@neon-rs/cli 0.0.176 → 0.0.177

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 +257 -181
  2. package/package.json +8 -8
package/index.js CHANGED
@@ -44171,7 +44171,7 @@ function wrappy (fn, cb) {
44171
44171
 
44172
44172
  /***/ }),
44173
44173
 
44174
- /***/ 1430:
44174
+ /***/ 5834:
44175
44175
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
44176
44176
 
44177
44177
 
@@ -45954,10 +45954,10 @@ var temp = __nccwpck_require__(591);
45954
45954
  ;// CONCATENATED MODULE: ./data/rust.json
45955
45955
  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"}');
45956
45956
  ;// CONCATENATED MODULE: ./data/node.json
45957
- 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"]}}');
45957
+ const node_namespaceObject = JSON.parse('{"darwin-arm64":{"os":"darwin","arch":"arm64","abi":null,"llvm":["aarch64-apple-darwin"]},"darwin-x64":{"os":"darwin","arch":"x64","abi":null,"llvm":["x86_64-apple-darwin"]},"ios-arm64":{"os":"ios","arch":"arm64","abi":null,"llvm":["aarch64-apple-ios"]},"ios-x64":{"os":"ios","arch":"x64","abi":null,"llvm":["x86_64-apple-ios"]},"android-arm64":{"os":"android","arch":"arm64","abi":null,"llvm":["aarch64-linux-android"]},"android-arm-eabi":{"os":"android","arch":"arm","abi":"eabi","llvm":["armv7-linux-androideabi"]},"android-ia32":{"os":"android","arch":"ia32","abi":null,"llvm":["i686-linux-android"]},"android-x64":{"os":"android","arch":"x64","abi":null,"llvm":["x86_64-linux-android"]},"win32-arm64-msvc":{"os":"win32","arch":"arm64","abi":"msvc","llvm":["aarch64-pc-windows-msvc"]},"win32-ia32-gnu":{"os":"win32","arch":"ia32","abi":"gnu","llvm":["i686-pc-windows-gnu"]},"win32-ia32-msvc":{"os":"win32","arch":"ia32","abi":"msvc","llvm":["i686-pc-windows-msvc"]},"win32-x64-gnu":{"os":"win32","arch":"x64","abi":"gnu","llvm":["x86_64-pc-windows-gnu"]},"win32-x64-msvc":{"os":"win32","arch":"x64","abi":"msvc","llvm":["x86_64-pc-windows-msvc"]},"linux-arm64-gnu":{"os":"linux","arch":"arm64","abi":"gnu","llvm":["aarch64-unknown-linux-gnu"]},"linux-arm64-musl":{"os":"linux","arch":"arm64","abi":"musl","llvm":["aarch64-unknown-linux-musl"]},"linux-arm-gnueabihf":{"os":"linux","arch":"arm","abi":"gnueabihf","llvm":["arm-unknown-linux-gnueabihf","armv7-unknown-linux-gnueabihf"]},"linux-arm-musleabihf":{"os":"linux","arch":"arm","abi":"musleabihf","llvm":["arm-unknown-linux-musleabihf","armv7-unknown-linux-musleabihf"]},"linux-ia32-gnu":{"os":"linux","arch":"ia32","abi":"gnu","llvm":["i686-unknown-linux-gnu"]},"linux-ia32-musl":{"os":"linux","arch":"ia32","abi":"musl","llvm":["i686-unknown-linux-musl"]},"linux-mips-gnu":{"os":"linux","arch":"mips","abi":"gnu","llvm":["mips-unknown-linux-gnu"]},"linux-mips-musl":{"os":"linux","arch":"mips","abi":"musl","llvm":["mips-unknown-linux-musl"]},"linux-mips64-gnuabi64":{"os":"linux","arch":"mips64","abi":"gnuabi64","llvm":["mips64-unknown-linux-gnuabi64"]},"linux-mips64-muslabi64":{"os":"linux","arch":"mips64","abi":"muslabi64","llvm":["mips64-unknown-linux-muslabi64"]},"linux-mips64el-gnuabi64":{"os":"linux","arch":"mips64el","abi":"gnuabi64","llvm":["mips64el-unknown-linux-gnuabi64"]},"linux-mips64el-muslabi64":{"os":"linux","arch":"mips64el","abi":"muslabi64","llvm":["mips64el-unknown-linux-muslabi64"]},"linux-mipsel-gnu":{"os":"linux","arch":"mipsel","abi":"gnu","llvm":["mipsel-unknown-linux-gnu"]},"linux-mipsel-musl":{"os":"linux","arch":"mipsel","abi":"musl","llvm":["mipsel-unknown-linux-musl"]},"linux-powerpc-gnu":{"os":"linux","arch":"powerpc","abi":"gnu","llvm":["powerpc-unknown-linux-gnu"]},"linux-powerpc64-gnu":{"os":"linux","arch":"powerpc64","abi":"gnu","llvm":["powerpc64-unknown-linux-gnu"]},"linux-powerpc64le-gnu":{"os":"linux","arch":"powerpc64le","abi":"gnu","llvm":["powerpc64le-unknown-linux-gnu"]},"linux-riscv64gc-gnu":{"os":"linux","arch":"riscv64gc","abi":"gnu","llvm":["riscv64gc-unknown-linux-gnu"]},"linux-s390x-gnu":{"os":"linux","arch":"s390x","abi":"gnu","llvm":["s390x-unknown-linux-gnu"]},"linux-sparc64-gnu":{"os":"linux","arch":"sparc64","abi":"gnu","llvm":["sparc64-unknown-linux-gnu"]},"linux-x64-gnu":{"os":"linux","arch":"x64","abi":"gnu","llvm":["x86_64-unknown-linux-gnu"]},"linux-x64-gnux32":{"os":"linux","arch":"x64","abi":"gnux32","llvm":["x86_64-unknown-linux-gnux32"]},"linux-x64-musl":{"os":"linux","arch":"x64","abi":"musl","llvm":["x86_64-unknown-linux-musl"]},"freebsd-ia32":{"os":"freebsd","arch":"ia32","abi":null,"llvm":["i686-unknown-freebsd"]},"freebsd-x64":{"os":"freebsd","arch":"x64","abi":null,"llvm":["x86_64-unknown-freebsd"]}}');
45958
45958
  ;// CONCATENATED MODULE: ./data/preset.json
45959
45959
  const preset_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"]}');
45960
- ;// CONCATENATED MODULE: ./src/target.ts
45960
+ ;// CONCATENATED MODULE: ./src/platform.ts
45961
45961
 
45962
45962
 
45963
45963
 
@@ -45970,23 +45970,23 @@ function assertIsRustTarget(x) {
45970
45970
  throw new RangeError(`invalid Rust target: ${x}`);
45971
45971
  }
45972
45972
  }
