@napi-rs/cli 3.7.0 → 3.7.2
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/dist/cli.js +14 -13
- package/dist/index.cjs +14 -13
- package/dist/index.d.cts +11 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +14 -13
- package/package.json +14 -14
- package/src/api/templates/js-binding.ts +12 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/cli",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"description": "Cli tools for napi-rs",
|
|
5
5
|
"author": "LongYinan <lynweklm@gmail.com>",
|
|
6
6
|
"homepage": "https://napi.rs/",
|
|
@@ -60,33 +60,33 @@
|
|
|
60
60
|
"url": "https://github.com/napi-rs/napi-rs/issues"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@inquirer/prompts": "^8.
|
|
63
|
+
"@inquirer/prompts": "^8.5.2",
|
|
64
64
|
"@napi-rs/cross-toolchain": "^1.0.3",
|
|
65
65
|
"@napi-rs/wasm-tools": "^1.0.1",
|
|
66
66
|
"@octokit/rest": "^22.0.1",
|
|
67
67
|
"clipanion": "^4.0.0-rc.4",
|
|
68
68
|
"colorette": "^2.0.20",
|
|
69
|
-
"emnapi": "^1.
|
|
70
|
-
"es-toolkit": "^1.
|
|
71
|
-
"js-yaml": "^4.
|
|
72
|
-
"obug": "^2.
|
|
73
|
-
"semver": "^7.
|
|
69
|
+
"emnapi": "^1.11.1",
|
|
70
|
+
"es-toolkit": "^1.47.0",
|
|
71
|
+
"js-yaml": "^4.2.0",
|
|
72
|
+
"obug": "^2.1.2",
|
|
73
|
+
"semver": "^7.8.2",
|
|
74
74
|
"typanion": "^3.14.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@emnapi/runtime": "^1.
|
|
77
|
+
"@emnapi/runtime": "^1.11.0",
|
|
78
78
|
"@oxc-node/core": "^0.1.0",
|
|
79
79
|
"@std/toml": "npm:@jsr/std__toml@^1.0.11",
|
|
80
80
|
"@types/inquirer": "^9.0.9",
|
|
81
81
|
"@types/js-yaml": "^4.0.9",
|
|
82
|
-
"@types/node": "^
|
|
82
|
+
"@types/node": "^25.9.2",
|
|
83
83
|
"@types/semver": "^7.7.1",
|
|
84
|
-
"ava": "^8.0.
|
|
85
|
-
"empathic": "^2.0.
|
|
84
|
+
"ava": "^8.0.1",
|
|
85
|
+
"empathic": "^2.0.1",
|
|
86
86
|
"env-paths": "^4.0.0",
|
|
87
|
-
"oxc-parser": "^0.
|
|
88
|
-
"prettier": "^3.
|
|
89
|
-
"tsdown": "^0.22.
|
|
87
|
+
"oxc-parser": "^0.135.0",
|
|
88
|
+
"prettier": "^3.8.3",
|
|
89
|
+
"tsdown": "^0.22.2",
|
|
90
90
|
"tslib": "^2.8.1",
|
|
91
91
|
"typescript": "^6.0.3"
|
|
92
92
|
},
|
|
@@ -20,7 +20,7 @@ export function createEsmBinding(
|
|
|
20
20
|
packageVersion?: string,
|
|
21
21
|
): string {
|
|
22
22
|
return `${bindingHeader}
|
|
23
|
-
import { createRequire } from '
|
|
23
|
+
import { createRequire } from 'module'
|
|
24
24
|
const require = createRequire(import.meta.url)
|
|
25
25
|
const __dirname = new URL('.', import.meta.url).pathname
|
|
26
26
|
|
|
@@ -69,7 +69,7 @@ ${ident}loadErrors.push(e)
|
|
|
69
69
|
${identLow}}${versionCheck}`
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
return `const { readFileSync } = require('
|
|
72
|
+
return `const { readFileSync } = require('fs')
|
|
73
73
|
let nativeBinding = null
|
|
74
74
|
const loadErrors = []
|
|
75
75
|
|
|
@@ -99,7 +99,7 @@ const isMuslFromFilesystem = () => {
|
|
|
99
99
|
|
|
100
100
|
const isMuslFromReport = () => {
|
|
101
101
|
let report = null
|
|
102
|
-
if (typeof process.report
|
|
102
|
+
if (process.report && typeof process.report.getReport === 'function') {
|
|
103
103
|
process.report.excludeNetwork = true
|
|
104
104
|
report = process.report.getReport()
|
|
105
105
|
}
|
|
@@ -143,7 +143,7 @@ function requireNative() {
|
|
|
143
143
|
}
|
|
144
144
|
} else if (process.platform === 'win32') {
|
|
145
145
|
if (process.arch === 'x64') {
|
|
146
|
-
if (process.config
|
|
146
|
+
if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
|
|
147
147
|
${requireTuple('win32-x64-gnu')}
|
|
148
148
|
} else {
|
|
149
149
|
${requireTuple('win32-x64-msvc')}
|
|
@@ -272,17 +272,18 @@ if (!nativeBinding || forceWasi) {
|
|
|
272
272
|
|
|
273
273
|
if (!nativeBinding) {
|
|
274
274
|
if (loadErrors.length > 0) {
|
|
275
|
-
|
|
275
|
+
const error = new Error(
|
|
276
276
|
\`Cannot find native binding. \` +
|
|
277
277
|
\`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). \` +
|
|
278
278
|
'Please try \`npm i\` again after removing both package-lock.json and node_modules directory.',
|
|
279
|
-
{
|
|
280
|
-
cause: loadErrors.reduce((err, cur) => {
|
|
281
|
-
cur.cause = err
|
|
282
|
-
return cur
|
|
283
|
-
}),
|
|
284
|
-
},
|
|
285
279
|
)
|
|
280
|
+
// assign instead of the \`new Error(message, { cause })\` options form,
|
|
281
|
+
// which Node < 16.9 silently ignores
|
|
282
|
+
error.cause = loadErrors.reduce((err, cur) => {
|
|
283
|
+
cur.cause = err
|
|
284
|
+
return cur
|
|
285
|
+
})
|
|
286
|
+
throw error
|
|
286
287
|
}
|
|
287
288
|
throw new Error(\`Failed to load native binding\`)
|
|
288
289
|
}
|