storybook 9.0.0-alpha.3 → 9.0.0-alpha.4
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/README.md +1 -1
- package/dist/actions/decorator.d.ts +6 -0
- package/dist/actions/decorator.js +139 -0
- package/dist/actions/index.cjs +127 -0
- package/dist/actions/index.d.ts +105 -0
- package/dist/actions/index.js +112 -0
- package/dist/actions/manager.js +1196 -0
- package/dist/actions/preview.cjs +165 -0
- package/dist/actions/preview.d.ts +55 -0
- package/dist/actions/preview.js +156 -0
- package/dist/bin/index.cjs +63 -64
- package/dist/bin/index.js +63 -64
- package/dist/channels/index.cjs +207 -230
- package/dist/channels/index.js +302 -304
- package/dist/cli/bin/index.cjs +405 -405
- package/dist/cli/bin/index.js +410 -410
- package/dist/client-logger/index.cjs +56 -88
- package/dist/client-logger/index.js +41 -47
- package/dist/common/index.cjs +65 -67
- package/dist/common/index.d.ts +1 -4
- package/dist/common/index.js +65 -67
- package/dist/components/index.cjs +9413 -11578
- package/dist/components/index.d.ts +92 -92
- package/dist/components/index.js +6768 -7544
- package/dist/core-events/index.d.ts +138 -25
- package/dist/core-server/index.cjs +5241 -5265
- package/dist/core-server/index.js +5353 -5375
- package/dist/core-server/presets/common-manager.js +11 -19
- package/dist/core-server/presets/common-preset.cjs +243 -242
- package/dist/core-server/presets/common-preset.js +379 -378
- package/dist/csf/index.cjs +76 -120
- package/dist/csf/index.d.ts +1 -3
- package/dist/csf/index.js +69 -113
- package/dist/docs-tools/index.cjs +1 -1
- package/dist/docs-tools/index.d.ts +2 -2
- package/dist/docs-tools/index.js +1 -1
- package/dist/instrumenter/index.cjs +1260 -1289
- package/dist/instrumenter/index.js +1344 -1348
- package/dist/manager/globals-module-info.cjs +272 -135
- package/dist/manager/globals-module-info.d.ts +1 -1
- package/dist/manager/globals-module-info.js +257 -120
- package/dist/manager/globals-runtime.js +59553 -22371
- package/dist/manager/globals.cjs +23 -19
- package/dist/manager/globals.d.ts +8 -5
- package/dist/manager/globals.js +10 -6
- package/dist/manager/runtime.js +129 -129
- package/dist/manager-api/index.cjs +1182 -1205
- package/dist/manager-api/index.d.ts +2 -2
- package/dist/manager-api/index.js +1010 -1008
- package/dist/preview/globals.cjs +21 -17
- package/dist/preview/globals.d.ts +4 -1
- package/dist/preview/globals.js +6 -2
- package/dist/preview/runtime.js +43946 -6546
- package/dist/preview-api/index.cjs +1243 -1239
- package/dist/preview-api/index.d.ts +104 -60
- package/dist/preview-api/index.js +1310 -1270
- package/dist/router/index.cjs +847 -871
- package/dist/router/index.js +193 -199
- package/dist/test/index.cjs +10068 -10205
- package/dist/test/index.d.ts +4 -4
- package/dist/test/index.js +9741 -9623
- package/dist/test/preview.cjs +15870 -0
- package/dist/test/preview.d.ts +54 -0
- package/dist/test/preview.js +14441 -0
- package/dist/test/spy.cjs +258 -0
- package/dist/test/spy.d.ts +66 -0
- package/dist/test/spy.js +240 -0
- package/dist/theming/create.cjs +79 -2269
- package/dist/theming/create.js +67 -841
- package/dist/theming/index.cjs +1065 -3232
- package/dist/theming/index.js +951 -1719
- package/dist/types/index.d.ts +242 -242
- package/package.json +134 -3
package/dist/cli/bin/index.js
CHANGED
|
@@ -4,39 +4,39 @@ import { dirname as ESM_COMPAT_dirname } from 'node:path';
|
|
|
4
4
|
const __filename = ESM_COMPAT_fileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = ESM_COMPAT_dirname(__filename);
|
|
6
6
|
const require = ESM_COMPAT_Module.createRequire(import.meta.url);
|
|
7
|
-
var
|
|
7
|
+
var Ve = Object.create;
|
|
8
8
|
var N = Object.defineProperty;
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
u" ? new Proxy(
|
|
9
|
+
var He = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var De = Object.getOwnPropertyNames;
|
|
11
|
+
var Pe = Object.getPrototypeOf, Ie = Object.prototype.hasOwnProperty;
|
|
12
|
+
var d = (n, e) => N(n, "name", { value: e, configurable: !0 }), C = /* @__PURE__ */ ((n) => typeof require < "u" ? require : typeof Proxy < "\
|
|
13
|
+
u" ? new Proxy(n, {
|
|
14
14
|
get: (e, t) => (typeof require < "u" ? require : e)[t]
|
|
15
|
-
}) :
|
|
15
|
+
}) : n)(function(n) {
|
|
16
16
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
17
|
-
throw Error('Dynamic require of "' +
|
|
17
|
+
throw Error('Dynamic require of "' + n + '" is not supported');
|
|
18
18
|
});
|
|
19
|
-
var b = (
|
|
20
|
-
var Ne = (
|
|
19
|
+
var b = (n, e) => () => (e || n((e = { exports: {} }).exports, e), e.exports);
|
|
20
|
+
var Ne = (n, e, t, i) => {
|
|
21
21
|
if (e && typeof e == "object" || typeof e == "function")
|
|
22
|
-
for (let
|
|
23
|
-
!Ie.call(
|
|
24
|
-
return
|
|
22
|
+
for (let s of De(e))
|
|
23
|
+
!Ie.call(n, s) && s !== t && N(n, s, { get: () => e[s], enumerable: !(i = He(e, s)) || i.enumerable });
|
|
24
|
+
return n;
|
|
25
25
|
};
|
|
26
|
-
var $ = (
|
|
26
|
+
var $ = (n, e, t) => (t = n != null ? Ve(Pe(n)) : {}, Ne(
|
|
27
27
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
28
|
// file that has been converted to a CommonJS file using a Babel-
|
|
29
29
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
30
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
-
e || !
|
|
32
|
-
|
|
31
|
+
e || !n || !n.__esModule ? N(t, "default", { value: n, enumerable: !0 }) : t,
|
|
32
|
+
n
|
|
33
33
|
));
|
|
34
34
|
|
|
35
35
|
// ../node_modules/commander/lib/error.js
|
|
36
36
|
var k = b((F) => {
|
|
37
|
-
var
|
|
37
|
+
var q = class extends Error {
|
|
38
38
|
static {
|
|
39
|
-
|
|
39
|
+
d(this, "CommanderError");
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Constructs the CommanderError class
|
|
@@ -48,9 +48,9 @@ var k = b((F) => {
|
|
|
48
48
|
super(i), Error.captureStackTrace(this, this.constructor), this.name = this.constructor.name, this.code = t, this.exitCode = e, this.nestedError =
|
|
49
49
|
void 0;
|
|
50
50
|
}
|
|
51
|
-
}, T = class extends
|
|
51
|
+
}, T = class extends q {
|
|
52
52
|
static {
|
|
53
|
-
|
|
53
|
+
d(this, "InvalidArgumentError");
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Constructs the InvalidArgumentError class
|
|
@@ -60,15 +60,15 @@ var k = b((F) => {
|
|
|
60
60
|
super(1, "commander.invalidArgument", e), Error.captureStackTrace(this, this.constructor), this.name = this.constructor.name;
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
-
F.CommanderError =
|
|
63
|
+
F.CommanderError = q;
|
|
64
64
|
F.InvalidArgumentError = T;
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
// ../node_modules/commander/lib/argument.js
|
|
68
|
-
var
|
|
68
|
+
var V = b((M) => {
|
|
69
69
|
var { InvalidArgumentError: Te } = k(), B = class {
|
|
70
70
|
static {
|
|
71
|
-
|
|
71
|
+
d(this, "Argument");
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Initialize a new command argument with the given name and description.
|
|
@@ -158,20 +158,20 @@ var H = b((M) => {
|
|
|
158
158
|
return this.required = !1, this;
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
-
function Fe(
|
|
162
|
-
let e =
|
|
163
|
-
return
|
|
161
|
+
function Fe(n) {
|
|
162
|
+
let e = n.name() + (n.variadic === !0 ? "..." : "");
|
|
163
|
+
return n.required ? "<" + e + ">" : "[" + e + "]";
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
d(Fe, "humanReadableArgName");
|
|
166
166
|
M.Argument = B;
|
|
167
167
|
M.humanReadableArgName = Fe;
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
// ../node_modules/commander/lib/help.js
|
|
171
171
|
var W = b((ae) => {
|
|
172
|
-
var { humanReadableArgName: Be } =
|
|
172
|
+
var { humanReadableArgName: Be } = V(), L = class {
|
|
173
173
|
static {
|
|
174
|
-
|
|
174
|
+
d(this, "Help");
|
|
175
175
|
}
|
|
176
176
|
constructor() {
|
|
177
177
|
this.helpWidth = void 0, this.sortSubcommands = !1, this.sortOptions = !1, this.showGlobalOptions = !1;
|
|
@@ -183,8 +183,8 @@ var W = b((ae) => {
|
|
|
183
183
|
* @returns {Command[]}
|
|
184
184
|
*/
|
|
185
185
|
visibleCommands(e) {
|
|
186
|
-
let t = e.commands.filter((
|
|
187
|
-
return i && !i._hidden && t.push(i), this.sortSubcommands && t.sort((
|
|
186
|
+
let t = e.commands.filter((s) => !s._hidden), i = e._getHelpCommand();
|
|
187
|
+
return i && !i._hidden && t.push(i), this.sortSubcommands && t.sort((s, r) => s.name().localeCompare(r.name())), t;
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* Compare options for sort.
|
|
@@ -194,7 +194,7 @@ var W = b((ae) => {
|
|
|
194
194
|
* @returns {number}
|
|
195
195
|
*/
|
|
196
196
|
compareOptions(e, t) {
|
|
197
|
-
let i = /* @__PURE__ */
|
|
197
|
+
let i = /* @__PURE__ */ d((s) => s.short ? s.short.replace(/^-/, "") : s.long.replace(/^--/, ""), "getSortKey");
|
|
198
198
|
return i(e).localeCompare(i(t));
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
@@ -204,12 +204,12 @@ var W = b((ae) => {
|
|
|
204
204
|
* @returns {Option[]}
|
|
205
205
|
*/
|
|
206
206
|
visibleOptions(e) {
|
|
207
|
-
let t = e.options.filter((
|
|
207
|
+
let t = e.options.filter((s) => !s.hidden), i = e._getHelpOption();
|
|
208
208
|
if (i && !i.hidden) {
|
|
209
|
-
let
|
|
210
|
-
!
|
|
209
|
+
let s = i.short && e._findOption(i.short), r = i.long && e._findOption(i.long);
|
|
210
|
+
!s && !r ? t.push(i) : i.long && !r ? t.push(
|
|
211
211
|
e.createOption(i.long, i.description)
|
|
212
|
-
) : i.short && !
|
|
212
|
+
) : i.short && !s && t.push(
|
|
213
213
|
e.createOption(i.short, i.description)
|
|
214
214
|
);
|
|
215
215
|
}
|
|
@@ -225,10 +225,10 @@ var W = b((ae) => {
|
|
|
225
225
|
if (!this.showGlobalOptions) return [];
|
|
226
226
|
let t = [];
|
|
227
227
|
for (let i = e.parent; i; i = i.parent) {
|
|
228
|
-
let
|
|
228
|
+
let s = i.options.filter(
|
|
229
229
|
(r) => !r.hidden
|
|
230
230
|
);
|
|
231
|
-
t.push(...
|
|
231
|
+
t.push(...s);
|
|
232
232
|
}
|
|
233
233
|
return this.sortOptions && t.sort(this.compareOptions), t;
|
|
234
234
|
}
|
|
@@ -280,7 +280,7 @@ var W = b((ae) => {
|
|
|
280
280
|
* @returns {number}
|
|
281
281
|
*/
|
|
282
282
|
longestSubcommandTermLength(e, t) {
|
|
283
|
-
return t.visibleCommands(e).reduce((i,
|
|
283
|
+
return t.visibleCommands(e).reduce((i, s) => Math.max(i, t.subcommandTerm(s).length), 0);
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
286
286
|
* Get the longest option term length.
|
|
@@ -290,7 +290,7 @@ var W = b((ae) => {
|
|
|
290
290
|
* @returns {number}
|
|
291
291
|
*/
|
|
292
292
|
longestOptionTermLength(e, t) {
|
|
293
|
-
return t.visibleOptions(e).reduce((i,
|
|
293
|
+
return t.visibleOptions(e).reduce((i, s) => Math.max(i, t.optionTerm(s).length), 0);
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
296
|
* Get the longest global option term length.
|
|
@@ -300,7 +300,7 @@ var W = b((ae) => {
|
|
|
300
300
|
* @returns {number}
|
|
301
301
|
*/
|
|
302
302
|
longestGlobalOptionTermLength(e, t) {
|
|
303
|
-
return t.visibleGlobalOptions(e).reduce((i,
|
|
303
|
+
return t.visibleGlobalOptions(e).reduce((i, s) => Math.max(i, t.optionTerm(s).length), 0);
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* Get the longest argument term length.
|
|
@@ -310,7 +310,7 @@ var W = b((ae) => {
|
|
|
310
310
|
* @returns {number}
|
|
311
311
|
*/
|
|
312
312
|
longestArgumentTermLength(e, t) {
|
|
313
|
-
return t.visibleArguments(e).reduce((i,
|
|
313
|
+
return t.visibleArguments(e).reduce((i, s) => Math.max(i, t.argumentTerm(s).length), 0);
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
316
316
|
* Get the command usage to be displayed at the top of the built-in help.
|
|
@@ -322,8 +322,8 @@ var W = b((ae) => {
|
|
|
322
322
|
let t = e._name;
|
|
323
323
|
e._aliases[0] && (t = t + "|" + e._aliases[0]);
|
|
324
324
|
let i = "";
|
|
325
|
-
for (let
|
|
326
|
-
i =
|
|
325
|
+
for (let s = e.parent; s; s = s.parent)
|
|
326
|
+
i = s.name() + " " + i;
|
|
327
327
|
return i + t + " " + e.usage();
|
|
328
328
|
}
|
|
329
329
|
/**
|
|
@@ -388,44 +388,44 @@ var W = b((ae) => {
|
|
|
388
388
|
* @returns {string}
|
|
389
389
|
*/
|
|
390
390
|
formatHelp(e, t) {
|
|
391
|
-
let i = t.padWidth(e, t),
|
|
391
|
+
let i = t.padWidth(e, t), s = t.helpWidth || 80, r = 2, o = 2;
|
|
392
392
|
function l(f, y) {
|
|
393
393
|
if (y) {
|
|
394
394
|
let I = `${f.padEnd(i + o)}${y}`;
|
|
395
395
|
return t.wrap(
|
|
396
396
|
I,
|
|
397
|
-
|
|
397
|
+
s - r,
|
|
398
398
|
i + o
|
|
399
399
|
);
|
|
400
400
|
}
|
|
401
401
|
return f;
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
d(l, "formatItem");
|
|
404
404
|
function a(f) {
|
|
405
405
|
return f.join(`
|
|
406
406
|
`).replace(/^/gm, " ".repeat(r));
|
|
407
407
|
}
|
|
408
|
-
|
|
409
|
-
let
|
|
410
|
-
|
|
411
|
-
t.wrap(
|
|
408
|
+
d(a, "formatList");
|
|
409
|
+
let c = [`Usage: ${t.commandUsage(e)}`, ""], u = t.commandDescription(e);
|
|
410
|
+
u.length > 0 && (c = c.concat([
|
|
411
|
+
t.wrap(u, s, 0),
|
|
412
412
|
""
|
|
413
413
|
]));
|
|
414
|
-
let
|
|
414
|
+
let p = t.visibleArguments(e).map((f) => l(
|
|
415
415
|
t.argumentTerm(f),
|
|
416
416
|
t.argumentDescription(f)
|
|
417
417
|
));
|
|
418
|
-
|
|
418
|
+
p.length > 0 && (c = c.concat(["Arguments:", a(p), ""]));
|
|
419
419
|
let m = t.visibleOptions(e).map((f) => l(
|
|
420
420
|
t.optionTerm(f),
|
|
421
421
|
t.optionDescription(f)
|
|
422
422
|
));
|
|
423
|
-
if (m.length > 0 && (
|
|
423
|
+
if (m.length > 0 && (c = c.concat(["Options:", a(m), ""])), this.showGlobalOptions) {
|
|
424
424
|
let f = t.visibleGlobalOptions(e).map((y) => l(
|
|
425
425
|
t.optionTerm(y),
|
|
426
426
|
t.optionDescription(y)
|
|
427
427
|
));
|
|
428
|
-
f.length > 0 && (
|
|
428
|
+
f.length > 0 && (c = c.concat([
|
|
429
429
|
"Global Options:",
|
|
430
430
|
a(f),
|
|
431
431
|
""
|
|
@@ -435,7 +435,7 @@ var W = b((ae) => {
|
|
|
435
435
|
t.subcommandTerm(f),
|
|
436
436
|
t.subcommandDescription(f)
|
|
437
437
|
));
|
|
438
|
-
return _.length > 0 && (
|
|
438
|
+
return _.length > 0 && (c = c.concat(["Commands:", a(_), ""])), c.join(`
|
|
439
439
|
`);
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
@@ -464,20 +464,20 @@ var W = b((ae) => {
|
|
|
464
464
|
* @return {string}
|
|
465
465
|
*
|
|
466
466
|
*/
|
|
467
|
-
wrap(e, t, i,
|
|
467
|
+
wrap(e, t, i, s = 40) {
|
|
468
468
|
let r = " \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF", o = new RegExp(`[\\n][${r}]+`);
|
|
469
469
|
if (e.match(o)) return e;
|
|
470
470
|
let l = t - i;
|
|
471
|
-
if (l <
|
|
472
|
-
let a = e.slice(0, i),
|
|
471
|
+
if (l < s) return e;
|
|
472
|
+
let a = e.slice(0, i), c = e.slice(i).replace(`\r
|
|
473
473
|
`, `
|
|
474
|
-
`),
|
|
474
|
+
`), u = " ".repeat(i), m = "\\s\u200B", _ = new RegExp(
|
|
475
475
|
`
|
|
476
476
|
|.{1,${l - 1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,
|
|
477
477
|
"g"
|
|
478
|
-
), f =
|
|
478
|
+
), f = c.match(_) || [];
|
|
479
479
|
return a + f.map((y, I) => y === `
|
|
480
|
-
` ? "" : (I > 0 ?
|
|
480
|
+
` ? "" : (I > 0 ? u : "") + y.trimEnd()).join(`
|
|
481
481
|
`);
|
|
482
482
|
}
|
|
483
483
|
};
|
|
@@ -488,7 +488,7 @@ var W = b((ae) => {
|
|
|
488
488
|
var J = b((U) => {
|
|
489
489
|
var { InvalidArgumentError: Me } = k(), R = class {
|
|
490
490
|
static {
|
|
491
|
-
|
|
491
|
+
d(this, "Option");
|
|
492
492
|
}
|
|
493
493
|
/**
|
|
494
494
|
* Initialize a new `Option` with the given `flags` and `description`.
|
|
@@ -659,7 +659,7 @@ var J = b((U) => {
|
|
|
659
659
|
}
|
|
660
660
|
}, G = class {
|
|
661
661
|
static {
|
|
662
|
-
|
|
662
|
+
d(this, "DualOptions");
|
|
663
663
|
}
|
|
664
664
|
/**
|
|
665
665
|
* @param {Option[]} options
|
|
@@ -682,74 +682,74 @@ var J = b((U) => {
|
|
|
682
682
|
valueFromOption(e, t) {
|
|
683
683
|
let i = t.attributeName();
|
|
684
684
|
if (!this.dualOptions.has(i)) return !0;
|
|
685
|
-
let
|
|
685
|
+
let s = this.negativeOptions.get(i).presetArg, r = s !== void 0 ? s : !1;
|
|
686
686
|
return t.negate === (r === e);
|
|
687
687
|
}
|
|
688
688
|
};
|
|
689
|
-
function Le(
|
|
690
|
-
return
|
|
689
|
+
function Le(n) {
|
|
690
|
+
return n.split("-").reduce((e, t) => e + t[0].toUpperCase() + t.slice(1));
|
|
691
691
|
}
|
|
692
|
-
|
|
693
|
-
function We(
|
|
694
|
-
let e, t, i =
|
|
692
|
+
d(Le, "camelcase");
|
|
693
|
+
function We(n) {
|
|
694
|
+
let e, t, i = n.split(/[ |,]+/);
|
|
695
695
|
return i.length > 1 && !/^[[<]/.test(i[1]) && (e = i.shift()), t = i.shift(), !e && /^-[^-]$/.test(t) && (e = t, t = void 0), { shortFlag: e,
|
|
696
696
|
longFlag: t };
|
|
697
697
|
}
|
|
698
|
-
|
|
698
|
+
d(We, "splitOptionFlags");
|
|
699
699
|
U.Option = R;
|
|
700
700
|
U.DualOptions = G;
|
|
701
701
|
});
|
|
702
702
|
|
|
703
703
|
// ../node_modules/commander/lib/suggestSimilar.js
|
|
704
|
-
var
|
|
705
|
-
function Re(
|
|
706
|
-
if (Math.abs(
|
|
707
|
-
return Math.max(
|
|
704
|
+
var de = b((le) => {
|
|
705
|
+
function Re(n, e) {
|
|
706
|
+
if (Math.abs(n.length - e.length) > 3)
|
|
707
|
+
return Math.max(n.length, e.length);
|
|
708
708
|
let t = [];
|
|
709
|
-
for (let i = 0; i <=
|
|
709
|
+
for (let i = 0; i <= n.length; i++)
|
|
710
710
|
t[i] = [i];
|
|
711
711
|
for (let i = 0; i <= e.length; i++)
|
|
712
712
|
t[0][i] = i;
|
|
713
713
|
for (let i = 1; i <= e.length; i++)
|
|
714
|
-
for (let
|
|
714
|
+
for (let s = 1; s <= n.length; s++) {
|
|
715
715
|
let r = 1;
|
|
716
|
-
s
|
|
717
|
-
t[
|
|
716
|
+
n[s - 1] === e[i - 1] ? r = 0 : r = 1, t[s][i] = Math.min(
|
|
717
|
+
t[s - 1][i] + 1,
|
|
718
718
|
// deletion
|
|
719
|
-
t[
|
|
719
|
+
t[s][i - 1] + 1,
|
|
720
720
|
// insertion
|
|
721
|
-
t[
|
|
721
|
+
t[s - 1][i - 1] + r
|
|
722
722
|
// substitution
|
|
723
|
-
),
|
|
723
|
+
), s > 1 && i > 1 && n[s - 1] === e[i - 2] && n[s - 2] === e[i - 1] && (t[s][i] = Math.min(t[s][i], t[s - 2][i - 2] + 1));
|
|
724
724
|
}
|
|
725
|
-
return t[
|
|
725
|
+
return t[n.length][e.length];
|
|
726
726
|
}
|
|
727
|
-
|
|
728
|
-
function Ge(
|
|
727
|
+
d(Re, "editDistance");
|
|
728
|
+
function Ge(n, e) {
|
|
729
729
|
if (!e || e.length === 0) return "";
|
|
730
730
|
e = Array.from(new Set(e));
|
|
731
|
-
let t =
|
|
732
|
-
t && (
|
|
733
|
-
let i = [],
|
|
731
|
+
let t = n.startsWith("--");
|
|
732
|
+
t && (n = n.slice(2), e = e.map((o) => o.slice(2)));
|
|
733
|
+
let i = [], s = 3, r = 0.4;
|
|
734
734
|
return e.forEach((o) => {
|
|
735
735
|
if (o.length <= 1) return;
|
|
736
|
-
let l = Re(
|
|
737
|
-
(a - l) / a > r && (l <
|
|
736
|
+
let l = Re(n, o), a = Math.max(n.length, o.length);
|
|
737
|
+
(a - l) / a > r && (l < s ? (s = l, i = [o]) : l === s && i.push(o));
|
|
738
738
|
}), i.sort((o, l) => o.localeCompare(l)), t && (i = i.map((o) => `--${o}`)), i.length > 1 ? `
|
|
739
739
|
(Did you mean one of ${i.join(", ")}?)` : i.length === 1 ? `
|
|
740
740
|
(Did you mean ${i[0]}?)` : "";
|
|
741
741
|
}
|
|
742
|
-
|
|
742
|
+
d(Ge, "suggestSimilar");
|
|
743
743
|
le.suggestSimilar = Ge;
|
|
744
744
|
});
|
|
745
745
|
|
|
746
746
|
// ../node_modules/commander/lib/command.js
|
|
747
|
-
var me = b((
|
|
748
|
-
var Ue = C("node:events").EventEmitter, Y = C("node:child_process"), x = C("node:path"), z = C("node:fs"),
|
|
749
|
-
humanReadableArgName: Ye } =
|
|
750
|
-
Q = class
|
|
747
|
+
var me = b((he) => {
|
|
748
|
+
var Ue = C("node:events").EventEmitter, Y = C("node:child_process"), x = C("node:path"), z = C("node:fs"), h = C("node:process"), { Argument: Je,
|
|
749
|
+
humanReadableArgName: Ye } = V(), { CommanderError: K } = k(), { Help: ze } = W(), { Option: ce, DualOptions: Ke } = J(), { suggestSimilar: ue } = de(),
|
|
750
|
+
Q = class n extends Ue {
|
|
751
751
|
static {
|
|
752
|
-
|
|
752
|
+
d(this, "Command");
|
|
753
753
|
}
|
|
754
754
|
/**
|
|
755
755
|
* Initialize a new `Command`.
|
|
@@ -764,11 +764,11 @@ var me = b((pe) => {
|
|
|
764
764
|
null, this._aliases = [], this._combineFlagAndOptionalValue = !0, this._description = "", this._summary = "", this._argsDescription = void 0,
|
|
765
765
|
this._enablePositionalOptions = !1, this._passThroughOptions = !1, this._lifeCycleHooks = {}, this._showHelpAfterError = !1, this._showSuggestionAfterError =
|
|
766
766
|
!0, this._outputConfiguration = {
|
|
767
|
-
writeOut: /* @__PURE__ */
|
|
768
|
-
writeErr: /* @__PURE__ */
|
|
769
|
-
getOutHelpWidth: /* @__PURE__ */
|
|
770
|
-
getErrHelpWidth: /* @__PURE__ */
|
|
771
|
-
outputError: /* @__PURE__ */
|
|
767
|
+
writeOut: /* @__PURE__ */ d((t) => h.stdout.write(t), "writeOut"),
|
|
768
|
+
writeErr: /* @__PURE__ */ d((t) => h.stderr.write(t), "writeErr"),
|
|
769
|
+
getOutHelpWidth: /* @__PURE__ */ d(() => h.stdout.isTTY ? h.stdout.columns : void 0, "getOutHelpWidth"),
|
|
770
|
+
getErrHelpWidth: /* @__PURE__ */ d(() => h.stderr.isTTY ? h.stderr.columns : void 0, "getErrHelpWidth"),
|
|
771
|
+
outputError: /* @__PURE__ */ d((t, i) => i(t), "outputError")
|
|
772
772
|
}, this._hidden = !1, this._helpOption = void 0, this._addImplicitHelpCommand = void 0, this._helpCommand = void 0, this._helpConfiguration =
|
|
773
773
|
{};
|
|
774
774
|
}
|
|
@@ -822,12 +822,12 @@ var me = b((pe) => {
|
|
|
822
822
|
* @return {Command} returns new command for action handler, or `this` for executable command
|
|
823
823
|
*/
|
|
824
824
|
command(e, t, i) {
|
|
825
|
-
let
|
|
826
|
-
typeof
|
|
825
|
+
let s = t, r = i;
|
|
826
|
+
typeof s == "object" && s !== null && (r = s, s = null), r = r || {};
|
|
827
827
|
let [, o, l] = e.match(/([^ ]+) *(.*)/), a = this.createCommand(o);
|
|
828
|
-
return
|
|
828
|
+
return s && (a.description(s), a._executableHandler = !0), r.isDefault && (this._defaultCommandName = a._name), a._hidden = !!(r.noHelp ||
|
|
829
829
|
r.hidden), a._executableFile = r.executableFile || null, l && a.arguments(l), this._registerCommand(a), a.parent = this, a.copyInheritedSettings(
|
|
830
|
-
this),
|
|
830
|
+
this), s ? this : a;
|
|
831
831
|
}
|
|
832
832
|
/**
|
|
833
833
|
* Factory routine to create a new unattached command.
|
|
@@ -839,7 +839,7 @@ var me = b((pe) => {
|
|
|
839
839
|
* @return {Command} new command
|
|
840
840
|
*/
|
|
841
841
|
createCommand(e) {
|
|
842
|
-
return new
|
|
842
|
+
return new n(e);
|
|
843
843
|
}
|
|
844
844
|
/**
|
|
845
845
|
* You can customise the help with a subclass of Help by overriding createHelp,
|
|
@@ -944,9 +944,9 @@ var me = b((pe) => {
|
|
|
944
944
|
* @param {*} [defaultValue]
|
|
945
945
|
* @return {Command} `this` command for chaining
|
|
946
946
|
*/
|
|
947
|
-
argument(e, t, i,
|
|
947
|
+
argument(e, t, i, s) {
|
|
948
948
|
let r = this.createArgument(e, t);
|
|
949
|
-
return typeof i == "function" ? r.default(
|
|
949
|
+
return typeof i == "function" ? r.default(s).argParser(i) : r.default(i), this.addArgument(r), this;
|
|
950
950
|
}
|
|
951
951
|
/**
|
|
952
952
|
* Define argument syntax for command, adding multiple at once (without descriptions).
|
|
@@ -999,8 +999,8 @@ var me = b((pe) => {
|
|
|
999
999
|
if (typeof e == "boolean")
|
|
1000
1000
|
return this._addImplicitHelpCommand = e, this;
|
|
1001
1001
|
e = e ?? "help [command]";
|
|
1002
|
-
let [, i,
|
|
1003
|
-
return o.helpOption(!1),
|
|
1002
|
+
let [, i, s] = e.match(/([^ ]+) *(.*)/), r = t ?? "display help for command", o = this.createCommand(i);
|
|
1003
|
+
return o.helpOption(!1), s && o.arguments(s), r && o.description(r), this._addImplicitHelpCommand = !0, this._helpCommand = o, this;
|
|
1004
1004
|
}
|
|
1005
1005
|
/**
|
|
1006
1006
|
* Add prepared custom help command.
|
|
@@ -1058,7 +1058,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1058
1058
|
* @private
|
|
1059
1059
|
*/
|
|
1060
1060
|
_exit(e, t, i) {
|
|
1061
|
-
this._exitCallback && this._exitCallback(new K(e, t, i)),
|
|
1061
|
+
this._exitCallback && this._exitCallback(new K(e, t, i)), h.exit(e);
|
|
1062
1062
|
}
|
|
1063
1063
|
/**
|
|
1064
1064
|
* Register callback `fn` for the command.
|
|
@@ -1075,9 +1075,9 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1075
1075
|
* @return {Command} `this` command for chaining
|
|
1076
1076
|
*/
|
|
1077
1077
|
action(e) {
|
|
1078
|
-
let t = /* @__PURE__ */
|
|
1079
|
-
let
|
|
1080
|
-
return this._storeOptionsAsProperties ? r[
|
|
1078
|
+
let t = /* @__PURE__ */ d((i) => {
|
|
1079
|
+
let s = this.registeredArguments.length, r = i.slice(0, s);
|
|
1080
|
+
return this._storeOptionsAsProperties ? r[s] = this : r[s] = this.opts(), r.push(this), e.apply(this, r);
|
|
1081
1081
|
}, "listener");
|
|
1082
1082
|
return this._actionHandler = t, this;
|
|
1083
1083
|
}
|
|
@@ -1092,7 +1092,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1092
1092
|
* @return {Option} new option
|
|
1093
1093
|
*/
|
|
1094
1094
|
createOption(e, t) {
|
|
1095
|
-
return new
|
|
1095
|
+
return new ce(e, t);
|
|
1096
1096
|
}
|
|
1097
1097
|
/**
|
|
1098
1098
|
* Wrap parseArgs to catch 'commander.invalidArgument'.
|
|
@@ -1103,12 +1103,12 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1103
1103
|
* @param {string} invalidArgumentMessage
|
|
1104
1104
|
* @private
|
|
1105
1105
|
*/
|
|
1106
|
-
_callParseArg(e, t, i,
|
|
1106
|
+
_callParseArg(e, t, i, s) {
|
|
1107
1107
|
try {
|
|
1108
1108
|
return e.parseArg(t, i);
|
|
1109
1109
|
} catch (r) {
|
|
1110
1110
|
if (r.code === "commander.invalidArgument") {
|
|
1111
|
-
let o = `${
|
|
1111
|
+
let o = `${s} ${r.message}`;
|
|
1112
1112
|
this.error(o, { exitCode: r.exitCode, code: r.code });
|
|
1113
1113
|
}
|
|
1114
1114
|
throw r;
|
|
@@ -1138,13 +1138,13 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1138
1138
|
* @private
|
|
1139
1139
|
*/
|
|
1140
1140
|
_registerCommand(e) {
|
|
1141
|
-
let t = /* @__PURE__ */
|
|
1142
|
-
(
|
|
1141
|
+
let t = /* @__PURE__ */ d((s) => [s.name()].concat(s.aliases()), "knownBy"), i = t(e).find(
|
|
1142
|
+
(s) => this._findCommand(s)
|
|
1143
1143
|
);
|
|
1144
1144
|
if (i) {
|
|
1145
|
-
let
|
|
1145
|
+
let s = t(this._findCommand(i)).join("|"), r = t(e).join("|");
|
|
1146
1146
|
throw new Error(
|
|
1147
|
-
`cannot add command '${r}' as already have command '${
|
|
1147
|
+
`cannot add command '${r}' as already have command '${s}'`
|
|
1148
1148
|
);
|
|
1149
1149
|
}
|
|
1150
1150
|
this.commands.push(e);
|
|
@@ -1166,7 +1166,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1166
1166
|
"default"
|
|
1167
1167
|
);
|
|
1168
1168
|
} else e.defaultValue !== void 0 && this.setOptionValueWithSource(i, e.defaultValue, "default");
|
|
1169
|
-
let
|
|
1169
|
+
let s = /* @__PURE__ */ d((r, o, l) => {
|
|
1170
1170
|
r == null && e.presetArg !== void 0 && (r = e.presetArg);
|
|
1171
1171
|
let a = this.getOptionValue(i);
|
|
1172
1172
|
r !== null && e.parseArg ? r = this._callParseArg(e, r, a, o) : r !== null && e.variadic && (r = e._concatValue(r, a)), r == null &&
|
|
@@ -1174,10 +1174,10 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1174
1174
|
}, "handleOptionValue");
|
|
1175
1175
|
return this.on("option:" + t, (r) => {
|
|
1176
1176
|
let o = `error: option '${e.flags}' argument '${r}' is invalid.`;
|
|
1177
|
-
|
|
1177
|
+
s(r, o, "cli");
|
|
1178
1178
|
}), e.envVar && this.on("optionEnv:" + t, (r) => {
|
|
1179
1179
|
let o = `error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;
|
|
1180
|
-
|
|
1180
|
+
s(r, o, "env");
|
|
1181
1181
|
}), this;
|
|
1182
1182
|
}
|
|
1183
1183
|
/**
|
|
@@ -1186,22 +1186,22 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1186
1186
|
* @return {Command} `this` command for chaining
|
|
1187
1187
|
* @private
|
|
1188
1188
|
*/
|
|
1189
|
-
_optionEx(e, t, i,
|
|
1190
|
-
if (typeof t == "object" && t instanceof
|
|
1189
|
+
_optionEx(e, t, i, s, r) {
|
|
1190
|
+
if (typeof t == "object" && t instanceof ce)
|
|
1191
1191
|
throw new Error(
|
|
1192
1192
|
"To add an Option object use addOption() instead of option() or requiredOption()"
|
|
1193
1193
|
);
|
|
1194
1194
|
let o = this.createOption(t, i);
|
|
1195
|
-
if (o.makeOptionMandatory(!!e.mandatory), typeof
|
|
1196
|
-
o.default(r).argParser(
|
|
1197
|
-
else if (
|
|
1198
|
-
let l =
|
|
1199
|
-
|
|
1200
|
-
let
|
|
1201
|
-
return
|
|
1202
|
-
}, "fn"), o.default(r).argParser(
|
|
1195
|
+
if (o.makeOptionMandatory(!!e.mandatory), typeof s == "function")
|
|
1196
|
+
o.default(r).argParser(s);
|
|
1197
|
+
else if (s instanceof RegExp) {
|
|
1198
|
+
let l = s;
|
|
1199
|
+
s = /* @__PURE__ */ d((a, c) => {
|
|
1200
|
+
let u = l.exec(a);
|
|
1201
|
+
return u ? u[0] : c;
|
|
1202
|
+
}, "fn"), o.default(r).argParser(s);
|
|
1203
1203
|
} else
|
|
1204
|
-
o.default(
|
|
1204
|
+
o.default(s);
|
|
1205
1205
|
return this.addOption(o);
|
|
1206
1206
|
}
|
|
1207
1207
|
/**
|
|
@@ -1225,8 +1225,8 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1225
1225
|
* @param {*} [defaultValue]
|
|
1226
1226
|
* @return {Command} `this` command for chaining
|
|
1227
1227
|
*/
|
|
1228
|
-
option(e, t, i,
|
|
1229
|
-
return this._optionEx({}, e, t, i,
|
|
1228
|
+
option(e, t, i, s) {
|
|
1229
|
+
return this._optionEx({}, e, t, i, s);
|
|
1230
1230
|
}
|
|
1231
1231
|
/**
|
|
1232
1232
|
* Add a required option which must have a value after parsing. This usually means
|
|
@@ -1240,13 +1240,13 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1240
1240
|
* @param {*} [defaultValue]
|
|
1241
1241
|
* @return {Command} `this` command for chaining
|
|
1242
1242
|
*/
|
|
1243
|
-
requiredOption(e, t, i,
|
|
1243
|
+
requiredOption(e, t, i, s) {
|
|
1244
1244
|
return this._optionEx(
|
|
1245
1245
|
{ mandatory: !0 },
|
|
1246
1246
|
e,
|
|
1247
1247
|
t,
|
|
1248
1248
|
i,
|
|
1249
|
-
|
|
1249
|
+
s
|
|
1250
1250
|
);
|
|
1251
1251
|
}
|
|
1252
1252
|
/**
|
|
@@ -1392,11 +1392,11 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1392
1392
|
if (e !== void 0 && !Array.isArray(e))
|
|
1393
1393
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1394
1394
|
if (t = t || {}, e === void 0 && t.from === void 0) {
|
|
1395
|
-
|
|
1396
|
-
let
|
|
1397
|
-
(
|
|
1395
|
+
h.versions?.electron && (t.from = "electron");
|
|
1396
|
+
let s = h.execArgv ?? [];
|
|
1397
|
+
(s.includes("-e") || s.includes("--eval") || s.includes("-p") || s.includes("--print")) && (t.from = "eval");
|
|
1398
1398
|
}
|
|
1399
|
-
e === void 0 && (e =
|
|
1399
|
+
e === void 0 && (e = h.argv), this.rawArgs = e.slice();
|
|
1400
1400
|
let i;
|
|
1401
1401
|
switch (t.from) {
|
|
1402
1402
|
case void 0:
|
|
@@ -1404,7 +1404,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1404
1404
|
this._scriptPath = e[1], i = e.slice(2);
|
|
1405
1405
|
break;
|
|
1406
1406
|
case "electron":
|
|
1407
|
-
|
|
1407
|
+
h.defaultApp ? (this._scriptPath = e[1], i = e.slice(2)) : i = e.slice(1);
|
|
1408
1408
|
break;
|
|
1409
1409
|
case "user":
|
|
1410
1410
|
i = e.slice(0);
|
|
@@ -1476,82 +1476,82 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1476
1476
|
*/
|
|
1477
1477
|
_executeSubCommand(e, t) {
|
|
1478
1478
|
t = t.slice();
|
|
1479
|
-
let i = !1,
|
|
1480
|
-
function r(
|
|
1481
|
-
let m = x.resolve(
|
|
1479
|
+
let i = !1, s = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1480
|
+
function r(u, p) {
|
|
1481
|
+
let m = x.resolve(u, p);
|
|
1482
1482
|
if (z.existsSync(m)) return m;
|
|
1483
|
-
if (
|
|
1484
|
-
let _ =
|
|
1483
|
+
if (s.includes(x.extname(p))) return;
|
|
1484
|
+
let _ = s.find(
|
|
1485
1485
|
(f) => z.existsSync(`${m}${f}`)
|
|
1486
1486
|
);
|
|
1487
1487
|
if (_) return `${m}${_}`;
|
|
1488
1488
|
}
|
|
1489
|
-
|
|
1489
|
+
d(r, "findFile"), this._checkForMissingMandatoryOptions(), this._checkForConflictingOptions();
|
|
1490
1490
|
let o = e._executableFile || `${this._name}-${e._name}`, l = this._executableDir || "";
|
|
1491
1491
|
if (this._scriptPath) {
|
|
1492
|
-
let
|
|
1492
|
+
let u;
|
|
1493
1493
|
try {
|
|
1494
|
-
|
|
1494
|
+
u = z.realpathSync(this._scriptPath);
|
|
1495
1495
|
} catch {
|
|
1496
|
-
|
|
1496
|
+
u = this._scriptPath;
|
|
1497
1497
|
}
|
|
1498
1498
|
l = x.resolve(
|
|
1499
|
-
x.dirname(
|
|
1499
|
+
x.dirname(u),
|
|
1500
1500
|
l
|
|
1501
1501
|
);
|
|
1502
1502
|
}
|
|
1503
1503
|
if (l) {
|
|
1504
|
-
let
|
|
1505
|
-
if (!
|
|
1506
|
-
let
|
|
1504
|
+
let u = r(l, o);
|
|
1505
|
+
if (!u && !e._executableFile && this._scriptPath) {
|
|
1506
|
+
let p = x.basename(
|
|
1507
1507
|
this._scriptPath,
|
|
1508
1508
|
x.extname(this._scriptPath)
|
|
1509
1509
|
);
|
|
1510
|
-
|
|
1510
|
+
p !== this._name && (u = r(
|
|
1511
1511
|
l,
|
|
1512
|
-
`${
|
|
1512
|
+
`${p}-${e._name}`
|
|
1513
1513
|
));
|
|
1514
1514
|
}
|
|
1515
|
-
o =
|
|
1515
|
+
o = u || o;
|
|
1516
1516
|
}
|
|
1517
|
-
i =
|
|
1517
|
+
i = s.includes(x.extname(o));
|
|
1518
1518
|
let a;
|
|
1519
|
-
|
|
1520
|
-
o, t, { stdio: "inherit" }) : (t.unshift(o), t =
|
|
1521
|
-
["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"].forEach((
|
|
1522
|
-
|
|
1523
|
-
a.killed === !1 && a.exitCode === null && a.kill(
|
|
1519
|
+
h.platform !== "win32" ? i ? (t.unshift(o), t = pe(h.execArgv).concat(t), a = Y.spawn(h.argv[0], t, { stdio: "inherit" })) : a = Y.spawn(
|
|
1520
|
+
o, t, { stdio: "inherit" }) : (t.unshift(o), t = pe(h.execArgv).concat(t), a = Y.spawn(h.execPath, t, { stdio: "inherit" })), a.killed ||
|
|
1521
|
+
["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"].forEach((p) => {
|
|
1522
|
+
h.on(p, () => {
|
|
1523
|
+
a.killed === !1 && a.exitCode === null && a.kill(p);
|
|
1524
1524
|
});
|
|
1525
1525
|
});
|
|
1526
|
-
let
|
|
1527
|
-
a.on("close", (
|
|
1528
|
-
|
|
1526
|
+
let c = this._exitCallback;
|
|
1527
|
+
a.on("close", (u) => {
|
|
1528
|
+
u = u ?? 1, c ? c(
|
|
1529
1529
|
new K(
|
|
1530
|
-
|
|
1530
|
+
u,
|
|
1531
1531
|
"commander.executeSubCommandAsync",
|
|
1532
1532
|
"(close)"
|
|
1533
1533
|
)
|
|
1534
|
-
) :
|
|
1535
|
-
}), a.on("error", (
|
|
1536
|
-
if (
|
|
1537
|
-
let
|
|
1534
|
+
) : h.exit(u);
|
|
1535
|
+
}), a.on("error", (u) => {
|
|
1536
|
+
if (u.code === "ENOENT") {
|
|
1537
|
+
let p = l ? `searched for local subcommand relative to directory '${l}'` : "no directory for search for local subcommand, use .exe\
|
|
1538
1538
|
cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
1539
1539
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\
|
|
1540
1540
|
|
|
1541
1541
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
1542
|
-
- ${
|
|
1542
|
+
- ${p}`;
|
|
1543
1543
|
throw new Error(m);
|
|
1544
|
-
} else if (
|
|
1544
|
+
} else if (u.code === "EACCES")
|
|
1545
1545
|
throw new Error(`'${o}' not executable`);
|
|
1546
|
-
if (!
|
|
1547
|
-
|
|
1546
|
+
if (!c)
|
|
1547
|
+
h.exit(1);
|
|
1548
1548
|
else {
|
|
1549
|
-
let
|
|
1549
|
+
let p = new K(
|
|
1550
1550
|
1,
|
|
1551
1551
|
"commander.executeSubCommandAsync",
|
|
1552
1552
|
"(error)"
|
|
1553
1553
|
);
|
|
1554
|
-
|
|
1554
|
+
p.nestedError = u, c(p);
|
|
1555
1555
|
}
|
|
1556
1556
|
}), this.runningCommand = a;
|
|
1557
1557
|
}
|
|
@@ -1559,18 +1559,18 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1559
1559
|
* @private
|
|
1560
1560
|
*/
|
|
1561
1561
|
_dispatchSubcommand(e, t, i) {
|
|
1562
|
-
let
|
|
1563
|
-
|
|
1562
|
+
let s = this._findCommand(e);
|
|
1563
|
+
s || this.help({ error: !0 });
|
|
1564
1564
|
let r;
|
|
1565
1565
|
return r = this._chainOrCallSubCommandHook(
|
|
1566
1566
|
r,
|
|
1567
|
-
|
|
1567
|
+
s,
|
|
1568
1568
|
"preSubcommand"
|
|
1569
1569
|
), r = this._chainOrCall(r, () => {
|
|
1570
|
-
if (
|
|
1571
|
-
this._executeSubCommand(
|
|
1570
|
+
if (s._executableHandler)
|
|
1571
|
+
this._executeSubCommand(s, t.concat(i));
|
|
1572
1572
|
else
|
|
1573
|
-
return
|
|
1573
|
+
return s._parseCommand(t, i);
|
|
1574
1574
|
}), r;
|
|
1575
1575
|
}
|
|
1576
1576
|
/**
|
|
@@ -1605,13 +1605,13 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1605
1605
|
* @private
|
|
1606
1606
|
*/
|
|
1607
1607
|
_processArguments() {
|
|
1608
|
-
let e = /* @__PURE__ */
|
|
1609
|
-
let o =
|
|
1610
|
-
if (
|
|
1611
|
-
let l = `error: command-argument value '${
|
|
1608
|
+
let e = /* @__PURE__ */ d((i, s, r) => {
|
|
1609
|
+
let o = s;
|
|
1610
|
+
if (s !== null && i.parseArg) {
|
|
1611
|
+
let l = `error: command-argument value '${s}' is invalid for argument '${i.name()}'.`;
|
|
1612
1612
|
o = this._callParseArg(
|
|
1613
1613
|
i,
|
|
1614
|
-
|
|
1614
|
+
s,
|
|
1615
1615
|
r,
|
|
1616
1616
|
l
|
|
1617
1617
|
);
|
|
@@ -1620,10 +1620,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1620
1620
|
}, "myParseArg");
|
|
1621
1621
|
this._checkNumberOfArguments();
|
|
1622
1622
|
let t = [];
|
|
1623
|
-
this.registeredArguments.forEach((i,
|
|
1623
|
+
this.registeredArguments.forEach((i, s) => {
|
|
1624
1624
|
let r = i.defaultValue;
|
|
1625
|
-
i.variadic ?
|
|
1626
|
-
void 0 && (r = []) :
|
|
1625
|
+
i.variadic ? s < this.args.length ? (r = this.args.slice(s), i.parseArg && (r = r.reduce((o, l) => e(i, l, o), i.defaultValue))) : r ===
|
|
1626
|
+
void 0 && (r = []) : s < this.args.length && (r = this.args[s], i.parseArg && (r = e(i, r, i.defaultValue))), t[s] = r;
|
|
1627
1627
|
}), this.processedArgs = t;
|
|
1628
1628
|
}
|
|
1629
1629
|
/**
|
|
@@ -1645,12 +1645,12 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1645
1645
|
* @private
|
|
1646
1646
|
*/
|
|
1647
1647
|
_chainOrCallHooks(e, t) {
|
|
1648
|
-
let i = e,
|
|
1648
|
+
let i = e, s = [];
|
|
1649
1649
|
return this._getCommandAndAncestors().reverse().filter((r) => r._lifeCycleHooks[t] !== void 0).forEach((r) => {
|
|
1650
1650
|
r._lifeCycleHooks[t].forEach((o) => {
|
|
1651
|
-
|
|
1651
|
+
s.push({ hookedCommand: r, callback: o });
|
|
1652
1652
|
});
|
|
1653
|
-
}), t === "postAction" &&
|
|
1653
|
+
}), t === "postAction" && s.reverse(), s.forEach((r) => {
|
|
1654
1654
|
i = this._chainOrCall(i, () => r.callback(r.hookedCommand, this));
|
|
1655
1655
|
}), i;
|
|
1656
1656
|
}
|
|
@@ -1663,10 +1663,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1663
1663
|
* @private
|
|
1664
1664
|
*/
|
|
1665
1665
|
_chainOrCallSubCommandHook(e, t, i) {
|
|
1666
|
-
let
|
|
1666
|
+
let s = e;
|
|
1667
1667
|
return this._lifeCycleHooks[i] !== void 0 && this._lifeCycleHooks[i].forEach((r) => {
|
|
1668
|
-
|
|
1669
|
-
}),
|
|
1668
|
+
s = this._chainOrCall(s, () => r(this, t));
|
|
1669
|
+
}), s;
|
|
1670
1670
|
}
|
|
1671
1671
|
/**
|
|
1672
1672
|
* Process arguments in context of this command.
|
|
@@ -1689,11 +1689,11 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1689
1689
|
);
|
|
1690
1690
|
this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName && this.help({ error: !0 }), this.
|
|
1691
1691
|
_outputHelpIfRequested(i.unknown), this._checkForMissingMandatoryOptions(), this._checkForConflictingOptions();
|
|
1692
|
-
let
|
|
1692
|
+
let s = /* @__PURE__ */ d(() => {
|
|
1693
1693
|
i.unknown.length > 0 && this.unknownOption(i.unknown[0]);
|
|
1694
1694
|
}, "checkForUnknownOptions"), r = `command:${this.name()}`;
|
|
1695
1695
|
if (this._actionHandler) {
|
|
1696
|
-
|
|
1696
|
+
s(), this._processArguments();
|
|
1697
1697
|
let o;
|
|
1698
1698
|
return o = this._chainOrCallHooks(o, "preAction"), o = this._chainOrCall(
|
|
1699
1699
|
o,
|
|
@@ -1703,12 +1703,12 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1703
1703
|
})), o = this._chainOrCallHooks(o, "postAction"), o;
|
|
1704
1704
|
}
|
|
1705
1705
|
if (this.parent && this.parent.listenerCount(r))
|
|
1706
|
-
|
|
1706
|
+
s(), this._processArguments(), this.parent.emit(r, e, t);
|
|
1707
1707
|
else if (e.length) {
|
|
1708
1708
|
if (this._findCommand("*"))
|
|
1709
1709
|
return this._dispatchSubcommand("*", e, t);
|
|
1710
|
-
this.listenerCount("command:*") ? this.emit("command:*", e, t) : this.commands.length ? this.unknownCommand() : (
|
|
1711
|
-
} else this.commands.length ? (
|
|
1710
|
+
this.listenerCount("command:*") ? this.emit("command:*", e, t) : this.commands.length ? this.unknownCommand() : (s(), this._processArguments());
|
|
1711
|
+
} else this.commands.length ? (s(), this.help({ error: !0 })) : (s(), this._processArguments());
|
|
1712
1712
|
}
|
|
1713
1713
|
/**
|
|
1714
1714
|
* Find matching command.
|
|
@@ -1752,16 +1752,16 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1752
1752
|
*/
|
|
1753
1753
|
_checkForConflictingLocalOptions() {
|
|
1754
1754
|
let e = this.options.filter((i) => {
|
|
1755
|
-
let
|
|
1756
|
-
return this.getOptionValue(
|
|
1755
|
+
let s = i.attributeName();
|
|
1756
|
+
return this.getOptionValue(s) === void 0 ? !1 : this.getOptionValueSource(s) !== "default";
|
|
1757
1757
|
});
|
|
1758
1758
|
e.filter(
|
|
1759
1759
|
(i) => i.conflictsWith.length > 0
|
|
1760
1760
|
).forEach((i) => {
|
|
1761
|
-
let
|
|
1761
|
+
let s = e.find(
|
|
1762
1762
|
(r) => i.conflictsWith.includes(r.attributeName())
|
|
1763
1763
|
);
|
|
1764
|
-
|
|
1764
|
+
s && this._conflictingOption(i, s);
|
|
1765
1765
|
});
|
|
1766
1766
|
}
|
|
1767
1767
|
/**
|
|
@@ -1791,16 +1791,16 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1791
1791
|
* @return {{operands: string[], unknown: string[]}}
|
|
1792
1792
|
*/
|
|
1793
1793
|
parseOptions(e) {
|
|
1794
|
-
let t = [], i = [],
|
|
1794
|
+
let t = [], i = [], s = t, r = e.slice();
|
|
1795
1795
|
function o(a) {
|
|
1796
1796
|
return a.length > 1 && a[0] === "-";
|
|
1797
1797
|
}
|
|
1798
|
-
|
|
1798
|
+
d(o, "maybeOption");
|
|
1799
1799
|
let l = null;
|
|
1800
1800
|
for (; r.length; ) {
|
|
1801
1801
|
let a = r.shift();
|
|
1802
1802
|
if (a === "--") {
|
|
1803
|
-
|
|
1803
|
+
s === i && s.push(a), s.push(...r);
|
|
1804
1804
|
break;
|
|
1805
1805
|
}
|
|
1806
1806
|
if (l && !o(a)) {
|
|
@@ -1808,36 +1808,36 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1808
1808
|
continue;
|
|
1809
1809
|
}
|
|
1810
1810
|
if (l = null, o(a)) {
|
|
1811
|
-
let
|
|
1812
|
-
if (
|
|
1813
|
-
if (
|
|
1814
|
-
let
|
|
1815
|
-
|
|
1816
|
-
} else if (
|
|
1817
|
-
let
|
|
1818
|
-
r.length > 0 && !o(r[0]) && (
|
|
1811
|
+
let c = this._findOption(a);
|
|
1812
|
+
if (c) {
|
|
1813
|
+
if (c.required) {
|
|
1814
|
+
let u = r.shift();
|
|
1815
|
+
u === void 0 && this.optionMissingArgument(c), this.emit(`option:${c.name()}`, u);
|
|
1816
|
+
} else if (c.optional) {
|
|
1817
|
+
let u = null;
|
|
1818
|
+
r.length > 0 && !o(r[0]) && (u = r.shift()), this.emit(`option:${c.name()}`, u);
|
|
1819
1819
|
} else
|
|
1820
|
-
this.emit(`option:${
|
|
1821
|
-
l =
|
|
1820
|
+
this.emit(`option:${c.name()}`);
|
|
1821
|
+
l = c.variadic ? c : null;
|
|
1822
1822
|
continue;
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
1825
|
if (a.length > 2 && a[0] === "-" && a[1] !== "-") {
|
|
1826
|
-
let
|
|
1827
|
-
if (
|
|
1828
|
-
|
|
1829
|
-
:${
|
|
1826
|
+
let c = this._findOption(`-${a[1]}`);
|
|
1827
|
+
if (c) {
|
|
1828
|
+
c.required || c.optional && this._combineFlagAndOptionalValue ? this.emit(`option:${c.name()}`, a.slice(2)) : (this.emit(`option\
|
|
1829
|
+
:${c.name()}`), r.unshift(`-${a.slice(2)}`));
|
|
1830
1830
|
continue;
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
1833
1833
|
if (/^--[^=]+=/.test(a)) {
|
|
1834
|
-
let
|
|
1835
|
-
if (
|
|
1836
|
-
this.emit(`option:${
|
|
1834
|
+
let c = a.indexOf("="), u = this._findOption(a.slice(0, c));
|
|
1835
|
+
if (u && (u.required || u.optional)) {
|
|
1836
|
+
this.emit(`option:${u.name()}`, a.slice(c + 1));
|
|
1837
1837
|
continue;
|
|
1838
1838
|
}
|
|
1839
1839
|
}
|
|
1840
|
-
if (o(a) && (
|
|
1840
|
+
if (o(a) && (s = i), (this._enablePositionalOptions || this._passThroughOptions) && t.length === 0 && i.length === 0) {
|
|
1841
1841
|
if (this._findCommand(a)) {
|
|
1842
1842
|
t.push(a), r.length > 0 && i.push(...r);
|
|
1843
1843
|
break;
|
|
@@ -1850,10 +1850,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1850
1850
|
}
|
|
1851
1851
|
}
|
|
1852
1852
|
if (this._passThroughOptions) {
|
|
1853
|
-
|
|
1853
|
+
s.push(a), r.length > 0 && s.push(...r);
|
|
1854
1854
|
break;
|
|
1855
1855
|
}
|
|
1856
|
-
|
|
1856
|
+
s.push(a);
|
|
1857
1857
|
}
|
|
1858
1858
|
return { operands: t, unknown: i };
|
|
1859
1859
|
}
|
|
@@ -1866,8 +1866,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1866
1866
|
if (this._storeOptionsAsProperties) {
|
|
1867
1867
|
let e = {}, t = this.options.length;
|
|
1868
1868
|
for (let i = 0; i < t; i++) {
|
|
1869
|
-
let
|
|
1870
|
-
e[
|
|
1869
|
+
let s = this.options[i].attributeName();
|
|
1870
|
+
e[s] = s === this._versionOptionName ? this._version : this[s];
|
|
1871
1871
|
}
|
|
1872
1872
|
return e;
|
|
1873
1873
|
}
|
|
@@ -1900,8 +1900,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1900
1900
|
), typeof this._showHelpAfterError == "string" ? this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
1901
1901
|
`) : this._showHelpAfterError && (this._outputConfiguration.writeErr(`
|
|
1902
1902
|
`), this.outputHelp({ error: !0 }));
|
|
1903
|
-
let i = t || {},
|
|
1904
|
-
this._exit(
|
|
1903
|
+
let i = t || {}, s = i.exitCode || 1, r = i.code || "commander.error";
|
|
1904
|
+
this._exit(s, r, e);
|
|
1905
1905
|
}
|
|
1906
1906
|
/**
|
|
1907
1907
|
* Apply any option related environment variables, if option does
|
|
@@ -1911,11 +1911,11 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1911
1911
|
*/
|
|
1912
1912
|
_parseOptionsEnv() {
|
|
1913
1913
|
this.options.forEach((e) => {
|
|
1914
|
-
if (e.envVar && e.envVar in
|
|
1914
|
+
if (e.envVar && e.envVar in h.env) {
|
|
1915
1915
|
let t = e.attributeName();
|
|
1916
1916
|
(this.getOptionValue(t) === void 0 || ["default", "config", "env"].includes(
|
|
1917
1917
|
this.getOptionValueSource(t)
|
|
1918
|
-
)) && (e.required || e.optional ? this.emit(`optionEnv:${e.name()}`,
|
|
1918
|
+
)) && (e.required || e.optional ? this.emit(`optionEnv:${e.name()}`, h.env[e.envVar]) : this.emit(`optionEnv:${e.name()}`));
|
|
1919
1919
|
}
|
|
1920
1920
|
});
|
|
1921
1921
|
}
|
|
@@ -1925,7 +1925,7 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1925
1925
|
* @private
|
|
1926
1926
|
*/
|
|
1927
1927
|
_parseOptionsImplied() {
|
|
1928
|
-
let e = new Ke(this.options), t = /* @__PURE__ */
|
|
1928
|
+
let e = new Ke(this.options), t = /* @__PURE__ */ d((i) => this.getOptionValue(i) !== void 0 && !["default", "implied"].includes(this.
|
|
1929
1929
|
getOptionValueSource(i)), "hasCustomOptionValue");
|
|
1930
1930
|
this.options.filter(
|
|
1931
1931
|
(i) => i.implied !== void 0 && t(i.attributeName()) && e.valueFromOption(
|
|
@@ -1933,10 +1933,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1933
1933
|
i
|
|
1934
1934
|
)
|
|
1935
1935
|
).forEach((i) => {
|
|
1936
|
-
Object.keys(i.implied).filter((
|
|
1936
|
+
Object.keys(i.implied).filter((s) => !t(s)).forEach((s) => {
|
|
1937
1937
|
this.setOptionValueWithSource(
|
|
1938
|
-
|
|
1939
|
-
i.implied[
|
|
1938
|
+
s,
|
|
1939
|
+
i.implied[s],
|
|
1940
1940
|
"implied"
|
|
1941
1941
|
);
|
|
1942
1942
|
});
|
|
@@ -1980,17 +1980,17 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1980
1980
|
* @private
|
|
1981
1981
|
*/
|
|
1982
1982
|
_conflictingOption(e, t) {
|
|
1983
|
-
let i = /* @__PURE__ */
|
|
1984
|
-
let l = o.attributeName(), a = this.getOptionValue(l),
|
|
1985
|
-
(
|
|
1986
|
-
),
|
|
1987
|
-
(
|
|
1983
|
+
let i = /* @__PURE__ */ d((o) => {
|
|
1984
|
+
let l = o.attributeName(), a = this.getOptionValue(l), c = this.options.find(
|
|
1985
|
+
(p) => p.negate && l === p.attributeName()
|
|
1986
|
+
), u = this.options.find(
|
|
1987
|
+
(p) => !p.negate && l === p.attributeName()
|
|
1988
1988
|
);
|
|
1989
|
-
return
|
|
1990
|
-
}, "findBestOptionFromValue"),
|
|
1989
|
+
return c && (c.presetArg === void 0 && a === !1 || c.presetArg !== void 0 && a === c.presetArg) ? c : u || o;
|
|
1990
|
+
}, "findBestOptionFromValue"), s = /* @__PURE__ */ d((o) => {
|
|
1991
1991
|
let l = i(o), a = l.attributeName();
|
|
1992
1992
|
return this.getOptionValueSource(a) === "env" ? `environment variable '${l.envVar}'` : `option '${l.flags}'`;
|
|
1993
|
-
}, "getErrorMessage"), r = `error: ${
|
|
1993
|
+
}, "getErrorMessage"), r = `error: ${s(e)} cannot be used with ${s(t)}`;
|
|
1994
1994
|
this.error(r, { code: "commander.conflictingOption" });
|
|
1995
1995
|
}
|
|
1996
1996
|
/**
|
|
@@ -2003,12 +2003,12 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2003
2003
|
if (this._allowUnknownOption) return;
|
|
2004
2004
|
let t = "";
|
|
2005
2005
|
if (e.startsWith("--") && this._showSuggestionAfterError) {
|
|
2006
|
-
let
|
|
2006
|
+
let s = [], r = this;
|
|
2007
2007
|
do {
|
|
2008
2008
|
let o = r.createHelp().visibleOptions(r).filter((l) => l.long).map((l) => l.long);
|
|
2009
|
-
|
|
2009
|
+
s = s.concat(o), r = r.parent;
|
|
2010
2010
|
} while (r && !r._enablePositionalOptions);
|
|
2011
|
-
t =
|
|
2011
|
+
t = ue(e, s);
|
|
2012
2012
|
}
|
|
2013
2013
|
let i = `error: unknown option '${e}'${t}`;
|
|
2014
2014
|
this.error(i, { code: "commander.unknownOption" });
|
|
@@ -2033,10 +2033,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2033
2033
|
unknownCommand() {
|
|
2034
2034
|
let e = this.args[0], t = "";
|
|
2035
2035
|
if (this._showSuggestionAfterError) {
|
|
2036
|
-
let
|
|
2036
|
+
let s = [];
|
|
2037
2037
|
this.createHelp().visibleCommands(this).forEach((r) => {
|
|
2038
|
-
|
|
2039
|
-
}), t =
|
|
2038
|
+
s.push(r.name()), r.alias() && s.push(r.alias());
|
|
2039
|
+
}), t = ue(e, s);
|
|
2040
2040
|
}
|
|
2041
2041
|
let i = `error: unknown command '${e}'${t}`;
|
|
2042
2042
|
this.error(i, { code: "commander.unknownCommand" });
|
|
@@ -2056,8 +2056,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2056
2056
|
version(e, t, i) {
|
|
2057
2057
|
if (e === void 0) return this._version;
|
|
2058
2058
|
this._version = e, t = t || "-V, --version", i = i || "output the version number";
|
|
2059
|
-
let
|
|
2060
|
-
return this._versionOptionName =
|
|
2059
|
+
let s = this.createOption(t, i);
|
|
2060
|
+
return this._versionOptionName = s.attributeName(), this._registerOption(s), this.on("option:" + s.name(), () => {
|
|
2061
2061
|
this._outputConfiguration.writeOut(`${e}
|
|
2062
2062
|
`), this._exit(0, "commander.version", e);
|
|
2063
2063
|
}), this;
|
|
@@ -2097,9 +2097,9 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2097
2097
|
throw new Error("Command alias can't be the same as its name");
|
|
2098
2098
|
let i = this.parent?._findCommand(e);
|
|
2099
2099
|
if (i) {
|
|
2100
|
-
let
|
|
2100
|
+
let s = [i.name()].concat(i.aliases()).join("|");
|
|
2101
2101
|
throw new Error(
|
|
2102
|
-
`cannot add alias '${e}' to command '${this.name()}' as already have command '${
|
|
2102
|
+
`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`
|
|
2103
2103
|
);
|
|
2104
2104
|
}
|
|
2105
2105
|
return t._aliases.push(e), this;
|
|
@@ -2188,8 +2188,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2188
2188
|
_getHelpContext(e) {
|
|
2189
2189
|
e = e || {};
|
|
2190
2190
|
let t = { error: !!e.error }, i;
|
|
2191
|
-
return t.error ? i = /* @__PURE__ */
|
|
2192
|
-
writeOut(
|
|
2191
|
+
return t.error ? i = /* @__PURE__ */ d((s) => this._outputConfiguration.writeErr(s), "write") : i = /* @__PURE__ */ d((s) => this._outputConfiguration.
|
|
2192
|
+
writeOut(s), "write"), t.write = e.write || i, t.command = this, t;
|
|
2193
2193
|
}
|
|
2194
2194
|
/**
|
|
2195
2195
|
* Output help information for this command.
|
|
@@ -2203,10 +2203,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2203
2203
|
typeof e == "function" && (t = e, e = void 0);
|
|
2204
2204
|
let i = this._getHelpContext(e);
|
|
2205
2205
|
this._getCommandAndAncestors().reverse().forEach((r) => r.emit("beforeAllHelp", i)), this.emit("beforeHelp", i);
|
|
2206
|
-
let
|
|
2207
|
-
if (t && (
|
|
2206
|
+
let s = this.helpInformation(i);
|
|
2207
|
+
if (t && (s = t(s), typeof s != "string" && !Buffer.isBuffer(s)))
|
|
2208
2208
|
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
2209
|
-
i.write(
|
|
2209
|
+
i.write(s), this._getHelpOption()?.long && this.emit(this._getHelpOption().long), this.emit("afterHelp", i), this._getCommandAndAncestors().
|
|
2210
2210
|
forEach(
|
|
2211
2211
|
(r) => r.emit("afterAllHelp", i)
|
|
2212
2212
|
);
|
|
@@ -2256,7 +2256,7 @@ help", t = t ?? "display help for command", this._helpOption = this.createOption
|
|
|
2256
2256
|
*/
|
|
2257
2257
|
help(e) {
|
|
2258
2258
|
this.outputHelp(e);
|
|
2259
|
-
let t =
|
|
2259
|
+
let t = h.exitCode || 0;
|
|
2260
2260
|
t === 0 && e && typeof e != "function" && e.error && (t = 1), this._exit(t, "commander.help", "(outputHelp)");
|
|
2261
2261
|
}
|
|
2262
2262
|
/**
|
|
@@ -2274,8 +2274,8 @@ help", t = t ?? "display help for command", this._helpOption = this.createOption
|
|
|
2274
2274
|
if (!i.includes(e))
|
|
2275
2275
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
2276
2276
|
Expecting one of '${i.join("', '")}'`);
|
|
2277
|
-
let
|
|
2278
|
-
return this.on(
|
|
2277
|
+
let s = `${e}Help`;
|
|
2278
|
+
return this.on(s, (r) => {
|
|
2279
2279
|
let o;
|
|
2280
2280
|
typeof t == "function" ? o = t({ error: r.error, command: r.command }) : o = t, o && r.write(`${o}
|
|
2281
2281
|
`);
|
|
@@ -2289,30 +2289,30 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
2289
2289
|
*/
|
|
2290
2290
|
_outputHelpIfRequested(e) {
|
|
2291
2291
|
let t = this._getHelpOption();
|
|
2292
|
-
t && e.find((
|
|
2292
|
+
t && e.find((s) => t.is(s)) && (this.outputHelp(), this._exit(0, "commander.helpDisplayed", "(outputHelp)"));
|
|
2293
2293
|
}
|
|
2294
2294
|
};
|
|
2295
|
-
function
|
|
2296
|
-
return
|
|
2295
|
+
function pe(n) {
|
|
2296
|
+
return n.map((e) => {
|
|
2297
2297
|
if (!e.startsWith("--inspect"))
|
|
2298
2298
|
return e;
|
|
2299
|
-
let t, i = "127.0.0.1",
|
|
2299
|
+
let t, i = "127.0.0.1", s = "9229", r;
|
|
2300
2300
|
return (r = e.match(/^(--inspect(-brk)?)$/)) !== null ? t = r[1] : (r = e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null ? (t =
|
|
2301
|
-
r[1], /^\d+$/.test(r[3]) ?
|
|
2302
|
-
r[3],
|
|
2301
|
+
r[1], /^\d+$/.test(r[3]) ? s = r[3] : i = r[3]) : (r = e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null && (t = r[1], i =
|
|
2302
|
+
r[3], s = r[4]), t && s !== "0" ? `${t}=${i}:${parseInt(s) + 1}` : e;
|
|
2303
2303
|
});
|
|
2304
2304
|
}
|
|
2305
|
-
|
|
2306
|
-
|
|
2305
|
+
d(pe, "incrementNodeInspectorPort");
|
|
2306
|
+
he.Command = Q;
|
|
2307
2307
|
});
|
|
2308
2308
|
|
|
2309
2309
|
// ../node_modules/commander/index.js
|
|
2310
2310
|
var _e = b((g) => {
|
|
2311
|
-
var { Argument: fe } =
|
|
2311
|
+
var { Argument: fe } = V(), { Command: X } = me(), { CommanderError: Qe, InvalidArgumentError: ge } = k(), { Help: Xe } = W(), { Option: be } = J();
|
|
2312
2312
|
g.program = new X();
|
|
2313
|
-
g.createCommand = (
|
|
2314
|
-
g.createOption = (
|
|
2315
|
-
g.createArgument = (
|
|
2313
|
+
g.createCommand = (n) => new X(n);
|
|
2314
|
+
g.createOption = (n, e) => new be(n, e);
|
|
2315
|
+
g.createArgument = (n, e) => new fe(n, e);
|
|
2316
2316
|
g.Command = X;
|
|
2317
2317
|
g.Option = be;
|
|
2318
2318
|
g.Argument = fe;
|
|
@@ -2323,38 +2323,38 @@ var _e = b((g) => {
|
|
|
2323
2323
|
});
|
|
2324
2324
|
|
|
2325
2325
|
// ../node_modules/walk-up-path/dist/cjs/index.js
|
|
2326
|
-
var ye = b((
|
|
2326
|
+
var ye = b((H) => {
|
|
2327
2327
|
"use strict";
|
|
2328
|
-
Object.defineProperty(
|
|
2329
|
-
|
|
2330
|
-
var xe = C("path"), Ze = /* @__PURE__ */
|
|
2331
|
-
for (
|
|
2332
|
-
yield
|
|
2333
|
-
let e = (0, xe.dirname)(
|
|
2334
|
-
if (e ===
|
|
2328
|
+
Object.defineProperty(H, "__esModule", { value: !0 });
|
|
2329
|
+
H.walkUp = void 0;
|
|
2330
|
+
var xe = C("path"), Ze = /* @__PURE__ */ d(function* (n) {
|
|
2331
|
+
for (n = (0, xe.resolve)(n); n; ) {
|
|
2332
|
+
yield n;
|
|
2333
|
+
let e = (0, xe.dirname)(n);
|
|
2334
|
+
if (e === n)
|
|
2335
2335
|
break;
|
|
2336
|
-
|
|
2336
|
+
n = e;
|
|
2337
2337
|
}
|
|
2338
2338
|
}, "walkUp");
|
|
2339
|
-
|
|
2339
|
+
H.walkUp = Ze;
|
|
2340
2340
|
});
|
|
2341
2341
|
|
|
2342
2342
|
// ../node_modules/picocolors/picocolors.js
|
|
2343
2343
|
var ke = b((zt, te) => {
|
|
2344
|
-
var
|
|
2345
|
-
"--color") ||
|
|
2346
|
-
let
|
|
2347
|
-
return ~r ?
|
|
2348
|
-
}, "formatter"), at = /* @__PURE__ */
|
|
2349
|
-
let
|
|
2344
|
+
var P = process || {}, Oe = P.argv || [], D = P.env || {}, nt = !(D.NO_COLOR || Oe.includes("--no-color")) && (!!D.FORCE_COLOR || Oe.includes(
|
|
2345
|
+
"--color") || P.platform === "win32" || (P.stdout || {}).isTTY && D.TERM !== "dumb" || !!D.CI), ot = /* @__PURE__ */ d((n, e, t = n) => (i) => {
|
|
2346
|
+
let s = "" + i, r = s.indexOf(e, n.length);
|
|
2347
|
+
return ~r ? n + at(s, e, t, r) + e : n + s + e;
|
|
2348
|
+
}, "formatter"), at = /* @__PURE__ */ d((n, e, t, i) => {
|
|
2349
|
+
let s = "", r = 0;
|
|
2350
2350
|
do
|
|
2351
|
-
|
|
2351
|
+
s += n.substring(r, i) + t, r = i + e.length, i = n.indexOf(e, r);
|
|
2352
2352
|
while (~i);
|
|
2353
|
-
return
|
|
2354
|
-
}, "replaceClose"), Ce = /* @__PURE__ */
|
|
2355
|
-
let e =
|
|
2353
|
+
return s + n.substring(r);
|
|
2354
|
+
}, "replaceClose"), Ce = /* @__PURE__ */ d((n = nt) => {
|
|
2355
|
+
let e = n ? ot : () => String;
|
|
2356
2356
|
return {
|
|
2357
|
-
isColorSupported:
|
|
2357
|
+
isColorSupported: n,
|
|
2358
2358
|
reset: e("\x1B[0m", "\x1B[0m"),
|
|
2359
2359
|
bold: e("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
2360
2360
|
dim: e("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
@@ -2407,21 +2407,21 @@ var $e = b((A) => {
|
|
|
2407
2407
|
"use strict";
|
|
2408
2408
|
Object.defineProperty(A, "__esModule", { value: !0 });
|
|
2409
2409
|
A.dedent = void 0;
|
|
2410
|
-
function Se(
|
|
2410
|
+
function Se(n) {
|
|
2411
2411
|
for (var e = [], t = 1; t < arguments.length; t++)
|
|
2412
2412
|
e[t - 1] = arguments[t];
|
|
2413
|
-
var i = Array.from(typeof
|
|
2413
|
+
var i = Array.from(typeof n == "string" ? [n] : n);
|
|
2414
2414
|
i[i.length - 1] = i[i.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
2415
|
-
var
|
|
2416
|
-
var
|
|
2417
|
-
return
|
|
2418
|
-
var
|
|
2419
|
-
return (m = (
|
|
2415
|
+
var s = i.reduce(function(l, a) {
|
|
2416
|
+
var c = a.match(/\n([\t ]+|(?!\s).)/g);
|
|
2417
|
+
return c ? l.concat(c.map(function(u) {
|
|
2418
|
+
var p, m;
|
|
2419
|
+
return (m = (p = u.match(/[\t ]/g)) === null || p === void 0 ? void 0 : p.length) !== null && m !== void 0 ? m : 0;
|
|
2420
2420
|
})) : l;
|
|
2421
2421
|
}, []);
|
|
2422
|
-
if (
|
|
2422
|
+
if (s.length) {
|
|
2423
2423
|
var r = new RegExp(`
|
|
2424
|
-
[ ]{` + Math.min.apply(Math,
|
|
2424
|
+
[ ]{` + Math.min.apply(Math, s) + "}", "g");
|
|
2425
2425
|
i = i.map(function(l) {
|
|
2426
2426
|
return l.replace(r, `
|
|
2427
2427
|
`);
|
|
@@ -2430,50 +2430,50 @@ var $e = b((A) => {
|
|
|
2430
2430
|
i[0] = i[0].replace(/^\r?\n/, "");
|
|
2431
2431
|
var o = i[0];
|
|
2432
2432
|
return e.forEach(function(l, a) {
|
|
2433
|
-
var
|
|
2433
|
+
var c = o.match(/(?:^|\n)( *)$/), u = c ? c[1] : "", p = l;
|
|
2434
2434
|
typeof l == "string" && l.includes(`
|
|
2435
|
-
`) && (
|
|
2435
|
+
`) && (p = String(l).split(`
|
|
2436
2436
|
`).map(function(m, _) {
|
|
2437
|
-
return _ === 0 ? m : "" +
|
|
2437
|
+
return _ === 0 ? m : "" + u + m;
|
|
2438
2438
|
}).join(`
|
|
2439
|
-
`)), o +=
|
|
2439
|
+
`)), o += p + i[a + 1];
|
|
2440
2440
|
}), o;
|
|
2441
2441
|
}
|
|
2442
|
-
|
|
2442
|
+
d(Se, "dedent");
|
|
2443
2443
|
A.dedent = Se;
|
|
2444
2444
|
A.default = Se;
|
|
2445
2445
|
});
|
|
2446
2446
|
|
|
2447
2447
|
// src/cli/bin/index.ts
|
|
2448
|
-
var
|
|
2449
|
-
import { getEnvConfig as re, parseList as vt, versions as
|
|
2450
|
-
import { logger as
|
|
2451
|
-
import { addToGlobalContext as
|
|
2448
|
+
var j = $(_e(), 1);
|
|
2449
|
+
import { getEnvConfig as re, parseList as vt, versions as wt } from "storybook/internal/common";
|
|
2450
|
+
import { logger as ne } from "storybook/internal/node-logger";
|
|
2451
|
+
import { addToGlobalContext as Ot } from "storybook/internal/telemetry";
|
|
2452
2452
|
|
|
2453
2453
|
// ../node_modules/fd-package-json/dist/esm/main.js
|
|
2454
2454
|
var ve = $(ye(), 1);
|
|
2455
2455
|
import { resolve as et } from "node:path";
|
|
2456
2456
|
import { stat as tt, readFile as it } from "node:fs/promises";
|
|
2457
2457
|
import { statSync as Wt, readFileSync as Rt } from "node:fs";
|
|
2458
|
-
async function
|
|
2458
|
+
async function st(n) {
|
|
2459
2459
|
try {
|
|
2460
|
-
return (await tt(
|
|
2460
|
+
return (await tt(n)).isFile();
|
|
2461
2461
|
} catch {
|
|
2462
2462
|
return !1;
|
|
2463
2463
|
}
|
|
2464
2464
|
}
|
|
2465
|
-
|
|
2466
|
-
async function rt(
|
|
2467
|
-
for (let e of (0, ve.walkUp)(
|
|
2465
|
+
d(st, "fileExists");
|
|
2466
|
+
async function rt(n) {
|
|
2467
|
+
for (let e of (0, ve.walkUp)(n)) {
|
|
2468
2468
|
let t = et(e, "package.json");
|
|
2469
|
-
if (await
|
|
2469
|
+
if (await st(t))
|
|
2470
2470
|
return t;
|
|
2471
2471
|
}
|
|
2472
2472
|
return null;
|
|
2473
2473
|
}
|
|
2474
|
-
|
|
2475
|
-
async function v(
|
|
2476
|
-
let e = await rt(
|
|
2474
|
+
d(rt, "findPackagePath");
|
|
2475
|
+
async function v(n) {
|
|
2476
|
+
let e = await rt(n);
|
|
2477
2477
|
if (!e)
|
|
2478
2478
|
return null;
|
|
2479
2479
|
try {
|
|
@@ -2483,128 +2483,128 @@ async function v(s) {
|
|
|
2483
2483
|
return null;
|
|
2484
2484
|
}
|
|
2485
2485
|
}
|
|
2486
|
-
|
|
2486
|
+
d(v, "findPackage");
|
|
2487
2487
|
|
|
2488
2488
|
// node_modules/leven/index.js
|
|
2489
|
-
var Z = [],
|
|
2490
|
-
function ee(
|
|
2491
|
-
if (
|
|
2489
|
+
var Z = [], we = [];
|
|
2490
|
+
function ee(n, e) {
|
|
2491
|
+
if (n === e)
|
|
2492
2492
|
return 0;
|
|
2493
|
-
let t =
|
|
2494
|
-
|
|
2495
|
-
let i =
|
|
2496
|
-
for (; i > 0 &&
|
|
2497
|
-
i--,
|
|
2493
|
+
let t = n;
|
|
2494
|
+
n.length > e.length && (n = e, e = t);
|
|
2495
|
+
let i = n.length, s = e.length;
|
|
2496
|
+
for (; i > 0 && n.charCodeAt(~-i) === e.charCodeAt(~-s); )
|
|
2497
|
+
i--, s--;
|
|
2498
2498
|
let r = 0;
|
|
2499
|
-
for (; r < i &&
|
|
2499
|
+
for (; r < i && n.charCodeAt(r) === e.charCodeAt(r); )
|
|
2500
2500
|
r++;
|
|
2501
|
-
if (i -= r,
|
|
2502
|
-
return
|
|
2503
|
-
let o, l, a,
|
|
2504
|
-
for (;
|
|
2505
|
-
|
|
2506
|
-
for (;
|
|
2507
|
-
for (o = e.charCodeAt(r +
|
|
2508
|
-
|
|
2501
|
+
if (i -= r, s -= r, i === 0)
|
|
2502
|
+
return s;
|
|
2503
|
+
let o, l, a, c, u = 0, p = 0;
|
|
2504
|
+
for (; u < i; )
|
|
2505
|
+
we[u] = n.charCodeAt(r + u), Z[u] = ++u;
|
|
2506
|
+
for (; p < s; )
|
|
2507
|
+
for (o = e.charCodeAt(r + p), a = p++, l = p, u = 0; u < i; u++)
|
|
2508
|
+
c = o === we[u] ? a : a + 1, a = Z[u], l = Z[u] = a > l ? c > l ? l + 1 : c : c > a ? a + 1 : c;
|
|
2509
2509
|
return l;
|
|
2510
2510
|
}
|
|
2511
|
-
|
|
2511
|
+
d(ee, "leven");
|
|
2512
2512
|
|
|
2513
2513
|
// src/cli/bin/index.ts
|
|
2514
|
-
var
|
|
2514
|
+
var E = $(ke(), 1);
|
|
2515
2515
|
|
|
2516
2516
|
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
2517
2517
|
var lt = process.env.NODE_ENV === "production", ie = "Invariant failed";
|
|
2518
|
-
function
|
|
2519
|
-
if (!
|
|
2518
|
+
function w(n, e) {
|
|
2519
|
+
if (!n) {
|
|
2520
2520
|
if (lt)
|
|
2521
2521
|
throw new Error(ie);
|
|
2522
2522
|
var t = typeof e == "function" ? e() : e, i = t ? "".concat(ie, ": ").concat(t) : ie;
|
|
2523
2523
|
throw new Error(i);
|
|
2524
2524
|
}
|
|
2525
2525
|
}
|
|
2526
|
-
|
|
2526
|
+
d(w, "invariant");
|
|
2527
2527
|
|
|
2528
2528
|
// package.json
|
|
2529
|
-
var Ae = "9.0.0-alpha.
|
|
2529
|
+
var Ae = "9.0.0-alpha.4";
|
|
2530
2530
|
|
|
2531
2531
|
// src/cli/build.ts
|
|
2532
|
-
import { cache as
|
|
2533
|
-
import { buildStaticStandalone as
|
|
2534
|
-
var
|
|
2532
|
+
import { cache as ct } from "storybook/internal/common";
|
|
2533
|
+
import { buildStaticStandalone as ut, withTelemetry as pt } from "storybook/internal/core-server";
|
|
2534
|
+
var je = /* @__PURE__ */ d(async (n) => {
|
|
2535
2535
|
let e = await v(__dirname);
|
|
2536
|
-
|
|
2536
|
+
w(e, "Failed to find the closest package.json file.");
|
|
2537
2537
|
let t = {
|
|
2538
|
-
...
|
|
2539
|
-
configDir:
|
|
2540
|
-
outputDir:
|
|
2541
|
-
ignorePreview: !!
|
|
2538
|
+
...n,
|
|
2539
|
+
configDir: n.configDir || "./.storybook",
|
|
2540
|
+
outputDir: n.outputDir || "./storybook-static",
|
|
2541
|
+
ignorePreview: !!n.previewUrl && !n.forceBuildPreview,
|
|
2542
2542
|
configType: "PRODUCTION",
|
|
2543
|
-
cache:
|
|
2543
|
+
cache: ct,
|
|
2544
2544
|
packageJson: e
|
|
2545
2545
|
};
|
|
2546
|
-
await
|
|
2546
|
+
await pt(
|
|
2547
2547
|
"build",
|
|
2548
|
-
{ cliOptions:
|
|
2549
|
-
() =>
|
|
2548
|
+
{ cliOptions: n, presetOptions: t },
|
|
2549
|
+
() => ut(t)
|
|
2550
2550
|
);
|
|
2551
2551
|
}, "build");
|
|
2552
2552
|
|
|
2553
2553
|
// src/cli/buildIndex.ts
|
|
2554
|
-
import { cache as
|
|
2554
|
+
import { cache as ht } from "storybook/internal/common";
|
|
2555
2555
|
import { buildIndexStandalone as mt, withTelemetry as ft } from "storybook/internal/core-server";
|
|
2556
|
-
var
|
|
2556
|
+
var Ee = /* @__PURE__ */ d(async (n) => {
|
|
2557
2557
|
let e = {
|
|
2558
|
-
...
|
|
2559
|
-
configDir:
|
|
2560
|
-
outputFile:
|
|
2558
|
+
...n,
|
|
2559
|
+
configDir: n.configDir || ".storybook",
|
|
2560
|
+
outputFile: n.outputFile || "index.json",
|
|
2561
2561
|
ignorePreview: !0,
|
|
2562
2562
|
configType: "PRODUCTION",
|
|
2563
|
-
cache:
|
|
2564
|
-
packageJson:
|
|
2563
|
+
cache: ht,
|
|
2564
|
+
packageJson: n.packageJson
|
|
2565
2565
|
}, t = {
|
|
2566
2566
|
...e,
|
|
2567
2567
|
corePresets: [],
|
|
2568
2568
|
overridePresets: []
|
|
2569
2569
|
};
|
|
2570
|
-
await ft("index", { cliOptions:
|
|
2570
|
+
await ft("index", { cliOptions: n, presetOptions: t }, () => mt(e));
|
|
2571
2571
|
}, "buildIndex");
|
|
2572
2572
|
|
|
2573
2573
|
// src/cli/dev.ts
|
|
2574
2574
|
import { cache as gt } from "storybook/internal/common";
|
|
2575
2575
|
import { buildDevStandalone as bt, withTelemetry as _t } from "storybook/internal/core-server";
|
|
2576
|
-
import { logger as
|
|
2577
|
-
var
|
|
2578
|
-
function yt(
|
|
2579
|
-
xt.heading = "",
|
|
2580
|
-
(e) =>
|
|
2581
|
-
|
|
2576
|
+
import { logger as O, instance as xt } from "storybook/internal/node-logger";
|
|
2577
|
+
var se = $($e(), 1);
|
|
2578
|
+
function yt(n) {
|
|
2579
|
+
xt.heading = "", n instanceof Error ? n.error ? O.error(n.error) : n.stats && n.stats.compilation.errors ? n.stats.compilation.errors.forEach(
|
|
2580
|
+
(e) => O.plain(e)) : O.error(n) : n.compilation?.errors && n.compilation.errors.forEach((e) => O.plain(e)), O.line(), O.warn(
|
|
2581
|
+
n.close ? se.dedent`
|
|
2582
2582
|
FATAL broken build!, will close the process,
|
|
2583
2583
|
Fix the error below and restart storybook.
|
|
2584
|
-
` :
|
|
2584
|
+
` : se.dedent`
|
|
2585
2585
|
Broken build, fix the error above.
|
|
2586
2586
|
You may need to refresh the browser.
|
|
2587
2587
|
`
|
|
2588
|
-
),
|
|
2588
|
+
), O.line();
|
|
2589
2589
|
}
|
|
2590
|
-
|
|
2591
|
-
var
|
|
2590
|
+
d(yt, "printError");
|
|
2591
|
+
var qe = /* @__PURE__ */ d(async (n) => {
|
|
2592
2592
|
let { env: e } = process;
|
|
2593
2593
|
e.NODE_ENV = e.NODE_ENV || "development";
|
|
2594
2594
|
let t = await v(__dirname);
|
|
2595
|
-
|
|
2595
|
+
w(t, "Failed to find the closest package.json file.");
|
|
2596
2596
|
let i = {
|
|
2597
|
-
...
|
|
2598
|
-
configDir:
|
|
2597
|
+
...n,
|
|
2598
|
+
configDir: n.configDir || "./.storybook",
|
|
2599
2599
|
configType: "DEVELOPMENT",
|
|
2600
|
-
ignorePreview: !!
|
|
2600
|
+
ignorePreview: !!n.previewUrl && !n.forceBuildPreview,
|
|
2601
2601
|
cache: gt,
|
|
2602
2602
|
packageJson: t
|
|
2603
2603
|
};
|
|
2604
2604
|
await _t(
|
|
2605
2605
|
"dev",
|
|
2606
2606
|
{
|
|
2607
|
-
cliOptions:
|
|
2607
|
+
cliOptions: n,
|
|
2608
2608
|
presetOptions: i,
|
|
2609
2609
|
printError: yt
|
|
2610
2610
|
},
|
|
@@ -2613,15 +2613,15 @@ var Ve = /* @__PURE__ */ c(async (s) => {
|
|
|
2613
2613
|
}, "dev");
|
|
2614
2614
|
|
|
2615
2615
|
// src/cli/bin/index.ts
|
|
2616
|
-
|
|
2617
|
-
var S = console, oe = /* @__PURE__ */
|
|
2616
|
+
Ot("cliVersion", wt.storybook);
|
|
2617
|
+
var S = console, oe = /* @__PURE__ */ d((n) => j.program.command(n).option(
|
|
2618
2618
|
"--disable-telemetry",
|
|
2619
2619
|
"Disable sending telemetry data",
|
|
2620
2620
|
// default value is false, but if the user sets STORYBOOK_DISABLE_TELEMETRY, it can be true
|
|
2621
2621
|
process.env.STORYBOOK_DISABLE_TELEMETRY && process.env.STORYBOOK_DISABLE_TELEMETRY !== "false"
|
|
2622
2622
|
).option("--debug", "Get more logs in debug mode", !1).option("--enable-crash-reports", "Enable sending crash reports to telemetry data"), "\
|
|
2623
2623
|
command");
|
|
2624
|
-
oe("dev").option("-p, --port <number>", "Port to run Storybook", (
|
|
2624
|
+
oe("dev").option("-p, --port <number>", "Port to run Storybook", (n) => parseInt(n, 10)).option("-h, --host <string>", "Host to run Storyboo\
|
|
2625
2625
|
k").option("-c, --config-dir <dir-name>", "Directory where to load Storybook configurations from").option(
|
|
2626
2626
|
"--https",
|
|
2627
2627
|
"Serve Storybook over HTTPS. Note: You must provide your own certificate information."
|
|
@@ -2643,17 +2643,17 @@ ack", "Display final webpack configurations for debugging purposes").option(
|
|
|
2643
2643
|
ly site using addon-docs").option("--exact-port", "Exit early if the desired port is not available").option(
|
|
2644
2644
|
"--initial-path [path]",
|
|
2645
2645
|
"URL path to be appended when visiting Storybook for the first time"
|
|
2646
|
-
).action(async (
|
|
2647
|
-
|
|
2646
|
+
).action(async (n) => {
|
|
2647
|
+
ne.setLevel(n.loglevel);
|
|
2648
2648
|
let e = await v(__dirname);
|
|
2649
|
-
|
|
2650
|
-
`)), re(
|
|
2649
|
+
w(e, "Failed to find the closest package.json file."), S.log(E.default.bold(`${e.name} v${e.version}`) + E.default.reset(`
|
|
2650
|
+
`)), re(n, {
|
|
2651
2651
|
port: "SBCONFIG_PORT",
|
|
2652
2652
|
host: "SBCONFIG_HOSTNAME",
|
|
2653
2653
|
staticDir: "SBCONFIG_STATIC_DIR",
|
|
2654
2654
|
configDir: "SBCONFIG_CONFIG_DIR",
|
|
2655
2655
|
ci: "CI"
|
|
2656
|
-
}), parseInt(`${
|
|
2656
|
+
}), parseInt(`${n.port}`, 10) && (n.port = parseInt(`${n.port}`, 10)), await qe({ ...n, packageJson: e }).catch(() => process.exit(1));
|
|
2657
2657
|
});
|
|
2658
2658
|
oe("build").option("-o, --output-dir <dir-name>", "Directory where to store built files").option("-c, --config-dir <dir-name>", "Directory w\
|
|
2659
2659
|
here to load Storybook configurations from").option("--quiet", "Suppress verbose build output").option("--loglevel <level>", "Control level \
|
|
@@ -2664,44 +2664,44 @@ of logging during build").option("--debug-webpack", "Display final webpack confi
|
|
|
2664
2664
|
"--preview-url <string>",
|
|
2665
2665
|
"Disables the default storybook preview and lets your use your own"
|
|
2666
2666
|
).option("--force-build-preview", "Build the preview iframe even if you are using --preview-url").option("--docs", "Build a documentation-on\
|
|
2667
|
-
ly site using addon-docs").option("--test", "Build stories optimized for testing purposes.").action(async (
|
|
2667
|
+
ly site using addon-docs").option("--test", "Build stories optimized for testing purposes.").action(async (n) => {
|
|
2668
2668
|
let { env: e } = process;
|
|
2669
2669
|
e.NODE_ENV = e.NODE_ENV || "production";
|
|
2670
2670
|
let t = await v(__dirname);
|
|
2671
|
-
|
|
2672
|
-
`)), re(
|
|
2671
|
+
w(t, "Failed to find the closest package.json file."), ne.setLevel(n.loglevel), S.log(E.default.bold(`${t.name} v${t.version}
|
|
2672
|
+
`)), re(n, {
|
|
2673
2673
|
staticDir: "SBCONFIG_STATIC_DIR",
|
|
2674
2674
|
outputDir: "SBCONFIG_OUTPUT_DIR",
|
|
2675
2675
|
configDir: "SBCONFIG_CONFIG_DIR"
|
|
2676
|
-
}), await
|
|
2677
|
-
...
|
|
2676
|
+
}), await je({
|
|
2677
|
+
...n,
|
|
2678
2678
|
packageJson: t,
|
|
2679
|
-
test: !!
|
|
2679
|
+
test: !!n.test || process.env.SB_TESTBUILD === "true"
|
|
2680
2680
|
}).catch(() => process.exit(1));
|
|
2681
2681
|
});
|
|
2682
2682
|
oe("index").option("-o, --output-file <file-name>", "JSON file to output index").option("-c, --config-dir <dir-name>", "Directory where to l\
|
|
2683
2683
|
oad Storybook configurations from").option("--quiet", "Suppress verbose build output").option("--loglevel <level>", "Control level of loggin\
|
|
2684
|
-
g during build").action(async (
|
|
2684
|
+
g during build").action(async (n) => {
|
|
2685
2685
|
let { env: e } = process;
|
|
2686
2686
|
e.NODE_ENV = e.NODE_ENV || "production";
|
|
2687
2687
|
let t = await v(__dirname);
|
|
2688
|
-
|
|
2689
|
-
`)), re(
|
|
2688
|
+
w(t, "Failed to find the closest package.json file."), ne.setLevel(n.loglevel), S.log(E.default.bold(`${t.name} v${t.version}
|
|
2689
|
+
`)), re(n, {
|
|
2690
2690
|
configDir: "SBCONFIG_CONFIG_DIR",
|
|
2691
2691
|
outputFile: "SBCONFIG_OUTPUT_FILE"
|
|
2692
|
-
}), await
|
|
2693
|
-
...
|
|
2692
|
+
}), await Ee({
|
|
2693
|
+
...n,
|
|
2694
2694
|
packageJson: t
|
|
2695
2695
|
}).catch(() => process.exit(1));
|
|
2696
2696
|
});
|
|
2697
|
-
|
|
2697
|
+
j.program.on("command:*", ([n]) => {
|
|
2698
2698
|
S.error(
|
|
2699
2699
|
` Invalid command: %s.
|
|
2700
2700
|
See --help for a list of available commands.`,
|
|
2701
|
-
|
|
2701
|
+
n
|
|
2702
2702
|
);
|
|
2703
|
-
let t =
|
|
2703
|
+
let t = j.program.commands.map((i) => i.name()).find((i) => ee(i, n) < 3);
|
|
2704
2704
|
t && S.info(`
|
|
2705
2705
|
Did you mean ${t}?`), process.exit(1);
|
|
2706
2706
|
});
|
|
2707
|
-
|
|
2707
|
+
j.program.usage("<command> [options]").version(String(Ae)).parse(process.argv);
|