@neon-rs/cli 0.0.166 → 0.0.167

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.
Files changed (2) hide show
  1. package/index.js +212 -22
  2. package/package.json +8 -8
package/index.js CHANGED
@@ -10245,7 +10245,7 @@ function wrappy (fn, cb) {
10245
10245
 
10246
10246
  /***/ }),
10247
10247
 
10248
- /***/ 1217:
10248
+ /***/ 3235:
10249
10249
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
10250
10250
 
10251
10251
 
@@ -10314,6 +10314,7 @@ class Dist {
10314
10314
  { name: 'cross-rs', summary: '<https://github.com/cross-rs/cross>' }
10315
10315
  ];
10316
10316
  }
10317
+ static extraSection() { }
10317
10318
  _log;
10318
10319
  _file;
10319
10320
  _mount;
@@ -11956,6 +11957,7 @@ class Bump {
11956
11957
  { name: 'npm version', summary: '<https://docs.npmjs.com/cli/commands/npm-version>' }
11957
11958
  ];
11958
11959
  }
11960
+ static extraSection() { }
11959
11961
  _verbose;
11960
11962
  _dir;
11961
11963
  _workspaces;
@@ -12027,10 +12029,13 @@ var temp = __nccwpck_require__(591);
12027
12029
  const rust_namespaceObject = JSON.parse('{"aarch64-apple-darwin":"darwin-arm64","x86_64-apple-darwin":"darwin-x64","aarch64-apple-ios":"ios-arm64","x86_64-apple-ios":"ios-x64","aarch64-linux-android":"android-arm64","armv7-linux-androideabi":"android-arm-eabi","i686-linux-android":"android-ia32","x86_64-linux-android":"android-x64","aarch64-pc-windows-msvc":"win32-arm64-msvc","i686-pc-windows-gnu":"win32-ia32-gnu","i686-pc-windows-msvc":"win32-ia32-msvc","x86_64-pc-windows-gnu":"win32-x64-gnu","x86_64-pc-windows-msvc":"win32-x64-msvc","aarch64-unknown-linux-gnu":"linux-arm64-gnu","aarch64-unknown-linux-musl":"linux-arm64-musl","arm-unknown-linux-gnueabihf":"linux-arm-gnueabihf","arm-unknown-linux-musleabihf":"linux-arm-musleabihf","armv7-unknown-linux-gnueabihf":"linux-arm-gnueabihf","armv7-unknown-linux-musleabihf":"linux-arm-musleabihf","i686-unknown-linux-gnu":"linux-ia32-gnu","i686-unknown-linux-musl":"linux-ia32-musl","mips-unknown-linux-gnu":"linux-mips-gnu","mips-unknown-linux-musl":"linux-mips-musl","mips64-unknown-linux-gnuabi64":"linux-mips64-gnuabi64","mips64-unknown-linux-muslabi64":"linux-mips64-muslabi64","mips64el-unknown-linux-gnuabi64":"linux-mips64el-gnuabi64","mips64el-unknown-linux-muslabi64":"linux-mips64el-muslabi64","mipsel-unknown-linux-gnu":"linux-mipsel-gnu","mipsel-unknown-linux-musl":"linux-mipsel-musl","powerpc-unknown-linux-gnu":"linux-powerpc-gnu","powerpc64-unknown-linux-gnu":"linux-powerpc64-gnu","powerpc64le-unknown-linux-gnu":"linux-powerpc64le-gnu","riscv64gc-unknown-linux-gnu":"linux-riscv64gc-gnu","s390x-unknown-linux-gnu":"linux-s390x-gnu","sparc64-unknown-linux-gnu":"linux-sparc64-gnu","x86_64-unknown-linux-gnu":"linux-x64-gnu","x86_64-unknown-linux-gnux32":"linux-x64-gnux32","x86_64-unknown-linux-musl":"linux-x64-musl","i686-unknown-freebsd":"freebsd-ia32","x86_64-unknown-freebsd":"freebsd-x64"}');
12028
12030
  ;// CONCATENATED MODULE: ./data/node.json
