@swipt/cli 0.1.0-nightly.78 → 0.1.0-nightly.79

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 (68) hide show
  1. package/dist/availability.d.ts +5 -0
  2. package/dist/availability.js +349 -0
  3. package/dist/availability.js.map +1 -0
  4. package/dist/client.d.ts +25 -0
  5. package/dist/client.js +248 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/connection.d.ts +24 -0
  8. package/dist/connection.js +293 -0
  9. package/dist/connection.js.map +1 -0
  10. package/dist/coredevice.d.ts +22 -0
  11. package/dist/coredevice.js +329 -0
  12. package/dist/coredevice.js.map +1 -0
  13. package/dist/device.d.ts +130 -0
  14. package/dist/device.js +539 -0
  15. package/dist/device.js.map +1 -0
  16. package/dist/i18n.d.ts +2 -0
  17. package/dist/i18n.js +57 -0
  18. package/dist/i18n.js.map +1 -0
  19. package/dist/ignore.d.ts +8 -0
  20. package/dist/ignore.js +112 -0
  21. package/dist/ignore.js.map +1 -0
  22. package/dist/metro.d.ts +10 -0
  23. package/dist/metro.js +349 -0
  24. package/dist/metro.js.map +1 -0
  25. package/dist/output.d.ts +20 -0
  26. package/dist/output.js +116 -0
  27. package/dist/output.js.map +1 -0
  28. package/dist/project.d.ts +18 -0
  29. package/dist/project.js +696 -0
  30. package/dist/project.js.map +1 -0
  31. package/dist/proto/common_pb.js +34 -0
  32. package/dist/proto/common_pb.js.map +1 -0
  33. package/dist/proto/logs_pb.js +15 -0
  34. package/dist/proto/logs_pb.js.map +1 -0
  35. package/dist/proto/repl_pb.js +15 -0
  36. package/dist/proto/repl_pb.js.map +1 -0
  37. package/dist/proto/swiplets_pb.js +28 -0
  38. package/dist/proto/swiplets_pb.js.map +1 -0
  39. package/dist/proto/system_pb.js +15 -0
  40. package/dist/proto/system_pb.js.map +1 -0
  41. package/dist/sideload.d.ts +17 -0
  42. package/dist/sideload.js +1098 -0
  43. package/dist/sideload.js.map +1 -0
  44. package/dist/swipt.d.ts +1 -0
  45. package/dist/swipt.js +631 -0
  46. package/dist/swipt.js.map +1 -0
  47. package/dist/version.d.ts +2 -0
  48. package/dist/version.js +15 -0
  49. package/dist/version.js.map +1 -0
  50. package/package.json +21 -7
  51. package/availability.mjs +0 -642
  52. package/client.mjs +0 -375
  53. package/connection.mjs +0 -450
  54. package/coredevice.mjs +0 -464
  55. package/device.mjs +0 -837
  56. package/i18n.mjs +0 -71
  57. package/ignore.mjs +0 -149
  58. package/metro.mjs +0 -432
  59. package/output.mjs +0 -177
  60. package/project.mjs +0 -1013
  61. package/proto/common_pb.js +0 -98
  62. package/proto/logs_pb.js +0 -34
  63. package/proto/repl_pb.js +0 -55
  64. package/proto/swiplets_pb.js +0 -179
  65. package/proto/system_pb.js +0 -27
  66. package/sideload.mjs +0 -1696
  67. package/swipt.mjs +0 -726
  68. package/version.mjs +0 -16
