storybook 9.1.12 → 9.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/babel/index.cjs +22495 -21246
  2. package/dist/babel/index.d.ts +672 -336
  3. package/dist/babel/index.js +22534 -21285
  4. package/dist/bin/index.cjs +42 -43
  5. package/dist/bin/index.js +42 -43
  6. package/dist/cli/bin/index.cjs +1 -1
  7. package/dist/cli/bin/index.js +1 -1
  8. package/dist/cli/index.cjs +27120 -25868
  9. package/dist/cli/index.js +27267 -26015
  10. package/dist/common/index.cjs +42 -43
  11. package/dist/common/index.d.ts +0 -1
  12. package/dist/common/index.js +42 -43
  13. package/dist/components/index.cjs +4464 -4353
  14. package/dist/components/index.js +3290 -3181
  15. package/dist/core-server/index.cjs +7388 -7318
  16. package/dist/core-server/index.js +7597 -7529
  17. package/dist/core-server/presets/common-preset.cjs +20127 -19935
  18. package/dist/core-server/presets/common-preset.js +20203 -20011
  19. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.cjs +306 -518
  20. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +302 -525
  21. package/dist/csf-tools/index.cjs +150 -144
  22. package/dist/csf-tools/index.js +401 -395
  23. package/dist/manager/globals-runtime.js +16578 -16469
  24. package/dist/manager-api/index.cjs +1 -1
  25. package/dist/manager-api/index.js +1 -1
  26. package/dist/node-logger/index.cjs +71 -71
  27. package/dist/node-logger/index.js +71 -71
  28. package/dist/preview/runtime.js +240 -240
  29. package/dist/telemetry/index.cjs +1 -1
  30. package/dist/telemetry/index.js +1 -1
  31. package/dist/test/index.cjs +267 -267
  32. package/dist/test/index.js +240 -240
  33. package/package.json +1 -1