45973
- function isNodeTarget(x) {
45973
+ function isNodePlatform(x) {
45974
45974
  return (typeof x === 'string') && (x in node_namespaceObject);
45975
45975
  }
45976
- function assertIsNodeTarget(x) {
45977
- if (!isNodeTarget(x)) {
45978
- throw new RangeError(`invalid Node target: ${x}`);
45976
+ function assertIsNodePlatform(x) {
45977
+ if (!isNodePlatform(x)) {
45978
+ throw new RangeError(`invalid platform: ${x}`);
45979
45979
  }
45980
45980
  }
45981
- function isTargetPreset(x) {
45981
+ function isPlatformPreset(x) {
45982
45982
  return (typeof x === 'string') && (x in preset_namespaceObject);
45983
45983
  }
45984
- function assertIsTargetPreset(x) {
45985
- if (!isTargetPreset(x)) {
45986
- throw new RangeError(`invalid target family preset: ${x}`);
45984
+ function assertIsPlatformPreset(x) {
45985
+ if (!isPlatformPreset(x)) {
45986
+ throw new RangeError(`invalid platform family preset: ${x}`);
45987
45987
  }
45988
45988
  }
45989
- function lookupTargetPreset(key) {
45989
+ function lookupPlatformPreset(key) {
45990
45990
  return preset_namespaceObject[key];
45991
45991
  }
45992
45992
  function merge(maps) {
@@ -45996,19 +45996,19 @@ function merge(maps) {
45996
45996
  }
45997
45997
  return merged;
45998
45998
  }
45999
- function expandTargetPreset(preset) {
46000
- return expandTargetFamily(lookupTargetPreset(preset));
45999
+ function expandPlatformPreset(preset) {
46000
+ return expandPlatformFamily(lookupPlatformPreset(preset));
46001
46001
  }
46002
- function expandTargetFamily(family) {
46003
- return isTargetPreset(family)
46004
- ? expandTargetPreset(family)
46002
+ function expandPlatformFamily(family) {
46003
+ return isPlatformPreset(family)
46004
+ ? expandPlatformPreset(family)
46005
46005
  : Array.isArray(family)
46006
- ? merge(family.map(expandTargetFamily))
46006
+ ? merge(family.map(expandPlatformFamily))
46007
46007
  : family;
46008
46008
  }
46009
46009
  function getTargetDescriptor(target) {
46010
46010
  const node = rust_namespaceObject[target];
46011
- if (!isNodeTarget(node)) {
46011
+ if (!isNodePlatform(node)) {
46012
46012
  throw new Error(`Rust target ${target} not supported`);
46013
46013
  }
46014
46014
  const nodeDescriptor = node_namespaceObject[node];
@@ -46018,7 +46018,7 @@ function getTargetDescriptor(target) {
46018
46018
  }
46019
46019
  return {
46020
46020
  node,
46021
- platform: nodeDescriptor.platform,
46021
+ os: nodeDescriptor.os,
46022
46022
  arch: nodeDescriptor.arch,
46023
46023
  abi: nodeDescriptor.abi,
46024
46024
  llvm: nodeDescriptor.llvm
@@ -46032,7 +46032,7 @@ function node2Rust(target) {
46032
46032
  }
46033
46033
  function rust2Node(target) {
46034
46034
  const nt = rust_namespaceObject[target];
46035
- assertIsNodeTarget(nt);
46035
+ assertIsNodePlatform(nt);
46036
46036
  return nt;
46037
46037
  }
46038
46038
  async function getCurrentTarget(log) {
@@ -46075,18 +46075,18 @@ function assertHasProps(keys, json, path) {
46075
46075
  }
46076
46076
  }
46077
46077
  function assertIsBinaryCfg(json) {
46078
- assertHasProps(['type', 'rust', 'node', 'platform', 'arch', 'abi'], json, "neon");
46078
+ assertHasProps(['type', 'rust', 'node', 'os', 'arch', 'abi'], json, "neon");
46079
46079
  if (json.type !== 'binary') {
46080
46080
  throw new TypeError(`expected "neon.type" property to be "binary", found ${json.type}`);
46081
46081
  }
46082
46082
  if (typeof json.rust !== 'string' || !isRustTarget(json.rust)) {
46083
46083
  throw new TypeError(`expected "neon.rust" to be a valid Rust target, found ${json.rust}`);
46084
46084
  }
46085
- if (typeof json.node !== 'string' || !isNodeTarget(json.node)) {
46085
+ if (typeof json.node !== 'string' || !isNodePlatform(json.node)) {
46086
46086
  throw new TypeError(`expected "neon.node" to be a valid Node target, found ${json.node}`);
46087
46087
  }
46088
- if (typeof json.platform !== 'string') {
46089
- throw new TypeError(`expected "neon.platform" to be a string, found ${json.platform}`);
46088
+ if (typeof json.os !== 'string') {
46089
+ throw new TypeError(`expected "neon.os" to be a string, found ${json.os}`);
46090
46090
  }
46091
46091
  if (typeof json.arch !== 'string') {
46092
46092
  throw new TypeError(`expected "neon.arch" to be a string, found ${json.arch}`);
@@ -46095,30 +46095,51 @@ function assertIsBinaryCfg(json) {
46095
46095
  throw new TypeError(`expected "neon.abi" to be a string or null, found ${json.abi}`);
46096
46096
  }
46097
46097
  }
46098
- function assertIsTargetMap(json, path) {
46098
+ function assertIsPlatformMap(json, path) {
46099
46099
  assertIsObject(json, path);
46100
46100
  for (const key in json) {
46101
46101
  const value = json[key];
46102
- if (!isNodeTarget(key)) {
46103
- throw new TypeError(`target table key ${key} is not a valid Node target`);
46102
+ if (!isNodePlatform(key)) {
46103
+ throw new TypeError(`platform table key ${key} is not a valid Node platform`);
46104
46104
  }
46105
46105
  if (typeof value !== 'string' || !isRustTarget(value)) {
46106
- throw new TypeError(`target table value ${value} is not a valid Rust target`);
46106
+ throw new TypeError(`platform table value ${value} is not a valid Rust target`);
46107
46107
  }
46108
46108
  }
46109
46109
  }
46110
- function assertIsTargetFamily(json, path) {
46110
+ function assertIsPlatformFamily(json, path) {
46111
46111
  if (typeof json === 'string') {
46112
- assertIsTargetPreset(json);
46112
+ assertIsPlatformPreset(json);
46113
46113
  return;
46114
46114
  }
46115
46115
  if (Array.isArray(json)) {
46116
46116
  for (const elt of json) {
46117
- assertIsTargetPreset(elt);
46117
+ assertIsPlatformPreset(elt);
46118
46118
  }
46119
46119
  return;
46120
46120
  }
46121
- assertIsTargetMap(json, path);
46121
+ assertIsPlatformMap(json, path);
46122
+ }
46123
+ function assertIsBinaryV2(json) {
46124
+ if (!json || typeof json !== 'object') {
46125
+ throw new TypeError(`expected "neon" to be an object, found ${json}`);
46126
+ }
46127
+ assertHasProps(['rust', 'node', 'platform', 'arch', 'abi'], json, "neon");
46128
+ if (!isRustTarget(json.rust)) {
46129
+ throw new TypeError(`expected "neon.rust" to be a valid Rust target, found ${json.rust}`);
46130
+ }
46131
+ if (!isNodePlatform(json.node)) {
46132
+ throw new TypeError(`expected "neon.node" to be a valid Node platform, found ${json.node}`);
46133
+ }
46134
+ if (typeof json.platform !== 'string') {
46135
+ throw new TypeError(`expected "neon.platform" to be a string, found ${json.platform}`);
46136
+ }
46137
+ if (typeof json.arch !== 'string') {
46138
+ throw new TypeError(`expected "neon.arch" to be a string, found ${json.arch}`);
46139
+ }
46140
+ if (json.abi !== null && typeof json.abi !== 'string') {
46141
+ throw new TypeError(`expected "neon.abi" to be a string or null, found ${json.abi}`);
46142
+ }
46122
46143
  }
46123
46144
  function assertIsBinaryV1(json) {
46124
46145
  assertHasProps(['binary'], json, "neon");
@@ -46130,8 +46151,8 @@ function assertIsBinaryV1(json) {
46130
46151
  if (typeof binary.rust !== 'string' || !isRustTarget(binary.rust)) {
46131
46152
  throw new TypeError(`expected "neon.binary.rust" to be a valid Rust target, found ${binary.rust}`);
46132
46153
  }
46133
- if (!isNodeTarget(binary.node)) {
46134
- throw new TypeError(`expected "neon.binary.node" to be a valid Node target, found ${binary.node}`);
46154
+ if (!isNodePlatform(binary.node)) {
46155
+ throw new TypeError(`expected "neon.binary.node" to be a valid Node platform, found ${binary.node}`);
46135
46156
  }
46136
46157
  if (typeof binary.platform !== 'string') {
46137
46158
  throw new TypeError(`expected "neon.binary.platform" to be a string, found ${binary.platform}`);
@@ -46156,14 +46177,14 @@ function assertIsSourceV1(json) {
46156
46177
  }
46157
46178
  }
46158
46179
  function assertIsSourceCfg(json) {
46159
- assertHasProps(['type', 'org', 'targets'], json, "neon");
46180
+ assertHasProps(['type', 'org', 'platforms'], json, "neon");
46160
46181
  if (json.type !== 'source') {
46161
46182
  throw new TypeError(`expected "neon.type" property to be "source", found ${json.type}`);
46162
46183
  }
46163
46184
  if (typeof json.org !== 'string') {
46164
46185
  throw new TypeError(`expected "neon.org" to be a string, found ${json.org}`);
46165
46186
  }
46166
- assertIsTargetFamily(json.targets, "neon.targets");
46187
+ assertIsPlatformFamily(json.platforms, "neon.platforms");
46167
46188
  if ('load' in json) {
46168
46189
  if (typeof json.load !== 'string' && typeof json.load !== 'undefined') {
46169
46190
  throw new TypeError(`expected "neon.load" to be a string, found ${json.load}`);
@@ -46238,6 +46259,19 @@ class BinaryManifest extends AbstractManifest {
46238
46259
  }
46239
46260
  function normalizeBinaryCfg(json) {
46240
46261
  assertHasCfg(json);
46262
+ // V3 format: {
46263
+ // neon: {
46264
+ // type: 'binary',
46265
+ // rust: RustTarget,
46266
+ // node: NodeTarget,
46267
+ // os: string,
46268
+ // arch: string,
46269
+ // abi: string | null
46270
+ // }
46271
+ // }
46272
+ if ('type' in json.neon && 'os' in json.neon) {
46273
+ return false;
46274
+ }
46241
46275
  // V2 format: {
46242
46276
  // neon: {
46243
46277
  // type: 'binary',
@@ -46249,7 +46283,8 @@ function normalizeBinaryCfg(json) {
46249
46283
  // }
46250
46284
  // }
46251
46285
  if ('type' in json.neon) {
46252
- return false;
46286
+ json.neon = upgradeBinaryV2(json.neon);
46287
+ return true;
46253
46288
  }
46254
46289
  // V1 format: {
46255
46290
  // neon: {
@@ -46267,15 +46302,34 @@ function normalizeBinaryCfg(json) {
46267
46302
  }
46268
46303
  function normalizeSourceCfg(json) {
46269
46304
  assertHasCfg(json);
46305
+ // V4 format: {
46306
+ // neon: {
46307
+ // type: 'source',
46308
+ // org: string,
46309
+ // platforms: PlatformFamily,
46310
+ // load?: string | undefined
46311
+ // }
46312
+ // }
46313
+ if ('type' in json.neon && 'platforms' in json.neon) {
46314
+ return false;
46315
+ }
46270
46316
  // V3 format: {
46271
46317
  // neon: {
46272
46318
  // type: 'source',
46273
46319
  // org: string,
46274
- // targets: { Node => Rust }
46320
+ // targets: PlatformFamily
46275
46321
  // }
46276
46322
  // }
46277
46323
  if ('type' in json.neon) {
46278
- return false;
46324
+ const org = json.neon['org'];
46325
+ const targets = json.neon['targets'];
46326
+ assertIsPlatformFamily(targets, "neon.targets");
46327
+ json.neon = {
46328
+ type: 'source',
46329
+ org,
46330
+ platforms: targets
46331
+ };
46332
+ return true;
46279
46333
  }
46280
46334
  // V2 format: {
46281
46335
  // neon: {
@@ -46284,12 +46338,12 @@ function normalizeSourceCfg(json) {
46284
46338
  // }
46285
46339
  // }
46286
46340
  if ('org' in json.neon) {
46287
- const targets = json.neon['targets'];
46288
- assertIsTargetMap(targets, "neon.targets");
46341
+ const platforms = json.neon['targets'];
46342
+ assertIsPlatformMap(platforms, "neon.targets");
46289
46343
  json.neon = {
46290
46344
  type: 'source',
46291
46345
  org: json.neon.org,
46292
- targets
46346
+ platforms
46293
46347
  };
46294
46348
  return true;
46295
46349
  }
@@ -46303,15 +46357,20 @@ function normalizeSourceCfg(json) {
46303
46357
  json.neon = upgradeSourceV1(targets);
46304
46358
  return true;
46305
46359
  }
46360
+ // The source manifest is the source of truth for all Neon
46361
+ // project metadata. This means you never need to go searching
46362
+ // for any other files to query the Neon project's metadata.
46363
+ // (Some data is replicated in the binary manifests, however,
46364
+ // since they are independently published in npm.)
46306
46365
  class SourceManifest extends AbstractManifest {
46307
46366
  _sourceJSON;
46308
- _expandedTargets;
46367
+ _expandedPlatforms;
46309
46368
  constructor(json) {
46310
46369
  super(json);
46311
46370
  this._upgraded = normalizeSourceCfg(this._json);
46312
46371
  assertHasSourceCfg(this._json);
46313
46372
  this._sourceJSON = this._json;
46314
- this._expandedTargets = expandTargetFamily(this._sourceJSON.neon.targets);
46373
+ this._expandedPlatforms = expandPlatformFamily(this._sourceJSON.neon.platforms);
46315
46374
  }
46316
46375
  static async load(dir) {
46317
46376
  return new SourceManifest(await readManifest(dir));
@@ -46321,12 +46380,12 @@ class SourceManifest extends AbstractManifest {
46321
46380
  }
46322
46381
  packageNames() {
46323
46382
  const cfg = this.cfg();
46324
- return Object.keys(this._expandedTargets).map(key => `${cfg.org}/${key}`);
46383
+ return Object.keys(this._expandedPlatforms).map(key => `${cfg.org}/${key}`);
46325
46384
  }
46326
46385
  packageFor(target) {
46327
46386
  const cfg = this.cfg();
46328
- for (const key in this._expandedTargets) {
46329
- const value = this._expandedTargets[key];
46387
+ for (const key in this._expandedPlatforms) {
46388
+ const value = this._expandedPlatforms[key];
46330
46389
  if (value === target) {
46331
46390
  return `${cfg.org}/${key}`;
46332
46391
  }
@@ -46334,19 +46393,19 @@ class SourceManifest extends AbstractManifest {
46334
46393
  return undefined;
46335
46394
  }
46336
46395
  rustTargetFor(node) {
46337
- return this._expandedTargets[node];
46396
+ return this._expandedPlatforms[node];
46338
46397
  }
46339
46398
  manifestFor(target) {
46340
46399
  const targetInfo = getTargetDescriptor(target);
46341
46400
  const name = this.packageFor(target);
46342
46401
  if (!name) {
46343
- throw new Error(`Rust target ${target} not found in "neon.targets" table.`);
46402
+ throw new Error(`Rust target ${target} not found in "neon.platforms" table.`);
46344
46403
  }
46345
46404
  const json = {
46346
46405
  name,
46347
46406
  description: `Prebuilt binary package for \`${this.name}\` on \`${targetInfo.node}\`.`,
46348
46407
  version: this.version,
46349
- os: [targetInfo.platform],
46408
+ os: [targetInfo.os],
46350
46409
  cpu: [targetInfo.arch],
46351
46410
  main: "index.node",
46352
46411
  files: ["index.node"],
@@ -46354,7 +46413,7 @@ class SourceManifest extends AbstractManifest {
46354
46413
  type: "binary",
46355
46414
  rust: target,
46356
46415
  node: targetInfo.node,
46357
- platform: targetInfo.platform,
46416
+ os: targetInfo.os,
46358
46417
  arch: targetInfo.arch,
46359
46418
  abi: targetInfo.abi
46360
46419
  }
@@ -46369,25 +46428,25 @@ class SourceManifest extends AbstractManifest {
46369
46428
  }
46370
46429
  return new BinaryManifest(json);
46371
46430
  }
46372
- async addLoaderTargets(targets) {
46431
+ async updateLoader(platforms) {
46373
46432
  const cfg = this.cfg();
46374
46433
  if (!cfg.load) {
46375
46434
  return;
46376
46435
  }
46377
46436
  const loader = await promises_namespaceObject.readFile(cfg.load, 'utf8');
46378
- function isTargetTable(p) {
46437
+ function isPlatformTable(p) {
46379
46438
  return p.value.properties.every(p => {
46380
46439
  return p.type === 'Property' &&
46381
46440
  p.key.type === 'Literal' &&
46382
- isNodeTarget(p.key.value);
46441
+ isNodePlatform(p.key.value);
46383
46442
  });
46384
46443
  }
46385
46444
  const result = jscodeshift_default()(loader)
46386
46445
  .find((jscodeshift_default()).ObjectExpression)
46387
- .filter(isTargetTable)
46446
+ .filter(isPlatformTable)
46388
46447
  .replaceWith((p) => {
46389
- const newProps = targets.map(target => {
46390
- return jscodeshift_default().property('init', jscodeshift_default().literal(target), jscodeshift_default().arrowFunctionExpression([], jscodeshift_default().callExpression(jscodeshift_default().identifier('require'), [jscodeshift_default().literal(`${cfg.org}/${target}`)])));
46448
+ const newProps = platforms.map(platform => {
46449
+ return jscodeshift_default().property('init', jscodeshift_default().literal(platform), jscodeshift_default().arrowFunctionExpression([], jscodeshift_default().callExpression(jscodeshift_default().identifier('require'), [jscodeshift_default().literal(`${cfg.org}/${platform}`)])));
46391
46450
  });
46392
46451
  return jscodeshift_default().objectExpression([...p.value.properties, ...newProps]);
46393
46452
  })
@@ -46396,20 +46455,20 @@ class SourceManifest extends AbstractManifest {
46396
46455
  }
46397
46456
  async addTargetPair(pair) {
46398
46457
  const { node, rust } = pair;
46399
- if (this._expandedTargets[node] === rust) {
46458
+ if (this._expandedPlatforms[node] === rust) {
46400
46459
  return null;
46401
46460
  }
46402
- this._expandedTargets[node] = rust;
46461
+ this._expandedPlatforms[node] = rust;
46403
46462
  await this.save();
46404
- await this.addLoaderTargets([node]);
46463
+ await this.updateLoader([node]);
46405
46464
  return pair;
46406
46465
  }
46407
- async addNodeTarget(target) {
46408
- const rt = node2Rust(target);
46409
- if (rt.length > 1) {
46410
- throw new Error(`multiple Rust targets found for Node target ${target}; please specify one of ${rt.join(', ')}`);
46466
+ async addNodePlatform(platform) {
46467
+ const targets = node2Rust(platform);
46468
+ if (targets.length > 1) {
46469
+ throw new Error(`multiple Rust targets found for Node platform ${platform}; please specify one of ${targets.join(', ')}`);
46411
46470
  }
46412
- return await this.addTargetPair({ node: target, rust: rt[0] });
46471
+ return await this.addTargetPair({ node: platform, rust: targets[0] });
46413
46472
  }
46414
46473
  async addRustTarget(target) {
46415
46474
  return await this.addTargetPair({ node: rust2Node(target), rust: target });
@@ -46419,39 +46478,39 @@ class SourceManifest extends AbstractManifest {
46419
46478
  for (const [key, value] of Object.entries(family)) {
46420
46479
  const node = key;
46421
46480
  const rust = value;
46422
- if (this._expandedTargets[node] === rust) {
46481
+ if (this._expandedPlatforms[node] === rust) {
46423
46482
  continue;
46424
46483
  }
46425
46484
  newTargets.push({ node, rust });
46426
46485
  }
46427
46486
  return newTargets;
46428
46487
  }
46429
- async addTargets(family, opts = {}) {
46488
+ async addPlatforms(family, opts = {}) {
46430
46489
  let newTargets = this.filterNewTargets(family);
46431
46490
  if (!newTargets.length) {
46432
46491
  return [];
46433
46492
  }
46434
46493
  for (const { node, rust } of newTargets) {
46435
- if (opts.targetsSrc) {
46436
- opts.targetsSrc[node] = rust;
46494
+ if (opts.platformsSrc) {
46495
+ opts.platformsSrc[node] = rust;
46437
46496
  }
46438
- this._expandedTargets[node] = rust;
46497
+ this._expandedPlatforms[node] = rust;
46439
46498
  }
46440
46499
  await this.save();
46441
- await this.addLoaderTargets(newTargets.map(({ node }) => node));
46500
+ await this.updateLoader(newTargets.map(({ node }) => node));
46442
46501
  return newTargets;
46443
46502
  }
46444
- async addTargetPreset(preset) {
46445
- const targetsSrc = this.cfg().targets;
46446
- if (typeof targetsSrc === 'string') {
46447
- this.cfg().targets = [targetsSrc, preset];
46448
- return this.addTargets(expandTargetFamily(preset));
46503
+ async addPlatformPreset(preset) {
46504
+ const platformsSrc = this.cfg().platforms;
46505
+ if (typeof platformsSrc === 'string') {
46506
+ this.cfg().platforms = [platformsSrc, preset];
46507
+ return this.addPlatforms(expandPlatformFamily(preset));
46449
46508
  }
46450
- if (Array.isArray(targetsSrc)) {
46451
- targetsSrc.push(preset);
46452
- return this.addTargets(expandTargetFamily(preset));
46509
+ if (Array.isArray(platformsSrc)) {
46510
+ platformsSrc.push(preset);
46511
+ return this.addPlatforms(expandPlatformFamily(preset));
46453
46512
  }
46454
- return this.addTargets(expandTargetFamily(preset), { targetsSrc });
46513
+ return this.addPlatforms(expandPlatformFamily(preset), { platformsSrc });
46455
46514
  }
46456
46515
  async updateTargets(log, bundle) {
46457
46516
  if (!this._json.optionalDependencies) {
@@ -46489,7 +46548,7 @@ function upgradeSourceV1(object) {
46489
46548
  throw new TypeError(`expected namespaced npm package name, found ${value}`);
46490
46549
  }
46491
46550
  const pkg = value.split('/')[1];
46492
- assertIsNodeTarget(pkg);
46551
+ assertIsNodePlatform(pkg);
46493
46552
  assertIsRustTarget(key);
46494
46553
  return [pkg, key];
46495
46554
  }
@@ -46504,7 +46563,7 @@ function upgradeSourceV1(object) {
46504
46563
  return {
46505
46564
  type: 'source',
46506
46565
  org: [...orgs][0],
46507
- targets: Object.fromEntries(entries)
46566
+ platforms: Object.fromEntries(entries)
46508
46567
  };
46509
46568
  }
46510
46569
  function upgradeBinaryV1(json) {
@@ -46513,11 +46572,22 @@ function upgradeBinaryV1(json) {
46513
46572
  type: 'binary',
46514
46573
  rust: json.binary.rust,
46515
46574
  node: json.binary.node,
46516
- platform: json.binary.platform,
46575
+ os: json.binary.platform,
46517
46576
  arch: json.binary.arch,
46518
46577
  abi: json.binary.abi
46519
46578
  };
46520
46579
  }
46580
+ function upgradeBinaryV2(json) {
46581
+ assertIsBinaryV2(json);
46582
+ return {
46583
+ type: 'binary',
46584
+ rust: json.rust,
46585
+ node: json.node,
46586
+ os: json.platform,
46587
+ arch: json.arch,
46588
+ abi: json.abi
46589
+ };
46590
+ }
46521
46591
 
46522
46592
  ;// CONCATENATED MODULE: ./src/commands/tarball.ts
46523
46593
 
@@ -46598,12 +46668,14 @@ class Tarball {
46598
46668
  const version = sourceManifest.version;
46599
46669
  const binaryManifest = await BinaryManifest.load(this._inDir);
46600
46670
  const cfg = binaryManifest.cfg();
46671
+ // Since the source manifest is the source of truth, any time there's a
46672
+ // metadata mismatch between source and binary manifests, binary is wrong.
46601
46673
  if (this._target && (cfg.rust !== this._target)) {
46602
46674
  throw new Error(`Specified target ${this._target} does not match target ${cfg.rust} in ${this._inDir}`);
46603
46675
  }
46604
46676
  const targetInfo = getTargetDescriptor(cfg.rust);
46605
46677
  cfg.node = targetInfo.node;
46606
- cfg.platform = targetInfo.platform;
46678
+ cfg.os = targetInfo.os;
46607
46679
  cfg.arch = targetInfo.arch;
46608
46680
  cfg.abi = targetInfo.abi;
46609
46681
  // FIXME: make it possible to disable this
@@ -46646,7 +46718,7 @@ class Tarball {
46646
46718
  ;
46647
46719
  }
46648
46720
 
46649
- ;// CONCATENATED MODULE: ./src/commands/add-target.ts
46721
+ ;// CONCATENATED MODULE: ./src/commands/add-platform.ts
46650
46722
 
46651
46723
 
46652
46724
 
@@ -46655,29 +46727,29 @@ class Tarball {
46655
46727
  function optionArray(option) {
46656
46728
  return option == null ? [] : [option];
46657
46729
  }
46658
- const add_target_OPTIONS = [
46730
+ const add_platform_OPTIONS = [
46659
46731
  { name: 'bundle', alias: 'b', type: String, defaultValue: null },
46660
- { name: 'platform', alias: 'p', type: String, defaultValue: null },
46661
- { name: 'arch', alias: 'a', type: String, defaultValue: null },
46732
+ { name: 'os', type: String, defaultValue: null },
46733
+ { name: 'arch', type: String, defaultValue: null },
46662
46734
  { name: 'abi', type: String, defaultValue: null },
46663
- { name: 'out-dir', alias: 'o', type: String, defaultValue: 'npm' },
46735
+ { name: 'out-dir', alias: 'o', type: String, defaultValue: 'platforms' },
46664
46736
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46665
46737
  ];
46666
- class AddTarget {
46667
- static summary() { return 'Add a new build target to package.json.'; }
46668
- static syntax() { return 'neon add-target [<t> | -p <p> -a <arch> [--abi <abi>]] [-o <d>] [-b <f>]'; }
46738
+ class AddPlatform {
46739
+ static summary() { return 'Add a platform or platform preset to a Neon project.'; }
46740
+ static syntax() { return 'neon add-platform [<p> | --os <a> --arch <b> [--abi <c>]] [-o <d>] [-b <f>]'; }
46669
46741
  static options() {
46670
46742
  return [
46671
- { name: '<t>', summary: 'Full target name, in either Node or Rust convention.' },
46743
+ { name: '<p>', summary: 'A Node platform or platform preset.' },
46672
46744
  {
46673
46745
  name: '',
46674
- 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)'
46746
+ summary: 'This can be a specific Node platform or one of the Neon platform family presets described below. (Default: current platform)'
46675
46747
  },
46676
- { name: '-p, --platform <p>', summary: 'Target platform name. (Default: current platform)' },
46677
- { name: '-a, --arch <arch>', summary: 'Target architecture name. (Default: current arch)' },
46678
- { name: '--abi <abi>', summary: 'Target ABI name. (Default: current ABI)' },
46679
- { name: '-o, --out-dir <d>', summary: 'Output directory for target template tree. (Default: npm)' },
46680
- { name: '-b, --bundle <f>', summary: 'File to generate bundling metadata.' },
46748
+ { name: '--os <a>', summary: 'Platform OS name. (Default: current OS)' },
46749
+ { name: '--arch <b>', summary: 'Platform architecture name. (Default: current arch)' },
46750
+ { name: '--abi <c>', summary: 'Platform ABI name. (Default: current ABI)' },
46751
+ { name: '-o, --out-dir <d>', summary: 'Output directory for platform template tree. (Default: ./platforms)' },
46752
+ { name: '-b, --bundle <f>', summary: 'File to generate bundling metadata. (Default: none)' },
46681
46753
  {
46682
46754
  name: '',
46683
46755
  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.'
@@ -46688,78 +46760,78 @@ class AddTarget {
46688
46760
  static seeAlso() { }
46689
46761
  static extraSection() {
46690
46762
  return {
46691
- title: 'Target Family Presets',
46763
+ title: 'Platform Family Presets',
46692
46764
  details: [
46693
- { name: 'linux', summary: 'Common desktop Linux targets.' },
46694
- { name: 'macos', summary: 'Common desktop macOS targets.' },
46695
- { name: 'windows', summary: 'Common desktop Windows targets.' },
46696
- { name: 'mobile', summary: 'Common mobile and tablet targets.' },
46697
- { name: 'desktop', summary: 'All common desktop targets.' },
46698
- { name: 'common', summary: 'All common targets.' },
46699
- { name: 'extended', summary: 'All supported targets.' }
46765
+ { name: 'linux', summary: 'Common desktop Linux platforms.' },
46766
+ { name: 'macos', summary: 'Common desktop macOS platforms.' },
46767
+ { name: 'windows', summary: 'Common desktop Windows platforms.' },
46768
+ { name: 'mobile', summary: 'Common mobile and tablet platforms.' },
46769
+ { name: 'desktop', summary: 'All common desktop platforms.' },
46770
+ { name: 'common', summary: 'All common platforms.' },
46771
+ { name: 'extended', summary: 'All supported platforms.' }
46700
46772
  ]
46701
46773
  };
46702
46774
  }
46703
- _platform;
46775
+ _os;
46704
46776
  _arch;
46705
46777
  _abi;
46706
- _target;
46778
+ _platform;
46707
46779
  _outDir;
46708
46780
  _bundle;
46709
46781
  _verbose;
46710
46782
  constructor(argv) {
46711
- const options = dist_default()(add_target_OPTIONS, { argv, partial: true });
46712
- this._platform = options.platform || null;
46783
+ const options = dist_default()(add_platform_OPTIONS, { argv, partial: true });
46784
+ this._os = options.os || null;
46713
46785
  this._arch = options.arch || null;
46714
46786
  this._abi = options.abi || null;
46715
- this._outDir = options['out-dir'] || external_node_path_namespaceObject.join(process.cwd(), 'dist');
46787
+ this._outDir = options['out-dir'];
46716
46788
  this._bundle = options.bundle || null;
46717
46789
  this._verbose = !!options.verbose;
46718
- if (options.platform && !options.arch) {
46719
- throw new Error("Option --platform requires option --arch to be specified as well.");
46790
+ if (options.os && !options.arch) {
46791
+ throw new Error("Option --os requires option --arch to be specified as well.");
46720
46792
  }
46721
- if (!options.platform && options.arch) {
46722
- throw new Error("Option --arch requires option --platform to be specified as well.");
46793
+ if (!options.os && options.arch) {
46794
+ throw new Error("Option --arch requires option --os to be specified as well.");
46723
46795
  }
46724
- if (options.abi && (!options.platform || !options.arch)) {
46725
- throw new Error("Option --abi requires both options --platform and --arch to be specified as well.");
46796
+ if (options.abi && (!options.os || !options.arch)) {
46797
+ throw new Error("Option --abi requires both options --os and --arch to be specified as well.");
46726
46798
  }
46727
- if (!options.platform && !options.arch && !options.abi) {
46799
+ if (!options.os && !options.arch && !options.abi) {
46728
46800
  if (!options._unknown || options._unknown.length === 0) {
46729
- throw new Error("No arguments found, expected <target> or -p and -a options.");
46801
+ throw new Error("No arguments found, expected platform or --os and --arch options.");
46730
46802
  }
46731
- this._target = options._unknown[0];
46803
+ this._platform = options._unknown[0];
46732
46804
  }
46733
46805
  else {
46734
- this._target = `${options.platform}-${options.arch}`;
46806
+ this._platform = `${options.os}-${options.arch}`;
46735
46807
  if (!!options.abi) {
46736
- this._target = `${this._target}-${options.abi}`;
46808
+ this._platform = `${this._platform}-${options.abi}`;
46737
46809
  }
46738
46810
  }
46739
46811
  }
46740
46812
  log(msg) {
46741
46813
  if (this._verbose) {
46742
- console.error("[neon add-target] " + msg);
46814
+ console.error("[neon add-platform] " + msg);
46743
46815
  }
46744
46816
  }
46745
- async addTarget(sourceManifest) {
46746
- if (!this._target) {
46747
- this.log('adding default system target');
46817
+ async addPlatform(sourceManifest) {
46818
+ if (!this._platform) {
46819
+ this.log('adding default system platform');
46748
46820
  return optionArray(await sourceManifest.addRustTarget(await getCurrentTarget(msg => this.log(msg))));
46749
46821
  }
46750
- else if (isRustTarget(this._target)) {
46751
- this.log(`adding Rust target ${this._target}`);
46752
- return optionArray(await sourceManifest.addRustTarget(this._target));
46822
+ else if (isRustTarget(this._platform)) {
46823
+ this.log(`adding Rust target ${this._platform}`);
46824
+ return optionArray(await sourceManifest.addRustTarget(this._platform));
46753
46825
  }
46754
- else if (isNodeTarget(this._target)) {
46755
- this.log(`adding Node target ${this._target}`);
46756
- return optionArray(await sourceManifest.addNodeTarget(this._target));
46826
+ else if (isNodePlatform(this._platform)) {
46827
+ this.log(`adding Node platform ${this._platform}`);
46828
+ return optionArray(await sourceManifest.addNodePlatform(this._platform));
46757
46829
  }
46758
- else if (isTargetPreset(this._target)) {
46759
- return sourceManifest.addTargetPreset(this._target);
46830
+ else if (isPlatformPreset(this._platform)) {
46831
+ return sourceManifest.addPlatformPreset(this._platform);
46760
46832
  }
46761
46833
  else {
46762
- throw new Error(`unrecognized target ${this._target}`);
46834
+ throw new Error(`unrecognized platform or preset ${this._platform}`);
46763
46835
  }
46764
46836
  }
46765
46837
  async createTemplateTree(sourceManifest, pair) {
@@ -46779,7 +46851,7 @@ class AddTarget {
46779
46851
  this.log(`reading package.json`);
46780
46852
  const sourceManifest = await SourceManifest.load();
46781
46853
  this.log(`manifest: ${sourceManifest.stringify()}`);
46782
- const modified = await this.addTarget(sourceManifest);
46854
+ const modified = await this.addPlatform(sourceManifest);
46783
46855
  if (modified.length) {
46784
46856
  sourceManifest.updateTargets(msg => this.log(msg), this._bundle);
46785
46857
  for (const pair of modified) {
@@ -46789,16 +46861,16 @@ class AddTarget {
46789
46861
  }
46790
46862
  }
46791
46863
 
46792
- ;// CONCATENATED MODULE: ./src/commands/update-targets.ts
46864
+ ;// CONCATENATED MODULE: ./src/commands/update-platforms.ts
46793
46865
 
46794
46866
 
46795
- const update_targets_OPTIONS = [
46867
+ const update_platforms_OPTIONS = [
46796
46868
  { name: 'bundle', alias: 'b', type: String, defaultValue: null },
46797
46869
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46798
46870
  ];
46799
- class UpdateTargets {
46871
+ class UpdatePlatforms {
46800
46872
  static summary() { return 'Update dependencies for all build targets in package.json.'; }
46801
- static syntax() { return 'neon update-targets [-b <file>]'; }
46873
+ static syntax() { return 'neon update-platforms [-b <file>]'; }
46802
46874
  static options() {
46803
46875
  return [
46804
46876
  { name: '-b, --bundle <file>', summary: 'File to generate bundling metadata.' },
@@ -46818,13 +46890,13 @@ class UpdateTargets {
46818
46890
  _bundle;
46819
46891
  _verbose;
46820
46892
  constructor(argv) {
46821
- const options = dist_default()(update_targets_OPTIONS, { argv });
46893
+ const options = dist_default()(update_platforms_OPTIONS, { argv });
46822
46894
  this._bundle = options.bundle || null;
46823
46895
  this._verbose = !!options.verbose;
46824
46896
  }
46825
46897
  log(msg) {
46826
46898
  if (this._verbose) {
46827
- console.error("[neon update-targets] " + msg);
46899
+ console.error("[neon update-platforms] " + msg);
46828
46900
  }
46829
46901
  }
46830
46902
  async run() {
@@ -46846,62 +46918,62 @@ class UpdateTargets {
46846
46918
 
46847
46919
 
46848
46920
  const rust_target_OPTIONS = [
46849
- { name: 'platform', alias: 'p', type: String, defaultValue: null },
46850
- { name: 'arch', alias: 'a', type: String, defaultValue: null },
46921
+ { name: 'os', type: String, defaultValue: null },
46922
+ { name: 'arch', type: String, defaultValue: null },
46851
46923
  { name: 'abi', type: String, defaultValue: null },
46852
46924
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46853
46925
  ];
46854
46926
  class RustTarget {
46855
- static summary() { return 'Display the Rust target triple for a given build target.'; }
46856
- static syntax() { return 'neon rust-target <target> | (-p <plat> -a <arch> [--abi <abi>])'; }
46927
+ static summary() { return 'Display the Rust target triple configured for a platform.'; }
46928
+ static syntax() { return 'neon rust-target <platform> | (--os <os> --arch <arch> [--abi <abi>])'; }
46857
46929
  static options() {
46858
46930
  return [
46859
- { name: '<target>', summary: 'Full target name in Node convention.' },
46860
- { name: '-p, --platform <plat>', summary: 'Target platform name.' },
46861
- { name: '-a, --arch <arch>', summary: 'Target architecture name.' },
46931
+ { name: '<platform>', summary: 'Full platform name in Node convention.' },
46932
+ { name: '--os <os>', summary: 'Target OS name.' },
46933
+ { name: '--arch <arch>', summary: 'Target architecture name.' },
46862
46934
  { name: '--abi <abi>', summary: 'Target ABI name. (Default: null)' },
46863
46935
  { name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
46864
46936
  ];
46865
46937
  }
46866
46938
  static seeAlso() { }
46867
46939
  static extraSection() { }
46868
- _platform;
46940
+ _os;
46869
46941
  _arch;
46870
46942
  _abi;
46871
- _target;
46943
+ _platform;
46872
46944
  _verbose;
46873
46945
  constructor(argv) {
46874
46946
  const options = dist_default()(rust_target_OPTIONS, { argv, partial: true });
46875
- this._platform = options.platform || null;
46947
+ this._os = options.os || null;
46876
46948
  this._arch = options.arch || null;
46877
46949
  this._abi = options.abi || null;
46878
46950
  this._verbose = !!options.verbose;
46879
- if (options.platform && !options.arch) {
46880
- throw new Error("Option --platform requires option --arch to be specified as well.");
46951
+ if (options.os && !options.arch) {
46952
+ throw new Error("Option --os requires option --arch to be specified as well.");
46881
46953
  }
46882
- if (!options.platform && options.arch) {
46883
- throw new Error("Option --arch requires option --platform to be specified as well.");
46954
+ if (!options.os && options.arch) {
46955
+ throw new Error("Option --arch requires option --os to be specified as well.");
46884
46956
  }
46885
- if (options.abi && (!options.platform || !options.arch)) {
46886
- throw new Error("Option --abi requires both options --platform and --arch to be specified as well.");
46957
+ if (options.abi && (!options.os || !options.arch)) {
46958
+ throw new Error("Option --abi requires both options --os and --arch to be specified as well.");
46887
46959
  }
46888
- let target;
46889
- if (!options.platform && !options.arch && !options.abi) {
46960
+ let platform;
46961
+ if (!options.os && !options.arch && !options.abi) {
46890
46962
  if (!options._unknown || options._unknown.length === 0) {
46891
- throw new Error("No arguments found, expected <target> or -p and -a options.");
46963
+ throw new Error("No arguments found, expected platform or --os and --arch options.");
46892
46964
  }
46893
- target = options._unknown[0];
46965
+ platform = options._unknown[0];
46894
46966
  }
46895
46967
  else {
46896
- target = `${options.platform}-${options.arch}`;
46968
+ platform = `${options.os}-${options.arch}`;
46897
46969
  if (!!options.abi) {
46898
- target = `${target}-${options.abi}`;
46970
+ platform = `${platform}-${options.abi}`;
46899
46971
  }
46900
46972
  }
46901
- if (!isNodeTarget(target)) {
46902
- throw new Error(`${target} is not a valid Node target.`);
46973
+ if (!isNodePlatform(platform)) {
46974
+ throw new Error(`${platform} is not a valid Node platform.`);
46903
46975
  }
46904
- this._target = target;
46976
+ this._platform = platform;
46905
46977
  }
46906
46978
  log(msg) {
46907
46979
  if (this._verbose) {
@@ -46912,9 +46984,9 @@ class RustTarget {
46912
46984
  this.log(`reading package.json`);
46913
46985
  const sourceManifest = await SourceManifest.load();
46914
46986
  this.log(`manifest: ${sourceManifest.stringify()}`);
46915
- const rust = sourceManifest.rustTargetFor(this._target);
46987
+ const rust = sourceManifest.rustTargetFor(this._platform);
46916
46988
  if (!rust) {
46917
- throw new Error(`no Rust target found for ${this._target}`);
46989
+ throw new Error(`no Rust target found for ${this._platform}`);
46918
46990
  }
46919
46991
  console.log(rust);
46920
46992
  }
@@ -46928,7 +47000,7 @@ const preset_OPTIONS = [
46928
47000
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46929
47001
  ];
46930
47002
  class Preset {
46931
- static summary() { return 'Display the target JSON data for a given preset.'; }
47003
+ static summary() { return 'Display the JSON target data for a platform preset.'; }
46932
47004
  static syntax() { return 'neon preset [-p] [-v] <preset>'; }
46933
47005
  static options() {
46934
47006
  return [
@@ -46952,7 +47024,7 @@ class Preset {
46952
47024
  if (options._unknown.length > 1) {
46953
47025
  throw new Error(`Unexpected argument ${options._unknown[1]}`);
46954
47026
  }
46955
- assertIsTargetPreset(options._unknown[0]);
47027
+ assertIsPlatformPreset(options._unknown[0]);
46956
47028
  this._preset = options._unknown[0];
46957
47029
  }
46958
47030
  log(msg) {
@@ -46961,7 +47033,7 @@ class Preset {
46961
47033
  }
46962
47034
  }
46963
47035
  async run() {
46964
- const map = expandTargetPreset(this._preset);
47036
+ const map = expandPlatformPreset(this._preset);
46965
47037
  const output = this._pretty
46966
47038
  ? JSON.stringify(map, null, 2)
46967
47039
  : JSON.stringify(map);
@@ -47018,8 +47090,10 @@ var CommandName;
47018
47090
  CommandName["PackBuild"] = "pack-build";
47019
47091
  CommandName["Tarball"] = "tarball";
47020
47092
  CommandName["AddTarget"] = "add-target";
47093
+ CommandName["AddPlatform"] = "add-platform";
47021
47094
  CommandName["InstallBuilds"] = "install-builds";
47022
47095
  CommandName["UpdateTargets"] = "update-targets";
47096
+ CommandName["UpdatePlatforms"] = "update-platforms";
47023
47097
  CommandName["RustTarget"] = "rust-target";
47024
47098
  CommandName["Preset"] = "preset";
47025
47099
  })(CommandName || (CommandName = {}));
@@ -47040,9 +47114,11 @@ const COMMANDS = {
47040
47114
  [CommandName.Bump]: Bump,
47041
47115
  [CommandName.PackBuild]: Tarball,
47042
47116
  [CommandName.Tarball]: Tarball,
47043
- [CommandName.AddTarget]: AddTarget,
47044
- [CommandName.InstallBuilds]: UpdateTargets,
47045
- [CommandName.UpdateTargets]: UpdateTargets,
47117
+ [CommandName.AddTarget]: AddPlatform,
47118
+ [CommandName.AddPlatform]: AddPlatform,
47119
+ [CommandName.InstallBuilds]: UpdatePlatforms,
47120
+ [CommandName.UpdateTargets]: UpdatePlatforms,
47121
+ [CommandName.UpdatePlatforms]: UpdatePlatforms,
47046
47122
  [CommandName.RustTarget]: RustTarget,
47047
47123
  [CommandName.Preset]: Preset
47048
47124
  };
@@ -47055,8 +47131,8 @@ function summaries() {
47055
47131
  { name: CommandName.Dist, summary: Dist.summary() },
47056
47132
  { name: CommandName.Bump, summary: Bump.summary() },
47057
47133
  { name: CommandName.Tarball, summary: Tarball.summary() },
47058
- { name: CommandName.AddTarget, summary: AddTarget.summary() },
47059
- { name: CommandName.UpdateTargets, summary: UpdateTargets.summary() },
47134
+ { name: CommandName.AddPlatform, summary: AddPlatform.summary() },
47135
+ { name: CommandName.UpdatePlatforms, summary: UpdatePlatforms.summary() },
47060
47136
  { name: CommandName.RustTarget, summary: RustTarget.summary() },
47061
47137
  { name: CommandName.Preset, summary: Preset.summary() }
47062
47138
  ];
@@ -47072,7 +47148,7 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
47072
47148
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(5046);
47073
47149
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(command_line_commands__WEBPACK_IMPORTED_MODULE_0__);
47074
47150
  /* harmony import */ var _print_js__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(9050);
47075
- /* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(1430);
47151
+ /* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(5834);
47076
47152
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(2033);
47077
47153
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(node_module__WEBPACK_IMPORTED_MODULE_3__);
47078
47154
 
@@ -50096,7 +50172,7 @@ const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});
50096
50172
  /* harmony default export */ const chalk_source = (chalk);
50097
50173
 
50098
50174
  // EXTERNAL MODULE: ./src/command.ts + 40 modules
50099
- var command = __nccwpck_require__(1430);
50175
+ var command = __nccwpck_require__(5834);
50100
50176
  ;// CONCATENATED MODULE: ./src/print.ts
50101
50177
 
50102
50178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/cli",
3
- "version": "0.0.176",
3
+ "version": "0.0.177",
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.176",
31
- "@cargo-messages/darwin-arm64": "0.0.176",
32
- "@cargo-messages/darwin-x64": "0.0.176",
33
- "@cargo-messages/linux-arm-gnueabihf": "0.0.176",
34
- "@cargo-messages/linux-x64-gnu": "0.0.168",
35
- "@cargo-messages/win32-arm64-msvc": "0.0.176",
36
- "@cargo-messages/win32-x64-msvc": "0.0.176"
30
+ "@cargo-messages/android-arm-eabi": "0.0.177",
31
+ "@cargo-messages/darwin-arm64": "0.0.177",
32
+ "@cargo-messages/darwin-x64": "0.0.177",
33
+ "@cargo-messages/linux-arm-gnueabihf": "0.0.177",
34
+ "@cargo-messages/linux-x64-gnu": "0.0.177",
35
+ "@cargo-messages/win32-arm64-msvc": "0.0.177",
36
+ "@cargo-messages/win32-x64-msvc": "0.0.177"
37
37
  }
38
38
  }