@neon-rs/cli 0.0.155 → 0.0.157

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 +33 -4
  2. package/package.json +8 -8
package/index.js CHANGED
@@ -12022,6 +12022,23 @@ function lookup(target) {
12022
12022
  }
12023
12023
  return { node, ...node_namespaceObject[node] };
12024
12024
  }
12025
+ function extractPackageNameV1(targets, target) {
12026
+ return targets[target];
12027
+ }
12028
+ function extractPackageNameV2(manifest, target) {
12029
+ for (const key in manifest.neon.targets) {
12030
+ if (key === target) {
12031
+ return `${manifest.neon.org}/${manifest.neon.targets[key]}`;
12032
+ }
12033
+ }
12034
+ return undefined;
12035
+ }
12036
+ function extractPackageName(manifest, target) {
12037
+ if (manifest.neon.org) {
12038
+ return extractPackageNameV2(manifest, target);
12039
+ }
12040
+ return extractPackageNameV1(manifest.neon.targets, target);
12041
+ }
12025
12042
  class PackBuild {
12026
12043
  static summary() { return 'Create an npm tarball from a prebuild.'; }
12027
12044
  static syntax() { return 'neon pack-build [-f <addon>] [-t <target>] [-d <dir>]'; }
@@ -12076,7 +12093,7 @@ class PackBuild {
12076
12093
  if (!isRustTarget(target)) {
12077
12094
  throw new Error(`Rust target ${target} not supported.`);
12078
12095
  }
12079
- const name = targets[target];
12096
+ const name = extractPackageName(manifest, target);
12080
12097
  if (!name) {
12081
12098
  throw new Error(`Rust target ${target} not found in package.json.`);
12082
12099
  }
@@ -12192,6 +12209,18 @@ const install_builds_OPTIONS = [
12192
12209
  { name: 'bundle', alias: 'b', type: String, defaultValue: null },
12193
12210
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
12194
12211
  ];
12212
+ function lookupBinaryPackagesV1(targets) {
12213
+ return Object.values(targets);
12214
+ }
12215
+ function lookupBinaryPackagesV2(org, targets) {
12216
+ return Object.keys(targets).map(key => `${org}/${key}`);
12217
+ }
12218
+ function lookupBinaryPackages(manifest) {
12219
+ if (manifest.neon.org) {
12220
+ return lookupBinaryPackagesV2(manifest.neon.org, manifest.neon.targets);
12221
+ }
12222
+ return lookupBinaryPackagesV1(manifest.neon.targets);
12223
+ }
12195
12224
  class InstallBuilds {
12196
12225
  static summary() { return 'Install dependencies on prebuilds in package.json.'; }
12197
12226
  static syntax() { return 'neon install-builds [-b <file>]'; }
@@ -12226,8 +12255,8 @@ class InstallBuilds {
12226
12255
  const version = manifest.version;
12227
12256
  this.log(`package.json before: ${JSON.stringify(manifest)}`);
12228
12257
  this.log(`determined version: ${version}`);
12229
- const targets = Object.values(manifest.neon.targets);
12230
- const specs = targets.map(name => `${name}@${version}`);
12258
+ const packages = lookupBinaryPackages(manifest);
12259
+ const specs = packages.map(name => `${name}@${version}`);
12231
12260
  this.log(`npm install --save-exact -O ${specs.join(' ')}`);
12232
12261
  const result = await execa('npm', ['install', '--save-exact', '-O', ...specs], { shell: true });
12233
12262
  if (result.exitCode !== 0) {
@@ -12249,7 +12278,7 @@ class InstallBuilds {
12249
12278
 
12250
12279
  if (0) {
12251
12280
  `;
12252
- const requires = targets.map(name => ` require('${name}');`).join('\n');
12281
+ const requires = packages.map(name => ` require('${name}');`).join('\n');
12253
12282
  this.log(`generating bundler compatibility module at ${this._bundle}`);
12254
12283
  await promises_namespaceObject.writeFile(this._bundle, PREAMBLE + requires + '\n}\n');
12255
12284
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/cli",
3
- "version": "0.0.155",
3
+ "version": "0.0.157",
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.154",
31
- "@cargo-messages/darwin-arm64": "0.0.154",
32
- "@cargo-messages/darwin-x64": "0.0.155",
33
- "@cargo-messages/linux-arm-gnueabihf": "0.0.155",
34
- "@cargo-messages/linux-x64-gnu": "0.0.155",
35
- "@cargo-messages/win32-arm64-msvc": "0.0.155",
36
- "@cargo-messages/win32-x64-msvc": "0.0.155"
30
+ "@cargo-messages/android-arm-eabi": "0.0.157",
31
+ "@cargo-messages/darwin-arm64": "0.0.157",
32
+ "@cargo-messages/darwin-x64": "0.0.157",
33
+ "@cargo-messages/linux-arm-gnueabihf": "0.0.157",
34
+ "@cargo-messages/linux-x64-gnu": "0.0.157",
35
+ "@cargo-messages/win32-arm64-msvc": "0.0.157",
36
+ "@cargo-messages/win32-x64-msvc": "0.0.157"
37
37
  }
38
38
  }