@neon-rs/cli 0.0.176 → 0.0.178

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 +306 -207
  2. package/package.json +8 -8
package/index.js CHANGED
@@ -8,8 +8,8 @@ import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
8
8
  var __webpack_unused_export__;
9
9
 
10
10
  __webpack_unused_export__ = ({ value: true });
11
- __webpack_unused_export__ = exports.sj = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
12
- function currentTarget() {
11
+ __webpack_unused_export__ = exports.sj = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
12
+ function currentPlatform() {
13
13
  let os = null;
14
14
  switch (process.platform) {
15
15
  case 'android':
@@ -65,6 +65,11 @@ function currentTarget() {
65
65
  }
66
66
  throw new Error(`Neon: unsupported system: ${process.platform}`);
67
67
  }
68
+ __webpack_unused_export__ = currentPlatform;
69
+ // DEPRECATE(0.1)
70
+ function currentTarget() {
71
+ return currentPlatform();
72
+ }
68
73
  __webpack_unused_export__ = currentTarget;
69
74
  function isGlibc() {
70
75
  // Cast to unknown to work around a bug in the type definition:
@@ -97,25 +102,34 @@ function* interleave(a1, a2) {
97
102
  }
98
103
  }
99
104
  function bin(scope, ...rest) {
100
- return [...interleave(scope, rest)].join("") + "/" + currentTarget();
105
+ return [...interleave(scope, rest)].join("") + "/" + currentPlatform();
101
106
  }
102
107
  __webpack_unused_export__ = bin;
108
+ // DEPRECATE(0.1)
103
109
  function lazyV1(loaders, exports) {
104
110
  return lazyV2({
105
111
  targets: loaders,
106
112
  exports
107
113
  });
108
114
  }
115
+ // DEPRECATE(0.1)
109
116
  function lazyV2(options) {
110
- const loaders = options.targets;
117
+ return lazyV3({
118
+ platforms: options.targets,
119
+ exports: options.exports,
120
+ debug: options.debug
121
+ });
122
+ }
123
+ function lazyV3(options) {
124
+ const loaders = options.platforms;
111
125
  let loaded = null;
112
126
  function load() {
113
127
  if (loaded) {
114
128
  return loaded;
115
129
  }
116
- const target = currentTarget();
117
- if (!loaders.hasOwnProperty(target)) {
118
- throw new Error(`no precompiled module found for ${target}`);
130
+ const platform = currentPlatform();
131
+ if (!loaders.hasOwnProperty(platform)) {
132
+ throw new Error(`no precompiled module found for ${platform}`);
119
133
  }
120
134
  if (options.debug) {
121
135
  try {
@@ -126,7 +140,7 @@ function lazyV2(options) {
126
140
  }
127
141
  }
128
142
  if (!loaded) {
129
- loaded = loaders[target]();
143
+ loaded = loaders[platform]();
130
144
  }
131
145
  return loaded;
132
146
  }
@@ -137,17 +151,19 @@ function lazyV2(options) {
137
151
  return module;
138
152
  }
139
153
  function lazy(optionsOrLoaders, exports) {
140
- return exports
141
- ? lazyV1(optionsOrLoaders, exports)
142
- : lazyV2(optionsOrLoaders);
154
+ return (!exports && !('targets' in optionsOrLoaders))
155
+ ? lazyV3(optionsOrLoaders)
156
+ : !exports
157
+ ? lazyV2(optionsOrLoaders)
158
+ : lazyV1(optionsOrLoaders, exports);
143
159
  }
144
160
  __webpack_unused_export__ = lazy;
145
161
  function __UNSTABLE_loader(loaders) {
146
- const target = currentTarget();
147
- if (!loaders.hasOwnProperty(target)) {
148
- throw new Error(`no precompiled module found for ${target}`);
162
+ const platform = currentPlatform();
163
+ if (!loaders.hasOwnProperty(platform)) {
164
+ throw new Error(`no precompiled module found for ${platform}`);
149
165
  }
150
- const loader = loaders[target];
166
+ const loader = loaders[platform];
151
167
  let loaded = null;
152
168
  return () => {
153
169
  if (loaded) {
@@ -158,19 +174,25 @@ function __UNSTABLE_loader(loaders) {
158
174
  };
159
175
  }
160
176
  __webpack_unused_export__ = __UNSTABLE_loader;
161
- function isTargetTable(options) {
162
- return !('targets' in options);
177
+ // DEPRECATE(0.1)
178
+ function isDeprecatedProxyOptions(options) {
179
+ return 'targets' in options;
180
+ }
181
+ function isProxyOptions(options) {
182
+ return 'platforms' in options;
163
183
  }
164
184
  function proxy(options) {
165
- if (isTargetTable(options)) {
166
- options = { targets: options };
167
- }
168
- const target = currentTarget();
169
- const loaders = options.targets;
170
- if (!loaders.hasOwnProperty(target)) {
171
- throw new Error(`no precompiled module found for ${target}`);
172
- }
173
- const loader = loaders[target];
185
+ const opts = isProxyOptions(options)
186
+ ? options
187
+ : !isDeprecatedProxyOptions(options)
188
+ ? { platforms: options }
189
+ : { platforms: options.targets, debug: options.debug };
190
+ const platform = currentPlatform();
191
+ const loaders = opts.platforms;
192
+ if (!loaders.hasOwnProperty(platform)) {
193
+ throw new Error(`no precompiled module found for ${platform}`);
194
+ }
195
+ const loader = loaders[platform];
174
196
  let loaded = null;
175
197
  function load() {
176
198
  if (!loaded) {
@@ -226,6 +248,7 @@ function proxy(options) {
226
248
  return new Proxy({}, handler);
227
249
  }
228
250
  exports.sj = proxy;
251
+ // DEPRECATE(0.1)
229
252
  function __UNSTABLE_proxy(options) {
230
253
  return proxy(options);
231
254
  }
@@ -44171,7 +44194,7 @@ function wrappy (fn, cb) {
44171
44194
 
44172
44195
  /***/ }),
44173
44196
 
44174
- /***/ 1430:
44197
+ /***/ 5834:
44175
44198
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
44176
44199
 
44177
44200
 
@@ -45954,10 +45977,10 @@ var temp = __nccwpck_require__(591);
45954
45977
  ;// CONCATENATED MODULE: ./data/rust.json
45955
45978
  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
45979
  ;// 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"]}}');
45980
+ 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
45981
  ;// CONCATENATED MODULE: ./data/preset.json
45959
45982
  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
45983
+ ;// CONCATENATED MODULE: ./src/platform.ts
45961
45984
 
45962
45985
 
45963
45986
 
@@ -45970,23 +45993,23 @@ function assertIsRustTarget(x) {
45970
45993
  throw new RangeError(`invalid Rust target: ${x}`);
45971
45994
  }
45972
45995
  }
45973
- function isNodeTarget(x) {
45996
+ function isNodePlatform(x) {
45974
45997
  return (typeof x === 'string') && (x in node_namespaceObject);
45975
45998
  }
45976
- function assertIsNodeTarget(x) {
45977
- if (!isNodeTarget(x)) {
45978
- throw new RangeError(`invalid Node target: ${x}`);
45999
+ function assertIsNodePlatform(x) {
46000
+ if (!isNodePlatform(x)) {
46001
+ throw new RangeError(`invalid platform: ${x}`);
45979
46002
  }
45980
46003
  }
45981
- function isTargetPreset(x) {
46004
+ function isPlatformPreset(x) {
45982
46005
  return (typeof x === 'string') && (x in preset_namespaceObject);
45983
46006
  }
45984
- function assertIsTargetPreset(x) {
45985
- if (!isTargetPreset(x)) {
45986
- throw new RangeError(`invalid target family preset: ${x}`);
46007
+ function assertIsPlatformPreset(x) {
46008
+ if (!isPlatformPreset(x)) {
46009
+ throw new RangeError(`invalid platform family preset: ${x}`);
45987
46010
  }
45988
46011
  }
45989
- function lookupTargetPreset(key) {
46012
+ function lookupPlatformPreset(key) {
45990
46013
  return preset_namespaceObject[key];
45991
46014
  }
45992
46015
  function merge(maps) {
@@ -45996,19 +46019,19 @@ function merge(maps) {
45996
46019
  }
45997
46020
  return merged;
45998
46021
  }
45999
- function expandTargetPreset(preset) {
46000
- return expandTargetFamily(lookupTargetPreset(preset));
46022
+ function expandPlatformPreset(preset) {
46023
+ return expandPlatformFamily(lookupPlatformPreset(preset));
46001
46024
  }
46002
- function expandTargetFamily(family) {
46003
- return isTargetPreset(family)
46004
- ? expandTargetPreset(family)
46025
+ function expandPlatformFamily(family) {
46026
+ return isPlatformPreset(family)
46027
+ ? expandPlatformPreset(family)
46005
46028
  : Array.isArray(family)
46006
- ? merge(family.map(expandTargetFamily))
46029
+ ? merge(family.map(expandPlatformFamily))
46007
46030
  : family;
46008
46031
  }
46009
46032
  function getTargetDescriptor(target) {
46010
46033
  const node = rust_namespaceObject[target];
46011
- if (!isNodeTarget(node)) {
46034
+ if (!isNodePlatform(node)) {
46012
46035
  throw new Error(`Rust target ${target} not supported`);
46013
46036
  }
46014
46037
  const nodeDescriptor = node_namespaceObject[node];
@@ -46018,7 +46041,7 @@ function getTargetDescriptor(target) {
46018
46041
  }
46019
46042
  return {
46020
46043
  node,
46021
- platform: nodeDescriptor.platform,
46044
+ os: nodeDescriptor.os,
46022
46045
  arch: nodeDescriptor.arch,
46023
46046
  abi: nodeDescriptor.abi,
46024
46047
  llvm: nodeDescriptor.llvm
@@ -46032,7 +46055,7 @@ function node2Rust(target) {
46032
46055
  }
46033
46056
  function rust2Node(target) {
46034
46057
  const nt = rust_namespaceObject[target];
46035
- assertIsNodeTarget(nt);
46058
+ assertIsNodePlatform(nt);
46036
46059
  return nt;
46037
46060
  }
46038
46061
  async function getCurrentTarget(log) {
@@ -46075,18 +46098,18 @@ function assertHasProps(keys, json, path) {
46075
46098
  }
46076
46099
  }
46077
46100
  function assertIsBinaryCfg(json) {
46078
- assertHasProps(['type', 'rust', 'node', 'platform', 'arch', 'abi'], json, "neon");
46101
+ assertHasProps(['type', 'rust', 'node', 'os', 'arch', 'abi'], json, "neon");
46079
46102
  if (json.type !== 'binary') {
46080
46103
  throw new TypeError(`expected "neon.type" property to be "binary", found ${json.type}`);
46081
46104
  }
46082
46105
  if (typeof json.rust !== 'string' || !isRustTarget(json.rust)) {
46083
46106
  throw new TypeError(`expected "neon.rust" to be a valid Rust target, found ${json.rust}`);
46084
46107
  }
46085
- if (typeof json.node !== 'string' || !isNodeTarget(json.node)) {
46108
+ if (typeof json.node !== 'string' || !isNodePlatform(json.node)) {
46086
46109
  throw new TypeError(`expected "neon.node" to be a valid Node target, found ${json.node}`);
46087
46110
  }
46088
- if (typeof json.platform !== 'string') {
46089
- throw new TypeError(`expected "neon.platform" to be a string, found ${json.platform}`);
46111
+ if (typeof json.os !== 'string') {
46112
+ throw new TypeError(`expected "neon.os" to be a string, found ${json.os}`);
46090
46113
  }
46091
46114
  if (typeof json.arch !== 'string') {
46092
46115
  throw new TypeError(`expected "neon.arch" to be a string, found ${json.arch}`);
@@ -46095,30 +46118,51 @@ function assertIsBinaryCfg(json) {
46095
46118
  throw new TypeError(`expected "neon.abi" to be a string or null, found ${json.abi}`);
46096
46119
  }
46097
46120
  }
46098
- function assertIsTargetMap(json, path) {
46121
+ function assertIsPlatformMap(json, path) {
46099
46122
  assertIsObject(json, path);
46100
46123
  for (const key in json) {
46101
46124
  const value = json[key];
46102
- if (!isNodeTarget(key)) {
46103
- throw new TypeError(`target table key ${key} is not a valid Node target`);
46125
+ if (!isNodePlatform(key)) {
46126
+ throw new TypeError(`platform table key ${key} is not a valid Node platform`);
46104
46127
  }
46105
46128
  if (typeof value !== 'string' || !isRustTarget(value)) {
46106
- throw new TypeError(`target table value ${value} is not a valid Rust target`);
46129
+ throw new TypeError(`platform table value ${value} is not a valid Rust target`);
46107
46130
  }
46108
46131
  }
46109
46132
  }
46110
- function assertIsTargetFamily(json, path) {
46133
+ function assertIsPlatformFamily(json, path) {
46111
46134
  if (typeof json === 'string') {
46112
- assertIsTargetPreset(json);
46135
+ assertIsPlatformPreset(json);
46113
46136
  return;
46114
46137
  }
46115
46138
  if (Array.isArray(json)) {
46116
46139
  for (const elt of json) {
46117
- assertIsTargetPreset(elt);
46140
+ assertIsPlatformPreset(elt);
46118
46141
  }
46119
46142
  return;
46120
46143
  }
46121
- assertIsTargetMap(json, path);
46144
+ assertIsPlatformMap(json, path);
46145
+ }
46146
+ function assertIsBinaryV2(json) {
46147
+ if (!json || typeof json !== 'object') {
46148
+ throw new TypeError(`expected "neon" to be an object, found ${json}`);
46149
+ }
46150
+ assertHasProps(['rust', 'node', 'platform', 'arch', 'abi'], json, "neon");
46151
+ if (!isRustTarget(json.rust)) {
46152
+ throw new TypeError(`expected "neon.rust" to be a valid Rust target, found ${json.rust}`);
46153
+ }
46154
+ if (!isNodePlatform(json.node)) {
46155
+ throw new TypeError(`expected "neon.node" to be a valid Node platform, found ${json.node}`);
46156
+ }
46157
+ if (typeof json.platform !== 'string') {
46158
+ throw new TypeError(`expected "neon.platform" to be a string, found ${json.platform}`);
46159
+ }
46160
+ if (typeof json.arch !== 'string') {
46161
+ throw new TypeError(`expected "neon.arch" to be a string, found ${json.arch}`);
46162
+ }
46163
+ if (json.abi !== null && typeof json.abi !== 'string') {
46164
+ throw new TypeError(`expected "neon.abi" to be a string or null, found ${json.abi}`);
46165
+ }
46122
46166
  }
46123
46167
  function assertIsBinaryV1(json) {
46124
46168
  assertHasProps(['binary'], json, "neon");
@@ -46130,8 +46174,8 @@ function assertIsBinaryV1(json) {
46130
46174
  if (typeof binary.rust !== 'string' || !isRustTarget(binary.rust)) {
46131
46175
  throw new TypeError(`expected "neon.binary.rust" to be a valid Rust target, found ${binary.rust}`);
46132
46176
  }
46133
- if (!isNodeTarget(binary.node)) {
46134
- throw new TypeError(`expected "neon.binary.node" to be a valid Node target, found ${binary.node}`);
46177
+ if (!isNodePlatform(binary.node)) {
46178
+ throw new TypeError(`expected "neon.binary.node" to be a valid Node platform, found ${binary.node}`);
46135
46179
  }
46136
46180
  if (typeof binary.platform !== 'string') {
46137
46181
  throw new TypeError(`expected "neon.binary.platform" to be a string, found ${binary.platform}`);
@@ -46156,14 +46200,14 @@ function assertIsSourceV1(json) {
46156
46200
  }
46157
46201
  }
46158
46202
  function assertIsSourceCfg(json) {
46159
- assertHasProps(['type', 'org', 'targets'], json, "neon");
46203
+ assertHasProps(['type', 'org', 'platforms'], json, "neon");
46160
46204
  if (json.type !== 'source') {
46161
46205
  throw new TypeError(`expected "neon.type" property to be "source", found ${json.type}`);
46162
46206
  }
46163
46207
  if (typeof json.org !== 'string') {
46164
46208
  throw new TypeError(`expected "neon.org" to be a string, found ${json.org}`);
46165
46209
  }
46166
- assertIsTargetFamily(json.targets, "neon.targets");
46210
+ assertIsPlatformFamily(json.platforms, "neon.platforms");
46167
46211
  if ('load' in json) {
46168
46212
  if (typeof json.load !== 'string' && typeof json.load !== 'undefined') {
46169
46213
  throw new TypeError(`expected "neon.load" to be a string, found ${json.load}`);
@@ -46238,6 +46282,19 @@ class BinaryManifest extends AbstractManifest {
46238
46282
  }
46239
46283
  function normalizeBinaryCfg(json) {
46240
46284
  assertHasCfg(json);
46285
+ // V3 format: {
46286
+ // neon: {
46287
+ // type: 'binary',
46288
+ // rust: RustTarget,
46289
+ // node: NodeTarget,
46290
+ // os: string,
46291
+ // arch: string,
46292
+ // abi: string | null
46293
+ // }
46294
+ // }
46295
+ if ('type' in json.neon && 'os' in json.neon) {
46296
+ return false;
46297
+ }
46241
46298
  // V2 format: {
46242
46299
  // neon: {
46243
46300
  // type: 'binary',
@@ -46249,7 +46306,8 @@ function normalizeBinaryCfg(json) {
46249
46306
  // }
46250
46307
  // }
46251
46308
  if ('type' in json.neon) {
46252
- return false;
46309
+ json.neon = upgradeBinaryV2(json.neon);
46310
+ return true;
46253
46311
  }
46254
46312
  // V1 format: {
46255
46313
  // neon: {
@@ -46267,15 +46325,34 @@ function normalizeBinaryCfg(json) {
46267
46325
  }
46268
46326
  function normalizeSourceCfg(json) {
46269
46327
  assertHasCfg(json);
46328
+ // V4 format: {
46329
+ // neon: {
46330
+ // type: 'source',
46331
+ // org: string,
46332
+ // platforms: PlatformFamily,
46333
+ // load?: string | undefined
46334
+ // }
46335
+ // }
46336
+ if ('type' in json.neon && 'platforms' in json.neon) {
46337
+ return false;
46338
+ }
46270
46339
  // V3 format: {
46271
46340
  // neon: {
46272
46341
  // type: 'source',
46273
46342
  // org: string,
46274
- // targets: { Node => Rust }
46343
+ // targets: PlatformFamily
46275
46344
  // }
46276
46345
  // }
46277
46346
  if ('type' in json.neon) {
46278
- return false;
46347
+ const org = json.neon['org'];
46348
+ const targets = json.neon['targets'];
46349
+ assertIsPlatformFamily(targets, "neon.targets");
46350
+ json.neon = {
46351
+ type: 'source',
46352
+ org,
46353
+ platforms: targets
46354
+ };
46355
+ return true;
46279
46356
  }
46280
46357
  // V2 format: {
46281
46358
  // neon: {
@@ -46284,12 +46361,12 @@ function normalizeSourceCfg(json) {
46284
46361
  // }
46285
46362
  // }
46286
46363
  if ('org' in json.neon) {
46287
- const targets = json.neon['targets'];
46288
- assertIsTargetMap(targets, "neon.targets");
46364
+ const platforms = json.neon['targets'];
46365
+ assertIsPlatformMap(platforms, "neon.targets");
46289
46366
  json.neon = {
46290
46367
  type: 'source',
46291
46368
  org: json.neon.org,
46292
- targets
46369
+ platforms
46293
46370
  };
46294
46371
  return true;
46295
46372
  }
@@ -46303,15 +46380,20 @@ function normalizeSourceCfg(json) {
46303
46380
  json.neon = upgradeSourceV1(targets);
46304
46381
  return true;
46305
46382
  }
46383
+ // The source manifest is the source of truth for all Neon
46384
+ // project metadata. This means you never need to go searching
46385
+ // for any other files to query the Neon project's metadata.
46386
+ // (Some data is replicated in the binary manifests, however,
46387
+ // since they are independently published in npm.)
46306
46388
  class SourceManifest extends AbstractManifest {
46307
46389
  _sourceJSON;
46308
- _expandedTargets;
46390
+ _expandedPlatforms;
46309
46391
  constructor(json) {
46310
46392
  super(json);
46311
46393
  this._upgraded = normalizeSourceCfg(this._json);
46312
46394
  assertHasSourceCfg(this._json);
46313
46395
  this._sourceJSON = this._json;
46314
- this._expandedTargets = expandTargetFamily(this._sourceJSON.neon.targets);
46396
+ this._expandedPlatforms = expandPlatformFamily(this._sourceJSON.neon.platforms);
46315
46397
  }
46316
46398
  static async load(dir) {
46317
46399
  return new SourceManifest(await readManifest(dir));
@@ -46321,12 +46403,12 @@ class SourceManifest extends AbstractManifest {
46321
46403
  }
46322
46404
  packageNames() {
46323
46405
  const cfg = this.cfg();
46324
- return Object.keys(this._expandedTargets).map(key => `${cfg.org}/${key}`);
46406
+ return Object.keys(this._expandedPlatforms).map(key => `${cfg.org}/${key}`);
46325
46407
  }
46326
46408
  packageFor(target) {
46327
46409
  const cfg = this.cfg();
46328
- for (const key in this._expandedTargets) {
46329
- const value = this._expandedTargets[key];
46410
+ for (const key in this._expandedPlatforms) {
46411
+ const value = this._expandedPlatforms[key];
46330
46412
  if (value === target) {
46331
46413
  return `${cfg.org}/${key}`;
46332
46414
  }
@@ -46334,19 +46416,19 @@ class SourceManifest extends AbstractManifest {
46334
46416
  return undefined;
46335
46417
  }
46336
46418
  rustTargetFor(node) {
46337
- return this._expandedTargets[node];
46419
+ return this._expandedPlatforms[node];
46338
46420
  }
46339
46421
  manifestFor(target) {
46340
46422
  const targetInfo = getTargetDescriptor(target);
46341
46423
  const name = this.packageFor(target);
46342
46424
  if (!name) {
46343
- throw new Error(`Rust target ${target} not found in "neon.targets" table.`);
46425
+ throw new Error(`Rust target ${target} not found in "neon.platforms" table.`);
46344
46426
  }
46345
46427
  const json = {
46346
46428
  name,
46347
46429
  description: `Prebuilt binary package for \`${this.name}\` on \`${targetInfo.node}\`.`,
46348
46430
  version: this.version,
46349
- os: [targetInfo.platform],
46431
+ os: [targetInfo.os],
46350
46432
  cpu: [targetInfo.arch],
46351
46433
  main: "index.node",
46352
46434
  files: ["index.node"],
@@ -46354,7 +46436,7 @@ class SourceManifest extends AbstractManifest {
46354
46436
  type: "binary",
46355
46437
  rust: target,
46356
46438
  node: targetInfo.node,
46357
- platform: targetInfo.platform,
46439
+ os: targetInfo.os,
46358
46440
  arch: targetInfo.arch,
46359
46441
  abi: targetInfo.abi
46360
46442
  }
@@ -46369,25 +46451,25 @@ class SourceManifest extends AbstractManifest {
46369
46451
  }
46370
46452
  return new BinaryManifest(json);
46371
46453
  }
46372
- async addLoaderTargets(targets) {
46454
+ async updateLoader(platforms) {
46373
46455
  const cfg = this.cfg();
46374
46456
  if (!cfg.load) {
46375
46457
  return;
46376
46458
  }
46377
46459
  const loader = await promises_namespaceObject.readFile(cfg.load, 'utf8');
46378
- function isTargetTable(p) {
46460
+ function isPlatformTable(p) {
46379
46461
  return p.value.properties.every(p => {
46380
46462
  return p.type === 'Property' &&
46381
46463
  p.key.type === 'Literal' &&
46382
- isNodeTarget(p.key.value);
46464
+ isNodePlatform(p.key.value);
46383
46465
  });
46384
46466
  }
46385
46467
  const result = jscodeshift_default()(loader)
46386
46468
  .find((jscodeshift_default()).ObjectExpression)
46387
- .filter(isTargetTable)
46469
+ .filter(isPlatformTable)
46388
46470
  .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}`)])));
46471
+ const newProps = platforms.map(platform => {
46472
+ 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
46473
  });
46392
46474
  return jscodeshift_default().objectExpression([...p.value.properties, ...newProps]);
46393
46475
  })
@@ -46396,20 +46478,20 @@ class SourceManifest extends AbstractManifest {
46396
46478
  }
46397
46479
  async addTargetPair(pair) {
46398
46480
  const { node, rust } = pair;
46399
- if (this._expandedTargets[node] === rust) {
46481
+ if (this._expandedPlatforms[node] === rust) {
46400
46482
  return null;
46401
46483
  }
46402
- this._expandedTargets[node] = rust;
46484
+ this._expandedPlatforms[node] = rust;
46403
46485
  await this.save();
46404
- await this.addLoaderTargets([node]);
46486
+ await this.updateLoader([node]);
46405
46487
  return pair;
46406
46488
  }
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(', ')}`);
46489
+ async addNodePlatform(platform) {
46490
+ const targets = node2Rust(platform);
46491
+ if (targets.length > 1) {
46492
+ throw new Error(`multiple Rust targets found for Node platform ${platform}; please specify one of ${targets.join(', ')}`);
46411
46493
  }
46412
- return await this.addTargetPair({ node: target, rust: rt[0] });
46494
+ return await this.addTargetPair({ node: platform, rust: targets[0] });
46413
46495
  }
46414
46496
  async addRustTarget(target) {
46415
46497
  return await this.addTargetPair({ node: rust2Node(target), rust: target });
@@ -46419,39 +46501,39 @@ class SourceManifest extends AbstractManifest {
46419
46501
  for (const [key, value] of Object.entries(family)) {
46420
46502
  const node = key;
46421
46503
  const rust = value;
46422
- if (this._expandedTargets[node] === rust) {
46504
+ if (this._expandedPlatforms[node] === rust) {
46423
46505
  continue;
46424
46506
  }
46425
46507
  newTargets.push({ node, rust });
46426
46508
  }
46427
46509
  return newTargets;
46428
46510
  }
46429
- async addTargets(family, opts = {}) {
46511
+ async addPlatforms(family, opts = {}) {
46430
46512
  let newTargets = this.filterNewTargets(family);
46431
46513
  if (!newTargets.length) {
46432
46514
  return [];
46433
46515
  }
46434
46516
  for (const { node, rust } of newTargets) {
46435
- if (opts.targetsSrc) {
46436
- opts.targetsSrc[node] = rust;
46517
+ if (opts.platformsSrc) {
46518
+ opts.platformsSrc[node] = rust;
46437
46519
  }
46438
- this._expandedTargets[node] = rust;
46520
+ this._expandedPlatforms[node] = rust;
46439
46521
  }
46440
46522
  await this.save();
46441
- await this.addLoaderTargets(newTargets.map(({ node }) => node));
46523
+ await this.updateLoader(newTargets.map(({ node }) => node));
46442
46524
  return newTargets;
46443
46525
  }
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));
46526
+ async addPlatformPreset(preset) {
46527
+ const platformsSrc = this.cfg().platforms;
46528
+ if (typeof platformsSrc === 'string') {
46529
+ this.cfg().platforms = [platformsSrc, preset];
46530
+ return this.addPlatforms(expandPlatformFamily(preset));
46449
46531
  }
46450
- if (Array.isArray(targetsSrc)) {
46451
- targetsSrc.push(preset);
46452
- return this.addTargets(expandTargetFamily(preset));
46532
+ if (Array.isArray(platformsSrc)) {
46533
+ platformsSrc.push(preset);
46534
+ return this.addPlatforms(expandPlatformFamily(preset));
46453
46535
  }
46454
- return this.addTargets(expandTargetFamily(preset), { targetsSrc });
46536
+ return this.addPlatforms(expandPlatformFamily(preset), { platformsSrc });
46455
46537
  }
46456
46538
  async updateTargets(log, bundle) {
46457
46539
  if (!this._json.optionalDependencies) {
@@ -46489,7 +46571,7 @@ function upgradeSourceV1(object) {
46489
46571
  throw new TypeError(`expected namespaced npm package name, found ${value}`);
46490
46572
  }
46491
46573
  const pkg = value.split('/')[1];
46492
- assertIsNodeTarget(pkg);
46574
+ assertIsNodePlatform(pkg);
46493
46575
  assertIsRustTarget(key);
46494
46576
  return [pkg, key];
46495
46577
  }
@@ -46504,7 +46586,7 @@ function upgradeSourceV1(object) {
46504
46586
  return {
46505
46587
  type: 'source',
46506
46588
  org: [...orgs][0],
46507
- targets: Object.fromEntries(entries)
46589
+ platforms: Object.fromEntries(entries)
46508
46590
  };
46509
46591
  }
46510
46592
  function upgradeBinaryV1(json) {
@@ -46513,11 +46595,22 @@ function upgradeBinaryV1(json) {
46513
46595
  type: 'binary',
46514
46596
  rust: json.binary.rust,
46515
46597
  node: json.binary.node,
46516
- platform: json.binary.platform,
46598
+ os: json.binary.platform,
46517
46599
  arch: json.binary.arch,
46518
46600
  abi: json.binary.abi
46519
46601
  };
46520
46602
  }
46603
+ function upgradeBinaryV2(json) {
46604
+ assertIsBinaryV2(json);
46605
+ return {
46606
+ type: 'binary',
46607
+ rust: json.rust,
46608
+ node: json.node,
46609
+ os: json.platform,
46610
+ arch: json.arch,
46611
+ abi: json.abi
46612
+ };
46613
+ }
46521
46614
 
46522
46615
  ;// CONCATENATED MODULE: ./src/commands/tarball.ts
46523
46616
 
@@ -46598,12 +46691,14 @@ class Tarball {
46598
46691
  const version = sourceManifest.version;
46599
46692
  const binaryManifest = await BinaryManifest.load(this._inDir);
46600
46693
  const cfg = binaryManifest.cfg();
46694
+ // Since the source manifest is the source of truth, any time there's a
46695
+ // metadata mismatch between source and binary manifests, binary is wrong.
46601
46696
  if (this._target && (cfg.rust !== this._target)) {
46602
46697
  throw new Error(`Specified target ${this._target} does not match target ${cfg.rust} in ${this._inDir}`);
46603
46698
  }
46604
46699
  const targetInfo = getTargetDescriptor(cfg.rust);
46605
46700
  cfg.node = targetInfo.node;
46606
- cfg.platform = targetInfo.platform;
46701
+ cfg.os = targetInfo.os;
46607
46702
  cfg.arch = targetInfo.arch;
46608
46703
  cfg.abi = targetInfo.abi;
46609
46704
  // FIXME: make it possible to disable this
@@ -46646,7 +46741,7 @@ class Tarball {
46646
46741
  ;
46647
46742
  }
46648
46743
 
46649
- ;// CONCATENATED MODULE: ./src/commands/add-target.ts
46744
+ ;// CONCATENATED MODULE: ./src/commands/add-platform.ts
46650
46745
 
46651
46746
 
46652
46747
 
@@ -46655,29 +46750,29 @@ class Tarball {
46655
46750
  function optionArray(option) {
46656
46751
  return option == null ? [] : [option];
46657
46752
  }
46658
- const add_target_OPTIONS = [
46753
+ const add_platform_OPTIONS = [
46659
46754
  { 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 },
46755
+ { name: 'os', type: String, defaultValue: null },
46756
+ { name: 'arch', type: String, defaultValue: null },
46662
46757
  { name: 'abi', type: String, defaultValue: null },
46663
- { name: 'out-dir', alias: 'o', type: String, defaultValue: 'npm' },
46758
+ { name: 'out-dir', alias: 'o', type: String, defaultValue: 'platforms' },
46664
46759
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46665
46760
  ];
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>]'; }
46761
+ class AddPlatform {
46762
+ static summary() { return 'Add a platform or platform preset to a Neon project.'; }
46763
+ static syntax() { return 'neon add-platform [<p> | --os <a> --arch <b> [--abi <c>]] [-o <d>] [-b <f>]'; }
46669
46764
  static options() {
46670
46765
  return [
46671
- { name: '<t>', summary: 'Full target name, in either Node or Rust convention.' },
46766
+ { name: '<p>', summary: 'A Node platform or platform preset.' },
46672
46767
  {
46673
46768
  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)'
46769
+ summary: 'This can be a specific Node platform or one of the Neon platform family presets described below. (Default: current platform)'
46675
46770
  },
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.' },
46771
+ { name: '--os <a>', summary: 'Platform OS name. (Default: current OS)' },
46772
+ { name: '--arch <b>', summary: 'Platform architecture name. (Default: current arch)' },
46773
+ { name: '--abi <c>', summary: 'Platform ABI name. (Default: current ABI)' },
46774
+ { name: '-o, --out-dir <d>', summary: 'Output directory for platform template tree. (Default: ./platforms)' },
46775
+ { name: '-b, --bundle <f>', summary: 'File to generate bundling metadata. (Default: none)' },
46681
46776
  {
46682
46777
  name: '',
46683
46778
  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 +46783,78 @@ class AddTarget {
46688
46783
  static seeAlso() { }
46689
46784
  static extraSection() {
46690
46785
  return {
46691
- title: 'Target Family Presets',
46786
+ title: 'Platform Family Presets',
46692
46787
  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.' }
46788
+ { name: 'linux', summary: 'Common desktop Linux platforms.' },
46789
+ { name: 'macos', summary: 'Common desktop macOS platforms.' },
46790
+ { name: 'windows', summary: 'Common desktop Windows platforms.' },
46791
+ { name: 'mobile', summary: 'Common mobile and tablet platforms.' },
46792
+ { name: 'desktop', summary: 'All common desktop platforms.' },
46793
+ { name: 'common', summary: 'All common platforms.' },
46794
+ { name: 'extended', summary: 'All supported platforms.' }
46700
46795
  ]
46701
46796
  };
46702
46797
  }
46703
- _platform;
46798
+ _os;
46704
46799
  _arch;
46705
46800
  _abi;
46706
- _target;
46801
+ _platform;
46707
46802
  _outDir;
46708
46803
  _bundle;
46709
46804
  _verbose;
46710
46805
  constructor(argv) {
46711
- const options = dist_default()(add_target_OPTIONS, { argv, partial: true });
46712
- this._platform = options.platform || null;
46806
+ const options = dist_default()(add_platform_OPTIONS, { argv, partial: true });
46807
+ this._os = options.os || null;
46713
46808
  this._arch = options.arch || null;
46714
46809
  this._abi = options.abi || null;
46715
- this._outDir = options['out-dir'] || external_node_path_namespaceObject.join(process.cwd(), 'dist');
46810
+ this._outDir = options['out-dir'];
46716
46811
  this._bundle = options.bundle || null;
46717
46812
  this._verbose = !!options.verbose;
46718
- if (options.platform && !options.arch) {
46719
- throw new Error("Option --platform requires option --arch to be specified as well.");
46813
+ if (options.os && !options.arch) {
46814
+ throw new Error("Option --os requires option --arch to be specified as well.");
46720
46815
  }
46721
- if (!options.platform && options.arch) {
46722
- throw new Error("Option --arch requires option --platform to be specified as well.");
46816
+ if (!options.os && options.arch) {
46817
+ throw new Error("Option --arch requires option --os to be specified as well.");
46723
46818
  }
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.");
46819
+ if (options.abi && (!options.os || !options.arch)) {
46820
+ throw new Error("Option --abi requires both options --os and --arch to be specified as well.");
46726
46821
  }
46727
- if (!options.platform && !options.arch && !options.abi) {
46822
+ if (!options.os && !options.arch && !options.abi) {
46728
46823
  if (!options._unknown || options._unknown.length === 0) {
46729
- throw new Error("No arguments found, expected <target> or -p and -a options.");
46824
+ throw new Error("No arguments found, expected platform or --os and --arch options.");
46730
46825
  }
46731
- this._target = options._unknown[0];
46826
+ this._platform = options._unknown[0];
46732
46827
  }
46733
46828
  else {
46734
- this._target = `${options.platform}-${options.arch}`;
46829
+ this._platform = `${options.os}-${options.arch}`;
46735
46830
  if (!!options.abi) {
46736
- this._target = `${this._target}-${options.abi}`;
46831
+ this._platform = `${this._platform}-${options.abi}`;
46737
46832
  }
46738
46833
  }
46739
46834
  }
46740
46835
  log(msg) {
46741
46836
  if (this._verbose) {
46742
- console.error("[neon add-target] " + msg);
46837
+ console.error("[neon add-platform] " + msg);
46743
46838
  }
46744
46839
  }
46745
- async addTarget(sourceManifest) {
46746
- if (!this._target) {
46747
- this.log('adding default system target');
46840
+ async addPlatform(sourceManifest) {
46841
+ if (!this._platform) {
46842
+ this.log('adding default system platform');
46748
46843
  return optionArray(await sourceManifest.addRustTarget(await getCurrentTarget(msg => this.log(msg))));
46749
46844
  }
46750
- else if (isRustTarget(this._target)) {
46751
- this.log(`adding Rust target ${this._target}`);
46752
- return optionArray(await sourceManifest.addRustTarget(this._target));
46845
+ else if (isRustTarget(this._platform)) {
46846
+ this.log(`adding Rust target ${this._platform}`);
46847
+ return optionArray(await sourceManifest.addRustTarget(this._platform));
46753
46848
  }
46754
- else if (isNodeTarget(this._target)) {
46755
- this.log(`adding Node target ${this._target}`);
46756
- return optionArray(await sourceManifest.addNodeTarget(this._target));
46849
+ else if (isNodePlatform(this._platform)) {
46850
+ this.log(`adding Node platform ${this._platform}`);
46851
+ return optionArray(await sourceManifest.addNodePlatform(this._platform));
46757
46852
  }
46758
- else if (isTargetPreset(this._target)) {
46759
- return sourceManifest.addTargetPreset(this._target);
46853
+ else if (isPlatformPreset(this._platform)) {
46854
+ return sourceManifest.addPlatformPreset(this._platform);
46760
46855
  }
46761
46856
  else {
46762
- throw new Error(`unrecognized target ${this._target}`);
46857
+ throw new Error(`unrecognized platform or preset ${this._platform}`);
46763
46858
  }
46764
46859
  }
46765
46860
  async createTemplateTree(sourceManifest, pair) {
@@ -46779,7 +46874,7 @@ class AddTarget {
46779
46874
  this.log(`reading package.json`);
46780
46875
  const sourceManifest = await SourceManifest.load();
46781
46876
  this.log(`manifest: ${sourceManifest.stringify()}`);
46782
- const modified = await this.addTarget(sourceManifest);
46877
+ const modified = await this.addPlatform(sourceManifest);
46783
46878
  if (modified.length) {
46784
46879
  sourceManifest.updateTargets(msg => this.log(msg), this._bundle);
46785
46880
  for (const pair of modified) {
@@ -46789,16 +46884,16 @@ class AddTarget {
46789
46884
  }
46790
46885
  }
46791
46886
 
46792
- ;// CONCATENATED MODULE: ./src/commands/update-targets.ts
46887
+ ;// CONCATENATED MODULE: ./src/commands/update-platforms.ts
46793
46888
 
46794
46889
 
46795
- const update_targets_OPTIONS = [
46890
+ const update_platforms_OPTIONS = [
46796
46891
  { name: 'bundle', alias: 'b', type: String, defaultValue: null },
46797
46892
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46798
46893
  ];
46799
- class UpdateTargets {
46894
+ class UpdatePlatforms {
46800
46895
  static summary() { return 'Update dependencies for all build targets in package.json.'; }
46801
- static syntax() { return 'neon update-targets [-b <file>]'; }
46896
+ static syntax() { return 'neon update-platforms [-b <file>]'; }
46802
46897
  static options() {
46803
46898
  return [
46804
46899
  { name: '-b, --bundle <file>', summary: 'File to generate bundling metadata.' },
@@ -46818,13 +46913,13 @@ class UpdateTargets {
46818
46913
  _bundle;
46819
46914
  _verbose;
46820
46915
  constructor(argv) {
46821
- const options = dist_default()(update_targets_OPTIONS, { argv });
46916
+ const options = dist_default()(update_platforms_OPTIONS, { argv });
46822
46917
  this._bundle = options.bundle || null;
46823
46918
  this._verbose = !!options.verbose;
46824
46919
  }
46825
46920
  log(msg) {
46826
46921
  if (this._verbose) {
46827
- console.error("[neon update-targets] " + msg);
46922
+ console.error("[neon update-platforms] " + msg);
46828
46923
  }
46829
46924
  }
46830
46925
  async run() {
@@ -46846,62 +46941,62 @@ class UpdateTargets {
46846
46941
 
46847
46942
 
46848
46943
  const rust_target_OPTIONS = [
46849
- { name: 'platform', alias: 'p', type: String, defaultValue: null },
46850
- { name: 'arch', alias: 'a', type: String, defaultValue: null },
46944
+ { name: 'os', type: String, defaultValue: null },
46945
+ { name: 'arch', type: String, defaultValue: null },
46851
46946
  { name: 'abi', type: String, defaultValue: null },
46852
46947
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46853
46948
  ];
46854
46949
  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>])'; }
46950
+ static summary() { return 'Display the Rust target triple configured for a platform.'; }
46951
+ static syntax() { return 'neon rust-target <platform> | (--os <os> --arch <arch> [--abi <abi>])'; }
46857
46952
  static options() {
46858
46953
  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.' },
46954
+ { name: '<platform>', summary: 'Full platform name in Node convention.' },
46955
+ { name: '--os <os>', summary: 'Target OS name.' },
46956
+ { name: '--arch <arch>', summary: 'Target architecture name.' },
46862
46957
  { name: '--abi <abi>', summary: 'Target ABI name. (Default: null)' },
46863
46958
  { name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
46864
46959
  ];
46865
46960
  }
46866
46961
  static seeAlso() { }
46867
46962
  static extraSection() { }
46868
- _platform;
46963
+ _os;
46869
46964
  _arch;
46870
46965
  _abi;
46871
- _target;
46966
+ _platform;
46872
46967
  _verbose;
46873
46968
  constructor(argv) {
46874
46969
  const options = dist_default()(rust_target_OPTIONS, { argv, partial: true });
46875
- this._platform = options.platform || null;
46970
+ this._os = options.os || null;
46876
46971
  this._arch = options.arch || null;
46877
46972
  this._abi = options.abi || null;
46878
46973
  this._verbose = !!options.verbose;
46879
- if (options.platform && !options.arch) {
46880
- throw new Error("Option --platform requires option --arch to be specified as well.");
46974
+ if (options.os && !options.arch) {
46975
+ throw new Error("Option --os requires option --arch to be specified as well.");
46881
46976
  }
46882
- if (!options.platform && options.arch) {
46883
- throw new Error("Option --arch requires option --platform to be specified as well.");
46977
+ if (!options.os && options.arch) {
46978
+ throw new Error("Option --arch requires option --os to be specified as well.");
46884
46979
  }
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.");
46980
+ if (options.abi && (!options.os || !options.arch)) {
46981
+ throw new Error("Option --abi requires both options --os and --arch to be specified as well.");
46887
46982
  }
46888
- let target;
46889
- if (!options.platform && !options.arch && !options.abi) {
46983
+ let platform;
46984
+ if (!options.os && !options.arch && !options.abi) {
46890
46985
  if (!options._unknown || options._unknown.length === 0) {
46891
- throw new Error("No arguments found, expected <target> or -p and -a options.");
46986
+ throw new Error("No arguments found, expected platform or --os and --arch options.");
46892
46987
  }
46893
- target = options._unknown[0];
46988
+ platform = options._unknown[0];
46894
46989
  }
46895
46990
  else {
46896
- target = `${options.platform}-${options.arch}`;
46991
+ platform = `${options.os}-${options.arch}`;
46897
46992
  if (!!options.abi) {
46898
- target = `${target}-${options.abi}`;
46993
+ platform = `${platform}-${options.abi}`;
46899
46994
  }
46900
46995
  }
46901
- if (!isNodeTarget(target)) {
46902
- throw new Error(`${target} is not a valid Node target.`);
46996
+ if (!isNodePlatform(platform)) {
46997
+ throw new Error(`${platform} is not a valid Node platform.`);
46903
46998
  }
46904
- this._target = target;
46999
+ this._platform = platform;
46905
47000
  }
46906
47001
  log(msg) {
46907
47002
  if (this._verbose) {
@@ -46912,9 +47007,9 @@ class RustTarget {
46912
47007
  this.log(`reading package.json`);
46913
47008
  const sourceManifest = await SourceManifest.load();
46914
47009
  this.log(`manifest: ${sourceManifest.stringify()}`);
46915
- const rust = sourceManifest.rustTargetFor(this._target);
47010
+ const rust = sourceManifest.rustTargetFor(this._platform);
46916
47011
  if (!rust) {
46917
- throw new Error(`no Rust target found for ${this._target}`);
47012
+ throw new Error(`no Rust target found for ${this._platform}`);
46918
47013
  }
46919
47014
  console.log(rust);
46920
47015
  }
@@ -46928,7 +47023,7 @@ const preset_OPTIONS = [
46928
47023
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
46929
47024
  ];
46930
47025
  class Preset {
46931
- static summary() { return 'Display the target JSON data for a given preset.'; }
47026
+ static summary() { return 'Display the JSON target data for a platform preset.'; }
46932
47027
  static syntax() { return 'neon preset [-p] [-v] <preset>'; }
46933
47028
  static options() {
46934
47029
  return [
@@ -46952,7 +47047,7 @@ class Preset {
46952
47047
  if (options._unknown.length > 1) {
46953
47048
  throw new Error(`Unexpected argument ${options._unknown[1]}`);
46954
47049
  }
46955
- assertIsTargetPreset(options._unknown[0]);
47050
+ assertIsPlatformPreset(options._unknown[0]);
46956
47051
  this._preset = options._unknown[0];
46957
47052
  }
46958
47053
  log(msg) {
@@ -46961,7 +47056,7 @@ class Preset {
46961
47056
  }
46962
47057
  }
46963
47058
  async run() {
46964
- const map = expandTargetPreset(this._preset);
47059
+ const map = expandPlatformPreset(this._preset);
46965
47060
  const output = this._pretty
46966
47061
  ? JSON.stringify(map, null, 2)
46967
47062
  : JSON.stringify(map);
@@ -47018,8 +47113,10 @@ var CommandName;
47018
47113
  CommandName["PackBuild"] = "pack-build";
47019
47114
  CommandName["Tarball"] = "tarball";
47020
47115
  CommandName["AddTarget"] = "add-target";
47116
+ CommandName["AddPlatform"] = "add-platform";
47021
47117
  CommandName["InstallBuilds"] = "install-builds";
47022
47118
  CommandName["UpdateTargets"] = "update-targets";
47119
+ CommandName["UpdatePlatforms"] = "update-platforms";
47023
47120
  CommandName["RustTarget"] = "rust-target";
47024
47121
  CommandName["Preset"] = "preset";
47025
47122
  })(CommandName || (CommandName = {}));
@@ -47040,9 +47137,11 @@ const COMMANDS = {
47040
47137
  [CommandName.Bump]: Bump,
47041
47138
  [CommandName.PackBuild]: Tarball,
47042
47139
  [CommandName.Tarball]: Tarball,
47043
- [CommandName.AddTarget]: AddTarget,
47044
- [CommandName.InstallBuilds]: UpdateTargets,
47045
- [CommandName.UpdateTargets]: UpdateTargets,
47140
+ [CommandName.AddTarget]: AddPlatform,
47141
+ [CommandName.AddPlatform]: AddPlatform,
47142
+ [CommandName.InstallBuilds]: UpdatePlatforms,
47143
+ [CommandName.UpdateTargets]: UpdatePlatforms,
47144
+ [CommandName.UpdatePlatforms]: UpdatePlatforms,
47046
47145
  [CommandName.RustTarget]: RustTarget,
47047
47146
  [CommandName.Preset]: Preset
47048
47147
  };
@@ -47055,8 +47154,8 @@ function summaries() {
47055
47154
  { name: CommandName.Dist, summary: Dist.summary() },
47056
47155
  { name: CommandName.Bump, summary: Bump.summary() },
47057
47156
  { name: CommandName.Tarball, summary: Tarball.summary() },
47058
- { name: CommandName.AddTarget, summary: AddTarget.summary() },
47059
- { name: CommandName.UpdateTargets, summary: UpdateTargets.summary() },
47157
+ { name: CommandName.AddPlatform, summary: AddPlatform.summary() },
47158
+ { name: CommandName.UpdatePlatforms, summary: UpdatePlatforms.summary() },
47060
47159
  { name: CommandName.RustTarget, summary: RustTarget.summary() },
47061
47160
  { name: CommandName.Preset, summary: Preset.summary() }
47062
47161
  ];
@@ -47072,7 +47171,7 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
47072
47171
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(5046);
47073
47172
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(command_line_commands__WEBPACK_IMPORTED_MODULE_0__);
47074
47173
  /* 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);
47174
+ /* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(5834);
47076
47175
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(2033);
47077
47176
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(node_module__WEBPACK_IMPORTED_MODULE_3__);
47078
47177
 
@@ -50096,7 +50195,7 @@ const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});
50096
50195
  /* harmony default export */ const chalk_source = (chalk);
50097
50196
 
50098
50197
  // EXTERNAL MODULE: ./src/command.ts + 40 modules
50099
- var command = __nccwpck_require__(1430);
50198
+ var command = __nccwpck_require__(5834);
50100
50199
  ;// CONCATENATED MODULE: ./src/print.ts
50101
50200
 
50102
50201
 
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.178",
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.178",
31
+ "@cargo-messages/darwin-arm64": "0.0.178",
32
+ "@cargo-messages/darwin-x64": "0.0.178",
33
+ "@cargo-messages/linux-arm-gnueabihf": "0.0.178",
34
+ "@cargo-messages/linux-x64-gnu": "0.0.178",
35
+ "@cargo-messages/win32-arm64-msvc": "0.0.178",
36
+ "@cargo-messages/win32-x64-msvc": "0.0.178"
37
37
  }
38
38
  }