12029
12031
  const node_namespaceObject = JSON.parse('{"darwin-arm64":{"platform":"darwin","arch":"arm64","abi":null,"llvm":["aarch64-apple-darwin"]},"darwin-x64":{"platform":"darwin","arch":"x64","abi":null,"llvm":["x86_64-apple-darwin"]},"ios-arm64":{"platform":"ios","arch":"arm64","abi":null,"llvm":["aarch64-apple-ios"]},"ios-x64":{"platform":"ios","arch":"x64","abi":null,"llvm":["x86_64-apple-ios"]},"android-arm64":{"platform":"android","arch":"arm64","abi":null,"llvm":["aarch64-linux-android"]},"android-arm-eabi":{"platform":"android","arch":"arm","abi":"eabi","llvm":["armv7-linux-androideabi"]},"android-ia32":{"platform":"android","arch":"ia32","abi":null,"llvm":["i686-linux-android"]},"android-x64":{"platform":"android","arch":"x64","abi":null,"llvm":["x86_64-linux-android"]},"win32-arm64-msvc":{"platform":"win32","arch":"arm64","abi":"msvc","llvm":["aarch64-pc-windows-msvc"]},"win32-ia32-gnu":{"platform":"win32","arch":"ia32","abi":"gnu","llvm":["i686-pc-windows-gnu"]},"win32-ia32-msvc":{"platform":"win32","arch":"ia32","abi":"msvc","llvm":["i686-pc-windows-msvc"]},"win32-x64-gnu":{"platform":"win32","arch":"x64","abi":"gnu","llvm":["x86_64-pc-windows-gnu"]},"win32-x64-msvc":{"platform":"win32","arch":"x64","abi":"msvc","llvm":["x86_64-pc-windows-msvc"]},"linux-arm64-gnu":{"platform":"linux","arch":"arm64","abi":"gnu","llvm":["aarch64-unknown-linux-gnu"]},"linux-arm64-musl":{"platform":"linux","arch":"arm64","abi":"musl","llvm":["aarch64-unknown-linux-musl"]},"linux-arm-gnueabihf":{"platform":"linux","arch":"arm","abi":"gnueabihf","llvm":["arm-unknown-linux-gnueabihf","armv7-unknown-linux-gnueabihf"]},"linux-arm-musleabihf":{"platform":"linux","arch":"arm","abi":"musleabihf","llvm":["arm-unknown-linux-musleabihf","armv7-unknown-linux-musleabihf"]},"linux-ia32-gnu":{"platform":"linux","arch":"ia32","abi":"gnu","llvm":["i686-unknown-linux-gnu"]},"linux-ia32-musl":{"platform":"linux","arch":"ia32","abi":"musl","llvm":["i686-unknown-linux-musl"]},"linux-mips-gnu":{"platform":"linux","arch":"mips","abi":"gnu","llvm":["mips-unknown-linux-gnu"]},"linux-mips-musl":{"platform":"linux","arch":"mips","abi":"musl","llvm":["mips-unknown-linux-musl"]},"linux-mips64-gnuabi64":{"platform":"linux","arch":"mips64","abi":"gnuabi64","llvm":["mips64-unknown-linux-gnuabi64"]},"linux-mips64-muslabi64":{"platform":"linux","arch":"mips64","abi":"muslabi64","llvm":["mips64-unknown-linux-muslabi64"]},"linux-mips64el-gnuabi64":{"platform":"linux","arch":"mips64el","abi":"gnuabi64","llvm":["mips64el-unknown-linux-gnuabi64"]},"linux-mips64el-muslabi64":{"platform":"linux","arch":"mips64el","abi":"muslabi64","llvm":["mips64el-unknown-linux-muslabi64"]},"linux-mipsel-gnu":{"platform":"linux","arch":"mipsel","abi":"gnu","llvm":["mipsel-unknown-linux-gnu"]},"linux-mipsel-musl":{"platform":"linux","arch":"mipsel","abi":"musl","llvm":["mipsel-unknown-linux-musl"]},"linux-powerpc-gnu":{"platform":"linux","arch":"powerpc","abi":"gnu","llvm":["powerpc-unknown-linux-gnu"]},"linux-powerpc64-gnu":{"platform":"linux","arch":"powerpc64","abi":"gnu","llvm":["powerpc64-unknown-linux-gnu"]},"linux-powerpc64le-gnu":{"platform":"linux","arch":"powerpc64le","abi":"gnu","llvm":["powerpc64le-unknown-linux-gnu"]},"linux-riscv64gc-gnu":{"platform":"linux","arch":"riscv64gc","abi":"gnu","llvm":["riscv64gc-unknown-linux-gnu"]},"linux-s390x-gnu":{"platform":"linux","arch":"s390x","abi":"gnu","llvm":["s390x-unknown-linux-gnu"]},"linux-sparc64-gnu":{"platform":"linux","arch":"sparc64","abi":"gnu","llvm":["sparc64-unknown-linux-gnu"]},"linux-x64-gnu":{"platform":"linux","arch":"x64","abi":"gnu","llvm":["x86_64-unknown-linux-gnu"]},"linux-x64-gnux32":{"platform":"linux","arch":"x64","abi":"gnux32","llvm":["x86_64-unknown-linux-gnux32"]},"linux-x64-musl":{"platform":"linux","arch":"x64","abi":"musl","llvm":["x86_64-unknown-linux-musl"]},"freebsd-ia32":{"platform":"freebsd","arch":"ia32","abi":null,"llvm":["i686-unknown-freebsd"]},"freebsd-x64":{"platform":"freebsd","arch":"x64","abi":null,"llvm":["x86_64-unknown-freebsd"]}}');
