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.cjs
CHANGED
|
@@ -4,28 +4,28 @@ var L = Object.defineProperty;
|
|
|
4
4
|
var Le = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var We = Object.getOwnPropertyNames;
|
|
6
6
|
var Re = Object.getPrototypeOf, Ge = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
var b = (
|
|
9
|
-
var Ue = (
|
|
7
|
+
var d = (n, e) => L(n, "name", { value: e, configurable: !0 });
|
|
8
|
+
var b = (n, e) => () => (e || n((e = { exports: {} }).exports, e), e.exports);
|
|
9
|
+
var Ue = (n, e, t, i) => {
|
|
10
10
|
if (e && typeof e == "object" || typeof e == "function")
|
|
11
|
-
for (let
|
|
12
|
-
!Ge.call(
|
|
13
|
-
return
|
|
11
|
+
for (let s of We(e))
|
|
12
|
+
!Ge.call(n, s) && s !== t && L(n, s, { get: () => e[s], enumerable: !(i = Le(e, s)) || i.enumerable });
|
|
13
|
+
return n;
|
|
14
14
|
};
|
|
15
|
-
var $ = (
|
|
15
|
+
var $ = (n, e, t) => (t = n != null ? Me(Re(n)) : {}, Ue(
|
|
16
16
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
18
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
e || !
|
|
21
|
-
|
|
20
|
+
e || !n || !n.__esModule ? L(t, "default", { value: n, enumerable: !0 }) : t,
|
|
21
|
+
n
|
|
22
22
|
));
|
|
23
23
|
|
|
24
24
|
// ../node_modules/commander/lib/error.js
|
|
25
25
|
var k = b((R) => {
|
|
26
|
-
var
|
|
26
|
+
var q = class extends Error {
|
|
27
27
|
static {
|
|
28
|
-
|
|
28
|
+
d(this, "CommanderError");
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Constructs the CommanderError class
|
|
@@ -37,9 +37,9 @@ var k = b((R) => {
|
|
|
37
37
|
super(i), Error.captureStackTrace(this, this.constructor), this.name = this.constructor.name, this.code = t, this.exitCode = e, this.nestedError =
|
|
38
38
|
void 0;
|
|
39
39
|
}
|
|
40
|
-
}, W = class extends
|
|
40
|
+
}, W = class extends q {
|
|
41
41
|
static {
|
|
42
|
-
|
|
42
|
+
d(this, "InvalidArgumentError");
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Constructs the InvalidArgumentError class
|
|
@@ -49,15 +49,15 @@ var k = b((R) => {
|
|
|
49
49
|
super(1, "commander.invalidArgument", e), Error.captureStackTrace(this, this.constructor), this.name = this.constructor.name;
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
R.CommanderError =
|
|
52
|
+
R.CommanderError = q;
|
|
53
53
|
R.InvalidArgumentError = W;
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
// ../node_modules/commander/lib/argument.js
|
|
57
|
-
var
|
|
57
|
+
var V = b((U) => {
|
|
58
58
|
var { InvalidArgumentError: Je } = k(), G = class {
|
|
59
59
|
static {
|
|
60
|
-
|
|
60
|
+
d(this, "Argument");
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Initialize a new command argument with the given name and description.
|
|
@@ -147,20 +147,20 @@ var H = b((U) => {
|
|
|
147
147
|
return this.required = !1, this;
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
function Ye(
|
|
151
|
-
let e =
|
|
152
|
-
return
|
|
150
|
+
function Ye(n) {
|
|
151
|
+
let e = n.name() + (n.variadic === !0 ? "..." : "");
|
|
152
|
+
return n.required ? "<" + e + ">" : "[" + e + "]";
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
d(Ye, "humanReadableArgName");
|
|
155
155
|
U.Argument = G;
|
|
156
156
|
U.humanReadableArgName = Ye;
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
// ../node_modules/commander/lib/help.js
|
|
160
|
-
var Y = b((
|
|
161
|
-
var { humanReadableArgName: ze } =
|
|
160
|
+
var Y = b((ce) => {
|
|
161
|
+
var { humanReadableArgName: ze } = V(), J = class {
|
|
162
162
|
static {
|
|
163
|
-
|
|
163
|
+
d(this, "Help");
|
|
164
164
|
}
|
|
165
165
|
constructor() {
|
|
166
166
|
this.helpWidth = void 0, this.sortSubcommands = !1, this.sortOptions = !1, this.showGlobalOptions = !1;
|
|
@@ -172,8 +172,8 @@ var Y = b((ue) => {
|
|
|
172
172
|
* @returns {Command[]}
|
|
173
173
|
*/
|
|
174
174
|
visibleCommands(e) {
|
|
175
|
-
let t = e.commands.filter((
|
|
176
|
-
return i && !i._hidden && t.push(i), this.sortSubcommands && t.sort((
|
|
175
|
+
let t = e.commands.filter((s) => !s._hidden), i = e._getHelpCommand();
|
|
176
|
+
return i && !i._hidden && t.push(i), this.sortSubcommands && t.sort((s, r) => s.name().localeCompare(r.name())), t;
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* Compare options for sort.
|
|
@@ -183,7 +183,7 @@ var Y = b((ue) => {
|
|
|
183
183
|
* @returns {number}
|
|
184
184
|
*/
|
|
185
185
|
compareOptions(e, t) {
|
|
186
|
-
let i = /* @__PURE__ */
|
|
186
|
+
let i = /* @__PURE__ */ d((s) => s.short ? s.short.replace(/^-/, "") : s.long.replace(/^--/, ""), "getSortKey");
|
|
187
187
|
return i(e).localeCompare(i(t));
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
@@ -193,12 +193,12 @@ var Y = b((ue) => {
|
|
|
193
193
|
* @returns {Option[]}
|
|
194
194
|
*/
|
|
195
195
|
visibleOptions(e) {
|
|
196
|
-
let t = e.options.filter((
|
|
196
|
+
let t = e.options.filter((s) => !s.hidden), i = e._getHelpOption();
|
|
197
197
|
if (i && !i.hidden) {
|
|
198
|
-
let
|
|
199
|
-
!
|
|
198
|
+
let s = i.short && e._findOption(i.short), r = i.long && e._findOption(i.long);
|
|
199
|
+
!s && !r ? t.push(i) : i.long && !r ? t.push(
|
|
200
200
|
e.createOption(i.long, i.description)
|
|
201
|
-
) : i.short && !
|
|
201
|
+
) : i.short && !s && t.push(
|
|
202
202
|
e.createOption(i.short, i.description)
|
|
203
203
|
);
|
|
204
204
|
}
|
|
@@ -214,10 +214,10 @@ var Y = b((ue) => {
|
|
|
214
214
|
if (!this.showGlobalOptions) return [];
|
|
215
215
|
let t = [];
|
|
216
216
|
for (let i = e.parent; i; i = i.parent) {
|
|
217
|
-
let
|
|
217
|
+
let s = i.options.filter(
|
|
218
218
|
(r) => !r.hidden
|
|
219
219
|
);
|
|
220
|
-
t.push(...
|
|
220
|
+
t.push(...s);
|
|
221
221
|
}
|
|
222
222
|
return this.sortOptions && t.sort(this.compareOptions), t;
|
|
223
223
|
}
|
|
@@ -269,7 +269,7 @@ var Y = b((ue) => {
|
|
|
269
269
|
* @returns {number}
|
|
270
270
|
*/
|
|
271
271
|
longestSubcommandTermLength(e, t) {
|
|
272
|
-
return t.visibleCommands(e).reduce((i,
|
|
272
|
+
return t.visibleCommands(e).reduce((i, s) => Math.max(i, t.subcommandTerm(s).length), 0);
|
|
273
273
|
}
|
|
274
274
|
/**
|
|
275
275
|
* Get the longest option term length.
|
|
@@ -279,7 +279,7 @@ var Y = b((ue) => {
|
|
|
279
279
|
* @returns {number}
|
|
280
280
|
*/
|
|
281
281
|
longestOptionTermLength(e, t) {
|
|
282
|
-
return t.visibleOptions(e).reduce((i,
|
|
282
|
+
return t.visibleOptions(e).reduce((i, s) => Math.max(i, t.optionTerm(s).length), 0);
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Get the longest global option term length.
|
|
@@ -289,7 +289,7 @@ var Y = b((ue) => {
|
|
|
289
289
|
* @returns {number}
|
|
290
290
|
*/
|
|
291
291
|
longestGlobalOptionTermLength(e, t) {
|
|
292
|
-
return t.visibleGlobalOptions(e).reduce((i,
|
|
292
|
+
return t.visibleGlobalOptions(e).reduce((i, s) => Math.max(i, t.optionTerm(s).length), 0);
|
|
293
293
|
}
|
|
294
294
|
/**
|
|
295
295
|
* Get the longest argument term length.
|
|
@@ -299,7 +299,7 @@ var Y = b((ue) => {
|
|
|
299
299
|
* @returns {number}
|
|
300
300
|
*/
|
|
301
301
|
longestArgumentTermLength(e, t) {
|
|
302
|
-
return t.visibleArguments(e).reduce((i,
|
|
302
|
+
return t.visibleArguments(e).reduce((i, s) => Math.max(i, t.argumentTerm(s).length), 0);
|
|
303
303
|
}
|
|
304
304
|
/**
|
|
305
305
|
* Get the command usage to be displayed at the top of the built-in help.
|
|
@@ -311,8 +311,8 @@ var Y = b((ue) => {
|
|
|
311
311
|
let t = e._name;
|
|
312
312
|
e._aliases[0] && (t = t + "|" + e._aliases[0]);
|
|
313
313
|
let i = "";
|
|
314
|
-
for (let
|
|
315
|
-
i =
|
|
314
|
+
for (let s = e.parent; s; s = s.parent)
|
|
315
|
+
i = s.name() + " " + i;
|
|
316
316
|
return i + t + " " + e.usage();
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
@@ -377,44 +377,44 @@ var Y = b((ue) => {
|
|
|
377
377
|
* @returns {string}
|
|
378
378
|
*/
|
|
379
379
|
formatHelp(e, t) {
|
|
380
|
-
let i = t.padWidth(e, t),
|
|
380
|
+
let i = t.padWidth(e, t), s = t.helpWidth || 80, r = 2, o = 2;
|
|
381
381
|
function l(f, v) {
|
|
382
382
|
if (v) {
|
|
383
383
|
let M = `${f.padEnd(i + o)}${v}`;
|
|
384
384
|
return t.wrap(
|
|
385
385
|
M,
|
|
386
|
-
|
|
386
|
+
s - r,
|
|
387
387
|
i + o
|
|
388
388
|
);
|
|
389
389
|
}
|
|
390
390
|
return f;
|
|
391
391
|
}
|
|
392
|
-
|
|
392
|
+
d(l, "formatItem");
|
|
393
393
|
function a(f) {
|
|
394
394
|
return f.join(`
|
|
395
395
|
`).replace(/^/gm, " ".repeat(r));
|
|
396
396
|
}
|
|
397
|
-
|
|
398
|
-
let
|
|
399
|
-
|
|
400
|
-
t.wrap(
|
|
397
|
+
d(a, "formatList");
|
|
398
|
+
let c = [`Usage: ${t.commandUsage(e)}`, ""], u = t.commandDescription(e);
|
|
399
|
+
u.length > 0 && (c = c.concat([
|
|
400
|
+
t.wrap(u, s, 0),
|
|
401
401
|
""
|
|
402
402
|
]));
|
|
403
|
-
let
|
|
403
|
+
let p = t.visibleArguments(e).map((f) => l(
|
|
404
404
|
t.argumentTerm(f),
|
|
405
405
|
t.argumentDescription(f)
|
|
406
406
|
));
|
|
407
|
-
|
|
407
|
+
p.length > 0 && (c = c.concat(["Arguments:", a(p), ""]));
|
|
408
408
|
let m = t.visibleOptions(e).map((f) => l(
|
|
409
409
|
t.optionTerm(f),
|
|
410
410
|
t.optionDescription(f)
|
|
411
411
|
));
|
|
412
|
-
if (m.length > 0 && (
|
|
412
|
+
if (m.length > 0 && (c = c.concat(["Options:", a(m), ""])), this.showGlobalOptions) {
|
|
413
413
|
let f = t.visibleGlobalOptions(e).map((v) => l(
|
|
414
414
|
t.optionTerm(v),
|
|
415
415
|
t.optionDescription(v)
|
|
416
416
|
));
|
|
417
|
-
f.length > 0 && (
|
|
417
|
+
f.length > 0 && (c = c.concat([
|
|
418
418
|
"Global Options:",
|
|
419
419
|
a(f),
|
|
420
420
|
""
|
|
@@ -424,7 +424,7 @@ var Y = b((ue) => {
|
|
|
424
424
|
t.subcommandTerm(f),
|
|
425
425
|
t.subcommandDescription(f)
|
|
426
426
|
));
|
|
427
|
-
return x.length > 0 && (
|
|
427
|
+
return x.length > 0 && (c = c.concat(["Commands:", a(x), ""])), c.join(`
|
|
428
428
|
`);
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
@@ -453,31 +453,31 @@ var Y = b((ue) => {
|
|
|
453
453
|
* @return {string}
|
|
454
454
|
*
|
|
455
455
|
*/
|
|
456
|
-
wrap(e, t, i,
|
|
456
|
+
wrap(e, t, i, s = 40) {
|
|
457
457
|
let r = " \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF", o = new RegExp(`[\\n][${r}]+`);
|
|
458
458
|
if (e.match(o)) return e;
|
|
459
459
|
let l = t - i;
|
|
460
|
-
if (l <
|
|
461
|
-
let a = e.slice(0, i),
|
|
460
|
+
if (l < s) return e;
|
|
461
|
+
let a = e.slice(0, i), c = e.slice(i).replace(`\r
|
|
462
462
|
`, `
|
|
463
|
-
`),
|
|
463
|
+
`), u = " ".repeat(i), m = "\\s\u200B", x = new RegExp(
|
|
464
464
|
`
|
|
465
465
|
|.{1,${l - 1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,
|
|
466
466
|
"g"
|
|
467
|
-
), f =
|
|
467
|
+
), f = c.match(x) || [];
|
|
468
468
|
return a + f.map((v, M) => v === `
|
|
469
|
-
` ? "" : (M > 0 ?
|
|
469
|
+
` ? "" : (M > 0 ? u : "") + v.trimEnd()).join(`
|
|
470
470
|
`);
|
|
471
471
|
}
|
|
472
472
|
};
|
|
473
|
-
|
|
473
|
+
ce.Help = J;
|
|
474
474
|
});
|
|
475
475
|
|
|
476
476
|
// ../node_modules/commander/lib/option.js
|
|
477
477
|
var X = b((Q) => {
|
|
478
478
|
var { InvalidArgumentError: Ke } = k(), z = class {
|
|
479
479
|
static {
|
|
480
|
-
|
|
480
|
+
d(this, "Option");
|
|
481
481
|
}
|
|
482
482
|
/**
|
|
483
483
|
* Initialize a new `Option` with the given `flags` and `description`.
|
|
@@ -648,7 +648,7 @@ var X = b((Q) => {
|
|
|
648
648
|
}
|
|
649
649
|
}, K = class {
|
|
650
650
|
static {
|
|
651
|
-
|
|
651
|
+
d(this, "DualOptions");
|
|
652
652
|
}
|
|
653
653
|
/**
|
|
654
654
|
* @param {Option[]} options
|
|
@@ -671,74 +671,74 @@ var X = b((Q) => {
|
|
|
671
671
|
valueFromOption(e, t) {
|
|
672
672
|
let i = t.attributeName();
|
|
673
673
|
if (!this.dualOptions.has(i)) return !0;
|
|
674
|
-
let
|
|
674
|
+
let s = this.negativeOptions.get(i).presetArg, r = s !== void 0 ? s : !1;
|
|
675
675
|
return t.negate === (r === e);
|
|
676
676
|
}
|
|
677
677
|
};
|
|
678
|
-
function Qe(
|
|
679
|
-
return
|
|
678
|
+
function Qe(n) {
|
|
679
|
+
return n.split("-").reduce((e, t) => e + t[0].toUpperCase() + t.slice(1));
|
|
680
680
|
}
|
|
681
|
-
|
|
682
|
-
function Xe(
|
|
683
|
-
let e, t, i =
|
|
681
|
+
d(Qe, "camelcase");
|
|
682
|
+
function Xe(n) {
|
|
683
|
+
let e, t, i = n.split(/[ |,]+/);
|
|
684
684
|
return i.length > 1 && !/^[[<]/.test(i[1]) && (e = i.shift()), t = i.shift(), !e && /^-[^-]$/.test(t) && (e = t, t = void 0), { shortFlag: e,
|
|
685
685
|
longFlag: t };
|
|
686
686
|
}
|
|
687
|
-
|
|
687
|
+
d(Xe, "splitOptionFlags");
|
|
688
688
|
Q.Option = z;
|
|
689
689
|
Q.DualOptions = K;
|
|
690
690
|
});
|
|
691
691
|
|
|
692
692
|
// ../node_modules/commander/lib/suggestSimilar.js
|
|
693
|
-
var
|
|
694
|
-
function Ze(
|
|
695
|
-
if (Math.abs(
|
|
696
|
-
return Math.max(
|
|
693
|
+
var pe = b((ue) => {
|
|
694
|
+
function Ze(n, e) {
|
|
695
|
+
if (Math.abs(n.length - e.length) > 3)
|
|
696
|
+
return Math.max(n.length, e.length);
|
|
697
697
|
let t = [];
|
|
698
|
-
for (let i = 0; i <=
|
|
698
|
+
for (let i = 0; i <= n.length; i++)
|
|
699
699
|
t[i] = [i];
|
|
700
700
|
for (let i = 0; i <= e.length; i++)
|
|
701
701
|
t[0][i] = i;
|
|
702
702
|
for (let i = 1; i <= e.length; i++)
|
|
703
|
-
for (let
|
|
703
|
+
for (let s = 1; s <= n.length; s++) {
|
|
704
704
|
let r = 1;
|
|
705
|
-
s
|
|
706
|
-
t[
|
|
705
|
+
n[s - 1] === e[i - 1] ? r = 0 : r = 1, t[s][i] = Math.min(
|
|
706
|
+
t[s - 1][i] + 1,
|
|
707
707
|
// deletion
|
|
708
|
-
t[
|
|
708
|
+
t[s][i - 1] + 1,
|
|
709
709
|
// insertion
|
|
710
|
-
t[
|
|
710
|
+
t[s - 1][i - 1] + r
|
|
711
711
|
// substitution
|
|
712
|
-
),
|
|
712
|
+
), 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));
|
|
713
713
|
}
|
|
714
|
-
return t[
|
|
714
|
+
return t[n.length][e.length];
|
|
715
715
|
}
|
|
716
|
-
|
|
717
|
-
function et(
|
|
716
|
+
d(Ze, "editDistance");
|
|
717
|
+
function et(n, e) {
|
|
718
718
|
if (!e || e.length === 0) return "";
|
|
719
719
|
e = Array.from(new Set(e));
|
|
720
|
-
let t =
|
|
721
|
-
t && (
|
|
722
|
-
let i = [],
|
|
720
|
+
let t = n.startsWith("--");
|
|
721
|
+
t && (n = n.slice(2), e = e.map((o) => o.slice(2)));
|
|
722
|
+
let i = [], s = 3, r = 0.4;
|
|
723
723
|
return e.forEach((o) => {
|
|
724
724
|
if (o.length <= 1) return;
|
|
725
|
-
let l = Ze(
|
|
726
|
-
(a - l) / a > r && (l <
|
|
725
|
+
let l = Ze(n, o), a = Math.max(n.length, o.length);
|
|
726
|
+
(a - l) / a > r && (l < s ? (s = l, i = [o]) : l === s && i.push(o));
|
|
727
727
|
}), i.sort((o, l) => o.localeCompare(l)), t && (i = i.map((o) => `--${o}`)), i.length > 1 ? `
|
|
728
728
|
(Did you mean one of ${i.join(", ")}?)` : i.length === 1 ? `
|
|
729
729
|
(Did you mean ${i[0]}?)` : "";
|
|
730
730
|
}
|
|
731
|
-
|
|
732
|
-
|
|
731
|
+
d(et, "suggestSimilar");
|
|
732
|
+
ue.suggestSimilar = et;
|
|
733
733
|
});
|
|
734
734
|
|
|
735
735
|
// ../node_modules/commander/lib/command.js
|
|
736
736
|
var be = b((ge) => {
|
|
737
|
-
var tt = require("node:events").EventEmitter, Z = require("node:child_process"), y = require("node:path"), ee = require("node:fs"),
|
|
738
|
-
{ Argument: it, humanReadableArgName:
|
|
739
|
-
{ suggestSimilar: me } =
|
|
737
|
+
var tt = require("node:events").EventEmitter, Z = require("node:child_process"), y = require("node:path"), ee = require("node:fs"), h = require("node:process"),
|
|
738
|
+
{ Argument: it, humanReadableArgName: st } = V(), { CommanderError: te } = k(), { Help: rt } = Y(), { Option: he, DualOptions: nt } = X(),
|
|
739
|
+
{ suggestSimilar: me } = pe(), ie = class n extends tt {
|
|
740
740
|
static {
|
|
741
|
-
|
|
741
|
+
d(this, "Command");
|
|
742
742
|
}
|
|
743
743
|
/**
|
|
744
744
|
* Initialize a new `Command`.
|
|
@@ -753,11 +753,11 @@ var be = b((ge) => {
|
|
|
753
753
|
null, this._aliases = [], this._combineFlagAndOptionalValue = !0, this._description = "", this._summary = "", this._argsDescription = void 0,
|
|
754
754
|
this._enablePositionalOptions = !1, this._passThroughOptions = !1, this._lifeCycleHooks = {}, this._showHelpAfterError = !1, this._showSuggestionAfterError =
|
|
755
755
|
!0, this._outputConfiguration = {
|
|
756
|
-
writeOut: /* @__PURE__ */
|
|
757
|
-
writeErr: /* @__PURE__ */
|
|
758
|
-
getOutHelpWidth: /* @__PURE__ */
|
|
759
|
-
getErrHelpWidth: /* @__PURE__ */
|
|
760
|
-
outputError: /* @__PURE__ */
|
|
756
|
+
writeOut: /* @__PURE__ */ d((t) => h.stdout.write(t), "writeOut"),
|
|
757
|
+
writeErr: /* @__PURE__ */ d((t) => h.stderr.write(t), "writeErr"),
|
|
758
|
+
getOutHelpWidth: /* @__PURE__ */ d(() => h.stdout.isTTY ? h.stdout.columns : void 0, "getOutHelpWidth"),
|
|
759
|
+
getErrHelpWidth: /* @__PURE__ */ d(() => h.stderr.isTTY ? h.stderr.columns : void 0, "getErrHelpWidth"),
|
|
760
|
+
outputError: /* @__PURE__ */ d((t, i) => i(t), "outputError")
|
|
761
761
|
}, this._hidden = !1, this._helpOption = void 0, this._addImplicitHelpCommand = void 0, this._helpCommand = void 0, this._helpConfiguration =
|
|
762
762
|
{};
|
|
763
763
|
}
|
|
@@ -811,12 +811,12 @@ var be = b((ge) => {
|
|
|
811
811
|
* @return {Command} returns new command for action handler, or `this` for executable command
|
|
812
812
|
*/
|
|
813
813
|
command(e, t, i) {
|
|
814
|
-
let
|
|
815
|
-
typeof
|
|
814
|
+
let s = t, r = i;
|
|
815
|
+
typeof s == "object" && s !== null && (r = s, s = null), r = r || {};
|
|
816
816
|
let [, o, l] = e.match(/([^ ]+) *(.*)/), a = this.createCommand(o);
|
|
817
|
-
return
|
|
817
|
+
return s && (a.description(s), a._executableHandler = !0), r.isDefault && (this._defaultCommandName = a._name), a._hidden = !!(r.noHelp ||
|
|
818
818
|
r.hidden), a._executableFile = r.executableFile || null, l && a.arguments(l), this._registerCommand(a), a.parent = this, a.copyInheritedSettings(
|
|
819
|
-
this),
|
|
819
|
+
this), s ? this : a;
|
|
820
820
|
}
|
|
821
821
|
/**
|
|
822
822
|
* Factory routine to create a new unattached command.
|
|
@@ -828,7 +828,7 @@ var be = b((ge) => {
|
|
|
828
828
|
* @return {Command} new command
|
|
829
829
|
*/
|
|
830
830
|
createCommand(e) {
|
|
831
|
-
return new
|
|
831
|
+
return new n(e);
|
|
832
832
|
}
|
|
833
833
|
/**
|
|
834
834
|
* You can customise the help with a subclass of Help by overriding createHelp,
|
|
@@ -933,9 +933,9 @@ var be = b((ge) => {
|
|
|
933
933
|
* @param {*} [defaultValue]
|
|
934
934
|
* @return {Command} `this` command for chaining
|
|
935
935
|
*/
|
|
936
|
-
argument(e, t, i,
|
|
936
|
+
argument(e, t, i, s) {
|
|
937
937
|
let r = this.createArgument(e, t);
|
|
938
|
-
return typeof i == "function" ? r.default(
|
|
938
|
+
return typeof i == "function" ? r.default(s).argParser(i) : r.default(i), this.addArgument(r), this;
|
|
939
939
|
}
|
|
940
940
|
/**
|
|
941
941
|
* Define argument syntax for command, adding multiple at once (without descriptions).
|
|
@@ -988,8 +988,8 @@ var be = b((ge) => {
|
|
|
988
988
|
if (typeof e == "boolean")
|
|
989
989
|
return this._addImplicitHelpCommand = e, this;
|
|
990
990
|
e = e ?? "help [command]";
|
|
991
|
-
let [, i,
|
|
992
|
-
return o.helpOption(!1),
|
|
991
|
+
let [, i, s] = e.match(/([^ ]+) *(.*)/), r = t ?? "display help for command", o = this.createCommand(i);
|
|
992
|
+
return o.helpOption(!1), s && o.arguments(s), r && o.description(r), this._addImplicitHelpCommand = !0, this._helpCommand = o, this;
|
|
993
993
|
}
|
|
994
994
|
/**
|
|
995
995
|
* Add prepared custom help command.
|
|
@@ -1047,7 +1047,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1047
1047
|
* @private
|
|
1048
1048
|
*/
|
|
1049
1049
|
_exit(e, t, i) {
|
|
1050
|
-
this._exitCallback && this._exitCallback(new te(e, t, i)),
|
|
1050
|
+
this._exitCallback && this._exitCallback(new te(e, t, i)), h.exit(e);
|
|
1051
1051
|
}
|
|
1052
1052
|
/**
|
|
1053
1053
|
* Register callback `fn` for the command.
|
|
@@ -1064,9 +1064,9 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1064
1064
|
* @return {Command} `this` command for chaining
|
|
1065
1065
|
*/
|
|
1066
1066
|
action(e) {
|
|
1067
|
-
let t = /* @__PURE__ */
|
|
1068
|
-
let
|
|
1069
|
-
return this._storeOptionsAsProperties ? r[
|
|
1067
|
+
let t = /* @__PURE__ */ d((i) => {
|
|
1068
|
+
let s = this.registeredArguments.length, r = i.slice(0, s);
|
|
1069
|
+
return this._storeOptionsAsProperties ? r[s] = this : r[s] = this.opts(), r.push(this), e.apply(this, r);
|
|
1070
1070
|
}, "listener");
|
|
1071
1071
|
return this._actionHandler = t, this;
|
|
1072
1072
|
}
|
|
@@ -1081,7 +1081,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1081
1081
|
* @return {Option} new option
|
|
1082
1082
|
*/
|
|
1083
1083
|
createOption(e, t) {
|
|
1084
|
-
return new
|
|
1084
|
+
return new he(e, t);
|
|
1085
1085
|
}
|
|
1086
1086
|
/**
|
|
1087
1087
|
* Wrap parseArgs to catch 'commander.invalidArgument'.
|
|
@@ -1092,12 +1092,12 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1092
1092
|
* @param {string} invalidArgumentMessage
|
|
1093
1093
|
* @private
|
|
1094
1094
|
*/
|
|
1095
|
-
_callParseArg(e, t, i,
|
|
1095
|
+
_callParseArg(e, t, i, s) {
|
|
1096
1096
|
try {
|
|
1097
1097
|
return e.parseArg(t, i);
|
|
1098
1098
|
} catch (r) {
|
|
1099
1099
|
if (r.code === "commander.invalidArgument") {
|
|
1100
|
-
let o = `${
|
|
1100
|
+
let o = `${s} ${r.message}`;
|
|
1101
1101
|
this.error(o, { exitCode: r.exitCode, code: r.code });
|
|
1102
1102
|
}
|
|
1103
1103
|
throw r;
|
|
@@ -1127,13 +1127,13 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1127
1127
|
* @private
|
|
1128
1128
|
*/
|
|
1129
1129
|
_registerCommand(e) {
|
|
1130
|
-
let t = /* @__PURE__ */
|
|
1131
|
-
(
|
|
1130
|
+
let t = /* @__PURE__ */ d((s) => [s.name()].concat(s.aliases()), "knownBy"), i = t(e).find(
|
|
1131
|
+
(s) => this._findCommand(s)
|
|
1132
1132
|
);
|
|
1133
1133
|
if (i) {
|
|
1134
|
-
let
|
|
1134
|
+
let s = t(this._findCommand(i)).join("|"), r = t(e).join("|");
|
|
1135
1135
|
throw new Error(
|
|
1136
|
-
`cannot add command '${r}' as already have command '${
|
|
1136
|
+
`cannot add command '${r}' as already have command '${s}'`
|
|
1137
1137
|
);
|
|
1138
1138
|
}
|
|
1139
1139
|
this.commands.push(e);
|
|
@@ -1155,7 +1155,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1155
1155
|
"default"
|
|
1156
1156
|
);
|
|
1157
1157
|
} else e.defaultValue !== void 0 && this.setOptionValueWithSource(i, e.defaultValue, "default");
|
|
1158
|
-
let
|
|
1158
|
+
let s = /* @__PURE__ */ d((r, o, l) => {
|
|
1159
1159
|
r == null && e.presetArg !== void 0 && (r = e.presetArg);
|
|
1160
1160
|
let a = this.getOptionValue(i);
|
|
1161
1161
|
r !== null && e.parseArg ? r = this._callParseArg(e, r, a, o) : r !== null && e.variadic && (r = e._concatValue(r, a)), r == null &&
|
|
@@ -1163,10 +1163,10 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1163
1163
|
}, "handleOptionValue");
|
|
1164
1164
|
return this.on("option:" + t, (r) => {
|
|
1165
1165
|
let o = `error: option '${e.flags}' argument '${r}' is invalid.`;
|
|
1166
|
-
|
|
1166
|
+
s(r, o, "cli");
|
|
1167
1167
|
}), e.envVar && this.on("optionEnv:" + t, (r) => {
|
|
1168
1168
|
let o = `error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;
|
|
1169
|
-
|
|
1169
|
+
s(r, o, "env");
|
|
1170
1170
|
}), this;
|
|
1171
1171
|
}
|
|
1172
1172
|
/**
|
|
@@ -1175,22 +1175,22 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1175
1175
|
* @return {Command} `this` command for chaining
|
|
1176
1176
|
* @private
|
|
1177
1177
|
*/
|
|
1178
|
-
_optionEx(e, t, i,
|
|
1179
|
-
if (typeof t == "object" && t instanceof
|
|
1178
|
+
_optionEx(e, t, i, s, r) {
|
|
1179
|
+
if (typeof t == "object" && t instanceof he)
|
|
1180
1180
|
throw new Error(
|
|
1181
1181
|
"To add an Option object use addOption() instead of option() or requiredOption()"
|
|
1182
1182
|
);
|
|
1183
1183
|
let o = this.createOption(t, i);
|
|
1184
|
-
if (o.makeOptionMandatory(!!e.mandatory), typeof
|
|
1185
|
-
o.default(r).argParser(
|
|
1186
|
-
else if (
|
|
1187
|
-
let l =
|
|
1188
|
-
|
|
1189
|
-
let
|
|
1190
|
-
return
|
|
1191
|
-
}, "fn"), o.default(r).argParser(
|
|
1184
|
+
if (o.makeOptionMandatory(!!e.mandatory), typeof s == "function")
|
|
1185
|
+
o.default(r).argParser(s);
|
|
1186
|
+
else if (s instanceof RegExp) {
|
|
1187
|
+
let l = s;
|
|
1188
|
+
s = /* @__PURE__ */ d((a, c) => {
|
|
1189
|
+
let u = l.exec(a);
|
|
1190
|
+
return u ? u[0] : c;
|
|
1191
|
+
}, "fn"), o.default(r).argParser(s);
|
|
1192
1192
|
} else
|
|
1193
|
-
o.default(
|
|
1193
|
+
o.default(s);
|
|
1194
1194
|
return this.addOption(o);
|
|
1195
1195
|
}
|
|
1196
1196
|
/**
|
|
@@ -1214,8 +1214,8 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1214
1214
|
* @param {*} [defaultValue]
|
|
1215
1215
|
* @return {Command} `this` command for chaining
|
|
1216
1216
|
*/
|
|
1217
|
-
option(e, t, i,
|
|
1218
|
-
return this._optionEx({}, e, t, i,
|
|
1217
|
+
option(e, t, i, s) {
|
|
1218
|
+
return this._optionEx({}, e, t, i, s);
|
|
1219
1219
|
}
|
|
1220
1220
|
/**
|
|
1221
1221
|
* Add a required option which must have a value after parsing. This usually means
|
|
@@ -1229,13 +1229,13 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1229
1229
|
* @param {*} [defaultValue]
|
|
1230
1230
|
* @return {Command} `this` command for chaining
|
|
1231
1231
|
*/
|
|
1232
|
-
requiredOption(e, t, i,
|
|
1232
|
+
requiredOption(e, t, i, s) {
|
|
1233
1233
|
return this._optionEx(
|
|
1234
1234
|
{ mandatory: !0 },
|
|
1235
1235
|
e,
|
|
1236
1236
|
t,
|
|
1237
1237
|
i,
|
|
1238
|
-
|
|
1238
|
+
s
|
|
1239
1239
|
);
|
|
1240
1240
|
}
|
|
1241
1241
|
/**
|
|
@@ -1381,11 +1381,11 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1381
1381
|
if (e !== void 0 && !Array.isArray(e))
|
|
1382
1382
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1383
1383
|
if (t = t || {}, e === void 0 && t.from === void 0) {
|
|
1384
|
-
|
|
1385
|
-
let
|
|
1386
|
-
(
|
|
1384
|
+
h.versions?.electron && (t.from = "electron");
|
|
1385
|
+
let s = h.execArgv ?? [];
|
|
1386
|
+
(s.includes("-e") || s.includes("--eval") || s.includes("-p") || s.includes("--print")) && (t.from = "eval");
|
|
1387
1387
|
}
|
|
1388
|
-
e === void 0 && (e =
|
|
1388
|
+
e === void 0 && (e = h.argv), this.rawArgs = e.slice();
|
|
1389
1389
|
let i;
|
|
1390
1390
|
switch (t.from) {
|
|
1391
1391
|
case void 0:
|
|
@@ -1393,7 +1393,7 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1393
1393
|
this._scriptPath = e[1], i = e.slice(2);
|
|
1394
1394
|
break;
|
|
1395
1395
|
case "electron":
|
|
1396
|
-
|
|
1396
|
+
h.defaultApp ? (this._scriptPath = e[1], i = e.slice(2)) : i = e.slice(1);
|
|
1397
1397
|
break;
|
|
1398
1398
|
case "user":
|
|
1399
1399
|
i = e.slice(0);
|
|
@@ -1465,82 +1465,82 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
1465
1465
|
*/
|
|
1466
1466
|
_executeSubCommand(e, t) {
|
|
1467
1467
|
t = t.slice();
|
|
1468
|
-
let i = !1,
|
|
1469
|
-
function r(
|
|
1470
|
-
let m = y.resolve(
|
|
1468
|
+
let i = !1, s = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1469
|
+
function r(u, p) {
|
|
1470
|
+
let m = y.resolve(u, p);
|
|
1471
1471
|
if (ee.existsSync(m)) return m;
|
|
1472
|
-
if (
|
|
1473
|
-
let x =
|
|
1472
|
+
if (s.includes(y.extname(p))) return;
|
|
1473
|
+
let x = s.find(
|
|
1474
1474
|
(f) => ee.existsSync(`${m}${f}`)
|
|
1475
1475
|
);
|
|
1476
1476
|
if (x) return `${m}${x}`;
|
|
1477
1477
|
}
|
|
1478
|
-
|
|
1478
|
+
d(r, "findFile"), this._checkForMissingMandatoryOptions(), this._checkForConflictingOptions();
|
|
1479
1479
|
let o = e._executableFile || `${this._name}-${e._name}`, l = this._executableDir || "";
|
|
1480
1480
|
if (this._scriptPath) {
|
|
1481
|
-
let
|
|
1481
|
+
let u;
|
|
1482
1482
|
try {
|
|
1483
|
-
|
|
1483
|
+
u = ee.realpathSync(this._scriptPath);
|
|
1484
1484
|
} catch {
|
|
1485
|
-
|
|
1485
|
+
u = this._scriptPath;
|
|
1486
1486
|
}
|
|
1487
1487
|
l = y.resolve(
|
|
1488
|
-
y.dirname(
|
|
1488
|
+
y.dirname(u),
|
|
1489
1489
|
l
|
|
1490
1490
|
);
|
|
1491
1491
|
}
|
|
1492
1492
|
if (l) {
|
|
1493
|
-
let
|
|
1494
|
-
if (!
|
|
1495
|
-
let
|
|
1493
|
+
let u = r(l, o);
|
|
1494
|
+
if (!u && !e._executableFile && this._scriptPath) {
|
|
1495
|
+
let p = y.basename(
|
|
1496
1496
|
this._scriptPath,
|
|
1497
1497
|
y.extname(this._scriptPath)
|
|
1498
1498
|
);
|
|
1499
|
-
|
|
1499
|
+
p !== this._name && (u = r(
|
|
1500
1500
|
l,
|
|
1501
|
-
`${
|
|
1501
|
+
`${p}-${e._name}`
|
|
1502
1502
|
));
|
|
1503
1503
|
}
|
|
1504
|
-
o =
|
|
1504
|
+
o = u || o;
|
|
1505
1505
|
}
|
|
1506
|
-
i =
|
|
1506
|
+
i = s.includes(y.extname(o));
|
|
1507
1507
|
let a;
|
|
1508
|
-
|
|
1509
|
-
o, t, { stdio: "inherit" }) : (t.unshift(o), t = fe(
|
|
1510
|
-
["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"].forEach((
|
|
1511
|
-
|
|
1512
|
-
a.killed === !1 && a.exitCode === null && a.kill(
|
|
1508
|
+
h.platform !== "win32" ? i ? (t.unshift(o), t = fe(h.execArgv).concat(t), a = Z.spawn(h.argv[0], t, { stdio: "inherit" })) : a = Z.spawn(
|
|
1509
|
+
o, t, { stdio: "inherit" }) : (t.unshift(o), t = fe(h.execArgv).concat(t), a = Z.spawn(h.execPath, t, { stdio: "inherit" })), a.killed ||
|
|
1510
|
+
["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"].forEach((p) => {
|
|
1511
|
+
h.on(p, () => {
|
|
1512
|
+
a.killed === !1 && a.exitCode === null && a.kill(p);
|
|
1513
1513
|
});
|
|
1514
1514
|
});
|
|
1515
|
-
let
|
|
1516
|
-
a.on("close", (
|
|
1517
|
-
|
|
1515
|
+
let c = this._exitCallback;
|
|
1516
|
+
a.on("close", (u) => {
|
|
1517
|
+
u = u ?? 1, c ? c(
|
|
1518
1518
|
new te(
|
|
1519
|
-
|
|
1519
|
+
u,
|
|
1520
1520
|
"commander.executeSubCommandAsync",
|
|
1521
1521
|
"(close)"
|
|
1522
1522
|
)
|
|
1523
|
-
) :
|
|
1524
|
-
}), a.on("error", (
|
|
1525
|
-
if (
|
|
1526
|
-
let
|
|
1523
|
+
) : h.exit(u);
|
|
1524
|
+
}), a.on("error", (u) => {
|
|
1525
|
+
if (u.code === "ENOENT") {
|
|
1526
|
+
let p = l ? `searched for local subcommand relative to directory '${l}'` : "no directory for search for local subcommand, use .exe\
|
|
1527
1527
|
cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
1528
1528
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\
|
|
1529
1529
|
|
|
1530
1530
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
1531
|
-
- ${
|
|
1531
|
+
- ${p}`;
|
|
1532
1532
|
throw new Error(m);
|
|
1533
|
-
} else if (
|
|
1533
|
+
} else if (u.code === "EACCES")
|
|
1534
1534
|
throw new Error(`'${o}' not executable`);
|
|
1535
|
-
if (!
|
|
1536
|
-
|
|
1535
|
+
if (!c)
|
|
1536
|
+
h.exit(1);
|
|
1537
1537
|
else {
|
|
1538
|
-
let
|
|
1538
|
+
let p = new te(
|
|
1539
1539
|
1,
|
|
1540
1540
|
"commander.executeSubCommandAsync",
|
|
1541
1541
|
"(error)"
|
|
1542
1542
|
);
|
|
1543
|
-
|
|
1543
|
+
p.nestedError = u, c(p);
|
|
1544
1544
|
}
|
|
1545
1545
|
}), this.runningCommand = a;
|
|
1546
1546
|
}
|
|
@@ -1548,18 +1548,18 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1548
1548
|
* @private
|
|
1549
1549
|
*/
|
|
1550
1550
|
_dispatchSubcommand(e, t, i) {
|
|
1551
|
-
let
|
|
1552
|
-
|
|
1551
|
+
let s = this._findCommand(e);
|
|
1552
|
+
s || this.help({ error: !0 });
|
|
1553
1553
|
let r;
|
|
1554
1554
|
return r = this._chainOrCallSubCommandHook(
|
|
1555
1555
|
r,
|
|
1556
|
-
|
|
1556
|
+
s,
|
|
1557
1557
|
"preSubcommand"
|
|
1558
1558
|
), r = this._chainOrCall(r, () => {
|
|
1559
|
-
if (
|
|
1560
|
-
this._executeSubCommand(
|
|
1559
|
+
if (s._executableHandler)
|
|
1560
|
+
this._executeSubCommand(s, t.concat(i));
|
|
1561
1561
|
else
|
|
1562
|
-
return
|
|
1562
|
+
return s._parseCommand(t, i);
|
|
1563
1563
|
}), r;
|
|
1564
1564
|
}
|
|
1565
1565
|
/**
|
|
@@ -1594,13 +1594,13 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1594
1594
|
* @private
|
|
1595
1595
|
*/
|
|
1596
1596
|
_processArguments() {
|
|
1597
|
-
let e = /* @__PURE__ */
|
|
1598
|
-
let o =
|
|
1599
|
-
if (
|
|
1600
|
-
let l = `error: command-argument value '${
|
|
1597
|
+
let e = /* @__PURE__ */ d((i, s, r) => {
|
|
1598
|
+
let o = s;
|
|
1599
|
+
if (s !== null && i.parseArg) {
|
|
1600
|
+
let l = `error: command-argument value '${s}' is invalid for argument '${i.name()}'.`;
|
|
1601
1601
|
o = this._callParseArg(
|
|
1602
1602
|
i,
|
|
1603
|
-
|
|
1603
|
+
s,
|
|
1604
1604
|
r,
|
|
1605
1605
|
l
|
|
1606
1606
|
);
|
|
@@ -1609,10 +1609,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1609
1609
|
}, "myParseArg");
|
|
1610
1610
|
this._checkNumberOfArguments();
|
|
1611
1611
|
let t = [];
|
|
1612
|
-
this.registeredArguments.forEach((i,
|
|
1612
|
+
this.registeredArguments.forEach((i, s) => {
|
|
1613
1613
|
let r = i.defaultValue;
|
|
1614
|
-
i.variadic ?
|
|
1615
|
-
void 0 && (r = []) :
|
|
1614
|
+
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 ===
|
|
1615
|
+
void 0 && (r = []) : s < this.args.length && (r = this.args[s], i.parseArg && (r = e(i, r, i.defaultValue))), t[s] = r;
|
|
1616
1616
|
}), this.processedArgs = t;
|
|
1617
1617
|
}
|
|
1618
1618
|
/**
|
|
@@ -1634,12 +1634,12 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1634
1634
|
* @private
|
|
1635
1635
|
*/
|
|
1636
1636
|
_chainOrCallHooks(e, t) {
|
|
1637
|
-
let i = e,
|
|
1637
|
+
let i = e, s = [];
|
|
1638
1638
|
return this._getCommandAndAncestors().reverse().filter((r) => r._lifeCycleHooks[t] !== void 0).forEach((r) => {
|
|
1639
1639
|
r._lifeCycleHooks[t].forEach((o) => {
|
|
1640
|
-
|
|
1640
|
+
s.push({ hookedCommand: r, callback: o });
|
|
1641
1641
|
});
|
|
1642
|
-
}), t === "postAction" &&
|
|
1642
|
+
}), t === "postAction" && s.reverse(), s.forEach((r) => {
|
|
1643
1643
|
i = this._chainOrCall(i, () => r.callback(r.hookedCommand, this));
|
|
1644
1644
|
}), i;
|
|
1645
1645
|
}
|
|
@@ -1652,10 +1652,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1652
1652
|
* @private
|
|
1653
1653
|
*/
|
|
1654
1654
|
_chainOrCallSubCommandHook(e, t, i) {
|
|
1655
|
-
let
|
|
1655
|
+
let s = e;
|
|
1656
1656
|
return this._lifeCycleHooks[i] !== void 0 && this._lifeCycleHooks[i].forEach((r) => {
|
|
1657
|
-
|
|
1658
|
-
}),
|
|
1657
|
+
s = this._chainOrCall(s, () => r(this, t));
|
|
1658
|
+
}), s;
|
|
1659
1659
|
}
|
|
1660
1660
|
/**
|
|
1661
1661
|
* Process arguments in context of this command.
|
|
@@ -1678,11 +1678,11 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1678
1678
|
);
|
|
1679
1679
|
this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName && this.help({ error: !0 }), this.
|
|
1680
1680
|
_outputHelpIfRequested(i.unknown), this._checkForMissingMandatoryOptions(), this._checkForConflictingOptions();
|
|
1681
|
-
let
|
|
1681
|
+
let s = /* @__PURE__ */ d(() => {
|
|
1682
1682
|
i.unknown.length > 0 && this.unknownOption(i.unknown[0]);
|
|
1683
1683
|
}, "checkForUnknownOptions"), r = `command:${this.name()}`;
|
|
1684
1684
|
if (this._actionHandler) {
|
|
1685
|
-
|
|
1685
|
+
s(), this._processArguments();
|
|
1686
1686
|
let o;
|
|
1687
1687
|
return o = this._chainOrCallHooks(o, "preAction"), o = this._chainOrCall(
|
|
1688
1688
|
o,
|
|
@@ -1692,12 +1692,12 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1692
1692
|
})), o = this._chainOrCallHooks(o, "postAction"), o;
|
|
1693
1693
|
}
|
|
1694
1694
|
if (this.parent && this.parent.listenerCount(r))
|
|
1695
|
-
|
|
1695
|
+
s(), this._processArguments(), this.parent.emit(r, e, t);
|
|
1696
1696
|
else if (e.length) {
|
|
1697
1697
|
if (this._findCommand("*"))
|
|
1698
1698
|
return this._dispatchSubcommand("*", e, t);
|
|
1699
|
-
this.listenerCount("command:*") ? this.emit("command:*", e, t) : this.commands.length ? this.unknownCommand() : (
|
|
1700
|
-
} else this.commands.length ? (
|
|
1699
|
+
this.listenerCount("command:*") ? this.emit("command:*", e, t) : this.commands.length ? this.unknownCommand() : (s(), this._processArguments());
|
|
1700
|
+
} else this.commands.length ? (s(), this.help({ error: !0 })) : (s(), this._processArguments());
|
|
1701
1701
|
}
|
|
1702
1702
|
/**
|
|
1703
1703
|
* Find matching command.
|
|
@@ -1741,16 +1741,16 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1741
1741
|
*/
|
|
1742
1742
|
_checkForConflictingLocalOptions() {
|
|
1743
1743
|
let e = this.options.filter((i) => {
|
|
1744
|
-
let
|
|
1745
|
-
return this.getOptionValue(
|
|
1744
|
+
let s = i.attributeName();
|
|
1745
|
+
return this.getOptionValue(s) === void 0 ? !1 : this.getOptionValueSource(s) !== "default";
|
|
1746
1746
|
});
|
|
1747
1747
|
e.filter(
|
|
1748
1748
|
(i) => i.conflictsWith.length > 0
|
|
1749
1749
|
).forEach((i) => {
|
|
1750
|
-
let
|
|
1750
|
+
let s = e.find(
|
|
1751
1751
|
(r) => i.conflictsWith.includes(r.attributeName())
|
|
1752
1752
|
);
|
|
1753
|
-
|
|
1753
|
+
s && this._conflictingOption(i, s);
|
|
1754
1754
|
});
|
|
1755
1755
|
}
|
|
1756
1756
|
/**
|
|
@@ -1780,16 +1780,16 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1780
1780
|
* @return {{operands: string[], unknown: string[]}}
|
|
1781
1781
|
*/
|
|
1782
1782
|
parseOptions(e) {
|
|
1783
|
-
let t = [], i = [],
|
|
1783
|
+
let t = [], i = [], s = t, r = e.slice();
|
|
1784
1784
|
function o(a) {
|
|
1785
1785
|
return a.length > 1 && a[0] === "-";
|
|
1786
1786
|
}
|
|
1787
|
-
|
|
1787
|
+
d(o, "maybeOption");
|
|
1788
1788
|
let l = null;
|
|
1789
1789
|
for (; r.length; ) {
|
|
1790
1790
|
let a = r.shift();
|
|
1791
1791
|
if (a === "--") {
|
|
1792
|
-
|
|
1792
|
+
s === i && s.push(a), s.push(...r);
|
|
1793
1793
|
break;
|
|
1794
1794
|
}
|
|
1795
1795
|
if (l && !o(a)) {
|
|
@@ -1797,36 +1797,36 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1797
1797
|
continue;
|
|
1798
1798
|
}
|
|
1799
1799
|
if (l = null, o(a)) {
|
|
1800
|
-
let
|
|
1801
|
-
if (
|
|
1802
|
-
if (
|
|
1803
|
-
let
|
|
1804
|
-
|
|
1805
|
-
} else if (
|
|
1806
|
-
let
|
|
1807
|
-
r.length > 0 && !o(r[0]) && (
|
|
1800
|
+
let c = this._findOption(a);
|
|
1801
|
+
if (c) {
|
|
1802
|
+
if (c.required) {
|
|
1803
|
+
let u = r.shift();
|
|
1804
|
+
u === void 0 && this.optionMissingArgument(c), this.emit(`option:${c.name()}`, u);
|
|
1805
|
+
} else if (c.optional) {
|
|
1806
|
+
let u = null;
|
|
1807
|
+
r.length > 0 && !o(r[0]) && (u = r.shift()), this.emit(`option:${c.name()}`, u);
|
|
1808
1808
|
} else
|
|
1809
|
-
this.emit(`option:${
|
|
1810
|
-
l =
|
|
1809
|
+
this.emit(`option:${c.name()}`);
|
|
1810
|
+
l = c.variadic ? c : null;
|
|
1811
1811
|
continue;
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
1814
|
if (a.length > 2 && a[0] === "-" && a[1] !== "-") {
|
|
1815
|
-
let
|
|
1816
|
-
if (
|
|
1817
|
-
|
|
1818
|
-
:${
|
|
1815
|
+
let c = this._findOption(`-${a[1]}`);
|
|
1816
|
+
if (c) {
|
|
1817
|
+
c.required || c.optional && this._combineFlagAndOptionalValue ? this.emit(`option:${c.name()}`, a.slice(2)) : (this.emit(`option\
|
|
1818
|
+
:${c.name()}`), r.unshift(`-${a.slice(2)}`));
|
|
1819
1819
|
continue;
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
1822
|
if (/^--[^=]+=/.test(a)) {
|
|
1823
|
-
let
|
|
1824
|
-
if (
|
|
1825
|
-
this.emit(`option:${
|
|
1823
|
+
let c = a.indexOf("="), u = this._findOption(a.slice(0, c));
|
|
1824
|
+
if (u && (u.required || u.optional)) {
|
|
1825
|
+
this.emit(`option:${u.name()}`, a.slice(c + 1));
|
|
1826
1826
|
continue;
|
|
1827
1827
|
}
|
|
1828
1828
|
}
|
|
1829
|
-
if (o(a) && (
|
|
1829
|
+
if (o(a) && (s = i), (this._enablePositionalOptions || this._passThroughOptions) && t.length === 0 && i.length === 0) {
|
|
1830
1830
|
if (this._findCommand(a)) {
|
|
1831
1831
|
t.push(a), r.length > 0 && i.push(...r);
|
|
1832
1832
|
break;
|
|
@@ -1839,10 +1839,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1839
1839
|
}
|
|
1840
1840
|
}
|
|
1841
1841
|
if (this._passThroughOptions) {
|
|
1842
|
-
|
|
1842
|
+
s.push(a), r.length > 0 && s.push(...r);
|
|
1843
1843
|
break;
|
|
1844
1844
|
}
|
|
1845
|
-
|
|
1845
|
+
s.push(a);
|
|
1846
1846
|
}
|
|
1847
1847
|
return { operands: t, unknown: i };
|
|
1848
1848
|
}
|
|
@@ -1855,8 +1855,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1855
1855
|
if (this._storeOptionsAsProperties) {
|
|
1856
1856
|
let e = {}, t = this.options.length;
|
|
1857
1857
|
for (let i = 0; i < t; i++) {
|
|
1858
|
-
let
|
|
1859
|
-
e[
|
|
1858
|
+
let s = this.options[i].attributeName();
|
|
1859
|
+
e[s] = s === this._versionOptionName ? this._version : this[s];
|
|
1860
1860
|
}
|
|
1861
1861
|
return e;
|
|
1862
1862
|
}
|
|
@@ -1889,8 +1889,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1889
1889
|
), typeof this._showHelpAfterError == "string" ? this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
1890
1890
|
`) : this._showHelpAfterError && (this._outputConfiguration.writeErr(`
|
|
1891
1891
|
`), this.outputHelp({ error: !0 }));
|
|
1892
|
-
let i = t || {},
|
|
1893
|
-
this._exit(
|
|
1892
|
+
let i = t || {}, s = i.exitCode || 1, r = i.code || "commander.error";
|
|
1893
|
+
this._exit(s, r, e);
|
|
1894
1894
|
}
|
|
1895
1895
|
/**
|
|
1896
1896
|
* Apply any option related environment variables, if option does
|
|
@@ -1900,11 +1900,11 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1900
1900
|
*/
|
|
1901
1901
|
_parseOptionsEnv() {
|
|
1902
1902
|
this.options.forEach((e) => {
|
|
1903
|
-
if (e.envVar && e.envVar in
|
|
1903
|
+
if (e.envVar && e.envVar in h.env) {
|
|
1904
1904
|
let t = e.attributeName();
|
|
1905
1905
|
(this.getOptionValue(t) === void 0 || ["default", "config", "env"].includes(
|
|
1906
1906
|
this.getOptionValueSource(t)
|
|
1907
|
-
)) && (e.required || e.optional ? this.emit(`optionEnv:${e.name()}`,
|
|
1907
|
+
)) && (e.required || e.optional ? this.emit(`optionEnv:${e.name()}`, h.env[e.envVar]) : this.emit(`optionEnv:${e.name()}`));
|
|
1908
1908
|
}
|
|
1909
1909
|
});
|
|
1910
1910
|
}
|
|
@@ -1914,7 +1914,7 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1914
1914
|
* @private
|
|
1915
1915
|
*/
|
|
1916
1916
|
_parseOptionsImplied() {
|
|
1917
|
-
let e = new
|
|
1917
|
+
let e = new nt(this.options), t = /* @__PURE__ */ d((i) => this.getOptionValue(i) !== void 0 && !["default", "implied"].includes(this.
|
|
1918
1918
|
getOptionValueSource(i)), "hasCustomOptionValue");
|
|
1919
1919
|
this.options.filter(
|
|
1920
1920
|
(i) => i.implied !== void 0 && t(i.attributeName()) && e.valueFromOption(
|
|
@@ -1922,10 +1922,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1922
1922
|
i
|
|
1923
1923
|
)
|
|
1924
1924
|
).forEach((i) => {
|
|
1925
|
-
Object.keys(i.implied).filter((
|
|
1925
|
+
Object.keys(i.implied).filter((s) => !t(s)).forEach((s) => {
|
|
1926
1926
|
this.setOptionValueWithSource(
|
|
1927
|
-
|
|
1928
|
-
i.implied[
|
|
1927
|
+
s,
|
|
1928
|
+
i.implied[s],
|
|
1929
1929
|
"implied"
|
|
1930
1930
|
);
|
|
1931
1931
|
});
|
|
@@ -1969,17 +1969,17 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1969
1969
|
* @private
|
|
1970
1970
|
*/
|
|
1971
1971
|
_conflictingOption(e, t) {
|
|
1972
|
-
let i = /* @__PURE__ */
|
|
1973
|
-
let l = o.attributeName(), a = this.getOptionValue(l),
|
|
1974
|
-
(
|
|
1975
|
-
),
|
|
1976
|
-
(
|
|
1972
|
+
let i = /* @__PURE__ */ d((o) => {
|
|
1973
|
+
let l = o.attributeName(), a = this.getOptionValue(l), c = this.options.find(
|
|
1974
|
+
(p) => p.negate && l === p.attributeName()
|
|
1975
|
+
), u = this.options.find(
|
|
1976
|
+
(p) => !p.negate && l === p.attributeName()
|
|
1977
1977
|
);
|
|
1978
|
-
return
|
|
1979
|
-
}, "findBestOptionFromValue"),
|
|
1978
|
+
return c && (c.presetArg === void 0 && a === !1 || c.presetArg !== void 0 && a === c.presetArg) ? c : u || o;
|
|
1979
|
+
}, "findBestOptionFromValue"), s = /* @__PURE__ */ d((o) => {
|
|
1980
1980
|
let l = i(o), a = l.attributeName();
|
|
1981
1981
|
return this.getOptionValueSource(a) === "env" ? `environment variable '${l.envVar}'` : `option '${l.flags}'`;
|
|
1982
|
-
}, "getErrorMessage"), r = `error: ${
|
|
1982
|
+
}, "getErrorMessage"), r = `error: ${s(e)} cannot be used with ${s(t)}`;
|
|
1983
1983
|
this.error(r, { code: "commander.conflictingOption" });
|
|
1984
1984
|
}
|
|
1985
1985
|
/**
|
|
@@ -1992,12 +1992,12 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
1992
1992
|
if (this._allowUnknownOption) return;
|
|
1993
1993
|
let t = "";
|
|
1994
1994
|
if (e.startsWith("--") && this._showSuggestionAfterError) {
|
|
1995
|
-
let
|
|
1995
|
+
let s = [], r = this;
|
|
1996
1996
|
do {
|
|
1997
1997
|
let o = r.createHelp().visibleOptions(r).filter((l) => l.long).map((l) => l.long);
|
|
1998
|
-
|
|
1998
|
+
s = s.concat(o), r = r.parent;
|
|
1999
1999
|
} while (r && !r._enablePositionalOptions);
|
|
2000
|
-
t = me(e,
|
|
2000
|
+
t = me(e, s);
|
|
2001
2001
|
}
|
|
2002
2002
|
let i = `error: unknown option '${e}'${t}`;
|
|
2003
2003
|
this.error(i, { code: "commander.unknownOption" });
|
|
@@ -2022,10 +2022,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2022
2022
|
unknownCommand() {
|
|
2023
2023
|
let e = this.args[0], t = "";
|
|
2024
2024
|
if (this._showSuggestionAfterError) {
|
|
2025
|
-
let
|
|
2025
|
+
let s = [];
|
|
2026
2026
|
this.createHelp().visibleCommands(this).forEach((r) => {
|
|
2027
|
-
|
|
2028
|
-
}), t = me(e,
|
|
2027
|
+
s.push(r.name()), r.alias() && s.push(r.alias());
|
|
2028
|
+
}), t = me(e, s);
|
|
2029
2029
|
}
|
|
2030
2030
|
let i = `error: unknown command '${e}'${t}`;
|
|
2031
2031
|
this.error(i, { code: "commander.unknownCommand" });
|
|
@@ -2045,8 +2045,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2045
2045
|
version(e, t, i) {
|
|
2046
2046
|
if (e === void 0) return this._version;
|
|
2047
2047
|
this._version = e, t = t || "-V, --version", i = i || "output the version number";
|
|
2048
|
-
let
|
|
2049
|
-
return this._versionOptionName =
|
|
2048
|
+
let s = this.createOption(t, i);
|
|
2049
|
+
return this._versionOptionName = s.attributeName(), this._registerOption(s), this.on("option:" + s.name(), () => {
|
|
2050
2050
|
this._outputConfiguration.writeOut(`${e}
|
|
2051
2051
|
`), this._exit(0, "commander.version", e);
|
|
2052
2052
|
}), this;
|
|
@@ -2086,9 +2086,9 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2086
2086
|
throw new Error("Command alias can't be the same as its name");
|
|
2087
2087
|
let i = this.parent?._findCommand(e);
|
|
2088
2088
|
if (i) {
|
|
2089
|
-
let
|
|
2089
|
+
let s = [i.name()].concat(i.aliases()).join("|");
|
|
2090
2090
|
throw new Error(
|
|
2091
|
-
`cannot add alias '${e}' to command '${this.name()}' as already have command '${
|
|
2091
|
+
`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`
|
|
2092
2092
|
);
|
|
2093
2093
|
}
|
|
2094
2094
|
return t._aliases.push(e), this;
|
|
@@ -2113,7 +2113,7 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2113
2113
|
usage(e) {
|
|
2114
2114
|
if (e === void 0) {
|
|
2115
2115
|
if (this._usage) return this._usage;
|
|
2116
|
-
let t = this.registeredArguments.map((i) =>
|
|
2116
|
+
let t = this.registeredArguments.map((i) => st(i));
|
|
2117
2117
|
return [].concat(
|
|
2118
2118
|
this.options.length || this._helpOption !== null ? "[options]" : [],
|
|
2119
2119
|
this.commands.length ? "[command]" : [],
|
|
@@ -2177,8 +2177,8 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2177
2177
|
_getHelpContext(e) {
|
|
2178
2178
|
e = e || {};
|
|
2179
2179
|
let t = { error: !!e.error }, i;
|
|
2180
|
-
return t.error ? i = /* @__PURE__ */
|
|
2181
|
-
writeOut(
|
|
2180
|
+
return t.error ? i = /* @__PURE__ */ d((s) => this._outputConfiguration.writeErr(s), "write") : i = /* @__PURE__ */ d((s) => this._outputConfiguration.
|
|
2181
|
+
writeOut(s), "write"), t.write = e.write || i, t.command = this, t;
|
|
2182
2182
|
}
|
|
2183
2183
|
/**
|
|
2184
2184
|
* Output help information for this command.
|
|
@@ -2192,10 +2192,10 @@ cutableDir() to supply a custom directory", m = `'${o}' does not exist
|
|
|
2192
2192
|
typeof e == "function" && (t = e, e = void 0);
|
|
2193
2193
|
let i = this._getHelpContext(e);
|
|
2194
2194
|
this._getCommandAndAncestors().reverse().forEach((r) => r.emit("beforeAllHelp", i)), this.emit("beforeHelp", i);
|
|
2195
|
-
let
|
|
2196
|
-
if (t && (
|
|
2195
|
+
let s = this.helpInformation(i);
|
|
2196
|
+
if (t && (s = t(s), typeof s != "string" && !Buffer.isBuffer(s)))
|
|
2197
2197
|
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
2198
|
-
i.write(
|
|
2198
|
+
i.write(s), this._getHelpOption()?.long && this.emit(this._getHelpOption().long), this.emit("afterHelp", i), this._getCommandAndAncestors().
|
|
2199
2199
|
forEach(
|
|
2200
2200
|
(r) => r.emit("afterAllHelp", i)
|
|
2201
2201
|
);
|
|
@@ -2245,7 +2245,7 @@ help", t = t ?? "display help for command", this._helpOption = this.createOption
|
|
|
2245
2245
|
*/
|
|
2246
2246
|
help(e) {
|
|
2247
2247
|
this.outputHelp(e);
|
|
2248
|
-
let t =
|
|
2248
|
+
let t = h.exitCode || 0;
|
|
2249
2249
|
t === 0 && e && typeof e != "function" && e.error && (t = 1), this._exit(t, "commander.help", "(outputHelp)");
|
|
2250
2250
|
}
|
|
2251
2251
|
/**
|
|
@@ -2263,8 +2263,8 @@ help", t = t ?? "display help for command", this._helpOption = this.createOption
|
|
|
2263
2263
|
if (!i.includes(e))
|
|
2264
2264
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
2265
2265
|
Expecting one of '${i.join("', '")}'`);
|
|
2266
|
-
let
|
|
2267
|
-
return this.on(
|
|
2266
|
+
let s = `${e}Help`;
|
|
2267
|
+
return this.on(s, (r) => {
|
|
2268
2268
|
let o;
|
|
2269
2269
|
typeof t == "function" ? o = t({ error: r.error, command: r.command }) : o = t, o && r.write(`${o}
|
|
2270
2270
|
`);
|
|
@@ -2278,31 +2278,31 @@ Expecting one of '${i.join("', '")}'`);
|
|
|
2278
2278
|
*/
|
|
2279
2279
|
_outputHelpIfRequested(e) {
|
|
2280
2280
|
let t = this._getHelpOption();
|
|
2281
|
-
t && e.find((
|
|
2281
|
+
t && e.find((s) => t.is(s)) && (this.outputHelp(), this._exit(0, "commander.helpDisplayed", "(outputHelp)"));
|
|
2282
2282
|
}
|
|
2283
2283
|
};
|
|
2284
|
-
function fe(
|
|
2285
|
-
return
|
|
2284
|
+
function fe(n) {
|
|
2285
|
+
return n.map((e) => {
|
|
2286
2286
|
if (!e.startsWith("--inspect"))
|
|
2287
2287
|
return e;
|
|
2288
|
-
let t, i = "127.0.0.1",
|
|
2288
|
+
let t, i = "127.0.0.1", s = "9229", r;
|
|
2289
2289
|
return (r = e.match(/^(--inspect(-brk)?)$/)) !== null ? t = r[1] : (r = e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null ? (t =
|
|
2290
|
-
r[1], /^\d+$/.test(r[3]) ?
|
|
2291
|
-
r[3],
|
|
2290
|
+
r[1], /^\d+$/.test(r[3]) ? s = r[3] : i = r[3]) : (r = e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null && (t = r[1], i =
|
|
2291
|
+
r[3], s = r[4]), t && s !== "0" ? `${t}=${i}:${parseInt(s) + 1}` : e;
|
|
2292
2292
|
});
|
|
2293
2293
|
}
|
|
2294
|
-
|
|
2294
|
+
d(fe, "incrementNodeInspectorPort");
|
|
2295
2295
|
ge.Command = ie;
|
|
2296
2296
|
});
|
|
2297
2297
|
|
|
2298
2298
|
// ../node_modules/commander/index.js
|
|
2299
2299
|
var ve = b((g) => {
|
|
2300
|
-
var { Argument: _e } =
|
|
2301
|
-
g.program = new
|
|
2302
|
-
g.createCommand = (
|
|
2303
|
-
g.createOption = (
|
|
2304
|
-
g.createArgument = (
|
|
2305
|
-
g.Command =
|
|
2300
|
+
var { Argument: _e } = V(), { Command: se } = be(), { CommanderError: ot, InvalidArgumentError: xe } = k(), { Help: at } = Y(), { Option: ye } = X();
|
|
2301
|
+
g.program = new se();
|
|
2302
|
+
g.createCommand = (n) => new se(n);
|
|
2303
|
+
g.createOption = (n, e) => new ye(n, e);
|
|
2304
|
+
g.createArgument = (n, e) => new _e(n, e);
|
|
2305
|
+
g.Command = se;
|
|
2306
2306
|
g.Option = ye;
|
|
2307
2307
|
g.Argument = _e;
|
|
2308
2308
|
g.Help = at;
|
|
@@ -2312,38 +2312,38 @@ var ve = b((g) => {
|
|
|
2312
2312
|
});
|
|
2313
2313
|
|
|
2314
2314
|
// ../node_modules/walk-up-path/dist/cjs/index.js
|
|
2315
|
-
var
|
|
2315
|
+
var Oe = b((H) => {
|
|
2316
2316
|
"use strict";
|
|
2317
|
-
Object.defineProperty(
|
|
2318
|
-
|
|
2319
|
-
var
|
|
2320
|
-
for (
|
|
2321
|
-
yield
|
|
2322
|
-
let e = (0,
|
|
2323
|
-
if (e ===
|
|
2317
|
+
Object.defineProperty(H, "__esModule", { value: !0 });
|
|
2318
|
+
H.walkUp = void 0;
|
|
2319
|
+
var we = require("path"), lt = /* @__PURE__ */ d(function* (n) {
|
|
2320
|
+
for (n = (0, we.resolve)(n); n; ) {
|
|
2321
|
+
yield n;
|
|
2322
|
+
let e = (0, we.dirname)(n);
|
|
2323
|
+
if (e === n)
|
|
2324
2324
|
break;
|
|
2325
|
-
|
|
2325
|
+
n = e;
|
|
2326
2326
|
}
|
|
2327
2327
|
}, "walkUp");
|
|
2328
|
-
|
|
2328
|
+
H.walkUp = lt;
|
|
2329
2329
|
});
|
|
2330
2330
|
|
|
2331
2331
|
// ../node_modules/picocolors/picocolors.js
|
|
2332
2332
|
var $e = b((Nt, oe) => {
|
|
2333
|
-
var I = process || {},
|
|
2334
|
-
"--color") || I.platform === "win32" || (I.stdout || {}).isTTY &&
|
|
2335
|
-
let
|
|
2336
|
-
return ~r ?
|
|
2337
|
-
}, "formatter"),
|
|
2338
|
-
let
|
|
2333
|
+
var I = process || {}, Ee = I.argv || [], P = I.env || {}, ut = !(P.NO_COLOR || Ee.includes("--no-color")) && (!!P.FORCE_COLOR || Ee.includes(
|
|
2334
|
+
"--color") || I.platform === "win32" || (I.stdout || {}).isTTY && P.TERM !== "dumb" || !!P.CI), pt = /* @__PURE__ */ d((n, e, t = n) => (i) => {
|
|
2335
|
+
let s = "" + i, r = s.indexOf(e, n.length);
|
|
2336
|
+
return ~r ? n + ht(s, e, t, r) + e : n + s + e;
|
|
2337
|
+
}, "formatter"), ht = /* @__PURE__ */ d((n, e, t, i) => {
|
|
2338
|
+
let s = "", r = 0;
|
|
2339
2339
|
do
|
|
2340
|
-
|
|
2340
|
+
s += n.substring(r, i) + t, r = i + e.length, i = n.indexOf(e, r);
|
|
2341
2341
|
while (~i);
|
|
2342
|
-
return
|
|
2343
|
-
}, "replaceClose"), Se = /* @__PURE__ */
|
|
2344
|
-
let e =
|
|
2342
|
+
return s + n.substring(r);
|
|
2343
|
+
}, "replaceClose"), Se = /* @__PURE__ */ d((n = ut) => {
|
|
2344
|
+
let e = n ? pt : () => String;
|
|
2345
2345
|
return {
|
|
2346
|
-
isColorSupported:
|
|
2346
|
+
isColorSupported: n,
|
|
2347
2347
|
reset: e("\x1B[0m", "\x1B[0m"),
|
|
2348
2348
|
bold: e("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
2349
2349
|
dim: e("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
@@ -2396,21 +2396,21 @@ var Ne = b((A) => {
|
|
|
2396
2396
|
"use strict";
|
|
2397
2397
|
Object.defineProperty(A, "__esModule", { value: !0 });
|
|
2398
2398
|
A.dedent = void 0;
|
|
2399
|
-
function Ie(
|
|
2399
|
+
function Ie(n) {
|
|
2400
2400
|
for (var e = [], t = 1; t < arguments.length; t++)
|
|
2401
2401
|
e[t - 1] = arguments[t];
|
|
2402
|
-
var i = Array.from(typeof
|
|
2402
|
+
var i = Array.from(typeof n == "string" ? [n] : n);
|
|
2403
2403
|
i[i.length - 1] = i[i.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
2404
|
-
var
|
|
2405
|
-
var
|
|
2406
|
-
return
|
|
2407
|
-
var
|
|
2408
|
-
return (m = (
|
|
2404
|
+
var s = i.reduce(function(l, a) {
|
|
2405
|
+
var c = a.match(/\n([\t ]+|(?!\s).)/g);
|
|
2406
|
+
return c ? l.concat(c.map(function(u) {
|
|
2407
|
+
var p, m;
|
|
2408
|
+
return (m = (p = u.match(/[\t ]/g)) === null || p === void 0 ? void 0 : p.length) !== null && m !== void 0 ? m : 0;
|
|
2409
2409
|
})) : l;
|
|
2410
2410
|
}, []);
|
|
2411
|
-
if (
|
|
2411
|
+
if (s.length) {
|
|
2412
2412
|
var r = new RegExp(`
|
|
2413
|
-
[ ]{` + Math.min.apply(Math,
|
|
2413
|
+
[ ]{` + Math.min.apply(Math, s) + "}", "g");
|
|
2414
2414
|
i = i.map(function(l) {
|
|
2415
2415
|
return l.replace(r, `
|
|
2416
2416
|
`);
|
|
@@ -2419,146 +2419,146 @@ var Ne = b((A) => {
|
|
|
2419
2419
|
i[0] = i[0].replace(/^\r?\n/, "");
|
|
2420
2420
|
var o = i[0];
|
|
2421
2421
|
return e.forEach(function(l, a) {
|
|
2422
|
-
var
|
|
2422
|
+
var c = o.match(/(?:^|\n)( *)$/), u = c ? c[1] : "", p = l;
|
|
2423
2423
|
typeof l == "string" && l.includes(`
|
|
2424
|
-
`) && (
|
|
2424
|
+
`) && (p = String(l).split(`
|
|
2425
2425
|
`).map(function(m, x) {
|
|
2426
|
-
return x === 0 ? m : "" +
|
|
2426
|
+
return x === 0 ? m : "" + u + m;
|
|
2427
2427
|
}).join(`
|
|
2428
|
-
`)), o +=
|
|
2428
|
+
`)), o += p + i[a + 1];
|
|
2429
2429
|
}), o;
|
|
2430
2430
|
}
|
|
2431
|
-
|
|
2431
|
+
d(Ie, "dedent");
|
|
2432
2432
|
A.dedent = Ie;
|
|
2433
2433
|
A.default = Ie;
|
|
2434
2434
|
});
|
|
2435
2435
|
|
|
2436
2436
|
// src/cli/bin/index.ts
|
|
2437
|
-
var C = require("storybook/internal/common"), B = require("storybook/internal/node-logger"), Be = require("storybook/internal/telemetry"),
|
|
2437
|
+
var C = require("storybook/internal/common"), B = require("storybook/internal/node-logger"), Be = require("storybook/internal/telemetry"), j = $(ve(), 1);
|
|
2438
2438
|
|
|
2439
2439
|
// ../node_modules/fd-package-json/dist/esm/main.js
|
|
2440
|
-
var Ce = $(
|
|
2441
|
-
async function
|
|
2440
|
+
var Ce = $(Oe(), 1), ke = require("node:path"), D = require("node:fs/promises"), Ae = require("node:fs");
|
|
2441
|
+
async function dt(n) {
|
|
2442
2442
|
try {
|
|
2443
|
-
return (await (0,
|
|
2443
|
+
return (await (0, D.stat)(n)).isFile();
|
|
2444
2444
|
} catch {
|
|
2445
2445
|
return !1;
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
|
-
|
|
2449
|
-
async function
|
|
2450
|
-
for (let e of (0, Ce.walkUp)(
|
|
2448
|
+
d(dt, "fileExists");
|
|
2449
|
+
async function ct(n) {
|
|
2450
|
+
for (let e of (0, Ce.walkUp)(n)) {
|
|
2451
2451
|
let t = (0, ke.resolve)(e, "package.json");
|
|
2452
|
-
if (await
|
|
2452
|
+
if (await dt(t))
|
|
2453
2453
|
return t;
|
|
2454
2454
|
}
|
|
2455
2455
|
return null;
|
|
2456
2456
|
}
|
|
2457
|
-
|
|
2458
|
-
async function
|
|
2459
|
-
let e = await
|
|
2457
|
+
d(ct, "findPackagePath");
|
|
2458
|
+
async function w(n) {
|
|
2459
|
+
let e = await ct(n);
|
|
2460
2460
|
if (!e)
|
|
2461
2461
|
return null;
|
|
2462
2462
|
try {
|
|
2463
|
-
let t = await (0,
|
|
2463
|
+
let t = await (0, D.readFile)(e, { encoding: "utf8" });
|
|
2464
2464
|
return JSON.parse(t);
|
|
2465
2465
|
} catch {
|
|
2466
2466
|
return null;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
|
|
2469
|
+
d(w, "findPackage");
|
|
2470
2470
|
|
|
2471
2471
|
// node_modules/leven/index.js
|
|
2472
|
-
var re = [],
|
|
2473
|
-
function
|
|
2474
|
-
if (
|
|
2472
|
+
var re = [], je = [];
|
|
2473
|
+
function ne(n, e) {
|
|
2474
|
+
if (n === e)
|
|
2475
2475
|
return 0;
|
|
2476
|
-
let t =
|
|
2477
|
-
|
|
2478
|
-
let i =
|
|
2479
|
-
for (; i > 0 &&
|
|
2480
|
-
i--,
|
|
2476
|
+
let t = n;
|
|
2477
|
+
n.length > e.length && (n = e, e = t);
|
|
2478
|
+
let i = n.length, s = e.length;
|
|
2479
|
+
for (; i > 0 && n.charCodeAt(~-i) === e.charCodeAt(~-s); )
|
|
2480
|
+
i--, s--;
|
|
2481
2481
|
let r = 0;
|
|
2482
|
-
for (; r < i &&
|
|
2482
|
+
for (; r < i && n.charCodeAt(r) === e.charCodeAt(r); )
|
|
2483
2483
|
r++;
|
|
2484
|
-
if (i -= r,
|
|
2485
|
-
return
|
|
2486
|
-
let o, l, a,
|
|
2487
|
-
for (;
|
|
2488
|
-
|
|
2489
|
-
for (;
|
|
2490
|
-
for (o = e.charCodeAt(r +
|
|
2491
|
-
|
|
2484
|
+
if (i -= r, s -= r, i === 0)
|
|
2485
|
+
return s;
|
|
2486
|
+
let o, l, a, c, u = 0, p = 0;
|
|
2487
|
+
for (; u < i; )
|
|
2488
|
+
je[u] = n.charCodeAt(r + u), re[u] = ++u;
|
|
2489
|
+
for (; p < s; )
|
|
2490
|
+
for (o = e.charCodeAt(r + p), a = p++, l = p, u = 0; u < i; u++)
|
|
2491
|
+
c = o === je[u] ? a : a + 1, a = re[u], l = re[u] = a > l ? c > l ? l + 1 : c : c > a ? a + 1 : c;
|
|
2492
2492
|
return l;
|
|
2493
2493
|
}
|
|
2494
|
-
|
|
2494
|
+
d(ne, "leven");
|
|
2495
2495
|
|
|
2496
2496
|
// src/cli/bin/index.ts
|
|
2497
|
-
var
|
|
2497
|
+
var E = $($e(), 1);
|
|
2498
2498
|
|
|
2499
2499
|
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
2500
2500
|
var mt = process.env.NODE_ENV === "production", ae = "Invariant failed";
|
|
2501
|
-
function
|
|
2502
|
-
if (!
|
|
2501
|
+
function O(n, e) {
|
|
2502
|
+
if (!n) {
|
|
2503
2503
|
if (mt)
|
|
2504
2504
|
throw new Error(ae);
|
|
2505
2505
|
var t = typeof e == "function" ? e() : e, i = t ? "".concat(ae, ": ").concat(t) : ae;
|
|
2506
2506
|
throw new Error(i);
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
|
-
|
|
2509
|
+
d(O, "invariant");
|
|
2510
2510
|
|
|
2511
2511
|
// package.json
|
|
2512
|
-
var
|
|
2512
|
+
var qe = "9.0.0-alpha.4";
|
|
2513
2513
|
|
|
2514
2514
|
// src/cli/build.ts
|
|
2515
|
-
var
|
|
2516
|
-
var
|
|
2517
|
-
let e = await
|
|
2518
|
-
|
|
2515
|
+
var Ve = require("storybook/internal/common"), N = require("storybook/internal/core-server");
|
|
2516
|
+
var He = /* @__PURE__ */ d(async (n) => {
|
|
2517
|
+
let e = await w(__dirname);
|
|
2518
|
+
O(e, "Failed to find the closest package.json file.");
|
|
2519
2519
|
let t = {
|
|
2520
|
-
...
|
|
2521
|
-
configDir:
|
|
2522
|
-
outputDir:
|
|
2523
|
-
ignorePreview: !!
|
|
2520
|
+
...n,
|
|
2521
|
+
configDir: n.configDir || "./.storybook",
|
|
2522
|
+
outputDir: n.outputDir || "./storybook-static",
|
|
2523
|
+
ignorePreview: !!n.previewUrl && !n.forceBuildPreview,
|
|
2524
2524
|
configType: "PRODUCTION",
|
|
2525
|
-
cache:
|
|
2525
|
+
cache: Ve.cache,
|
|
2526
2526
|
packageJson: e
|
|
2527
2527
|
};
|
|
2528
2528
|
await (0, N.withTelemetry)(
|
|
2529
2529
|
"build",
|
|
2530
|
-
{ cliOptions:
|
|
2530
|
+
{ cliOptions: n, presetOptions: t },
|
|
2531
2531
|
() => (0, N.buildStaticStandalone)(t)
|
|
2532
2532
|
);
|
|
2533
2533
|
}, "build");
|
|
2534
2534
|
|
|
2535
2535
|
// src/cli/buildIndex.ts
|
|
2536
|
-
var
|
|
2537
|
-
var
|
|
2536
|
+
var De = require("storybook/internal/common"), T = require("storybook/internal/core-server");
|
|
2537
|
+
var Pe = /* @__PURE__ */ d(async (n) => {
|
|
2538
2538
|
let e = {
|
|
2539
|
-
...
|
|
2540
|
-
configDir:
|
|
2541
|
-
outputFile:
|
|
2539
|
+
...n,
|
|
2540
|
+
configDir: n.configDir || ".storybook",
|
|
2541
|
+
outputFile: n.outputFile || "index.json",
|
|
2542
2542
|
ignorePreview: !0,
|
|
2543
2543
|
configType: "PRODUCTION",
|
|
2544
|
-
cache:
|
|
2545
|
-
packageJson:
|
|
2544
|
+
cache: De.cache,
|
|
2545
|
+
packageJson: n.packageJson
|
|
2546
2546
|
}, t = {
|
|
2547
2547
|
...e,
|
|
2548
2548
|
corePresets: [],
|
|
2549
2549
|
overridePresets: []
|
|
2550
2550
|
};
|
|
2551
|
-
await (0, T.withTelemetry)("index", { cliOptions:
|
|
2551
|
+
await (0, T.withTelemetry)("index", { cliOptions: n, presetOptions: t }, () => (0, T.buildIndexStandalone)(e));
|
|
2552
2552
|
}, "buildIndex");
|
|
2553
2553
|
|
|
2554
2554
|
// src/cli/dev.ts
|
|
2555
2555
|
var Te = require("storybook/internal/common"), F = require("storybook/internal/core-server"), _ = require("storybook/internal/node-logger");
|
|
2556
2556
|
var le = $(Ne(), 1);
|
|
2557
|
-
function gt(
|
|
2558
|
-
_.instance.heading = "",
|
|
2559
|
-
errors.forEach((e) => _.logger.plain(e)) : _.logger.error(
|
|
2557
|
+
function gt(n) {
|
|
2558
|
+
_.instance.heading = "", n instanceof Error ? n.error ? _.logger.error(n.error) : n.stats && n.stats.compilation.errors ? n.stats.compilation.
|
|
2559
|
+
errors.forEach((e) => _.logger.plain(e)) : _.logger.error(n) : n.compilation?.errors && n.compilation.errors.forEach((e) => _.logger.plain(
|
|
2560
2560
|
e)), _.logger.line(), _.logger.warn(
|
|
2561
|
-
|
|
2561
|
+
n.close ? le.dedent`
|
|
2562
2562
|
FATAL broken build!, will close the process,
|
|
2563
2563
|
Fix the error below and restart storybook.
|
|
2564
2564
|
` : le.dedent`
|
|
@@ -2567,24 +2567,24 @@ function gt(s) {
|
|
|
2567
2567
|
`
|
|
2568
2568
|
), _.logger.line();
|
|
2569
2569
|
}
|
|
2570
|
-
|
|
2571
|
-
var Fe = /* @__PURE__ */
|
|
2570
|
+
d(gt, "printError");
|
|
2571
|
+
var Fe = /* @__PURE__ */ d(async (n) => {
|
|
2572
2572
|
let { env: e } = process;
|
|
2573
2573
|
e.NODE_ENV = e.NODE_ENV || "development";
|
|
2574
|
-
let t = await
|
|
2575
|
-
|
|
2574
|
+
let t = await w(__dirname);
|
|
2575
|
+
O(t, "Failed to find the closest package.json file.");
|
|
2576
2576
|
let i = {
|
|
2577
|
-
...
|
|
2578
|
-
configDir:
|
|
2577
|
+
...n,
|
|
2578
|
+
configDir: n.configDir || "./.storybook",
|
|
2579
2579
|
configType: "DEVELOPMENT",
|
|
2580
|
-
ignorePreview: !!
|
|
2580
|
+
ignorePreview: !!n.previewUrl && !n.forceBuildPreview,
|
|
2581
2581
|
cache: Te.cache,
|
|
2582
2582
|
packageJson: t
|
|
2583
2583
|
};
|
|
2584
2584
|
await (0, F.withTelemetry)(
|
|
2585
2585
|
"dev",
|
|
2586
2586
|
{
|
|
2587
|
-
cliOptions:
|
|
2587
|
+
cliOptions: n,
|
|
2588
2588
|
presetOptions: i,
|
|
2589
2589
|
printError: gt
|
|
2590
2590
|
},
|
|
@@ -2594,14 +2594,14 @@ var Fe = /* @__PURE__ */ c(async (s) => {
|
|
|
2594
2594
|
|
|
2595
2595
|
// src/cli/bin/index.ts
|
|
2596
2596
|
(0, Be.addToGlobalContext)("cliVersion", C.versions.storybook);
|
|
2597
|
-
var S = console,
|
|
2597
|
+
var S = console, de = /* @__PURE__ */ d((n) => j.program.command(n).option(
|
|
2598
2598
|
"--disable-telemetry",
|
|
2599
2599
|
"Disable sending telemetry data",
|
|
2600
2600
|
// default value is false, but if the user sets STORYBOOK_DISABLE_TELEMETRY, it can be true
|
|
2601
2601
|
process.env.STORYBOOK_DISABLE_TELEMETRY && process.env.STORYBOOK_DISABLE_TELEMETRY !== "false"
|
|
2602
2602
|
).option("--debug", "Get more logs in debug mode", !1).option("--enable-crash-reports", "Enable sending crash reports to telemetry data"), "\
|
|
2603
2603
|
command");
|
|
2604
|
-
|
|
2604
|
+
de("dev").option("-p, --port <number>", "Port to run Storybook", (n) => parseInt(n, 10)).option("-h, --host <string>", "Host to run Storyboo\
|
|
2605
2605
|
k").option("-c, --config-dir <dir-name>", "Directory where to load Storybook configurations from").option(
|
|
2606
2606
|
"--https",
|
|
2607
2607
|
"Serve Storybook over HTTPS. Note: You must provide your own certificate information."
|
|
@@ -2623,19 +2623,19 @@ ack", "Display final webpack configurations for debugging purposes").option(
|
|
|
2623
2623
|
ly site using addon-docs").option("--exact-port", "Exit early if the desired port is not available").option(
|
|
2624
2624
|
"--initial-path [path]",
|
|
2625
2625
|
"URL path to be appended when visiting Storybook for the first time"
|
|
2626
|
-
).action(async (
|
|
2627
|
-
B.logger.setLevel(
|
|
2628
|
-
let e = await
|
|
2629
|
-
|
|
2630
|
-
`)), (0, C.getEnvConfig)(
|
|
2626
|
+
).action(async (n) => {
|
|
2627
|
+
B.logger.setLevel(n.loglevel);
|
|
2628
|
+
let e = await w(__dirname);
|
|
2629
|
+
O(e, "Failed to find the closest package.json file."), S.log(E.default.bold(`${e.name} v${e.version}`) + E.default.reset(`
|
|
2630
|
+
`)), (0, C.getEnvConfig)(n, {
|
|
2631
2631
|
port: "SBCONFIG_PORT",
|
|
2632
2632
|
host: "SBCONFIG_HOSTNAME",
|
|
2633
2633
|
staticDir: "SBCONFIG_STATIC_DIR",
|
|
2634
2634
|
configDir: "SBCONFIG_CONFIG_DIR",
|
|
2635
2635
|
ci: "CI"
|
|
2636
|
-
}), parseInt(`${
|
|
2636
|
+
}), parseInt(`${n.port}`, 10) && (n.port = parseInt(`${n.port}`, 10)), await Fe({ ...n, packageJson: e }).catch(() => process.exit(1));
|
|
2637
2637
|
});
|
|
2638
|
-
|
|
2638
|
+
de("build").option("-o, --output-dir <dir-name>", "Directory where to store built files").option("-c, --config-dir <dir-name>", "Directory w\
|
|
2639
2639
|
here to load Storybook configurations from").option("--quiet", "Suppress verbose build output").option("--loglevel <level>", "Control level \
|
|
2640
2640
|
of logging during build").option("--debug-webpack", "Display final webpack configurations for debugging purposes").option(
|
|
2641
2641
|
"--webpack-stats-json [directory]",
|
|
@@ -2644,44 +2644,44 @@ of logging during build").option("--debug-webpack", "Display final webpack confi
|
|
|
2644
2644
|
"--preview-url <string>",
|
|
2645
2645
|
"Disables the default storybook preview and lets your use your own"
|
|
2646
2646
|
).option("--force-build-preview", "Build the preview iframe even if you are using --preview-url").option("--docs", "Build a documentation-on\
|
|
2647
|
-
ly site using addon-docs").option("--test", "Build stories optimized for testing purposes.").action(async (
|
|
2647
|
+
ly site using addon-docs").option("--test", "Build stories optimized for testing purposes.").action(async (n) => {
|
|
2648
2648
|
let { env: e } = process;
|
|
2649
2649
|
e.NODE_ENV = e.NODE_ENV || "production";
|
|
2650
|
-
let t = await
|
|
2651
|
-
|
|
2652
|
-
`)), (0, C.getEnvConfig)(
|
|
2650
|
+
let t = await w(__dirname);
|
|
2651
|
+
O(t, "Failed to find the closest package.json file."), B.logger.setLevel(n.loglevel), S.log(E.default.bold(`${t.name} v${t.version}
|
|
2652
|
+
`)), (0, C.getEnvConfig)(n, {
|
|
2653
2653
|
staticDir: "SBCONFIG_STATIC_DIR",
|
|
2654
2654
|
outputDir: "SBCONFIG_OUTPUT_DIR",
|
|
2655
2655
|
configDir: "SBCONFIG_CONFIG_DIR"
|
|
2656
|
-
}), await
|
|
2657
|
-
...
|
|
2656
|
+
}), await He({
|
|
2657
|
+
...n,
|
|
2658
2658
|
packageJson: t,
|
|
2659
|
-
test: !!
|
|
2659
|
+
test: !!n.test || process.env.SB_TESTBUILD === "true"
|
|
2660
2660
|
}).catch(() => process.exit(1));
|
|
2661
2661
|
});
|
|
2662
|
-
|
|
2662
|
+
de("index").option("-o, --output-file <file-name>", "JSON file to output index").option("-c, --config-dir <dir-name>", "Directory where to l\
|
|
2663
2663
|
oad Storybook configurations from").option("--quiet", "Suppress verbose build output").option("--loglevel <level>", "Control level of loggin\
|
|
2664
|
-
g during build").action(async (
|
|
2664
|
+
g during build").action(async (n) => {
|
|
2665
2665
|
let { env: e } = process;
|
|
2666
2666
|
e.NODE_ENV = e.NODE_ENV || "production";
|
|
2667
|
-
let t = await
|
|
2668
|
-
|
|
2669
|
-
`)), (0, C.getEnvConfig)(
|
|
2667
|
+
let t = await w(__dirname);
|
|
2668
|
+
O(t, "Failed to find the closest package.json file."), B.logger.setLevel(n.loglevel), S.log(E.default.bold(`${t.name} v${t.version}
|
|
2669
|
+
`)), (0, C.getEnvConfig)(n, {
|
|
2670
2670
|
configDir: "SBCONFIG_CONFIG_DIR",
|
|
2671
2671
|
outputFile: "SBCONFIG_OUTPUT_FILE"
|
|
2672
|
-
}), await
|
|
2673
|
-
...
|
|
2672
|
+
}), await Pe({
|
|
2673
|
+
...n,
|
|
2674
2674
|
packageJson: t
|
|
2675
2675
|
}).catch(() => process.exit(1));
|
|
2676
2676
|
});
|
|
2677
|
-
|
|
2677
|
+
j.program.on("command:*", ([n]) => {
|
|
2678
2678
|
S.error(
|
|
2679
2679
|
` Invalid command: %s.
|
|
2680
2680
|
See --help for a list of available commands.`,
|
|
2681
|
-
|
|
2681
|
+
n
|
|
2682
2682
|
);
|
|
2683
|
-
let t =
|
|
2683
|
+
let t = j.program.commands.map((i) => i.name()).find((i) => ne(i, n) < 3);
|
|
2684
2684
|
t && S.info(`
|
|
2685
2685
|
Did you mean ${t}?`), process.exit(1);
|
|
2686
2686
|
});
|
|
2687
|
-
|
|
2687
|
+
j.program.usage("<command> [options]").version(String(qe)).parse(process.argv);
|