@offckb/cli 0.4.4-canary-3ef5ca4.0 → 0.4.4-canary-659966d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -55,6 +55,8 @@ pnpm install -g @offckb/cli
55
55
 
56
56
  _Require Node version `>= v20.0.0`. We recommend using latest [LTS](https://nodejs.org/en/download/package-manager) version of Node to run `offckb`_
57
57
 
58
+ **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.
59
+
58
60
  ## Usage
59
61
 
60
62
  ```sh
package/build/index.js CHANGED
@@ -2289,7 +2289,6 @@ const request_1 = __nccwpck_require__(65897);
2289
2289
  const setting_1 = __nccwpck_require__(25546);
2290
2290
  const encoding_1 = __nccwpck_require__(6851);
2291
2291
  const logger_1 = __nccwpck_require__(65370);
2292
- const cpu_features_1 = __importDefault(__nccwpck_require__(64573));
2293
2292
  function installCKBBinary(version) {
2294
2293
  return __awaiter(this, void 0, void 0, function* () {
2295
2294
  const ckbBinPath = (0, setting_1.getCKBBinaryPath)(version);
@@ -2426,14 +2425,29 @@ function getExtension() {
2426
2425
  }
2427
2426
  return 'zip';
2428
2427
  }
2428
+ let cachedIsPortable = undefined;
2429
2429
  function isPortable() {
2430
- const features = (0, cpu_features_1.default)();
2431
- if (features.arch === 'x86') {
2432
- const flags = features.flags;
2433
- // if lacks any of the following instruction, use portable binary
2434
- return !(flags.avx2 && flags.sse4_2 && flags.bmi2 && flags.pclmulqdq);
2430
+ if (cachedIsPortable !== undefined) {
2431
+ return cachedIsPortable;
2435
2432
  }
2436
- return false;
2433
+ try {
2434
+ const CPUFeatures = __nccwpck_require__(64573);
2435
+ const features = CPUFeatures();
2436
+ if (features.arch === 'x86') {
2437
+ const flags = features.flags; // CPUFeatures.X86CpuFlags
2438
+ // if lacks any of the following instruction, use portable binary
2439
+ cachedIsPortable = !(flags.avx2 && flags.sse4_2 && flags.bmi2 && flags.pclmulqdq);
2440
+ }
2441
+ else {
2442
+ cachedIsPortable = false;
2443
+ }
2444
+ }
2445
+ catch (error) {
2446
+ // If cpu-features fails to load (e.g., on Windows without build tools), use portable binary
2447
+ logger_1.logger.warn('Failed to detect CPU features, using portable binary', error);
2448
+ cachedIsPortable = true;
2449
+ }
2450
+ return cachedIsPortable;
2437
2451
  }
2438
2452
  function buildCKBGithubReleasePackageName(version, opt = {}) {
2439
2453
  const os = opt.os || getOS();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offckb/cli",
3
- "version": "0.4.4-canary-3ef5ca4.0",
3
+ "version": "0.4.4-canary-659966d.0",
4
4
  "description": "ckb development network for your first try",
5
5
  "author": "CKB EcoFund",
6
6
  "license": "MIT",
@@ -27,7 +27,6 @@
27
27
  },
28
28
  "pnpm": {
29
29
  "onlyBuiltDependencies": [
30
- "cpu-features",
31
30
  "secp256k1"
32
31
  ]
33
32
  },
@@ -55,7 +54,6 @@
55
54
  },
56
55
  "devDependencies": {
57
56
  "@types/adm-zip": "^0.5.5",
58
- "@types/cpu-features": "^0.0.3",
59
57
  "@types/node": "^20.17.24",
60
58
  "@types/node-fetch": "^2.6.11",
61
59
  "@types/semver": "^7.5.7",
@@ -80,12 +78,14 @@
80
78
  "child_process": "^1.0.2",
81
79
  "ckb-transaction-dumper": "^0.4.2",
82
80
  "commander": "^12.0.0",
83
- "cpu-features": "^0.0.10",
84
81
  "http-proxy": "^1.18.1",
85
82
  "https-proxy-agent": "^7.0.5",
86
83
  "node-fetch": "2",
87
84
  "semver": "^7.6.0",
88
85
  "tar": "^6.2.1",
89
86
  "winston": "^3.17.0"
87
+ },
88
+ "optionalDependencies": {
89
+ "cpu-features": "^0.0.10"
90
90
  }
91
91
  }