@agoric/swingset-vat 0.32.3-dev-488dec7.0.488dec7 → 0.32.3-dev-b85a94d.0.b85a94d

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/package.json +12 -14
  2. package/tools/vat.js +36 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/swingset-vat",
3
- "version": "0.32.3-dev-488dec7.0.488dec7",
3
+ "version": "0.32.3-dev-b85a94d.0.b85a94d",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -25,19 +25,18 @@
25
25
  "@types/better-sqlite3": "^7.6.13",
26
26
  "@types/microtime": "^2.1.0",
27
27
  "@types/tmp": "^0.2.0",
28
- "@types/yargs-parser": "^21.0.0",
29
28
  "ava": "^7.0.0"
30
29
  },
31
30
  "dependencies": {
32
- "@agoric/internal": "0.3.3-dev-488dec7.0.488dec7",
33
- "@agoric/kmarshal": "0.1.1-dev-488dec7.0.488dec7",
34
- "@agoric/store": "0.9.3-dev-488dec7.0.488dec7",
35
- "@agoric/swing-store": "0.9.2-dev-488dec7.0.488dec7",
36
- "@agoric/swingset-liveslots": "0.10.3-dev-488dec7.0.488dec7",
37
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-488dec7.0.488dec7",
38
- "@agoric/time": "0.3.3-dev-488dec7.0.488dec7",
39
- "@agoric/vat-data": "0.5.3-dev-488dec7.0.488dec7",
40
- "@agoric/xsnap-lockdown": "0.14.1-dev-488dec7.0.488dec7",
31
+ "@agoric/internal": "0.3.3-dev-b85a94d.0.b85a94d",
32
+ "@agoric/kmarshal": "0.1.1-dev-b85a94d.0.b85a94d",
33
+ "@agoric/store": "0.9.3-dev-b85a94d.0.b85a94d",
34
+ "@agoric/swing-store": "0.9.2-dev-b85a94d.0.b85a94d",
35
+ "@agoric/swingset-liveslots": "0.10.3-dev-b85a94d.0.b85a94d",
36
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-b85a94d.0.b85a94d",
37
+ "@agoric/time": "0.3.3-dev-b85a94d.0.b85a94d",
38
+ "@agoric/vat-data": "0.5.3-dev-b85a94d.0.b85a94d",
39
+ "@agoric/xsnap-lockdown": "0.14.1-dev-b85a94d.0.b85a94d",
41
40
  "@endo/base64": "^1.0.12",
42
41
  "@endo/bundle-source": "^4.1.2",
43
42
  "@endo/captp": "^4.4.8",
@@ -61,8 +60,7 @@
61
60
  "import-meta-resolve": "^4.1.0",
62
61
  "microtime": "^3.1.0",
63
62
  "semver": "^6.3.0",
64
- "tmp": "^0.2.1",
65
- "yargs-parser": "^21.1.1"
63
+ "tmp": "^0.2.1"
66
64
  },
67
65
  "peerDependencies": {
68
66
  "@agoric/xsnap": "0.14.2",
@@ -112,5 +110,5 @@
112
110
  "typeCoverage": {
113
111
  "atLeast": 76.72
114
112
  },
115
- "gitHead": "488dec73a49f5a4fd66eea6521638ce5ba11dd2f"
113
+ "gitHead": "b85a94d36a78e1fac36766d1cb9649c5db9e869c"
116
114
  }
package/tools/vat.js CHANGED
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { dirname } from 'node:path';
4
- import yargsParser from 'yargs-parser';
5
4
  import '@endo/init/pre-bundle-source.js';
6
5
  import '@endo/init';
7
6
  import process from 'node:process';
8
7
  import repl from 'node:repl';
9
- import util from 'node:util';
8
+ import { inspect, parseArgs } from 'node:util';
10
9
  import {
11
10
  loadSwingsetConfigFile,
12
11
  loadBasedir,
@@ -27,19 +26,43 @@ const showUsage = (message, exitCode = 64) => {
27
26
  };
28
27
 
29
28
  function deepLog(item) {
30
- console.log(util.inspect(item, false, null, true));
29
+ console.log(inspect(item, false, null, true));
31
30
  }
32
31
 
32
+ const parseVatArgs = rawArgs => {
33
+ const separator = rawArgs.indexOf('--');
34
+ const cliArgs = separator < 0 ? rawArgs : rawArgs.slice(0, separator);
35
+ const extraArgs = separator < 0 ? [] : rawArgs.slice(separator + 1);
36
+ const { values: options, tokens } = parseArgs({
37
+ args: cliArgs,
38
+ options: {
39
+ config: { type: 'string', short: 'c' },
40
+ },
41
+ allowPositionals: true,
42
+ strict: false,
43
+ tokens: true,
44
+ });
45
+ const argv = [];
46
+ for (const token of tokens) {
47
+ if (token.kind === 'positional') {
48
+ argv.push(token.value);
49
+ } else if (token.kind === 'option' && token.name !== 'config') {
50
+ argv.push(
51
+ token.inlineValue ? `${token.rawName}=${token.value}` : token.rawName,
52
+ );
53
+ }
54
+ }
55
+ const config =
56
+ typeof options.config === 'string' ? options.config : undefined;
57
+ return { argv, extraArgs, config };
58
+ };
59
+
33
60
  async function main() {
34
61
  const {
35
- _: argv,
36
- '--': extraArgs = [],
37
- ...options
38
- } = yargsParser(process.argv.slice(2), {
39
- configuration: { 'populate--': true, 'unknown-options-as-args': true },
40
- string: ['config'],
41
- alias: { config: ['c'] },
42
- });
62
+ argv,
63
+ extraArgs,
64
+ config: configPath,
65
+ } = parseVatArgs(process.argv.slice(2));
43
66
  const command = argv.shift();
44
67
  if (command === undefined) {
45
68
  if (argv.includes('--help')) return showUsage();
@@ -49,15 +72,14 @@ async function main() {
49
72
  command === 'help' ? undefined : `Unrecognized command: ${command}`,
50
73
  );
51
74
  }
52
- const configPath = options.config;
53
75
  let basedir = /** @type {string | undefined} */ (argv.shift());
54
76
  if (basedir === undefined) {
55
77
  basedir = configPath ? dirname(configPath) : '.';
56
78
  }
57
79
  const vatArgv = /** @type {string[]} */ ([...argv, ...extraArgs]);
58
80
 
59
- const config = await (options.config
60
- ? loadSwingsetConfigFile(options.config)
81
+ const config = await (configPath
82
+ ? loadSwingsetConfigFile(configPath)
61
83
  : loadBasedir(basedir));
62
84
  assert(config);
63
85
  config.devices ||= {};