@napi-rs/cli 3.0.0-alpha.27 → 3.0.0-alpha.29
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 +16 -5
- package/dist/api/artifacts.js.map +1 -1
- package/dist/api/create-npm-dirs.js +12 -0
- package/dist/api/create-npm-dirs.js.map +1 -1
- package/dist/api/templates/package.json.d.ts +5 -0
- package/dist/def/artifacts.d.ts +10 -0
- package/dist/def/artifacts.js +4 -0
- package/dist/def/artifacts.js.map +1 -1
- package/dist/index.cjs +31 -7
- package/package.json +2 -2
- package/src/api/artifacts.ts +44 -5
- package/src/api/create-npm-dirs.ts +17 -0
- package/src/api/templates/package.json.ts +1 -1
- package/src/def/artifacts.ts +10 -0
package/dist/api/artifacts.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { join, parse
|
|
1
|
+
import { join, parse } from 'node:path';
|
|
2
2
|
import * as colors from 'colorette';
|
|
3
3
|
import { applyDefaultArtifactsOptions, } from '../def/artifacts.js';
|
|
4
4
|
import { readNapiConfig, debugFactory, readFileAsync, writeFileAsync, UniArchsByPlatform, readdirAsync, } from '../utils/index.js';
|
|
5
5
|
const debug = debugFactory('artifacts');
|
|
6
6
|
export async function collectArtifacts(userOptions) {
|
|
7
7
|
const options = applyDefaultArtifactsOptions(userOptions);
|
|
8
|
-
const packageJsonPath =
|
|
8
|
+
const packageJsonPath = join(options.cwd, options.packageJsonPath);
|
|
9
9
|
const { targets, binaryName } = await readNapiConfig(packageJsonPath);
|
|
10
|
-
const distDirs = targets.map((platform) =>
|
|
10
|
+
const distDirs = targets.map((platform) => join(options.cwd, options.npmDir, platform.platformArchABI));
|
|
11
11
|
const universalSourceBins = new Set(targets
|
|
12
12
|
.filter((platform) => platform.arch === 'universal')
|
|
13
13
|
.flatMap((p) => UniArchsByPlatform[p.platform]?.map((a) => `${p.platform}-${a}`))
|
|
14
14
|
.filter(Boolean));
|
|
15
|
-
await collectNodeBinaries(
|
|
15
|
+
await collectNodeBinaries(join(options.cwd, options.outputDir)).then((output) => Promise.all(output.map(async (filePath) => {
|
|
16
16
|
debug.info(`Read [${colors.yellowBright(filePath)}]`);
|
|
17
17
|
const sourceContent = await readFileAsync(filePath);
|
|
18
18
|
const parsedName = parse(filePath);
|
|
@@ -38,11 +38,22 @@ export async function collectArtifacts(userOptions) {
|
|
|
38
38
|
debug.info(`Write file content to [${colors.yellowBright(distFilePathLocal)}]`);
|
|
39
39
|
await writeFileAsync(distFilePathLocal, sourceContent);
|
|
40
40
|
})));
|
|
41
|
+
const wasiTarget = targets.find((t) => t.platform === 'wasi');
|
|
42
|
+
if (wasiTarget) {
|
|
43
|
+
const wasiDir = join(options.cwd, options.npmDir, wasiTarget.platformArchABI);
|
|
44
|
+
const cjsFile = join(options.buildOutputDir ?? options.cwd, `${binaryName}.wasi.cjs`);
|
|
45
|
+
const workerFile = join(options.buildOutputDir ?? options.cwd, `wasi-worker.mjs`);
|
|
46
|
+
debug.info(`Move wasi cjs file [${colors.yellowBright(cjsFile)}] to [${colors.yellowBright(wasiDir)}]`);
|
|
47
|
+
await writeFileAsync(join(wasiDir, `${binaryName}.wasi.cjs`), await readFileAsync(cjsFile));
|
|
48
|
+
debug.info(`Move wasi worker file [${colors.yellowBright(workerFile)}] to [${colors.yellowBright(wasiDir)}]`);
|
|
49
|
+
await writeFileAsync(join(wasiDir, `wasi-worker.mjs`), await readFileAsync(workerFile));
|
|
50
|
+
}
|
|
41
51
|
}
|
|
42
52
|
async function collectNodeBinaries(root) {
|
|
43
53
|
const files = await readdirAsync(root, { withFileTypes: true });
|
|
44
54
|
const nodeBinaries = files
|
|
45
|
-
.filter((file) => file.isFile() &&
|
|
55
|
+
.filter((file) => file.isFile() &&
|
|
56
|
+
(file.name.endsWith('.node') || file.name.endsWith('.wasm')))
|
|
46
57
|
.map((file) => join(root, file.name));
|
|
47
58
|
const dirs = files.filter((file) => file.isDirectory());
|
|
48
59
|
for (const dir of dirs) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/api/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/api/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AAEnC,OAAO,EACL,4BAA4B,GAE7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAA;AAE1B,MAAM,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;AAEvC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,WAA6B;IAClE,MAAM,OAAO,GAAG,4BAA4B,CAAC,WAAW,CAAC,CAAA;IAEzD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAClE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,cAAc,CAAC,eAAe,CAAC,CAAA;IAErE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAC5D,CAAA;IAED,MAAM,mBAAmB,GAAG,IAAI,GAAG,CACjC,OAAO;SACJ,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,CAAC;SACnD,OAAO,CACN,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ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AAY,CAAA;AACrB,CAAC"}
|
|
@@ -43,6 +43,18 @@ export async function createNpmDirs(userOptions) {
|
|
|
43
43
|
// @ts-expect-error
|
|
44
44
|
scopedPackageJson.os = [target.platform];
|
|
45
45
|
}
|
|
46
|
+
else {
|
|
47
|
+
const entry = `${binaryName}.wasi.cjs`;
|
|
48
|
+
scopedPackageJson.files.push(entry, `wasi-worker.mjs`);
|
|
49
|
+
scopedPackageJson.main = entry;
|
|
50
|
+
const emnapiCore = await fetch(`https://registry.npmjs.org/@emnapi/core`).then((res) => res.json());
|
|
51
|
+
const emnapiRuntime = await fetch(`https://registry.npmjs.org/@emnapi/runtime`).then((res) => res.json());
|
|
52
|
+
// @ts-expect-error
|
|
53
|
+
scopedPackageJson.dependencies = {
|
|
54
|
+
'@emnapi/core': `^${emnapiCore['dist-tags'].latest}`,
|
|
55
|
+
'@emnapi/runtime': `^${emnapiRuntime['dist-tags'].latest}`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
46
58
|
if (target.abi === 'gnu') {
|
|
47
59
|
// @ts-expect-error
|
|
48
60
|
scopedPackageJson.libc = ['glibc'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-npm-dirs.js","sourceRoot":"","sources":["../../src/api/create-npm-dirs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EACL,gCAAgC,GAEjC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,IAAI,aAAa,EAC3B,IAAI,EACJ,cAAc,IAAI,iBAAiB,GAEpC,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"create-npm-dirs.js","sourceRoot":"","sources":["../../src/api/create-npm-dirs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EACL,gCAAgC,GAEjC,MA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AC,WAAmB,EAAE,MAAc;IACjD,OAAO,OAAO,WAAW,IAAI,MAAM,CAAC,eAAe;;gBAErC,MAAM,CAAC,MAAM,mBAAmB,WAAW;CAC1D,CAAA;AACD,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { SupportedTestFramework } from '../../utils/config.js';
|
|
2
|
+
export interface PackageMeta {
|
|
3
|
+
'dist-tags': {
|
|
4
|
+
[index: string]: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
2
7
|
export declare const createPackageJson: ({ name, binaryName, targets, license, engineRequirement, cliVersion, testFramework, }: {
|
|
3
8
|
name: string;
|
|
4
9
|
binaryName: string;
|
package/dist/def/artifacts.d.ts
CHANGED
|
@@ -7,12 +7,14 @@ export declare abstract class BaseArtifactsCommand extends Command {
|
|
|
7
7
|
packageJsonPath: string;
|
|
8
8
|
outputDir: string;
|
|
9
9
|
npmDir: string;
|
|
10
|
+
buildOutputDir?: string;
|
|
10
11
|
getOptions(): {
|
|
11
12
|
cwd: string;
|
|
12
13
|
configPath: string | undefined;
|
|
13
14
|
packageJsonPath: string;
|
|
14
15
|
outputDir: string;
|
|
15
16
|
npmDir: string;
|
|
17
|
+
buildOutputDir: string | undefined;
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
@@ -47,6 +49,10 @@ export interface ArtifactsOptions {
|
|
|
47
49
|
* @default 'npm'
|
|
48
50
|
*/
|
|
49
51
|
npmDir?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Path to the build output dir, only needed when targets contains `wasm32-wasi-*`
|
|
54
|
+
*/
|
|
55
|
+
buildOutputDir?: string;
|
|
50
56
|
}
|
|
51
57
|
export declare function applyDefaultArtifactsOptions(options: ArtifactsOptions): {
|
|
52
58
|
cwd: string;
|
|
@@ -57,4 +63,8 @@ export declare function applyDefaultArtifactsOptions(options: ArtifactsOptions):
|
|
|
57
63
|
packageJsonPath: string;
|
|
58
64
|
outputDir: string;
|
|
59
65
|
npmDir: string;
|
|
66
|
+
/**
|
|
67
|
+
* Path to the build output dir, only needed when targets contains `wasm32-wasi-*`
|
|
68
|
+
*/
|
|
69
|
+
buildOutputDir?: string | undefined;
|
|
60
70
|
};
|
package/dist/def/artifacts.js
CHANGED
|
@@ -21,6 +21,9 @@ export class BaseArtifactsCommand extends Command {
|
|
|
21
21
|
npmDir = Option.String('--npm-dir', 'npm', {
|
|
22
22
|
description: 'Path to the folder where the npm packages put',
|
|
23
23
|
});
|
|
24
|
+
buildOutputDir = Option.String('--build-output-dir', {
|
|
25
|
+
description: 'Path to the build output dir, only needed when targets contains `wasm32-wasi-*`',
|
|
26
|
+
});
|
|
24
27
|
getOptions() {
|
|
25
28
|
return {
|
|
26
29
|
cwd: this.cwd,
|
|
@@ -28,6 +31,7 @@ export class BaseArtifactsCommand extends Command {
|
|
|
28
31
|
packageJsonPath: this.packageJsonPath,
|
|
29
32
|
outputDir: this.outputDir,
|
|
30
33
|
npmDir: this.npmDir,
|
|
34
|
+
buildOutputDir: this.buildOutputDir,
|
|
31
35
|
};
|
|
32
36
|
}
|
|
33
37
|
}
|
|
@@ -1 +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,OAAgB,oBAAqB,SAAQ,OAAO;IACxD,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA;IAE9B,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,WAAW,EACT,2EAA2E;KAC9E,CAAC,CAAA;IAEF,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE;QAC1C,WAAW,EACT,oHAAoH;KACvH,CAAC,CAAA;IAEF,UAAU,GAAY,MA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;IAEF,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,cAAc,EAAE;QACrE,WAAW,EAAE,wBAAwB;KACtC,CAAC,CAAA;IAEF,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE,aAAa,EAAE;QAC7D,WAAW,EACT,+FAA+F;KAClG,CAAC,CAAA;IAEF,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE;QACzC,WAAW,EAAE,+CAA+C;KAC7D,CAAC,CAAA;IAEF,cAAc,GAAY,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE;QAC5D,WAAW,EACT,iFAAiF;KACpF,CAAC,CAAA;IAEF,UAAU;QACR,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAA;IACH,CAAC;;AAyCH,MAAM,UAAU,4BAA4B,CAAC,OAAyB;IACpE,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,eAAe,EAAE,cAAc;QAC/B,SAAS,EAAE,aAAa;QACxB,MAAM,EAAE,KAAK;QACb,GAAG,OAAO;KACX,CAAA;AACH,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -7780,13 +7780,17 @@ var BaseArtifactsCommand = class extends import_clipanion.Command {
|
|
|
7780
7780
|
npmDir = import_clipanion.Option.String("--npm-dir", "npm", {
|
|
7781
7781
|
description: "Path to the folder where the npm packages put"
|
|
7782
7782
|
});
|
|
7783
|
+
buildOutputDir = import_clipanion.Option.String("--build-output-dir", {
|
|
7784
|
+
description: "Path to the build output dir, only needed when targets contains `wasm32-wasi-*`"
|
|
7785
|
+
});
|
|
7783
7786
|
getOptions() {
|
|
7784
7787
|
return {
|
|
7785
7788
|
cwd: this.cwd,
|
|
7786
7789
|
configPath: this.configPath,
|
|
7787
7790
|
packageJsonPath: this.packageJsonPath,
|
|
7788
7791
|
outputDir: this.outputDir,
|
|
7789
|
-
npmDir: this.npmDir
|
|
7792
|
+
npmDir: this.npmDir,
|
|
7793
|
+
buildOutputDir: this.buildOutputDir
|
|
7790
7794
|
};
|
|
7791
7795
|
}
|
|
7792
7796
|
};
|
|
@@ -10668,11 +10672,11 @@ function correctStringIdent(src, ident) {
|
|
|
10668
10672
|
var debug2 = debugFactory("artifacts");
|
|
10669
10673
|
async function collectArtifacts(userOptions) {
|
|
10670
10674
|
const options = applyDefaultArtifactsOptions(userOptions);
|
|
10671
|
-
const packageJsonPath = (0, import_node_path.
|
|
10675
|
+
const packageJsonPath = (0, import_node_path.join)(options.cwd, options.packageJsonPath);
|
|
10672
10676
|
const { targets, binaryName } = await readNapiConfig(packageJsonPath);
|
|
10673
|
-
const distDirs = targets.map((platform2) => (0, import_node_path.
|
|
10677
|
+
const distDirs = targets.map((platform2) => (0, import_node_path.join)(options.cwd, options.npmDir, platform2.platformArchABI));
|
|
10674
10678
|
const universalSourceBins = new Set(targets.filter((platform2) => platform2.arch === "universal").flatMap((p) => UniArchsByPlatform[p.platform]?.map((a) => `${p.platform}-${a}`)).filter(Boolean));
|
|
10675
|
-
await collectNodeBinaries((0, import_node_path.
|
|
10679
|
+
await collectNodeBinaries((0, import_node_path.join)(options.cwd, options.outputDir)).then((output) => Promise.all(output.map(async (filePath) => {
|
|
10676
10680
|
debug2.info(`Read [${yellowBright(filePath)}]`);
|
|
10677
10681
|
const sourceContent = await readFileAsync(filePath);
|
|
10678
10682
|
const parsedName = (0, import_node_path.parse)(filePath);
|
|
@@ -10698,10 +10702,20 @@ async function collectArtifacts(userOptions) {
|
|
|
10698
10702
|
debug2.info(`Write file content to [${yellowBright(distFilePathLocal)}]`);
|
|
10699
10703
|
await writeFileAsync(distFilePathLocal, sourceContent);
|
|
10700
10704
|
})));
|
|
10705
|
+
const wasiTarget = targets.find((t) => t.platform === "wasi");
|
|
10706
|
+
if (wasiTarget) {
|
|
10707
|
+
const wasiDir = (0, import_node_path.join)(options.cwd, options.npmDir, wasiTarget.platformArchABI);
|
|
10708
|
+
const cjsFile = (0, import_node_path.join)(options.buildOutputDir ?? options.cwd, `${binaryName}.wasi.cjs`);
|
|
10709
|
+
const workerFile = (0, import_node_path.join)(options.buildOutputDir ?? options.cwd, `wasi-worker.mjs`);
|
|
10710
|
+
debug2.info(`Move wasi cjs file [${yellowBright(cjsFile)}] to [${yellowBright(wasiDir)}]`);
|
|
10711
|
+
await writeFileAsync((0, import_node_path.join)(wasiDir, `${binaryName}.wasi.cjs`), await readFileAsync(cjsFile));
|
|
10712
|
+
debug2.info(`Move wasi worker file [${yellowBright(workerFile)}] to [${yellowBright(wasiDir)}]`);
|
|
10713
|
+
await writeFileAsync((0, import_node_path.join)(wasiDir, `wasi-worker.mjs`), await readFileAsync(workerFile));
|
|
10714
|
+
}
|
|
10701
10715
|
}
|
|
10702
10716
|
async function collectNodeBinaries(root2) {
|
|
10703
10717
|
const files = await readdirAsync(root2, { withFileTypes: true });
|
|
10704
|
-
const nodeBinaries = files.filter((file) => file.isFile() && file.name.endsWith(".node")).map((file) => (0, import_node_path.join)(root2, file.name));
|
|
10718
|
+
const nodeBinaries = files.filter((file) => file.isFile() && (file.name.endsWith(".node") || file.name.endsWith(".wasm"))).map((file) => (0, import_node_path.join)(root2, file.name));
|
|
10705
10719
|
const dirs = files.filter((file) => file.isDirectory());
|
|
10706
10720
|
for (const dir of dirs) {
|
|
10707
10721
|
if (dir.name !== "node_modules") {
|
|
@@ -14926,7 +14940,7 @@ var Builder = class {
|
|
|
14926
14940
|
debug3(" %i", `cargo ${this.args.join(" ")}`);
|
|
14927
14941
|
const controller = new AbortController();
|
|
14928
14942
|
const watch = this.options.watch;
|
|
14929
|
-
const buildTask = new Promise((
|
|
14943
|
+
const buildTask = new Promise((resolve7, reject) => {
|
|
14930
14944
|
if (this.options.useCross && this.options.crossCompile) {
|
|
14931
14945
|
throw new Error("`--use-cross` and `--cross-compile` can not be used together");
|
|
14932
14946
|
}
|
|
@@ -14943,7 +14957,7 @@ var Builder = class {
|
|
|
14943
14957
|
buildProcess.once("exit", (code) => {
|
|
14944
14958
|
if (code === 0) {
|
|
14945
14959
|
debug3("%i", `Build crate ${this.crate.name} successfully!`);
|
|
14946
|
-
|
|
14960
|
+
resolve7();
|
|
14947
14961
|
} else {
|
|
14948
14962
|
reject(new Error(`Build failed with exit code ${code}`));
|
|
14949
14963
|
}
|
|
@@ -15356,6 +15370,16 @@ async function createNpmDirs(userOptions) {
|
|
|
15356
15370
|
};
|
|
15357
15371
|
if (target.arch !== "wasm32") {
|
|
15358
15372
|
scopedPackageJson.os = [target.platform];
|
|
15373
|
+
} else {
|
|
15374
|
+
const entry = `${binaryName}.wasi.cjs`;
|
|
15375
|
+
scopedPackageJson.files.push(entry, `wasi-worker.mjs`);
|
|
15376
|
+
scopedPackageJson.main = entry;
|
|
15377
|
+
const emnapiCore = await fetch(`https://registry.npmjs.org/@emnapi/core`).then((res) => res.json());
|
|
15378
|
+
const emnapiRuntime = await fetch(`https://registry.npmjs.org/@emnapi/runtime`).then((res) => res.json());
|
|
15379
|
+
scopedPackageJson.dependencies = {
|
|
15380
|
+
"@emnapi/core": `^${emnapiCore["dist-tags"].latest}`,
|
|
15381
|
+
"@emnapi/runtime": `^${emnapiRuntime["dist-tags"].latest}`
|
|
15382
|
+
};
|
|
15359
15383
|
}
|
|
15360
15384
|
if (target.abi === "gnu") {
|
|
15361
15385
|
scopedPackageJson.libc = ["glibc"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/cli",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.29",
|
|
4
4
|
"description": "Cli tools for napi-rs",
|
|
5
5
|
"author": "LongYinan <lynweklm@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/napi-rs/napi-rs",
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"**/__tests__/**/*.spec.ts"
|
|
131
131
|
]
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "8e3e688c28cbcdb6c8db447b6c10419e0eab845d"
|
|
134
134
|
}
|
package/src/api/artifacts.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { join, parse
|
|
1
|
+
import { join, parse } from 'node:path'
|
|
2
2
|
|
|
3
3
|
import * as colors from 'colorette'
|
|
4
4
|
|
|
@@ -20,11 +20,11 @@ const debug = debugFactory('artifacts')
|
|
|
20
20
|
export async function collectArtifacts(userOptions: ArtifactsOptions) {
|
|
21
21
|
const options = applyDefaultArtifactsOptions(userOptions)
|
|
22
22
|
|
|
23
|
-
const packageJsonPath =
|
|
23
|
+
const packageJsonPath = join(options.cwd, options.packageJsonPath)
|
|
24
24
|
const { targets, binaryName } = await readNapiConfig(packageJsonPath)
|
|
25
25
|
|
|
26
26
|
const distDirs = targets.map((platform) =>
|
|
27
|
-
|
|
27
|
+
join(options.cwd, options.npmDir, platform.platformArchABI),
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
const universalSourceBins = new Set(
|
|
@@ -36,7 +36,7 @@ export async function collectArtifacts(userOptions: ArtifactsOptions) {
|
|
|
36
36
|
.filter(Boolean) as string[],
|
|
37
37
|
)
|
|
38
38
|
|
|
39
|
-
await collectNodeBinaries(
|
|
39
|
+
await collectNodeBinaries(join(options.cwd, options.outputDir)).then(
|
|
40
40
|
(output) =>
|
|
41
41
|
Promise.all(
|
|
42
42
|
output.map(async (filePath) => {
|
|
@@ -80,12 +80,51 @@ export async function collectArtifacts(userOptions: ArtifactsOptions) {
|
|
|
80
80
|
}),
|
|
81
81
|
),
|
|
82
82
|
)
|
|
83
|
+
|
|
84
|
+
const wasiTarget = targets.find((t) => t.platform === 'wasi')
|
|
85
|
+
if (wasiTarget) {
|
|
86
|
+
const wasiDir = join(
|
|
87
|
+
options.cwd,
|
|
88
|
+
options.npmDir,
|
|
89
|
+
wasiTarget.platformArchABI,
|
|
90
|
+
)
|
|
91
|
+
const cjsFile = join(
|
|
92
|
+
options.buildOutputDir ?? options.cwd,
|
|
93
|
+
`${binaryName}.wasi.cjs`,
|
|
94
|
+
)
|
|
95
|
+
const workerFile = join(
|
|
96
|
+
options.buildOutputDir ?? options.cwd,
|
|
97
|
+
`wasi-worker.mjs`,
|
|
98
|
+
)
|
|
99
|
+
debug.info(
|
|
100
|
+
`Move wasi cjs file [${colors.yellowBright(
|
|
101
|
+
cjsFile,
|
|
102
|
+
)}] to [${colors.yellowBright(wasiDir)}]`,
|
|
103
|
+
)
|
|
104
|
+
await writeFileAsync(
|
|
105
|
+
join(wasiDir, `${binaryName}.wasi.cjs`),
|
|
106
|
+
await readFileAsync(cjsFile),
|
|
107
|
+
)
|
|
108
|
+
debug.info(
|
|
109
|
+
`Move wasi worker file [${colors.yellowBright(
|
|
110
|
+
workerFile,
|
|
111
|
+
)}] to [${colors.yellowBright(wasiDir)}]`,
|
|
112
|
+
)
|
|
113
|
+
await writeFileAsync(
|
|
114
|
+
join(wasiDir, `wasi-worker.mjs`),
|
|
115
|
+
await readFileAsync(workerFile),
|
|
116
|
+
)
|
|
117
|
+
}
|
|
83
118
|
}
|
|
84
119
|
|
|
85
120
|
async function collectNodeBinaries(root: string) {
|
|
86
121
|
const files = await readdirAsync(root, { withFileTypes: true })
|
|
87
122
|
const nodeBinaries = files
|
|
88
|
-
.filter(
|
|
123
|
+
.filter(
|
|
124
|
+
(file) =>
|
|
125
|
+
file.isFile() &&
|
|
126
|
+
(file.name.endsWith('.node') || file.name.endsWith('.wasm')),
|
|
127
|
+
)
|
|
89
128
|
.map((file) => join(root, file.name))
|
|
90
129
|
|
|
91
130
|
const dirs = files.filter((file) => file.isDirectory())
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
Target,
|
|
14
14
|
} from '../utils/index.js'
|
|
15
15
|
|
|
16
|
+
import type { PackageMeta } from './templates/package.json.js'
|
|
17
|
+
|
|
16
18
|
const debug = debugFactory('create-npm-dirs')
|
|
17
19
|
|
|
18
20
|
export async function createNpmDirs(userOptions: CreateNpmDirsOptions) {
|
|
@@ -82,6 +84,21 @@ export async function createNpmDirs(userOptions: CreateNpmDirsOptions) {
|
|
|
82
84
|
if (target.arch !== 'wasm32') {
|
|
83
85
|
// @ts-expect-error
|
|
84
86
|
scopedPackageJson.os = [target.platform]
|
|
87
|
+
} else {
|
|
88
|
+
const entry = `${binaryName}.wasi.cjs`
|
|
89
|
+
scopedPackageJson.files.push(entry, `wasi-worker.mjs`)
|
|
90
|
+
scopedPackageJson.main = entry
|
|
91
|
+
const emnapiCore = await fetch(
|
|
92
|
+
`https://registry.npmjs.org/@emnapi/core`,
|
|
93
|
+
).then((res) => res.json() as Promise<PackageMeta>)
|
|
94
|
+
const emnapiRuntime = await fetch(
|
|
95
|
+
`https://registry.npmjs.org/@emnapi/runtime`,
|
|
96
|
+
).then((res) => res.json() as Promise<PackageMeta>)
|
|
97
|
+
// @ts-expect-error
|
|
98
|
+
scopedPackageJson.dependencies = {
|
|
99
|
+
'@emnapi/core': `^${emnapiCore['dist-tags'].latest}`,
|
|
100
|
+
'@emnapi/runtime': `^${emnapiRuntime['dist-tags'].latest}`,
|
|
101
|
+
}
|
|
85
102
|
}
|
|
86
103
|
|
|
87
104
|
if (target.abi === 'gnu') {
|
package/src/def/artifacts.ts
CHANGED
|
@@ -32,6 +32,11 @@ export abstract class BaseArtifactsCommand extends Command {
|
|
|
32
32
|
description: 'Path to the folder where the npm packages put',
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
+
buildOutputDir?: string = Option.String('--build-output-dir', {
|
|
36
|
+
description:
|
|
37
|
+
'Path to the build output dir, only needed when targets contains `wasm32-wasi-*`',
|
|
38
|
+
})
|
|
39
|
+
|
|
35
40
|
getOptions() {
|
|
36
41
|
return {
|
|
37
42
|
cwd: this.cwd,
|
|
@@ -39,6 +44,7 @@ export abstract class BaseArtifactsCommand extends Command {
|
|
|
39
44
|
packageJsonPath: this.packageJsonPath,
|
|
40
45
|
outputDir: this.outputDir,
|
|
41
46
|
npmDir: this.npmDir,
|
|
47
|
+
buildOutputDir: this.buildOutputDir,
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
@@ -75,6 +81,10 @@ export interface ArtifactsOptions {
|
|
|
75
81
|
* @default 'npm'
|
|
76
82
|
*/
|
|
77
83
|
npmDir?: string
|
|
84
|
+
/**
|
|
85
|
+
* Path to the build output dir, only needed when targets contains `wasm32-wasi-*`
|
|
86
|
+
*/
|
|
87
|
+
buildOutputDir?: string
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
export function applyDefaultArtifactsOptions(options: ArtifactsOptions) {
|