diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1ce5fe..74aa23a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,36 +15,26 @@ jobs: - run: deno fmt --check # TODO # - run: deno lint - - test: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest] - node-version: ["20.x"] - - runs-on: ${{ matrix.platform }} + build: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js lts/* uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v3 - with: - version: 8 - - uses: oven-sh/setup-bun@v1 - - run: corepack enable yarn + cache: "npm" + node-version: "lts/*" - - run: npm i - - run: npm run build --if-present - - run: npm test + - run: npm ci + - run: node --run build - test-win: + test: strategy: + fail-fast: false # prevent a failure in other versions run cancelling others matrix: - platform: [windows-latest] - node-version: ["20.x"] + platform: [ubuntu-latest, macos-latest, windows-latest] + node-version: ["22.x", "24.x"] runs-on: ${{ matrix.platform }} @@ -53,12 +43,13 @@ jobs: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: + cache: "npm" node-version: ${{ matrix.node-version }} - uses: pnpm/action-setup@v3 with: version: 8 + - uses: oven-sh/setup-bun@v1 - run: corepack enable yarn - - run: npm i - - run: npm run build --if-present - - run: npm test + - run: npm ci + - run: node --run test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3af0561..bbbb484 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: # Setup .npmrc file to publish to npm - uses: actions/setup-node@v3 with: - node-version: "20.x" + node-version: "22.x" registry-url: "https://registry.npmjs.org" - run: npm ci - run: npm publish diff --git a/package-lock.json b/package-lock.json index ff8f41a..e54a795 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,24 +16,9 @@ "jsr": "dist/bin.js" }, "devDependencies": { - "@types/mocha": "^10.0.6", "@types/node": "^22.9.0", - "mocha": "^10.3.0", "rimraf": "^5.0.5", - "ts-node": "^10.9.2", - "typescript": "^5.3.3" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" + "typescript": "^5.8.3" } }, "node_modules/@isaacs/cliui": { @@ -53,31 +38,6 @@ "node": ">=12" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -88,36 +48,6 @@ "node": ">=14" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true - }, - "node_modules/@types/mocha": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", - "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", - "dev": true - }, "node_modules/@types/node": { "version": "22.15.32", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.32.tgz", @@ -128,36 +58,6 @@ "undici-types": "~6.21.0" } }, - "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", @@ -182,46 +82,12 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -231,190 +97,6 @@ "balanced-match": "^1.0.0" } }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -433,12 +115,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -453,50 +129,6 @@ "node": ">= 8" } }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -509,64 +141,6 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, - "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "bin": { - "flat": "cli.js" - } - }, "node_modules/foreground-child": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", @@ -583,35 +157,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, "node_modules/glob": { "version": "10.3.10", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", @@ -626,130 +171,21 @@ }, "bin": { "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, + }, "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/isexe": { @@ -776,49 +212,6 @@ "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/lru-cache": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", @@ -828,12 +221,6 @@ "node": "14 || >=16.14" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -858,87 +245,6 @@ "node": ">=16 || 14 >=14.17" } }, - "node_modules/mocha": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz", - "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==", - "dev": true, - "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "8.1.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": ">= 14.0.0" - } - }, - "node_modules/mocha/node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/mocha/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, "node_modules/node-stream-zip": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/node-stream-zip/-/node-stream-zip-1.15.0.tgz", @@ -951,63 +257,6 @@ "url": "https://github.com/sponsors/antelle" } }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -1033,48 +282,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/rimraf": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", @@ -1093,26 +300,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/semiver": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz", @@ -1121,15 +308,6 @@ "node": ">=6" } }, - "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -1259,93 +437,12 @@ "node": ">=8" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -1361,12 +458,6 @@ "dev": true, "license": "MIT" }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1382,12 +473,6 @@ "node": ">= 8" } }, - "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", @@ -1478,125 +563,6 @@ "engines": { "node": ">=8" } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } } } } diff --git a/package.json b/package.json index 2d64e0c..ac64b72 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,11 @@ } }, "scripts": { - "test": "mocha -r ts-node/register --extensions ts,tsx --timeout 30000 --watch-files src,test 'test/**/*.test.ts'", - "cli": "ts-node src/bin.ts", + "test": "node --no-warnings --test --experimental-strip-types test/**.test.ts", + "test:coverage": "node --no-warnings --test --experimental-strip-types --experimental-test-coverage --test-coverage-exclude='**/.cache/**' --test-coverage-exclude='test/**' test/**.test.ts", + "cli": "node --no-warnings --experimental-strip-types src/bin.ts", "build": "rimraf dist dist-esm && tsc && tsc -p tsconfig.esm.json", - "prepack": "npm run build" + "prepack": "node --run build" }, "keywords": [ "install", @@ -38,12 +39,9 @@ "dist-esm/" ], "devDependencies": { - "@types/mocha": "^10.0.6", "@types/node": "^22.9.0", - "mocha": "^10.3.0", "rimraf": "^5.0.5", - "ts-node": "^10.9.2", - "typescript": "^5.3.3" + "typescript": "^5.8.3" }, "dependencies": { "node-stream-zip": "^1.15.0", diff --git a/src/api.ts b/src/api.ts index 1aa2aac..d8e37a8 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,4 +1,4 @@ -import { JsrPackage } from "./utils"; +import { JsrPackage } from "./utils.ts"; export const JSR_URL = process.env.JSR_URL ?? "https://jsr.io"; diff --git a/src/bin.ts b/src/bin.ts index 67d9290..985c5c6 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -9,7 +9,7 @@ import { remove, runScript, showPackageInfo, -} from "./commands"; +} from "./commands.ts"; import { ExecError, findProjectDir, @@ -18,8 +18,8 @@ import { prettyTime, setDebug, styleText, -} from "./utils"; -import { PkgManagerName } from "./pkg_manager"; +} from "./utils.ts"; +import type { PkgManagerName } from "./pkg_manager.ts"; const args = process.argv.slice(2); @@ -149,6 +149,7 @@ if (args.length === 0) { // frequently. if (cmd === "publish") { const binFolder = path.join(__dirname, "..", ".download"); + run(async () => { const projectInfo = await findProjectDir(process.cwd()); return publish(process.cwd(), { diff --git a/src/commands.ts b/src/commands.ts index b20aef6..3007a33 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,17 +1,22 @@ // Copyright 2024 the JSR authors. MIT license. import * as path from "node:path"; import * as fs from "node:fs"; -import { styleText } from "./utils"; import { exec, fileExists, getNewLineChars, JsrPackage, + styleText, timeAgo, -} from "./utils"; -import { Bun, getPkgManager, PkgManagerName, YarnBerry } from "./pkg_manager"; -import { downloadDeno, getDenoDownloadUrl } from "./download"; -import { getNpmPackageInfo, getPackageMeta } from "./api"; +} from "./utils.ts"; +import { + Bun, + getPkgManager, + type PkgManagerName, + YarnBerry, +} from "./pkg_manager.ts"; +import { downloadDeno, getDenoDownloadUrl } from "./download.ts"; +import { getNpmPackageInfo, getPackageMeta } from "./api.ts"; import semiver from "semiver"; const NPMRC_FILE = ".npmrc"; diff --git a/src/download.ts b/src/download.ts index 6d7fe54..7935c2b 100644 --- a/src/download.ts +++ b/src/download.ts @@ -4,8 +4,10 @@ import * as fs from "node:fs"; import * as path from "node:path"; import * as util from "node:util"; import * as stream from "node:stream"; -import * as StreamZip from "node-stream-zip"; -import { styleText } from "./utils"; +import StreamZipPkg from "node-stream-zip"; +import { styleText } from "./utils.ts"; + +const { async } = StreamZipPkg; const streamFinished = util.promisify(stream.finished); @@ -95,7 +97,7 @@ export async function downloadDeno( const file = path.join(binFolder, info.filename); await fs.promises.rename(tmpFile, file); - const zip = new StreamZip.async({ file }); + const zip = new async({ file }); await zip.extract(null, binFolder); await zip.close(); diff --git a/src/index.ts b/src/index.ts index b8d05e5..cd52fdf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,4 @@ // Copyright 2024 the JSR authors. MIT license. -export { - install, - type InstallOptions, - publish, - type PublishOptions, - remove, -} from "./commands"; -export { JsrPackage, JsrPackageNameError } from "./utils"; +export { install, publish, remove } from "./commands.ts"; +export type { InstallOptions, PublishOptions } from "./commands.ts"; +export { JsrPackage, JsrPackageNameError } from "./utils.ts"; diff --git a/src/pkg_manager.ts b/src/pkg_manager.ts index 6d07cba..c3cbb61 100644 --- a/src/pkg_manager.ts +++ b/src/pkg_manager.ts @@ -1,9 +1,14 @@ // Copyright 2024 the JSR authors. MIT license. -import { getLatestPackageVersion } from "./api"; -import { InstallOptions } from "./commands"; -import { exec, findProjectDir, JsrPackage, logDebug } from "./utils"; -import { styleText } from "./utils"; import semiver from "semiver"; +import { getLatestPackageVersion } from "./api.ts"; +import type { InstallOptions } from "./commands.ts"; +import { + exec, + findProjectDir, + JsrPackage, + logDebug, + styleText, +} from "./utils.ts"; async function execWithLog(cmd: string, args: string[], cwd: string) { console.log(styleText("dim", `$ ${cmd} ${args.join(" ")}`)); @@ -53,7 +58,11 @@ export interface PackageManager { } class Npm implements PackageManager { - constructor(public cwd: string) {} + public cwd: string; + + constructor(cwd: string) { + this.cwd = cwd; + } async install(packages: JsrPackage[], options: InstallOptions) { const args = ["install"]; @@ -80,7 +89,11 @@ class Npm implements PackageManager { } class Yarn implements PackageManager { - constructor(public cwd: string) {} + public cwd: string; + + constructor(cwd: string) { + this.cwd = cwd; + } async install(packages: JsrPackage[], options: InstallOptions) { const args = ["add"]; @@ -133,7 +146,11 @@ export class YarnBerry extends Yarn { } class Pnpm implements PackageManager { - constructor(public cwd: string) {} + public cwd: string; + + constructor(cwd: string) { + this.cwd = cwd; + } async install(packages: JsrPackage[], options: InstallOptions) { const args = ["add"]; @@ -159,7 +176,11 @@ class Pnpm implements PackageManager { } export class Bun implements PackageManager { - constructor(public cwd: string) {} + public cwd: string; + + constructor(cwd: string) { + this.cwd = cwd; + } async install(packages: JsrPackage[], options: InstallOptions) { const args = ["add"]; diff --git a/src/utils.ts b/src/utils.ts index 4273d41..7bc7259 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -2,8 +2,8 @@ import * as path from "node:path"; import * as fs from "node:fs"; import * as util from "node:util"; -import { PkgManagerName } from "./pkg_manager"; import { spawn } from "node:child_process"; +import type { PkgManagerName } from "./pkg_manager.ts"; export let DEBUG = false; export function setDebug(enabled: boolean) { @@ -21,6 +21,19 @@ const EXTRACT_REG_PROXY = /^@jsr\/([a-z0-9-]+)__([a-z0-9-]+)(@(.+))?$/; export class JsrPackageNameError extends Error {} export class JsrPackage { + public scope: string; + public name: string; + public version: string | null; + private constructor( + scope: string, + name: string, + version: string | null, + ) { + this.scope = scope; + this.name = name; + this.version = version; + } + static from(input: string) { const exactMatch = input.match(EXTRACT_REG); if (exactMatch !== null) { @@ -43,12 +56,6 @@ export class JsrPackage { ); } - private constructor( - public scope: string, - public name: string, - public version: string | null, - ) {} - toNpmPackage(): string { const version = this.version !== null ? `@${this.version}` : ""; return `@jsr/${this.scope}__${this.name}${version}`; @@ -207,8 +214,11 @@ export function timeAgo(diff: number) { } export class ExecError extends Error { - constructor(public code: number) { + public code: number; + + constructor(code: number) { super(`Child process exited with: ${code}`); + this.code = code; } } @@ -253,8 +263,14 @@ export async function exec( return new Promise((resolve, reject) => { cp.on("exit", (code) => { - if (code === 0) resolve({ combined, stdout, stderr }); - else reject(new ExecError(code ?? 1)); + if (code === 0) { + resolve({ combined, stdout, stderr }); + } else { + console.log(`Command: ${cmd} ${args.join(" ")}`); + console.log(`CWD: ${cwd}`); + console.log(`Output: ${combined}`); + reject(new ExecError(code ?? 1)); + } }); }); } diff --git a/test/commands.test.ts b/test/commands.test.ts index 24305fe..6a6ff71 100644 --- a/test/commands.test.ts +++ b/test/commands.test.ts @@ -1,25 +1,27 @@ -import * as path from "path"; -import * as fs from "fs"; +import * as path from "node:path"; +import * as fs from "node:fs"; +import * as assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { - DenoJson, + type DenoJson, enableYarnBerry, isDirectory, isFile, runInTempDir, runJsr, withTempEnv, -} from "./test_utils"; -import * as assert from "node:assert/strict"; +} from "./test_utils.ts"; import { exec, ExecError, - PkgJson, + type PkgJson, readJson, readTextFile, + styleText, writeJson, writeTextFile, -} from "../src/utils"; -import { Bun } from "../src/pkg_manager"; +} from "../src/utils.ts"; +import { Bun } from "../src/pkg_manager.ts"; describe("general", () => { it("exit 1 on unknown command", async () => { @@ -183,7 +185,8 @@ describe("install", () => { await runJsr(["i", "--pnpm", "@std/encoding"], path.join(dir, "sub")); - assert.deepEqual( + // in some case pnpm add `packageManager` key to package.json + assert.partialDeepStrictEqual( await readJson(path.join(dir, "package.json")), parentPkgJson, ); @@ -271,23 +274,21 @@ describe("install", () => { }); }); - if (process.platform !== "win32") { - await withTempEnv( - ["i", "--bun", "--save-dev", "@std/encoding@0.216.0"], - async (dir) => { - assert.ok( - await isFile(path.join(dir, "bun.lock")), - "bun lockfile not created", - ); - const pkgJson = await readJson( - path.join(dir, "package.json"), - ); - assert.deepEqual(pkgJson.devDependencies, { - "@std/encoding": "npm:@jsr/std__encoding@0.216.0", - }); - }, - ); - } + await withTempEnv( + ["i", "--bun", "--save-dev", "@std/encoding@0.216.0"], + async (dir) => { + assert.ok( + await isFile(path.join(dir, "bun.lock")), + "bun lockfile not created", + ); + const pkgJson = await readJson( + path.join(dir, "package.json"), + ); + assert.deepEqual(pkgJson.devDependencies, { + "@std/encoding": "npm:@jsr/std__encoding@0.216.0", + }); + }, + ); }); it("jsr add -O @std/encoding@0.216.0 - dev dependency", async () => { @@ -327,23 +328,21 @@ describe("install", () => { }); }); - if (process.platform !== "win32") { - await withTempEnv( - ["i", "--bun", "--save-optional", "@std/encoding@0.216.0"], - async (dir) => { - assert.ok( - await isFile(path.join(dir, "bun.lock")), - "bun lockfile not created", - ); - const pkgJson = await readJson( - path.join(dir, "package.json"), - ); - assert.deepEqual(pkgJson.optionalDependencies, { - "@std/encoding": "npm:@jsr/std__encoding@0.216.0", - }); - }, - ); - } + await withTempEnv( + ["i", "--bun", "--save-optional", "@std/encoding@0.216.0"], + async (dir) => { + assert.ok( + await isFile(path.join(dir, "bun.lock")), + "bun lockfile not created", + ); + const pkgJson = await readJson( + path.join(dir, "package.json"), + ); + assert.deepEqual(pkgJson.optionalDependencies, { + "@std/encoding": "npm:@jsr/std__encoding@0.216.0", + }); + }, + ); }); it("jsr i - runs ' install' instead", async () => { @@ -433,54 +432,53 @@ describe("install", () => { }); }); - if (process.platform !== "win32") { - it("jsr add --bun @std/encoding@0.216.0 - forces bun", async () => { - await withTempEnv( - ["i", "--bun", "@std/encoding@0.216.0"], - async (dir) => { + it("jsr add --bun @std/encoding@0.216.0 - forces bun", async () => { + await withTempEnv( + ["i", "--bun", "@std/encoding@0.216.0"], + async (dir) => { + assert.ok( + await isFile(path.join(dir, "bun.lock")), + "bun lockfile not created", + ); + + const bun = new Bun(dir); + + if (await bun.isNpmrcSupported()) { + const npmrcPath = path.join(dir, ".npmrc"); + const npmRc = await readTextFile(npmrcPath); assert.ok( - await isFile(path.join(dir, "bun.lock")), - "bun lockfile not created", + npmRc.includes("@jsr:registry=https://npm.jsr.io"), + "Missing npmrc registry", ); + } else { + const config = await readTextFile(path.join(dir, "bunfig.toml")); + assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); + } + }, + ); + }); - const bun = new Bun(dir); - - if (await bun.isNpmrcSupported()) { - const npmrcPath = path.join(dir, ".npmrc"); - const npmRc = await readTextFile(npmrcPath); - assert.ok( - npmRc.includes("@jsr:registry=https://npm.jsr.io"), - "Missing npmrc registry", - ); - } else { - const config = await readTextFile(path.join(dir, "bunfig.toml")); - assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); - } - }, - ); - }); - it("jsr add --bun @std/encoding@0.216.0 - forces bun for twice", async () => { - await withTempEnv( - ["i", "--bun", "@std/encoding@0.216.0"], - async (dir) => { - await runJsr(["i", "--bun", "@std/encoding@0.216.0"], dir); - - const bun = new Bun(dir); - if (await bun.isNpmrcSupported()) { - const npmrcPath = path.join(dir, ".npmrc"); - const npmRc = await readTextFile(npmrcPath); - assert.ok( - npmRc.includes("@jsr:registry=https://npm.jsr.io"), - "Missing npmrc registry", - ); - } else { - const config = await readTextFile(path.join(dir, "bunfig.toml")); - assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); - } - }, - ); - }); - } + it("jsr add --bun @std/encoding@0.216.0 - forces bun for twice", async () => { + await withTempEnv( + ["i", "--bun", "@std/encoding@0.216.0"], + async (dir) => { + await runJsr(["i", "--bun", "@std/encoding@0.216.0"], dir); + + const bun = new Bun(dir); + if (await bun.isNpmrcSupported()) { + const npmrcPath = path.join(dir, ".npmrc"); + const npmRc = await readTextFile(npmrcPath); + assert.ok( + npmRc.includes("@jsr:registry=https://npm.jsr.io"), + "Missing npmrc registry", + ); + } else { + const config = await readTextFile(path.join(dir, "bunfig.toml")); + assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); + } + }, + ); + }); describe("env detection", () => { it("detect pnpm from npm_config_user_agent", async () => { @@ -577,26 +575,24 @@ describe("install", () => { }); }); - if (process.platform !== "win32") { - it("detect bun from npm_config_user_agent", async () => { - await withTempEnv( - ["i", "@std/encoding@0.216.0"], - async (dir) => { - assert.ok( - await isFile(path.join(dir, "bun.lock")), - "bun lockfile not created", - ); - }, - { - env: { - ...process.env, - npm_config_user_agent: - `bun/1.0.29 ${process.env.npm_config_user_agent}`, - }, + it("detect bun from npm_config_user_agent", async () => { + await withTempEnv( + ["i", "@std/encoding@0.216.0"], + async (dir) => { + assert.ok( + await isFile(path.join(dir, "bun.lock")), + "bun lockfile not created", + ); + }, + { + env: { + ...process.env, + npm_config_user_agent: + `bun/1.0.29 ${process.env.npm_config_user_agent}`, }, - ); - }); - } + }, + ); + }); }); }); @@ -657,7 +653,7 @@ describe("remove", () => { }); describe("publish", () => { - it("should publish a package", async () => { + it("should publish a package", { timeout: 600000 }, async () => { await runInTempDir(async (dir) => { const pkgJsonPath = path.join(dir, "package.json"); const pkgJson = await readJson(pkgJsonPath); @@ -671,8 +667,7 @@ describe("publish", () => { "export const value = 42;", ); - // TODO: Change this once deno supports jsr.json - await writeJson(path.join(dir, "deno.json"), { + await writeJson(path.join(dir, "jsr.json"), { name: "@deno/jsr-cli-test", version: pkgJson.version!, license: "MIT", @@ -683,9 +678,11 @@ describe("publish", () => { await runJsr(["publish", "--dry-run"], dir); }); - }).timeout(600000); + }); - it("should not add unstable publish flags for a Deno project", async () => { + it("should not add unstable publish flags for a Deno project", { + timeout: 600000, + }, async () => { await runInTempDir(async (dir) => { const pkgJsonPath = path.join(dir, "package.json"); await fs.promises.rm(pkgJsonPath); @@ -711,7 +708,7 @@ describe("publish", () => { assert.ok(err instanceof ExecError, `Unknown exec error thrown`); } }); - }).timeout(600000); + }); it("should leave node_modules as is", async () => { await runInTempDir(async (dir) => { @@ -761,8 +758,7 @@ describe("publish", () => { "export const value = 42;", ); - // TODO: Change this once deno supports jsr.json - await writeJson(path.join(dir, "deno.json"), { + await writeJson(path.join(dir, "jsr.json"), { name: "@deno/jsr-cli-test", version: "1.0.0", license: "MIT", @@ -772,7 +768,7 @@ describe("publish", () => { }); await runJsr(["publish", "--dry-run", "--non-existant-option"], dir, { - DENO_BIN_PATH: path.join(__dirname, "fixtures", "dummy.js"), + DENO_BIN_PATH: path.join(import.meta.dirname, "fixtures", "dummy.js"), }); }); }); @@ -784,8 +780,7 @@ describe("publish", () => { "export const value = 42;", ); - // TODO: Change this once deno supports jsr.json - await writeJson(path.join(dir, "deno.json"), { + await writeJson(path.join(dir, "jsr.json"), { name: "@deno/jsr-cli-test", version: "1.0.0", license: "MIT", @@ -865,7 +860,7 @@ describe("show", () => { true, ); - assert.ok(output.combined.includes("latest: -")); + assert.ok(output.combined.includes("latest: " + styleText("magenta", "-"))); assert.ok(output.combined.includes("npm tarball:")); }); }); diff --git a/test/test_utils.ts b/test/test_utils.ts index 9b8eb20..045d070 100644 --- a/test/test_utils.ts +++ b/test/test_utils.ts @@ -1,7 +1,9 @@ import * as fs from "node:fs"; import * as path from "node:path"; import * as os from "node:os"; -import { exec, writeJson } from "../src/utils"; +import * as module from "node:module"; +import { isMainThread } from "node:worker_threads"; +import { exec, writeJson } from "../src/utils.ts"; export interface DenoJson { name: string; @@ -10,6 +12,16 @@ export interface DenoJson { license: string; } +/** + * By default when node run ts file it's in ESM context so __dirname is not defined. + * But we use it in source code and `tsc` transpiles to ESM/CJS + * So we need to deifnefpr test context. + */ +if (isMainThread && "register" in module) { + const __dirname = import.meta.dirname; + globalThis.__dirname = __dirname; +} + /** * This sets the `packageManager` field in the `package.json` of the * specified directory to be the latest modern stable version of yarn. @@ -24,13 +36,26 @@ export async function runJsr( env: Record = {}, captureOutput = false, ) { - const bin = path.join(__dirname, "..", "src", "bin.ts"); - const tsNode = path.join(__dirname, "..", "node_modules", ".bin", "ts-node"); - return await exec(tsNode, [bin, ...args], cwd, { - ...process.env, - npm_config_user_agent: undefined, - ...env, - }, captureOutput); + const bin = path.resolve("src", "bin.ts"); + + return await exec( + "node", + [ + "--no-warnings", + "--import", + import.meta.resolve("./test_utils.ts"), + "--experimental-strip-types", + bin, + ...args, + ], + cwd, + { + ...process.env, + npm_config_user_agent: undefined, + ...env, + }, + captureOutput, + ); } export async function runInTempDir(fn: (dir: string) => Promise) { diff --git a/test/unit.test.ts b/test/unit.test.ts index c221d14..aa3fb25 100644 --- a/test/unit.test.ts +++ b/test/unit.test.ts @@ -1,8 +1,9 @@ -import * as path from "path"; -import { runInTempDir } from "./test_utils"; -import { setupNpmRc } from "../src/commands"; -import * as assert from "assert/strict"; -import { readTextFile, writeTextFile } from "../src/utils"; +import * as path from "node:path"; +import * as assert from "node:assert/strict"; +import { describe, it } from "node:test"; +import { runInTempDir } from "./test_utils.ts"; +import { setupNpmRc } from "../src/commands.ts"; +import { readTextFile, writeTextFile } from "../src/utils.ts"; describe("npmrc", () => { it("doesn't overwrite exising jsr mapping", async () => { diff --git a/test/utils.test.ts b/test/utils.test.ts index 359fad7..50bd83e 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -1,13 +1,14 @@ -import * as assert from "assert/strict"; +import * as assert from "node:assert/strict"; import * as path from "node:path"; -import { runInTempDir } from "./test_utils"; +import { describe, it } from "node:test"; +import { runInTempDir } from "./test_utils.ts"; import { findProjectDir, JsrPackage, - PkgJson, + type PkgJson, writeJson, writeTextFile, -} from "../src/utils"; +} from "../src/utils.ts"; describe("findProjectDir", () => { it("should return npm if package-lock.json is found", async () => { diff --git a/tsconfig.esm.json b/tsconfig.esm.json index fae3408..35a6041 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -3,9 +3,10 @@ "compilerOptions": { "module": "NodeNext", "target": "ESNext", - "strict": true, - "outDir": "dist-esm/", - "declaration": true + "moduleResolution": "NodeNext", + "outDir": "dist-esm/" }, - "include": ["src"] + "include": ["src"], + // we don't want to compile the bin file in ESM mode + "exclude": ["src/bin.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 310add3..8493f49 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,14 @@ { "compilerOptions": { - "module": "CommonJS", - "target": "ESNext", + "target": "esnext", + "module": "commonjs", + "rewriteRelativeImportExtensions": true, + "erasableSyntaxOnly": true, + "esModuleInterop": true, + "outDir": "dist", "strict": true, - "outDir": "dist/", "declaration": true, - "sourceMap": true, - "isolatedModules": true, - "esModuleInterop": true + "sourceMap": true }, "include": ["src"] }