@napi-rs/cli 3.0.0-alpha.5 → 3.0.0-alpha.50
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/api/artifacts.js +32 -8
- package/dist/api/artifacts.js.map +1 -0
- package/dist/api/build.d.ts +1 -1
- package/dist/api/build.js +249 -25
- package/dist/api/build.js.map +1 -0
- package/dist/api/create-npm-dirs.js +46 -8
- package/dist/api/create-npm-dirs.js.map +1 -0
- package/dist/api/new.js +58 -20
- package/dist/api/new.js.map +1 -0
- package/dist/api/pre-publish.js +10 -7
- package/dist/api/pre-publish.js.map +1 -0
- package/dist/api/rename.js +10 -1
- package/dist/api/rename.js.map +1 -0
- package/dist/api/templates/.gitignore.d.ts +1 -1
- package/dist/api/templates/.gitignore.js +2 -0
- package/dist/api/templates/.gitignore.js.map +1 -0
- package/dist/api/templates/.npmignore.js +1 -0
- package/dist/api/templates/.npmignore.js.map +1 -0
- package/dist/api/templates/build.rs.js +1 -0
- package/dist/api/templates/build.rs.js.map +1 -0
- package/dist/api/templates/cargo.toml.js +1 -0
- package/dist/api/templates/cargo.toml.js.map +1 -0
- package/dist/api/templates/ci-template.d.ts +3 -1
- package/dist/api/templates/ci-template.js +167 -150
- package/dist/api/templates/ci-template.js.map +1 -0
- package/dist/api/templates/ci.yml.d.ts +3 -1
- package/dist/api/templates/ci.yml.js +13 -2
- package/dist/api/templates/ci.yml.js.map +1 -0
- package/dist/api/templates/index.js +1 -0
- package/dist/api/templates/index.js.map +1 -0
- package/dist/api/templates/js-binding.js +150 -225
- package/dist/api/templates/js-binding.js.map +1 -0
- package/dist/api/templates/lib.rs.js +2 -4
- package/dist/api/templates/lib.rs.js.map +1 -0
- package/dist/api/templates/load-wasi-template.d.ts +2 -0
- package/dist/api/templates/load-wasi-template.js +146 -0
- package/dist/api/templates/load-wasi-template.js.map +1 -0
- package/dist/api/templates/package.json.d.ts +9 -2
- package/dist/api/templates/package.json.js +27 -4
- package/dist/api/templates/package.json.js.map +1 -0
- package/dist/api/templates/wasi-worker-template.d.ts +2 -0
- package/dist/api/templates/wasi-worker-template.js +103 -0
- package/dist/api/templates/wasi-worker-template.js.map +1 -0
- package/dist/api/universalize.js +6 -5
- package/dist/api/universalize.js.map +1 -0
- package/dist/api/version.js +3 -2
- package/dist/api/version.js.map +1 -0
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/artifacts.js +3 -2
- package/dist/commands/artifacts.js.map +1 -0
- package/dist/commands/build.js +2 -1
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/create-npm-dirs.js +1 -0
- package/dist/commands/create-npm-dirs.js.map +1 -0
- package/dist/commands/help.js +1 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/new.js +17 -6
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/pre-publish.js +1 -0
- package/dist/commands/pre-publish.js.map +1 -0
- package/dist/commands/rename.js +1 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/universalize.js +1 -0
- package/dist/commands/universalize.js.map +1 -0
- package/dist/commands/version.js +1 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/def/artifacts.d.ts +21 -1
- package/dist/def/artifacts.js +11 -2
- package/dist/def/artifacts.js.map +1 -0
- package/dist/def/build.d.ts +20 -2
- package/dist/def/build.js +15 -2
- package/dist/def/build.js.map +1 -0
- package/dist/def/create-npm-dirs.d.ts +10 -0
- package/dist/def/create-npm-dirs.js +5 -0
- package/dist/def/create-npm-dirs.js.map +1 -0
- package/dist/def/new.d.ts +24 -6
- package/dist/def/new.js +12 -1
- package/dist/def/new.js.map +1 -0
- package/dist/def/pre-publish.d.ts +10 -0
- package/dist/def/pre-publish.js +8 -3
- package/dist/def/pre-publish.js.map +1 -0
- package/dist/def/rename.d.ts +11 -1
- package/dist/def/rename.js +6 -1
- package/dist/def/rename.js.map +1 -0
- package/dist/def/universalize.d.ts +10 -0
- package/dist/def/universalize.js +5 -0
- package/dist/def/universalize.js.map +1 -0
- package/dist/def/version.d.ts +10 -0
- package/dist/def/version.js +5 -0
- package/dist/def/version.js.map +1 -0
- package/dist/index.cjs +3918 -715
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/__tests__/config.spec.d.ts +1 -0
- package/dist/utils/__tests__/config.spec.js +63 -0
- package/dist/utils/__tests__/config.spec.js.map +1 -0
- package/dist/utils/__tests__/target.spec.js +1 -0
- package/dist/utils/__tests__/target.spec.js.map +1 -0
- package/dist/utils/__tests__/typegen.spec.js +9 -4
- package/dist/utils/__tests__/typegen.spec.js.map +1 -0
- package/dist/utils/__tests__/version.spec.js +1 -0
- package/dist/utils/__tests__/version.spec.js.map +1 -0
- package/dist/utils/cargo.js +2 -1
- package/dist/utils/cargo.js.map +1 -0
- package/dist/utils/config.d.ts +40 -5
- package/dist/utils/config.js +39 -6
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/log.js +1 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/metadata.js +3 -2
- package/dist/utils/metadata.js.map +1 -0
- package/dist/utils/misc.d.ts +1 -1
- package/dist/utils/misc.js +4 -3
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/target.d.ts +9 -5
- package/dist/utils/target.js +25 -1
- package/dist/utils/target.js.map +1 -0
- package/dist/utils/typegen.d.ts +1 -1
- package/dist/utils/typegen.js +8 -6
- package/dist/utils/typegen.js.map +1 -0
- package/dist/utils/version.d.ts +2 -1
- package/dist/utils/version.js +11 -8
- package/dist/utils/version.js.map +1 -0
- package/package.json +46 -13
- package/src/api/artifacts.ts +83 -8
- package/src/api/build.ts +416 -27
- package/src/api/create-npm-dirs.ts +56 -8
- package/src/api/new.ts +82 -31
- package/src/api/pre-publish.ts +13 -7
- package/src/api/rename.ts +10 -1
- package/src/api/templates/.gitignore.ts +1 -0
- package/src/api/templates/ci-template.ts +176 -150
- package/src/api/templates/ci.yml.ts +16 -3
- package/src/api/templates/js-binding.ts +150 -225
- package/src/api/templates/lib.rs.ts +1 -4
- package/src/api/templates/load-wasi-template.ts +157 -0
- package/src/api/templates/package.json.ts +47 -5
- package/src/api/templates/wasi-worker-template.ts +103 -0
- package/src/api/universalize.ts +8 -5
- package/src/api/version.ts +5 -2
- package/src/commands/artifacts.ts +2 -2
- package/src/commands/build.ts +1 -1
- package/src/commands/new.ts +16 -6
- package/src/def/artifacts.ts +22 -3
- package/src/def/build.ts +32 -4
- package/src/def/create-npm-dirs.ts +9 -0
- package/src/def/new.ts +28 -3
- package/src/def/pre-publish.ts +12 -3
- package/src/def/rename.ts +11 -2
- package/src/def/universalize.ts +9 -0
- package/src/def/version.ts +9 -0
- package/src/index.ts +2 -0
- package/src/utils/__tests__/__snapshots__/config.spec.ts.md +97 -0
- package/src/utils/__tests__/__snapshots__/config.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.md +28 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/typegen.spec.ts.md +555 -0
- package/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/version.spec.ts.md +8 -7
- package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
- package/src/utils/__tests__/config.spec.ts +81 -0
- package/src/utils/__tests__/typegen.spec.ts +18 -3
- package/src/utils/cargo.ts +1 -1
- package/src/utils/config.ts +104 -12
- package/src/utils/index.ts +0 -1
- package/src/utils/metadata.ts +2 -2
- package/src/utils/misc.ts +11 -3
- package/src/utils/target.ts +34 -7
- package/src/utils/typegen.ts +11 -5
- package/src/utils/version.ts +10 -8
- package/dist/utils/ci.d.ts +0 -11
- package/dist/utils/ci.js +0 -95
- package/src/utils/ci.ts +0 -111
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { UNIVERSAL_TARGETS } from '../../utils/target.js';
|
|
2
|
+
export const createPackageJson = async ({ name, binaryName, targets, license, engineRequirement, cliVersion, testFramework, }) => {
|
|
3
|
+
const hasWasmTarget = targets.some((t) => t.includes('wasm'));
|
|
4
|
+
const universalTargets = targets.filter((t) => t in UNIVERSAL_TARGETS);
|
|
5
|
+
const unifiedtargets = universalTargets.length
|
|
6
|
+
? targets.filter((target) => !universalTargets.some((t) => {
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
return UNIVERSAL_TARGETS[t].includes(target);
|
|
9
|
+
}))
|
|
10
|
+
: targets;
|
|
2
11
|
const content = {
|
|
3
12
|
name,
|
|
4
|
-
version: '
|
|
13
|
+
version: '0.0.0',
|
|
5
14
|
license,
|
|
6
15
|
engines: {
|
|
7
16
|
node: engineRequirement,
|
|
@@ -9,14 +18,15 @@ export const createPackageJson = ({ name, binaryName, targets, license, engineRe
|
|
|
9
18
|
type: 'commonjs',
|
|
10
19
|
main: 'index.js',
|
|
11
20
|
types: 'index.d.ts',
|
|
21
|
+
browser: 'browser.js',
|
|
12
22
|
module: undefined,
|
|
13
23
|
exports: undefined,
|
|
14
24
|
napi: {
|
|
15
25
|
binaryName,
|
|
16
|
-
targets,
|
|
26
|
+
targets: unifiedtargets,
|
|
17
27
|
},
|
|
18
28
|
scripts: {
|
|
19
|
-
test:
|
|
29
|
+
test: testFramework,
|
|
20
30
|
build: 'napi build --release --platform --strip',
|
|
21
31
|
'build:debug': 'napi build',
|
|
22
32
|
prepublishOnly: 'napi prepublish -t npm',
|
|
@@ -27,5 +37,18 @@ export const createPackageJson = ({ name, binaryName, targets, license, engineRe
|
|
|
27
37
|
'@napi-rs/cli': `^${cliVersion}`,
|
|
28
38
|
},
|
|
29
39
|
};
|
|
40
|
+
if (testFramework === 'ava') {
|
|
41
|
+
const avaMeta = await fetch(`https://registry.npmjs.org/ava`).then((res) => res.json());
|
|
42
|
+
content.devDependencies['ava'] = `^${avaMeta['dist-tags'].latest}`;
|
|
43
|
+
content.ava = {
|
|
44
|
+
timeout: '1m',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (hasWasmTarget) {
|
|
48
|
+
const wasmRuntime = await fetch(`https://registry.npmjs.org/@napi-rs/wasm-runtime`).then((res) => res.json());
|
|
49
|
+
const latest = wasmRuntime['dist-tags'].latest;
|
|
50
|
+
content.devDependencies['@napi-rs/wasm-runtime'] = `^${latest}`;
|
|
51
|
+
}
|
|
30
52
|
return JSON.stringify(content, null, 2);
|
|
31
53
|
};
|
|
54
|
+
//# sourceMappingURL=package.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.json.js","sourceRoot":"","sources":["../../../src/api/templates/package.json.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAMzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,IAAI,EACJ,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,aAAa,GASd,EAAE,EAAE;IACH,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,iBAAiB,CACQ,CAAA;IACvC,MAAM,cAAc,GAAG,gBAAgB,CAAC,MAAM;QAC5C,CAAC,CAAC,OAAO,CAAC,MAAM,CACZ,CAAC,MAAM,EAAE,EAAE,CACT,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YAC3B,mBAAmB;YACnB,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC9C,CAAC,CAAC,CACL;QACH,CAAC,CAAC,OAAO,CAAA;IACX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AE,CAAA;IAClE,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AACzC,CAAC,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const WASI_WORKER_TEMPLATE = "import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { WASI } from \"node:wasi\";\nimport { parentPort, Worker } from \"node:worker_threads\";\n\nconst require = createRequire(import.meta.url);\n\nconst { instantiateNapiModuleSync, MessageHandler, getDefaultContext } = require(\"@napi-rs/wasm-runtime\");\n\nif (parentPort) {\n parentPort.on(\"message\", (data) => {\n globalThis.onmessage({ data });\n });\n}\n\nObject.assign(globalThis, {\n self: globalThis,\n require,\n Worker,\n importScripts: function (f) {\n ;(0, eval)(fs.readFileSync(f, \"utf8\") + \"//# sourceURL=\" + f);\n },\n postMessage: function (msg) {\n if (parentPort) {\n parentPort.postMessage(msg);\n }\n },\n});\n\nconst emnapiContext = getDefaultContext()\n\nconst handler = new MessageHandler({\n onLoad({ wasmModule, wasmMemory }) {\n const wasi = new WASI({\n version: 'preview1',\n env: process.env,\n preopens: {\n '/': '/',\n },\n });\n\n return instantiateNapiModuleSync(wasmModule, {\n childThread: true,\n wasi,\n context: emnapiContext,\n overwriteImports(importObject) {\n importObject.env = {\n ...importObject.env,\n ...importObject.napi,\n ...importObject.emnapi,\n memory: wasmMemory\n };\n },\n });\n },\n});\n\nglobalThis.onmessage = function (e) {\n handler.handle(e);\n};\n";
|
|
2
|
+
export declare const WASI_WORKER_BROWSER_TEMPLATE = "import { instantiateNapiModuleSync, MessageHandler, WASI } from '@napi-rs/wasm-runtime'\nimport { Volume, createFsFromVolume } from '@napi-rs/wasm-runtime/fs'\n\nconst fs = createFsFromVolume(\n Volume.fromJSON({\n '/': null,\n }),\n)\n\nconst handler = new MessageHandler({\n onLoad({ wasmModule, wasmMemory }) {\n const wasi = new WASI({\n fs,\n print: function () {\n // eslint-disable-next-line no-console\n console.log.apply(console, arguments)\n },\n printErr: function() {\n // eslint-disable-next-line no-console\n console.error.apply(console, arguments)\n },\n })\n return instantiateNapiModuleSync(wasmModule, {\n childThread: true,\n wasi,\n overwriteImports(importObject) {\n importObject.env = {\n ...importObject.env,\n ...importObject.napi,\n ...importObject.emnapi,\n memory: wasmMemory,\n }\n },\n })\n },\n})\n\nglobalThis.onmessage = function (e) {\n handler.handle(e)\n}\n";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export const WASI_WORKER_TEMPLATE = `import fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { WASI } from "node:wasi";
|
|
4
|
+
import { parentPort, Worker } from "node:worker_threads";
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
|
|
8
|
+
const { instantiateNapiModuleSync, MessageHandler, getDefaultContext } = require("@napi-rs/wasm-runtime");
|
|
9
|
+
|
|
10
|
+
if (parentPort) {
|
|
11
|
+
parentPort.on("message", (data) => {
|
|
12
|
+
globalThis.onmessage({ data });
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Object.assign(globalThis, {
|
|
17
|
+
self: globalThis,
|
|
18
|
+
require,
|
|
19
|
+
Worker,
|
|
20
|
+
importScripts: function (f) {
|
|
21
|
+
;(0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
|
|
22
|
+
},
|
|
23
|
+
postMessage: function (msg) {
|
|
24
|
+
if (parentPort) {
|
|
25
|
+
parentPort.postMessage(msg);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const emnapiContext = getDefaultContext()
|
|
31
|
+
|
|
32
|
+
const handler = new MessageHandler({
|
|
33
|
+
onLoad({ wasmModule, wasmMemory }) {
|
|
34
|
+
const wasi = new WASI({
|
|
35
|
+
version: 'preview1',
|
|
36
|
+
env: process.env,
|
|
37
|
+
preopens: {
|
|
38
|
+
'/': '/',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return instantiateNapiModuleSync(wasmModule, {
|
|
43
|
+
childThread: true,
|
|
44
|
+
wasi,
|
|
45
|
+
context: emnapiContext,
|
|
46
|
+
overwriteImports(importObject) {
|
|
47
|
+
importObject.env = {
|
|
48
|
+
...importObject.env,
|
|
49
|
+
...importObject.napi,
|
|
50
|
+
...importObject.emnapi,
|
|
51
|
+
memory: wasmMemory
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
globalThis.onmessage = function (e) {
|
|
59
|
+
handler.handle(e);
|
|
60
|
+
};
|
|
61
|
+
`;
|
|
62
|
+
export const WASI_WORKER_BROWSER_TEMPLATE = `import { instantiateNapiModuleSync, MessageHandler, WASI } from '@napi-rs/wasm-runtime'
|
|
63
|
+
import { Volume, createFsFromVolume } from '@napi-rs/wasm-runtime/fs'
|
|
64
|
+
|
|
65
|
+
const fs = createFsFromVolume(
|
|
66
|
+
Volume.fromJSON({
|
|
67
|
+
'/': null,
|
|
68
|
+
}),
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
const handler = new MessageHandler({
|
|
72
|
+
onLoad({ wasmModule, wasmMemory }) {
|
|
73
|
+
const wasi = new WASI({
|
|
74
|
+
fs,
|
|
75
|
+
print: function () {
|
|
76
|
+
// eslint-disable-next-line no-console
|
|
77
|
+
console.log.apply(console, arguments)
|
|
78
|
+
},
|
|
79
|
+
printErr: function() {
|
|
80
|
+
// eslint-disable-next-line no-console
|
|
81
|
+
console.error.apply(console, arguments)
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
return instantiateNapiModuleSync(wasmModule, {
|
|
85
|
+
childThread: true,
|
|
86
|
+
wasi,
|
|
87
|
+
overwriteImports(importObject) {
|
|
88
|
+
importObject.env = {
|
|
89
|
+
...importObject.env,
|
|
90
|
+
...importObject.napi,
|
|
91
|
+
...importObject.emnapi,
|
|
92
|
+
memory: wasmMemory,
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
globalThis.onmessage = function (e) {
|
|
100
|
+
handler.handle(e)
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
//# sourceMappingURL=wasi-worker-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasi-worker-template.js","sourceRoot":"","sources":["../../../src/api/templates/wasi-worker-template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DnC,CAAA;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC3C,CAAA"}
|
package/dist/api/universalize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { spawnSync } from 'child_process';
|
|
2
|
-
import { join, resolve } from 'path';
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
3
|
import { applyDefaultUniversalizeOptions, } from '../def/universalize.js';
|
|
4
4
|
import { readNapiConfig } from '../utils/config.js';
|
|
5
5
|
import { debugFactory } from '../utils/log.js';
|
|
@@ -16,18 +16,18 @@ const universalizers = {
|
|
|
16
16
|
export async function universalizeBinaries(userOptions) {
|
|
17
17
|
const options = applyDefaultUniversalizeOptions(userOptions);
|
|
18
18
|
const packageJsonPath = join(options.cwd, options.packageJsonPath);
|
|
19
|
-
const config = await readNapiConfig(packageJsonPath);
|
|
19
|
+
const config = await readNapiConfig(packageJsonPath, options.configPath ? resolve(options.cwd, options.configPath) : undefined);
|
|
20
20
|
const target = config.targets.find((t) => t.platform === process.platform && t.arch === 'universal');
|
|
21
21
|
if (!target) {
|
|
22
22
|
throw new Error(`'universal' arch for platform '${process.platform}' not found in config!`);
|
|
23
23
|
}
|
|
24
|
-
const srcFiles = UniArchsByPlatform[process.platform]?.map((arch) => `${config.binaryName}.${process.platform}-${arch}.node`);
|
|
24
|
+
const srcFiles = UniArchsByPlatform[process.platform]?.map((arch) => resolve(options.cwd, options.outputDir, `${config.binaryName}.${process.platform}-${arch}.node`));
|
|
25
25
|
if (!srcFiles || !universalizers[process.platform]) {
|
|
26
26
|
throw new Error(`'universal' arch for platform '${process.platform}' not supported.`);
|
|
27
27
|
}
|
|
28
28
|
debug(`Looking up source binaries to combine: `);
|
|
29
29
|
debug(' %O', srcFiles);
|
|
30
|
-
const srcFileLookup = await Promise.all(srcFiles.map((f) => fileExists(
|
|
30
|
+
const srcFileLookup = await Promise.all(srcFiles.map((f) => fileExists(f)));
|
|
31
31
|
const notFoundFiles = srcFiles.filter((_, i) => !srcFileLookup[i]);
|
|
32
32
|
if (notFoundFiles.length) {
|
|
33
33
|
throw new Error(`Some binary files were not found: ${JSON.stringify(notFoundFiles)}`);
|
|
@@ -36,3 +36,4 @@ export async function universalizeBinaries(userOptions) {
|
|
|
36
36
|
universalizers[process.platform]?.(srcFiles, output);
|
|
37
37
|
debug(`Produced universal binary: ${output}`);
|
|
38
38
|
}
|
|
39
|
+
//# sourceMappingURL=universalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universalize.js","sourceRoot":"","sources":["../../src/api/universalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EACL,+BAA+B,GAEhC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM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AG,MAAM,CAAC,UAAU,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,OAAO,CAAC,CAC3G,CAAA;IAED,IAAI,CAAC,QAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACb,kCAAkC,OAAO,CAAC,QAAQ,kBAAkB,CACrE,CAAA;IACH,CAAC;IAED,KAAK,CAAC,yCAAyC,CAAC,CAAA;IAChD,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAEvB,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CACnC,CAAA;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;IAElE,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CACrE,CAAA;IACH,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CACpB,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,SAAS,EACjB,GAAG,MAAM,CAAC,UAAU,IAAI,OAAO,CAAC,QAAQ,iBAAiB,CAC1D,CAAA;IAED,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAEpD,KAAK,CAAC,8BAA8B,MAAM,EAAE,CAAC,CAAA;AAC/C,CAAC"}
|
package/dist/api/version.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { join, resolve } from 'path';
|
|
1
|
+
import { join, resolve } from 'node:path';
|
|
2
2
|
import { applyDefaultVersionOptions } from '../def/version.js';
|
|
3
3
|
import { readNapiConfig, debugFactory, updatePackageJson, } from '../utils/index.js';
|
|
4
4
|
const debug = debugFactory('version');
|
|
5
5
|
export async function version(userOptions) {
|
|
6
6
|
const options = applyDefaultVersionOptions(userOptions);
|
|
7
7
|
const packageJsonPath = resolve(options.cwd, options.packageJsonPath);
|
|
8
|
-
const config = await readNapiConfig(packageJsonPath);
|
|
8
|
+
const config = await readNapiConfig(packageJsonPath, options.configPath ? resolve(options.cwd, options.configPath) : undefined);
|
|
9
9
|
for (const target of config.targets) {
|
|
10
10
|
const pkgDir = resolve(options.cwd, options.npmDir, target.platformArchABI);
|
|
11
11
|
debug(`Update version to %i in [%i]`, config.packageJson.version, pkgDir);
|
|
@@ -14,3 +14,4 @@ export async function version(userOptions) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/api/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,0BAA0B,EAAkB,MAAM,mBAAmB,CAAA;AAC9E,OAAO,EACL,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;AAErC,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,WAA2B;IACvD,MAAM,OAAO,GAAG,0BAA0B,CAAC,WAAW,CAAC,CAAA;IACvD,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAErE,MAAM,MAAM,GAAG,MAAM,cAAc,CACjC,eAAe,EACf,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,C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;IAClB,aAAa,EAAE,WAAW;CAC3B,CAAC,CAAA;AAEF,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;AACxB,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;AAC1B,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAA;AAClC,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;AAC9B,GAAG,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAA;AACjC,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;AAC3B,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAA;AAC/B,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAC5B,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;AAEzB,KAAK,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -6,9 +6,9 @@ export class ArtifactsCommand extends BaseArtifactsCommand {
|
|
|
6
6
|
description: 'Copy artifacts from Github Actions into specified dir',
|
|
7
7
|
examples: [
|
|
8
8
|
[
|
|
9
|
-
'$0 artifacts --dir
|
|
9
|
+
'$0 artifacts --output-dir ./artifacts --dist ./npm',
|
|
10
10
|
`Copy [binaryName].[platform].node under current dir(.) into packages under npm dir.
|
|
11
|
-
e.g: index.linux-x64-gnu.node --> ./npm/linux-x64-gnu/index.node`,
|
|
11
|
+
e.g: index.linux-x64-gnu.node --> ./npm/linux-x64-gnu/index.linux-x64-gnu.node`,
|
|
12
12
|
],
|
|
13
13
|
],
|
|
14
14
|
});
|
|
@@ -17,3 +17,4 @@ e.g: index.linux-x64-gnu.node --> ./npm/linux-x64-gnu/index.node`,
|
|
|
17
17
|
await collectArtifacts(this.getOptions());
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D,MAAM,OAAO,gBAAiB,SAAQ,oBAAoB;IACxD,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,WAAW,EAAE,uDAAuD;QACpE,QAAQ,EAAE;YACR;gBACE,oDAAoD;gBACpD;+EACuE;aACxE;SACF;KACF,CAAC,CAAA;IAEF,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA;IAE9B,KAAK,CAAC,OAAO;QACX,MAAM,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IAC3C,CAAC"}
|
package/dist/commands/build.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
2
|
import { Option } from 'clipanion';
|
|
3
3
|
import { buildProject } from '../api/build.js';
|
|
4
4
|
import { BaseBuildCommand } from '../def/build.js';
|
|
@@ -32,3 +32,4 @@ export class BuildCommand extends BaseBuildCommand {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,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2B,CAAA;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEpE,MAAM,OAAO,oBAAqB,SAAQ,wBAAwB;IAChE,KAAK,CAAC,OAAO;QACX,MAAM,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IACxC,CAAC;CACF"}
|
package/dist/commands/help.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAY;IAC3C,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IACnC,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;IACnD,CAAC"}
|
package/dist/commands/new.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from 'path';
|
|
1
|
+
import path from 'node:path';
|
|
2
2
|
import { Option } from 'clipanion';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
import { newProject } from '../api/new.js';
|
|
@@ -7,7 +7,7 @@ import { AVAILABLE_TARGETS, debugFactory, DEFAULT_TARGETS, } from '../utils/inde
|
|
|
7
7
|
import { napiEngineRequirement } from '../utils/version.js';
|
|
8
8
|
const debug = debugFactory('new');
|
|
9
9
|
export class NewCommand extends BaseNewCommand {
|
|
10
|
-
interactive = Option.Boolean('--interactive,-i',
|
|
10
|
+
interactive = Option.Boolean('--interactive,-i', true, {
|
|
11
11
|
description: 'Ask project basic information interactively without just using the default.',
|
|
12
12
|
});
|
|
13
13
|
async execute() {
|
|
@@ -25,9 +25,19 @@ export class NewCommand extends BaseNewCommand {
|
|
|
25
25
|
async fetchOptions() {
|
|
26
26
|
const cmdOptions = super.getOptions();
|
|
27
27
|
if (this.interactive) {
|
|
28
|
+
const targetPath = cmdOptions.path
|
|
29
|
+
? cmdOptions.path
|
|
30
|
+
: await inquirer
|
|
31
|
+
.prompt({
|
|
32
|
+
type: 'input',
|
|
33
|
+
name: 'path',
|
|
34
|
+
message: 'Target path to create the project, relative to cwd',
|
|
35
|
+
})
|
|
36
|
+
.then(({ path }) => path);
|
|
37
|
+
cmdOptions.path = targetPath;
|
|
28
38
|
return {
|
|
29
39
|
...cmdOptions,
|
|
30
|
-
name: await this.fetchName(path.parse(
|
|
40
|
+
name: await this.fetchName(path.parse(targetPath).base),
|
|
31
41
|
minNodeApiVersion: await this.fetchNapiVersion(),
|
|
32
42
|
targets: await this.fetchTargets(),
|
|
33
43
|
license: await this.fetchLicense(),
|
|
@@ -39,14 +49,14 @@ export class NewCommand extends BaseNewCommand {
|
|
|
39
49
|
}
|
|
40
50
|
async fetchName(defaultName) {
|
|
41
51
|
return (this.$$name ??
|
|
42
|
-
|
|
52
|
+
inquirer
|
|
43
53
|
.prompt({
|
|
44
54
|
type: 'input',
|
|
45
55
|
name: 'name',
|
|
46
56
|
message: 'Package name (the name field in your package.json file)',
|
|
47
57
|
default: defaultName,
|
|
48
58
|
})
|
|
49
|
-
.then(({ name }) => name))
|
|
59
|
+
.then(({ name }) => name));
|
|
50
60
|
}
|
|
51
61
|
async fetchLicense() {
|
|
52
62
|
return inquirer
|
|
@@ -65,7 +75,7 @@ export class NewCommand extends BaseNewCommand {
|
|
|
65
75
|
name: 'minNodeApiVersion',
|
|
66
76
|
message: 'Minimum node-api version (with node version requirement)',
|
|
67
77
|
loop: false,
|
|
68
|
-
choices:
|
|
78
|
+
choices: Array.from({ length: 8 }, (_, i) => ({
|
|
69
79
|
name: `napi${i + 1} (${napiEngineRequirement(i + 1)})`,
|
|
70
80
|
value: i + 1,
|
|
71
81
|
})),
|
|
@@ -107,3 +117,4 @@ export class NewCommand extends BaseNewCommand {
|
|
|
107
117
|
return enableGithubActions;
|
|
108
118
|
}
|
|
109
119
|
}
|
|
120
|
+
//# sourceMappingURL=new.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../src/commands/new.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAEhB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;AAEjC,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5C,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,EAAE;QACrD,WAAW,EACT,6EAA6E;KAChF,CAAC,CAAA;IAEF,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;YACzC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAA;YACzB,OAAO,CAAC,CAAA;QACV,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,KAAK,CAAC,8BAA8B,CAAC,CAAA;YACrC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACd,OAAO,CAAC,CAAA;QACV,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY;QACxB,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,CAAA;QAErC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,MAA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AE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YAC9C,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,wCAAwC;YACjD,OAAO,EAAE,IAAI,CAAC,aAAa;SAC5B,CAAC,CAAA;QAEF,OAAO,aAAa,CAAA;IACtB,CAAC;IAEO,KAAK,CAAC,kBAAkB;QAC9B,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACpD,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,0BAA0B;YACnC,OAAO,EAAE,IAAI,CAAC,mBAAmB;SAClC,CAAC,CAAA;QAEF,OAAO,mBAAmB,CAAA;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pre-publish.js","sourceRoot":"","sources":["../../src/commands/pre-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,MAAM,OAAO,iBAAkB,SAAQ,qBAAqB;IAC1D,KAAK,CAAC,OAAO;QACX,mDAAmD;QACnD,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IACrC,CAAC;CACF"}
|
package/dist/commands/rename.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename.js","sourceRoot":"","sources":["../../src/commands/rename.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAClD,KAAK,CAAC,OAAO;QACX,MAAM,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universalize.js","sourceRoot":"","sources":["../../src/commands/universalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAEhE,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAC9D,KAAK,CAAC,OAAO;QACX,MAAM,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IAC/C,CAAC;CACF"}
|
package/dist/commands/version.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IACpD,KAAK,CAAC,OAAO;QACX,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IAClC,CAAC;CACF"}
|
package/dist/def/artifacts.d.ts
CHANGED
|
@@ -3,14 +3,18 @@ export declare abstract class BaseArtifactsCommand extends Command {
|
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
static usage: import("clipanion").Usage;
|
|
5
5
|
cwd: string;
|
|
6
|
+
configPath?: string;
|
|
6
7
|
packageJsonPath: string;
|
|
7
8
|
outputDir: string;
|
|
8
9
|
npmDir: string;
|
|
10
|
+
buildOutputDir?: string;
|
|
9
11
|
getOptions(): {
|
|
10
12
|
cwd: string;
|
|
13
|
+
configPath: string | undefined;
|
|
11
14
|
packageJsonPath: string;
|
|
12
15
|
outputDir: string;
|
|
13
16
|
npmDir: string;
|
|
17
|
+
buildOutputDir: string | undefined;
|
|
14
18
|
};
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
@@ -23,6 +27,10 @@ export interface ArtifactsOptions {
|
|
|
23
27
|
* @default process.cwd()
|
|
24
28
|
*/
|
|
25
29
|
cwd?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Path to `napi` config json file
|
|
32
|
+
*/
|
|
33
|
+
configPath?: string;
|
|
26
34
|
/**
|
|
27
35
|
* Path to `package.json`
|
|
28
36
|
*
|
|
@@ -32,7 +40,7 @@ export interface ArtifactsOptions {
|
|
|
32
40
|
/**
|
|
33
41
|
* Path to the folder where all built `.node` files put, same as `--output-dir` of build command
|
|
34
42
|
*
|
|
35
|
-
* @default './'
|
|
43
|
+
* @default './artifacts'
|
|
36
44
|
*/
|
|
37
45
|
outputDir?: string;
|
|
38
46
|
/**
|
|
@@ -41,10 +49,22 @@ export interface ArtifactsOptions {
|
|
|
41
49
|
* @default 'npm'
|
|
42
50
|
*/
|
|
43
51
|
npmDir?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Path to the build output dir, only needed when targets contains `wasm32-wasi-*`
|
|
54
|
+
*/
|
|
55
|
+
buildOutputDir?: string;
|
|
44
56
|
}
|
|
45
57
|
export declare function applyDefaultArtifactsOptions(options: ArtifactsOptions): {
|
|
46
58
|
cwd: string;
|
|
59
|
+
/**
|
|
60
|
+
* Path to `napi` config json file
|
|
61
|
+
*/
|
|
62
|
+
configPath?: string | undefined;
|
|
47
63
|
packageJsonPath: string;
|
|
48
64
|
outputDir: string;
|
|
49
65
|
npmDir: string;
|
|
66
|
+
/**
|
|
67
|
+
* Path to the build output dir, only needed when targets contains `wasm32-wasi-*`
|
|
68
|
+
*/
|
|
69
|
+
buildOutputDir?: string | undefined;
|
|
50
70
|
};
|
package/dist/def/artifacts.js
CHANGED
|
@@ -9,21 +9,29 @@ export class BaseArtifactsCommand extends Command {
|
|
|
9
9
|
cwd = Option.String('--cwd', process.cwd(), {
|
|
10
10
|
description: 'The working directory of where napi command will be executed in, all other paths options are relative to this path',
|
|
11
11
|
});
|
|
12
|
+
configPath = Option.String('--config-path,-c', {
|
|
13
|
+
description: 'Path to `napi` config json file',
|
|
14
|
+
});
|
|
12
15
|
packageJsonPath = Option.String('--package-json-path', 'package.json', {
|
|
13
16
|
description: 'Path to `package.json`',
|
|
14
17
|
});
|
|
15
|
-
outputDir = Option.String('--output-dir,-o', './', {
|
|
18
|
+
outputDir = Option.String('--output-dir,-o,-d', './artifacts', {
|
|
16
19
|
description: 'Path to the folder where all built `.node` files put, same as `--output-dir` of build command',
|
|
17
20
|
});
|
|
18
21
|
npmDir = Option.String('--npm-dir', 'npm', {
|
|
19
22
|
description: 'Path to the folder where the npm packages put',
|
|
20
23
|
});
|
|
24
|
+
buildOutputDir = Option.String('--build-output-dir', {
|
|
25
|
+
description: 'Path to the build output dir, only needed when targets contains `wasm32-wasi-*`',
|
|
26
|
+
});
|
|
21
27
|
getOptions() {
|
|
22
28
|
return {
|
|
23
29
|
cwd: this.cwd,
|
|
30
|
+
configPath: this.configPath,
|
|
24
31
|
packageJsonPath: this.packageJsonPath,
|
|
25
32
|
outputDir: this.outputDir,
|
|
26
33
|
npmDir: this.npmDir,
|
|
34
|
+
buildOutputDir: this.buildOutputDir,
|
|
27
35
|
};
|
|
28
36
|
}
|
|
29
37
|
}
|
|
@@ -31,8 +39,9 @@ export function applyDefaultArtifactsOptions(options) {
|
|
|
31
39
|
return {
|
|
32
40
|
cwd: process.cwd(),
|
|
33
41
|
packageJsonPath: 'package.json',
|
|
34
|
-
outputDir: './',
|
|
42
|
+
outputDir: './artifacts',
|
|
35
43
|
npmDir: 'npm',
|
|
36
44
|
...options,
|
|
37
45
|
};
|
|
38
46
|
}
|
|
47
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/def/artifacts.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,O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,EAAE,cAAc;QAC/B,SAAS,EAAE,aAAa;QACxB,MAAM,EAAE,KAAK;QACb,GAAG,OAAO;KACX,CAAA;AACH,CAAC"}
|
package/dist/def/build.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ export declare abstract class BaseBuildCommand extends Command {
|
|
|
5
5
|
target?: string;
|
|
6
6
|
cwd?: string;
|
|
7
7
|
manifestPath?: string;
|
|
8
|
+
configPath?: string;
|
|
8
9
|
packageJsonPath?: string;
|
|
9
10
|
targetDir?: string;
|
|
10
11
|
outputDir?: string;
|
|
11
12
|
platform?: boolean;
|
|
12
13
|
jsPackageName?: string;
|
|
14
|
+
constEnum?: boolean;
|
|
13
15
|
jsBinding?: string;
|
|
14
16
|
noJsBinding?: boolean;
|
|
15
17
|
dts?: string;
|
|
@@ -23,6 +25,7 @@ export declare abstract class BaseBuildCommand extends Command {
|
|
|
23
25
|
profile?: string;
|
|
24
26
|
crossCompile?: boolean;
|
|
25
27
|
useCross?: boolean;
|
|
28
|
+
useNapiCross?: boolean;
|
|
26
29
|
watch?: boolean;
|
|
27
30
|
features?: string[];
|
|
28
31
|
allFeatures?: boolean;
|
|
@@ -31,11 +34,13 @@ export declare abstract class BaseBuildCommand extends Command {
|
|
|
31
34
|
target: string | undefined;
|
|
32
35
|
cwd: string | undefined;
|
|
33
36
|
manifestPath: string | undefined;
|
|
37
|
+
configPath: string | undefined;
|
|
34
38
|
packageJsonPath: string | undefined;
|
|
35
39
|
targetDir: string | undefined;
|
|
36
40
|
outputDir: string | undefined;
|
|
37
41
|
platform: boolean | undefined;
|
|
38
42
|
jsPackageName: string | undefined;
|
|
43
|
+
constEnum: boolean | undefined;
|
|
39
44
|
jsBinding: string | undefined;
|
|
40
45
|
noJsBinding: boolean | undefined;
|
|
41
46
|
dts: string | undefined;
|
|
@@ -49,6 +54,7 @@ export declare abstract class BaseBuildCommand extends Command {
|
|
|
49
54
|
profile: string | undefined;
|
|
50
55
|
crossCompile: boolean | undefined;
|
|
51
56
|
useCross: boolean | undefined;
|
|
57
|
+
useNapiCross: boolean | undefined;
|
|
52
58
|
watch: boolean | undefined;
|
|
53
59
|
features: string[] | undefined;
|
|
54
60
|
allFeatures: boolean | undefined;
|
|
@@ -56,7 +62,7 @@ export declare abstract class BaseBuildCommand extends Command {
|
|
|
56
62
|
};
|
|
57
63
|
}
|
|
58
64
|
/**
|
|
59
|
-
* Build the
|
|
65
|
+
* Build the NAPI-RS project
|
|
60
66
|
*/
|
|
61
67
|
export interface BuildOptions {
|
|
62
68
|
/**
|
|
@@ -71,6 +77,10 @@ export interface BuildOptions {
|
|
|
71
77
|
* Path to `Cargo.toml`
|
|
72
78
|
*/
|
|
73
79
|
manifestPath?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Path to `napi` config json file
|
|
82
|
+
*/
|
|
83
|
+
configPath?: string;
|
|
74
84
|
/**
|
|
75
85
|
* Path to `package.json`
|
|
76
86
|
*/
|
|
@@ -91,6 +101,10 @@ export interface BuildOptions {
|
|
|
91
101
|
* Package name in generated js binding file. Only works with `--platform` flag
|
|
92
102
|
*/
|
|
93
103
|
jsPackageName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Whether generate const enum for typescript bindings
|
|
106
|
+
*/
|
|
107
|
+
constEnum?: boolean;
|
|
94
108
|
/**
|
|
95
109
|
* Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.
|
|
96
110
|
*/
|
|
@@ -144,7 +158,11 @@ export interface BuildOptions {
|
|
|
144
158
|
*/
|
|
145
159
|
useCross?: boolean;
|
|
146
160
|
/**
|
|
147
|
-
*
|
|
161
|
+
* [experimental] use @napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets.
|
|
162
|
+
*/
|
|
163
|
+
useNapiCross?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* watch the crate changes and build continuously with `cargo-watch` crates
|
|
148
166
|
*/
|
|
149
167
|
watch?: boolean;
|
|
150
168
|
/**
|