storybook 9.0.10 → 9.0.12

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 (38) hide show
  1. package/dist/bin/index.cjs +43 -43
  2. package/dist/bin/index.js +43 -43
  3. package/dist/cli/bin/index.cjs +629 -629
  4. package/dist/cli/bin/index.js +202 -201
  5. package/dist/cli/index.cjs +13788 -13797
  6. package/dist/cli/index.d.ts +712 -15
  7. package/dist/cli/index.js +12364 -12372
  8. package/dist/common/index.cjs +10997 -10888
  9. package/dist/common/index.d.ts +348 -66
  10. package/dist/common/index.js +24315 -24203
  11. package/dist/components/index.cjs +5 -3
  12. package/dist/components/index.d.ts +2 -1
  13. package/dist/components/index.js +5 -3
  14. package/dist/core-server/index.cjs +4838 -4791
  15. package/dist/core-server/index.d.ts +10 -1
  16. package/dist/core-server/index.js +5746 -5699
  17. package/dist/core-server/presets/common-manager.js +257 -243
  18. package/dist/core-server/presets/common-preset.cjs +1047 -1045
  19. package/dist/core-server/presets/common-preset.js +2053 -2048
  20. package/dist/csf-tools/index.cjs +226 -224
  21. package/dist/csf-tools/index.js +116 -112
  22. package/dist/manager/globals-runtime.js +6 -4
  23. package/dist/manager-api/index.cjs +73 -73
  24. package/dist/manager-api/index.js +140 -140
  25. package/dist/node-logger/index.cjs +8520 -994
  26. package/dist/node-logger/index.d.ts +395 -2
  27. package/dist/node-logger/index.js +8535 -995
  28. package/dist/preview/runtime.js +4 -3
  29. package/dist/preview-api/index.cjs +4 -3
  30. package/dist/preview-api/index.js +4 -3
  31. package/dist/server-errors.cjs +201 -242
  32. package/dist/server-errors.d.ts +1 -12
  33. package/dist/server-errors.js +182 -223
  34. package/dist/telemetry/index.cjs +1224 -1223
  35. package/dist/telemetry/index.d.ts +3 -2
  36. package/dist/telemetry/index.js +1069 -1066
  37. package/dist/types/index.d.ts +3 -3
  38. package/package.json +2 -1
@@ -1,34 +1,34 @@
1
1
  "use strict";
2
- var We = Object.create;
2
+ var Ge = Object.create;
3
3
  var A = Object.defineProperty;
4
- var Ge = Object.getOwnPropertyDescriptor;
5
- var ze = Object.getOwnPropertyNames;
6
- var Xe = Object.getPrototypeOf, Ke = Object.prototype.hasOwnProperty;
4
+ var ze = Object.getOwnPropertyDescriptor;
5
+ var Xe = Object.getOwnPropertyNames;
6
+ var Ke = Object.getPrototypeOf, Je = Object.prototype.hasOwnProperty;
7
7
  var f = (s, e) => A(s, "name", { value: e, configurable: !0 });
