@neon-rs/cli 0.0.151 → 0.0.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +33 -11
  2. package/package.json +8 -8
package/index.js CHANGED
@@ -10244,6 +10244,8 @@ __nccwpck_require__.d(__webpack_exports__, {
10244
10244
 
10245
10245
  // UNUSED EXPORTS: isCommandName
10246
10246
 
10247
+ ;// CONCATENATED MODULE: external "node:fs"
10248
+ const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
10247
10249
  ;// CONCATENATED MODULE: external "node:fs/promises"
10248
10250
  const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
10249
10251
  // EXTERNAL MODULE: ./node_modules/command-line-args/dist/index.js
@@ -10258,6 +10260,7 @@ var lib = __nccwpck_require__(9048);
10258
10260
 
10259
10261
 
10260
10262
 
10263
+
10261
10264
  // FIXME: add options to infer crate name from manifests
10262
10265
  // --package <path/to/package.json>
10263
10266
  // --crate <path/to/Cargo.toml>
@@ -10270,6 +10273,9 @@ const OPTIONS = [
10270
10273
  { name: 'out', alias: 'o', type: String, defaultValue: 'index.node' },
10271
10274
  { name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
10272
10275
  ];
10276
+ function createInputStream(file) {
10277
+ return file ? (0,external_node_fs_namespaceObject.createReadStream)(file) : process.stdin;
10278
+ }
10273
10279
  class Dist {
10274
10280
  static summary() { return 'Generate a .node file from a build.'; }
10275
10281
  static syntax() { return 'neon dist [-n <name>] [-f <dylib>|[-l <log>] [-m <path>]] [-o <dist>]'; }
@@ -10312,25 +10318,43 @@ class Dist {
10312
10318
  this._out = options.out;
10313
10319
  this._verbose = !!options.verbose;
10314
10320
  }
10315
- findArtifact() {
10316
- const messages = new lib.CargoMessages({
10321
+ async findArtifact() {
10322
+ const reader = new lib.CargoReader(createInputStream(this._log), {
10317
10323
  mount: this._mount || undefined,
10318
10324
  manifestPath: this._manifestPath || undefined,
10319
- file: this._log || undefined,
10320
10325
  verbose: this._verbose
10321
10326
  });
10322
- const artifact = messages.findArtifact(this._crateName);
10323
- if (!artifact) {
10324
- throw new Error(`No artifacts were generated for crate ${this._crateName}`);
10327
+ let file = null;
10328
+ for await (const msg of reader) {
10329
+ if (msg.isCompilerArtifact() && msg.crateName() === this._crateName) {
10330
+ file = msg.findFileByCrateType('cdylib');
10331
+ if (!file) {
10332
+ throw new Error(`No artifacts were generated for crate ${this._crateName}`);
10333
+ }
10334
+ }
10325
10335
  }
10326
- const file = artifact.findFileByCrateType('cdylib');
10327
10336
  if (!file) {
10328
- throw new Error(`No cdylib artifact found for crate ${this._crateName}`);
10337
+ throw new Error(`No artifacts were generated for crate ${this._crateName}`);
10329
10338
  }
10330
10339
  return file;
10340
+ // const messages: CargoMessages = new CargoMessages({
10341
+ // mount: this._mount || undefined,
10342
+ // manifestPath: this._manifestPath || undefined,
10343
+ // file: this._log || undefined,
10344
+ // verbose: this._verbose
10345
+ // });
10346
+ // const artifact = messages.findArtifact(this._crateName);
10347
+ // if (!artifact) {
10348
+ // throw new Error(`No artifacts were generated for crate ${this._crateName}`);
10349
+ // }
10350
+ // const file = artifact.findFileByCrateType('cdylib');
10351
+ // if (!file) {
10352
+ // throw new Error(`No cdylib artifact found for crate ${this._crateName}`);
10353
+ // }
10354
+ // return file;
10331
10355
  }
10332
10356
  async run() {
10333
- const file = this._file || this.findArtifact();
10357
+ const file = this._file || (await this.findArtifact());
10334
10358
  // FIXME: needs all the logic of cargo-cp-artifact (timestamp check, M1 workaround, async, errors)
10335
10359
  await (0,promises_namespaceObject.copyFile)(file, this._out);
10336
10360
  }
@@ -11177,8 +11201,6 @@ const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
11177
11201
  });
11178
11202
  };
11179
11203
 
11180
- ;// CONCATENATED MODULE: external "node:fs"
11181
- const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
11182
11204
  ;// CONCATENATED MODULE: ./node_modules/is-stream/index.js
11183
11205
  function isStream(stream) {
11184
11206
  return stream !== null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/cli",
3
- "version": "0.0.151",
3
+ "version": "0.0.152",
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.151",
31
- "@cargo-messages/darwin-arm64": "0.0.151",
32
- "@cargo-messages/darwin-x64": "0.0.151",
33
- "@cargo-messages/linux-arm-gnueabihf": "0.0.151",
34
- "@cargo-messages/linux-x64-gnu": "0.0.151",
35
- "@cargo-messages/win32-arm64-msvc": "0.0.151",
36
- "@cargo-messages/win32-x64-msvc": "0.0.151"
30
+ "@cargo-messages/android-arm-eabi": "0.0.152",
31
+ "@cargo-messages/darwin-arm64": "0.0.152",
32
+ "@cargo-messages/darwin-x64": "0.0.152",
33
+ "@cargo-messages/linux-arm-gnueabihf": "0.0.152",
34
+ "@cargo-messages/linux-x64-gnu": "0.0.152",
35
+ "@cargo-messages/win32-arm64-msvc": "0.0.152",
36
+ "@cargo-messages/win32-x64-msvc": "0.0.152"
37
37
  }
38
38
  }