@neon-rs/cli 0.0.181 → 0.0.183

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 +357 -15
  2. package/package.json +8 -8
package/index.js CHANGED
@@ -7,6 +7,261 @@ import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
7
7
 
8
8
  var __webpack_unused_export__;
9
9
 
10
+ __webpack_unused_export__ = ({ value: true });
11
+ __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.ob = void 0;
12
+ function currentPlatform() {
13
+ let os = null;
14
+ switch (process.platform) {
15
+ case 'android':
16
+ switch (process.arch) {
17
+ case 'arm':
18
+ return 'android-arm-eabi';
19
+ case 'arm64':
20
+ return 'android-arm64';
21
+ }
22
+ os = 'Android';
23
+ break;
24
+ case 'win32':
25
+ switch (process.arch) {
26
+ case 'x64':
27
+ return 'win32-x64-msvc';
28
+ case 'arm64':
29
+ return 'win32-arm64-msvc';
30
+ case 'ia32':
31
+ return 'win32-ia32-msvc';
32
+ }
33
+ os = 'Windows';
34
+ break;
35
+ case 'darwin':
36
+ switch (process.arch) {
37
+ case 'x64':
38
+ return 'darwin-x64';
39
+ case 'arm64':
40
+ return 'darwin-arm64';
41
+ }
42
+ os = 'macOS';
43
+ break;
44
+ case 'linux':
45
+ switch (process.arch) {
46
+ case 'x64':
47
+ case 'arm64':
48
+ return isGlibc()
49
+ ? `linux-${process.arch}-gnu`
50
+ : `linux-${process.arch}-musl`;
51
+ case 'arm':
52
+ return 'linux-arm-gnueabihf';
53
+ }
54
+ os = 'Linux';
55
+ break;
56
+ case 'freebsd':
57
+ if (process.arch === 'x64') {
58
+ return 'freebsd-x64';
59
+ }
60
+ os = 'FreeBSD';
61
+ break;
62
+ }
63
+ if (os) {
64
+ throw new Error(`Neon: unsupported ${os} architecture: ${process.arch}`);
65
+ }
66
+ throw new Error(`Neon: unsupported system: ${process.platform}`);
67
+ }
68
+ exports.ob = currentPlatform;
69
+ // DEPRECATE(0.1)
70
+ function currentTarget() {
71
+ return currentPlatform();
72
+ }
73
+ __webpack_unused_export__ = currentTarget;
74
+ function isGlibc() {
75
+ // Cast to unknown to work around a bug in the type definition:
76
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/40140
77
+ const report = process.report?.getReport();
78
+ if ((typeof report !== 'object') || !report || (!('header' in report))) {
79
+ return false;
80
+ }
81
+ const header = report.header;
82
+ return (typeof header === 'object') &&
83
+ !!header &&
84
+ ('glibcVersionRuntime' in header);
85
+ }
86
+ // export function debug(...components: string[]) {
87
+ // if (components.length === 0 || !components[components.length - 1].endsWith(".node")) {
88
+ // components.push("index.node");
89
+ // }
90
+ // const pathSpec = path.join(...components);
91
+ // return fs.existsSync(pathSpec) ? require(pathSpec) : null;
92
+ // }
93
+ function* interleave(a1, a2) {
94
+ const length = Math.max(a1.length, a2.length);
95
+ for (let i = 0; i < length; i++) {
96
+ if (i < a1.length) {
97
+ yield a1[i];
98
+ }
99
+ if (i < a2.length) {
100
+ yield a2[i];
101
+ }
102
+ }
103
+ }
104
+ function bin(scope, ...rest) {
105
+ return [...interleave(scope, rest)].join("") + "/" + currentPlatform();
106
+ }
107
+ __webpack_unused_export__ = bin;
108
+ // DEPRECATE(0.1)
109
+ function lazyV1(loaders, exports) {
110
+ return lazyV2({
111
+ targets: loaders,
112
+ exports
113
+ });
114
+ }
115
+ // DEPRECATE(0.1)
116
+ function lazyV2(options) {
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;
125
+ let loaded = null;
126
+ function load() {
127
+ if (loaded) {
128
+ return loaded;
129
+ }
130
+ const platform = currentPlatform();
131
+ if (!loaders.hasOwnProperty(platform)) {
132
+ throw new Error(`no precompiled module found for ${platform}`);
133
+ }
134
+ if (options.debug) {
135
+ try {
136
+ loaded = options.debug();
137
+ }
138
+ catch (_e) {
139
+ loaded = null;
140
+ }
141
+ }
142
+ if (!loaded) {
143
+ loaded = loaders[platform]();
144
+ }
145
+ return loaded;
146
+ }
147
+ let module = {};
148
+ for (const key of options.exports) {
149
+ Object.defineProperty(module, key, { get() { return load()[key]; } });
150
+ }
151
+ return module;
152
+ }
153
+ function lazy(optionsOrLoaders, exports) {
154
+ return (!exports && !('targets' in optionsOrLoaders))
155
+ ? lazyV3(optionsOrLoaders)
156
+ : !exports
157
+ ? lazyV2(optionsOrLoaders)
158
+ : lazyV1(optionsOrLoaders, exports);
159
+ }
160
+ __webpack_unused_export__ = lazy;
161
+ function __UNSTABLE_loader(loaders) {
162
+ const platform = currentPlatform();
163
+ if (!loaders.hasOwnProperty(platform)) {
164
+ throw new Error(`no precompiled module found for ${platform}`);
165
+ }
166
+ const loader = loaders[platform];
167
+ let loaded = null;
168
+ return () => {
169
+ if (loaded) {
170
+ return loaded;
171
+ }
172
+ loaded = loader();
173
+ return loaded;
174
+ };
175
+ }
176
+ __webpack_unused_export__ = __UNSTABLE_loader;
177
+ // DEPRECATE(0.1)
178
+ function isDeprecatedProxyOptions(options) {
179
+ return 'targets' in options;
180
+ }
181
+ function isProxyOptions(options) {
182
+ return 'platforms' in options;
183
+ }
184
+ function proxy(options) {
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];
196
+ let loaded = null;
197
+ function load() {
198
+ if (!loaded) {
199
+ if (options.debug) {
200
+ try {
201
+ loaded = options.debug();
202
+ }
203
+ catch (_e) {
204
+ loaded = null;
205
+ }
206
+ }
207
+ if (!loaded) {
208
+ loaded = loader();
209
+ }
210
+ }
211
+ return loaded;
212
+ }
213
+ const handler = {
214
+ has(_target, key) {
215
+ return Reflect.has(load(), key);
216
+ },
217
+ get(_target, key) {
218
+ return Reflect.get(load(), key);
219
+ },
220
+ ownKeys(_target) {
221
+ return Reflect.ownKeys(load());
222
+ },
223
+ defineProperty(_target, _key, _descriptor) {
224
+ throw new Error('attempt to modify read-only Neon module proxy');
225
+ },
226
+ deleteProperty(_target, _key) {
227
+ throw new Error('attempt to modify read-only Neon module proxy');
228
+ },
229
+ set(_target, _key, _val) {
230
+ throw new Error('attempt to modify read-only Neon module proxy');
231
+ },
232
+ setPrototypeOf(_target, _proto) {
233
+ throw new Error('attempt to modify read-only Neon module proxy');
234
+ },
235
+ getPrototypeOf(_target) {
236
+ return Object.getPrototypeOf(load());
237
+ },
238
+ isExtensible(_target) {
239
+ return Reflect.isExtensible(load());
240
+ },
241
+ preventExtensions(_target) {
242
+ return Reflect.preventExtensions(load());
243
+ },
244
+ getOwnPropertyDescriptor(_target, key) {
245
+ return Reflect.getOwnPropertyDescriptor(load(), key);
246
+ }
247
+ };
248
+ return new Proxy({}, handler);
249
+ }
250
+ __webpack_unused_export__ = proxy;
251
+ // DEPRECATE(0.1)
252
+ function __UNSTABLE_proxy(options) {
253
+ return proxy(options);
254
+ }
255
+ __webpack_unused_export__ = __UNSTABLE_proxy;
256
+
257
+
258
+ /***/ }),
259
+
260
+ /***/ 8372:
261
+ /***/ ((__unused_webpack_module, exports) => {
262
+
263
+ var __webpack_unused_export__;
264
+
10
265
  __webpack_unused_export__ = ({ value: true });
11
266
  __webpack_unused_export__ = exports.sj = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
12
267
  function currentPlatform() {
@@ -44194,7 +44449,7 @@ function wrappy (fn, cb) {
44194
44449
 
44195
44450
  /***/ }),
44196
44451
 
44197
- /***/ 5834:
44452
+ /***/ 5291:
44198
44453
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
44199
44454
 
44200
44455
 
@@ -46416,6 +46671,9 @@ class SourceManifest extends AbstractManifest {
46416
46671
  }
46417
46672
  return undefined;
46418
46673
  }
46674
+ allPlatforms() {
46675
+ return this._expandedPlatforms;
46676
+ }
46419
46677
  rustTargetFor(node) {
46420
46678
  return this._expandedPlatforms[node];
46421
46679
  }
@@ -46937,6 +47195,89 @@ class UpdatePlatforms {
46937
47195
  }
46938
47196
  }
