@neon-rs/cli 0.1.23 → 0.1.26
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/index.js +68 -23
- package/package.json +8 -8
package/index.js
CHANGED
|
@@ -40266,11 +40266,23 @@ var lib = __nccwpck_require__(3993);
|
|
|
40266
40266
|
;// CONCATENATED MODULE: ./node_modules/cargo-messages/lib/index.mjs
|
|
40267
40267
|
|
|
40268
40268
|
|
|
40269
|
+
// EXTERNAL MODULE: ../node_modules/@neon-rs/manifest/lib/index.cjs
|
|
40270
|
+
var manifest_lib = __nccwpck_require__(4696);
|
|
40271
|
+
;// CONCATENATED MODULE: ../node_modules/@neon-rs/manifest/lib/index.mjs
|
|
40272
|
+
|
|
40273
|
+
|
|
40274
|
+
// EXTERNAL MODULE: ../node_modules/@neon-rs/manifest/lib/platform.cjs
|
|
40275
|
+
var lib_platform = __nccwpck_require__(2147);
|
|
40276
|
+
;// CONCATENATED MODULE: ../node_modules/@neon-rs/manifest/lib/platform.mjs
|
|
40277
|
+
|
|
40278
|
+
|
|
40269
40279
|
;// CONCATENATED MODULE: ./src/commands/dist.ts
|
|
40270
40280
|
|
|
40271
40281
|
|
|
40272
40282
|
|
|
40273
40283
|
|
|
40284
|
+
|
|
40285
|
+
|
|
40274
40286
|
// FIXME: add options to infer crate name from manifests
|
|
40275
40287
|
// --package <path/to/package.json>
|
|
40276
40288
|
// --crate <path/to/Cargo.toml>
|
|
@@ -40281,6 +40293,8 @@ const OPTIONS = [
|
|
|
40281
40293
|
{ name: 'mount', alias: 'm', type: String, defaultValue: null },
|
|
40282
40294
|
{ name: 'manifest-path', type: String, defaultValue: null },
|
|
40283
40295
|
{ name: 'out', alias: 'o', type: String, defaultValue: null },
|
|
40296
|
+
{ name: 'platform', alias: 'p', type: String, defaultValue: null },
|
|
40297
|
+
{ name: 'debug', alias: 'd', type: Boolean, defaultValue: false },
|
|
40284
40298
|
{ name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
|
|
40285
40299
|
];
|
|
40286
40300
|
function createInputStream(file) {
|
|
@@ -40295,20 +40309,53 @@ function ensureDefined(str, msg) {
|
|
|
40295
40309
|
}
|
|
40296
40310
|
return str;
|
|
40297
40311
|
}
|
|
40312
|
+
function parseOutputFile(debug, out, platform) {
|
|
40313
|
+
if (debug && out) {
|
|
40314
|
+
throw new Error("Options --debug and --out cannot both be enabled.");
|
|
40315
|
+
}
|
|
40316
|
+
else if (debug && platform) {
|
|
40317
|
+
throw new Error("Options --debug and --platform cannot both be enabled.");
|
|
40318
|
+
}
|
|
40319
|
+
else if (out && platform) {
|
|
40320
|
+
throw new Error("Options --out and --platform cannot both be enabled.");
|
|
40321
|
+
}
|
|
40322
|
+
const NEON_DIST_OUTPUT = process.env['NEON_DIST_OUTPUT'];
|
|
40323
|
+
const NEON_BUILD_PLATFORM = process.env['NEON_BUILD_PLATFORM'];
|
|
40324
|
+
if (platform || (!debug && NEON_BUILD_PLATFORM)) {
|
|
40325
|
+
const p = platform || NEON_BUILD_PLATFORM;
|
|
40326
|
+
(0,lib_platform.assertIsNodePlatform)(p);
|
|
40327
|
+
return manifest_lib/* LibraryManifest.load */.N.load().then(manifest => {
|
|
40328
|
+
const path = manifest.getPlatformOutputPath(p);
|
|
40329
|
+
if (!path) {
|
|
40330
|
+
throw new Error(`Platform $p not supported by this library.`);
|
|
40331
|
+
}
|
|
40332
|
+
return path;
|
|
40333
|
+
});
|
|
40334
|
+
}
|
|
40335
|
+
else if (out || (!debug && NEON_DIST_OUTPUT)) {
|
|
40336
|
+
const path = out || NEON_DIST_OUTPUT;
|
|
40337
|
+
return Promise.resolve(path);
|
|
40338
|
+
}
|
|
40339
|
+
else {
|
|
40340
|
+
return Promise.resolve('index.node');
|
|
40341
|
+
}
|
|
40342
|
+
}
|
|
40298
40343
|
class Dist {
|
|
40299
40344
|
static summary() { return 'Generate a binary .node file from a cargo output log.'; }
|
|
40300
|
-
static syntax() { return 'neon dist [-n <name>] [-f <
|
|
40345
|
+
static syntax() { return 'neon dist [-n <name>] [-f <file>|[-l <log>] [-m <path>]] [-p <platform> | -d]'; }
|
|
40301
40346
|
static options() {
|
|
40302
40347
|
return [
|
|
40303
40348
|
{ name: '-n, --name', summary: 'Crate name. (Default: $npm_package_name)' },
|
|
40304
|
-
{ name: '-f, --file <
|
|
40349
|
+
{ name: '-f, --file <file>', summary: 'Build .node from dylib file <file>.' },
|
|
40305
40350
|
{ name: '-l, --log <log>', summary: 'Find dylib path from cargo messages <log>. (Default: stdin)' },
|
|
40306
40351
|
{
|
|
40307
40352
|
name: '-m, --mount <path>',
|
|
40308
40353
|
summary: 'Mounted path of target directory in virtual filesystem. This is used to map paths from the log data back to their real paths, needed when tools such as cross-rs report messages from within a mounted Docker filesystem.'
|
|
40309
40354
|
},
|
|
40310
40355
|
{ name: '--manifest-path <path>', summary: 'Real path to Cargo.toml. (Default: cargo behavior)' },
|
|
40311
|
-
{ name: '-o, --out <dist>', summary: 'Copy output to file <dist>. (Default: $NEON_DIST_OUTPUT or index.node)' },
|
|
40356
|
+
// { name: '-o, --out <dist>', summary: 'Copy output to file <dist>. (Default: $NEON_DIST_OUTPUT or index.node)' },
|
|
40357
|
+
{ name: '-p, --platform <platform>', summary: 'Stage output file for caching to platform <platform>. (Default: $NEON_BUILD_PLATFORM or -d)' },
|
|
40358
|
+
{ name: '-d, --debug', summary: 'Generate output file for debugging (./index.node)' },
|
|
40312
40359
|
{ name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
|
|
40313
40360
|
];
|
|
40314
40361
|
}
|
|
@@ -40343,9 +40390,7 @@ class Dist {
|
|
|
40343
40390
|
this._manifestPath = options['manifest-path'];
|
|
40344
40391
|
this._crateName = options.name ||
|
|
40345
40392
|
basename(ensureDefined(process.env['npm_package_name'], '$npm_package_name'));
|
|
40346
|
-
this._out = options.out
|
|
40347
|
-
process.env['NEON_DIST_OUTPUT'] ||
|
|
40348
|
-
'index.node';
|
|
40393
|
+
this._out = parseOutputFile(options.debug, options.out, options.platform);
|
|
40349
40394
|
this._verbose = !!options.verbose;
|
|
40350
40395
|
this.log(`crate name = "${this._crateName}"`);
|
|
40351
40396
|
}
|
|
@@ -40392,7 +40437,7 @@ class Dist {
|
|
|
40392
40437
|
async run() {
|
|
40393
40438
|
const file = this._file || (await this.findArtifact());
|
|
40394
40439
|
// FIXME: needs all the logic of cargo-cp-artifact (timestamp check, M1 workaround, async, errors)
|
|
40395
|
-
await (0,promises_.copyFile)(file, this._out);
|
|
40440
|
+
await (0,promises_.copyFile)(file, await this._out);
|
|
40396
40441
|
}
|
|
40397
40442
|
}
|
|
40398
40443
|
|
|
@@ -42037,16 +42082,6 @@ class Bump {
|
|
|
42037
42082
|
}
|
|
42038
42083
|
}
|
|
42039
42084
|
|
|
42040
|
-
// EXTERNAL MODULE: ../node_modules/@neon-rs/manifest/lib/platform.cjs
|
|
42041
|
-
var platform = __nccwpck_require__(2147);
|
|
42042
|
-
;// CONCATENATED MODULE: ../node_modules/@neon-rs/manifest/lib/platform.mjs
|
|
42043
|
-
|
|
42044
|
-
|
|
42045
|
-
// EXTERNAL MODULE: ../node_modules/@neon-rs/manifest/lib/index.cjs
|
|
42046
|
-
var manifest_lib = __nccwpck_require__(4696);
|
|
42047
|
-
;// CONCATENATED MODULE: ../node_modules/@neon-rs/manifest/lib/index.mjs
|
|
42048
|
-
|
|
42049
|
-
|
|
42050
42085
|
;// CONCATENATED MODULE: ./src/target.ts
|
|
42051
42086
|
|
|
42052
42087
|
|
|
@@ -42063,7 +42098,7 @@ async function getCurrentTarget(log) {
|
|
|
42063
42098
|
}
|
|
42064
42099
|
const target = hostLine.replace(/^host:\s+/, '');
|
|
42065
42100
|
log(`currentTarget result: "${target}"`);
|
|
42066
|
-
(0,
|
|
42101
|
+
(0,lib_platform.assertIsRustTarget)(target);
|
|
42067
42102
|
return target;
|
|
42068
42103
|
}
|
|
42069
42104
|
|
|
@@ -42159,15 +42194,15 @@ class AddPlatform {
|
|
|
42159
42194
|
this.log('adding default system platform');
|
|
42160
42195
|
await libManifest.addRustTarget(await getCurrentTarget(msg => this.log(msg)));
|
|
42161
42196
|
}
|
|
42162
|
-
else if ((0,
|
|
42197
|
+
else if ((0,lib_platform.isRustTarget)(this._platform)) {
|
|
42163
42198
|
this.log(`adding Rust target ${this._platform}`);
|
|
42164
42199
|
await libManifest.addRustTarget(this._platform);
|
|
42165
42200
|
}
|
|
42166
|
-
else if ((0,
|
|
42201
|
+
else if ((0,lib_platform.isNodePlatform)(this._platform)) {
|
|
42167
42202
|
this.log(`adding Node platform ${this._platform}`);
|
|
42168
42203
|
await libManifest.addNodePlatform(this._platform);
|
|
42169
42204
|
}
|
|
42170
|
-
else if ((0,
|
|
42205
|
+
else if ((0,lib_platform.isPlatformPreset)(this._platform)) {
|
|
42171
42206
|
await libManifest.addPlatformPreset(this._platform);
|
|
42172
42207
|
}
|
|
42173
42208
|
else {
|
|
@@ -42341,7 +42376,7 @@ class Preset {
|
|
|
42341
42376
|
if (options._unknown.length > 1) {
|
|
42342
42377
|
throw new Error(`Unexpected argument ${options._unknown[1]}`);
|
|
42343
42378
|
}
|
|
42344
|
-
(0,
|
|
42379
|
+
(0,lib_platform.assertIsPlatformPreset)(options._unknown[0]);
|
|
42345
42380
|
this._preset = options._unknown[0];
|
|
42346
42381
|
}
|
|
42347
42382
|
log(msg) {
|
|
@@ -42350,7 +42385,7 @@ class Preset {
|
|
|
42350
42385
|
}
|
|
42351
42386
|
}
|
|
42352
42387
|
async run() {
|
|
42353
|
-
const map = (0,
|
|
42388
|
+
const map = (0,lib_platform.expandPlatformPreset)(this._preset);
|
|
42354
42389
|
console.log(JSON.stringify(map, null, 2));
|
|
42355
42390
|
}
|
|
42356
42391
|
}
|
|
@@ -60764,6 +60799,11 @@ class NPMCacheCfg {
|
|
|
60764
60799
|
}
|
|
60765
60800
|
this._packages = packages;
|
|
60766
60801
|
}
|
|
60802
|
+
getPlatformOutputPath(platform) {
|
|
60803
|
+
return this._packages[platform]
|
|
60804
|
+
? path.join(this.dir, platform, 'index.node')
|
|
60805
|
+
: undefined;
|
|
60806
|
+
}
|
|
60767
60807
|
async setPlatformTarget(platform, target) {
|
|
60768
60808
|
const pkg = this._packages[platform];
|
|
60769
60809
|
if (!pkg) {
|
|
@@ -61250,6 +61290,11 @@ class LibraryManifest extends util_cjs_1.AbstractManifest {
|
|
|
61250
61290
|
this._updatedPlatforms = true;
|
|
61251
61291
|
}
|
|
61252
61292
|
}
|
|
61293
|
+
getPlatformOutputPath(platform) {
|
|
61294
|
+
return this._cacheCfg
|
|
61295
|
+
? this._cacheCfg.getPlatformOutputPath(platform)
|
|
61296
|
+
: undefined;
|
|
61297
|
+
}
|
|
61253
61298
|
}
|
|
61254
61299
|
exports.LibraryManifest = LibraryManifest;
|
|
61255
61300
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neon-rs/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Command-line build tool for Neon modules.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./index.js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/dherman/neon-rs#readme",
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@cargo-messages/android-arm-eabi": "0.1.
|
|
31
|
-
"@cargo-messages/darwin-arm64": "0.
|
|
32
|
-
"@cargo-messages/darwin-x64": "0.
|
|
33
|
-
"@cargo-messages/linux-arm-gnueabihf": "0.
|
|
34
|
-
"@cargo-messages/linux-x64-gnu": "0.
|
|
35
|
-
"@cargo-messages/win32-arm64-msvc": "0.
|
|
36
|
-
"@cargo-messages/win32-x64-msvc": "0.
|
|
30
|
+
"@cargo-messages/android-arm-eabi": "0.1.26",
|
|
31
|
+
"@cargo-messages/darwin-arm64": "0.1.26",
|
|
32
|
+
"@cargo-messages/darwin-x64": "0.1.26",
|
|
33
|
+
"@cargo-messages/linux-arm-gnueabihf": "0.1.26",
|
|
34
|
+
"@cargo-messages/linux-x64-gnu": "0.1.26",
|
|
35
|
+
"@cargo-messages/win32-arm64-msvc": "0.1.26",
|
|
36
|
+
"@cargo-messages/win32-x64-msvc": "0.1.26"
|
|
37
37
|
}
|
|
38
38
|
}
|