storybook 9.1.13 → 9.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babel/index.cjs +22495 -21246
- package/dist/babel/index.d.ts +672 -336
- package/dist/babel/index.js +22534 -21285
- package/dist/bin/index.cjs +42 -43
- package/dist/bin/index.js +42 -43
- package/dist/cli/bin/index.cjs +1 -1
- package/dist/cli/bin/index.js +1 -1
- package/dist/cli/index.cjs +27120 -25868
- package/dist/cli/index.js +27267 -26015
- package/dist/common/index.cjs +57 -58
- package/dist/common/index.d.ts +0 -1
- package/dist/common/index.js +103 -104
- package/dist/components/index.cjs +4464 -4353
- package/dist/components/index.js +3290 -3181
- package/dist/core-events/index.cjs +105 -103
- package/dist/core-events/index.d.ts +3 -1
- package/dist/core-events/index.js +85 -83
- package/dist/core-server/index.cjs +7389 -7318
- package/dist/core-server/index.js +7598 -7529
- package/dist/core-server/presets/common-preset.cjs +20111 -19862
- package/dist/core-server/presets/common-preset.js +20183 -19934
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.cjs +306 -518
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +302 -525
- package/dist/csf-tools/index.cjs +150 -144
- package/dist/csf-tools/index.js +401 -395
- package/dist/manager/globals-module-info.cjs +2 -0
- package/dist/manager/globals-module-info.js +2 -0
- package/dist/manager/globals-runtime.js +16492 -16380
- package/dist/manager/runtime.js +525 -522
- package/dist/manager-api/index.cjs +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/node-logger/index.cjs +71 -71
- package/dist/node-logger/index.js +71 -71
- package/dist/preview/runtime.js +7462 -7458
- package/dist/preview-api/index.cjs +2 -0
- package/dist/preview-api/index.js +233 -230
- package/dist/telemetry/index.cjs +5 -4
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +5 -4
- package/dist/test/index.cjs +267 -267
- package/dist/test/index.js +240 -240
- package/package.json +1 -1
package/dist/csf-tools/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ var Qe = (s, e) => () => (e || s((e = { exports: {} }).exports, e), e.exports),
|
|
|
14
14
|
!Je.call(s, i) && i !== r && V(s, i, { get: () => e[i], enumerable: !(t = ze(e, i)) || t.enumerable });
|
|
15
15
|
return s;
|
|
16
16
|
};
|
|
17
|
-
var
|
|
17
|
+
var G = (s, e, r) => (r = s != null ? Ge(Ke(s)) : {}, fe(
|
|
18
18
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
19
|
// file that has been converted to a CommonJS file using a Babel-
|
|
20
20
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
@@ -54,8 +54,8 @@ var $ = Qe((A) => {
|
|
|
54
54
|
var d = o.match(/(?:^|\n)( *)$/), u = d ? d[1] : "", x = c;
|
|
55
55
|
typeof c == "string" && c.includes(`
|
|
56
56
|
`) && (x = String(c).split(`
|
|
57
|
-
`).map(function(E,
|
|
58
|
-
return
|
|
57
|
+
`).map(function(E, y) {
|
|
58
|
+
return y === 0 ? E : "" + u + E;
|
|
59
59
|
}).join(`
|
|
60
60
|
`)), o += x + t[p + 1];
|
|
61
61
|
}), o;
|
|
@@ -68,12 +68,12 @@ var $ = Qe((A) => {
|
|
|
68
68
|
// src/csf-tools/index.ts
|
|
69
69
|
var dt = {};
|
|
70
70
|
He(dt, {
|
|
71
|
-
BadMetaError: () =>
|
|
72
|
-
ConfigFile: () =>
|
|
73
|
-
CsfFile: () =>
|
|
74
|
-
MixedFactoryError: () =>
|
|
75
|
-
MultipleMetaError: () =>
|
|
76
|
-
NoMetaError: () =>
|
|
71
|
+
BadMetaError: () => L,
|
|
72
|
+
ConfigFile: () => Z,
|
|
73
|
+
CsfFile: () => X,
|
|
74
|
+
MixedFactoryError: () => R,
|
|
75
|
+
MultipleMetaError: () => z,
|
|
76
|
+
NoMetaError: () => M,
|
|
77
77
|
babelParse: () => $e.babelParse,
|
|
78
78
|
babelParseFile: () => be,
|
|
79
79
|
enrichCsf: () => pt,
|
|
@@ -88,7 +88,7 @@ He(dt, {
|
|
|
88
88
|
isModuleMock: () => ye,
|
|
89
89
|
isValidPreviewPath: () => xe,
|
|
90
90
|
loadConfig: () => Se,
|
|
91
|
-
loadCsf: () =>
|
|
91
|
+
loadCsf: () => J,
|
|
92
92
|
printConfig: () => Pe,
|
|
93
93
|
printCsf: () => Ee,
|
|
94
94
|
readConfig: () => ot,
|
|
@@ -100,8 +100,8 @@ He(dt, {
|
|
|
100
100
|
module.exports = Ye(dt);
|
|
101
101
|
|
|
102
102
|
// src/csf-tools/CsfFile.ts
|
|
103
|
-
var
|
|
104
|
-
P =
|
|
103
|
+
var K = require("node:fs/promises"), l = require("storybook/internal/babel"), v = require("storybook/internal/csf"), re = require("storybook/internal/node-logger"),
|
|
104
|
+
P = G($(), 1);
|
|
105
105
|
|
|
106
106
|
// src/csf-tools/findVarInitialization.ts
|
|
107
107
|
var N = require("storybook/internal/babel");
|
|
@@ -171,7 +171,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
171
171
|
},
|
|
172
172
|
{}
|
|
173
173
|
), "sortExports"), rt = /* @__PURE__ */ f((s) => {
|
|
174
|
-
if (l.types.isArrowFunctionExpression(s) || l.types.isFunctionDeclaration(s)) {
|
|
174
|
+
if (l.types.isArrowFunctionExpression(s) || l.types.isFunctionDeclaration(s) || l.types.isObjectMethod(s)) {
|
|
175
175
|
let e = s.params;
|
|
176
176
|
if (e.length >= 1) {
|
|
177
177
|
let [r] = e;
|
|
@@ -183,7 +183,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
return !1;
|
|
186
|
-
}, "hasMount"), it = /^[.\/#].*\.mock($|\.[^.]*$)/i,
|
|
186
|
+
}, "hasMount"), it = /^[.\/#].*\.mock($|\.[^.]*$)/i, M = class extends Error {
|
|
187
187
|
static {
|
|
188
188
|
f(this, "NoMetaError");
|
|
189
189
|
}
|
|
@@ -195,7 +195,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
195
195
|
More info: https://storybook.js.org/docs/writing-stories?ref=error#default-export
|
|
196
196
|
`), this.name = this.constructor.name;
|
|
197
197
|
}
|
|
198
|
-
},
|
|
198
|
+
}, z = class extends Error {
|
|
199
199
|
static {
|
|
200
200
|
f(this, "MultipleMetaError");
|
|
201
201
|
}
|
|
@@ -207,7 +207,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
207
207
|
More info: https://storybook.js.org/docs/writing-stories?ref=error#default-export
|
|
208
208
|
`), this.name = this.constructor.name;
|
|
209
209
|
}
|
|
210
|
-
},
|
|
210
|
+
}, R = class extends Error {
|
|
211
211
|
static {
|
|
212
212
|
f(this, "MixedFactoryError");
|
|
213
213
|
}
|
|
@@ -219,7 +219,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
219
219
|
More info: https://storybook.js.org/docs/writing-stories?ref=error#default-export
|
|
220
220
|
`), this.name = this.constructor.name;
|
|
221
221
|
}
|
|
222
|
-
},
|
|
222
|
+
}, L = class extends Error {
|
|
223
223
|
static {
|
|
224
224
|
f(this, "BadMetaError");
|
|
225
225
|
}
|
|
@@ -231,7 +231,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
231
231
|
More info: https://storybook.js.org/docs/writing-stories?ref=error#default-export
|
|
232
232
|
`), this.name = this.constructor.name;
|
|
233
233
|
}
|
|
234
|
-
},
|
|
234
|
+
}, X = class {
|
|
235
235
|
constructor(e, r, t) {
|
|
236
236
|
this._stories = {};
|
|
237
237
|
this._metaAnnotations = {};
|
|
@@ -259,31 +259,32 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
259
259
|
}
|
|
260
260
|
_parseMeta(e, r) {
|
|
261
261
|
if (this._metaNode)
|
|
262
|
-
throw new
|
|
262
|
+
throw new z("multiple meta objects", e, this._options.fileName);
|
|
263
263
|
this._metaNode = e;
|
|
264
264
|
let t = {};
|
|
265
265
|
e.properties.forEach((i) => {
|
|
266
266
|
if (l.types.isIdentifier(i.key)) {
|
|
267
|
-
|
|
267
|
+
let a = l.types.isObjectMethod(i) ? i : i.value;
|
|
268
|
+
if (this._metaAnnotations[i.key.name] = a, i.key.name === "title")
|
|
268
269
|
t.title = this._parseTitle(i.value);
|
|
269
270
|
else if (["includeStories", "excludeStories"].includes(i.key.name))
|
|
270
271
|
t[i.key.name] = et(i.value);
|
|
271
272
|
else if (i.key.name === "component") {
|
|
272
|
-
let
|
|
273
|
-
if (l.types.isIdentifier(
|
|
274
|
-
let
|
|
275
|
-
(
|
|
273
|
+
let o = i.value;
|
|
274
|
+
if (l.types.isIdentifier(o)) {
|
|
275
|
+
let p = o.name, d = r.body.find(
|
|
276
|
+
(u) => l.types.isImportDeclaration(u) && u.specifiers.find((x) => x.local.name === p)
|
|
276
277
|
);
|
|
277
|
-
if (
|
|
278
|
-
let { source:
|
|
279
|
-
l.types.isStringLiteral(
|
|
278
|
+
if (d) {
|
|
279
|
+
let { source: u } = d;
|
|
280
|
+
l.types.isStringLiteral(u) && (this._rawComponentPath = u.value);
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
|
-
let { code:
|
|
283
|
-
t.component =
|
|
283
|
+
let { code: c } = l.recast.print(i.value, {});
|
|
284
|
+
t.component = c;
|
|
284
285
|
} else if (i.key.name === "tags") {
|
|
285
|
-
let
|
|
286
|
-
l.types.isIdentifier(
|
|
286
|
+
let o = i.value;
|
|
287
|
+
l.types.isIdentifier(o) && (o = O(o.name, this._ast.program)), t.tags = me(o);
|
|
287
288
|
} else if (i.key.name === "id")
|
|
288
289
|
if (l.types.isStringLiteral(i.value))
|
|
289
290
|
t.id = i.value.value;
|
|
@@ -338,7 +339,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
338
339
|
l.types.isTSAsExpression(p) && l.types.isTSSatisfiesExpression(p.expression) && l.types.isObjectExpression(p.expression.expression) &&
|
|
339
340
|
(c = p.expression.expression)
|
|
340
341
|
), c && l.types.isProgram(a) && e._parseMeta(c, a), e._metaStatement && !e._metaNode)
|
|
341
|
-
throw new
|
|
342
|
+
throw new M(
|
|
342
343
|
"default export must be an object",
|
|
343
344
|
e._metaStatement,
|
|
344
345
|
e._options.fileName
|
|
@@ -368,43 +369,48 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
368
369
|
x = c.init : x = c, l.types.isCallExpression(x) && l.types.isMemberExpression(x.callee) && l.types.isIdentifier(x.callee.property) &&
|
|
369
370
|
(x.callee.property.name === "story" || x.callee.property.name === "extend") && (p = !0, x = x.arguments[0]), e._metaIsFactory &&
|
|
370
371
|
!p)
|
|
371
|
-
throw new
|
|
372
|
+
throw new R(
|
|
372
373
|
"expected factory story",
|
|
373
374
|
x,
|
|
374
375
|
e._options.fileName
|
|
375
376
|
);
|
|
376
377
|
if (!e._metaIsFactory && p)
|
|
377
|
-
throw e._metaNode ? new
|
|
378
|
+
throw e._metaNode ? new R(
|
|
378
379
|
"expected non-factory story",
|
|
379
380
|
x,
|
|
380
381
|
e._options.fileName
|
|
381
|
-
) : new
|
|
382
|
+
) : new L(
|
|
382
383
|
"meta() factory must be imported from .storybook/preview configuration",
|
|
383
384
|
x,
|
|
384
385
|
e._options.fileName
|
|
385
386
|
);
|
|
386
387
|
let E = {};
|
|
387
|
-
l.types.isObjectExpression(x) ? (E.__isArgsStory = !0, x.properties.forEach((
|
|
388
|
-
if (l.types.isIdentifier(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
388
|
+
l.types.isObjectExpression(x) ? (E.__isArgsStory = !0, x.properties.forEach((y) => {
|
|
389
|
+
if (l.types.isIdentifier(y.key)) {
|
|
390
|
+
let j = y.key.name;
|
|
391
|
+
if (l.types.isObjectMethod(y))
|
|
392
|
+
e._storyAnnotations[d][j] = y;
|
|
393
|
+
else {
|
|
394
|
+
if (y.key.name === "render")
|
|
395
|
+
E.__isArgsStory = ue(
|
|
396
|
+
y.value,
|
|
397
|
+
a,
|
|
398
|
+
e
|
|
399
|
+
);
|
|
400
|
+
else if (y.key.name === "name" && l.types.isStringLiteral(y.value))
|
|
401
|
+
u = y.value.value;
|
|
402
|
+
else if (y.key.name === "storyName" && l.types.isStringLiteral(y.value))
|
|
403
|
+
re.logger.warn(
|
|
404
|
+
`Unexpected usage of "storyName" in "${d}". Please use "name" instead.`
|
|
405
|
+
);
|
|
406
|
+
else if (y.key.name === "parameters" && l.types.isObjectExpression(y.value)) {
|
|
407
|
+
let te = y.value.properties.find(
|
|
408
|
+
(h) => l.types.isObjectProperty(h) && l.types.isIdentifier(h.key) && h.key.name === "__id"
|
|
409
|
+
);
|
|
410
|
+
te && (E.__id = te.value.value);
|
|
411
|
+
}
|
|
412
|
+
e._storyAnnotations[d][y.key.name] = y.value;
|
|
406
413
|
}
|
|
407
|
-
e._storyAnnotations[d][b.key.name] = b.value;
|
|
408
414
|
}
|
|
409
415
|
})) : E.__isArgsStory = ue(x, a, e), e._stories[d] = {
|
|
410
416
|
id: "FIXME",
|
|
@@ -428,8 +434,8 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
428
434
|
), x && l.types.isProgram(a) && e._parseMeta(x, a);
|
|
429
435
|
} else {
|
|
430
436
|
let x = {}, E = u;
|
|
431
|
-
l.types.isObjectExpression(E) && E.properties.forEach((
|
|
432
|
-
l.types.isIdentifier(
|
|
437
|
+
l.types.isObjectExpression(E) && E.properties.forEach((y) => {
|
|
438
|
+
l.types.isIdentifier(y.key) && (x[y.key.name] = y.value);
|
|
433
439
|
}), e._storyAnnotations[p] = x, e._storyStatements[p] = u, e._storyPaths[p] = t, e._stories[p] = {
|
|
434
440
|
id: "FIXME",
|
|
435
441
|
name: p,
|
|
@@ -476,7 +482,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
476
482
|
let p = i.arguments[0];
|
|
477
483
|
e._metaVariableName = a.property.name, e._metaIsFactory = !0, e._parseMeta(p, e._ast.program);
|
|
478
484
|
} else
|
|
479
|
-
throw new
|
|
485
|
+
throw new L(
|
|
480
486
|
"meta() factory must be imported from .storybook/preview configuration",
|
|
481
487
|
c,
|
|
482
488
|
e._options.fileName
|
|
@@ -494,7 +500,7 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
494
500
|
}
|
|
495
501
|
}
|
|
496
502
|
}), !e._meta)
|
|
497
|
-
throw new
|
|
503
|
+
throw new M("missing default export", e._ast, e._options.fileName);
|
|
498
504
|
let r = Object.entries(e._stories);
|
|
499
505
|
if (e._meta.title = this._options.makeTitle(e._meta?.title), e._metaAnnotations.play && (e._meta.tags = [...e._meta.tags || [], "play-fn"]),
|
|
500
506
|
e._stories = r.reduce(
|
|
@@ -506,17 +512,17 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
506
512
|
i === "__page" && (r.length === 1 || Array.isArray(p) && p.length === 1) && (c.docsOnly = !0), t[i] = { ...a, id: o, parameters: c };
|
|
507
513
|
let d = e._storyAnnotations[i], { tags: u, play: x } = d;
|
|
508
514
|
if (u) {
|
|
509
|
-
let
|
|
510
|
-
t[i].tags = me(
|
|
515
|
+
let j = l.types.isIdentifier(u) ? O(u.name, this._ast.program) : u;
|
|
516
|
+
t[i].tags = me(j);
|
|
511
517
|
}
|
|
512
518
|
x && (t[i].tags = [...t[i].tags || [], "play-fn"]);
|
|
513
519
|
let E = t[i].__stats;
|
|
514
|
-
["play", "render", "loaders", "beforeEach", "globals", "tags"].forEach((
|
|
515
|
-
E[
|
|
520
|
+
["play", "render", "loaders", "beforeEach", "globals", "tags"].forEach((j) => {
|
|
521
|
+
E[j] = !!d[j] || !!e._metaAnnotations[j];
|
|
516
522
|
});
|
|
517
|
-
let
|
|
518
|
-
return E.storyFn = !!(l.types.isArrowFunctionExpression(
|
|
519
|
-
play), E.moduleMock = !!e.imports.find((
|
|
523
|
+
let y = e.getStoryExport(i);
|
|
524
|
+
return E.storyFn = !!(l.types.isArrowFunctionExpression(y) || l.types.isFunctionDeclaration(y)), E.mount = rt(d.play ?? e._metaAnnotations.
|
|
525
|
+
play), E.moduleMock = !!e.imports.find((j) => ye(j)), t;
|
|
520
526
|
},
|
|
521
527
|
{}
|
|
522
528
|
), Object.keys(e._storyExports).forEach((t) => {
|
|
@@ -567,23 +573,23 @@ var D = /* @__PURE__ */ f((s, e) => {
|
|
|
567
573
|
code: s,
|
|
568
574
|
filename: e = "",
|
|
569
575
|
ast: r
|
|
570
|
-
}) => new l.BabelFileClass({ filename: e }, { code: s, ast: r ?? (0, l.babelParse)(s) }), "babelParseFile"),
|
|
576
|
+
}) => new l.BabelFileClass({ filename: e }, { code: s, ast: r ?? (0, l.babelParse)(s) }), "babelParseFile"), J = /* @__PURE__ */ f((s, e) => {
|
|
571
577
|
let r = (0, l.babelParse)(s), t = be({ code: s, filename: e.fileName, ast: r });
|
|
572
|
-
return new
|
|
578
|
+
return new X(r, e, t);
|
|
573
579
|
}, "loadCsf"), ie = /* @__PURE__ */ f((s, e = { sourceMaps: !1 }, r) => {
|
|
574
580
|
let t = (0, l.generate)(s._ast, e, r);
|
|
575
581
|
return e.sourceMaps ? t : t.code;
|
|
576
582
|
}, "formatCsf"), Ee = /* @__PURE__ */ f((s, e = {}) => l.recast.print(s._ast, e), "printCsf"), st = /* @__PURE__ */ f(async (s, e) => {
|
|
577
|
-
let r = (await (0,
|
|
578
|
-
return
|
|
583
|
+
let r = (await (0, K.readFile)(s, "utf-8")).toString();
|
|
584
|
+
return J(r, { ...e, fileName: s });
|
|
579
585
|
}, "readCsf"), nt = /* @__PURE__ */ f(async (s, e) => {
|
|
580
586
|
if (!(e || s._options.fileName))
|
|
581
587
|
throw new Error("Please specify a fileName for writeCsf");
|
|
582
|
-
await (0,
|
|
588
|
+
await (0, K.writeFile)(e, Ee(s).code);
|
|
583
589
|
}, "writeCsf");
|
|
584
590
|
|
|
585
591
|
// src/csf-tools/ConfigFile.ts
|
|
586
|
-
var
|
|
592
|
+
var ee = require("node:fs/promises"), n = require("storybook/internal/babel"), Q = require("storybook/internal/node-logger"), he = G($(), 1);
|
|
587
593
|
var se = /* @__PURE__ */ f(({
|
|
588
594
|
expectedType: s,
|
|
589
595
|
foundType: e,
|
|
@@ -591,7 +597,7 @@ var se = /* @__PURE__ */ f(({
|
|
|
591
597
|
}) => he.dedent`
|
|
592
598
|
CSF Parsing error: Expected '${s}' but found '${e}' instead in '${r?.type}'.
|
|
593
599
|
`, "getCsfParsingErrorMessage"), F = /* @__PURE__ */ f((s) => n.types.isIdentifier(s.key) ? s.key.name : n.types.isStringLiteral(s.key) ?
|
|
594
|
-
s.key.value : null, "propKey"),
|
|
600
|
+
s.key.value : null, "propKey"), H = /* @__PURE__ */ f((s) => n.types.isTSAsExpression(s) || n.types.isTSSatisfiesExpression(s) ? H(s.expression) :
|
|
595
601
|
s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
596
602
|
if (s.length === 0)
|
|
597
603
|
return e;
|
|
@@ -611,12 +617,12 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
611
617
|
if (i)
|
|
612
618
|
return t.length === 0 ? e.properties : je(t, i.value);
|
|
613
619
|
}
|
|
614
|
-
}, "_getPathProperties"),
|
|
620
|
+
}, "_getPathProperties"), Y = /* @__PURE__ */ f((s, e) => {
|
|
615
621
|
let r = null, t = null;
|
|
616
622
|
return e.body.find((i) => (n.types.isVariableDeclaration(i) ? t = i.declarations : n.types.isExportNamedDeclaration(i) && n.types.isVariableDeclaration(
|
|
617
623
|
i.declaration) && (t = i.declaration.declarations), t && t.find((a) => n.types.isVariableDeclarator(a) && n.types.isIdentifier(a.id) && a.
|
|
618
624
|
id.name === s ? (r = a, !0) : !1))), r;
|
|
619
|
-
}, "_findVarDeclarator"), w = /* @__PURE__ */ f((s, e) =>
|
|
625
|
+
}, "_findVarDeclarator"), w = /* @__PURE__ */ f((s, e) => Y(s, e)?.init, "_findVarInitialization"), q = /* @__PURE__ */ f((s, e) => {
|
|
620
626
|
if (s.length === 0)
|
|
621
627
|
return e;
|
|
622
628
|
let [r, ...t] = s, i = q(t, e);
|
|
@@ -628,7 +634,7 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
628
634
|
a ? n.types.isObjectExpression(a.value) && i.length > 0 ? U(i, e, a.value) : a.value = q(i, e) : r.properties.push(
|
|
629
635
|
n.types.objectProperty(n.types.identifier(t), q(i, e))
|
|
630
636
|
);
|
|
631
|
-
}, "_updateExportNode"),
|
|
637
|
+
}, "_updateExportNode"), Z = class {
|
|
632
638
|
constructor(e, r, t) {
|
|
633
639
|
this._exports = {};
|
|
634
640
|
// FIXME: this is a hack. this is only used in the case where the user is
|
|
@@ -657,8 +663,8 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
657
663
|
enter({ node: r, parent: t }) {
|
|
658
664
|
e.hasDefaultExport = !0;
|
|
659
665
|
let i = n.types.isIdentifier(r.declaration) && n.types.isProgram(t) ? w(r.declaration.name, t) : r.declaration;
|
|
660
|
-
i =
|
|
661
|
-
i) ? e._parseExportsObject(i) :
|
|
666
|
+
i = H(i), n.types.isCallExpression(i) && n.types.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.types.isObjectExpression(
|
|
667
|
+
i) ? e._parseExportsObject(i) : Q.logger.warn(
|
|
662
668
|
se({
|
|
663
669
|
expectedType: "ObjectExpression",
|
|
664
670
|
foundType: i?.type,
|
|
@@ -684,10 +690,10 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
684
690
|
}
|
|
685
691
|
} else r.specifiers ? r.specifiers.forEach((i) => {
|
|
686
692
|
if (n.types.isExportSpecifier(i) && n.types.isIdentifier(i.local) && n.types.isIdentifier(i.exported)) {
|
|
687
|
-
let { name: a } = i.local, { name: o } = i.exported, c =
|
|
693
|
+
let { name: a } = i.local, { name: o } = i.exported, c = Y(a, t);
|
|
688
694
|
c && (e._exports[o] = c.init, e._exportDecls[o] = c);
|
|
689
695
|
}
|
|
690
|
-
}) :
|
|
696
|
+
}) : Q.logger.warn(
|
|
691
697
|
se({
|
|
692
698
|
expectedType: "VariableDeclaration",
|
|
693
699
|
foundType: r.declaration?.type,
|
|
@@ -703,7 +709,7 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
703
709
|
if (n.types.isMemberExpression(i) && n.types.isIdentifier(i.object) && i.object.name === "module" && n.types.isIdentifier(i.property) &&
|
|
704
710
|
i.property.name === "exports") {
|
|
705
711
|
let o = a;
|
|
706
|
-
n.types.isIdentifier(a) && (o = w(a.name, t)), o =
|
|
712
|
+
n.types.isIdentifier(a) && (o = w(a.name, t)), o = H(o), n.types.isObjectExpression(o) ? (e._exportsObject = o, o.properties.forEach(
|
|
707
713
|
(c) => {
|
|
708
714
|
let p = F(c);
|
|
709
715
|
if (p) {
|
|
@@ -713,7 +719,7 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
713
719
|
t
|
|
714
720
|
)), e._exports[p] = d;
|
|
715
721
|
}
|
|
716
|
-
})) :
|
|
722
|
+
})) : Q.logger.warn(
|
|
717
723
|
se({
|
|
718
724
|
expectedType: "ObjectExpression",
|
|
719
725
|
foundType: o?.type,
|
|
@@ -760,7 +766,7 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
760
766
|
if (this._exportsObject) {
|
|
761
767
|
let p = this._exportsObject.properties.find((d) => F(d) === t);
|
|
762
768
|
if (p && n.types.isIdentifier(p.value)) {
|
|
763
|
-
let d =
|
|
769
|
+
let d = Y(p.value.name, this._ast.program);
|
|
764
770
|
if (d && n.types.isObjectExpression(d.init)) {
|
|
765
771
|
U(i, r, d.init);
|
|
766
772
|
return;
|
|
@@ -773,7 +779,7 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
773
779
|
U(i, r, a);
|
|
774
780
|
return;
|
|
775
781
|
}
|
|
776
|
-
let o =
|
|
782
|
+
let o = Y(t, this._ast.program);
|
|
777
783
|
if (o && n.types.isObjectExpression(o.init)) {
|
|
778
784
|
U(i, r, o.init);
|
|
779
785
|
return;
|
|
@@ -875,7 +881,7 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
875
881
|
}
|
|
876
882
|
if (n.types.isExportDefaultDeclaration(a)) {
|
|
877
883
|
let o = a.declaration;
|
|
878
|
-
if (n.types.isIdentifier(o) && (o = w(o.name, this._ast.program)), o =
|
|
884
|
+
if (n.types.isIdentifier(o) && (o = w(o.name, this._ast.program)), o = H(o), n.types.isObjectExpression(o)) {
|
|
879
885
|
let c = o.properties;
|
|
880
886
|
r(c, e[0]), i = !0;
|
|
881
887
|
}
|
|
@@ -1083,36 +1089,36 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
|
|
|
1083
1089
|
}
|
|
1084
1090
|
}, Se = /* @__PURE__ */ f((s, e) => {
|
|
1085
1091
|
let r = (0, n.babelParse)(s);
|
|
1086
|
-
return new
|
|
1092
|
+
return new Z(r, s, e);
|
|
1087
1093
|
}, "loadConfig"), Oe = /* @__PURE__ */ f((s) => Pe(s).code, "formatConfig"), Pe = /* @__PURE__ */ f((s, e = {}) => n.recast.print(s._ast, e),
|
|
1088
1094
|
"printConfig"), ot = /* @__PURE__ */ f(async (s) => {
|
|
1089
|
-
let e = (await (0,
|
|
1095
|
+
let e = (await (0, ee.readFile)(s, "utf-8")).toString();
|
|
1090
1096
|
return Se(e, s).parse();
|
|
1091
1097
|
}, "readConfig"), at = /* @__PURE__ */ f(async (s, e) => {
|
|
1092
1098
|
let r = e || s.fileName;
|
|
1093
1099
|
if (!r)
|
|
1094
1100
|
throw new Error("Please specify a fileName for writeConfig");
|
|
1095
|
-
await (0,
|
|
1101
|
+
await (0, ee.writeFile)(r, Oe(s));
|
|
1096
1102
|
}, "writeConfig"), lt = /* @__PURE__ */ f((s) => !!s._ast.program.body.find((r) => n.types.isImportDeclaration(r) && r.source.value.includes(
|
|
1097
1103
|
"@storybook") && r.specifiers.some((t) => n.types.isImportSpecifier(t) && n.types.isIdentifier(t.imported) && t.imported.name === "definePre\
|
|
1098
1104
|
view")), "isCsfFactoryPreview");
|
|
1099
1105
|
|
|
1100
1106
|
// src/csf-tools/getStorySortParameter.ts
|
|
1101
|
-
var
|
|
1107
|
+
var b = require("storybook/internal/babel"), De = require("storybook/internal/node-logger"), Ie = G($(), 1);
|
|
1102
1108
|
var ne = /* @__PURE__ */ f((s, e) => {
|
|
1103
1109
|
let r;
|
|
1104
1110
|
return s.properties.forEach((t) => {
|
|
1105
|
-
|
|
1111
|
+
b.types.isIdentifier(t.key) && t.key.name === e && (r = t.value);
|
|
1106
1112
|
}), r;
|
|
1107
1113
|
}, "getValue"), oe = /* @__PURE__ */ f((s) => {
|
|
1108
1114
|
let e = B(s);
|
|
1109
|
-
if (
|
|
1115
|
+
if (b.types.isArrayExpression(e))
|
|
1110
1116
|
return e.elements.map((r) => oe(r));
|
|
1111
|
-
if (
|
|
1112
|
-
return e.properties.reduce((r, t) => (
|
|
1113
|
-
if (
|
|
1117
|
+
if (b.types.isObjectExpression(e))
|
|
1118
|
+
return e.properties.reduce((r, t) => (b.types.isIdentifier(t.key) && (r[t.key.name] = oe(t.value)), r), {});
|
|
1119
|
+
if (b.types.isLiteral(e))
|
|
1114
1120
|
return e.value;
|
|
1115
|
-
if (
|
|
1121
|
+
if (b.types.isIdentifier(e))
|
|
1116
1122
|
return C(e.name, !0);
|
|
1117
1123
|
throw new Error(`Unknown node type ${e.type}`);
|
|
1118
1124
|
}, "parseValue"), C = /* @__PURE__ */ f((s, e) => {
|
|
@@ -1130,34 +1136,34 @@ var ne = /* @__PURE__ */ f((s, e) => {
|
|
|
1130
1136
|
if (e)
|
|
1131
1137
|
throw new Error(r);
|
|
1132
1138
|
De.logger.log(r);
|
|
1133
|
-
}, "unsupported"), B = /* @__PURE__ */ f((s) =>
|
|
1139
|
+
}, "unsupported"), B = /* @__PURE__ */ f((s) => b.types.isTSAsExpression(s) || b.types.isTSSatisfiesExpression(s) ? s.expression : s, "strip\
|
|
1134
1140
|
TSModifiers"), Ne = /* @__PURE__ */ f((s) => {
|
|
1135
1141
|
let e = B(s);
|
|
1136
|
-
if (
|
|
1142
|
+
if (b.types.isObjectExpression(e)) {
|
|
1137
1143
|
let r = ne(e, "options");
|
|
1138
1144
|
if (r) {
|
|
1139
|
-
if (
|
|
1145
|
+
if (b.types.isObjectExpression(r))
|
|
1140
1146
|
return ne(r, "storySort");
|
|
1141
1147
|
C("options", !0);
|
|
1142
1148
|
}
|
|
1143
1149
|
}
|
|
1144
1150
|
}, "parseParameters"), ve = /* @__PURE__ */ f((s, e) => {
|
|
1145
1151
|
let r = B(s);
|
|
1146
|
-
if (
|
|
1152
|
+
if (b.types.isObjectExpression(r)) {
|
|
1147
1153
|
let t = ne(r, "parameters");
|
|
1148
|
-
if (
|
|
1154
|
+
if (b.types.isIdentifier(t) && (t = O(t.name, e)), t)
|
|
1149
1155
|
return Ne(t);
|
|
1150
1156
|
} else
|
|
1151
1157
|
C("default", !0);
|
|
1152
1158
|
}, "parseDefault"), ct = /* @__PURE__ */ f((s) => {
|
|
1153
1159
|
if (!s.includes("storySort"))
|
|
1154
1160
|
return;
|
|
1155
|
-
let e, r = (0,
|
|
1156
|
-
if ((0,
|
|
1161
|
+
let e, r = (0, b.babelParse)(s);
|
|
1162
|
+
if ((0, b.traverse)(r, {
|
|
1157
1163
|
ExportNamedDeclaration: {
|
|
1158
1164
|
enter({ node: t }) {
|
|
1159
|
-
|
|
1160
|
-
if (
|
|
1165
|
+
b.types.isVariableDeclaration(t.declaration) ? t.declaration.declarations.forEach((i) => {
|
|
1166
|
+
if (b.types.isVariableDeclarator(i) && b.types.isIdentifier(i.id)) {
|
|
1161
1167
|
let { name: a } = i.id;
|
|
1162
1168
|
if (a === "parameters" && i.init) {
|
|
1163
1169
|
let o = B(i.init);
|
|
@@ -1165,30 +1171,30 @@ TSModifiers"), Ne = /* @__PURE__ */ f((s) => {
|
|
|
1165
1171
|
}
|
|
1166
1172
|
}
|
|
1167
1173
|
}) : t.specifiers.forEach((i) => {
|
|
1168
|
-
|
|
1174
|
+
b.types.isIdentifier(i.exported) && i.exported.name === "parameters" && C("parameters", !1);
|
|
1169
1175
|
});
|
|
1170
1176
|
}
|
|
1171
1177
|
},
|
|
1172
1178
|
ExportDefaultDeclaration: {
|
|
1173
1179
|
enter({ node: t }) {
|
|
1174
1180
|
let i = t.declaration;
|
|
1175
|
-
|
|
1176
|
-
e = ve(i.arguments[0], r.program) :
|
|
1181
|
+
b.types.isIdentifier(i) && (i = O(i.name, r.program)), i = B(i), b.types.isCallExpression(i) && b.types.isObjectExpression(i.arguments?.[0]) ?
|
|
1182
|
+
e = ve(i.arguments[0], r.program) : b.types.isObjectExpression(i) ? e = ve(i, r.program) : C("default", !1);
|
|
1177
1183
|
}
|
|
1178
1184
|
}
|
|
1179
1185
|
}), !!e) {
|
|
1180
|
-
if (
|
|
1181
|
-
let { code: t } = (0,
|
|
1186
|
+
if (b.types.isArrowFunctionExpression(e)) {
|
|
1187
|
+
let { code: t } = (0, b.generate)(e, {});
|
|
1182
1188
|
return (0, eval)(t);
|
|
1183
1189
|
}
|
|
1184
|
-
if (
|
|
1185
|
-
let { code: t } = (0,
|
|
1190
|
+
if (b.types.isFunctionExpression(e)) {
|
|
1191
|
+
let { code: t } = (0, b.generate)(e, {}), i = e.id?.name, a = `(a, b) => {
|
|
1186
1192
|
${t};
|
|
1187
1193
|
return ${i}(a, b)
|
|
1188
1194
|
}`;
|
|
1189
1195
|
return (0, eval)(a);
|
|
1190
1196
|
}
|
|
1191
|
-
return
|
|
1197
|
+
return b.types.isLiteral(e) || b.types.isArrayExpression(e) || b.types.isObjectExpression(e) ? oe(e) : C("storySort", !0);
|
|
1192
1198
|
}
|
|
1193
1199
|
}, "getStorySortParameter");
|
|
1194
1200
|
|
|
@@ -1207,7 +1213,7 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
|
|
|
1207
1213
|
!0
|
|
1208
1214
|
), E = [];
|
|
1209
1215
|
if (o) {
|
|
1210
|
-
let
|
|
1216
|
+
let y = g.types.optionalMemberExpression(
|
|
1211
1217
|
x,
|
|
1212
1218
|
g.types.identifier("source"),
|
|
1213
1219
|
!1,
|
|
@@ -1218,13 +1224,13 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
|
|
|
1218
1224
|
g.types.identifier("source"),
|
|
1219
1225
|
g.types.objectExpression([
|
|
1220
1226
|
g.types.objectProperty(g.types.identifier("originalSource"), g.types.stringLiteral(o)),
|
|
1221
|
-
g.types.spreadElement(
|
|
1227
|
+
g.types.spreadElement(y)
|
|
1222
1228
|
])
|
|
1223
1229
|
)
|
|
1224
1230
|
);
|
|
1225
1231
|
}
|
|
1226
1232
|
if (c) {
|
|
1227
|
-
let
|
|
1233
|
+
let y = g.types.optionalMemberExpression(
|
|
1228
1234
|
x,
|
|
1229
1235
|
g.types.identifier("description"),
|
|
1230
1236
|
!1,
|
|
@@ -1235,7 +1241,7 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
|
|
|
1235
1241
|
g.types.identifier("description"),
|
|
1236
1242
|
g.types.objectExpression([
|
|
1237
1243
|
g.types.objectProperty(g.types.identifier("story"), g.types.stringLiteral(c)),
|
|
1238
|
-
g.types.spreadElement(
|
|
1244
|
+
g.types.spreadElement(y)
|
|
1239
1245
|
])
|
|
1240
1246
|
)
|
|
1241
1247
|
);
|
|
@@ -1247,10 +1253,10 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
|
|
|
1247
1253
|
g.types.objectExpression([g.types.spreadElement(x), ...E])
|
|
1248
1254
|
)
|
|
1249
1255
|
);
|
|
1250
|
-
let
|
|
1256
|
+
let y = g.types.expressionStatement(
|
|
1251
1257
|
g.types.assignmentExpression("=", u, g.types.objectExpression(p))
|
|
1252
1258
|
);
|
|
1253
|
-
s._ast.program.body.push(
|
|
1259
|
+
s._ast.program.body.push(y);
|
|
1254
1260
|
}
|
|
1255
1261
|
}, "enrichCsfStory"), Fe = /* @__PURE__ */ f((s, e, r) => {
|
|
1256
1262
|
if (!e.length) {
|
|
@@ -1291,7 +1297,7 @@ var $e = require("storybook/internal/babel");
|
|
|
1291
1297
|
|
|
1292
1298
|
// src/csf-tools/vitest-plugin/transformer.ts
|
|
1293
1299
|
var m = require("storybook/internal/babel"), ke = require("storybook/internal/common"), Ve = require("storybook/internal/csf"), le = require("storybook/internal/node-logger"),
|
|
1294
|
-
ce =
|
|
1300
|
+
ce = G($(), 1);
|
|
1295
1301
|
var ft = /* @__PURE__ */ f((s, e) => !(e.include.length && !e.include.some((r) => s?.includes(r)) || e.exclude.some((r) => s?.includes(r))),
|
|
1296
1302
|
"isValidTest");
|
|
1297
1303
|
async function Ae({
|
|
@@ -1302,7 +1308,7 @@ async function Ae({
|
|
|
1302
1308
|
tagsFilter: i,
|
|
1303
1309
|
previewLevelTags: a = []
|
|
1304
1310
|
}) {
|
|
1305
|
-
let o =
|
|
1311
|
+
let o = J(s, {
|
|
1306
1312
|
fileName: e,
|
|
1307
1313
|
transformInlineMeta: !0,
|
|
1308
1314
|
makeTitle: /* @__PURE__ */ f((h) => {
|
|
@@ -1341,10 +1347,10 @@ le an issue with details about your use case.`
|
|
|
1341
1347
|
);
|
|
1342
1348
|
ft(S, i) && (E[h] = o._storyStatements[h]);
|
|
1343
1349
|
});
|
|
1344
|
-
let
|
|
1350
|
+
let y = o._file.path.scope.generateUidIdentifier("test"), j = o._file.path.scope.generateUidIdentifier("describe");
|
|
1345
1351
|
if (Object.keys(E).length === 0) {
|
|
1346
1352
|
let h = m.types.expressionStatement(
|
|
1347
|
-
m.types.callExpression(m.types.memberExpression(
|
|
1353
|
+
m.types.callExpression(m.types.memberExpression(j, m.types.identifier("skip")), [
|
|
1348
1354
|
m.types.stringLiteral("No valid tests found")
|
|
1349
1355
|
])
|
|
1350
1356
|
);
|
|
@@ -1352,8 +1358,8 @@ le an issue with details about your use case.`
|
|
|
1352
1358
|
let S = [
|
|
1353
1359
|
m.types.importDeclaration(
|
|
1354
1360
|
[
|
|
1355
|
-
m.types.importSpecifier(
|
|
1356
|
-
m.types.importSpecifier(
|
|
1361
|
+
m.types.importSpecifier(y, m.types.identifier("test")),
|
|
1362
|
+
m.types.importSpecifier(j, m.types.identifier("describe"))
|
|
1357
1363
|
],
|
|
1358
1364
|
m.types.stringLiteral("vitest")
|
|
1359
1365
|
)
|
|
@@ -1361,7 +1367,7 @@ le an issue with details about your use case.`
|
|
|
1361
1367
|
c.program.body.unshift(...S);
|
|
1362
1368
|
} else {
|
|
1363
1369
|
let pe = function() {
|
|
1364
|
-
let
|
|
1370
|
+
let _ = o._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), I = m.types.memberExpression(
|
|
1365
1371
|
m.types.callExpression(m.types.memberExpression(h, m.types.identifier("getState")), []),
|
|
1366
1372
|
m.types.identifier("testPath")
|
|
1367
1373
|
), T = m.types.memberExpression(
|
|
@@ -1373,7 +1379,7 @@ le an issue with details about your use case.`
|
|
|
1373
1379
|
// https://github.com/vitest-dev/vitest/issues/6367 (or probably just use testPathProperty)
|
|
1374
1380
|
T,
|
|
1375
1381
|
I
|
|
1376
|
-
),
|
|
1382
|
+
), W = m.types.callExpression(
|
|
1377
1383
|
m.types.memberExpression(
|
|
1378
1384
|
m.types.callExpression(m.types.identifier("convertToFilePath"), [
|
|
1379
1385
|
m.types.memberExpression(
|
|
@@ -1386,50 +1392,50 @@ le an issue with details about your use case.`
|
|
|
1386
1392
|
[k]
|
|
1387
1393
|
);
|
|
1388
1394
|
return { isRunningFromThisFileDeclaration: m.types.variableDeclaration("const", [
|
|
1389
|
-
m.types.variableDeclarator(
|
|
1390
|
-
]), isRunningFromThisFileId:
|
|
1395
|
+
m.types.variableDeclarator(_, W)
|
|
1396
|
+
]), isRunningFromThisFileId: _ };
|
|
1391
1397
|
};
|
|
1392
|
-
var
|
|
1398
|
+
var te = pe;
|
|
1393
1399
|
f(pe, "getTestGuardDeclaration");
|
|
1394
|
-
let h = o._file.path.scope.generateUidIdentifier("expect"), S = o._file.path.scope.generateUidIdentifier("testStory"),
|
|
1395
|
-
JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration:
|
|
1396
|
-
c.program.body.push(
|
|
1400
|
+
let h = o._file.path.scope.generateUidIdentifier("expect"), S = o._file.path.scope.generateUidIdentifier("testStory"), Me = m.types.identifier(
|
|
1401
|
+
JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Re, isRunningFromThisFileId: Le } = pe();
|
|
1402
|
+
c.program.body.push(Re);
|
|
1397
1403
|
let Ue = /* @__PURE__ */ f(({
|
|
1398
|
-
localName:
|
|
1404
|
+
localName: _,
|
|
1399
1405
|
exportName: I,
|
|
1400
1406
|
testTitle: T,
|
|
1401
1407
|
node: k
|
|
1402
1408
|
}) => {
|
|
1403
|
-
let
|
|
1404
|
-
m.types.callExpression(
|
|
1409
|
+
let W = m.types.expressionStatement(
|
|
1410
|
+
m.types.callExpression(y, [
|
|
1405
1411
|
m.types.stringLiteral(T),
|
|
1406
1412
|
m.types.callExpression(S, [
|
|
1407
1413
|
m.types.stringLiteral(I),
|
|
1408
|
-
m.types.identifier(
|
|
1414
|
+
m.types.identifier(_),
|
|
1409
1415
|
m.types.identifier(p),
|
|
1410
|
-
|
|
1416
|
+
Me
|
|
1411
1417
|
])
|
|
1412
1418
|
])
|
|
1413
1419
|
);
|
|
1414
|
-
return
|
|
1415
|
-
}, "getTestStatementForStory"), qe = Object.entries(E).map(([
|
|
1420
|
+
return W.loc = k.loc, W;
|
|
1421
|
+
}, "getTestStatementForStory"), qe = Object.entries(E).map(([_, I]) => {
|
|
1416
1422
|
if (I === null) {
|
|
1417
1423
|
le.logger.warn(
|
|
1418
1424
|
ce.dedent`
|
|
1419
|
-
[Storybook]: Could not transform "${
|
|
1425
|
+
[Storybook]: Could not transform "${_}" story into test at "${e}".
|
|
1420
1426
|
Please make sure to define stories in the same file and not re-export stories coming from other files".
|
|
1421
1427
|
`
|
|
1422
1428
|
);
|
|
1423
1429
|
return;
|
|
1424
1430
|
}
|
|
1425
|
-
let T = o._stories[
|
|
1426
|
-
return Ue({ testTitle: k, localName: T, exportName:
|
|
1427
|
-
}).filter((
|
|
1431
|
+
let T = o._stories[_].localName ?? _, k = o._stories[_].name ?? _;
|
|
1432
|
+
return Ue({ testTitle: k, localName: T, exportName: _, node: I });
|
|
1433
|
+
}).filter((_) => !!_), Be = m.types.ifStatement(Le, m.types.blockStatement(qe));
|
|
1428
1434
|
c.program.body.push(Be);
|
|
1429
1435
|
let We = [
|
|
1430
1436
|
m.types.importDeclaration(
|
|
1431
1437
|
[
|
|
1432
|
-
m.types.importSpecifier(
|
|
1438
|
+
m.types.importSpecifier(y, m.types.identifier("test")),
|
|
1433
1439
|
m.types.importSpecifier(h, m.types.identifier("expect"))
|
|
1434
1440
|
],
|
|
1435
1441
|
m.types.stringLiteral("vitest")
|