12032
+ ;// CONCATENATED MODULE: ./data/family.json
12033
+ const family_namespaceObject = JSON.parse('{"windows":{"win32-x64-msvc":"x86_64-pc-windows-msvc"},"macos":{"darwin-x64":"x86_64-apple-darwin","darwin-arm64":"aarch64-apple-darwin"},"linux":{"linux-x64-gnu":"x86_64-unknown-linux-gnu","linux-arm-gnueabihf":"armv7-unknown-linux-gnueabihf"},"desktop":{"win32-x64-msvc":"x86_64-pc-windows-msvc","darwin-x64":"x86_64-apple-darwin","darwin-arm64":"aarch64-apple-darwin","linux-x64-gnu":"x86_64-unknown-linux-gnu"},"mobile":{"win32-arm64-msvc":"aarch64-pc-windows-msvc","linux-arm-gnueabihf":"armv7-unknown-linux-gnueabihf","android-arm-eabi":"armv7-linux-androideabi"},"common":["desktop"],"extended":["desktop","mobile"]}');
12030
12034
  ;// CONCATENATED MODULE: ./src/target.ts
12031
12035
 
12032
12036
 
12033
12037
 
12038
+
12034
12039
  function isRustTarget(x) {
12035
12040
  return (typeof x === 'string') && (x in rust_namespaceObject);
12036
12041
  }
@@ -12047,6 +12052,31 @@ function assertIsNodeTarget(x) {
12047
12052
  throw new RangeError(`invalid Node target: ${x}`);
12048
12053
  }
12049
12054
  }
