@autter/runtime-node 1.5.0 → 1.6.1

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.
package/dist/cli.cjs CHANGED
@@ -1,32 +1,52 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
2
+ "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3
3
 
4
4
 
5
5
 
6
6
 
7
- var _chunkL6SRL65Jcjs = require('./chunk-L6SRL65J.cjs');
8
- require('./chunk-GI47WGRR.cjs');
7
+ var _chunk7OTD2YPTcjs = require('./chunk-7OTD2YPT.cjs');
8
+ require('./chunk-4MVWIRBI.cjs');
9
9
 
10
10
  // src/cli.ts
11
+ var _child_process = require('child_process');
12
+ var _fs = require('fs');
13
+ var _module = require('module');
14
+ var _path = require('path');
15
+ function delegateToRuntimeCli(argv) {
16
+ try {
17
+ const manifest = _module.createRequire.call(void 0, _path.join.call(void 0, process.cwd(), "package.json")).resolve("@autter/runtime-cli/package.json");
18
+ const bin = _optionalChain([JSON, 'access', _ => _.parse, 'call', _2 => _2(_fs.readFileSync.call(void 0, manifest, "utf8")), 'access', _3 => _3.bin, 'optionalAccess', _4 => _4["autter-runtime"]]);
19
+ if (!bin) return null;
20
+ return _nullishCoalesce(_child_process.spawnSync.call(void 0, process.execPath, [_path.resolve.call(void 0, _path.dirname.call(void 0, manifest), bin), ...argv], { stdio: "inherit" }).status, () => ( 1));
21
+ } catch (e) {
22
+ return null;
23
+ }
24
+ }
11
25
  async function main(argv) {
12
26
  const [command, ...rest] = argv;
27
+ if (command === "sourcemaps") {
28
+ const code = delegateToRuntimeCli(argv);
29
+ if (code !== null) return code;
30
+ console.error("autter-runtime sourcemaps is part of @autter/runtime-cli: npm install -D @autter/runtime-cli");
31
+ return 64;
32
+ }
13
33
  if (command !== "doctor") {
14
- console.log(_chunkL6SRL65Jcjs.DOCTOR_USAGE);
34
+ console.log(_chunk7OTD2YPTcjs.DOCTOR_USAGE);
15
35
  return command === void 0 || command === "--help" || command === "-h" ? 0 : 64;
16
36
  }
17
- const parsed = _chunkL6SRL65Jcjs.parseDoctorArgs.call(void 0, rest);
37
+ const parsed = _chunk7OTD2YPTcjs.parseDoctorArgs.call(void 0, rest);
18
38
  if ("help" in parsed) {
19
- console.log(_chunkL6SRL65Jcjs.DOCTOR_USAGE);
39
+ console.log(_chunk7OTD2YPTcjs.DOCTOR_USAGE);
20
40
  return 0;
21
41
  }
22
42
  if ("error" in parsed) {
23
43
  console.error(`${parsed.error}
24
44
 
25
- ${_chunkL6SRL65Jcjs.DOCTOR_USAGE}`);
45
+ ${_chunk7OTD2YPTcjs.DOCTOR_USAGE}`);
26
46
  return 64;
27
47
  }
28
- const report = await _chunkL6SRL65Jcjs.runDoctor.call(void 0, parsed);
29
- console.log(parsed.json ? JSON.stringify(report, null, 2) : _chunkL6SRL65Jcjs.formatDoctorReport.call(void 0, report));
48
+ const report = await _chunk7OTD2YPTcjs.runDoctor.call(void 0, parsed);
49
+ console.log(parsed.json ? JSON.stringify(report, null, 2) : _chunk7OTD2YPTcjs.formatDoctorReport.call(void 0, report));
30
50
  return report.exitCode;
31
51
  }
32
52
  main(process.argv.slice(2)).then(
package/dist/cli.js CHANGED
@@ -4,12 +4,32 @@ import {
4
4
  formatDoctorReport,
5
5
  parseDoctorArgs,
6
6
  runDoctor
7
- } from "./chunk-ZS4WQJQR.js";
8
- import "./chunk-L7HWKMCZ.js";
7
+ } from "./chunk-L5ENELB2.js";
8
+ import "./chunk-HRDELHZP.js";
9
9
 
10
10
  // src/cli.ts
11
+ import { spawnSync } from "child_process";
12
+ import { readFileSync } from "fs";
13
+ import { createRequire } from "module";
14
+ import { dirname, join, resolve } from "path";
15
+ function delegateToRuntimeCli(argv) {
16
+ try {
17
+ const manifest = createRequire(join(process.cwd(), "package.json")).resolve("@autter/runtime-cli/package.json");
18
+ const bin = JSON.parse(readFileSync(manifest, "utf8")).bin?.["autter-runtime"];
19
+ if (!bin) return null;
20
+ return spawnSync(process.execPath, [resolve(dirname(manifest), bin), ...argv], { stdio: "inherit" }).status ?? 1;
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
11
25
  async function main(argv) {
12
26
  const [command, ...rest] = argv;
27
+ if (command === "sourcemaps") {
28
+ const code = delegateToRuntimeCli(argv);
29
+ if (code !== null) return code;
30
+ console.error("autter-runtime sourcemaps is part of @autter/runtime-cli: npm install -D @autter/runtime-cli");
31
+ return 64;
32
+ }
13
33
  if (command !== "doctor") {
14
34
  console.log(DOCTOR_USAGE);
15
35
  return command === void 0 || command === "--help" || command === "-h" ? 0 : 64;