package/swipt.mjs DELETED
@@ -1,726 +0,0 @@
1
- #!/usr/bin/env node
2
- import path from "node:path";
3
- import { parseArgs } from "node:util";
4
-
5
- import { Code, RpcError, UsageError } from "./client.mjs";
6
- import * as connection from "./connection.mjs";
7
- import * as device from "./device.mjs";
8
- import { tr } from "./i18n.mjs";
9
- import { FalseResult } from "./output.mjs";
10
- import { buildProject, createCommand, sourceCommand } from "./project.mjs";
11
- import * as sideload from "./sideload.mjs";
12
-
13
- const globalOptions = {
14
- help: { type: "boolean", short: "h", help: tr("help") },
15
- };
16
-
17
- const deviceOption = {
18
- device: {
19
- type: "string",
20
- short: "d",
21
- value: "NAME|URL",
22
- help: tr("the device to use"),
23
- },
24
- };
25
-
26
- const sideloadOptions = {
27
- device: {
28
- type: "string",
29
- short: "d",
30
- value: "NAME|UDID",
31
- help: tr("the device to use"),
32
- },
33
- team: {
34
- type: "string",
35
- value: "ID",
36
- help: tr("team ID, required if more than one"),
37
- },
38
- };
39
-
40
- const passcodeOptions = (help) => ({
41
- passcode: { type: "string", value: "CODE", help },
42
- "passcode-type": {
43
- type: "string",
44
- value: "TYPE",
45
- help: tr("pin (4 or 6 digits, default), numeric or alphanumeric"),
46
- },
47
- });
48
-
49
- const nightlyOption = {
50
- nightly: { type: "boolean", help: tr("use nightly build") },
51
- };
52
-
53
- const setupStepOptions = {
54
- "no-setup-pair": { type: "boolean", help: tr("do not pair Swipt") },
55
- "no-setup-api": {
56
- type: "boolean",
57
- help: tr("do not publish the API to the local network"),
58
- },
59
- };
60
-
61
- const setupOptions = {
62
- "no-setup": {
63
- type: "boolean",
64
- help: tr("do not pair Swipt, trust its developer or publish its API"),
65
- },
66
- ...setupStepOptions,
67
- };
68
-
69
- const durationUnits = {
70
- ns: 1e-6,
71
- us: 1e-3,
72
- µs: 1e-3,
73
- ms: 1,
74
- s: 1000,
75
- m: 60_000,
76
- h: 3_600_000,
77
- };
78
-
79
- function parseDuration(text, option) {
80
- if (text === undefined) {
81
- return 0;
82
- }
83
- if (/^-?\d+$/.test(text) && Number(text) === 0) {
84
- return 0;
85
- }
86
- let total = 0;
87
- let rest = text;
88
- while (rest !== "") {
89
- const match = /^(\d+(?:\.\d*)?|\.\d+)(ns|us|µs|ms|s|m|h)/.exec(rest);
90
- if (!match) {
91
- throw new UsageError(
92
- tr(
93
- "invalid argument {value} for {option}: it is a duration such as 30s or 1m30s",
94
- { value: JSON.stringify(text), option },
95
- ),
96
- );
97
- }
98
- total += Number(match[1]) * durationUnits[match[2]];
99
- rest = rest.slice(match[0].length);
100
- }
101
- return total;
102
- }
103
-
104
- function parseCount(text, option) {
105
- if (text === undefined) {
106
- return undefined;
107
- }
108
- if (!/^\d+$/.test(text) || Number(text) > 0xffffffff) {
109
- throw new UsageError(
110
- tr("invalid argument {value} for {option}: it is a number", {
111
- value: JSON.stringify(text),
112
- option,
113
- }),
114
- );
115
- }
116
- return Number(text);
117
- }
118
-
119
- const dataCommands = (operand, files) => {
120
- const before = operand === "" ? 0 : 1;
121
- return {
122
- name: "data",
123
- short:
124
- operand === ""
125
- ? tr("Manage the files in the data directory of the REPL")
126
- : tr("Manage the files in the data directory of a swiplet"),
127
- commands: [
128
- {
129
- name: "list",
130
- use: `list ${operand}[PATH]`,
131
- short: tr("List data files"),
132
- args: [before, before + 1],
133
- options: {
134
- recursive: { type: "boolean", help: tr("include subdirectories") },
135
- },
136
- run: files.list,
137
- },
138
- {
139
- name: "read",
140
- use: `read ${operand}PATH`,
141
- short: tr("Read a data file or directory"),
142
- args: [before + 1, before + 1],
143
- options: {
144
- output: { type: "string", value: "PATH", help: tr("destination") },
145
- },
146
- run: files.read,
147
- },
148
- {
149
- name: "write",
150
- use: `write ${operand}PATH [FILE | -]`,
151
- short: tr("Write a data file"),
152
- args: [before + 1, before + 2],
153
- run: files.write,
154
- },
155
- {
156
- name: "remove",
157
- use: `remove ${operand}PATH`,
158
- short: tr("Remove a data file"),
159
- args: [before + 1, before + 1],
160
- options: {
161
- recursive: {
162
- type: "boolean",
163
- help: tr("include directory contents"),
164
- },
165
- },
166
- run: files.remove,
167
- },
168
- {
169
- name: "clear",
170
- use: `clear ${operand}`.trimEnd(),
171
- short: tr("Remove every data file, keeping the data directory"),
172
- args: [before, before],
173
- run: files.clear,
174
- },
175
- ],
176
- };
177
- };
178
-
179
- const commands = [
180
- {
181
- name: "project",
182
- short: tr("Make, build and deploy swiplet projects"),
183
- commands: [
184
- {
185
- name: "create",
186
- use: "create DIRECTORY",
187
- short: tr("Make a swiplet project in a new or empty directory"),
188
- args: [1, 1],
189
- run: ({ args }) => createCommand(args[0]),
190
- },
191
- {
192
- name: "build",
193
- use: "build [PROJECT]",
194
- short: tr("Bundle the project into dist/<swiplet.id>.swiplet"),
195
- args: [0, 1],
196
- run: async ({ args }) => {
197
- const { archive } = await buildProject(path.resolve(args[0] ?? "."));
198
- console.log(path.relative(process.cwd(), archive));
199
- },
200
- },
201
- {
202
- name: "source",
203
- use: "source [SWIPLET...]",
204
- short: tr("Collect the built swiplets into dist/ with a swiplets.json"),
205
- args: [0, Infinity],
206
- run: ({ args }) => sourceCommand(process.cwd(), args),
207
- },
208
- {
209
- name: "deploy",
210
- use: "deploy [PROJECT]",
211
- short: tr("Build the project and install it on the device"),
212
- args: [0, 1],
213
- options: deviceOption,
214
- run: device.deployProject,
215
- },
216
- {
217
- name: "develop",
218
- use: "develop [PROJECT]",
219
- short: tr("Build, install and follow a swiplet project as it changes"),
220
- args: [0, 1],
221
- options: {
222
- ...deviceOption,
223
- "no-logs": { type: "boolean", help: tr("without logs") },
224
- },
225
- run: device.develop,
226
- },
227
- ],
228
- },
229
- {
230
- name: "device",
231
- short: tr("Manage the devices and read their logs"),
232
- commands: [
233
- {
234
- name: "list",
235
- short: tr(
236
- "List the devices, adding the ones found on the local network",
237
- ),
238
- args: [0, 0],
239
- run: connection.list,
240
- },
241
- {
242
- name: "add",
243
- use: "add URL",
244
- short: tr(
245
- "Add a device by its URL; needed when it is remote or requires a token",
246
- ),
247
- args: [1, 1],
248
- run: connection.add,
249
- },
250
- {
251
- name: "remove",
252
- use: "remove NAME",
253
- short: tr("Forget a device"),
254
- args: [1, 1],
255
- run: connection.remove,
256
- },
257
- {
258
- name: "stop",
259
- short: tr("Stop the Swipt server"),
260
- args: [0, 0],
261
- options: deviceOption,
262
- run: device.stop,
263
- },
264
- {
265
- name: "logs",
266
- short: tr("Print the logs"),
267
- args: [0, 0],
268
- options: {
269
- ...deviceOption,
270
- follow: { type: "boolean", help: tr("follow new entries") },
271
- tail: {
272
- type: "string",
273
- value: "COUNT",
274
- help: tr("number of past entries (default 100)"),
275
- },
276
- since: { type: "string", value: "DURATION", help: tr("maximum age") },
277
- level: {
278
- type: "string",
279
- value: "LEVEL",
280
- help: tr("minimum level (default info)"),
281
- },
282
- swiplet: { type: "string", value: "ID", help: tr("swiplet ID") },
283
- },
284
- parse: (options) => ({
285
- ...options,
286
- tail: parseCount(options.tail, "--tail"),
287
- since: parseDuration(options.since, "--since"),
288
- level: options.level ?? "info",
289
- }),
290
- run: device.logs,
291
- },
292
- ],
293
- },
294
- {
295
- name: "swiplet",
296
- short: tr("Manage the swiplets on the device"),
297
- options: deviceOption,
298
- commands: [
299
- {
300
- name: "list",
301
- short: tr("List the swiplets"),
302
- args: [0, 0],
303
- run: device.list,
304
- },
305
- {
306
- name: "show",
307
- use: "show ID",
308
- short: tr("Show a swiplet"),
309
- args: [1, 1],
310
- run: device.show,
311
- },
312
- {
313
- name: "install",
314
- use: "install ARCHIVE",
315
- short: tr("Install a swiplet archive"),
316
- args: [1, 1],
317
- run: device.install,
318
- },
319
- {
320
- name: "remove",
321
- use: "remove ID",
322
- short: tr("Remove a swiplet"),
323
- args: [1, 1],
324
- run: device.remove,
325
- },
326
- {
327
- name: "call",
328
- use: "call ID ACTION",
329
- short: tr("Call a swiplet action"),
330
- args: [2, 2],
331
- options: {
332
- input: {
333
- type: "string",
334
- value: "JSON",
335
- help: tr("input JSON, @FILE or -"),
336
- },
337
- },
338
- run: device.call,
339
- },
340
- {
341
- name: "service",
342
- short: tr("Manage swiplet services"),
343
- commands: [
344
- {
345
- name: "enable",
346
- use: "enable ID",
347
- short: tr("Turn on a swiplet service"),
348
- args: [1, 1],
349
- options: {
350
- watch: { type: "boolean", help: tr("watch the state") },
351
- },
352
- run: device.setService(true),
353
- },
354
- {
355
- name: "disable",
356
- use: "disable ID",
357
- short: tr("Turn off a swiplet service"),
358
- args: [1, 1],
359
- options: {
360
- watch: { type: "boolean", help: tr("watch the state") },
361
- },
362
- run: device.setService(false),
363
- },
364
- {
365
- name: "watch",
366
- use: "watch [ID]",
367
- short: tr("Watch swiplet services"),
368
- args: [0, 1],
369
- run: device.serviceWatch,
370
- },
371
- ],
372
- },
373
- dataCommands("ID ", device.swipletData),
374
- ],
375
- },
376
- {
377
- name: "repl",
378
- short: tr("Run JavaScript in the REPL session on the device"),
379
- options: deviceOption,
380
- commands: [
381
- {
382
- name: "run",
383
- use: "run [CODE | FILE [ARG...] | - [ARG...]]",
384
- short: tr("Run a JavaScript expression or program on the device"),
385
- description: [
386
- tr(
387
- "The first argument is FILE when it names an existing file and CODE otherwise; options go before it.",
388
- ),
389
- tr(
390
- "CODE is an expression whose value is printed. FILE, or standard input given as - or no argument, is a program, and only its console output is printed.",
391
- ),
392
- ],
393
- args: [0, Infinity],
394
- passthrough: device.isProgram,
395
- options: {
396
- output: {
397
- type: "string",
398
- value: "DIRECTORY",
399
- help: tr("image directory (default: a new temporary directory)"),
400
- },
401
- },
402
- run: device.run,
403
- },
404
- {
405
- name: "reset",
406
- short: tr("Reset the session"),
407
- args: [0, 0],
408
- run: device.reset,
409
- },
410
- {
411
- name: "api",
412
- short: tr(
413
- "Print the TypeScript declarations of the globals and modules",
414
- ),
415
- args: [0, 0],
416
- run: device.api,
417
- },
418
- dataCommands("", device.replData),
419
- ],
420
- },
421
- {
422
- name: "sideload",
423
- short: tr("Sideload Swipt"),
424
- options: sideloadOptions,
425
- commands: [
426
- {
427
- name: "install",
428
- short: tr("Install Swipt"),
429
- args: [0, 0],
430
- options: {
431
- ...passcodeOptions(tr("set up auto-unlock with this passcode")),
432
- ...nightlyOption,
433
- ...setupOptions,
434
- },
435
- run: sideload.install,
436
- },
437
- {
438
- name: "update",
439
- short: tr("Update or renew Swipt"),
440
- args: [0, 0],
441
- options: {
442
- ...passcodeOptions(tr("unlock device with this passcode")),
443
- ...nightlyOption,
444
- ...setupOptions,
445
- },
446
- run: sideload.update,
447
- },
448
- {
449
- name: "setup",
450
- short: tr("Set up Swipt"),
451
- args: [0, 0],
452
- options: {
453
- ...passcodeOptions(tr("set up auto-unlock with this passcode")),
454
- ...setupStepOptions,
455
- },
456
- run: sideload.setup,
457
- },
458
- {
459
- name: "uninstall",
460
- short: tr("Remove Swipt"),
461
- args: [0, 0],
462
- run: sideload.uninstall,
463
- },
464
- ],
465
- },
466
- {
467
- name: "version",
468
- short: tr("Print the version"),
469
- args: [0, 0],
470
- run: device.printVersion,
471
- },
472
- ];
473
-
474
- const root = {
475
- name: "swipt",
476
- short: tr("Swipt CLI"),
477
- commands,
478
- };
479
-
480
- const parseOptions = (options) =>
481
- Object.fromEntries(
482
- Object.entries(options ?? {}).map(([name, option]) => [
483
- name,
484
- { type: option.type, ...(option.short ? { short: option.short } : {}) },
485
- ]),
486
- );
487
-
488
- function allOptions(command, collected = {}) {
489
- Object.assign(collected, parseOptions(command.options));
490
- for (const child of command.commands ?? []) {
491
- allOptions(child, collected);
492
- }
493
- return collected;
494
- }
495
-
496
- function usage(trail) {
497
- const command = trail.at(-1);
498
- const name = trail.map((it) => it.name).join(" ");
499
- const lines = [command.short, ""];
500
- if (command.commands) {
501
- lines.push(
502
- tr("usage: {usage}", { usage: `${name} COMMAND` }),
503
- "",
504
- tr("commands:"),
505
- );
506
- lines.push(
507
- ...columns(
508
- command.commands.map((child) => [
509
- ` ${child.use ?? child.name}`,
510
- child.short,
511
- ]),
512
- ).split("\n"),
513
- );
514
- } else {
515
- lines.push(
516
- tr("usage: {usage}", {
517
- usage: `${trail
518
- .slice(0, -1)
519
- .map((it) => it.name)
520
- .join(" ")} ${command.use ?? command.name}`.replace(/ +/g, " "),
521
- }),
522
- );
523
- }
524
- if (command.description) {
525
- lines.push("", ...command.description);
526
- }
527
- const options = {
528
- ...trail.reduce((found, it) => ({ ...found, ...it.options }), {}),
529
- ...globalOptions,
530
- };
531
- lines.push("", tr("options:"));
532
- lines.push(
533
- ...columns(
534
- Object.entries(options).map(([option, it]) => [
535
- ` ${it.short ? `-${it.short}, ` : ""}--${option}${it.value ? ` ${it.value}` : ""}`,
536
- it.help,
537
- ]),
538
- ).split("\n"),
539
- );
540
- return lines.join("\n");
541
- }
542
-
543
- function columns(rows) {
544
- const width = Math.max(...rows.map((row) => row[0].length));
545
- return rows.map((row) => `${row[0].padEnd(width + 2)}${row[1]}`).join("\n");
546
- }
547
-
548
- function resolve(argv) {
549
- const loose = parseArgs({
550
- args: argv,
551
- options: { ...parseOptions(globalOptions), ...allOptions(root) },
552
- allowPositionals: true,
553
- strict: false,
554
- tokens: true,
555
- });
556
- const positionals = loose.tokens.filter(
557
- (token) => token.kind === "positional",
558
- );
559
- const trail = [root];
560
- let consumed = 0;
561
- let help = positionals[0]?.value === "help";
562
- if (help) {
563
- consumed++;
564
- }
565
- while (trail.at(-1).commands) {
566
- const current = trail.at(-1);
567
- const word = positionals[consumed]?.value;
568
- if (word === undefined) {
569
- if (help || loose.values.help || current !== root || argv.length === 0) {
570
- return { trail, help: true };
571
- }
572
- throw new UsageError(tr("a command is missing"));
573
- }
574
- const found = current.commands.find((it) => it.name === word);
575
- if (!found) {
576
- throw new UsageError(
577
- tr("unknown command {name} for {parent}", {
578
- name: JSON.stringify(word),
579
- parent: JSON.stringify(trail.map((it) => it.name).join(" ")),
580
- }),
581
- );
582
- }
583
- trail.push(found);
584
- consumed++;
585
- }
586
- const command = trail.at(-1);
587
- const options = trail.reduce(
588
- (found, it) => ({ ...found, ...it.options }),
589
- {},
590
- );
591
- const first = positionals[consumed];
592
- const verbatim =
593
- first !== undefined && command.passthrough?.(first.value)
594
- ? first.index + 1
595
- : argv.length;
596
- let parsed;
597
- try {
598
- parsed = parseArgs({
599
- args: argv.slice(0, verbatim),
600
- options: { ...parseOptions(globalOptions), ...parseOptions(options) },
601
- allowPositionals: true,
602
- strict: true,
603
- });
604
- } catch (error) {
605
- const option = error.message.match(/^Unknown option '(-[^']*)'/)?.[1];
606
- throw new UsageError(
607
- option === undefined
608
- ? error.message
609
- : tr("{option} is not an option of {command}", {
610
- option,
611
- command: JSON.stringify(trail.map((it) => it.name).join(" ")),
612
- }),
613
- );
614
- }
615
- if (parsed.values.help) {
616
- help = true;
617
- }
618
- const args = [...parsed.positionals.slice(consumed), ...argv.slice(verbatim)];
619
- if (
620
- !help &&
621
- (args.length < command.args[0] || args.length > command.args[1])
622
- ) {
623
- const [least, most] = command.args;
624
- throw new UsageError(
625
- least === most
626
- ? tr("accepts {count} arg(s), received {received}", {
627
- count: least,
628
- received: args.length,
629
- })
630
- : most === Infinity
631
- ? tr("accepts at least {count} arg(s), received {received}", {
632
- count: least,
633
- received: args.length,
634
- })
635
- : tr(
636
- "accepts between {least} and {count} arg(s), received {received}",
637
- { least, count: most, received: args.length },
638
- ),
639
- );
640
- }
641
- return { trail, help, args, values: parsed.values };
642
- }
643
-
644
- function printError(error, target, operation) {
645
- let exit = 1;
646
- let message = error.message;
647
- if (error instanceof UsageError) {
648
- exit = 2;
649
- } else if (error instanceof RpcError) {
650
- switch (error.code) {
651
- case Code.Unavailable:
652
- exit = 5;
653
- message = tr("Swipt at {url} is unreachable: {message}", {
654
- url: target.url,
655
- message,
656
- });
657
- break;
658
- case Code.Unauthenticated:
659
- message = tr(
660
- "{message}; connect with the URL from Swipt › Developer: swipt device add {url}",
661
- { message, url: connection.withToken(target.url) },
662
- );
663
- break;
664
- case Code.Unimplemented:
665
- message = tr(
666
- "Swipt at {url} does not have this command; update Swipt",
667
- { url: target.url },
668
- );
669
- break;
670
- }
671
- }
672
- console.error(
673
- tr("error: {message}", {
674
- message: operation === undefined ? message : `${operation}: ${message}`,
675
- }),
676
- );
677
- if (exit === 2) {
678
- console.error(tr('run "swipt help" for usage'));
679
- }
680
- return exit;
681
- }
682
-
683
- async function main() {
684
- const interrupt = new AbortController();
685
- const interrupted = () => interrupt.abort();
686
- process.once("SIGINT", interrupted);
687
- process.once("SIGTERM", interrupted);
688
- const target = { url: "" };
689
- try {
690
- const resolved = resolve(process.argv.slice(2));
691
- if (resolved.help) {
692
- console.log(usage(resolved.trail));
693
- return;
694
- }
695
- const command = resolved.trail.at(-1);
696
- const values = command.parse
697
- ? command.parse(resolved.values)
698
- : resolved.values;
699
- await command.run({
700
- args: resolved.args,
701
- options: values,
702
- target,
703
- signal: interrupt.signal,
704
- printError: (error, operation) => printError(error, target, operation),
705
- });
706
- } catch (error) {
707
- if (error instanceof FalseResult) {
708
- process.exitCode = 1;
709
- } else if (interrupt.signal.aborted || error.name === "ExitPromptError") {
710
- process.exitCode = 130;
711
- } else {
712
- process.exitCode = printError(error, target);
713
- }
714
- } finally {
715
- process.off("SIGINT", interrupted);
716
- process.off("SIGTERM", interrupted);
717
- }
718
- }
719
-
720
- await main();
721
- await Promise.all(
722
- [process.stdout, process.stderr].map(
723
- (stream) => new Promise((resolve) => stream.write("", resolve)),
724
- ),
725
- );
726
- process.exit();