46939
47197
 
47198
+ ;// CONCATENATED MODULE: ./src/commands/list-platforms.ts
47199
+
47200
+
47201
+ const list_platforms_OPTIONS = [
47202
+ { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
47203
+ ];
47204
+ class ListPlatforms {
47205
+ static summary() { return 'Display the JSON target data for this project\'s platforms.'; }
47206
+ static syntax() { return 'neon list-platforms [-v]'; }
47207
+ static options() {
47208
+ return [
47209
+ { name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
47210
+ ];
47211
+ }
47212
+ static seeAlso() { }
47213
+ static extraSection() { }
47214
+ _verbose;
47215
+ constructor(argv) {
47216
+ const options = dist_default()(list_platforms_OPTIONS, { argv });
47217
+ this._verbose = !!options.verbose;
47218
+ }
47219
+ log(msg) {
47220
+ if (this._verbose) {
47221
+ console.error("[neon list-platforms] " + msg);
47222
+ }
47223
+ }
47224
+ async run() {
47225
+ this.log(`reading package.json`);
47226
+ const sourceManifest = await SourceManifest.load();
47227
+ this.log(`manifest: ${sourceManifest.stringify()}`);
47228
+ const platforms = sourceManifest.allPlatforms();
47229
+ console.log(JSON.stringify(platforms, null, 2));
47230
+ }
47231
+ }
47232
+
47233
+ // EXTERNAL MODULE: ./node_modules/@neon-rs/load/dist/index.js
47234
+ var load_dist = __nccwpck_require__(8938);
47235
+ ;// CONCATENATED MODULE: ./src/commands/current-platform.ts
47236
+
47237
+
47238
+ const current_platform_OPTIONS = [
47239
+ { name: 'json', type: Boolean, defaultValue: false },
47240
+ { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
47241
+ ];
47242
+ class CurrentPlatform {
47243
+ static summary() { return 'Display the current device\'s platform info.'; }
47244
+ static syntax() { return 'neon current-platform [--json] [-v]'; }
47245
+ static options() {
47246
+ return [
47247
+ { name: '--json', summary: 'Display platform info in JSON format. (Default: false)' },
47248
+ { name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
47249
+ ];
47250
+ }
47251
+ static seeAlso() { }
47252
+ static extraSection() { }
47253
+ _json;
47254
+ _verbose;
47255
+ constructor(argv) {
47256
+ const options = dist_default()(current_platform_OPTIONS, { argv });
47257
+ this._json = options.json || false;
47258
+ this._verbose = !!options.verbose;
47259
+ }
47260
+ log(msg) {
47261
+ if (this._verbose) {
47262
+ console.error("[neon current-platform] " + msg);
47263
+ }
47264
+ }
47265
+ async run() {
47266
+ if (this._json) {
47267
+ const [os, arch, abi] = (0,load_dist/* currentPlatform */.ob)().split('-');
47268
+ const json = {
47269
+ os,
47270
+ arch,
47271
+ abi: abi || null
47272
+ };
47273
+ console.log(JSON.stringify(json, null, 2));
47274
+ }
47275
+ else {
47276
+ console.log((0,load_dist/* currentPlatform */.ob)());
47277
+ }
47278
+ }
47279
+ }
47280
+
46940
47281
  ;// CONCATENATED MODULE: ./src/commands/rust-target.ts
46941
47282
 
46942
47283
 
@@ -47020,27 +47361,24 @@ class RustTarget {
47020
47361
 
47021
47362
 
47022
47363
  const preset_OPTIONS = [
47023
- { name: 'pretty', alias: 'p', type: Boolean, defaultValue: false },
47364
+ { name: 'pretty', alias: 'p', type: Boolean, defaultValue: true },
47024
47365
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
47025
47366
  ];
47026
47367
  class Preset {
47027
47368
  static summary() { return 'Display the JSON target data for a platform preset.'; }
47028
- static syntax() { return 'neon preset [-p] [-v] <preset>'; }
47369
+ static syntax() { return 'neon preset [-v] <preset>'; }
47029
47370
  static options() {
47030
47371
  return [
47031
47372
  { name: '<preset>', summary: 'The target family preset to look up.' },
47032
- { name: '-p, --pretty', summary: 'Pretty-print the JSON output. (Default: false)' },
47033
47373
  { name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
47034
47374
  ];
47035
47375
  }
47036
47376
  static seeAlso() { }
47037
47377
  static extraSection() { }
47038
- _pretty;
47039
47378
  _verbose;
47040
47379
  _preset;
47041
47380
  constructor(argv) {
47042
47381
  const options = dist_default()(preset_OPTIONS, { argv, partial: true });
47043
- this._pretty = options.pretty || false;
47044
47382
  this._verbose = !!options.verbose;
47045
47383
  if (!options._unknown || options._unknown.length === 0) {
47046
47384
  throw new Error("Missing argument, expected <preset>");
@@ -47058,10 +47396,7 @@ class Preset {
47058
47396
  }
47059
47397
  async run() {
47060
47398
  const map = expandPlatformPreset(this._preset);
47061
- const output = this._pretty
47062
- ? JSON.stringify(map, null, 2)
47063
- : JSON.stringify(map);
47064
- console.log(output);
47399
+ console.log(JSON.stringify(map, null, 2));
47065
47400
  }
47066
47401
  }
47067
47402
 
@@ -47106,6 +47441,8 @@ class Help {
47106
47441
 
47107
47442
 
47108
47443
 
47444
+
47445
+
47109
47446
  var CommandName;
47110
47447
  (function (CommandName) {
47111
47448
  CommandName["Help"] = "help";
@@ -47118,6 +47455,8 @@ var CommandName;
47118
47455
  CommandName["InstallBuilds"] = "install-builds";
47119
47456
  CommandName["UpdateTargets"] = "update-targets";
47120
47457
  CommandName["UpdatePlatforms"] = "update-platforms";
47458
+ CommandName["ListPlatforms"] = "list-platforms";
47459
+ CommandName["CurrentPlatform"] = "current-platform";
47121
47460
  CommandName["RustTarget"] = "rust-target";
47122
47461
  CommandName["Preset"] = "preset";
47123
47462
  })(CommandName || (CommandName = {}));
@@ -47143,6 +47482,8 @@ const COMMANDS = {
47143
47482
  [CommandName.InstallBuilds]: UpdatePlatforms,
47144
47483
  [CommandName.UpdateTargets]: UpdatePlatforms,
47145
47484
  [CommandName.UpdatePlatforms]: UpdatePlatforms,
47485
+ [CommandName.ListPlatforms]: ListPlatforms,
47486
+ [CommandName.CurrentPlatform]: CurrentPlatform,
47146
47487
  [CommandName.RustTarget]: RustTarget,
47147
47488
  [CommandName.Preset]: Preset
47148
47489
  };
@@ -47156,7 +47497,8 @@ function summaries() {
47156
47497
  { name: CommandName.Bump, summary: Bump.summary() },
47157
47498
  { name: CommandName.AddPlatform, summary: AddPlatform.summary() },
47158
47499
  { name: CommandName.UpdatePlatforms, summary: UpdatePlatforms.summary() },
47159
- { name: CommandName.RustTarget, summary: RustTarget.summary() },
47500
+ { name: CommandName.ListPlatforms, summary: ListPlatforms.summary() },
47501
+ { name: CommandName.CurrentPlatform, summary: CurrentPlatform.summary() },
47160
47502
  { name: CommandName.Preset, summary: Preset.summary() }
47161
47503
  ];
47162
47504
  }
@@ -47171,7 +47513,7 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
47171
47513
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(5046);
47172
47514
  /* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(command_line_commands__WEBPACK_IMPORTED_MODULE_0__);
47173
47515
  /* harmony import */ var _print_js__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(9050);
47174
- /* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(5834);
47516
+ /* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(5291);
47175
47517
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(2033);
47176
47518
  /* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(node_module__WEBPACK_IMPORTED_MODULE_3__);
47177
47519
 
@@ -50194,8 +50536,8 @@ const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});
50194
50536
 
50195
50537
  /* harmony default export */ const chalk_source = (chalk);
50196
50538
 
50197
- // EXTERNAL MODULE: ./src/command.ts + 40 modules
50198
- var command = __nccwpck_require__(5834);
50539
+ // EXTERNAL MODULE: ./src/command.ts + 42 modules
50540
+ var command = __nccwpck_require__(5291);
50199
50541
  ;// CONCATENATED MODULE: ./src/print.ts
50200
50542
 
50201
50543
 
@@ -65068,7 +65410,7 @@ module.exports = {
65068
65410
  /***/ 6459:
65069
65411
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
65070
65412
 
65071
- module.exports = (__nccwpck_require__(8938)/* .proxy */ .sj)({
65413
+ module.exports = (__nccwpck_require__(8372)/* .proxy */ .sj)({
65072
65414
  'darwin-x64': () => __nccwpck_require__(2990),
65073
65415
  'win32-x64-msvc': () => __nccwpck_require__(1324),
65074
65416
  'win32-arm64-msvc': () => __nccwpck_require__(7894),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/cli",
3
- "version": "0.0.181",
3
+ "version": "0.0.183",
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.181",
31
- "@cargo-messages/darwin-arm64": "0.0.181",
32
- "@cargo-messages/darwin-x64": "0.0.181",
33
- "@cargo-messages/linux-arm-gnueabihf": "0.0.181",
34
- "@cargo-messages/linux-x64-gnu": "0.0.181",
35
- "@cargo-messages/win32-arm64-msvc": "0.0.181",
36
- "@cargo-messages/win32-x64-msvc": "0.0.181"
30
+ "@cargo-messages/android-arm-eabi": "0.0.183",
31
+ "@cargo-messages/darwin-arm64": "0.0.183",
32
+ "@cargo-messages/darwin-x64": "0.0.183",
33
+ "@cargo-messages/linux-arm-gnueabihf": "0.0.183",
34
+ "@cargo-messages/linux-x64-gnu": "0.0.183",
35
+ "@cargo-messages/win32-arm64-msvc": "0.0.183",
36
+ "@cargo-messages/win32-x64-msvc": "0.0.183"
37
37
  }
38
38
  }