@@ -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 z = (s, e, r) => (r = s != null ? Ge(Ke(s)) : {}, fe(
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, b) {
58
- return b === 0 ? E : "" + u + E;
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: () => M,
72
- ConfigFile: () => ee,
73
- CsfFile: () => K,
74
- MixedFactoryError: () => L,
75
- MultipleMetaError: () => X,
76
- NoMetaError: () => R,
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: () => Q,
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 J = require("node:fs/promises"), l = require("storybook/internal/babel"), v = require("storybook/internal/csf"), re = require("storybook/internal/node-logger"),
104
- P = z($(), 1);
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, R = class extends Error {
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
- }, X = class extends Error {
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
- }, L = class extends Error {
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
- }, M = class extends Error {
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
- }, K = class {
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 X("multiple meta objects", e, this._options.fileName);
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
- if (this._metaAnnotations[i.key.name] = i.value, i.key.name === "title")
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 a = i.value;
273
- if (l.types.isIdentifier(a)) {
274
- let c = a.name, p = r.body.find(
275
- (d) => l.types.isImportDeclaration(d) && d.specifiers.find((u) => u.local.name === c)
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 (p) {
278
- let { source: d } = p;
279
- l.types.isStringLiteral(d) && (this._rawComponentPath = d.value);
278
+ if (d) {
279
+ let { source: u } = d;
280
+ l.types.isStringLiteral(u) && (this._rawComponentPath = u.value);
280
281
  }
281
282
  }
282
- let { code: o } = l.recast.print(i.value, {});
283
- t.component = o;
283
+ let { code: c } = l.recast.print(i.value, {});
284
+ t.component = c;
284
285
  } else if (i.key.name === "tags") {
285
- let a = i.value;
286
- l.types.isIdentifier(a) && (a = O(a.name, this._ast.program)), t.tags = me(a);
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 R(
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 L(
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 L(
378
+ throw e._metaNode ? new R(
378
379
  "expected non-factory story",
379
380
  x,
380
381
  e._options.fileName
381
- ) : new M(
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((b) => {
388
- if (l.types.isIdentifier(b.key)) {
389
- if (b.key.name === "render")
390
- E.__isArgsStory = ue(
391
- b.value,
392
- a,
393
- e
394
- );
395
- else if (b.key.name === "name" && l.types.isStringLiteral(b.value))
396
- u = b.value.value;
397
- else if (b.key.name === "storyName" && l.types.isStringLiteral(b.value))
398
- re.logger.warn(
399
- `Unexpected usage of "storyName" in "${d}". Please use "name" instead.`
400
- );
401
- else if (b.key.name === "parameters" && l.types.isObjectExpression(b.value)) {
402
- let _ = b.value.properties.find(
403
- (W) => l.types.isObjectProperty(W) && l.types.isIdentifier(W.key) && W.key.name === "__id"
404
- );
405
- _ && (E.__id = _.value.value);
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((b) => {
432
- l.types.isIdentifier(b.key) && (x[b.key.name] = b.value);
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 M(
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 R("missing default export", e._ast, e._options.fileName);
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 _ = l.types.isIdentifier(u) ? O(u.name, this._ast.program) : u;
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[_] = !!d[_] || !!e._metaAnnotations[_];
520
+ ["play", "render", "loaders", "beforeEach", "globals", "tags"].forEach((j) => {
521
+ E[j] = !!d[j] || !!e._metaAnnotations[j];
516
522
  });
517
- let b = e.getStoryExport(i);
518
- return E.storyFn = !!(l.types.isArrowFunctionExpression(b) || l.types.isFunctionDeclaration(b)), E.mount = rt(d.play ?? e._metaAnnotations.
519
- play), E.moduleMock = !!e.imports.find((_) => ye(_)), t;
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"), Q = /* @__PURE__ */ f((s, e) => {
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 K(r, e, t);
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, J.readFile)(s, "utf-8")).toString();
578
- return Q(r, { ...e, fileName: s });
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, J.writeFile)(e, Ee(s).code);
588
+ await (0, K.writeFile)(e, Ee(s).code);
583
589
  }, "writeCsf");
584
590
 
585
591
  // src/csf-tools/ConfigFile.ts
586
- var te = require("node:fs/promises"), n = require("storybook/internal/babel"), H = require("storybook/internal/node-logger"), he = z($(), 1);
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"), Y = /* @__PURE__ */ f((s) => n.types.isTSAsExpression(s) || n.types.isTSSatisfiesExpression(s) ? Y(s.expression) :
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"), Z = /* @__PURE__ */ f((s, e) => {
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) => Z(s, e)?.init, "_findVarInitialization"), q = /* @__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"), ee = class {
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 = Y(i), n.types.isCallExpression(i) && n.types.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.types.isObjectExpression(
661
- i) ? e._parseExportsObject(i) : H.logger.warn(
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 = Z(a, t);
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
- }) : H.logger.warn(
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 = Y(o), n.types.isObjectExpression(o) ? (e._exportsObject = o, o.properties.forEach(
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
- })) : H.logger.warn(
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 = Z(p.value.name, this._ast.program);
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 = Z(t, this._ast.program);
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 = Y(o), n.types.isObjectExpression(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 ee(r, s, e);
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, te.readFile)(s, "utf-8")).toString();
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, te.writeFile)(r, Oe(s));
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 y = require("storybook/internal/babel"), De = require("storybook/internal/node-logger"), Ie = z($(), 1);
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
- y.types.isIdentifier(t.key) && t.key.name === e && (r = t.value);
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 (y.types.isArrayExpression(e))
1115
+ if (b.types.isArrayExpression(e))
1110
1116
  return e.elements.map((r) => oe(r));
1111
- if (y.types.isObjectExpression(e))
1112
- return e.properties.reduce((r, t) => (y.types.isIdentifier(t.key) && (r[t.key.name] = oe(t.value)), r), {});
1113
- if (y.types.isLiteral(e))
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 (y.types.isIdentifier(e))
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) => y.types.isTSAsExpression(s) || y.types.isTSSatisfiesExpression(s) ? s.expression : s, "strip\
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 (y.types.isObjectExpression(e)) {
1142
+ if (b.types.isObjectExpression(e)) {
1137
1143
  let r = ne(e, "options");
1138
1144
  if (r) {
1139
- if (y.types.isObjectExpression(r))
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 (y.types.isObjectExpression(r)) {
1152
+ if (b.types.isObjectExpression(r)) {
1147
1153
  let t = ne(r, "parameters");
1148
- if (y.types.isIdentifier(t) && (t = O(t.name, e)), t)
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, y.babelParse)(s);
1156
- if ((0, y.traverse)(r, {
1161
+ let e, r = (0, b.babelParse)(s);
1162
+ if ((0, b.traverse)(r, {
1157
1163
  ExportNamedDeclaration: {
1158
1164
  enter({ node: t }) {
1159
- y.types.isVariableDeclaration(t.declaration) ? t.declaration.declarations.forEach((i) => {
1160
- if (y.types.isVariableDeclarator(i) && y.types.isIdentifier(i.id)) {
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
- y.types.isIdentifier(i.exported) && i.exported.name === "parameters" && C("parameters", !1);
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
- y.types.isIdentifier(i) && (i = O(i.name, r.program)), i = B(i), y.types.isCallExpression(i) && y.types.isObjectExpression(i.arguments?.[0]) ?
1176
- e = ve(i.arguments[0], r.program) : y.types.isObjectExpression(i) ? e = ve(i, r.program) : C("default", !1);
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 (y.types.isArrowFunctionExpression(e)) {
1181
- let { code: t } = (0, y.generate)(e, {});
1186
+ if (b.types.isArrowFunctionExpression(e)) {
1187
+ let { code: t } = (0, b.generate)(e, {});
1182
1188
  return (0, eval)(t);
1183
1189
  }
1184
- if (y.types.isFunctionExpression(e)) {
1185
- let { code: t } = (0, y.generate)(e, {}), i = e.id?.name, a = `(a, b) => {
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 y.types.isLiteral(e) || y.types.isArrayExpression(e) || y.types.isObjectExpression(e) ? oe(e) : C("storySort", !0);
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 b = g.types.optionalMemberExpression(
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(b)
1227
+ g.types.spreadElement(y)
1222
1228
  ])
1223
1229
  )
1224
1230
  );
1225
1231
  }
1226
1232
  if (c) {
1227
- let b = g.types.optionalMemberExpression(
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(b)
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 b = g.types.expressionStatement(
1256
+ let y = g.types.expressionStatement(
1251
1257
  g.types.assignmentExpression("=", u, g.types.objectExpression(p))
1252
1258
  );
1253
- s._ast.program.body.push(b);
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 = z($(), 1);
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 = Q(s, {
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 b = o._file.path.scope.generateUidIdentifier("test"), _ = o._file.path.scope.generateUidIdentifier("describe");
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(_, m.types.identifier("skip")), [
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(b, m.types.identifier("test")),
1356
- m.types.importSpecifier(_, m.types.identifier("describe"))
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 j = o._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), I = m.types.memberExpression(
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
- ), G = m.types.callExpression(
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(j, G)
1390
- ]), isRunningFromThisFileId: j };
1395
+ m.types.variableDeclarator(_, W)
1396
+ ]), isRunningFromThisFileId: _ };
1391
1397
  };
1392
- var W = pe;
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"), Re = m.types.identifier(
1395
- JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Le, isRunningFromThisFileId: Me } = pe();
1396
- c.program.body.push(Le);
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: j,
1404
+ localName: _,
1399
1405
  exportName: I,
1400
1406
  testTitle: T,
1401
1407
  node: k
1402
1408
  }) => {
1403
- let G = m.types.expressionStatement(
1404
- m.types.callExpression(b, [
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(j),
1414
+ m.types.identifier(_),
1409
1415
  m.types.identifier(p),
1410
- Re
1416
+ Me
1411
1417
  ])
1412
1418
  ])
1413
1419
  );
1414
- return G.loc = k.loc, G;
1415
- }, "getTestStatementForStory"), qe = Object.entries(E).map(([j, I]) => {
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 "${j}" story into test at "${e}".
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[j].localName ?? j, k = o._stories[j].name ?? j;
1426
- return Ue({ testTitle: k, localName: T, exportName: j, node: I });
1427
- }).filter((j) => !!j), Be = m.types.ifStatement(Me, m.types.blockStatement(qe));
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(b, m.types.identifier("test")),
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")