12055
+ function isTargetFamilyKey(x) {
12056
+ return (typeof x === 'string') && (x in family_namespaceObject);
12057
+ }
12058
+ function assertIsTargetFamilyKey(x) {
12059
+ if (!isTargetFamilyKey(x)) {
12060
+ throw new RangeError(`invalid target family name: ${x}`);
12061
+ }
12062
+ }
12063
+ function lookupTargetFamily(key) {
12064
+ return family_namespaceObject[key];
12065
+ }
12066
+ function merge(maps) {
12067
+ const merged = Object.create(null);
12068
+ for (const map of maps) {
12069
+ Object.assign(merged, map);
12070
+ }
12071
+ return merged;
12072
+ }
12073
+ function expandTargetFamily(family) {
12074
+ return isTargetFamilyKey(family)
12075
+ ? expandTargetFamily(lookupTargetFamily(family))
12076
+ : Array.isArray(family)
12077
+ ? merge(family.map(expandTargetFamily))
12078
+ : family;
12079
+ }
12050
12080
  function getTargetDescriptor(target) {
12051
12081
  const node = rust_namespaceObject[target];
12052
12082
  if (!isNodeTarget(node)) {
@@ -12384,24 +12414,42 @@ class SourceManifest extends AbstractManifest {
12384
12414
  }
12385
12415
  return new BinaryManifest(json);
12386
12416
  }
12387
- async addTargetPair(node, rust) {
12417
+ async addTargetPair(pair) {
12418
+ const { node, rust } = pair;
12388
12419
  const targets = this.cfg().targets;
12389
12420
  if (targets[node] === rust) {
12390
- return false;
12421
+ return null;
12391
12422
  }
12392
12423
  targets[node] = rust;
12393
12424
  await this.save();
12394
- return true;
12425
+ return pair;
12395
12426
  }
12396
12427
  async addNodeTarget(target) {
12397
12428
  const rt = node2Rust(target);
12398
12429
  if (rt.length > 1) {
12399
12430
  throw new Error(`multiple Rust targets found for Node target ${target}; please specify one of ${rt.join(', ')}`);
12400
12431
  }
12401
- return await this.addTargetPair(target, rt[0]);
12432
+ return await this.addTargetPair({ node: target, rust: rt[0] });
12402
12433
  }
12403
12434
  async addRustTarget(target) {
12404
- return await this.addTargetPair(rust2Node(target), target);
12435
+ return await this.addTargetPair({ node: rust2Node(target), rust: target });
12436
+ }
12437
+ async addTargets(family) {
12438
+ const targets = this.cfg().targets;
12439
+ let modified = [];
12440
+ for (const [key, value] of Object.entries(family)) {
12441
+ const node = key;
12442
+ const rust = value;
12443
+ if (targets[node] === rust) {
12444
+ continue;
12445
+ }
12446
+ targets[node] = rust;
12447
+ modified.push({ node, rust });
12448
+ }
12449
+ if (modified.length) {
12450
+ await this.save();
12451
+ }
12452
+ return modified;
12405
12453
  }
12406
12454
  async updateTargets(log, bundle) {
12407
12455
  const packages = this.packageNames();
@@ -12503,6 +12551,7 @@ class Tarball {
12503
12551
  { name: 'cross-rs', summary: '<https://github.com/cross-rs/cross>' }
12504
12552
  ];
12505
12553
  }
12554
+ static extraSection() { }
12506
12555
  _target;
12507
12556
  _addon;
12508
12557
  _inDir;
@@ -12598,23 +12647,34 @@ class Tarball {
12598
12647
 
12599
12648
 
12600
12649
 
12650
+
12651
+
12652
+ function optionArray(option) {
12653
+ return option == null ? [] : [option];
12654
+ }
12601
12655
  const add_target_OPTIONS = [
12602
12656
  { name: 'bundle', alias: 'b', type: String, defaultValue: null },
12603
12657
  { name: 'platform', alias: 'p', type: String, defaultValue: null },
12604
12658
  { name: 'arch', alias: 'a', type: String, defaultValue: null },
12605
12659
  { name: 'abi', type: String, defaultValue: null },
12660
+ { name: 'out-dir', alias: 'o', type: String, defaultValue: 'npm' },
12606
12661
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
12607
12662
  ];
12608
12663
  class AddTarget {
12609
12664
  static summary() { return 'Add a new build target to package.json.'; }
12610
- static syntax() { return 'neon add-target [<target> | -p <plat> -a <arch> [--abi <abi>]] [-b <file>]'; }
12665
+ static syntax() { return 'neon add-target [<t> | -p <p> -a <arch> [--abi <abi>]] [-o <d>] [-b <f>]'; }
12611
12666
  static options() {
12612
12667
  return [
12613
- { name: '<target>', summary: 'Full target name, in either Node or Rust convention. (Default: current target)' },
12614
- { name: '-p, --platform <plat>', summary: 'Target platform name. (Default: current platform)' },
12668
+ { name: '<t>', summary: 'Full target name, in either Node or Rust convention.' },
12669
+ {
12670
+ name: '',
12671
+ summary: 'This may be a target name in either Node or Rust convention, or one of the Neon target family presets described below. (Default: current target)'
12672
+ },
12673
+ { name: '-p, --platform <p>', summary: 'Target platform name. (Default: current platform)' },
12615
12674
  { name: '-a, --arch <arch>', summary: 'Target architecture name. (Default: current arch)' },
12616
12675
  { name: '--abi <abi>', summary: 'Target ABI name. (Default: current ABI)' },
12617
- { name: '-b, --bundle <file>', summary: 'File to generate bundling metadata.' },
12676
+ { name: '-o, --out-dir <d>', summary: 'Output directory for target template tree. (Default: npm)' },
12677
+ { name: '-b, --bundle <f>', summary: 'File to generate bundling metadata.' },
12618
12678
  {
12619
12679
  name: '',
12620
12680
  summary: 'This generated file ensures support for bundlers (e.g. @vercel/ncc), which rely on static analysis to detect and enable any addons used by the library.'
@@ -12622,13 +12682,26 @@ class AddTarget {
12622
12682
  { name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
12623
12683
  ];
12624
12684
  }
12625
- static seeAlso() {
12626
- return [];
12685
+ static seeAlso() { }
12686
+ static extraSection() {
12687
+ return {
12688
+ title: 'Target Family Presets',
12689
+ details: [
12690
+ { name: 'linux', summary: 'Common desktop Linux targets.' },
12691
+ { name: 'macos', summary: 'Common desktop macOS targets.' },
12692
+ { name: 'windows', summary: 'Common desktop Windows targets.' },
12693
+ { name: 'mobile', summary: 'Common mobile and tablet targets.' },
12694
+ { name: 'desktop', summary: 'All common desktop targets.' },
12695
+ { name: 'common', summary: 'All common targets.' },
12696
+ { name: 'extended', summary: 'All supported targets.' }
12697
+ ]
12698
+ };
12627
12699
  }
12628
12700
  _platform;
12629
12701
  _arch;
12630
12702
  _abi;
12631
12703
  _target;
12704
+ _outDir;
12632
12705
  _bundle;
12633
12706
  _verbose;
12634
12707
  constructor(argv) {
@@ -12636,6 +12709,7 @@ class AddTarget {
12636
12709
  this._platform = options.platform || null;
12637
12710
  this._arch = options.arch || null;
12638
12711
  this._abi = options.abi || null;
12712
+ this._outDir = options['out-dir'] || external_node_path_namespaceObject.join(process.cwd(), 'dist');
12639
12713
  this._bundle = options.bundle || null;
12640
12714
  this._verbose = !!options.verbose;
12641
12715
  if (options.platform && !options.arch) {
@@ -12654,7 +12728,10 @@ class AddTarget {
12654
12728
  this._target = options._unknown[0];
12655
12729
  }
12656
12730
  else {
12657
- this._target = null;
12731
+ this._target = `${options.platform}-${options.arch}`;
12732
+ if (!!options.abi) {
12733
+ this._target = `${this._target}-${options.abi}`;
12734
+ }
12658
12735
  }
12659
12736
  }
12660
12737
  log(msg) {
@@ -12665,26 +12742,46 @@ class AddTarget {
12665
12742
  async addTarget(sourceManifest) {
12666
12743
  if (!this._target) {
12667
12744
  this.log('adding default system target');
12668
- return sourceManifest.addRustTarget(await getCurrentTarget(msg => this.log(msg)));
12745
+ return optionArray(await sourceManifest.addRustTarget(await getCurrentTarget(msg => this.log(msg))));
12669
12746
  }
12670
12747
  else if (isRustTarget(this._target)) {
12671
12748
  this.log(`adding Rust target ${this._target}`);
12672
- return sourceManifest.addRustTarget(this._target);
12749
+ return optionArray(await sourceManifest.addRustTarget(this._target));
12673
12750
  }
12674
12751
  else if (isNodeTarget(this._target)) {
12675
12752
  this.log(`adding Node target ${this._target}`);
12676
- return sourceManifest.addNodeTarget(this._target);
12753
+ return optionArray(await sourceManifest.addNodeTarget(this._target));
12754
+ }
12755
+ else if (isTargetFamilyKey(this._target)) {
12756
+ return sourceManifest.addTargets(expandTargetFamily(this._target));
12677
12757
  }
12678
12758
  else {
12679
12759
  throw new Error(`unrecognized target ${this._target}`);
12680
12760
  }
12681
12761
  }
12762
+ async createTemplateTree(sourceManifest, pair) {
12763
+ const { node, rust } = pair;
12764
+ const binaryManifest = sourceManifest.manifestFor(rust);
12765
+ this.log(`prebuild manifest: ${binaryManifest.stringify()}`);
12766
+ const treeDir = external_node_path_namespaceObject.join(this._outDir, node);
12767
+ this.log(`creating ${treeDir}`);
12768
+ await promises_namespaceObject.mkdir(treeDir, { recursive: true });
12769
+ this.log(`created ${treeDir}`);
12770
+ this.log(`creating ${treeDir}/package.json`);
12771
+ await binaryManifest.save(treeDir);
12772
+ this.log(`creating ${treeDir}/README.md`);
12773
+ await promises_namespaceObject.writeFile(external_node_path_namespaceObject.join(treeDir, "README.md"), `# \`${binaryManifest.name}\`\n\n${binaryManifest.description}\n`);
12774
+ }
12682
12775
  async run() {
12683
12776
  this.log(`reading package.json`);
12684
12777
  const sourceManifest = await SourceManifest.load();
12685
12778
  this.log(`manifest: ${sourceManifest.stringify()}`);
12686
- if (await this.addTarget(sourceManifest)) {
12779
+ const modified = await this.addTarget(sourceManifest);
12780
+ if (modified.length) {
12687
12781
  sourceManifest.updateTargets(msg => this.log(msg), this._bundle);
12782
+ for (const pair of modified) {
12783
+ await this.createTemplateTree(sourceManifest, pair);
12784
+ }
12688
12785
  }
12689
12786
  }
12690
12787
  }
@@ -12714,6 +12811,7 @@ class UpdateTargets {
12714
12811
  { name: 'ncc', summary: '<https://github.com/vercel/ncc>' }
12715
12812
  ];
12716
12813
  }
12814
+ static extraSection() { }
12717
12815
  _bundle;
12718
12816
  _verbose;
12719
12817
  constructor(argv) {
@@ -12740,6 +12838,86 @@ class UpdateTargets {
12740
12838
  }
12741
12839
  }
12742
12840
 
12841
+ ;// CONCATENATED MODULE: ./src/commands/rust-target.ts
12842
+
12843
+
12844
+
12845
+ const rust_target_OPTIONS = [
12846
+ { name: 'platform', alias: 'p', type: String, defaultValue: null },
12847
+ { name: 'arch', alias: 'a', type: String, defaultValue: null },
12848
+ { name: 'abi', type: String, defaultValue: null },
12849
+ { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
12850
+ ];
12851
+ class RustTarget {
12852
+ static summary() { return 'Look up the Rust target triple for a given build target.'; }
12853
+ static syntax() { return 'neon rust-target <target> | (-p <plat> -a <arch> [--abi <abi>])'; }
12854
+ static options() {
12855
+ return [
12856
+ { name: '<target>', summary: 'Full target name in Node convention.' },
12857
+ { name: '-p, --platform <plat>', summary: 'Target platform name.' },
12858
+ { name: '-a, --arch <arch>', summary: 'Target architecture name.' },
12859
+ { name: '--abi <abi>', summary: 'Target ABI name. (Default: null)' },
12860
+ { name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
12861
+ ];
12862
+ }
12863
+ static seeAlso() { }
12864
+ static extraSection() { }
12865
+ _platform;
12866
+ _arch;
12867
+ _abi;
12868
+ _target;
12869
+ _verbose;
12870
+ constructor(argv) {
12871
+ const options = dist_default()(rust_target_OPTIONS, { argv, partial: true });
12872
+ this._platform = options.platform || null;
12873
+ this._arch = options.arch || null;
12874
+ this._abi = options.abi || null;
12875
+ this._verbose = !!options.verbose;
12876
+ if (options.platform && !options.arch) {
12877
+ throw new Error("Option --platform requires option --arch to be specified as well.");
12878
+ }
12879
+ if (!options.platform && options.arch) {
12880
+ throw new Error("Option --arch requires option --platform to be specified as well.");
12881
+ }
12882
+ if (options.abi && (!options.platform || !options.arch)) {
12883
+ throw new Error("Option --abi requires both options --platform and --arch to be specified as well.");
12884
+ }
12885
+ let target;
12886
+ if (!options.platform && !options.arch && !options.abi) {
12887
+ if (!options._unknown || options._unknown.length === 0) {
12888
+ throw new Error("No arguments found, expected <target> or -p and -a options.");
12889
+ }
12890
+ target = options._unknown[0];
12891
+ }
12892
+ else {
12893
+ target = `${options.platform}-${options.arch}`;
12894
+ if (!!options.abi) {
12895
+ target = `${target}-${options.abi}`;
12896
+ }
12897
+ }
12898
+ if (!isNodeTarget(target)) {
12899
+ throw new Error(`${target} is not a valid Node target.`);
12900
+ }
12901
+ this._target = target;
12902
+ }
12903
+ log(msg) {
12904
+ if (this._verbose) {
12905
+ console.error("[neon rust-target] " + msg);
12906
+ }
12907
+ }
12908
+ async run() {
12909
+ this.log(`reading package.json`);
12910
+ const sourceManifest = await SourceManifest.load();
12911
+ this.log(`manifest: ${sourceManifest.stringify()}`);
12912
+ const targets = sourceManifest.cfg().targets;
12913
+ const rust = targets[this._target];
12914
+ if (!rust) {
12915
+ throw new Error(`no Rust target found for ${this._target}`);
12916
+ }
12917
+ console.log(rust);
12918
+ }
12919
+ }
12920
+
12743
12921
  // EXTERNAL MODULE: ./src/print.ts + 26 modules
12744
12922
  var print = __nccwpck_require__(9050);
12745
12923
  ;// CONCATENATED MODULE: ./src/commands/help.ts
@@ -12754,6 +12932,7 @@ class Help {
12754
12932
  ];
12755
12933
  }
12756
12934
  static seeAlso() { }
12935
+ static extraSection() { }
12757
12936
  _name;
12758
12937
  constructor(argv) {
12759
12938
  this._name = argv.length > 0 ? asCommandName(argv[0]) : undefined;
@@ -12778,6 +12957,7 @@ class Help {
12778
12957
 
12779
12958
 
12780
12959
 
12960
+
12781
12961
  var CommandName;
12782
12962
  (function (CommandName) {
12783
12963
  CommandName["Help"] = "help";
@@ -12788,6 +12968,7 @@ var CommandName;
12788
12968
  CommandName["AddTarget"] = "add-target";
12789
12969
  CommandName["InstallBuilds"] = "install-builds";
12790
12970
  CommandName["UpdateTargets"] = "update-targets";
12971
+ CommandName["RustTarget"] = "rust-target";
12791
12972
  })(CommandName || (CommandName = {}));
12792
12973
  ;
12793
12974
  function isCommandName(s) {
@@ -12808,7 +12989,8 @@ const COMMANDS = {
12808
12989
  [CommandName.Tarball]: Tarball,
12809
12990
  [CommandName.AddTarget]: AddTarget,
12810
12991
  [CommandName.InstallBuilds]: UpdateTargets,
12811
- [CommandName.UpdateTargets]: UpdateTargets
12992
+ [CommandName.UpdateTargets]: UpdateTargets,
12993
+ [CommandName.RustTarget]: RustTarget
12812
12994
  };
12813
12995
  function commandFor(name) {
12814
12996
  return COMMANDS[name];
@@ -12820,7 +13002,8 @@ function summaries() {
12820
13002
  { name: CommandName.Bump, summary: Bump.summary() },
12821
13003
  { name: CommandName.Tarball, summary: Tarball.summary() },
12822
13004
  { name: CommandName.AddTarget, summary: AddTarget.summary() },
12823
- { name: CommandName.UpdateTargets, summary: UpdateTargets.summary() }
13005
+ { name: CommandName.UpdateTargets, summary: UpdateTargets.summary() },
13006
+ { name: CommandName.RustTarget, summary: RustTarget.summary() }
12824
13007
  ];
12825
13008
  }
12826
13009
 
@@ -12834,7 +13017,7 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
12834
13017
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(5046);
12835
13018
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(command_line_commands__WEBPACK_IMPORTED_MODULE_0__);
12836
13019
  /* harmony import */ var _print_js__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(9050);
12837
- /* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(1217);
13020
+ /* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(3235);
12838
13021
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(2033);
12839
13022
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(node_module__WEBPACK_IMPORTED_MODULE_3__);
12840
13023
 
@@ -15857,8 +16040,8 @@ const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});
15857
16040
 
15858
16041
  /* harmony default export */ const chalk_source = (chalk);
15859
16042
 
15860
- // EXTERNAL MODULE: ./src/command.ts + 37 modules
15861
- var command = __nccwpck_require__(1217);
16043
+ // EXTERNAL MODULE: ./src/command.ts + 39 modules
16044
+ var command = __nccwpck_require__(3235);
15862
16045
  ;// CONCATENATED MODULE: ./src/print.ts
15863
16046
 
15864
16047
 
@@ -15875,6 +16058,9 @@ function yellow(text) {
15875
16058
  function green(text) {
15876
16059
  return chalk_source.bold.greenBright(text);
15877
16060
  }
16061
+ function purple(text) {
16062
+ return chalk_source.bold.magentaBright(text);
16063
+ }
15878
16064
  function commandUsage(name, command) {
15879
16065
  const sections = [
15880
16066
  {
@@ -15894,6 +16080,10 @@ function commandUsage(name, command) {
15894
16080
  if (seeAlso) {
15895
16081
  sections.push({ header: green('See Also:'), content: seeAlso });
15896
16082
  }
16083
+ const extraSection = command.extraSection();
16084
+ if (extraSection) {
16085
+ sections.push({ header: purple(extraSection.title + ':'), content: extraSection.details });
16086
+ }
15897
16087
  return command_line_usage(sections).trimStart();
15898
16088
  }
15899
16089
  function mainUsage() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/cli",
3
- "version": "0.0.166",
3
+ "version": "0.0.167",
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.0.166",
31
- "@cargo-messages/darwin-arm64": "0.0.166",
32
- "@cargo-messages/darwin-x64": "0.0.166",
33
- "@cargo-messages/linux-arm-gnueabihf": "0.0.166",
34
- "@cargo-messages/linux-x64-gnu": "0.0.166",
35
- "@cargo-messages/win32-arm64-msvc": "0.0.166",
36
- "@cargo-messages/win32-x64-msvc": "0.0.166"
30
+ "@cargo-messages/android-arm-eabi": "0.0.167",
31
+ "@cargo-messages/darwin-arm64": "0.0.167",
32
+ "@cargo-messages/darwin-x64": "0.0.167",
33
+ "@cargo-messages/linux-arm-gnueabihf": "0.0.167",
34
+ "@cargo-messages/linux-x64-gnu": "0.0.167",
35
+ "@cargo-messages/win32-arm64-msvc": "0.0.167",
36
+ "@cargo-messages/win32-x64-msvc": "0.0.167"
37
37
  }
38
38
  }