8
- var Je = (s, e) => () => (e || s((e = { exports: {} }).exports, e), e.exports), Qe = (s, e) => {
8
+ var Qe = (s, e) => () => (e || s((e = { exports: {} }).exports, e), e.exports), He = (s, e) => {
9
9
  for (var r in e)
10
10
  A(s, r, { get: e[r], enumerable: !0 });
11
- }, ce = (s, e, r, t) => {
11
+ }, fe = (s, e, r, t) => {
12
12
  if (e && typeof e == "object" || typeof e == "function")
13
- for (let i of ze(e))
14
- !Ke.call(s, i) && i !== r && A(s, i, { get: () => e[i], enumerable: !(t = Ge(e, i)) || t.enumerable });
13
+ for (let i of Xe(e))
14
+ !Je.call(s, i) && i !== r && A(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 ? We(Xe(s)) : {}, ce(
17
+ var z = (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
21
21
  // "default" to the CommonJS "module.exports" for node compatibility.
22
22
  e || !s || !s.__esModule ? A(r, "default", { value: s, enumerable: !0 }) : r,
23
23
  s
24
- )), He = (s) => ce(A({}, "__esModule", { value: !0 }), s);
24
+ )), Ye = (s) => fe(A({}, "__esModule", { value: !0 }), s);
25
25
 
26
26
  // ../node_modules/ts-dedent/dist/index.js
27
- var R = Je(($) => {
27
+ var R = Qe(($) => {
28
28
  "use strict";
29
29
  Object.defineProperty($, "__esModule", { value: !0 });
30
30
  $.dedent = void 0;
31
- function pe(s) {
31
+ function de(s) {
32
32
  for (var e = [], r = 1; r < arguments.length; r++)
33
33
  e[r - 1] = arguments[r];
34
34
  var t = Array.from(typeof s == "string" ? [s] : s);
@@ -60,47 +60,48 @@ var R = Je(($) => {
60
60
  `)), a += x + t[p + 1];
61
61
  }), a;
62
62
  }
63
- f(pe, "dedent");
64
- $.dedent = pe;
65
- $.default = pe;
63
+ f(de, "dedent");
64
+ $.dedent = de;
65
+ $.default = de;
66
66
  });
67
67
 
68
68
  // src/csf-tools/index.ts
69
69
  var dt = {};
70
- Qe(dt, {
70
+ He(dt, {
71
71
  BadMetaError: () => U,
72
- ConfigFile: () => Z,
72
+ ConfigFile: () => ee,
73
73
  CsfFile: () => K,
74
74
  MixedFactoryError: () => M,
75
75
  MultipleMetaError: () => X,
76
76
  NoMetaError: () => L,
77
- babelParse: () => Ae.babelParse,
78
- babelParseFile: () => ye,
77
+ babelParse: () => $e.babelParse,
78
+ babelParseFile: () => be,
79
79
  enrichCsf: () => pt,
80
- enrichCsfMeta: () => we,
81
- enrichCsfStory: () => Ie,
82
- extractDescription: () => oe,
83
- extractSource: () => Fe,
84
- formatConfig: () => Se,
85
- formatCsf: () => te,
80
+ enrichCsfMeta: () => Ce,
81
+ enrichCsfStory: () => we,
82
+ extractDescription: () => ae,
83
+ extractSource: () => Te,
84
+ formatConfig: () => Pe,
85
+ formatCsf: () => ie,
86
86
  getStorySortParameter: () => ct,
87
- isCsfFactoryPreview: () => at,
88
- isModuleMock: () => xe,
89
- isValidPreviewPath: () => ge,
90
- loadConfig: () => je,
87
+ isCsfFactoryPreview: () => lt,
88
+ isModuleMock: () => ye,
89
+ isValidPreviewPath: () => xe,
90
+ loadConfig: () => Se,
91
91
  loadCsf: () => Q,
92
- printConfig: () => Pe,
93
- printCsf: () => be,
94
- readConfig: () => nt,
95
- readCsf: () => it,
96
- vitestTransform: () => Ve,
97
- writeConfig: () => ot,
98
- writeCsf: () => st
92
+ printConfig: () => Oe,
93
+ printCsf: () => he,
94
+ readConfig: () => ot,
95
+ readCsf: () => st,
96
+ vitestTransform: () => Ae,
97
+ writeConfig: () => at,
98
+ writeCsf: () => nt
99
99
  });
100
- module.exports = He(dt);
100
+ module.exports = Ye(dt);
101
101
 
102
102
  // src/csf-tools/CsfFile.ts
103
- var J = require("node:fs/promises"), c = require("storybook/internal/babel"), v = require("storybook/internal/csf"), O = z(R(), 1);
103
+ var J = require("node:fs/promises"), c = require("storybook/internal/babel"), v = require("storybook/internal/csf"), re = require("storybook/internal/node-logger"),
104
+ O = z(R(), 1);
104
105
 
105
106
  // src/csf-tools/findVarInitialization.ts
106
107
  var w = require("storybook/internal/babel");
@@ -112,8 +113,8 @@ var P = /* @__PURE__ */ f((s, e) => {
112
113
  }, "findVarInitialization");
113
114
 
114
115
  // src/csf-tools/CsfFile.ts
115
- var fe = console, Ye = /\/preview(.(js|jsx|mjs|ts|tsx))?$/, ge = /* @__PURE__ */ f((s) => Ye.test(s), "isValidPreviewPath");
116
- function Ze(s) {
116
+ var Ze = /\/preview(.(js|jsx|mjs|ts|tsx))?$/, xe = /* @__PURE__ */ f((s) => Ze.test(s), "isValidPreviewPath");
117
+ function et(s) {
117
118
  if (c.types.isArrayExpression(s))
118
119
  return s.elements.map((e) => {
119
120
  if (c.types.isStringLiteral(e))
@@ -126,8 +127,8 @@ function Ze(s) {
126
127
  return new RegExp(s.pattern, s.flags);
127
128
  throw new Error(`Unknown include/exclude: ${s}`);
128
129
  }
129
- f(Ze, "parseIncludeExclude");
130
- function de(s) {
130
+ f(et, "parseIncludeExclude");
131
+ function me(s) {
131
132
  if (!c.types.isArrayExpression(s))
132
133
  throw new Error("CSF: Expected tags array");
133
134
  return s.elements.map((e) => {
@@ -136,7 +137,7 @@ function de(s) {
136
137
  throw new Error("CSF: Expected tag to be string literal");
137
138
  });
138
139
  }
139
- f(de, "parseTags");
140
+ f(me, "parseTags");
140
141
  var D = /* @__PURE__ */ f((s, e) => {
141
142
  let r = "";
142
143
  if (s.loc) {
@@ -144,7 +145,7 @@ var D = /* @__PURE__ */ f((s, e) => {
144
145
  r = `(line ${t}, col ${i})`;
145
146
  }
146
147
  return `${e || ""} ${r}`.trim();
147
- }, "formatLocation"), xe = /* @__PURE__ */ f((s) => rt.test(s), "isModuleMock"), ue = /* @__PURE__ */ f((s, e, r) => {
148
+ }, "formatLocation"), ye = /* @__PURE__ */ f((s) => it.test(s), "isModuleMock"), ue = /* @__PURE__ */ f((s, e, r) => {
148
149
  let t = s;
149
150
  if (c.types.isCallExpression(s)) {
150
151
  let { callee: i, arguments: o } = s;
@@ -155,7 +156,7 @@ var D = /* @__PURE__ */ f((s, e) => {
155
156
  }
156
157
  }
157
158
  return c.types.isArrowFunctionExpression(t) || c.types.isFunctionDeclaration(t) ? t.params.length > 0 : !1;
158
- }, "isArgsStory"), et = /* @__PURE__ */ f((s) => {
159
+ }, "isArgsStory"), tt = /* @__PURE__ */ f((s) => {
159
160
  if (c.types.isArrayExpression(s))
160
161
  return s.elements.map((e) => {
161
162
  if (c.types.isStringLiteral(e))
@@ -163,13 +164,13 @@ var D = /* @__PURE__ */ f((s, e) => {
163
164
  throw new Error(`Expected string literal named export: ${e}`);
164
165
  });
165
166
  throw new Error(`Expected array of string literals: ${s}`);
166
- }, "parseExportsOrder"), me = /* @__PURE__ */ f((s, e) => e.reduce(
167
+ }, "parseExportsOrder"), ge = /* @__PURE__ */ f((s, e) => e.reduce(
167
168
  (r, t) => {
168
169
  let i = s[t];
169
170
  return i && (r[t] = i), r;
170
171
  },
171
172
  {}
172
- ), "sortExports"), tt = /* @__PURE__ */ f((s) => {
173
+ ), "sortExports"), rt = /* @__PURE__ */ f((s) => {
173
174
  if (c.types.isArrowFunctionExpression(s) || c.types.isFunctionDeclaration(s)) {
174
175
  let e = s.params;
175
176
  if (e.length >= 1) {
@@ -182,14 +183,14 @@ var D = /* @__PURE__ */ f((s, e) => {
182
183
  }
183
184
  }
184
185
  return !1;
185
- }, "hasMount"), rt = /^[.\/#].*\.mock($|\.[^.]*$)/i, L = class extends Error {
186
+ }, "hasMount"), it = /^[.\/#].*\.mock($|\.[^.]*$)/i, L = class extends Error {
186
187
  static {
187
188
  f(this, "NoMetaError");
188
189
  }
189
190
  constructor(e, r, t) {
190
- let i = "".trim();
191
+ let i = e.trim();
191
192
  super(O.dedent`
192
- CSF: ${e} ${D(r, t)}
193
+ CSF: ${i} ${D(r, t)}
193
194
 
194
195
  More info: https://storybook.js.org/docs/writing-stories#default-export
195
196
  `), this.name = this.constructor.name;
@@ -266,7 +267,7 @@ var D = /* @__PURE__ */ f((s, e) => {
266
267
  if (this._metaAnnotations[i.key.name] = i.value, i.key.name === "title")
267
268
  t.title = this._parseTitle(i.value);
268
269
  else if (["includeStories", "excludeStories"].includes(i.key.name))
269
- t[i.key.name] = Ze(i.value);
270
+ t[i.key.name] = et(i.value);
270
271
  else if (i.key.name === "component") {
271
272
  let o = i.value;
272
273
  if (c.types.isIdentifier(o)) {
@@ -282,7 +283,7 @@ var D = /* @__PURE__ */ f((s, e) => {
282
283
  t.component = a;
283
284
  } else if (i.key.name === "tags") {
284
285
  let o = i.value;
285
- c.types.isIdentifier(o) && (o = P(o.name, this._ast.program)), t.tags = de(o);
286
+ c.types.isIdentifier(o) && (o = P(o.name, this._ast.program)), t.tags = me(o);
286
287
  } else if (i.key.name === "id")
287
288
  if (c.types.isStringLiteral(i.value))
288
289
  t.id = i.value.value;
@@ -351,12 +352,12 @@ var D = /* @__PURE__ */ f((s, e) => {
351
352
  if (c.types.isIdentifier(l.id)) {
352
353
  let p = !1, { name: d } = l.id;
353
354
  if (d === "__namedExportsOrder" && c.types.isVariableDeclarator(l)) {
354
- e._namedExportsOrder = et(l.init);
355
+ e._namedExportsOrder = tt(l.init);
355
356
  return;
356
357
  }
357
358
  e._storyExports[d] = l, e._storyPaths[d] = t, e._storyStatements[d] = i;
358
359
  let g = (0, v.storyNameFromExport)(d);
359
- e._storyAnnotations[d] ? fe.warn(
360
+ e._storyAnnotations[d] ? re.logger.warn(
360
361
  `Unexpected annotations for "${d}" before story declaration`
361
362
  ) : e._storyAnnotations[d] = {};
362
363
  let x;
@@ -390,7 +391,7 @@ var D = /* @__PURE__ */ f((s, e) => {
390
391
  else if (b.key.name === "name" && c.types.isStringLiteral(b.value))
391
392
  g = b.value.value;
392
393
  else if (b.key.name === "storyName" && c.types.isStringLiteral(b.value))
393
- fe.warn(
394
+ re.logger.warn(
394
395
  `Unexpected usage of "storyName" in "${d}". Please use "name" instead.`
395
396
  );
396
397
  else if (b.key.name === "parameters" && c.types.isObjectExpression(b.value)) {
@@ -465,7 +466,7 @@ var D = /* @__PURE__ */ f((s, e) => {
465
466
  i.arguments.length > 0) {
466
467
  let l = t.scope.getBinding(o.object.name)?.path?.parentPath?.node;
467
468
  if (c.types.isImportDeclaration(l))
468
- if (ge(l.source.value)) {
469
+ if (xe(l.source.value)) {
469
470
  let p = i.arguments[0];
470
471
  e._metaVariableName = o.property.name, e._metaIsFactory = !0, e._parseMeta(p, e._ast.program);
471
472
  } else
@@ -500,7 +501,7 @@ var D = /* @__PURE__ */ f((s, e) => {
500
501
  let d = e._storyAnnotations[i], { tags: g, play: x } = d;
501
502
  if (g) {
502
503
  let E = c.types.isIdentifier(g) ? P(g.name, this._ast.program) : g;
503
- t[i].tags = de(E);
504
+ t[i].tags = me(E);
504
505
  }
505
506
  x && (t[i].tags = [...t[i].tags || [], "play-fn"]);
506
507
  let h = t[i].__stats;
@@ -508,15 +509,15 @@ var D = /* @__PURE__ */ f((s, e) => {
508
509
  h[E] = !!d[E] || !!e._metaAnnotations[E];
509
510
  });
510
511
  let b = e.getStoryExport(i);
511
- return h.storyFn = !!(c.types.isArrowFunctionExpression(b) || c.types.isFunctionDeclaration(b)), h.mount = tt(d.play ?? e._metaAnnotations.
512
- play), h.moduleMock = !!e.imports.find((E) => xe(E)), t;
512
+ return h.storyFn = !!(c.types.isArrowFunctionExpression(b) || c.types.isFunctionDeclaration(b)), h.mount = rt(d.play ?? e._metaAnnotations.
513
+ play), h.moduleMock = !!e.imports.find((E) => ye(E)), t;
513
514
  },
514
515
  {}
515
516
  ), Object.keys(e._storyExports).forEach((t) => {
516
517
  (0, v.isExportStory)(t, e._meta) || (delete e._storyExports[t], delete e._storyAnnotations[t], delete e._storyStatements[t]);
517
518
  }), e._namedExportsOrder) {
518
519
  let t = Object.keys(e._storyExports);
519
- e._storyExports = me(e._storyExports, e._namedExportsOrder), e._stories = me(e._stories, e._namedExportsOrder);
520
+ e._storyExports = ge(e._storyExports, e._namedExportsOrder), e._stories = ge(e._stories, e._namedExportsOrder);
520
521
  let i = Object.keys(e._storyExports);
521
522
  if (t.length !== i.length)
522
523
  throw new Error(
@@ -556,44 +557,44 @@ var D = /* @__PURE__ */ f((s, e) => {
556
557
  };
557
558
  });
558
559
  }
559
- }, ye = /* @__PURE__ */ f(({
560
+ }, be = /* @__PURE__ */ f(({
560
561
  code: s,
561
562
  filename: e = "",
562
563
  ast: r
563
564
  }) => new c.BabelFileClass({ filename: e }, { code: s, ast: r ?? (0, c.babelParse)(s) }), "babelParseFile"), Q = /* @__PURE__ */ f((s, e) => {
564
- let r = (0, c.babelParse)(s), t = ye({ code: s, filename: e.fileName, ast: r });
565
+ let r = (0, c.babelParse)(s), t = be({ code: s, filename: e.fileName, ast: r });
565
566
  return new K(r, e, t);
566
- }, "loadCsf"), te = /* @__PURE__ */ f((s, e = { sourceMaps: !1 }, r) => {
567
+ }, "loadCsf"), ie = /* @__PURE__ */ f((s, e = { sourceMaps: !1 }, r) => {
567
568
  let t = (0, c.generate)(s._ast, e, r);
568
569
  return e.sourceMaps ? t : t.code;
569
- }, "formatCsf"), be = /* @__PURE__ */ f((s, e = {}) => c.recast.print(s._ast, e), "printCsf"), it = /* @__PURE__ */ f(async (s, e) => {
570
+ }, "formatCsf"), he = /* @__PURE__ */ f((s, e = {}) => c.recast.print(s._ast, e), "printCsf"), st = /* @__PURE__ */ f(async (s, e) => {
570
571
  let r = (await (0, J.readFile)(s, "utf-8")).toString();
571
572
  return Q(r, { ...e, fileName: s });
572
- }, "readCsf"), st = /* @__PURE__ */ f(async (s, e) => {
573
+ }, "readCsf"), nt = /* @__PURE__ */ f(async (s, e) => {
573
574
  if (!(e || s._options.fileName))
574
575
  throw new Error("Please specify a fileName for writeCsf");
575
- await (0, J.writeFile)(e, be(s).code);
576
+ await (0, J.writeFile)(e, he(s).code);
576
577
  }, "writeCsf");
577
578
 
578
579
  // src/csf-tools/ConfigFile.ts
579
- var ee = require("node:fs/promises"), n = require("storybook/internal/babel"), he = z(R(), 1);
580
- var re = console, ie = /* @__PURE__ */ f(({
580
+ var te = require("node:fs/promises"), n = require("storybook/internal/babel"), H = require("storybook/internal/node-logger"), Ee = z(R(), 1);
581
+ var se = /* @__PURE__ */ f(({
581
582
  expectedType: s,
582
583
  foundType: e,
583
584
  node: r
584
- }) => he.dedent`
585
+ }) => Ee.dedent`
585
586
  CSF Parsing error: Expected '${s}' but found '${e}' instead in '${r?.type}'.
586
587
  `, "getCsfParsingErrorMessage"), C = /* @__PURE__ */ f((s) => n.types.isIdentifier(s.key) ? s.key.name : n.types.isStringLiteral(s.key) ?
587
- s.key.value : null, "propKey"), H = /* @__PURE__ */ f((s) => n.types.isTSAsExpression(s) || n.types.isTSSatisfiesExpression(s) ? H(s.expression) :
588
- s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
588
+ s.key.value : null, "propKey"), Y = /* @__PURE__ */ f((s) => n.types.isTSAsExpression(s) || n.types.isTSSatisfiesExpression(s) ? Y(s.expression) :
589
+ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
589
590
  if (s.length === 0)
590
591
  return e;
591
592
  if (n.types.isObjectExpression(e)) {
592
593
  let [r, ...t] = s, i = e.properties.find((o) => C(o) === r);
593
594
  if (i)
594
- return Ee(t, i.value);
595
+ return _e(t, i.value);
595
596
  }
596
- }, "_getPath"), _e = /* @__PURE__ */ f((s, e) => {
597
+ }, "_getPath"), je = /* @__PURE__ */ f((s, e) => {
597
598
  if (s.length === 0) {
598
599
  if (n.types.isObjectExpression(e))
599
600
  return e.properties;
@@ -602,14 +603,14 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
602
603
  if (n.types.isObjectExpression(e)) {
603
604
  let [r, ...t] = s, i = e.properties.find((o) => C(o) === r);
604
605
  if (i)
605
- return t.length === 0 ? e.properties : _e(t, i.value);
606
+ return t.length === 0 ? e.properties : je(t, i.value);
606
607
  }
607
- }, "_getPathProperties"), Y = /* @__PURE__ */ f((s, e) => {
608
+ }, "_getPathProperties"), Z = /* @__PURE__ */ f((s, e) => {
608
609
  let r = null, t = null;
609
610
  return e.body.find((i) => (n.types.isVariableDeclaration(i) ? t = i.declarations : n.types.isExportNamedDeclaration(i) && n.types.isVariableDeclaration(
610
611
  i.declaration) && (t = i.declaration.declarations), t && t.find((o) => n.types.isVariableDeclarator(o) && n.types.isIdentifier(o.id) && o.
611
612
  id.name === s ? (r = o, !0) : !1))), r;
612
- }, "_findVarDeclarator"), F = /* @__PURE__ */ f((s, e) => Y(s, e)?.init, "_findVarInitialization"), B = /* @__PURE__ */ f((s, e) => {
613
+ }, "_findVarDeclarator"), F = /* @__PURE__ */ f((s, e) => Z(s, e)?.init, "_findVarInitialization"), B = /* @__PURE__ */ f((s, e) => {
613
614
  if (s.length === 0)
614
615
  return e;
615
616
  let [r, ...t] = s, i = B(t, e);
@@ -621,7 +622,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
621
622
  o ? n.types.isObjectExpression(o.value) && i.length > 0 ? q(i, e, o.value) : o.value = B(i, e) : r.properties.push(
622
623
  n.types.objectProperty(n.types.identifier(t), B(i, e))
623
624
  );
624
- }, "_updateExportNode"), Z = class {
625
+ }, "_updateExportNode"), ee = class {
625
626
  constructor(e, r, t) {
626
627
  this._exports = {};
627
628
  // FIXME: this is a hack. this is only used in the case where the user is
@@ -650,9 +651,9 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
650
651
  enter({ node: r, parent: t }) {
651
652
  e.hasDefaultExport = !0;
652
653
  let i = n.types.isIdentifier(r.declaration) && n.types.isProgram(t) ? F(r.declaration.name, t) : r.declaration;
653
- i = H(i), n.types.isCallExpression(i) && n.types.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.types.isObjectExpression(
654
- i) ? e._parseExportsObject(i) : re.warn(
655
- ie({
654
+ i = Y(i), n.types.isCallExpression(i) && n.types.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.types.isObjectExpression(
655
+ i) ? e._parseExportsObject(i) : H.logger.warn(
656
+ se({
656
657
  expectedType: "ObjectExpression",
657
658
  foundType: i?.type,
658
659
  node: i || r.declaration
@@ -677,11 +678,11 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
677
678
  }
678
679
  } else r.specifiers ? r.specifiers.forEach((i) => {
679
680
  if (n.types.isExportSpecifier(i) && n.types.isIdentifier(i.local) && n.types.isIdentifier(i.exported)) {
680
- let { name: o } = i.local, { name: a } = i.exported, l = Y(o, t);
681
+ let { name: o } = i.local, { name: a } = i.exported, l = Z(o, t);
681
682
  l && (e._exports[a] = l.init, e._exportDecls[a] = l);
682
683
  }
683
- }) : re.warn(
684
- ie({
684
+ }) : H.logger.warn(
685
+ se({
685
686
  expectedType: "VariableDeclaration",
686
687
  foundType: r.declaration?.type,
687
688
  node: r.declaration
@@ -696,7 +697,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
696
697
  if (n.types.isMemberExpression(i) && n.types.isIdentifier(i.object) && i.object.name === "module" && n.types.isIdentifier(i.property) &&
697
698
  i.property.name === "exports") {
698
699
  let a = o;
699
- n.types.isIdentifier(o) && (a = F(o.name, t)), a = H(a), n.types.isObjectExpression(a) ? (e._exportsObject = a, a.properties.forEach(
700
+ n.types.isIdentifier(o) && (a = F(o.name, t)), a = Y(a), n.types.isObjectExpression(a) ? (e._exportsObject = a, a.properties.forEach(
700
701
  (l) => {
701
702
  let p = C(l);
702
703
  if (p) {
@@ -706,8 +707,8 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
706
707
  t
707
708
  )), e._exports[p] = d;
708
709
  }
709
- })) : re.warn(
710
- ie({
710
+ })) : H.logger.warn(
711
+ se({
711
712
  expectedType: "ObjectExpression",
712
713
  foundType: a?.type,
713
714
  node: a
@@ -728,12 +729,12 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
728
729
  getFieldNode(e) {
729
730
  let [r, ...t] = e, i = this._exports[r];
730
731
  if (i)
731
- return Ee(t, i);
732
+ return _e(t, i);
732
733
  }
733
734
  getFieldProperties(e) {
734
735
  let [r, ...t] = e, i = this._exports[r];
735
736
  if (i)
736
- return _e(t, i);
737
+ return je(t, i);
737
738
  }
738
739
  getFieldValue(e) {
739
740
  let r = this.getFieldNode(e);
@@ -753,7 +754,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
753
754
  if (this._exportsObject) {
754
755
  let p = this._exportsObject.properties.find((d) => C(d) === t);
755
756
  if (p && n.types.isIdentifier(p.value)) {
756
- let d = Y(p.value.name, this._ast.program);
757
+ let d = Z(p.value.name, this._ast.program);
757
758
  if (d && n.types.isObjectExpression(d.init)) {
758
759
  q(i, r, d.init);
759
760
  return;
@@ -766,7 +767,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
766
767
  q(i, r, o);
767
768
  return;
768
769
  }
769
- let a = Y(t, this._ast.program);
770
+ let a = Z(t, this._ast.program);
770
771
  if (a && n.types.isObjectExpression(a.init)) {
771
772
  q(i, r, a.init);
772
773
  return;
@@ -868,7 +869,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
868
869
  }
869
870
  if (n.types.isExportDefaultDeclaration(o)) {
870
871
  let a = o.declaration;
871
- if (n.types.isIdentifier(a) && (a = F(a.name, this._ast.program)), a = H(a), n.types.isObjectExpression(a)) {
872
+ if (n.types.isIdentifier(a) && (a = F(a.name, this._ast.program)), a = Y(a), n.types.isObjectExpression(a)) {
872
873
  let l = a.properties;
873
874
  r(l, e[0]), i = !0;
874
875
  }
@@ -1074,42 +1075,42 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
1074
1075
  )
1075
1076
  ));
1076
1077
  }
1077
- }, je = /* @__PURE__ */ f((s, e) => {
1078
+ }, Se = /* @__PURE__ */ f((s, e) => {
1078
1079
  let r = (0, n.babelParse)(s);
1079
- return new Z(r, s, e);
1080
- }, "loadConfig"), Se = /* @__PURE__ */ f((s) => Pe(s).code, "formatConfig"), Pe = /* @__PURE__ */ f((s, e = {}) => n.recast.print(s._ast, e),
1081
- "printConfig"), nt = /* @__PURE__ */ f(async (s) => {
1082
- let e = (await (0, ee.readFile)(s, "utf-8")).toString();
1083
- return je(e, s).parse();
1084
- }, "readConfig"), ot = /* @__PURE__ */ f(async (s, e) => {
1080
+ return new ee(r, s, e);
1081
+ }, "loadConfig"), Pe = /* @__PURE__ */ f((s) => Oe(s).code, "formatConfig"), Oe = /* @__PURE__ */ f((s, e = {}) => n.recast.print(s._ast, e),
1082
+ "printConfig"), ot = /* @__PURE__ */ f(async (s) => {
1083
+ let e = (await (0, te.readFile)(s, "utf-8")).toString();
1084
+ return Se(e, s).parse();
1085
+ }, "readConfig"), at = /* @__PURE__ */ f(async (s, e) => {
1085
1086
  let r = e || s.fileName;
1086
1087
  if (!r)
1087
1088
  throw new Error("Please specify a fileName for writeConfig");
1088
- await (0, ee.writeFile)(r, Se(s));
1089
- }, "writeConfig"), at = /* @__PURE__ */ f((s) => !!s._ast.program.body.find((r) => n.types.isImportDeclaration(r) && r.source.value.includes(
1089
+ await (0, te.writeFile)(r, Pe(s));
1090
+ }, "writeConfig"), lt = /* @__PURE__ */ f((s) => !!s._ast.program.body.find((r) => n.types.isImportDeclaration(r) && r.source.value.includes(
1090
1091
  "@storybook") && r.specifiers.some((t) => n.types.isImportSpecifier(t) && n.types.isIdentifier(t.imported) && t.imported.name === "definePre\
1091
1092
  view")), "isCsfFactoryPreview");
1092
1093
 
1093
1094
  // src/csf-tools/getStorySortParameter.ts
1094
- var y = require("storybook/internal/babel"), ve = z(R(), 1);
1095
- var lt = console, se = /* @__PURE__ */ f((s, e) => {
1095
+ var y = require("storybook/internal/babel"), De = require("storybook/internal/node-logger"), Ie = z(R(), 1);
1096
+ var ne = /* @__PURE__ */ f((s, e) => {
1096
1097
  let r;
1097
1098
  return s.properties.forEach((t) => {
1098
1099
  y.types.isIdentifier(t.key) && t.key.name === e && (r = t.value);
1099
1100
  }), r;
1100
- }, "getValue"), ne = /* @__PURE__ */ f((s) => {
1101
+ }, "getValue"), oe = /* @__PURE__ */ f((s) => {
1101
1102
  let e = W(s);
1102
1103
  if (y.types.isArrayExpression(e))
1103
- return e.elements.map((r) => ne(r));
1104
+ return e.elements.map((r) => oe(r));
1104
1105
  if (y.types.isObjectExpression(e))
1105
- return e.properties.reduce((r, t) => (y.types.isIdentifier(t.key) && (r[t.key.name] = ne(t.value)), r), {});
1106
+ return e.properties.reduce((r, t) => (y.types.isIdentifier(t.key) && (r[t.key.name] = oe(t.value)), r), {});
1106
1107
  if (y.types.isLiteral(e))
1107
1108
  return e.value;
1108
1109
  if (y.types.isIdentifier(e))
1109
1110
  return T(e.name, !0);
1110
1111
  throw new Error(`Unknown node type ${e.type}`);
1111
1112
  }, "parseValue"), T = /* @__PURE__ */ f((s, e) => {
1112
- let r = ve.dedent`
1113
+ let r = Ie.dedent`
1113
1114
  Unexpected '${s}'. Parameter 'options.storySort' should be defined inline e.g.:
1114
1115
 
1115
1116
  export default {
@@ -1122,24 +1123,24 @@ var lt = console, se = /* @__PURE__ */ f((s, e) => {
1122
1123
  `;
1123
1124
  if (e)
1124
1125
  throw new Error(r);
1125
- lt.info(r);
1126
+ De.logger.log(r);
1126
1127
  }, "unsupported"), W = /* @__PURE__ */ f((s) => y.types.isTSAsExpression(s) || y.types.isTSSatisfiesExpression(s) ? s.expression : s, "strip\
1127
- TSModifiers"), De = /* @__PURE__ */ f((s) => {
1128
+ TSModifiers"), Ne = /* @__PURE__ */ f((s) => {
1128
1129
  let e = W(s);
1129
1130
  if (y.types.isObjectExpression(e)) {
1130
- let r = se(e, "options");
1131
+ let r = ne(e, "options");
1131
1132
  if (r) {
1132
1133
  if (y.types.isObjectExpression(r))
1133
- return se(r, "storySort");
1134
+ return ne(r, "storySort");
1134
1135
  T("options", !0);
1135
1136
  }
1136
1137
  }
1137
- }, "parseParameters"), Oe = /* @__PURE__ */ f((s, e) => {
1138
+ }, "parseParameters"), ve = /* @__PURE__ */ f((s, e) => {
1138
1139
  let r = W(s);
1139
1140
  if (y.types.isObjectExpression(r)) {
1140
- let t = se(r, "parameters");
1141
+ let t = ne(r, "parameters");
1141
1142
  if (y.types.isIdentifier(t) && (t = P(t.name, e)), t)
1142
- return De(t);
1143
+ return Ne(t);
1143
1144
  } else
1144
1145
  T("default", !0);
1145
1146
  }, "parseDefault"), ct = /* @__PURE__ */ f((s) => {
@@ -1154,7 +1155,7 @@ TSModifiers"), De = /* @__PURE__ */ f((s) => {
1154
1155
  let { name: o } = i.id;
1155
1156
  if (o === "parameters" && i.init) {
1156
1157
  let a = W(i.init);
1157
- e = De(a);
1158
+ e = Ne(a);
1158
1159
  }
1159
1160
  }
1160
1161
  }) : t.specifiers.forEach((i) => {
@@ -1166,7 +1167,7 @@ TSModifiers"), De = /* @__PURE__ */ f((s) => {
1166
1167
  enter({ node: t }) {
1167
1168
  let i = t.declaration;
1168
1169
  y.types.isIdentifier(i) && (i = P(i.name, r.program)), i = W(i), y.types.isCallExpression(i) && y.types.isObjectExpression(i.arguments?.[0]) ?
1169
- e = Oe(i.arguments[0], r.program) : y.types.isObjectExpression(i) ? e = Oe(i, r.program) : T("default", !1);
1170
+ e = ve(i.arguments[0], r.program) : y.types.isObjectExpression(i) ? e = ve(i, r.program) : T("default", !1);
1170
1171
  }
1171
1172
  }
1172
1173
  }), !!e) {
@@ -1181,112 +1182,113 @@ TSModifiers"), De = /* @__PURE__ */ f((s) => {
1181
1182
  }`;
1182
1183
  return (0, eval)(o);
1183
1184
  }
1184
- return y.types.isLiteral(e) || y.types.isArrayExpression(e) || y.types.isObjectExpression(e) ? ne(e) : T("storySort", !0);
1185
+ return y.types.isLiteral(e) || y.types.isArrayExpression(e) || y.types.isObjectExpression(e) ? oe(e) : T("storySort", !0);
1185
1186
  }
1186
1187
  }, "getStorySortParameter");
1187
1188
 
1188
1189
  // src/csf-tools/enrichCsf.ts
1189
- var m = require("storybook/internal/babel");
1190
- var Ie = /* @__PURE__ */ f((s, e, r, t) => {
1191
- let i = e.getStoryExport(r), o = m.types.isCallExpression(i) && m.types.isMemberExpression(i.callee) && m.types.isIdentifier(i.callee.object) &&
1192
- i.callee.object.name === "meta", a = !t?.disableSource && Fe(i), l = !t?.disableDescription && oe(e._storyStatements[r]), p = [], d = o ? m.types.
1193
- memberExpression(m.types.identifier(r), m.types.identifier("input")) : m.types.identifier(r), g = m.types.memberExpression(d, m.types.identifier(
1190
+ var u = require("storybook/internal/babel");
1191
+ var we = /* @__PURE__ */ f((s, e, r, t) => {
1192
+ let i = e.getStoryExport(r), o = u.types.isCallExpression(i) && u.types.isMemberExpression(i.callee) && u.types.isIdentifier(i.callee.object) &&
1193
+ i.callee.object.name === "meta", a = !t?.disableSource && Te(i), l = !t?.disableDescription && ae(e._storyStatements[r]), p = [], d = o ? u.types.
1194
+ memberExpression(u.types.identifier(r), u.types.identifier("input")) : u.types.identifier(r), g = u.types.memberExpression(d, u.types.identifier(
1194
1195
  "parameters"));
1195
- p.push(m.types.spreadElement(g));
1196
- let x = m.types.optionalMemberExpression(
1196
+ p.push(u.types.spreadElement(g));
1197
+ let x = u.types.optionalMemberExpression(
1197
1198
  g,
1198
- m.types.identifier("docs"),
1199
+ u.types.identifier("docs"),
1199
1200
  !1,
1200
1201
  !0
1201
1202
  ), h = [];
1202
1203
  if (a) {
1203
- let b = m.types.optionalMemberExpression(
1204
+ let b = u.types.optionalMemberExpression(
1204
1205
  x,
1205
- m.types.identifier("source"),
1206
+ u.types.identifier("source"),
1206
1207
  !1,
1207
1208
  !0
1208
1209
  );
1209
1210
  h.push(
1210
- m.types.objectProperty(
1211
- m.types.identifier("source"),
1212
- m.types.objectExpression([
1213
- m.types.objectProperty(m.types.identifier("originalSource"), m.types.stringLiteral(a)),
1214
- m.types.spreadElement(b)
1211
+ u.types.objectProperty(
1212
+ u.types.identifier("source"),
1213
+ u.types.objectExpression([
1214
+ u.types.objectProperty(u.types.identifier("originalSource"), u.types.stringLiteral(a)),
1215
+ u.types.spreadElement(b)
1215
1216
  ])
1216
1217
  )
1217
1218
  );
1218
1219
  }
1219
1220
  if (l) {
1220
- let b = m.types.optionalMemberExpression(
1221
+ let b = u.types.optionalMemberExpression(
1221
1222
  x,
1222
- m.types.identifier("description"),
1223
+ u.types.identifier("description"),
1223
1224
  !1,
1224
1225
  !0
1225
1226
  );
1226
1227
  h.push(
1227
- m.types.objectProperty(
1228
- m.types.identifier("description"),
1229
- m.types.objectExpression([
1230
- m.types.objectProperty(m.types.identifier("story"), m.types.stringLiteral(l)),
1231
- m.types.spreadElement(b)
1228
+ u.types.objectProperty(
1229
+ u.types.identifier("description"),
1230
+ u.types.objectExpression([
1231
+ u.types.objectProperty(u.types.identifier("story"), u.types.stringLiteral(l)),
1232
+ u.types.spreadElement(b)
1232
1233
  ])
1233
1234
  )
1234
1235
  );
1235
1236
  }
1236
1237
  if (h.length > 0) {
1237
1238
  p.push(
1238
- m.types.objectProperty(
1239
- m.types.identifier("docs"),
1240
- m.types.objectExpression([m.types.spreadElement(x), ...h])
1239
+ u.types.objectProperty(
1240
+ u.types.identifier("docs"),
1241
+ u.types.objectExpression([u.types.spreadElement(x), ...h])
1241
1242
  )
1242
1243
  );
1243
- let b = m.types.expressionStatement(
1244
- m.types.assignmentExpression("=", g, m.types.objectExpression(p))
1244
+ let b = u.types.expressionStatement(
1245
+ u.types.assignmentExpression("=", g, u.types.objectExpression(p))
1245
1246
  );
1246
1247
  s._ast.program.body.push(b);
1247
1248
  }
1248
- }, "enrichCsfStory"), Ne = /* @__PURE__ */ f((s, e, r) => {
1249
+ }, "enrichCsfStory"), Fe = /* @__PURE__ */ f((s, e, r) => {
1249
1250
  if (!e.length) {
1250
1251
  s.properties.find(
1251
- (p) => m.types.isObjectProperty(p) && m.types.isIdentifier(p.key) && p.key.name === "component"
1252
+ (p) => u.types.isObjectProperty(p) && u.types.isIdentifier(p.key) && p.key.name === "component"
1252
1253
  ) || s.properties.unshift(r);
1253
1254
  return;
1254
1255
  }
1255
1256
  let [t, ...i] = e, o = s.properties.find(
1256
- (l) => m.types.isObjectProperty(l) && m.types.isIdentifier(l.key) && l.key.name === t && m.types.isObjectExpression(l.value)
1257
+ (l) => u.types.isObjectProperty(l) && u.types.isIdentifier(l.key) && l.key.name === t && u.types.isObjectExpression(l.value)
1257
1258
  ), a;
1258
- o ? a = o.value : (a = m.types.objectExpression([]), s.properties.push(m.types.objectProperty(m.types.identifier(t), a))), Ne(a, i, r);
1259
- }, "addComponentDescription"), we = /* @__PURE__ */ f((s, e, r) => {
1260
- let t = !r?.disableDescription && oe(e._metaStatement);
1259
+ o ? a = o.value : (a = u.types.objectExpression([]), s.properties.push(u.types.objectProperty(u.types.identifier(t), a))), Fe(a, i, r);
1260
+ }, "addComponentDescription"), Ce = /* @__PURE__ */ f((s, e, r) => {
1261
+ let t = !r?.disableDescription && ae(e._metaStatement);
1261
1262
  if (t) {
1262
1263
  let i = s._metaNode;
1263
- i && m.types.isObjectExpression(i) && Ne(
1264
+ i && u.types.isObjectExpression(i) && Fe(
1264
1265
  i,
1265
1266
  ["parameters", "docs", "description"],
1266
- m.types.objectProperty(m.types.identifier("component"), m.types.stringLiteral(t))
1267
+ u.types.objectProperty(u.types.identifier("component"), u.types.stringLiteral(t))
1267
1268
  );
1268
1269
  }
1269
1270
  }, "enrichCsfMeta"), pt = /* @__PURE__ */ f((s, e, r) => {
1270
- we(s, e, r), Object.keys(s._storyExports).forEach((t) => {
1271
- Ie(s, e, t, r);
1271
+ Ce(s, e, r), Object.keys(s._storyExports).forEach((t) => {
1272
+ we(s, e, t, r);
1272
1273
  });
1273
- }, "enrichCsf"), Fe = /* @__PURE__ */ f((s) => {
1274
- let e = m.types.isVariableDeclarator(s) ? s.init : s, { code: r } = (0, m.generate)(e, {});
1274
+ }, "enrichCsf"), Te = /* @__PURE__ */ f((s) => {
1275
+ let e = u.types.isVariableDeclarator(s) ? s.init : s, { code: r } = (0, u.generate)(e, {});
1275
1276
  return r;
1276
- }, "extractSource"), oe = /* @__PURE__ */ f((s) => s?.leadingComments ? s.leadingComments.map((r) => r.type === "CommentLine" || !r.value.startsWith(
1277
+ }, "extractSource"), ae = /* @__PURE__ */ f((s) => s?.leadingComments ? s.leadingComments.map((r) => r.type === "CommentLine" || !r.value.startsWith(
1277
1278
  "*") ? null : r.value.split(`
1278
1279
  `).map((t) => t.replace(/^(\s+)?(\*+)?(\s)?/, "")).join(`
1279
1280
  `).trim()).filter(Boolean).join(`
1280
1281
  `) : "", "extractDescription");
1281
1282
 
1282
1283
  // src/csf-tools/index.ts
1283
- var Ae = require("storybook/internal/babel");
1284
+ var $e = require("storybook/internal/babel");
1284
1285
 
1285
1286
  // src/csf-tools/vitest-plugin/transformer.ts
1286
- var u = require("storybook/internal/babel"), Te = require("storybook/internal/common"), ke = require("storybook/internal/csf"), ae = z(R(), 1);
1287
- var Ce = console, ft = /* @__PURE__ */ f((s, e) => !(e.include.length && !e.include.some((r) => s?.includes(r)) || e.exclude.some((r) => s?.
1288
- includes(r))), "isValidTest");
1289
- async function Ve({
1287
+ var m = require("storybook/internal/babel"), ke = require("storybook/internal/common"), Ve = require("storybook/internal/csf"), le = require("storybook/internal/node-logger"),
1288
+ ce = z(R(), 1);
1289
+ var ft = /* @__PURE__ */ f((s, e) => !(e.include.length && !e.include.some((r) => s?.includes(r)) || e.exclude.some((r) => s?.includes(r))),
1290
+ "isValidTest");
1291
+ async function Ae({
1290
1292
  code: s,
1291
1293
  fileName: e,
1292
1294
  configDir: r,
@@ -1300,23 +1302,23 @@ async function Ve({
1300
1302
  fileName: e,
1301
1303
  transformInlineMeta: !0,
1302
1304
  makeTitle: /* @__PURE__ */ f((_) => {
1303
- let S = (0, Te.getStoryTitle)({
1305
+ let S = (0, ke.getStoryTitle)({
1304
1306
  storyFilePath: e,
1305
1307
  configDir: r,
1306
1308
  stories: t,
1307
1309
  userTitle: _
1308
1310
  }) || "unknown";
1309
- return S === "unknown" && Ce.warn(
1310
- ae.dedent`
1311
+ return S === "unknown" && le.logger.warn(
1312
+ ce.dedent`
1311
1313
  [Storybook]: Could not calculate story title for "${e}".
1312
1314
  Please make sure that this file matches the globs included in the "stories" field in your Storybook configuration at "${r}".
1313
1315
  `
1314
1316
  ), S;
1315
1317
  }, "makeTitle")
1316
1318
  }).parse(), p = l._ast, d = l._metaVariableName, g = l._metaNode, x = g.properties.find(
1317
- (_) => u.types.isObjectProperty(_) && u.types.isIdentifier(_.key) && _.key.name === "title"
1318
- ), h = u.types.stringLiteral(l._meta?.title || "unknown");
1319
- if (x ? u.types.isObjectProperty(x) && (x.value = h) : g.properties.push(u.types.objectProperty(u.types.identifier("title"), h)), !g || !l.
1319
+ (_) => m.types.isObjectProperty(_) && m.types.isIdentifier(_.key) && _.key.name === "title"
1320
+ ), h = m.types.stringLiteral(l._meta?.title || "unknown");
1321
+ if (x ? m.types.isObjectProperty(x) && (x.value = h) : g.properties.push(m.types.objectProperty(m.types.identifier("title"), h)), !g || !l.
1320
1322
  _meta)
1321
1323
  throw new Error(
1322
1324
  `The Storybook vitest plugin could not detect the meta (default export) object in the story file.
@@ -1326,7 +1328,7 @@ le an issue with details about your use case.`
1326
1328
  );
1327
1329
  let b = {};
1328
1330
  Object.keys(l._stories).map((_) => {
1329
- let S = (0, ke.combineTags)(
1331
+ let S = (0, Ve.combineTags)(
1330
1332
  "test",
1331
1333
  "dev",
1332
1334
  ...o,
@@ -1337,79 +1339,79 @@ le an issue with details about your use case.`
1337
1339
  });
1338
1340
  let E = l._file.path.scope.generateUidIdentifier("test"), I = l._file.path.scope.generateUidIdentifier("describe");
1339
1341
  if (Object.keys(b).length === 0) {
1340
- let _ = u.types.expressionStatement(
1341
- u.types.callExpression(u.types.memberExpression(I, u.types.identifier("skip")), [
1342
- u.types.stringLiteral("No valid tests found")
1342
+ let _ = m.types.expressionStatement(
1343
+ m.types.callExpression(m.types.memberExpression(I, m.types.identifier("skip")), [
1344
+ m.types.stringLiteral("No valid tests found")
1343
1345
  ])
1344
1346
  );
1345
1347
  p.program.body.push(_);
1346
1348
  let S = [
1347
- u.types.importDeclaration(
1349
+ m.types.importDeclaration(
1348
1350
  [
1349
- u.types.importSpecifier(E, u.types.identifier("test")),
1350
- u.types.importSpecifier(I, u.types.identifier("describe"))
1351
+ m.types.importSpecifier(E, m.types.identifier("test")),
1352
+ m.types.importSpecifier(I, m.types.identifier("describe"))
1351
1353
  ],
1352
- u.types.stringLiteral("vitest")
1354
+ m.types.stringLiteral("vitest")
1353
1355
  )
1354
1356
  ];
1355
1357
  p.program.body.unshift(...S);
1356
1358
  } else {
1357
- let le = function() {
1358
- let j = l._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), N = u.types.memberExpression(
1359
- u.types.callExpression(u.types.memberExpression(_, u.types.identifier("getState")), []),
1360
- u.types.identifier("testPath")
1361
- ), k = u.types.memberExpression(
1362
- u.types.memberExpression(u.types.identifier("globalThis"), u.types.identifier("__vitest_worker__")),
1363
- u.types.identifier("filepath")
1364
- ), V = u.types.logicalExpression(
1359
+ let pe = function() {
1360
+ let j = l._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), N = m.types.memberExpression(
1361
+ m.types.callExpression(m.types.memberExpression(_, m.types.identifier("getState")), []),
1362
+ m.types.identifier("testPath")
1363
+ ), k = m.types.memberExpression(
1364
+ m.types.memberExpression(m.types.identifier("globalThis"), m.types.identifier("__vitest_worker__")),
1365
+ m.types.identifier("filepath")
1366
+ ), V = m.types.logicalExpression(
1365
1367
  "??",
1366
1368
  // TODO: switch order of testPathProperty and filePathProperty when the bug is fixed
1367
1369
  // https://github.com/vitest-dev/vitest/issues/6367 (or probably just use testPathProperty)
1368
1370
  k,
1369
1371
  N
1370
- ), G = u.types.callExpression(
1371
- u.types.memberExpression(
1372
- u.types.callExpression(u.types.identifier("convertToFilePath"), [
1373
- u.types.memberExpression(
1374
- u.types.memberExpression(u.types.identifier("import"), u.types.identifier("meta")),
1375
- u.types.identifier("url")
1372
+ ), G = m.types.callExpression(
1373
+ m.types.memberExpression(
1374
+ m.types.callExpression(m.types.identifier("convertToFilePath"), [
1375
+ m.types.memberExpression(
1376
+ m.types.memberExpression(m.types.identifier("import"), m.types.identifier("meta")),
1377
+ m.types.identifier("url")
1376
1378
  )
1377
1379
  ]),
1378
- u.types.identifier("includes")
1380
+ m.types.identifier("includes")
1379
1381
  ),
1380
1382
  [V]
1381
1383
  );
1382
- return { isRunningFromThisFileDeclaration: u.types.variableDeclaration("const", [
1383
- u.types.variableDeclarator(j, G)
1384
+ return { isRunningFromThisFileDeclaration: m.types.variableDeclaration("const", [
1385
+ m.types.variableDeclarator(j, G)
1384
1386
  ]), isRunningFromThisFileId: j };
1385
1387
  };
1386
- var ut = le;
1387
- f(le, "getTestGuardDeclaration");
1388
- let _ = l._file.path.scope.generateUidIdentifier("expect"), S = l._file.path.scope.generateUidIdentifier("testStory"), $e = u.types.identifier(
1389
- JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Re, isRunningFromThisFileId: Le } = le();
1390
- p.program.body.push(Re);
1391
- let Me = /* @__PURE__ */ f(({
1388
+ var mt = pe;
1389
+ f(pe, "getTestGuardDeclaration");
1390
+ let _ = l._file.path.scope.generateUidIdentifier("expect"), S = l._file.path.scope.generateUidIdentifier("testStory"), Re = m.types.identifier(
1391
+ JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Le, isRunningFromThisFileId: Me } = pe();
1392
+ p.program.body.push(Le);
1393
+ let Ue = /* @__PURE__ */ f(({
1392
1394
  localName: j,
1393
1395
  exportName: N,
1394
1396
  testTitle: k,
1395
1397
  node: V
1396
1398
  }) => {
1397
- let G = u.types.expressionStatement(
1398
- u.types.callExpression(E, [
1399
- u.types.stringLiteral(k),
1400
- u.types.callExpression(S, [
1401
- u.types.stringLiteral(N),
1402
- u.types.identifier(j),
1403
- u.types.identifier(d),
1404
- $e
1399
+ let G = m.types.expressionStatement(
1400
+ m.types.callExpression(E, [
1401
+ m.types.stringLiteral(k),
1402
+ m.types.callExpression(S, [
1403
+ m.types.stringLiteral(N),
1404
+ m.types.identifier(j),
1405
+ m.types.identifier(d),
1406
+ Re
1405
1407
  ])
1406
1408
  ])
1407
1409
  );
1408
1410
  return G.loc = V.loc, G;
1409
- }, "getTestStatementForStory"), Ue = Object.entries(b).map(([j, N]) => {
1411
+ }, "getTestStatementForStory"), qe = Object.entries(b).map(([j, N]) => {
1410
1412
  if (N === null) {
1411
- Ce.warn(
1412
- ae.dedent`
1413
+ le.logger.warn(
1414
+ ce.dedent`
1413
1415
  [Storybook]: Could not transform "${j}" story into test at "${e}".
1414
1416
  Please make sure to define stories in the same file and not re-export stories coming from other files".
1415
1417
  `
@@ -1417,27 +1419,27 @@ le an issue with details about your use case.`
1417
1419
  return;
1418
1420
  }
1419
1421
  let k = l._stories[j].localName ?? j, V = l._stories[j].name ?? j;
1420
- return Me({ testTitle: V, localName: k, exportName: j, node: N });
1421
- }).filter((j) => !!j), qe = u.types.ifStatement(Le, u.types.blockStatement(Ue));
1422
- p.program.body.push(qe);
1423
- let Be = [
1424
- u.types.importDeclaration(
1422
+ return Ue({ testTitle: V, localName: k, exportName: j, node: N });
1423
+ }).filter((j) => !!j), Be = m.types.ifStatement(Me, m.types.blockStatement(qe));
1424
+ p.program.body.push(Be);
1425
+ let We = [
1426
+ m.types.importDeclaration(
1425
1427
  [
1426
- u.types.importSpecifier(E, u.types.identifier("test")),
1427
- u.types.importSpecifier(_, u.types.identifier("expect"))
1428
+ m.types.importSpecifier(E, m.types.identifier("test")),
1429
+ m.types.importSpecifier(_, m.types.identifier("expect"))
1428
1430
  ],
1429
- u.types.stringLiteral("vitest")
1431
+ m.types.stringLiteral("vitest")
1430
1432
  ),
1431
- u.types.importDeclaration(
1433
+ m.types.importDeclaration(
1432
1434
  [
1433
- u.types.importSpecifier(S, u.types.identifier("testStory")),
1434
- u.types.importSpecifier(u.types.identifier("convertToFilePath"), u.types.identifier("convertToFilePath"))
1435
+ m.types.importSpecifier(S, m.types.identifier("testStory")),
1436
+ m.types.importSpecifier(m.types.identifier("convertToFilePath"), m.types.identifier("convertToFilePath"))
1435
1437
  ],
1436
- u.types.stringLiteral("@storybook/addon-vitest/internal/test-utils")
1438
+ m.types.stringLiteral("@storybook/addon-vitest/internal/test-utils")
1437
1439
  )
1438
1440
  ];
1439
- p.program.body.unshift(...Be);
1441
+ p.program.body.unshift(...We);
1440
1442
  }
1441
- return te(l, { sourceMaps: !0, sourceFileName: e }, s);
1443
+ return ie(l, { sourceMaps: !0, sourceFileName: e }, s);
1442
1444
  }
1443
- f(Ve, "vitestTransform");
1445
+ f(Ae, "vitestTransform");