storybook 9.1.0-alpha.5 → 9.1.0-alpha.6

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 (39) hide show
  1. package/dist/bin/index.cjs +62 -69
  2. package/dist/bin/index.js +43 -50
  3. package/dist/cli/bin/index.cjs +604 -604
  4. package/dist/cli/bin/index.js +151 -150
  5. package/dist/cli/index.cjs +13787 -13796
  6. package/dist/cli/index.d.ts +706 -15
  7. package/dist/cli/index.js +12363 -12371
  8. package/dist/common/index.cjs +13481 -13382
  9. package/dist/common/index.d.ts +341 -72
  10. package/dist/common/index.js +24018 -23916
  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/controls/preview.cjs +14 -14
  15. package/dist/controls/preview.d.ts +1 -1
  16. package/dist/controls/preview.js +2 -2
  17. package/dist/core-server/index.cjs +4838 -4791
  18. package/dist/core-server/index.d.ts +10 -1
  19. package/dist/core-server/index.js +5746 -5699
  20. package/dist/core-server/presets/common-manager.js +46 -32
  21. package/dist/core-server/presets/common-preset.cjs +1047 -1045
  22. package/dist/core-server/presets/common-preset.js +2053 -2048
  23. package/dist/csf/index.d.ts +2 -1
  24. package/dist/csf-tools/index.cjs +226 -224
  25. package/dist/csf-tools/index.js +116 -112
  26. package/dist/manager/globals-runtime.js +6 -4
  27. package/dist/manager-api/index.cjs +73 -73
  28. package/dist/manager-api/index.js +140 -140
  29. package/dist/node-logger/index.cjs +8520 -994
  30. package/dist/node-logger/index.d.ts +395 -2
  31. package/dist/node-logger/index.js +8535 -995
  32. package/dist/server-errors.cjs +201 -242
  33. package/dist/server-errors.d.ts +1 -12
  34. package/dist/server-errors.js +182 -223
  35. package/dist/telemetry/index.cjs +1326 -1325
  36. package/dist/telemetry/index.d.ts +3 -2
  37. package/dist/telemetry/index.js +1217 -1214
  38. package/dist/types/index.d.ts +3 -3
  39. package/package.json +18 -9
