From 095f3d1b56cf69c840e87537c877e1604ed156f1 Mon Sep 17 00:00:00 2001 From: Muhammad Bin Jamil Date: Sat, 18 May 2024 20:42:14 +0500 Subject: [PATCH] add esbuild --- .gitignore | 3 + .prettierrc.json | 6 + build.mjs | 22 +++ package.json | 28 ++++ pnpm-lock.yaml | 350 +++++++++++++++++++++++++++++++++++++++++++++++ src/index.ts | 1 + tsconfig.json | 14 ++ 7 files changed, 424 insertions(+) create mode 100644 .gitignore create mode 100644 .prettierrc.json create mode 100644 build.mjs create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d67a86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +node_modules +dist diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..f0eb61e --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "semi": true, + "singleQuote": false +} diff --git a/build.mjs b/build.mjs new file mode 100644 index 0000000..25faa43 --- /dev/null +++ b/build.mjs @@ -0,0 +1,22 @@ +import * as esbuild from "esbuild"; +import pkg from "./package.json" assert { type: "json" }; + +await Promise.all([ + // bundle for esm + esbuild.build({ + entryPoints: ["src/index.ts"], + bundle: true, + minify: true, + format: "esm", + outfile: pkg.module, + }), + + // bundle for commonjs + esbuild.build({ + entryPoints: ["src/index.ts"], + bundle: true, + minify: true, + format: "cjs", + outfile: pkg.main, + }), +]); diff --git a/package.json b/package.json new file mode 100644 index 0000000..64ffdbe --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "matomo-client", + "version": "1.0.0", + "description": "A thin wrapper around Matomo analytics", + "keywords": [ + "analytics" + ], + "license": "MIT", + "author": "Muhammad Bin Jamil", + "files": [ + "dist/matomo-client.cjs.js", + "dist/matomo-client.esm.js", + "dist/index.d.ts" + ], + "main": "dist/matomo-client.cjs.js", + "module": "dist/matomo-client.esm.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "npm run build:types && npm run build:js", + "build:js": "node build.mjs", + "build:types": "tsc --emitDeclarationOnly" + }, + "devDependencies": { + "esbuild": "^0.21.3", + "prettier": "^3.2.5", + "typescript": "^5.4.5" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..4aec57f --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,350 @@ +lockfileVersion: "9.0" + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + .: + devDependencies: + esbuild: + specifier: ^0.21.3 + version: 0.21.3 + prettier: + specifier: ^3.2.5 + version: 3.2.5 + typescript: + specifier: ^5.4.5 + version: 5.4.5 + +packages: + "@esbuild/aix-ppc64@0.21.3": + resolution: + { + integrity: sha512-yTgnwQpFVYfvvo4SvRFB0SwrW8YjOxEoT7wfMT7Ol5v7v5LDNvSGo67aExmxOb87nQNeWPVvaGBNfQ7BXcrZ9w==, + } + engines: { node: ">=12" } + cpu: [ppc64] + os: [aix] + + "@esbuild/android-arm64@0.21.3": + resolution: + { + integrity: sha512-c+ty9necz3zB1Y+d/N+mC6KVVkGUUOcm4ZmT5i/Fk5arOaY3i6CA3P5wo/7+XzV8cb4GrI/Zjp8NuOQ9Lfsosw==, + } + engines: { node: ">=12" } + cpu: [arm64] + os: [android] + + "@esbuild/android-arm@0.21.3": + resolution: + { + integrity: sha512-bviJOLMgurLJtF1/mAoJLxDZDL6oU5/ztMHnJQRejbJrSc9FFu0QoUoFhvi6qSKJEw9y5oGyvr9fuDtzJ30rNQ==, + } + engines: { node: ">=12" } + cpu: [arm] + os: [android] + + "@esbuild/android-x64@0.21.3": + resolution: + { + integrity: sha512-JReHfYCRK3FVX4Ra+y5EBH1b9e16TV2OxrPAvzMsGeES0X2Ndm9ImQRI4Ket757vhc5XBOuGperw63upesclRw==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [android] + + "@esbuild/darwin-arm64@0.21.3": + resolution: + { + integrity: sha512-U3fuQ0xNiAkXOmQ6w5dKpEvXQRSpHOnbw7gEfHCRXPeTKW9sBzVck6C5Yneb8LfJm0l6le4NQfkNPnWMSlTFUQ==, + } + engines: { node: ">=12" } + cpu: [arm64] + os: [darwin] + + "@esbuild/darwin-x64@0.21.3": + resolution: + { + integrity: sha512-3m1CEB7F07s19wmaMNI2KANLcnaqryJxO1fXHUV5j1rWn+wMxdUYoPyO2TnAbfRZdi7ADRwJClmOwgT13qlP3Q==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [darwin] + + "@esbuild/freebsd-arm64@0.21.3": + resolution: + { + integrity: sha512-fsNAAl5pU6wmKHq91cHWQT0Fz0vtyE1JauMzKotrwqIKAswwP5cpHUCxZNSTuA/JlqtScq20/5KZ+TxQdovU/g==, + } + engines: { node: ">=12" } + cpu: [arm64] + os: [freebsd] + + "@esbuild/freebsd-x64@0.21.3": + resolution: + { + integrity: sha512-tci+UJ4zP5EGF4rp8XlZIdq1q1a/1h9XuronfxTMCNBslpCtmk97Q/5qqy1Mu4zIc0yswN/yP/BLX+NTUC1bXA==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [freebsd] + + "@esbuild/linux-arm64@0.21.3": + resolution: + { + integrity: sha512-vvG6R5g5ieB4eCJBQevyDMb31LMHthLpXTc2IGkFnPWS/GzIFDnaYFp558O+XybTmYrVjxnryru7QRleJvmZ6Q==, + } + engines: { node: ">=12" } + cpu: [arm64] + os: [linux] + + "@esbuild/linux-arm@0.21.3": + resolution: + { + integrity: sha512-f6kz2QpSuyHHg01cDawj0vkyMwuIvN62UAguQfnNVzbge2uWLhA7TCXOn83DT0ZvyJmBI943MItgTovUob36SQ==, + } + engines: { node: ">=12" } + cpu: [arm] + os: [linux] + + "@esbuild/linux-ia32@0.21.3": + resolution: + { + integrity: sha512-HjCWhH7K96Na+66TacDLJmOI9R8iDWDDiqe17C7znGvvE4sW1ECt9ly0AJ3dJH62jHyVqW9xpxZEU1jKdt+29A==, + } + engines: { node: ">=12" } + cpu: [ia32] + os: [linux] + + "@esbuild/linux-loong64@0.21.3": + resolution: + { + integrity: sha512-BGpimEccmHBZRcAhdlRIxMp7x9PyJxUtj7apL2IuoG9VxvU/l/v1z015nFs7Si7tXUwEsvjc1rOJdZCn4QTU+Q==, + } + engines: { node: ">=12" } + cpu: [loong64] + os: [linux] + + "@esbuild/linux-mips64el@0.21.3": + resolution: + { + integrity: sha512-5rMOWkp7FQGtAH3QJddP4w3s47iT20hwftqdm7b+loe95o8JU8ro3qZbhgMRy0VuFU0DizymF1pBKkn3YHWtsw==, + } + engines: { node: ">=12" } + cpu: [mips64el] + os: [linux] + + "@esbuild/linux-ppc64@0.21.3": + resolution: + { + integrity: sha512-h0zj1ldel89V5sjPLo5H1SyMzp4VrgN1tPkN29TmjvO1/r0MuMRwJxL8QY05SmfsZRs6TF0c/IDH3u7XYYmbAg==, + } + engines: { node: ">=12" } + cpu: [ppc64] + os: [linux] + + "@esbuild/linux-riscv64@0.21.3": + resolution: + { + integrity: sha512-dkAKcTsTJ+CRX6bnO17qDJbLoW37npd5gSNtSzjYQr0svghLJYGYB0NF1SNcU1vDcjXLYS5pO4qOW4YbFama4A==, + } + engines: { node: ">=12" } + cpu: [riscv64] + os: [linux] + + "@esbuild/linux-s390x@0.21.3": + resolution: + { + integrity: sha512-vnD1YUkovEdnZWEuMmy2X2JmzsHQqPpZElXx6dxENcIwTu+Cu5ERax6+Ke1QsE814Zf3c6rxCfwQdCTQ7tPuXA==, + } + engines: { node: ">=12" } + cpu: [s390x] + os: [linux] + + "@esbuild/linux-x64@0.21.3": + resolution: + { + integrity: sha512-IOXOIm9WaK7plL2gMhsWJd+l2bfrhfilv0uPTptoRoSb2p09RghhQQp9YY6ZJhk/kqmeRt6siRdMSLLwzuT0KQ==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [linux] + + "@esbuild/netbsd-x64@0.21.3": + resolution: + { + integrity: sha512-uTgCwsvQ5+vCQnqM//EfDSuomo2LhdWhFPS8VL8xKf+PKTCrcT/2kPPoWMTs22aB63MLdGMJiE3f1PHvCDmUOw==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [netbsd] + + "@esbuild/openbsd-x64@0.21.3": + resolution: + { + integrity: sha512-vNAkR17Ub2MgEud2Wag/OE4HTSI6zlb291UYzHez/psiKarp0J8PKGDnAhMBcHFoOHMXHfExzmjMojJNbAStrQ==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [openbsd] + + "@esbuild/sunos-x64@0.21.3": + resolution: + { + integrity: sha512-W8H9jlGiSBomkgmouaRoTXo49j4w4Kfbl6I1bIdO/vT0+0u4f20ko3ELzV3hPI6XV6JNBVX+8BC+ajHkvffIJA==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [sunos] + + "@esbuild/win32-arm64@0.21.3": + resolution: + { + integrity: sha512-EjEomwyLSCg8Ag3LDILIqYCZAq/y3diJ04PnqGRgq8/4O3VNlXyMd54j/saShaN4h5o5mivOjAzmU6C3X4v0xw==, + } + engines: { node: ">=12" } + cpu: [arm64] + os: [win32] + + "@esbuild/win32-ia32@0.21.3": + resolution: + { + integrity: sha512-WGiE/GgbsEwR33++5rzjiYsKyHywE8QSZPF7Rfx9EBfK3Qn3xyR6IjyCr5Uk38Kg8fG4/2phN7sXp4NPWd3fcw==, + } + engines: { node: ">=12" } + cpu: [ia32] + os: [win32] + + "@esbuild/win32-x64@0.21.3": + resolution: + { + integrity: sha512-xRxC0jaJWDLYvcUvjQmHCJSfMrgmUuvsoXgDeU/wTorQ1ngDdUBuFtgY3W1Pc5sprGAvZBtWdJX7RPg/iZZUqA==, + } + engines: { node: ">=12" } + cpu: [x64] + os: [win32] + + esbuild@0.21.3: + resolution: + { + integrity: sha512-Kgq0/ZsAPzKrbOjCQcjoSmPoWhlcVnGAUo7jvaLHoxW1Drto0KGkR1xBNg2Cp43b9ImvxmPEJZ9xkfcnqPsfBw==, + } + engines: { node: ">=12" } + hasBin: true + + prettier@3.2.5: + resolution: + { + integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==, + } + engines: { node: ">=14" } + hasBin: true + + typescript@5.4.5: + resolution: + { + integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==, + } + engines: { node: ">=14.17" } + hasBin: true + +snapshots: + "@esbuild/aix-ppc64@0.21.3": + optional: true + + "@esbuild/android-arm64@0.21.3": + optional: true + + "@esbuild/android-arm@0.21.3": + optional: true + + "@esbuild/android-x64@0.21.3": + optional: true + + "@esbuild/darwin-arm64@0.21.3": + optional: true + + "@esbuild/darwin-x64@0.21.3": + optional: true + + "@esbuild/freebsd-arm64@0.21.3": + optional: true + + "@esbuild/freebsd-x64@0.21.3": + optional: true + + "@esbuild/linux-arm64@0.21.3": + optional: true + + "@esbuild/linux-arm@0.21.3": + optional: true + + "@esbuild/linux-ia32@0.21.3": + optional: true + + "@esbuild/linux-loong64@0.21.3": + optional: true + + "@esbuild/linux-mips64el@0.21.3": + optional: true + + "@esbuild/linux-ppc64@0.21.3": + optional: true + + "@esbuild/linux-riscv64@0.21.3": + optional: true + + "@esbuild/linux-s390x@0.21.3": + optional: true + + "@esbuild/linux-x64@0.21.3": + optional: true + + "@esbuild/netbsd-x64@0.21.3": + optional: true + + "@esbuild/openbsd-x64@0.21.3": + optional: true + + "@esbuild/sunos-x64@0.21.3": + optional: true + + "@esbuild/win32-arm64@0.21.3": + optional: true + + "@esbuild/win32-ia32@0.21.3": + optional: true + + "@esbuild/win32-x64@0.21.3": + optional: true + + esbuild@0.21.3: + optionalDependencies: + "@esbuild/aix-ppc64": 0.21.3 + "@esbuild/android-arm": 0.21.3 + "@esbuild/android-arm64": 0.21.3 + "@esbuild/android-x64": 0.21.3 + "@esbuild/darwin-arm64": 0.21.3 + "@esbuild/darwin-x64": 0.21.3 + "@esbuild/freebsd-arm64": 0.21.3 + "@esbuild/freebsd-x64": 0.21.3 + "@esbuild/linux-arm": 0.21.3 + "@esbuild/linux-arm64": 0.21.3 + "@esbuild/linux-ia32": 0.21.3 + "@esbuild/linux-loong64": 0.21.3 + "@esbuild/linux-mips64el": 0.21.3 + "@esbuild/linux-ppc64": 0.21.3 + "@esbuild/linux-riscv64": 0.21.3 + "@esbuild/linux-s390x": 0.21.3 + "@esbuild/linux-x64": 0.21.3 + "@esbuild/netbsd-x64": 0.21.3 + "@esbuild/openbsd-x64": 0.21.3 + "@esbuild/sunos-x64": 0.21.3 + "@esbuild/win32-arm64": 0.21.3 + "@esbuild/win32-ia32": 0.21.3 + "@esbuild/win32-x64": 0.21.3 + + prettier@3.2.5: {} + + typescript@5.4.5: {} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..5c0612c --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +console.log("hello bro"); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..f758e05 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES6", + "declaration": true, + "declarationDir": "dist", + "strict": true, + "isolatedModules": true, + "strictNullChecks": false, + "moduleResolution": "node" + }, + + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +}