From 9ac13b2df2d0f98d4b96e57bbfcba9cf096edab1 Mon Sep 17 00:00:00 2001 From: Weiliang Li Date: Wed, 23 Oct 2024 15:53:17 +0900 Subject: [PATCH] Check commonjs require in CI --- .github/workflows/ci.yml | 2 + CHANGELOG.md | 4 ++ example/runtime/require.cjs | 10 +++++ package.json | 46 ++++++++++---------- pnpm-lock.yaml | 85 +++++++++++++++++-------------------- 5 files changed, 78 insertions(+), 69 deletions(-) create mode 100644 example/runtime/require.cjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6202619..5c67e8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,3 +54,5 @@ jobs: - run: bun run example/runtime/main.js - run: deno run --allow-read example/runtime/main.js - run: node example/runtime/main.js + - run: node example/runtime/import.js + - run: node example/runtime/require.cjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 24aa5c8..448b059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog +## 0.4.10 + +- Fix commonjs build + ## 0.4.9 - Add examples diff --git a/example/runtime/require.cjs b/example/runtime/require.cjs new file mode 100644 index 0000000..f6d8e5a --- /dev/null +++ b/example/runtime/require.cjs @@ -0,0 +1,10 @@ +const { ECIES_CONFIG, utils: _utils } = require("eciesjs"); +const config = require("eciesjs/config"); +const consts = require("eciesjs/consts"); +const utils = require("eciesjs/utils"); + +console.log("ECIES_CONFIG:", ECIES_CONFIG); +console.log("config:", config); +console.log("consts:", consts); +console.log("utils:", utils); +console.log("index utils:", _utils); diff --git a/package.json b/package.json index 2e462bc..f6f0f58 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "type": "git", "url": "git+https://github.com/ecies/js.git" }, - "version": "0.4.9", + "version": "0.4.10", "engines": { "node": ">=16.0.0" }, @@ -31,27 +31,27 @@ "dist" ], "exports": { - ".": { - "types": "./dist/index.d.ts", - "require": "./dist/index.js", - "import": "./dist/index.js" - }, - "./config": { - "types": "./dist/config.d.ts", - "import": "./dist/config.js", - "require": "./dist/config.js" - }, - "./consts": { - "types": "./dist/consts.d.ts", - "import": "./dist/consts.js", - "require": "./dist/consts.js" - }, - "./utils": { - "types": "./dist/utils/index.d.ts", - "import": "./dist/utils/index.js", - "require": "./dist/utils/index.js" - } - }, + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js", + "import": "./dist/index.js" + }, + "./config": { + "types": "./dist/config.d.ts", + "import": "./dist/config.js", + "require": "./dist/config.js" + }, + "./consts": { + "types": "./dist/consts.d.ts", + "import": "./dist/consts.js", + "require": "./dist/consts.js" + }, + "./utils": { + "types": "./dist/utils/index.d.ts", + "import": "./dist/utils/index.js", + "require": "./dist/utils/index.js" + } + }, "scripts": { "build": "npx tsc", "test": "vitest" @@ -63,7 +63,7 @@ "@noble/hashes": "^1.5.0" }, "devDependencies": { - "@types/node": "^22.7.8", + "@types/node": "^22.7.9", "@vitest/coverage-v8": "^2.1.3", "typescript": "^5.6.3", "undici": "^6.20.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d0ef44..b0005c6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,11 +22,11 @@ importers: version: 1.5.0 devDependencies: '@types/node': - specifier: ^22.7.8 - version: 22.7.8 + specifier: ^22.7.9 + version: 22.7.9 '@vitest/coverage-v8': specifier: ^2.1.3 - version: 2.1.3(vitest@2.1.3(@types/node@22.7.8)) + version: 2.1.3(vitest@2.1.3(@types/node@22.7.9)) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -35,7 +35,7 @@ importers: version: 6.20.1 vitest: specifier: ^2.1.3 - version: 2.1.3(@types/node@22.7.8) + version: 2.1.3(@types/node@22.7.9) packages: @@ -43,21 +43,21 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} - '@babel/helper-string-parser@7.25.7': - resolution: {integrity: sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==} + '@babel/helper-string-parser@7.25.9': + resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.25.7': - resolution: {integrity: sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==} + '@babel/helper-validator-identifier@7.25.9': + resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} engines: {node: '>=6.9.0'} - '@babel/parser@7.25.8': - resolution: {integrity: sha512-HcttkxzdPucv3nNFmfOOMfFf64KgdJVqm1KaCm25dPGMLElo9nsLvXeJECQg8UzPuBGLyTSA0ZzqCtDSzKTEoQ==} + '@babel/parser@7.25.9': + resolution: {integrity: sha512-aI3jjAAO1fh7vY/pBGsn1i9LDbRP43+asrRlkPuTXW5yHXtd1NgTEMudbBoDDxrf1daEEfPJqR+JBMakzrR4Dg==} engines: {node: '>=6.0.0'} hasBin: true - '@babel/types@7.25.8': - resolution: {integrity: sha512-JWtuCu8VQsMladxVz/P4HzHUGCAwpuqacmowgXFs5XjxIgKuNjnLokQzuVjlTvIzODaDmpjT3oxcC48vyk9EWg==} + '@babel/types@7.25.9': + resolution: {integrity: sha512-OwS2CM5KocvQ/k7dFJa8i5bNGJP0hXWfVCfDkqRFP1IreH1JDC7wG6eCYCi0+McbfT8OR/kNqsI0UU0xP9H6PQ==} engines: {node: '>=6.9.0'} '@bcoe/v8-coverage@0.2.3': @@ -332,8 +332,8 @@ packages: '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} - '@types/node@22.7.8': - resolution: {integrity: sha512-a922jJy31vqR5sk+kAdIENJjHblqcZ4RmERviFsER4WJcEONqxKcjNOlk0q7OUfrF5sddT+vng070cdfMlrPLg==} + '@types/node@22.7.9': + resolution: {integrity: sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg==} '@vitest/coverage-v8@2.1.3': resolution: {integrity: sha512-2OJ3c7UPoFSmBZwqD2VEkUw6A/tzPF0LmW0ZZhhB8PFxuc+9IBG/FaSM+RLEenc7ljzFvGN+G0nGQoZnh7sy2A==} @@ -633,10 +633,6 @@ packages: resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} engines: {node: '>=14.0.0'} - to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - typescript@5.6.3: resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} engines: {node: '>=14.17'} @@ -654,8 +650,8 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true - vite@5.4.9: - resolution: {integrity: sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==} + vite@5.4.10: + resolution: {integrity: sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -735,19 +731,18 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@babel/helper-string-parser@7.25.7': {} + '@babel/helper-string-parser@7.25.9': {} - '@babel/helper-validator-identifier@7.25.7': {} + '@babel/helper-validator-identifier@7.25.9': {} - '@babel/parser@7.25.8': + '@babel/parser@7.25.9': dependencies: - '@babel/types': 7.25.8 + '@babel/types': 7.25.9 - '@babel/types@7.25.8': + '@babel/types@7.25.9': dependencies: - '@babel/helper-string-parser': 7.25.7 - '@babel/helper-validator-identifier': 7.25.7 - to-fast-properties: 2.0.0 + '@babel/helper-string-parser': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 '@bcoe/v8-coverage@0.2.3': {} @@ -913,11 +908,11 @@ snapshots: '@types/estree@1.0.6': {} - '@types/node@22.7.8': + '@types/node@22.7.9': dependencies: undici-types: 6.19.8 - '@vitest/coverage-v8@2.1.3(vitest@2.1.3(@types/node@22.7.8))': + '@vitest/coverage-v8@2.1.3(vitest@2.1.3(@types/node@22.7.9))': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 @@ -931,7 +926,7 @@ snapshots: std-env: 3.7.0 test-exclude: 7.0.1 tinyrainbow: 1.2.0 - vitest: 2.1.3(@types/node@22.7.8) + vitest: 2.1.3(@types/node@22.7.9) transitivePeerDependencies: - supports-color @@ -942,13 +937,13 @@ snapshots: chai: 5.1.1 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.3(@vitest/spy@2.1.3)(vite@5.4.9(@types/node@22.7.8))': + '@vitest/mocker@2.1.3(@vitest/spy@2.1.3)(vite@5.4.10(@types/node@22.7.9))': dependencies: '@vitest/spy': 2.1.3 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - vite: 5.4.9(@types/node@22.7.8) + vite: 5.4.10(@types/node@22.7.9) '@vitest/pretty-format@2.1.3': dependencies: @@ -1121,8 +1116,8 @@ snapshots: magicast@0.3.5: dependencies: - '@babel/parser': 7.25.8 - '@babel/types': 7.25.8 + '@babel/parser': 7.25.9 + '@babel/types': 7.25.9 source-map-js: 1.2.1 make-dir@4.0.0: @@ -1240,20 +1235,18 @@ snapshots: tinyspy@3.0.2: {} - to-fast-properties@2.0.0: {} - typescript@5.6.3: {} undici-types@6.19.8: {} undici@6.20.1: {} - vite-node@2.1.3(@types/node@22.7.8): + vite-node@2.1.3(@types/node@22.7.9): dependencies: cac: 6.7.14 debug: 4.3.7 pathe: 1.1.2 - vite: 5.4.9(@types/node@22.7.8) + vite: 5.4.10(@types/node@22.7.9) transitivePeerDependencies: - '@types/node' - less @@ -1265,19 +1258,19 @@ snapshots: - supports-color - terser - vite@5.4.9(@types/node@22.7.8): + vite@5.4.10(@types/node@22.7.9): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.24.0 optionalDependencies: - '@types/node': 22.7.8 + '@types/node': 22.7.9 fsevents: 2.3.3 - vitest@2.1.3(@types/node@22.7.8): + vitest@2.1.3(@types/node@22.7.9): dependencies: '@vitest/expect': 2.1.3 - '@vitest/mocker': 2.1.3(@vitest/spy@2.1.3)(vite@5.4.9(@types/node@22.7.8)) + '@vitest/mocker': 2.1.3(@vitest/spy@2.1.3)(vite@5.4.10(@types/node@22.7.9)) '@vitest/pretty-format': 2.1.3 '@vitest/runner': 2.1.3 '@vitest/snapshot': 2.1.3 @@ -1292,11 +1285,11 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.9(@types/node@22.7.8) - vite-node: 2.1.3(@types/node@22.7.8) + vite: 5.4.10(@types/node@22.7.9) + vite-node: 2.1.3(@types/node@22.7.9) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.7.8 + '@types/node': 22.7.9 transitivePeerDependencies: - less - lightningcss