@@ -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;
@@ -391,7 +392,7 @@ var D = /* @__PURE__ */ f((s, e) => {
391
392
  else if (b.key.name === "name" && c.types.isStringLiteral(b.value))
392
393
  g = b.value.value;
393
394
  else if (b.key.name === "storyName" && c.types.isStringLiteral(b.value))
394
- fe.warn(
395
+ re.logger.warn(
395
396
  `Unexpected usage of "storyName" in "${d}". Please use "name" instead.`
396
397
  );
397
398
  else if (b.key.name === "parameters" && c.types.isObjectExpression(b.value)) {
@@ -466,7 +467,7 @@ var D = /* @__PURE__ */ f((s, e) => {
466
467
  i.arguments.length > 0) {
467
468
  let l = t.scope.getBinding(o.object.name)?.path?.parentPath?.node;
468
469
  if (c.types.isImportDeclaration(l))
469
- if (ge(l.source.value)) {
470
+ if (xe(l.source.value)) {
470
471
  let p = i.arguments[0];
471
472
  e._metaVariableName = o.property.name, e._metaIsFactory = !0, e._parseMeta(p, e._ast.program);
472
473
  } else
@@ -501,7 +502,7 @@ var D = /* @__PURE__ */ f((s, e) => {
501
502
  let d = e._storyAnnotations[i], { tags: g, play: x } = d;
502
503
  if (g) {
503
504
  let E = c.types.isIdentifier(g) ? P(g.name, this._ast.program) : g;
504
- t[i].tags = de(E);
505
+ t[i].tags = me(E);
505
506
  }
506
507
  x && (t[i].tags = [...t[i].tags || [], "play-fn"]);
507
508
  let h = t[i].__stats;
@@ -509,15 +510,15 @@ var D = /* @__PURE__ */ f((s, e) => {
509
510
  h[E] = !!d[E] || !!e._metaAnnotations[E];
510
511
  });
511
512
  let b = e.getStoryExport(i);
512
- return h.storyFn = !!(c.types.isArrowFunctionExpression(b) || c.types.isFunctionDeclaration(b)), h.mount = tt(d.play ?? e._metaAnnotations.
513
- play), h.moduleMock = !!e.imports.find((E) => xe(E)), t;
513
+ return h.storyFn = !!(c.types.isArrowFunctionExpression(b) || c.types.isFunctionDeclaration(b)), h.mount = rt(d.play ?? e._metaAnnotations.
514
+ play), h.moduleMock = !!e.imports.find((E) => ye(E)), t;
514
515
  },
515
516
  {}
516
517
  ), Object.keys(e._storyExports).forEach((t) => {
517
518
  (0, v.isExportStory)(t, e._meta) || (delete e._storyExports[t], delete e._storyAnnotations[t], delete e._storyStatements[t]);
518
519
  }), e._namedExportsOrder) {
519
520
  let t = Object.keys(e._storyExports);
520
- e._storyExports = me(e._storyExports, e._namedExportsOrder), e._stories = me(e._stories, e._namedExportsOrder);
521
+ e._storyExports = ge(e._storyExports, e._namedExportsOrder), e._stories = ge(e._stories, e._namedExportsOrder);
521
522
  let i = Object.keys(e._storyExports);
522
523
  if (t.length !== i.length)
523
524
  throw new Error(
@@ -557,44 +558,44 @@ var D = /* @__PURE__ */ f((s, e) => {
557
558
  };
558
559
  });
559
560
  }
560
- }, ye = /* @__PURE__ */ f(({
561
+ }, be = /* @__PURE__ */ f(({
561
562
  code: s,
562
563
  filename: e = "",
563
564
  ast: r
564
565
  }) => new c.BabelFileClass({ filename: e }, { code: s, ast: r ?? (0, c.babelParse)(s) }), "babelParseFile"), Q = /* @__PURE__ */ f((s, e) => {
565
- let r = (0, c.babelParse)(s), t = ye({ code: s, filename: e.fileName, ast: r });
566
+ let r = (0, c.babelParse)(s), t = be({ code: s, filename: e.fileName, ast: r });
566
567
  return new K(r, e, t);
567
- }, "loadCsf"), te = /* @__PURE__ */ f((s, e = { sourceMaps: !1 }, r) => {
568
+ }, "loadCsf"), ie = /* @__PURE__ */ f((s, e = { sourceMaps: !1 }, r) => {
568
569
  let t = (0, c.generate)(s._ast, e, r);
569
570
  return e.sourceMaps ? t : t.code;
570
- }, "formatCsf"), be = /* @__PURE__ */ f((s, e = {}) => c.recast.print(s._ast, e), "printCsf"), it = /* @__PURE__ */ f(async (s, e) => {
571
+ }, "formatCsf"), he = /* @__PURE__ */ f((s, e = {}) => c.recast.print(s._ast, e), "printCsf"), st = /* @__PURE__ */ f(async (s, e) => {
571
572
  let r = (await (0, J.readFile)(s, "utf-8")).toString();
572
573
  return Q(r, { ...e, fileName: s });
573
- }, "readCsf"), st = /* @__PURE__ */ f(async (s, e) => {
574
+ }, "readCsf"), nt = /* @__PURE__ */ f(async (s, e) => {
574
575
  if (!(e || s._options.fileName))
575
576
  throw new Error("Please specify a fileName for writeCsf");
576
- await (0, J.writeFile)(e, be(s).code);
577
+ await (0, J.writeFile)(e, he(s).code);
577
578
  }, "writeCsf");
578
579
 
579
580
  // src/csf-tools/ConfigFile.ts
580
- var ee = require("node:fs/promises"), n = require("storybook/internal/babel"), he = z(R(), 1);
581
- var re = console, ie = /* @__PURE__ */ f(({
581
+ var te = require("node:fs/promises"), n = require("storybook/internal/babel"), H = require("storybook/internal/node-logger"), Ee = z(R(), 1);
582
+ var se = /* @__PURE__ */ f(({
582
583
  expectedType: s,
583
584
  foundType: e,
584
585
  node: r
585
- }) => he.dedent`
586
+ }) => Ee.dedent`
586
587
  CSF Parsing error: Expected '${s}' but found '${e}' instead in '${r?.type}'.
587
588
  `, "getCsfParsingErrorMessage"), C = /* @__PURE__ */ f((s) => n.types.isIdentifier(s.key) ? s.key.name : n.types.isStringLiteral(s.key) ?
588
- s.key.value : null, "propKey"), H = /* @__PURE__ */ f((s) => n.types.isTSAsExpression(s) || n.types.isTSSatisfiesExpression(s) ? H(s.expression) :
589
- s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
589
+ s.key.value : null, "propKey"), Y = /* @__PURE__ */ f((s) => n.types.isTSAsExpression(s) || n.types.isTSSatisfiesExpression(s) ? Y(s.expression) :
590
+ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
590
591
  if (s.length === 0)
591
592
  return e;
592
593
  if (n.types.isObjectExpression(e)) {
593
594
  let [r, ...t] = s, i = e.properties.find((o) => C(o) === r);
594
595
  if (i)
595
- return Ee(t, i.value);
596
+ return _e(t, i.value);
596
597
  }
597
- }, "_getPath"), _e = /* @__PURE__ */ f((s, e) => {
598
+ }, "_getPath"), je = /* @__PURE__ */ f((s, e) => {
598
599
  if (s.length === 0) {
599
600
  if (n.types.isObjectExpression(e))
600
601
  return e.properties;
@@ -603,14 +604,14 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
603
604
  if (n.types.isObjectExpression(e)) {
604
605
  let [r, ...t] = s, i = e.properties.find((o) => C(o) === r);
605
606
  if (i)
606
- return t.length === 0 ? e.properties : _e(t, i.value);
607
+ return t.length === 0 ? e.properties : je(t, i.value);
607
608
  }
608
- }, "_getPathProperties"), Y = /* @__PURE__ */ f((s, e) => {
609
+ }, "_getPathProperties"), Z = /* @__PURE__ */ f((s, e) => {
609
610
  let r = null, t = null;
610
611
  return e.body.find((i) => (n.types.isVariableDeclaration(i) ? t = i.declarations : n.types.isExportNamedDeclaration(i) && n.types.isVariableDeclaration(
611
612
  i.declaration) && (t = i.declaration.declarations), t && t.find((o) => n.types.isVariableDeclarator(o) && n.types.isIdentifier(o.id) && o.
612
613
  id.name === s ? (r = o, !0) : !1))), r;
613
- }, "_findVarDeclarator"), F = /* @__PURE__ */ f((s, e) => Y(s, e)?.init, "_findVarInitialization"), B = /* @__PURE__ */ f((s, e) => {
614
+ }, "_findVarDeclarator"), F = /* @__PURE__ */ f((s, e) => Z(s, e)?.init, "_findVarInitialization"), B = /* @__PURE__ */ f((s, e) => {
614
615
  if (s.length === 0)
615
616
  return e;
616
617
  let [r, ...t] = s, i = B(t, e);
@@ -622,7 +623,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
622
623
  o ? n.types.isObjectExpression(o.value) && i.length > 0 ? q(i, e, o.value) : o.value = B(i, e) : r.properties.push(
623
624
  n.types.objectProperty(n.types.identifier(t), B(i, e))
624
625
  );
625
- }, "_updateExportNode"), Z = class {
626
+ }, "_updateExportNode"), ee = class {
626
627
  constructor(e, r, t) {
627
628
  this._exports = {};
628
629
  // FIXME: this is a hack. this is only used in the case where the user is
@@ -651,9 +652,9 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
651
652
  enter({ node: r, parent: t }) {
652
653
  e.hasDefaultExport = !0;
653
654
  let i = n.types.isIdentifier(r.declaration) && n.types.isProgram(t) ? F(r.declaration.name, t) : r.declaration;
654
- i = H(i), n.types.isCallExpression(i) && n.types.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.types.isObjectExpression(
655
- i) ? e._parseExportsObject(i) : re.warn(
656
- ie({
655
+ i = Y(i), n.types.isCallExpression(i) && n.types.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.types.isObjectExpression(
656
+ i) ? e._parseExportsObject(i) : H.logger.warn(
657
+ se({
657
658
  expectedType: "ObjectExpression",
658
659
  foundType: i?.type,
659
660
  node: i || r.declaration
@@ -678,11 +679,11 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
678
679
  }
679
680
  } else r.specifiers ? r.specifiers.forEach((i) => {
680
681
  if (n.types.isExportSpecifier(i) && n.types.isIdentifier(i.local) && n.types.isIdentifier(i.exported)) {
681
- let { name: o } = i.local, { name: a } = i.exported, l = Y(o, t);
682
+ let { name: o } = i.local, { name: a } = i.exported, l = Z(o, t);
682
683
  l && (e._exports[a] = l.init, e._exportDecls[a] = l);
683
684
  }
684
- }) : re.warn(
685
- ie({
685
+ }) : H.logger.warn(
686
+ se({
686
687
  expectedType: "VariableDeclaration",
687
688
  foundType: r.declaration?.type,
688
689
  node: r.declaration
@@ -697,7 +698,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
697
698
  if (n.types.isMemberExpression(i) && n.types.isIdentifier(i.object) && i.object.name === "module" && n.types.isIdentifier(i.property) &&
698
699
  i.property.name === "exports") {
699
700
  let a = o;
700
- n.types.isIdentifier(o) && (a = F(o.name, t)), a = H(a), n.types.isObjectExpression(a) ? (e._exportsObject = a, a.properties.forEach(
701
+ n.types.isIdentifier(o) && (a = F(o.name, t)), a = Y(a), n.types.isObjectExpression(a) ? (e._exportsObject = a, a.properties.forEach(
701
702
  (l) => {
702
703
  let p = C(l);
703
704
  if (p) {
@@ -707,8 +708,8 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
707
708
  t
708
709
  )), e._exports[p] = d;
709
710
  }
710
- })) : re.warn(
711
- ie({
711
+ })) : H.logger.warn(
712
+ se({
712
713
  expectedType: "ObjectExpression",
713
714
  foundType: a?.type,
714
715
  node: a
@@ -729,12 +730,12 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
729
730
  getFieldNode(e) {
730
731
  let [r, ...t] = e, i = this._exports[r];
731
732
  if (i)
732
- return Ee(t, i);
733
+ return _e(t, i);
733
734
  }
734
735
  getFieldProperties(e) {
735
736
  let [r, ...t] = e, i = this._exports[r];
736
737
  if (i)
737
- return _e(t, i);
738
+ return je(t, i);
738
739
  }
739
740
  getFieldValue(e) {
740
741
  let r = this.getFieldNode(e);
@@ -754,7 +755,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
754
755
  if (this._exportsObject) {
755
756
  let p = this._exportsObject.properties.find((d) => C(d) === t);
756
757
  if (p && n.types.isIdentifier(p.value)) {
757
- let d = Y(p.value.name, this._ast.program);
758
+ let d = Z(p.value.name, this._ast.program);
758
759
  if (d && n.types.isObjectExpression(d.init)) {
759
760
  q(i, r, d.init);
760
761
  return;
@@ -767,7 +768,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
767
768
  q(i, r, o);
768
769
  return;
769
770
  }
770
- let a = Y(t, this._ast.program);
771
+ let a = Z(t, this._ast.program);
771
772
  if (a && n.types.isObjectExpression(a.init)) {
772
773
  q(i, r, a.init);
773
774
  return;
@@ -869,7 +870,7 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
869
870
  }
870
871
  if (n.types.isExportDefaultDeclaration(o)) {
871
872
  let a = o.declaration;
872
- if (n.types.isIdentifier(a) && (a = F(a.name, this._ast.program)), a = H(a), n.types.isObjectExpression(a)) {
873
+ if (n.types.isIdentifier(a) && (a = F(a.name, this._ast.program)), a = Y(a), n.types.isObjectExpression(a)) {
873
874
  let l = a.properties;
874
875
  r(l, e[0]), i = !0;
875
876
  }
@@ -1075,42 +1076,42 @@ s, "unwrap"), Ee = /* @__PURE__ */ f((s, e) => {
1075
1076
  )
1076
1077
  ));
1077
1078
  }
1078
- }, je = /* @__PURE__ */ f((s, e) => {
1079
+ }, Se = /* @__PURE__ */ f((s, e) => {
1079
1080
  let r = (0, n.babelParse)(s);
1080
- return new Z(r, s, e);
1081
- }, "loadConfig"), Se = /* @__PURE__ */ f((s) => Pe(s).code, "formatConfig"), Pe = /* @__PURE__ */ f((s, e = {}) => n.recast.print(s._ast, e),
1082
- "printConfig"), nt = /* @__PURE__ */ f(async (s) => {
1083
- let e = (await (0, ee.readFile)(s, "utf-8")).toString();
1084
- return je(e, s).parse();
1085
- }, "readConfig"), ot = /* @__PURE__ */ f(async (s, e) => {
1081
+ return new ee(r, s, e);
1082
+ }, "loadConfig"), Pe = /* @__PURE__ */ f((s) => Oe(s).code, "formatConfig"), Oe = /* @__PURE__ */ f((s, e = {}) => n.recast.print(s._ast, e),
1083
+ "printConfig"), ot = /* @__PURE__ */ f(async (s) => {
1084
+ let e = (await (0, te.readFile)(s, "utf-8")).toString();
1085
+ return Se(e, s).parse();
1086
+ }, "readConfig"), at = /* @__PURE__ */ f(async (s, e) => {
1086
1087
  let r = e || s.fileName;
1087
1088
  if (!r)
1088
1089
  throw new Error("Please specify a fileName for writeConfig");
1089
- await (0, ee.writeFile)(r, Se(s));
1090
- }, "writeConfig"), at = /* @__PURE__ */ f((s) => !!s._ast.program.body.find((r) => n.types.isImportDeclaration(r) && r.source.value.includes(
1090
+ await (0, te.writeFile)(r, Pe(s));
1091
+ }, "writeConfig"), lt = /* @__PURE__ */ f((s) => !!s._ast.program.body.find((r) => n.types.isImportDeclaration(r) && r.source.value.includes(
1091
1092
  "@storybook") && r.specifiers.some((t) => n.types.isImportSpecifier(t) && n.types.isIdentifier(t.imported) && t.imported.name === "definePre\
1092
1093
  view")), "isCsfFactoryPreview");
1093
1094
 
1094
1095
  // src/csf-tools/getStorySortParameter.ts
1095
- var y = require("storybook/internal/babel"), ve = z(R(), 1);
1096
- var lt = console, se = /* @__PURE__ */ f((s, e) => {
1096
+ var y = require("storybook/internal/babel"), De = require("storybook/internal/node-logger"), Ie = z(R(), 1);
1097
+ var ne = /* @__PURE__ */ f((s, e) => {
1097
1098
  let r;
1098
1099
  return s.properties.forEach((t) => {
1099
1100
  y.types.isIdentifier(t.key) && t.key.name === e && (r = t.value);
1100
1101
  }), r;
1101
- }, "getValue"), ne = /* @__PURE__ */ f((s) => {
1102
+ }, "getValue"), oe = /* @__PURE__ */ f((s) => {
1102
1103
  let e = W(s);
1103
1104
  if (y.types.isArrayExpression(e))
1104
- return e.elements.map((r) => ne(r));
1105
+ return e.elements.map((r) => oe(r));
1105
1106
  if (y.types.isObjectExpression(e))
1106
- return e.properties.reduce((r, t) => (y.types.isIdentifier(t.key) && (r[t.key.name] = ne(t.value)), r), {});
1107
+ return e.properties.reduce((r, t) => (y.types.isIdentifier(t.key) && (r[t.key.name] = oe(t.value)), r), {});
1107
1108
  if (y.types.isLiteral(e))
1108
1109
  return e.value;
1109
1110
  if (y.types.isIdentifier(e))
1110
1111
  return T(e.name, !0);
1111
1112
  throw new Error(`Unknown node type ${e.type}`);
1112
1113
  }, "parseValue"), T = /* @__PURE__ */ f((s, e) => {
1113
- let r = ve.dedent`
1114
+ let r = Ie.dedent`
1114
1115
  Unexpected '${s}'. Parameter 'options.storySort' should be defined inline e.g.:
1115
1116
 
1116
1117
  export default {
@@ -1123,24 +1124,24 @@ var lt = console, se = /* @__PURE__ */ f((s, e) => {
1123
1124
  `;
1124
1125
  if (e)
1125
1126
  throw new Error(r);
1126
- lt.info(r);
1127
+ De.logger.log(r);
1127
1128
  }, "unsupported"), W = /* @__PURE__ */ f((s) => y.types.isTSAsExpression(s) || y.types.isTSSatisfiesExpression(s) ? s.expression : s, "strip\
1128
- TSModifiers"), De = /* @__PURE__ */ f((s) => {
1129
+ TSModifiers"), Ne = /* @__PURE__ */ f((s) => {
1129
1130
  let e = W(s);
1130
1131
  if (y.types.isObjectExpression(e)) {
1131
- let r = se(e, "options");
1132
+ let r = ne(e, "options");
1132
1133
  if (r) {
1133
1134
  if (y.types.isObjectExpression(r))
1134
- return se(r, "storySort");
1135
+ return ne(r, "storySort");
1135
1136
  T("options", !0);
1136
1137
  }
1137
1138
  }
1138
- }, "parseParameters"), Oe = /* @__PURE__ */ f((s, e) => {
1139
+ }, "parseParameters"), ve = /* @__PURE__ */ f((s, e) => {
1139
1140
  let r = W(s);
1140
1141
  if (y.types.isObjectExpression(r)) {
1141
- let t = se(r, "parameters");
1142
+ let t = ne(r, "parameters");
1142
1143
  if (y.types.isIdentifier(t) && (t = P(t.name, e)), t)
1143
- return De(t);
1144
+ return Ne(t);
1144
1145
  } else
1145
1146
  T("default", !0);
1146
1147
  }, "parseDefault"), ct = /* @__PURE__ */ f((s) => {
@@ -1155,7 +1156,7 @@ TSModifiers"), De = /* @__PURE__ */ f((s) => {
1155
1156
  let { name: o } = i.id;
1156
1157
  if (o === "parameters" && i.init) {
1157
1158
  let a = W(i.init);
1158
- e = De(a);
1159
+ e = Ne(a);
1159
1160
  }
1160
1161
  }
1161
1162
  }) : t.specifiers.forEach((i) => {
@@ -1167,7 +1168,7 @@ TSModifiers"), De = /* @__PURE__ */ f((s) => {
1167
1168
  enter({ node: t }) {
1168
1169
  let i = t.declaration;
1169
1170
  y.types.isIdentifier(i) && (i = P(i.name, r.program)), i = W(i), y.types.isCallExpression(i) && y.types.isObjectExpression(i.arguments?.[0]) ?
1170
- e = Oe(i.arguments[0], r.program) : y.types.isObjectExpression(i) ? e = Oe(i, r.program) : T("default", !1);
1171
+ e = ve(i.arguments[0], r.program) : y.types.isObjectExpression(i) ? e = ve(i, r.program) : T("default", !1);
1171
1172
  }
1172
1173
  }
1173
1174
  }), !!e) {
@@ -1182,112 +1183,113 @@ TSModifiers"), De = /* @__PURE__ */ f((s) => {
1182
1183
  }`;
1183
1184
  return (0, eval)(o);
1184
1185
  }
1185
- return y.types.isLiteral(e) || y.types.isArrayExpression(e) || y.types.isObjectExpression(e) ? ne(e) : T("storySort", !0);
1186
+ return y.types.isLiteral(e) || y.types.isArrayExpression(e) || y.types.isObjectExpression(e) ? oe(e) : T("storySort", !0);
1186
1187
  }
1187
1188
  }, "getStorySortParameter");
1188
1189
 
1189
1190
  // src/csf-tools/enrichCsf.ts
1190
- var m = require("storybook/internal/babel");
1191
- var Ie = /* @__PURE__ */ f((s, e, r, t) => {
1192
- let i = e.getStoryExport(r), o = m.types.isCallExpression(i) && m.types.isMemberExpression(i.callee) && m.types.isIdentifier(i.callee.object) &&
1193
- i.callee.object.name === "meta", a = !t?.disableSource && Fe(i), l = !t?.disableDescription && oe(e._storyStatements[r]), p = [], d = o ? m.types.
1194
- memberExpression(m.types.identifier(r), m.types.identifier("input")) : m.types.identifier(r), g = m.types.memberExpression(d, m.types.identifier(
1191
+ var u = require("storybook/internal/babel");
1192
+ var we = /* @__PURE__ */ f((s, e, r, t) => {
1193
+ let i = e.getStoryExport(r), o = u.types.isCallExpression(i) && u.types.isMemberExpression(i.callee) && u.types.isIdentifier(i.callee.object) &&
1194
+ i.callee.object.name === "meta", a = !t?.disableSource && Te(i), l = !t?.disableDescription && ae(e._storyStatements[r]), p = [], d = o ? u.types.
1195
+ memberExpression(u.types.identifier(r), u.types.identifier("input")) : u.types.identifier(r), g = u.types.memberExpression(d, u.types.identifier(
1195
1196
  "parameters"));
1196
- p.push(m.types.spreadElement(g));
1197
- let x = m.types.optionalMemberExpression(
1197
+ p.push(u.types.spreadElement(g));
1198
+ let x = u.types.optionalMemberExpression(
1198
1199
  g,
1199
- m.types.identifier("docs"),
1200
+ u.types.identifier("docs"),
1200
1201
  !1,
1201
1202
  !0
1202
1203
  ), h = [];
1203
1204
  if (a) {
1204
- let b = m.types.optionalMemberExpression(
1205
+ let b = u.types.optionalMemberExpression(
1205
1206
  x,
1206
- m.types.identifier("source"),
1207
+ u.types.identifier("source"),
1207
1208
  !1,
1208
1209
  !0
1209
1210
  );
1210
1211
  h.push(
1211
- m.types.objectProperty(
1212
- m.types.identifier("source"),
1213
- m.types.objectExpression([
1214
- m.types.objectProperty(m.types.identifier("originalSource"), m.types.stringLiteral(a)),
1215
- m.types.spreadElement(b)
1212
+ u.types.objectProperty(
1213
+ u.types.identifier("source"),
1214
+ u.types.objectExpression([
1215
+ u.types.objectProperty(u.types.identifier("originalSource"), u.types.stringLiteral(a)),
1216
+ u.types.spreadElement(b)
1216
1217
  ])
1217
1218
  )
1218
1219
  );
1219
1220
  }
1220
1221
  if (l) {
1221
- let b = m.types.optionalMemberExpression(
1222
+ let b = u.types.optionalMemberExpression(
1222
1223
  x,
1223
- m.types.identifier("description"),
1224
+ u.types.identifier("description"),
1224
1225
  !1,
1225
1226
  !0
1226
1227
  );
1227
1228
  h.push(
1228
- m.types.objectProperty(
1229
- m.types.identifier("description"),
1230
- m.types.objectExpression([
1231
- m.types.objectProperty(m.types.identifier("story"), m.types.stringLiteral(l)),
1232
- m.types.spreadElement(b)
1229
+ u.types.objectProperty(
1230
+ u.types.identifier("description"),
1231
+ u.types.objectExpression([
1232
+ u.types.objectProperty(u.types.identifier("story"), u.types.stringLiteral(l)),
1233
+ u.types.spreadElement(b)
1233
1234
  ])
1234
1235
  )
1235
1236
  );
1236
1237
  }
1237
1238
  if (h.length > 0) {
1238
1239
  p.push(
1239
- m.types.objectProperty(
1240
- m.types.identifier("docs"),
1241
- m.types.objectExpression([m.types.spreadElement(x), ...h])
1240
+ u.types.objectProperty(
1241
+ u.types.identifier("docs"),
1242
+ u.types.objectExpression([u.types.spreadElement(x), ...h])
1242
1243
  )
1243
1244
  );
1244
- let b = m.types.expressionStatement(
1245
- m.types.assignmentExpression("=", g, m.types.objectExpression(p))
1245
+ let b = u.types.expressionStatement(
1246
+ u.types.assignmentExpression("=", g, u.types.objectExpression(p))
1246
1247
  );
1247
1248
  s._ast.program.body.push(b);
1248
1249
  }
1249
- }, "enrichCsfStory"), Ne = /* @__PURE__ */ f((s, e, r) => {
1250
+ }, "enrichCsfStory"), Fe = /* @__PURE__ */ f((s, e, r) => {
1250
1251
  if (!e.length) {
1251
1252
  s.properties.find(
1252
- (p) => m.types.isObjectProperty(p) && m.types.isIdentifier(p.key) && p.key.name === "component"
1253
+ (p) => u.types.isObjectProperty(p) && u.types.isIdentifier(p.key) && p.key.name === "component"
1253
1254
  ) || s.properties.unshift(r);
1254
1255
  return;
1255
1256
  }
1256
1257
  let [t, ...i] = e, o = s.properties.find(
1257
- (l) => m.types.isObjectProperty(l) && m.types.isIdentifier(l.key) && l.key.name === t && m.types.isObjectExpression(l.value)
1258
+ (l) => u.types.isObjectProperty(l) && u.types.isIdentifier(l.key) && l.key.name === t && u.types.isObjectExpression(l.value)
1258
1259
  ), a;
1259
- o ? a = o.value : (a = m.types.objectExpression([]), s.properties.push(m.types.objectProperty(m.types.identifier(t), a))), Ne(a, i, r);
1260
- }, "addComponentDescription"), we = /* @__PURE__ */ f((s, e, r) => {
1261
- let t = !r?.disableDescription && oe(e._metaStatement);
1260
+ o ? a = o.value : (a = u.types.objectExpression([]), s.properties.push(u.types.objectProperty(u.types.identifier(t), a))), Fe(a, i, r);
1261
+ }, "addComponentDescription"), Ce = /* @__PURE__ */ f((s, e, r) => {
1262
+ let t = !r?.disableDescription && ae(e._metaStatement);
1262
1263
  if (t) {
1263
1264
  let i = s._metaNode;
1264
- i && m.types.isObjectExpression(i) && Ne(
1265
+ i && u.types.isObjectExpression(i) && Fe(
1265
1266
  i,
1266
1267
  ["parameters", "docs", "description"],
1267
- m.types.objectProperty(m.types.identifier("component"), m.types.stringLiteral(t))
1268
+ u.types.objectProperty(u.types.identifier("component"), u.types.stringLiteral(t))
1268
1269
  );
1269
1270
  }
1270
1271
  }, "enrichCsfMeta"), pt = /* @__PURE__ */ f((s, e, r) => {
1271
- we(s, e, r), Object.keys(s._storyExports).forEach((t) => {
1272
- Ie(s, e, t, r);
1272
+ Ce(s, e, r), Object.keys(s._storyExports).forEach((t) => {
1273
+ we(s, e, t, r);
1273
1274
  });
1274
- }, "enrichCsf"), Fe = /* @__PURE__ */ f((s) => {
1275
- let e = m.types.isVariableDeclarator(s) ? s.init : s, { code: r } = (0, m.generate)(e, {});
1275
+ }, "enrichCsf"), Te = /* @__PURE__ */ f((s) => {
1276
+ let e = u.types.isVariableDeclarator(s) ? s.init : s, { code: r } = (0, u.generate)(e, {});
1276
1277
  return r;
1277
- }, "extractSource"), oe = /* @__PURE__ */ f((s) => s?.leadingComments ? s.leadingComments.map((r) => r.type === "CommentLine" || !r.value.startsWith(
1278
+ }, "extractSource"), ae = /* @__PURE__ */ f((s) => s?.leadingComments ? s.leadingComments.map((r) => r.type === "CommentLine" || !r.value.startsWith(
1278
1279
  "*") ? null : r.value.split(`
1279
1280
  `).map((t) => t.replace(/^(\s+)?(\*+)?(\s)?/, "")).join(`
1280
1281
  `).trim()).filter(Boolean).join(`
1281
1282
  `) : "", "extractDescription");
1282
1283
 
1283
1284
  // src/csf-tools/index.ts
1284
- var Ae = require("storybook/internal/babel");
1285
+ var $e = require("storybook/internal/babel");
1285
1286
 
1286
1287
  // src/csf-tools/vitest-plugin/transformer.ts
1287
- var u = require("storybook/internal/babel"), Te = require("storybook/internal/common"), ke = require("storybook/internal/csf"), ae = z(R(), 1);
1288
- var Ce = console, ft = /* @__PURE__ */ f((s, e) => !(e.include.length && !e.include.some((r) => s?.includes(r)) || e.exclude.some((r) => s?.
1289
- includes(r))), "isValidTest");
1290
- async function Ve({
1288
+ var m = require("storybook/internal/babel"), ke = require("storybook/internal/common"), Ve = require("storybook/internal/csf"), le = require("storybook/internal/node-logger"),
1289
+ ce = z(R(), 1);
1290
+ var ft = /* @__PURE__ */ f((s, e) => !(e.include.length && !e.include.some((r) => s?.includes(r)) || e.exclude.some((r) => s?.includes(r))),
1291
+ "isValidTest");
1292
+ async function Ae({
1291
1293
  code: s,
1292
1294
  fileName: e,
1293
1295
  configDir: r,
@@ -1301,23 +1303,23 @@ async function Ve({
1301
1303
  fileName: e,
1302
1304
  transformInlineMeta: !0,
1303
1305
  makeTitle: /* @__PURE__ */ f((_) => {
1304
- let S = (0, Te.getStoryTitle)({
1306
+ let S = (0, ke.getStoryTitle)({
1305
1307
  storyFilePath: e,
1306
1308
  configDir: r,
1307
1309
  stories: t,
1308
1310
  userTitle: _
1309
1311
  }) || "unknown";
1310
- return S === "unknown" && Ce.warn(
1311
- ae.dedent`
1312
+ return S === "unknown" && le.logger.warn(
1313
+ ce.dedent`
1312
1314
  [Storybook]: Could not calculate story title for "${e}".
1313
1315
  Please make sure that this file matches the globs included in the "stories" field in your Storybook configuration at "${r}".
1314
1316
  `
1315
1317
  ), S;
1316
1318
  }, "makeTitle")
1317
1319
  }).parse(), p = l._ast, d = l._metaVariableName, g = l._metaNode, x = g.properties.find(
1318
- (_) => u.types.isObjectProperty(_) && u.types.isIdentifier(_.key) && _.key.name === "title"
1319
- ), h = u.types.stringLiteral(l._meta?.title || "unknown");
1320
- if (x ? u.types.isObjectProperty(x) && (x.value = h) : g.properties.push(u.types.objectProperty(u.types.identifier("title"), h)), !g || !l.
1320
+ (_) => m.types.isObjectProperty(_) && m.types.isIdentifier(_.key) && _.key.name === "title"
1321
+ ), h = m.types.stringLiteral(l._meta?.title || "unknown");
1322
+ if (x ? m.types.isObjectProperty(x) && (x.value = h) : g.properties.push(m.types.objectProperty(m.types.identifier("title"), h)), !g || !l.
1321
1323
  _meta)
1322
1324
  throw new Error(
1323
1325
  `The Storybook vitest plugin could not detect the meta (default export) object in the story file.
@@ -1327,7 +1329,7 @@ le an issue with details about your use case.`
1327
1329
  );
1328
1330
  let b = {};
1329
1331
  Object.keys(l._stories).map((_) => {
1330
- let S = (0, ke.combineTags)(
1332
+ let S = (0, Ve.combineTags)(
1331
1333
  "test",
1332
1334
  "dev",
1333
1335
  ...o,
@@ -1338,79 +1340,79 @@ le an issue with details about your use case.`
1338
1340
  });
1339
1341
  let E = l._file.path.scope.generateUidIdentifier("test"), I = l._file.path.scope.generateUidIdentifier("describe");
1340
1342
  if (Object.keys(b).length === 0) {
1341
- let _ = u.types.expressionStatement(
1342
- u.types.callExpression(u.types.memberExpression(I, u.types.identifier("skip")), [
1343
- u.types.stringLiteral("No valid tests found")
1343
+ let _ = m.types.expressionStatement(
1344
+ m.types.callExpression(m.types.memberExpression(I, m.types.identifier("skip")), [
1345
+ m.types.stringLiteral("No valid tests found")
1344
1346
  ])
1345
1347
  );
1346
1348
  p.program.body.push(_);
1347
1349
  let S = [
1348
- u.types.importDeclaration(
1350
+ m.types.importDeclaration(
1349
1351
  [
1350
- u.types.importSpecifier(E, u.types.identifier("test")),
1351
- u.types.importSpecifier(I, u.types.identifier("describe"))
1352
+ m.types.importSpecifier(E, m.types.identifier("test")),
1353
+ m.types.importSpecifier(I, m.types.identifier("describe"))
1352
1354
  ],
1353
- u.types.stringLiteral("vitest")
1355
+ m.types.stringLiteral("vitest")
1354
1356
  )
1355
1357
  ];
1356
1358
  p.program.body.unshift(...S);
1357
1359
  } else {
1358
- let le = function() {
1359
- let j = l._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), N = u.types.memberExpression(
1360
- u.types.callExpression(u.types.memberExpression(_, u.types.identifier("getState")), []),
1361
- u.types.identifier("testPath")
1362
- ), k = u.types.memberExpression(
1363
- u.types.memberExpression(u.types.identifier("globalThis"), u.types.identifier("__vitest_worker__")),
1364
- u.types.identifier("filepath")
1365
- ), V = u.types.logicalExpression(
1360
+ let pe = function() {
1361
+ let j = l._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), N = m.types.memberExpression(
1362
+ m.types.callExpression(m.types.memberExpression(_, m.types.identifier("getState")), []),
1363
+ m.types.identifier("testPath")
1364
+ ), k = m.types.memberExpression(
1365
+ m.types.memberExpression(m.types.identifier("globalThis"), m.types.identifier("__vitest_worker__")),
1366
+ m.types.identifier("filepath")
1367
+ ), V = m.types.logicalExpression(
1366
1368
  "??",
1367
1369
  // TODO: switch order of testPathProperty and filePathProperty when the bug is fixed
1368
1370
  // https://github.com/vitest-dev/vitest/issues/6367 (or probably just use testPathProperty)
1369
1371
  k,
1370
1372
  N
1371
- ), G = u.types.callExpression(
1372
- u.types.memberExpression(
1373
- u.types.callExpression(u.types.identifier("convertToFilePath"), [
1374
- u.types.memberExpression(
1375
- u.types.memberExpression(u.types.identifier("import"), u.types.identifier("meta")),
1376
- u.types.identifier("url")
1373
+ ), G = m.types.callExpression(
1374
+ m.types.memberExpression(
1375
+ m.types.callExpression(m.types.identifier("convertToFilePath"), [
1376
+ m.types.memberExpression(
1377
+ m.types.memberExpression(m.types.identifier("import"), m.types.identifier("meta")),
1378
+ m.types.identifier("url")
1377
1379
  )
1378
1380
  ]),
1379
- u.types.identifier("includes")
1381
+ m.types.identifier("includes")
1380
1382
  ),
1381
1383
  [V]
1382
1384
  );
1383
- return { isRunningFromThisFileDeclaration: u.types.variableDeclaration("const", [
1384
- u.types.variableDeclarator(j, G)
1385
+ return { isRunningFromThisFileDeclaration: m.types.variableDeclaration("const", [
1386
+ m.types.variableDeclarator(j, G)
1385
1387
  ]), isRunningFromThisFileId: j };
1386
1388
  };
1387
- var ut = le;
1388
- f(le, "getTestGuardDeclaration");
1389
- let _ = l._file.path.scope.generateUidIdentifier("expect"), S = l._file.path.scope.generateUidIdentifier("testStory"), $e = u.types.identifier(
1390
- JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Re, isRunningFromThisFileId: Le } = le();
1391
- p.program.body.push(Re);
1392
- let Me = /* @__PURE__ */ f(({
1389
+ var mt = pe;
1390
+ f(pe, "getTestGuardDeclaration");
1391
+ let _ = l._file.path.scope.generateUidIdentifier("expect"), S = l._file.path.scope.generateUidIdentifier("testStory"), Re = m.types.identifier(
1392
+ JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Le, isRunningFromThisFileId: Me } = pe();
1393
+ p.program.body.push(Le);
1394
+ let Ue = /* @__PURE__ */ f(({
1393
1395
  localName: j,
1394
1396
  exportName: N,
1395
1397
  testTitle: k,
1396
1398
  node: V
1397
1399
  }) => {
1398
- let G = u.types.expressionStatement(
1399
- u.types.callExpression(E, [
1400
- u.types.stringLiteral(k),
1401
- u.types.callExpression(S, [
1402
- u.types.stringLiteral(N),
1403
- u.types.identifier(j),
1404
- u.types.identifier(d),
1405
- $e
1400
+ let G = m.types.expressionStatement(
1401
+ m.types.callExpression(E, [
1402
+ m.types.stringLiteral(k),
1403
+ m.types.callExpression(S, [
1404
+ m.types.stringLiteral(N),
1405
+ m.types.identifier(j),
1406
+ m.types.identifier(d),
1407
+ Re
1406
1408
  ])
1407
1409
  ])
1408
1410
  );
1409
1411
  return G.loc = V.loc, G;
1410
- }, "getTestStatementForStory"), Ue = Object.entries(b).map(([j, N]) => {
1412
+ }, "getTestStatementForStory"), qe = Object.entries(b).map(([j, N]) => {
1411
1413
  if (N === null) {
1412
- Ce.warn(
1413
- ae.dedent`
1414
+ le.logger.warn(
1415
+ ce.dedent`
1414
1416
  [Storybook]: Could not transform "${j}" story into test at "${e}".
1415
1417
  Please make sure to define stories in the same file and not re-export stories coming from other files".
1416
1418
  `
@@ -1418,27 +1420,27 @@ le an issue with details about your use case.`
1418
1420
  return;
1419
1421
  }
1420
1422
  let k = l._stories[j].localName ?? j, V = l._stories[j].name ?? j;
1421
- return Me({ testTitle: V, localName: k, exportName: j, node: N });
1422
- }).filter((j) => !!j), qe = u.types.ifStatement(Le, u.types.blockStatement(Ue));
1423
- p.program.body.push(qe);
1424
- let Be = [
1425
- u.types.importDeclaration(
1423
+ return Ue({ testTitle: V, localName: k, exportName: j, node: N });
1424
+ }).filter((j) => !!j), Be = m.types.ifStatement(Me, m.types.blockStatement(qe));
1425
+ p.program.body.push(Be);
1426
+ let We = [
1427
+ m.types.importDeclaration(
1426
1428
  [
1427
- u.types.importSpecifier(E, u.types.identifier("test")),
1428
- u.types.importSpecifier(_, u.types.identifier("expect"))
1429
+ m.types.importSpecifier(E, m.types.identifier("test")),
1430
+ m.types.importSpecifier(_, m.types.identifier("expect"))
1429
1431
  ],
1430
- u.types.stringLiteral("vitest")
1432
+ m.types.stringLiteral("vitest")
1431
1433
  ),
1432
- u.types.importDeclaration(
1434
+ m.types.importDeclaration(
1433
1435
  [
1434
- u.types.importSpecifier(S, u.types.identifier("testStory")),
1435
- u.types.importSpecifier(u.types.identifier("convertToFilePath"), u.types.identifier("convertToFilePath"))
1436
+ m.types.importSpecifier(S, m.types.identifier("testStory")),
1437
+ m.types.importSpecifier(m.types.identifier("convertToFilePath"), m.types.identifier("convertToFilePath"))
1436
1438
  ],
1437
- u.types.stringLiteral("@storybook/addon-vitest/internal/test-utils")
1439
+ m.types.stringLiteral("@storybook/addon-vitest/internal/test-utils")
1438
1440
  )
1439
1441
  ];
1440
- p.program.body.unshift(...Be);
1442
+ p.program.body.unshift(...We);
1441
1443
  }
1442
- return te(l, { sourceMaps: !0, sourceFileName: e }, s);
1444
+ return ie(l, { sourceMaps: !0, sourceFileName: e }, s);
1443
1445
  }
1444
- f(Ve, "vitestTransform");
1446
+ f(Ae, "vitestTransform");