From bf97ebc55abc0edd15fea6cea13b7b4180049fe5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 09:58:09 +0800 Subject: [PATCH 1/3] build(deps): bump the npm_and_yarn group across 2 directories with 1 update (#339) Bumps the npm_and_yarn group with 1 update in the /templates/v3/js-script-next-js directory: [next](https://github.com/vercel/next.js). Bumps the npm_and_yarn group with 1 update in the /templates/v3/next-js-template/frontend directory: [next](https://github.com/vercel/next.js). Updates `next` from 15.4.8 to 15.4.9 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v15.4.8...v15.4.9) Updates `next` from 15.4.8 to 15.4.9 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v15.4.8...v15.4.9) --- updated-dependencies: - dependency-name: next dependency-version: 15.4.9 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: next dependency-version: 15.4.9 dependency-type: direct:production dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../packages/frontend/package.json | 2 +- templates/v3/js-script-next-js/pnpm-lock.yaml | 28 +++++++++---------- .../frontend/package-lock.json | 16 +++++------ .../v3/next-js-template/frontend/package.json | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/templates/v3/js-script-next-js/packages/frontend/package.json b/templates/v3/js-script-next-js/packages/frontend/package.json index de11a62..80b4018 100644 --- a/templates/v3/js-script-next-js/packages/frontend/package.json +++ b/templates/v3/js-script-next-js/packages/frontend/package.json @@ -11,7 +11,7 @@ "dependencies": { "@ckb-ccc/connector-react": "^v1.0.14", "@ckb-ccc/lumos-patches": "^1.0.14", - "next": "^15.4.8", + "next": "^15.4.9", "react": "^18", "react-dom": "^18" }, diff --git a/templates/v3/js-script-next-js/pnpm-lock.yaml b/templates/v3/js-script-next-js/pnpm-lock.yaml index 8f19e20..e328db0 100644 --- a/templates/v3/js-script-next-js/pnpm-lock.yaml +++ b/templates/v3/js-script-next-js/pnpm-lock.yaml @@ -37,8 +37,8 @@ importers: specifier: ^1.0.14 version: 1.0.16(typescript@5.8.3) next: - specifier: ^15.4.8 - version: 15.4.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^15.4.9 + version: 15.4.9(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: specifier: ^18 version: 18.3.1 @@ -841,8 +841,8 @@ packages: '@nervosnetwork/ckb-types@0.109.5': resolution: {integrity: sha512-5jQNjFw76YCd+Ppl+0RvBWzxwvWaKfWC5wjVFFdNAieX7xksCHfZFIeow8je7AF8uVypwe56WlLBlblxw9NBBQ==} - '@next/env@15.4.8': - resolution: {integrity: sha512-LydLa2MDI1NMrOFSkO54mTc8iIHSttj6R6dthITky9ylXV2gCGi0bHQjVCtLGRshdRPjyh2kXbxJukDtBWQZtQ==} + '@next/env@15.4.9': + resolution: {integrity: sha512-OYR0RulK5phnbxxzcLE4/ECgfx1PL3EHrDbjyelJ7jauaO+/Qvj5gG8JPMltB51CygC2KrZ0aAfYLjPYjYY17A==} '@next/eslint-plugin-next@14.2.3': resolution: {integrity: sha512-L3oDricIIjgj1AVnRdRor21gI7mShlSwU/1ZGHmqM3LzHhXXhdkrfeNY5zif25Bi5Dd7fiJHsbhoZCHfXYvlAw==} @@ -1429,8 +1429,8 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - caniuse-lite@1.0.30001759: - resolution: {integrity: sha512-Pzfx9fOKoKvevQf8oCXoyNRQ5QyxJj+3O0Rqx2V5oxT61KGx8+n6hV/IUyJeifUci2clnmmKVpvtiqRzgiWjSw==} + caniuse-lite@1.0.30001760: + resolution: {integrity: sha512-7AAMPcueWELt1p3mi13HR/LHH0TJLT11cnwDJEs3xA4+CK/PLKeO9Kl1oru24htkyUKtkGCvAx4ohB0Ttry8Dw==} chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} @@ -2609,8 +2609,8 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - next@15.4.8: - resolution: {integrity: sha512-jwOXTz/bo0Pvlf20FSb6VXVeWRssA2vbvq9SdrOPEg9x8E1B27C2rQtvriAn600o9hH61kjrVRexEffv3JybuA==} + next@15.4.9: + resolution: {integrity: sha512-/NedNmbiH4Umt/7SohT9VKxEdBt02Lj33xHrukE7d8Li6juT+75sEq4a4U06jggrvdbklKgr78OZEyWZ8XRrtw==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} hasBin: true peerDependencies: @@ -4422,7 +4422,7 @@ snapshots: '@nervosnetwork/ckb-types@0.109.5': {} - '@next/env@15.4.8': {} + '@next/env@15.4.9': {} '@next/eslint-plugin-next@14.2.3': dependencies: @@ -4952,7 +4952,7 @@ snapshots: browserslist@4.24.4: dependencies: - caniuse-lite: 1.0.30001759 + caniuse-lite: 1.0.30001760 electron-to-chromium: 1.5.136 node-releases: 2.0.19 update-browserslist-db: 1.1.3(browserslist@4.24.4) @@ -5024,7 +5024,7 @@ snapshots: camelcase@6.3.0: {} - caniuse-lite@1.0.30001759: {} + caniuse-lite@1.0.30001760: {} chalk@4.1.2: dependencies: @@ -6605,11 +6605,11 @@ snapshots: natural-compare@1.4.0: {} - next@15.4.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@15.4.9(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@next/env': 15.4.8 + '@next/env': 15.4.9 '@swc/helpers': 0.5.15 - caniuse-lite: 1.0.30001759 + caniuse-lite: 1.0.30001760 postcss: 8.4.31 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) diff --git a/templates/v3/next-js-template/frontend/package-lock.json b/templates/v3/next-js-template/frontend/package-lock.json index 6c1bfdf..77f1eca 100644 --- a/templates/v3/next-js-template/frontend/package-lock.json +++ b/templates/v3/next-js-template/frontend/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@ckb-ccc/connector-react": "^v1.0.30", "@ckb-ccc/lumos-patches": "^1.0.14", - "next": "^15.4.8", + "next": "^15.4.9", "react": "^18", "react-dom": "^18" }, @@ -1590,9 +1590,9 @@ "integrity": "sha512-5jQNjFw76YCd+Ppl+0RvBWzxwvWaKfWC5wjVFFdNAieX7xksCHfZFIeow8je7AF8uVypwe56WlLBlblxw9NBBQ==" }, "node_modules/@next/env": { - "version": "15.4.8", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.8.tgz", - "integrity": "sha512-LydLa2MDI1NMrOFSkO54mTc8iIHSttj6R6dthITky9ylXV2gCGi0bHQjVCtLGRshdRPjyh2kXbxJukDtBWQZtQ==", + "version": "15.4.9", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.9.tgz", + "integrity": "sha512-OYR0RulK5phnbxxzcLE4/ECgfx1PL3EHrDbjyelJ7jauaO+/Qvj5gG8JPMltB51CygC2KrZ0aAfYLjPYjYY17A==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -5626,12 +5626,12 @@ "dev": true }, "node_modules/next": { - "version": "15.4.8", - "resolved": "https://registry.npmjs.org/next/-/next-15.4.8.tgz", - "integrity": "sha512-jwOXTz/bo0Pvlf20FSb6VXVeWRssA2vbvq9SdrOPEg9x8E1B27C2rQtvriAn600o9hH61kjrVRexEffv3JybuA==", + "version": "15.4.9", + "resolved": "https://registry.npmjs.org/next/-/next-15.4.9.tgz", + "integrity": "sha512-/NedNmbiH4Umt/7SohT9VKxEdBt02Lj33xHrukE7d8Li6juT+75sEq4a4U06jggrvdbklKgr78OZEyWZ8XRrtw==", "license": "MIT", "dependencies": { - "@next/env": "15.4.8", + "@next/env": "15.4.9", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", diff --git a/templates/v3/next-js-template/frontend/package.json b/templates/v3/next-js-template/frontend/package.json index 1022b13..8d045fe 100644 --- a/templates/v3/next-js-template/frontend/package.json +++ b/templates/v3/next-js-template/frontend/package.json @@ -11,7 +11,7 @@ "dependencies": { "@ckb-ccc/connector-react": "^v1.0.30", "@ckb-ccc/lumos-patches": "^1.0.14", - "next": "^15.4.8", + "next": "^15.4.9", "react": "^18", "react-dom": "^18" }, From aa25a56fc813de09a1c91e602470338702a6b812 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 08:17:16 +0800 Subject: [PATCH 2/3] build(deps): bump the npm_and_yarn group across 2 directories with 1 update (#340) Bumps the npm_and_yarn group with 1 update in the /templates/v3/js-script-next-js directory: [next](https://github.com/vercel/next.js). Bumps the npm_and_yarn group with 1 update in the /templates/v3/next-js-template/frontend directory: [next](https://github.com/vercel/next.js). Updates `next` from 15.4.9 to 15.4.10 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v15.4.9...v15.4.10) Updates `next` from 15.4.9 to 15.4.10 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v15.4.9...v15.4.10) --- updated-dependencies: - dependency-name: next dependency-version: 15.4.10 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: next dependency-version: 15.4.10 dependency-type: direct:production dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../packages/frontend/package.json | 2 +- templates/v3/js-script-next-js/pnpm-lock.yaml | 18 +++++++++--------- .../frontend/package-lock.json | 16 ++++++++-------- .../v3/next-js-template/frontend/package.json | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/templates/v3/js-script-next-js/packages/frontend/package.json b/templates/v3/js-script-next-js/packages/frontend/package.json index 80b4018..0c64d99 100644 --- a/templates/v3/js-script-next-js/packages/frontend/package.json +++ b/templates/v3/js-script-next-js/packages/frontend/package.json @@ -11,7 +11,7 @@ "dependencies": { "@ckb-ccc/connector-react": "^v1.0.14", "@ckb-ccc/lumos-patches": "^1.0.14", - "next": "^15.4.9", + "next": "^15.4.10", "react": "^18", "react-dom": "^18" }, diff --git a/templates/v3/js-script-next-js/pnpm-lock.yaml b/templates/v3/js-script-next-js/pnpm-lock.yaml index e328db0..2bcfc5e 100644 --- a/templates/v3/js-script-next-js/pnpm-lock.yaml +++ b/templates/v3/js-script-next-js/pnpm-lock.yaml @@ -37,8 +37,8 @@ importers: specifier: ^1.0.14 version: 1.0.16(typescript@5.8.3) next: - specifier: ^15.4.9 - version: 15.4.9(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^15.4.10 + version: 15.4.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: specifier: ^18 version: 18.3.1 @@ -841,8 +841,8 @@ packages: '@nervosnetwork/ckb-types@0.109.5': resolution: {integrity: sha512-5jQNjFw76YCd+Ppl+0RvBWzxwvWaKfWC5wjVFFdNAieX7xksCHfZFIeow8je7AF8uVypwe56WlLBlblxw9NBBQ==} - '@next/env@15.4.9': - resolution: {integrity: sha512-OYR0RulK5phnbxxzcLE4/ECgfx1PL3EHrDbjyelJ7jauaO+/Qvj5gG8JPMltB51CygC2KrZ0aAfYLjPYjYY17A==} + '@next/env@15.4.10': + resolution: {integrity: sha512-knhmoJ0Vv7VRf6pZEPSnciUG1S4bIhWx+qTYBW/AjxEtlzsiNORPk8sFDCEvqLfmKuey56UB9FL1UdHEV3uBrg==} '@next/eslint-plugin-next@14.2.3': resolution: {integrity: sha512-L3oDricIIjgj1AVnRdRor21gI7mShlSwU/1ZGHmqM3LzHhXXhdkrfeNY5zif25Bi5Dd7fiJHsbhoZCHfXYvlAw==} @@ -2609,8 +2609,8 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - next@15.4.9: - resolution: {integrity: sha512-/NedNmbiH4Umt/7SohT9VKxEdBt02Lj33xHrukE7d8Li6juT+75sEq4a4U06jggrvdbklKgr78OZEyWZ8XRrtw==} + next@15.4.10: + resolution: {integrity: sha512-itVlc79QjpKMFMRhP+kbGKaSG/gZM6RCvwhEbwmCNF06CdDiNaoHcbeg0PqkEa2GOcn8KJ0nnc7+yL7EjoYLHQ==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} hasBin: true peerDependencies: @@ -4422,7 +4422,7 @@ snapshots: '@nervosnetwork/ckb-types@0.109.5': {} - '@next/env@15.4.9': {} + '@next/env@15.4.10': {} '@next/eslint-plugin-next@14.2.3': dependencies: @@ -6605,9 +6605,9 @@ snapshots: natural-compare@1.4.0: {} - next@15.4.9(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@15.4.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@next/env': 15.4.9 + '@next/env': 15.4.10 '@swc/helpers': 0.5.15 caniuse-lite: 1.0.30001760 postcss: 8.4.31 diff --git a/templates/v3/next-js-template/frontend/package-lock.json b/templates/v3/next-js-template/frontend/package-lock.json index 77f1eca..ed69e7d 100644 --- a/templates/v3/next-js-template/frontend/package-lock.json +++ b/templates/v3/next-js-template/frontend/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@ckb-ccc/connector-react": "^v1.0.30", "@ckb-ccc/lumos-patches": "^1.0.14", - "next": "^15.4.9", + "next": "^15.4.10", "react": "^18", "react-dom": "^18" }, @@ -1590,9 +1590,9 @@ "integrity": "sha512-5jQNjFw76YCd+Ppl+0RvBWzxwvWaKfWC5wjVFFdNAieX7xksCHfZFIeow8je7AF8uVypwe56WlLBlblxw9NBBQ==" }, "node_modules/@next/env": { - "version": "15.4.9", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.9.tgz", - "integrity": "sha512-OYR0RulK5phnbxxzcLE4/ECgfx1PL3EHrDbjyelJ7jauaO+/Qvj5gG8JPMltB51CygC2KrZ0aAfYLjPYjYY17A==", + "version": "15.4.10", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.10.tgz", + "integrity": "sha512-knhmoJ0Vv7VRf6pZEPSnciUG1S4bIhWx+qTYBW/AjxEtlzsiNORPk8sFDCEvqLfmKuey56UB9FL1UdHEV3uBrg==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -5626,12 +5626,12 @@ "dev": true }, "node_modules/next": { - "version": "15.4.9", - "resolved": "https://registry.npmjs.org/next/-/next-15.4.9.tgz", - "integrity": "sha512-/NedNmbiH4Umt/7SohT9VKxEdBt02Lj33xHrukE7d8Li6juT+75sEq4a4U06jggrvdbklKgr78OZEyWZ8XRrtw==", + "version": "15.4.10", + "resolved": "https://registry.npmjs.org/next/-/next-15.4.10.tgz", + "integrity": "sha512-itVlc79QjpKMFMRhP+kbGKaSG/gZM6RCvwhEbwmCNF06CdDiNaoHcbeg0PqkEa2GOcn8KJ0nnc7+yL7EjoYLHQ==", "license": "MIT", "dependencies": { - "@next/env": "15.4.9", + "@next/env": "15.4.10", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", diff --git a/templates/v3/next-js-template/frontend/package.json b/templates/v3/next-js-template/frontend/package.json index 8d045fe..5ff00e5 100644 --- a/templates/v3/next-js-template/frontend/package.json +++ b/templates/v3/next-js-template/frontend/package.json @@ -11,7 +11,7 @@ "dependencies": { "@ckb-ccc/connector-react": "^v1.0.30", "@ckb-ccc/lumos-patches": "^1.0.14", - "next": "^15.4.9", + "next": "^15.4.10", "react": "^18", "react-dom": "^18" }, From fbcec0c11219dc5e6a82173089661dd04ce314af Mon Sep 17 00:00:00 2001 From: RetricSu Date: Tue, 30 Dec 2025 14:22:04 +0800 Subject: [PATCH 3/3] use portable if cpu-feature build fails (#344) * use portable if cpu-feature build fails * fix pnpm-lock * fix isPortable * Memoize isPortable() and add error logging (#345) * Initial plan * Apply review suggestions: add error logging and memoize isPortable Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com> * chore: fmt --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com> --- README.md | 2 ++ package.json | 6 +++--- pnpm-lock.yaml | 19 +++++++------------ src/node/install.ts | 29 ++++++++++++++++++++++------- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 71b7fb9..8ede0e4 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ pnpm install -g @offckb/cli _Require Node version `>= v20.0.0`. We recommend using latest [LTS](https://nodejs.org/en/download/package-manager) version of Node to run `offckb`_ +**Note for Windows users:** If installation fails due to native module compilation issues, the CLI will still work but may use portable binaries instead of optimized ones. For better performance, consider installing Visual Studio Build Tools. + ## Usage ```sh diff --git a/package.json b/package.json index 8549c77..9124b80 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ }, "pnpm": { "onlyBuiltDependencies": [ - "cpu-features", "secp256k1" ] }, @@ -55,7 +54,6 @@ }, "devDependencies": { "@types/adm-zip": "^0.5.5", - "@types/cpu-features": "^0.0.3", "@types/node": "^20.17.24", "@types/node-fetch": "^2.6.11", "@types/semver": "^7.5.7", @@ -80,12 +78,14 @@ "child_process": "^1.0.2", "ckb-transaction-dumper": "^0.4.2", "commander": "^12.0.0", - "cpu-features": "^0.0.10", "http-proxy": "^1.18.1", "https-proxy-agent": "^7.0.5", "node-fetch": "2", "semver": "^7.6.0", "tar": "^6.2.1", "winston": "^3.17.0" + }, + "optionalDependencies": { + "cpu-features": "^0.0.10" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e4a9dc..9e0c747 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,9 +35,6 @@ importers: commander: specifier: ^12.0.0 version: 12.1.0 - cpu-features: - specifier: ^0.0.10 - version: 0.0.10 http-proxy: specifier: ^1.18.1 version: 1.18.1 @@ -60,9 +57,6 @@ importers: '@types/adm-zip': specifier: ^0.5.5 version: 0.5.7 - '@types/cpu-features': - specifier: ^0.0.3 - version: 0.0.3 '@types/node': specifier: ^20.17.24 version: 20.17.24 @@ -102,6 +96,10 @@ importers: typescript: specifier: ^5.3.3 version: 5.8.2 + optionalDependencies: + cpu-features: + specifier: ^0.0.10 + version: 0.0.10 packages: @@ -357,9 +355,6 @@ packages: '@types/adm-zip@0.5.7': resolution: {integrity: sha512-DNEs/QvmyRLurdQPChqq0Md4zGvPwHerAJYWk9l2jCbD1VPpnzRJorOdiq4zsw09NFbYnhfsoEhWtxIzXpn2yw==} - '@types/cpu-features@0.0.3': - resolution: {integrity: sha512-W/Ep+LDZoxMbCcH7LHRB3RN+TY4gbHl3u4uRq4XsxOh1gnpf5Lkwy5xWTBKSaJYQuMLW2XPAmRWA5Ucsy2EGVQ==} - '@types/http-proxy@1.17.16': resolution: {integrity: sha512-sdWoUajOB1cd0A8cRRQ1cfyWNbmFKLAqBB89Y8x5iYyG/mkJHc0YUH8pdWBy2omi9qtCpiIgGjuwO0dQST2l5w==} @@ -1998,8 +1993,6 @@ snapshots: dependencies: '@types/node': 20.17.24 - '@types/cpu-features@0.0.3': {} - '@types/http-proxy@1.17.16': dependencies: '@types/node': 20.17.24 @@ -2268,7 +2261,8 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 - buildcheck@0.0.6: {} + buildcheck@0.0.6: + optional: true call-bind-apply-helpers@1.0.2: dependencies: @@ -2375,6 +2369,7 @@ snapshots: dependencies: buildcheck: 0.0.6 nan: 2.22.2 + optional: true create-hash@1.2.0: dependencies: diff --git a/src/node/install.ts b/src/node/install.ts index 3fee4bb..dbb8136 100644 --- a/src/node/install.ts +++ b/src/node/install.ts @@ -9,7 +9,6 @@ import { Request } from '../util/request'; import { getCKBBinaryInstallPath, getCKBBinaryPath, readSettings } from '../cfg/setting'; import { encodeBinPathForTerminal } from '../util/encoding'; import { logger } from '../util/logger'; -import CPUFeatures from 'cpu-features'; export async function installCKBBinary(version: string) { const ckbBinPath = getCKBBinaryPath(version); @@ -149,14 +148,30 @@ function getExtension(): 'tar.gz' | 'zip' { return 'zip'; } +let cachedIsPortable: boolean | undefined = undefined; + function isPortable(): boolean { - const features = CPUFeatures(); - if (features.arch === 'x86') { - const flags = features.flags as CPUFeatures.X86CpuFlags; - // if lacks any of the following instruction, use portable binary - return !(flags.avx2 && flags.sse4_2 && flags.bmi2 && flags.pclmulqdq); + if (cachedIsPortable !== undefined) { + return cachedIsPortable; + } + + try { + const CPUFeatures = require('cpu-features'); + const features = CPUFeatures(); + if (features.arch === 'x86') { + const flags = features.flags as any; // CPUFeatures.X86CpuFlags + // if lacks any of the following instruction, use portable binary + cachedIsPortable = !(flags.avx2 && flags.sse4_2 && flags.bmi2 && flags.pclmulqdq); + } else { + cachedIsPortable = false; + } + } catch (error) { + // If cpu-features fails to load (e.g., on Windows without build tools), use portable binary + logger.warn('Failed to detect CPU features, using portable binary', error); + cachedIsPortable = true; } - return false; + + return cachedIsPortable; } function buildCKBGithubReleasePackageName(version: string, opt: { os?: string; arch?: string } = {}) {