storybook 9.1.0-alpha.6 → 9.1.0-alpha.8

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 (88) hide show
  1. package/assets/browser/favicon-wrapper.svg +46 -0
  2. package/assets/browser/favicon.svg +1 -1
  3. package/dist/bin/index.cjs +43 -43
  4. package/dist/bin/index.js +43 -43
  5. package/dist/cli/bin/index.cjs +513 -513
  6. package/dist/cli/bin/index.js +535 -535
  7. package/dist/cli/index.cjs +2454 -2453
  8. package/dist/cli/index.d.ts +10 -3
  9. package/dist/cli/index.js +2436 -2435
  10. package/dist/common/index.cjs +64 -61
  11. package/dist/common/index.d.ts +9 -3
  12. package/dist/common/index.js +64 -61
  13. package/dist/components/index.cjs +4602 -4427
  14. package/dist/components/index.d.ts +9 -11
  15. package/dist/components/index.js +2760 -2580
  16. package/dist/core-server/index.cjs +5833 -5819
  17. package/dist/core-server/index.d.ts +4 -1
  18. package/dist/core-server/index.js +4848 -4835
  19. package/dist/core-server/presets/common-manager.js +3410 -3332
  20. package/dist/core-server/presets/common-preset.cjs +1831 -1837
  21. package/dist/core-server/presets/common-preset.js +1787 -1792
  22. package/dist/csf/index.cjs +2536 -736
  23. package/dist/csf/index.d.ts +250 -9
  24. package/dist/csf/index.js +2558 -749
  25. package/dist/csf-tools/index.cjs +319 -321
  26. package/dist/csf-tools/index.js +239 -241
  27. package/dist/instrumenter/index.cjs +1150 -1099
  28. package/dist/instrumenter/index.d.ts +1 -0
  29. package/dist/instrumenter/index.js +1261 -1214
  30. package/dist/manager/globals-module-info.cjs +0 -1
  31. package/dist/manager/globals-module-info.js +0 -1
  32. package/dist/manager/globals-runtime.js +21740 -24218
  33. package/dist/manager/runtime.js +3715 -3536
  34. package/dist/manager-api/index.cjs +3 -3
  35. package/dist/manager-api/index.d.ts +4 -1
  36. package/dist/manager-api/index.js +3 -3
  37. package/dist/node-logger/index.cjs +1620 -1620
  38. package/dist/node-logger/index.js +1619 -1619
  39. package/dist/preview/runtime.js +13337 -16032
  40. package/dist/preview-api/index.cjs +273 -271
  41. package/dist/preview-api/index.d.ts +4 -1
  42. package/dist/preview-api/index.js +14 -12
  43. package/dist/telemetry/index.cjs +500 -500
  44. package/dist/telemetry/index.d.ts +1 -1
  45. package/dist/telemetry/index.js +478 -478
  46. package/dist/test/index.cjs +9136 -9815
  47. package/dist/test/index.js +8339 -9025
  48. package/dist/types/index.d.ts +12 -12
  49. package/package.json +5 -196
  50. package/dist/actions/preview.cjs +0 -159
  51. package/dist/actions/preview.d.ts +0 -45
  52. package/dist/actions/preview.js +0 -149
  53. package/dist/backgrounds/index.cjs +0 -16
  54. package/dist/backgrounds/index.d.ts +0 -2
  55. package/dist/backgrounds/index.js +0 -0
  56. package/dist/backgrounds/preview.cjs +0 -143
  57. package/dist/backgrounds/preview.d.ts +0 -53
  58. package/dist/backgrounds/preview.js +0 -127
  59. package/dist/component-testing/index.cjs +0 -23
  60. package/dist/component-testing/index.d.ts +0 -3
  61. package/dist/component-testing/index.js +0 -5
  62. package/dist/component-testing/preview.cjs +0 -40
  63. package/dist/component-testing/preview.d.ts +0 -5
  64. package/dist/component-testing/preview.js +0 -25
  65. package/dist/controls/preview.cjs +0 -26
  66. package/dist/controls/preview.d.ts +0 -43
  67. package/dist/controls/preview.js +0 -9
  68. package/dist/highlight/preview.cjs +0 -590
  69. package/dist/highlight/preview.d.ts +0 -20
  70. package/dist/highlight/preview.js +0 -575
  71. package/dist/measure/index.cjs +0 -16
  72. package/dist/measure/index.d.ts +0 -2
  73. package/dist/measure/index.js +0 -0
  74. package/dist/measure/preview.cjs +0 -466
  75. package/dist/measure/preview.d.ts +0 -25
  76. package/dist/measure/preview.js +0 -450
  77. package/dist/outline/index.cjs +0 -16
  78. package/dist/outline/index.d.ts +0 -2
  79. package/dist/outline/index.js +0 -0
  80. package/dist/outline/preview.cjs +0 -518
  81. package/dist/outline/preview.d.ts +0 -25
  82. package/dist/outline/preview.js +0 -486
  83. package/dist/test/preview.cjs +0 -73
  84. package/dist/test/preview.d.ts +0 -17
  85. package/dist/test/preview.js +0 -66
  86. package/dist/viewport/preview.cjs +0 -35
  87. package/dist/viewport/preview.d.ts +0 -62
  88. package/dist/viewport/preview.js +0 -19
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  var Ge = Object.create;
3
- var A = Object.defineProperty;
3
+ var V = Object.defineProperty;
4
4
  var ze = Object.getOwnPropertyDescriptor;
5
5
  var Xe = Object.getOwnPropertyNames;
6
6
  var Ke = Object.getPrototypeOf, Je = Object.prototype.hasOwnProperty;
7
- var f = (s, e) => A(s, "name", { value: e, configurable: !0 });
7
+ var f = (s, e) => V(s, "name", { value: e, configurable: !0 });
8
8
  var Qe = (s, e) => () => (e || s((e = { exports: {} }).exports, e), e.exports), He = (s, e) => {
9
9
  for (var r in e)
10
- A(s, r, { get: e[r], enumerable: !0 });
10
+ V(s, r, { get: e[r], enumerable: !0 });
11
11
  }, fe = (s, e, r, t) => {
12
12
  if (e && typeof e == "object" || typeof e == "function")
13
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 });
14
+ !Je.call(s, i) && i !== r && V(s, i, { get: () => e[i], enumerable: !(t = ze(e, i)) || t.enumerable });
15
15
  return s;
16
16
  };
17
17
  var z = (s, e, r) => (r = s != null ? Ge(Ke(s)) : {}, fe(
@@ -19,61 +19,61 @@ var z = (s, e, r) => (r = s != null ? Ge(Ke(s)) : {}, fe(
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
- e || !s || !s.__esModule ? A(r, "default", { value: s, enumerable: !0 }) : r,
22
+ e || !s || !s.__esModule ? V(r, "default", { value: s, enumerable: !0 }) : r,
23
23
  s
24
- )), Ye = (s) => fe(A({}, "__esModule", { value: !0 }), s);
24
+ )), Ye = (s) => fe(V({}, "__esModule", { value: !0 }), s);
25
25
 
26
26
  // ../node_modules/ts-dedent/dist/index.js
27
- var R = Qe(($) => {
27
+ var $ = Qe((A) => {
28
28
  "use strict";
29
- Object.defineProperty($, "__esModule", { value: !0 });
30
- $.dedent = void 0;
29
+ Object.defineProperty(A, "__esModule", { value: !0 });
30
+ A.dedent = void 0;
31
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);
35
35
  t[t.length - 1] = t[t.length - 1].replace(/\r?\n([\t ]*)$/, "");
36
- var i = t.reduce(function(l, p) {
36
+ var i = t.reduce(function(c, p) {
37
37
  var d = p.match(/\n([\t ]+|(?!\s).)/g);
38
- return d ? l.concat(d.map(function(g) {
38
+ return d ? c.concat(d.map(function(g) {
39
39
  var x, h;
40
40
  return (h = (x = g.match(/[\t ]/g)) === null || x === void 0 ? void 0 : x.length) !== null && h !== void 0 ? h : 0;
41
- })) : l;
41
+ })) : c;
42
42
  }, []);
43
43
  if (i.length) {
44
- var o = new RegExp(`
44
+ var a = new RegExp(`
45
45
  [ ]{` + Math.min.apply(Math, i) + "}", "g");
46
- t = t.map(function(l) {
47
- return l.replace(o, `
46
+ t = t.map(function(c) {
47
+ return c.replace(a, `
48
48
  `);
49
49
  });
50
50
  }
51
51
  t[0] = t[0].replace(/^\r?\n/, "");
52
- var a = t[0];
53
- return e.forEach(function(l, p) {
54
- var d = a.match(/(?:^|\n)( *)$/), g = d ? d[1] : "", x = l;
55
- typeof l == "string" && l.includes(`
56
- `) && (x = String(l).split(`
52
+ var o = t[0];
53
+ return e.forEach(function(c, p) {
54
+ var d = o.match(/(?:^|\n)( *)$/), g = d ? d[1] : "", x = c;
55
+ typeof c == "string" && c.includes(`
56
+ `) && (x = String(c).split(`
57
57
  `).map(function(h, b) {
58
58
  return b === 0 ? h : "" + g + h;
59
59
  }).join(`
60
- `)), a += x + t[p + 1];
61
- }), a;
60
+ `)), o += x + t[p + 1];
61
+ }), o;
62
62
  }
63
63
  f(de, "dedent");
64
- $.dedent = de;
65
- $.default = de;
64
+ A.dedent = de;
65
+ A.default = de;
66
66
  });
67
67
 
68
68
  // src/csf-tools/index.ts
69
69
  var dt = {};
70
70
  He(dt, {
71
- BadMetaError: () => U,
71
+ BadMetaError: () => M,
72
72
  ConfigFile: () => ee,
73
73
  CsfFile: () => K,
74
- MixedFactoryError: () => M,
74
+ MixedFactoryError: () => L,
75
75
  MultipleMetaError: () => X,
76
- NoMetaError: () => L,
76
+ NoMetaError: () => R,
77
77
  babelParse: () => $e.babelParse,
78
78
  babelParseFile: () => be,
79
79
  enrichCsf: () => pt,
@@ -100,39 +100,39 @@ He(dt, {
100
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"), re = require("storybook/internal/node-logger"),
104
- O = z(R(), 1);
103
+ var J = require("node:fs/promises"), l = require("storybook/internal/babel"), v = require("storybook/internal/csf"), re = require("storybook/internal/node-logger"),
104
+ O = z($(), 1);
105
105
 
106
106
  // src/csf-tools/findVarInitialization.ts
107
- var w = require("storybook/internal/babel");
107
+ var N = require("storybook/internal/babel");
108
108
  var P = /* @__PURE__ */ f((s, e) => {
109
109
  let r = null, t = null;
110
- return e.body.find((i) => (w.types.isVariableDeclaration(i) ? t = i.declarations : w.types.isExportNamedDeclaration(i) && w.types.isVariableDeclaration(
111
- i.declaration) && (t = i.declaration.declarations), t && t.find((o) => w.types.isVariableDeclarator(o) && w.types.isIdentifier(o.id) && o.
112
- id.name === s ? (r = o.init, !0) : !1))), r;
110
+ return e.body.find((i) => (N.types.isVariableDeclaration(i) ? t = i.declarations : N.types.isExportNamedDeclaration(i) && N.types.isVariableDeclaration(
111
+ i.declaration) && (t = i.declaration.declarations), t && t.find((a) => N.types.isVariableDeclarator(a) && N.types.isIdentifier(a.id) && a.
112
+ id.name === s ? (r = a.init, !0) : !1))), r;
113
113
  }, "findVarInitialization");
114
114
 
115
115
  // src/csf-tools/CsfFile.ts
116
116
  var Ze = /\/preview(.(js|jsx|mjs|ts|tsx))?$/, xe = /* @__PURE__ */ f((s) => Ze.test(s), "isValidPreviewPath");
117
117
  function et(s) {
118
- if (c.types.isArrayExpression(s))
118
+ if (l.types.isArrayExpression(s))
119
119
  return s.elements.map((e) => {
120
- if (c.types.isStringLiteral(e))
120
+ if (l.types.isStringLiteral(e))
121
121
  return e.value;
122
122
  throw new Error(`Expected string literal: ${e}`);
123
123
  });
124
- if (c.types.isStringLiteral(s))
124
+ if (l.types.isStringLiteral(s))
125
125
  return new RegExp(s.value);
126
- if (c.types.isRegExpLiteral(s))
126
+ if (l.types.isRegExpLiteral(s))
127
127
  return new RegExp(s.pattern, s.flags);
128
128
  throw new Error(`Unknown include/exclude: ${s}`);
129
129
  }
130
130
  f(et, "parseIncludeExclude");
131
131
  function me(s) {
132
- if (!c.types.isArrayExpression(s))
132
+ if (!l.types.isArrayExpression(s))
133
133
  throw new Error("CSF: Expected tags array");
134
134
  return s.elements.map((e) => {
135
- if (c.types.isStringLiteral(e))
135
+ if (l.types.isStringLiteral(e))
136
136
  return e.value;
137
137
  throw new Error("CSF: Expected tag to be string literal");
138
138
  });
@@ -147,19 +147,19 @@ var D = /* @__PURE__ */ f((s, e) => {
147
147
  return `${e || ""} ${r}`.trim();
148
148
  }, "formatLocation"), ye = /* @__PURE__ */ f((s) => it.test(s), "isModuleMock"), ue = /* @__PURE__ */ f((s, e, r) => {
149
149
  let t = s;
150
- if (c.types.isCallExpression(s)) {
151
- let { callee: i, arguments: o } = s;
152
- if (c.types.isProgram(e) && c.types.isMemberExpression(i) && c.types.isIdentifier(i.object) && c.types.isIdentifier(i.property) && i.property.
153
- name === "bind" && (o.length === 0 || o.length === 1 && c.types.isObjectExpression(o[0]) && o[0].properties.length === 0)) {
154
- let a = i.object.name, l = P(a, e);
155
- l && (r._templates[a] = l, t = l);
150
+ if (l.types.isCallExpression(s)) {
151
+ let { callee: i, arguments: a } = s;
152
+ if (l.types.isProgram(e) && l.types.isMemberExpression(i) && l.types.isIdentifier(i.object) && l.types.isIdentifier(i.property) && i.property.
153
+ name === "bind" && (a.length === 0 || a.length === 1 && l.types.isObjectExpression(a[0]) && a[0].properties.length === 0)) {
154
+ let o = i.object.name, c = P(o, e);
155
+ c && (r._templates[o] = c, t = c);
156
156
  }
157
157
  }
158
- return c.types.isArrowFunctionExpression(t) || c.types.isFunctionDeclaration(t) ? t.params.length > 0 : !1;
158
+ return l.types.isArrowFunctionExpression(t) || l.types.isFunctionDeclaration(t) ? t.params.length > 0 : !1;
159
159
  }, "isArgsStory"), tt = /* @__PURE__ */ f((s) => {
160
- if (c.types.isArrayExpression(s))
160
+ if (l.types.isArrayExpression(s))
161
161
  return s.elements.map((e) => {
162
- if (c.types.isStringLiteral(e))
162
+ if (l.types.isStringLiteral(e))
163
163
  return e.value;
164
164
  throw new Error(`Expected string literal named export: ${e}`);
165
165
  });
@@ -171,19 +171,19 @@ var D = /* @__PURE__ */ f((s, e) => {
171
171
  },
172
172
  {}
173
173
  ), "sortExports"), rt = /* @__PURE__ */ f((s) => {
174
- if (c.types.isArrowFunctionExpression(s) || c.types.isFunctionDeclaration(s)) {
174
+ if (l.types.isArrowFunctionExpression(s) || l.types.isFunctionDeclaration(s)) {
175
175
  let e = s.params;
176
176
  if (e.length >= 1) {
177
177
  let [r] = e;
178
- if (c.types.isObjectPattern(r))
178
+ if (l.types.isObjectPattern(r))
179
179
  return !!r.properties.find((t) => {
180
- if (c.types.isObjectProperty(t) && c.types.isIdentifier(t.key))
180
+ if (l.types.isObjectProperty(t) && l.types.isIdentifier(t.key))
181
181
  return t.key.name === "mount";
182
182
  });
183
183
  }
184
184
  }
185
185
  return !1;
186
- }, "hasMount"), it = /^[.\/#].*\.mock($|\.[^.]*$)/i, L = class extends Error {
186
+ }, "hasMount"), it = /^[.\/#].*\.mock($|\.[^.]*$)/i, R = class extends Error {
187
187
  static {
188
188
  f(this, "NoMetaError");
189
189
  }
@@ -207,7 +207,7 @@ var D = /* @__PURE__ */ f((s, e) => {
207
207
  More info: https://storybook.js.org/docs/writing-stories#default-export
208
208
  `), this.name = this.constructor.name;
209
209
  }
210
- }, M = class extends Error {
210
+ }, L = class extends Error {
211
211
  static {
212
212
  f(this, "MixedFactoryError");
213
213
  }
@@ -219,7 +219,7 @@ var D = /* @__PURE__ */ f((s, e) => {
219
219
  More info: https://storybook.js.org/docs/writing-stories#default-export
220
220
  `), this.name = this.constructor.name;
221
221
  }
222
- }, U = class extends Error {
222
+ }, M = class extends Error {
223
223
  static {
224
224
  f(this, "BadMetaError");
225
225
  }
@@ -246,10 +246,10 @@ var D = /* @__PURE__ */ f((s, e) => {
246
246
  f(this, "CsfFile");
247
247
  }
248
248
  _parseTitle(e) {
249
- let r = c.types.isIdentifier(e) ? P(e.name, this._ast.program) : e;
250
- if (c.types.isStringLiteral(r))
249
+ let r = l.types.isIdentifier(e) ? P(e.name, this._ast.program) : e;
250
+ if (l.types.isStringLiteral(r))
251
251
  return r.value;
252
- if (c.types.isTSSatisfiesExpression(r) && c.types.isStringLiteral(r.expression))
252
+ if (l.types.isTSSatisfiesExpression(r) && l.types.isStringLiteral(r.expression))
253
253
  return r.expression.value;
254
254
  throw new Error(O.dedent`
255
255
  CSF: unexpected dynamic title ${D(r, this._options.fileName)}
@@ -263,29 +263,29 @@ var D = /* @__PURE__ */ f((s, e) => {
263
263
  this._metaNode = e;
264
264
  let t = {};
265
265
  e.properties.forEach((i) => {
266
- if (c.types.isIdentifier(i.key)) {
266
+ if (l.types.isIdentifier(i.key)) {
267
267
  if (this._metaAnnotations[i.key.name] = i.value, i.key.name === "title")
268
268
  t.title = this._parseTitle(i.value);
269
269
  else if (["includeStories", "excludeStories"].includes(i.key.name))
270
270
  t[i.key.name] = et(i.value);
271
271
  else if (i.key.name === "component") {
272
- let o = i.value;
273
- if (c.types.isIdentifier(o)) {
274
- let l = o.name, p = r.body.find(
275
- (d) => c.types.isImportDeclaration(d) && d.specifiers.find((g) => g.local.name === l)
272
+ let a = i.value;
273
+ if (l.types.isIdentifier(a)) {
274
+ let c = a.name, p = r.body.find(
275
+ (d) => l.types.isImportDeclaration(d) && d.specifiers.find((g) => g.local.name === c)
276
276
  );
277
277
  if (p) {
278
278
  let { source: d } = p;
279
- c.types.isStringLiteral(d) && (this._rawComponentPath = d.value);
279
+ l.types.isStringLiteral(d) && (this._rawComponentPath = d.value);
280
280
  }
281
281
  }
282
- let { code: a } = c.recast.print(i.value, {});
283
- t.component = a;
282
+ let { code: o } = l.recast.print(i.value, {});
283
+ t.component = o;
284
284
  } else if (i.key.name === "tags") {
285
- let o = i.value;
286
- c.types.isIdentifier(o) && (o = P(o.name, this._ast.program)), t.tags = me(o);
285
+ let a = i.value;
286
+ l.types.isIdentifier(a) && (a = P(a.name, this._ast.program)), t.tags = me(a);
287
287
  } else if (i.key.name === "id")
288
- if (c.types.isStringLiteral(i.value))
288
+ if (l.types.isStringLiteral(i.value))
289
289
  t.id = i.value.value;
290
290
  else
291
291
  throw new Error(`Unexpected component id: ${i.value}`);
@@ -294,49 +294,49 @@ var D = /* @__PURE__ */ f((s, e) => {
294
294
  }
295
295
  getStoryExport(e) {
296
296
  let r = this._storyExports[e];
297
- if (r = c.types.isVariableDeclarator(r) ? r.init : r, c.types.isCallExpression(r)) {
297
+ if (r = l.types.isVariableDeclarator(r) ? r.init : r, l.types.isCallExpression(r)) {
298
298
  let { callee: t, arguments: i } = r;
299
- if (c.types.isMemberExpression(t) && c.types.isIdentifier(t.object) && c.types.isIdentifier(t.property) && t.property.name === "bind" &&
300
- (i.length === 0 || i.length === 1 && c.types.isObjectExpression(i[0]) && i[0].properties.length === 0)) {
301
- let { name: o } = t.object;
302
- r = this._templates[o];
299
+ if (l.types.isMemberExpression(t) && l.types.isIdentifier(t.object) && l.types.isIdentifier(t.property) && t.property.name === "bind" &&
300
+ (i.length === 0 || i.length === 1 && l.types.isObjectExpression(i[0]) && i[0].properties.length === 0)) {
301
+ let { name: a } = t.object;
302
+ r = this._templates[a];
303
303
  }
304
304
  }
305
305
  return r;
306
306
  }
307
307
  parse() {
308
308
  let e = this;
309
- if ((0, c.traverse)(this._ast, {
309
+ if ((0, l.traverse)(this._ast, {
310
310
  ExportDefaultDeclaration: {
311
311
  enter(t) {
312
- let { node: i, parent: o } = t, a = c.types.isIdentifier(i.declaration) && c.types.isProgram(o);
313
- if (e._options.transformInlineMeta && !a && c.types.isExpression(i.declaration)) {
312
+ let { node: i, parent: a } = t, o = l.types.isIdentifier(i.declaration) && l.types.isProgram(a);
313
+ if (e._options.transformInlineMeta && !o && l.types.isExpression(i.declaration)) {
314
314
  let d = t.scope.generateUidIdentifier("meta");
315
315
  e._metaVariableName = d.name;
316
316
  let g = [
317
- c.types.variableDeclaration("const", [c.types.variableDeclarator(d, i.declaration)]),
318
- c.types.exportDefaultDeclaration(d)
317
+ l.types.variableDeclaration("const", [l.types.variableDeclarator(d, i.declaration)]),
318
+ l.types.exportDefaultDeclaration(d)
319
319
  ];
320
320
  g.forEach((x) => x.loc = t.node.loc), t.replaceWithMultiple(g);
321
321
  return;
322
322
  }
323
- let l, p;
324
- if (a) {
323
+ let c, p;
324
+ if (o) {
325
325
  let d = i.declaration.name;
326
326
  e._metaVariableName = d;
327
- let g = /* @__PURE__ */ f((x) => c.types.isIdentifier(x.id) && x.id.name === d, "isVariableDeclarator");
327
+ let g = /* @__PURE__ */ f((x) => l.types.isIdentifier(x.id) && x.id.name === d, "isVariableDeclarator");
328
328
  e._metaStatement = e._ast.program.body.find(
329
- (x) => c.types.isVariableDeclaration(x) && x.declarations.find(g)
329
+ (x) => l.types.isVariableDeclaration(x) && x.declarations.find(g)
330
330
  ), p = (e?._metaStatement?.declarations || []).find(
331
331
  g
332
332
  )?.init;
333
333
  } else
334
334
  e._metaStatement = i, p = i.declaration;
335
- if (c.types.isObjectExpression(p) ? l = p : (
335
+ if (l.types.isObjectExpression(p) ? c = p : (
336
336
  // export default { ... } as Meta<...>
337
- (c.types.isTSAsExpression(p) || c.types.isTSSatisfiesExpression(p)) && c.types.isObjectExpression(p.expression) && (l = p.expression)
338
- ), l && c.types.isProgram(o) && e._parseMeta(l, o), e._metaStatement && !e._metaNode)
339
- throw new L(
337
+ (l.types.isTSAsExpression(p) || l.types.isTSSatisfiesExpression(p)) && l.types.isObjectExpression(p.expression) && (c = p.expression)
338
+ ), c && l.types.isProgram(a) && e._parseMeta(c, a), e._metaStatement && !e._metaNode)
339
+ throw new R(
340
340
  "default export must be an object",
341
341
  e._metaStatement,
342
342
  e._options.fileName
@@ -346,64 +346,64 @@ var D = /* @__PURE__ */ f((s, e) => {
346
346
  },
347
347
  ExportNamedDeclaration: {
348
348
  enter(t) {
349
- let { node: i, parent: o } = t, a;
350
- c.types.isVariableDeclaration(i.declaration) ? a = i.declaration.declarations.filter((l) => c.types.isVariableDeclarator(l)) : c.types.
351
- isFunctionDeclaration(i.declaration) && (a = [i.declaration]), a ? a.forEach((l) => {
352
- if (c.types.isIdentifier(l.id)) {
353
- let p = !1, { name: d } = l.id;
354
- if (d === "__namedExportsOrder" && c.types.isVariableDeclarator(l)) {
355
- e._namedExportsOrder = tt(l.init);
349
+ let { node: i, parent: a } = t, o;
350
+ l.types.isVariableDeclaration(i.declaration) ? o = i.declaration.declarations.filter((c) => l.types.isVariableDeclarator(c)) : l.types.
351
+ isFunctionDeclaration(i.declaration) && (o = [i.declaration]), o ? o.forEach((c) => {
352
+ if (l.types.isIdentifier(c.id)) {
353
+ let p = !1, { name: d } = c.id;
354
+ if (d === "__namedExportsOrder" && l.types.isVariableDeclarator(c)) {
355
+ e._namedExportsOrder = tt(c.init);
356
356
  return;
357
357
  }
358
- e._storyExports[d] = l, e._storyPaths[d] = t, e._storyStatements[d] = i;
358
+ e._storyExports[d] = c, e._storyPaths[d] = t, e._storyStatements[d] = i;
359
359
  let g = (0, v.storyNameFromExport)(d);
360
360
  e._storyAnnotations[d] ? re.logger.warn(
361
361
  `Unexpected annotations for "${d}" before story declaration`
362
362
  ) : e._storyAnnotations[d] = {};
363
363
  let x;
364
- if (c.types.isVariableDeclarator(l) ? x = c.types.isTSAsExpression(l.init) || c.types.isTSSatisfiesExpression(l.init) ? l.init.
365
- expression : l.init : x = l, c.types.isCallExpression(x) && c.types.isMemberExpression(x.callee) && c.types.isIdentifier(x.callee.
364
+ if (l.types.isVariableDeclarator(c) ? x = l.types.isTSAsExpression(c.init) || l.types.isTSSatisfiesExpression(c.init) ? c.init.
365
+ expression : c.init : x = c, l.types.isCallExpression(x) && l.types.isMemberExpression(x.callee) && l.types.isIdentifier(x.callee.
366
366
  property) && (x.callee.property.name === "story" || x.callee.property.name === "extend") && (p = !0, x = x.arguments[0]), e._metaIsFactory &&
367
367
  !p)
368
- throw new M(
368
+ throw new L(
369
369
  "expected factory story",
370
370
  x,
371
371
  e._options.fileName
372
372
  );
373
373
  if (!e._metaIsFactory && p)
374
- throw e._metaNode ? new M(
374
+ throw e._metaNode ? new L(
375
375
  "expected non-factory story",
376
376
  x,
377
377
  e._options.fileName
378
- ) : new U(
378
+ ) : new M(
379
379
  "meta() factory must be imported from .storybook/preview configuration",
380
380
  x,
381
381
  e._options.fileName
382
382
  );
383
383
  let h = {};
384
- c.types.isObjectExpression(x) ? (h.__isArgsStory = !0, x.properties.forEach((b) => {
385
- if (c.types.isIdentifier(b.key)) {
384
+ l.types.isObjectExpression(x) ? (h.__isArgsStory = !0, x.properties.forEach((b) => {
385
+ if (l.types.isIdentifier(b.key)) {
386
386
  if (b.key.name === "render")
387
387
  h.__isArgsStory = ue(
388
388
  b.value,
389
- o,
389
+ a,
390
390
  e
391
391
  );
392
- else if (b.key.name === "name" && c.types.isStringLiteral(b.value))
392
+ else if (b.key.name === "name" && l.types.isStringLiteral(b.value))
393
393
  g = b.value.value;
394
- else if (b.key.name === "storyName" && c.types.isStringLiteral(b.value))
394
+ else if (b.key.name === "storyName" && l.types.isStringLiteral(b.value))
395
395
  re.logger.warn(
396
396
  `Unexpected usage of "storyName" in "${d}". Please use "name" instead.`
397
397
  );
398
- else if (b.key.name === "parameters" && c.types.isObjectExpression(b.value)) {
399
- let E = b.value.properties.find(
400
- (I) => c.types.isObjectProperty(I) && c.types.isIdentifier(I.key) && I.key.name === "__id"
398
+ else if (b.key.name === "parameters" && l.types.isObjectExpression(b.value)) {
399
+ let _ = b.value.properties.find(
400
+ (W) => l.types.isObjectProperty(W) && l.types.isIdentifier(W.key) && W.key.name === "__id"
401
401
  );
402
- E && (h.__id = E.value.value);
402
+ _ && (h.__id = _.value.value);
403
403
  }
404
404
  e._storyAnnotations[d][b.key.name] = b.value;
405
405
  }
406
- })) : h.__isArgsStory = ue(x, o, e), e._stories[d] = {
406
+ })) : h.__isArgsStory = ue(x, a, e), e._stories[d] = {
407
407
  id: "FIXME",
408
408
  name: g,
409
409
  parameters: h,
@@ -412,19 +412,19 @@ var D = /* @__PURE__ */ f((s, e) => {
412
412
  }
413
413
  };
414
414
  }
415
- }) : i.specifiers.length > 0 && i.specifiers.forEach((l) => {
416
- if (c.types.isExportSpecifier(l) && c.types.isIdentifier(l.exported)) {
417
- let { name: p } = l.exported, { name: d } = l.local, g = c.types.isProgram(o) ? P(d, o) : l.local;
415
+ }) : i.specifiers.length > 0 && i.specifiers.forEach((c) => {
416
+ if (l.types.isExportSpecifier(c) && l.types.isIdentifier(c.exported)) {
417
+ let { name: p } = c.exported, { name: d } = c.local, g = l.types.isProgram(a) ? P(d, a) : c.local;
418
418
  if (p === "default") {
419
419
  let x;
420
- c.types.isObjectExpression(g) ? x = g : (
420
+ l.types.isObjectExpression(g) ? x = g : (
421
421
  // export default { ... } as Meta<...>
422
- c.types.isTSAsExpression(g) && c.types.isObjectExpression(g.expression) && (x = g.expression)
423
- ), x && c.types.isProgram(o) && e._parseMeta(x, o);
422
+ l.types.isTSAsExpression(g) && l.types.isObjectExpression(g.expression) && (x = g.expression)
423
+ ), x && l.types.isProgram(a) && e._parseMeta(x, a);
424
424
  } else {
425
425
  let x = {}, h = g;
426
- c.types.isObjectExpression(h) && h.properties.forEach((b) => {
427
- c.types.isIdentifier(b.key) && (x[b.key.name] = b.value);
426
+ l.types.isObjectExpression(h) && h.properties.forEach((b) => {
427
+ l.types.isIdentifier(b.key) && (x[b.key.name] = b.value);
428
428
  }), e._storyAnnotations[p] = x, e._storyStatements[p] = g, e._storyPaths[p] = t, e._stories[p] = {
429
429
  id: "FIXME",
430
430
  name: p,
@@ -439,14 +439,14 @@ var D = /* @__PURE__ */ f((s, e) => {
439
439
  },
440
440
  ExpressionStatement: {
441
441
  enter({ node: t, parent: i }) {
442
- let { expression: o } = t;
443
- if (c.types.isProgram(i) && c.types.isAssignmentExpression(o) && c.types.isMemberExpression(o.left) && c.types.isIdentifier(o.left.
444
- object) && c.types.isIdentifier(o.left.property)) {
445
- let a = o.left.object.name, l = o.left.property.name, p = o.right;
446
- if (e._storyAnnotations[a] && (l === "story" && c.types.isObjectExpression(p) ? p.properties.forEach((d) => {
447
- c.types.isIdentifier(d.key) && (e._storyAnnotations[a][d.key.name] = d.value);
448
- }) : e._storyAnnotations[a][l] = p), l === "storyName" && c.types.isStringLiteral(p)) {
449
- let d = p.value, g = e._stories[a];
442
+ let { expression: a } = t;
443
+ if (l.types.isProgram(i) && l.types.isAssignmentExpression(a) && l.types.isMemberExpression(a.left) && l.types.isIdentifier(a.left.
444
+ object) && l.types.isIdentifier(a.left.property)) {
445
+ let o = a.left.object.name, c = a.left.property.name, p = a.right;
446
+ if (e._storyAnnotations[o] && (c === "story" && l.types.isObjectExpression(p) ? p.properties.forEach((d) => {
447
+ l.types.isIdentifier(d.key) && (e._storyAnnotations[o][d.key.name] = d.value);
448
+ }) : e._storyAnnotations[o][c] = p), c === "storyName" && l.types.isStringLiteral(p)) {
449
+ let d = p.value, g = e._stories[o];
450
450
  if (!g)
451
451
  return;
452
452
  g.name = d;
@@ -456,24 +456,24 @@ var D = /* @__PURE__ */ f((s, e) => {
456
456
  },
457
457
  CallExpression: {
458
458
  enter(t) {
459
- let { node: i } = t, { callee: o } = i;
460
- if (c.types.isIdentifier(o) && o.name === "storiesOf")
459
+ let { node: i } = t, { callee: a } = i;
460
+ if (l.types.isIdentifier(a) && a.name === "storiesOf")
461
461
  throw new Error(O.dedent`
462
462
  Unexpected \`storiesOf\` usage: ${D(i, e._options.fileName)}.
463
463
 
464
464
  SB8 does not support \`storiesOf\`.
465
465
  `);
466
- if (c.types.isMemberExpression(o) && c.types.isIdentifier(o.property) && o.property.name === "meta" && c.types.isIdentifier(o.object) &&
466
+ if (l.types.isMemberExpression(a) && l.types.isIdentifier(a.property) && a.property.name === "meta" && l.types.isIdentifier(a.object) &&
467
467
  i.arguments.length > 0) {
468
- let l = t.scope.getBinding(o.object.name)?.path?.parentPath?.node;
469
- if (c.types.isImportDeclaration(l))
470
- if (xe(l.source.value)) {
468
+ let c = t.scope.getBinding(a.object.name)?.path?.parentPath?.node;
469
+ if (l.types.isImportDeclaration(c))
470
+ if (xe(c.source.value)) {
471
471
  let p = i.arguments[0];
472
- e._metaVariableName = o.property.name, e._metaIsFactory = !0, e._parseMeta(p, e._ast.program);
472
+ e._metaVariableName = a.property.name, e._metaIsFactory = !0, e._parseMeta(p, e._ast.program);
473
473
  } else
474
- throw new U(
474
+ throw new M(
475
475
  "meta() factory must be imported from .storybook/preview configuration",
476
- l,
476
+ c,
477
477
  e._options.fileName
478
478
  );
479
479
  }
@@ -482,36 +482,36 @@ var D = /* @__PURE__ */ f((s, e) => {
482
482
  ImportDeclaration: {
483
483
  enter({ node: t }) {
484
484
  let { source: i } = t;
485
- if (c.types.isStringLiteral(i))
485
+ if (l.types.isStringLiteral(i))
486
486
  e.imports.push(i.value);
487
487
  else
488
488
  throw new Error("CSF: unexpected import source");
489
489
  }
490
490
  }
491
491
  }), !e._meta)
492
- throw new L("missing default export", e._ast, e._options.fileName);
492
+ throw new R("missing default export", e._ast, e._options.fileName);
493
493
  let r = Object.entries(e._stories);
494
494
  if (e._meta.title = this._options.makeTitle(e._meta?.title), e._metaAnnotations.play && (e._meta.tags = [...e._meta.tags || [], "play-fn"]),
495
495
  e._stories = r.reduce(
496
- (t, [i, o]) => {
496
+ (t, [i, a]) => {
497
497
  if (!(0, v.isExportStory)(i, e._meta))
498
498
  return t;
499
- let a = o.parameters?.__id ?? (0, v.toId)(e._meta?.id || e._meta?.title, (0, v.storyNameFromExport)(i)), l = { ...o.parameters, __id: a },
499
+ let o = a.parameters?.__id ?? (0, v.toId)(e._meta?.id || e._meta?.title, (0, v.storyNameFromExport)(i)), c = { ...a.parameters, __id: o },
500
500
  { includeStories: p } = e._meta || {};
501
- i === "__page" && (r.length === 1 || Array.isArray(p) && p.length === 1) && (l.docsOnly = !0), t[i] = { ...o, id: a, parameters: l };
501
+ i === "__page" && (r.length === 1 || Array.isArray(p) && p.length === 1) && (c.docsOnly = !0), t[i] = { ...a, id: o, parameters: c };
502
502
  let d = e._storyAnnotations[i], { tags: g, play: x } = d;
503
503
  if (g) {
504
- let E = c.types.isIdentifier(g) ? P(g.name, this._ast.program) : g;
505
- t[i].tags = me(E);
504
+ let _ = l.types.isIdentifier(g) ? P(g.name, this._ast.program) : g;
505
+ t[i].tags = me(_);
506
506
  }
507
507
  x && (t[i].tags = [...t[i].tags || [], "play-fn"]);
508
508
  let h = t[i].__stats;
509
- ["play", "render", "loaders", "beforeEach", "globals", "tags"].forEach((E) => {
510
- h[E] = !!d[E] || !!e._metaAnnotations[E];
509
+ ["play", "render", "loaders", "beforeEach", "globals", "tags"].forEach((_) => {
510
+ h[_] = !!d[_] || !!e._metaAnnotations[_];
511
511
  });
512
512
  let b = e.getStoryExport(i);
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;
513
+ return h.storyFn = !!(l.types.isArrowFunctionExpression(b) || l.types.isFunctionDeclaration(b)), h.mount = rt(d.play ?? e._metaAnnotations.
514
+ play), h.moduleMock = !!e.imports.find((_) => ye(_)), t;
515
515
  },
516
516
  {}
517
517
  ), Object.keys(e._storyExports).forEach((t) => {
@@ -523,7 +523,7 @@ var D = /* @__PURE__ */ f((s, e) => {
523
523
  if (t.length !== i.length)
524
524
  throw new Error(
525
525
  `Missing exports after sort: ${t.filter(
526
- (o) => !i.includes(o)
526
+ (a) => !i.includes(a)
527
527
  )}`
528
528
  );
529
529
  }
@@ -562,13 +562,13 @@ var D = /* @__PURE__ */ f((s, e) => {
562
562
  code: s,
563
563
  filename: e = "",
564
564
  ast: r
565
- }) => new c.BabelFileClass({ filename: e }, { code: s, ast: r ?? (0, c.babelParse)(s) }), "babelParseFile"), Q = /* @__PURE__ */ f((s, e) => {
566
- let r = (0, c.babelParse)(s), t = be({ code: s, filename: e.fileName, ast: r });
565
+ }) => new l.BabelFileClass({ filename: e }, { code: s, ast: r ?? (0, l.babelParse)(s) }), "babelParseFile"), Q = /* @__PURE__ */ f((s, e) => {
566
+ let r = (0, l.babelParse)(s), t = be({ code: s, filename: e.fileName, ast: r });
567
567
  return new K(r, e, t);
568
568
  }, "loadCsf"), ie = /* @__PURE__ */ f((s, e = { sourceMaps: !1 }, r) => {
569
- let t = (0, c.generate)(s._ast, e, r);
569
+ let t = (0, l.generate)(s._ast, e, r);
570
570
  return e.sourceMaps ? t : t.code;
571
- }, "formatCsf"), he = /* @__PURE__ */ f((s, e = {}) => c.recast.print(s._ast, e), "printCsf"), st = /* @__PURE__ */ f(async (s, e) => {
571
+ }, "formatCsf"), he = /* @__PURE__ */ f((s, e = {}) => l.recast.print(s._ast, e), "printCsf"), st = /* @__PURE__ */ f(async (s, e) => {
572
572
  let r = (await (0, J.readFile)(s, "utf-8")).toString();
573
573
  return Q(r, { ...e, fileName: s });
574
574
  }, "readCsf"), nt = /* @__PURE__ */ f(async (s, e) => {
@@ -578,20 +578,20 @@ var D = /* @__PURE__ */ f((s, e) => {
578
578
  }, "writeCsf");
579
579
 
580
580
  // src/csf-tools/ConfigFile.ts
581
- var te = require("node:fs/promises"), n = require("storybook/internal/babel"), H = require("storybook/internal/node-logger"), Ee = z(R(), 1);
581
+ var te = require("node:fs/promises"), n = require("storybook/internal/babel"), H = require("storybook/internal/node-logger"), Ee = z($(), 1);
582
582
  var se = /* @__PURE__ */ f(({
583
583
  expectedType: s,
584
584
  foundType: e,
585
585
  node: r
586
586
  }) => Ee.dedent`
587
587
  CSF Parsing error: Expected '${s}' but found '${e}' instead in '${r?.type}'.
588
- `, "getCsfParsingErrorMessage"), C = /* @__PURE__ */ f((s) => n.types.isIdentifier(s.key) ? s.key.name : n.types.isStringLiteral(s.key) ?
588
+ `, "getCsfParsingErrorMessage"), F = /* @__PURE__ */ f((s) => n.types.isIdentifier(s.key) ? s.key.name : n.types.isStringLiteral(s.key) ?
589
589
  s.key.value : null, "propKey"), Y = /* @__PURE__ */ f((s) => n.types.isTSAsExpression(s) || n.types.isTSSatisfiesExpression(s) ? Y(s.expression) :
590
590
  s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
591
591
  if (s.length === 0)
592
592
  return e;
593
593
  if (n.types.isObjectExpression(e)) {
594
- let [r, ...t] = s, i = e.properties.find((o) => C(o) === r);
594
+ let [r, ...t] = s, i = e.properties.find((a) => F(a) === r);
595
595
  if (i)
596
596
  return _e(t, i.value);
597
597
  }
@@ -602,26 +602,26 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
602
602
  throw new Error("Expected object expression");
603
603
  }
604
604
  if (n.types.isObjectExpression(e)) {
605
- let [r, ...t] = s, i = e.properties.find((o) => C(o) === r);
605
+ let [r, ...t] = s, i = e.properties.find((a) => F(a) === r);
606
606
  if (i)
607
607
  return t.length === 0 ? e.properties : je(t, i.value);
608
608
  }
609
609
  }, "_getPathProperties"), Z = /* @__PURE__ */ f((s, e) => {
610
610
  let r = null, t = null;
611
611
  return e.body.find((i) => (n.types.isVariableDeclaration(i) ? t = i.declarations : n.types.isExportNamedDeclaration(i) && n.types.isVariableDeclaration(
612
- i.declaration) && (t = i.declaration.declarations), t && t.find((o) => n.types.isVariableDeclarator(o) && n.types.isIdentifier(o.id) && o.
613
- id.name === s ? (r = o, !0) : !1))), r;
614
- }, "_findVarDeclarator"), F = /* @__PURE__ */ f((s, e) => Z(s, e)?.init, "_findVarInitialization"), B = /* @__PURE__ */ f((s, e) => {
612
+ i.declaration) && (t = i.declaration.declarations), t && t.find((a) => n.types.isVariableDeclarator(a) && n.types.isIdentifier(a.id) && a.
613
+ id.name === s ? (r = a, !0) : !1))), r;
614
+ }, "_findVarDeclarator"), w = /* @__PURE__ */ f((s, e) => Z(s, e)?.init, "_findVarInitialization"), q = /* @__PURE__ */ f((s, e) => {
615
615
  if (s.length === 0)
616
616
  return e;
617
- let [r, ...t] = s, i = B(t, e);
617
+ let [r, ...t] = s, i = q(t, e);
618
618
  return n.types.objectExpression([n.types.objectProperty(n.types.identifier(r), i)]);
619
- }, "_makeObjectExpression"), q = /* @__PURE__ */ f((s, e, r) => {
620
- let [t, ...i] = s, o = r.properties.find(
621
- (a) => C(a) === t
619
+ }, "_makeObjectExpression"), U = /* @__PURE__ */ f((s, e, r) => {
620
+ let [t, ...i] = s, a = r.properties.find(
621
+ (o) => F(o) === t
622
622
  );
623
- o ? n.types.isObjectExpression(o.value) && i.length > 0 ? q(i, e, o.value) : o.value = B(i, e) : r.properties.push(
624
- n.types.objectProperty(n.types.identifier(t), B(i, e))
623
+ a ? n.types.isObjectExpression(a.value) && i.length > 0 ? U(i, e, a.value) : a.value = q(i, e) : r.properties.push(
624
+ n.types.objectProperty(n.types.identifier(t), q(i, e))
625
625
  );
626
626
  }, "_updateExportNode"), ee = class {
627
627
  constructor(e, r, t) {
@@ -638,10 +638,10 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
638
638
  }
639
639
  _parseExportsObject(e) {
640
640
  this._exportsObject = e, e.properties.forEach((r) => {
641
- let t = C(r);
641
+ let t = F(r);
642
642
  if (t) {
643
643
  let i = r.value;
644
- n.types.isIdentifier(i) && (i = F(i.name, this._ast.program)), this._exports[t] = i;
644
+ n.types.isIdentifier(i) && (i = w(i.name, this._ast.program)), this._exports[t] = i;
645
645
  }
646
646
  });
647
647
  }
@@ -651,7 +651,7 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
651
651
  ExportDefaultDeclaration: {
652
652
  enter({ node: r, parent: t }) {
653
653
  e.hasDefaultExport = !0;
654
- let i = n.types.isIdentifier(r.declaration) && n.types.isProgram(t) ? F(r.declaration.name, t) : r.declaration;
654
+ let i = n.types.isIdentifier(r.declaration) && n.types.isProgram(t) ? w(r.declaration.name, t) : r.declaration;
655
655
  i = Y(i), n.types.isCallExpression(i) && n.types.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.types.isObjectExpression(
656
656
  i) ? e._parseExportsObject(i) : H.logger.warn(
657
657
  se({
@@ -667,20 +667,20 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
667
667
  if (n.types.isVariableDeclaration(r.declaration))
668
668
  r.declaration.declarations.forEach((i) => {
669
669
  if (n.types.isVariableDeclarator(i) && n.types.isIdentifier(i.id)) {
670
- let { name: o } = i.id, a = i.init;
671
- n.types.isIdentifier(a) && (a = F(a.name, t)), e._exports[o] = a, e._exportDecls[o] = i;
670
+ let { name: a } = i.id, o = i.init;
671
+ n.types.isIdentifier(o) && (o = w(o.name, t)), e._exports[a] = o, e._exportDecls[a] = i;
672
672
  }
673
673
  });
674
674
  else if (n.types.isFunctionDeclaration(r.declaration)) {
675
675
  let i = r.declaration;
676
676
  if (n.types.isIdentifier(i.id)) {
677
- let { name: o } = i.id;
678
- e._exportDecls[o] = i;
677
+ let { name: a } = i.id;
678
+ e._exportDecls[a] = i;
679
679
  }
680
680
  } else r.specifiers ? r.specifiers.forEach((i) => {
681
681
  if (n.types.isExportSpecifier(i) && n.types.isIdentifier(i.local) && n.types.isIdentifier(i.exported)) {
682
- let { name: o } = i.local, { name: a } = i.exported, l = Z(o, t);
683
- l && (e._exports[a] = l.init, e._exportDecls[a] = l);
682
+ let { name: a } = i.local, { name: o } = i.exported, c = Z(a, t);
683
+ c && (e._exports[o] = c.init, e._exportDecls[o] = c);
684
684
  }
685
685
  }) : H.logger.warn(
686
686
  se({
@@ -694,16 +694,16 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
694
694
  ExpressionStatement: {
695
695
  enter({ node: r, parent: t }) {
696
696
  if (n.types.isAssignmentExpression(r.expression) && r.expression.operator === "=") {
697
- let { left: i, right: o } = r.expression;
697
+ let { left: i, right: a } = r.expression;
698
698
  if (n.types.isMemberExpression(i) && n.types.isIdentifier(i.object) && i.object.name === "module" && n.types.isIdentifier(i.property) &&
699
699
  i.property.name === "exports") {
700
- let a = o;
701
- n.types.isIdentifier(o) && (a = F(o.name, t)), a = Y(a), n.types.isObjectExpression(a) ? (e._exportsObject = a, a.properties.forEach(
702
- (l) => {
703
- let p = C(l);
700
+ let o = a;
701
+ n.types.isIdentifier(a) && (o = w(a.name, t)), o = Y(o), n.types.isObjectExpression(o) ? (e._exportsObject = o, o.properties.forEach(
702
+ (c) => {
703
+ let p = F(c);
704
704
  if (p) {
705
- let d = l.value;
706
- n.types.isIdentifier(d) && (d = F(
705
+ let d = c.value;
706
+ n.types.isIdentifier(d) && (d = w(
707
707
  d.name,
708
708
  t
709
709
  )), e._exports[p] = d;
@@ -711,8 +711,8 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
711
711
  })) : H.logger.warn(
712
712
  se({
713
713
  expectedType: "ObjectExpression",
714
- foundType: a?.type,
715
- node: a
714
+ foundType: o?.type,
715
+ node: o
716
716
  })
717
717
  );
718
718
  }
@@ -751,31 +751,31 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
751
751
  }
752
752
  }
753
753
  setFieldNode(e, r) {
754
- let [t, ...i] = e, o = this._exports[t];
754
+ let [t, ...i] = e, a = this._exports[t];
755
755
  if (this._exportsObject) {
756
- let p = this._exportsObject.properties.find((d) => C(d) === t);
756
+ let p = this._exportsObject.properties.find((d) => F(d) === t);
757
757
  if (p && n.types.isIdentifier(p.value)) {
758
758
  let d = Z(p.value.name, this._ast.program);
759
759
  if (d && n.types.isObjectExpression(d.init)) {
760
- q(i, r, d.init);
760
+ U(i, r, d.init);
761
761
  return;
762
762
  }
763
763
  }
764
- q(e, r, this._exportsObject), this._exports[e[0]] = r;
764
+ U(e, r, this._exportsObject), this._exports[e[0]] = r;
765
765
  return;
766
766
  }
767
- if (o && n.types.isObjectExpression(o) && i.length > 0) {
768
- q(i, r, o);
767
+ if (a && n.types.isObjectExpression(a) && i.length > 0) {
768
+ U(i, r, a);
769
769
  return;
770
770
  }
771
- let a = Z(t, this._ast.program);
772
- if (a && n.types.isObjectExpression(a.init)) {
773
- q(i, r, a.init);
771
+ let o = Z(t, this._ast.program);
772
+ if (o && n.types.isObjectExpression(o.init)) {
773
+ U(i, r, o.init);
774
774
  return;
775
775
  }
776
- if (o && i.length === 0 && this._exportDecls[e[0]]) {
777
- let l = this._exportDecls[e[0]];
778
- n.types.isVariableDeclarator(l) && (l.init = B([], r));
776
+ if (a && i.length === 0 && this._exportDecls[e[0]]) {
777
+ let c = this._exportDecls[e[0]];
778
+ n.types.isVariableDeclarator(c) && (c.init = q([], r));
779
779
  } else {
780
780
  if (this.hasDefaultExport)
781
781
  throw new Error(
@@ -784,10 +784,10 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
784
784
  )}" field as the default export is not an object in this file.`
785
785
  );
786
786
  {
787
- let l = B(i, r), p = n.types.exportNamedDeclaration(
788
- n.types.variableDeclaration("const", [n.types.variableDeclarator(n.types.identifier(t), l)])
787
+ let c = q(i, r), p = n.types.exportNamedDeclaration(
788
+ n.types.variableDeclaration("const", [n.types.variableDeclarator(n.types.identifier(t), c)])
789
789
  );
790
- this._exports[t] = l, this._ast.program.body.push(p);
790
+ this._exports[t] = c, this._ast.program.body.push(p);
791
791
  }
792
792
  }
793
793
  }
@@ -855,31 +855,31 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
855
855
  return t;
856
856
  }
857
857
  removeField(e) {
858
- let r = /* @__PURE__ */ f((i, o) => {
859
- let a = i.findIndex(
860
- (l) => n.types.isIdentifier(l.key) && l.key.name === o || n.types.isStringLiteral(l.key) && l.key.value === o
858
+ let r = /* @__PURE__ */ f((i, a) => {
859
+ let o = i.findIndex(
860
+ (c) => n.types.isIdentifier(c.key) && c.key.name === a || n.types.isStringLiteral(c.key) && c.key.value === a
861
861
  );
862
- a >= 0 && i.splice(a, 1);
862
+ o >= 0 && i.splice(o, 1);
863
863
  }, "removeProperty");
864
864
  if (e.length === 1) {
865
865
  let i = !1;
866
- if (this._ast.program.body.forEach((o) => {
867
- if (n.types.isExportNamedDeclaration(o) && n.types.isVariableDeclaration(o.declaration)) {
868
- let a = o.declaration.declarations[0];
869
- n.types.isIdentifier(a.id) && a.id.name === e[0] && (this._ast.program.body.splice(this._ast.program.body.indexOf(o), 1), i = !0);
866
+ if (this._ast.program.body.forEach((a) => {
867
+ if (n.types.isExportNamedDeclaration(a) && n.types.isVariableDeclaration(a.declaration)) {
868
+ let o = a.declaration.declarations[0];
869
+ n.types.isIdentifier(o.id) && o.id.name === e[0] && (this._ast.program.body.splice(this._ast.program.body.indexOf(a), 1), i = !0);
870
870
  }
871
- if (n.types.isExportDefaultDeclaration(o)) {
872
- let a = o.declaration;
873
- if (n.types.isIdentifier(a) && (a = F(a.name, this._ast.program)), a = Y(a), n.types.isObjectExpression(a)) {
874
- let l = a.properties;
875
- r(l, e[0]), i = !0;
871
+ if (n.types.isExportDefaultDeclaration(a)) {
872
+ let o = a.declaration;
873
+ if (n.types.isIdentifier(o) && (o = w(o.name, this._ast.program)), o = Y(o), n.types.isObjectExpression(o)) {
874
+ let c = o.properties;
875
+ r(c, e[0]), i = !0;
876
876
  }
877
877
  }
878
- if (n.types.isExpressionStatement(o) && n.types.isAssignmentExpression(o.expression) && n.types.isMemberExpression(o.expression.left) &&
879
- n.types.isIdentifier(o.expression.left.object) && o.expression.left.object.name === "module" && n.types.isIdentifier(o.expression.left.
880
- property) && o.expression.left.property.name === "exports" && n.types.isObjectExpression(o.expression.right)) {
881
- let a = o.expression.right.properties;
882
- r(a, e[0]), i = !0;
878
+ if (n.types.isExpressionStatement(a) && n.types.isAssignmentExpression(a.expression) && n.types.isMemberExpression(a.expression.left) &&
879
+ n.types.isIdentifier(a.expression.left.object) && a.expression.left.object.name === "module" && n.types.isIdentifier(a.expression.left.
880
+ property) && a.expression.left.property.name === "exports" && n.types.isObjectExpression(a.expression.right)) {
881
+ let o = a.expression.right.properties;
882
+ r(o, e[0]), i = !0;
883
883
  }
884
884
  }), i)
885
885
  return;
@@ -911,8 +911,8 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
911
911
  let t = this.getFieldNode(e);
912
912
  if (t)
913
913
  if (n.types.isArrayExpression(t)) {
914
- let i = t.elements.findIndex((o) => n.types.isStringLiteral(o) ? o.value === r : n.types.isObjectExpression(o) ? this._getPresetValue(
915
- o, "name") === r : this._getPnpWrappedValue(o) === r);
914
+ let i = t.elements.findIndex((a) => n.types.isStringLiteral(a) ? a.value === r : n.types.isObjectExpression(a) ? this._getPresetValue(
915
+ a, "name") === r : this._getPnpWrappedValue(a) === r);
916
916
  if (i >= 0)
917
917
  t.elements.splice(i, 1);
918
918
  else
@@ -933,12 +933,12 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
933
933
  valueToNode(e) {
934
934
  let r = this._inferQuotes(), t;
935
935
  if (r === "single") {
936
- let { code: i } = (0, n.generate)(n.types.valueToNode(e), { jsescOption: { quotes: r } }), o = (0, n.babelParse)(`const __x = ${i}`);
937
- (0, n.traverse)(o, {
936
+ let { code: i } = (0, n.generate)(n.types.valueToNode(e), { jsescOption: { quotes: r } }), a = (0, n.babelParse)(`const __x = ${i}`);
937
+ (0, n.traverse)(a, {
938
938
  VariableDeclaration: {
939
- enter({ node: a }) {
940
- a.declarations.length === 1 && n.types.isVariableDeclarator(a.declarations[0]) && n.types.isIdentifier(a.declarations[0].id) && a.
941
- declarations[0].id.name === "__x" && (t = a.declarations[0].init);
939
+ enter({ node: o }) {
940
+ o.declarations.length === 1 && n.types.isVariableDeclarator(o.declarations[0]) && n.types.isIdentifier(o.declarations[0].id) && o.
941
+ declarations[0].id.name === "__x" && (t = o.declarations[0].init);
942
942
  }
943
943
  }
944
944
  });
@@ -976,18 +976,18 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
976
976
  * @param fromImport - The module to import from
977
977
  */
978
978
  setRequireImport(e, r) {
979
- let t = this._ast.program.body.find((a) => {
980
- let l = n.types.isVariableDeclaration(a) && a.declarations.length === 1 && n.types.isVariableDeclarator(a.declarations[0]) && n.types.
981
- isCallExpression(a.declarations[0].init) && n.types.isIdentifier(a.declarations[0].init.callee) && a.declarations[0].init.callee.name ===
982
- "require" && n.types.isStringLiteral(a.declarations[0].init.arguments[0]) && (a.declarations[0].init.arguments[0].value === r || a.declarations[0].
979
+ let t = this._ast.program.body.find((o) => {
980
+ let c = n.types.isVariableDeclaration(o) && o.declarations.length === 1 && n.types.isVariableDeclarator(o.declarations[0]) && n.types.
981
+ isCallExpression(o.declarations[0].init) && n.types.isIdentifier(o.declarations[0].init.callee) && o.declarations[0].init.callee.name ===
982
+ "require" && n.types.isStringLiteral(o.declarations[0].init.arguments[0]) && (o.declarations[0].init.arguments[0].value === r || o.declarations[0].
983
983
  init.arguments[0].value === r.split("node:")[1]);
984
- return l && (r = a.declarations[0].init.arguments[0].value), l;
985
- }), i = /* @__PURE__ */ f((a) => n.types.isObjectPattern(t?.declarations[0].id) && t?.declarations[0].id.properties.find(
986
- (l) => n.types.isObjectProperty(l) && n.types.isIdentifier(l.key) && l.key.name === a
987
- ), "hasRequireSpecifier"), o = /* @__PURE__ */ f((a, l) => a.declarations.length === 1 && n.types.isVariableDeclarator(a.declarations[0]) &&
988
- n.types.isIdentifier(a.declarations[0].id) && a.declarations[0].id.name === l, "hasDefaultRequireSpecifier");
984
+ return c && (r = o.declarations[0].init.arguments[0].value), c;
985
+ }), i = /* @__PURE__ */ f((o) => n.types.isObjectPattern(t?.declarations[0].id) && t?.declarations[0].id.properties.find(
986
+ (c) => n.types.isObjectProperty(c) && n.types.isIdentifier(c.key) && c.key.name === o
987
+ ), "hasRequireSpecifier"), a = /* @__PURE__ */ f((o, c) => o.declarations.length === 1 && n.types.isVariableDeclarator(o.declarations[0]) &&
988
+ n.types.isIdentifier(o.declarations[0].id) && o.declarations[0].id.name === c, "hasDefaultRequireSpecifier");
989
989
  if (typeof e == "string") {
990
- let a = /* @__PURE__ */ f(() => {
990
+ let o = /* @__PURE__ */ f(() => {
991
991
  this._ast.program.body.unshift(
992
992
  n.types.variableDeclaration("const", [
993
993
  n.types.variableDeclarator(
@@ -997,17 +997,17 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
997
997
  ])
998
998
  );
999
999
  }, "addDefaultRequireSpecifier");
1000
- t && o(t, e) || a();
1001
- } else t ? e.forEach((a) => {
1002
- i(a) || t.declarations[0].id.properties.push(
1003
- n.types.objectProperty(n.types.identifier(a), n.types.identifier(a), void 0, !0)
1000
+ t && a(t, e) || o();
1001
+ } else t ? e.forEach((o) => {
1002
+ i(o) || t.declarations[0].id.properties.push(
1003
+ n.types.objectProperty(n.types.identifier(o), n.types.identifier(o), void 0, !0)
1004
1004
  );
1005
1005
  }) : this._ast.program.body.unshift(
1006
1006
  n.types.variableDeclaration("const", [
1007
1007
  n.types.variableDeclarator(
1008
1008
  n.types.objectPattern(
1009
1009
  e.map(
1010
- (a) => n.types.objectProperty(n.types.identifier(a), n.types.identifier(a), void 0, !0)
1010
+ (o) => n.types.objectProperty(n.types.identifier(o), n.types.identifier(o), void 0, !0)
1011
1011
  )
1012
1012
  ),
1013
1013
  n.types.callExpression(n.types.identifier("require"), [n.types.stringLiteral(r)])
@@ -1044,10 +1044,10 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
1044
1044
  let t = this._ast.program.body.find((p) => {
1045
1045
  let d = n.types.isImportDeclaration(p) && (p.source.value === r || p.source.value === r.split("node:")[1]);
1046
1046
  return d && (r = p.source.value), d;
1047
- }), i = /* @__PURE__ */ f((p) => n.types.importSpecifier(n.types.identifier(p), n.types.identifier(p)), "getNewImportSpecifier"), o = /* @__PURE__ */ f(
1047
+ }), i = /* @__PURE__ */ f((p) => n.types.importSpecifier(n.types.identifier(p), n.types.identifier(p)), "getNewImportSpecifier"), a = /* @__PURE__ */ f(
1048
1048
  (p, d) => p.specifiers.find(
1049
1049
  (g) => n.types.isImportSpecifier(g) && n.types.isIdentifier(g.imported) && g.imported.name === d
1050
- ), "hasImportSpecifier"), a = /* @__PURE__ */ f((p, d) => p.specifiers.find(
1050
+ ), "hasImportSpecifier"), o = /* @__PURE__ */ f((p, d) => p.specifiers.find(
1051
1051
  (g) => n.types.isImportNamespaceSpecifier(g) && n.types.isIdentifier(g.local) && g.local.name === d
1052
1052
  ), "hasNamespaceImportSpecifier");
1053
1053
  e === null ? t || this._ast.program.body.unshift(n.types.importDeclaration([], n.types.stringLiteral(r))) : typeof e == "string" ? t ? (/* @__PURE__ */ f(
@@ -1061,13 +1061,13 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
1061
1061
  n.types.stringLiteral(r)
1062
1062
  )
1063
1063
  ) : Array.isArray(e) ? t ? e.forEach((p) => {
1064
- o(t, p) || t.specifiers.push(i(p));
1064
+ a(t, p) || t.specifiers.push(i(p));
1065
1065
  }) : this._ast.program.body.unshift(
1066
1066
  n.types.importDeclaration(
1067
1067
  e.map(i),
1068
1068
  n.types.stringLiteral(r)
1069
1069
  )
1070
- ) : e.namespace && (t ? a(t, e.namespace) || t.specifiers.push(
1070
+ ) : e.namespace && (t ? o(t, e.namespace) || t.specifiers.push(
1071
1071
  n.types.importNamespaceSpecifier(n.types.identifier(e.namespace))
1072
1072
  ) : this._ast.program.body.unshift(
1073
1073
  n.types.importDeclaration(
@@ -1093,14 +1093,14 @@ s, "unwrap"), _e = /* @__PURE__ */ f((s, e) => {
1093
1093
  view")), "isCsfFactoryPreview");
1094
1094
 
1095
1095
  // src/csf-tools/getStorySortParameter.ts
1096
- var y = require("storybook/internal/babel"), De = require("storybook/internal/node-logger"), Ie = z(R(), 1);
1096
+ var y = require("storybook/internal/babel"), De = require("storybook/internal/node-logger"), Ie = z($(), 1);
1097
1097
  var ne = /* @__PURE__ */ f((s, e) => {
1098
1098
  let r;
1099
1099
  return s.properties.forEach((t) => {
1100
1100
  y.types.isIdentifier(t.key) && t.key.name === e && (r = t.value);
1101
1101
  }), r;
1102
1102
  }, "getValue"), oe = /* @__PURE__ */ f((s) => {
1103
- let e = W(s);
1103
+ let e = B(s);
1104
1104
  if (y.types.isArrayExpression(e))
1105
1105
  return e.elements.map((r) => oe(r));
1106
1106
  if (y.types.isObjectExpression(e))
@@ -1108,9 +1108,9 @@ var ne = /* @__PURE__ */ f((s, e) => {
1108
1108
  if (y.types.isLiteral(e))
1109
1109
  return e.value;
1110
1110
  if (y.types.isIdentifier(e))
1111
- return T(e.name, !0);
1111
+ return C(e.name, !0);
1112
1112
  throw new Error(`Unknown node type ${e.type}`);
1113
- }, "parseValue"), T = /* @__PURE__ */ f((s, e) => {
1113
+ }, "parseValue"), C = /* @__PURE__ */ f((s, e) => {
1114
1114
  let r = Ie.dedent`
1115
1115
  Unexpected '${s}'. Parameter 'options.storySort' should be defined inline e.g.:
1116
1116
 
@@ -1125,25 +1125,25 @@ var ne = /* @__PURE__ */ f((s, e) => {
1125
1125
  if (e)
1126
1126
  throw new Error(r);
1127
1127
  De.logger.log(r);
1128
- }, "unsupported"), W = /* @__PURE__ */ f((s) => y.types.isTSAsExpression(s) || y.types.isTSSatisfiesExpression(s) ? s.expression : s, "strip\
1128
+ }, "unsupported"), B = /* @__PURE__ */ f((s) => y.types.isTSAsExpression(s) || y.types.isTSSatisfiesExpression(s) ? s.expression : s, "strip\
1129
1129
  TSModifiers"), Ne = /* @__PURE__ */ f((s) => {
1130
- let e = W(s);
1130
+ let e = B(s);
1131
1131
  if (y.types.isObjectExpression(e)) {
1132
1132
  let r = ne(e, "options");
1133
1133
  if (r) {
1134
1134
  if (y.types.isObjectExpression(r))
1135
1135
  return ne(r, "storySort");
1136
- T("options", !0);
1136
+ C("options", !0);
1137
1137
  }
1138
1138
  }
1139
1139
  }, "parseParameters"), ve = /* @__PURE__ */ f((s, e) => {
1140
- let r = W(s);
1140
+ let r = B(s);
1141
1141
  if (y.types.isObjectExpression(r)) {
1142
1142
  let t = ne(r, "parameters");
1143
1143
  if (y.types.isIdentifier(t) && (t = P(t.name, e)), t)
1144
1144
  return Ne(t);
1145
1145
  } else
1146
- T("default", !0);
1146
+ C("default", !0);
1147
1147
  }, "parseDefault"), ct = /* @__PURE__ */ f((s) => {
1148
1148
  if (!s.includes("storySort"))
1149
1149
  return;
@@ -1153,22 +1153,22 @@ TSModifiers"), Ne = /* @__PURE__ */ f((s) => {
1153
1153
  enter({ node: t }) {
1154
1154
  y.types.isVariableDeclaration(t.declaration) ? t.declaration.declarations.forEach((i) => {
1155
1155
  if (y.types.isVariableDeclarator(i) && y.types.isIdentifier(i.id)) {
1156
- let { name: o } = i.id;
1157
- if (o === "parameters" && i.init) {
1158
- let a = W(i.init);
1159
- e = Ne(a);
1156
+ let { name: a } = i.id;
1157
+ if (a === "parameters" && i.init) {
1158
+ let o = B(i.init);
1159
+ e = Ne(o);
1160
1160
  }
1161
1161
  }
1162
1162
  }) : t.specifiers.forEach((i) => {
1163
- y.types.isIdentifier(i.exported) && i.exported.name === "parameters" && T("parameters", !1);
1163
+ y.types.isIdentifier(i.exported) && i.exported.name === "parameters" && C("parameters", !1);
1164
1164
  });
1165
1165
  }
1166
1166
  },
1167
1167
  ExportDefaultDeclaration: {
1168
1168
  enter({ node: t }) {
1169
1169
  let i = t.declaration;
1170
- y.types.isIdentifier(i) && (i = P(i.name, r.program)), i = W(i), y.types.isCallExpression(i) && y.types.isObjectExpression(i.arguments?.[0]) ?
1171
- e = ve(i.arguments[0], r.program) : y.types.isObjectExpression(i) ? e = ve(i, r.program) : T("default", !1);
1170
+ y.types.isIdentifier(i) && (i = P(i.name, r.program)), i = B(i), y.types.isCallExpression(i) && y.types.isObjectExpression(i.arguments?.[0]) ?
1171
+ e = ve(i.arguments[0], r.program) : y.types.isObjectExpression(i) ? e = ve(i, r.program) : C("default", !1);
1172
1172
  }
1173
1173
  }
1174
1174
  }), !!e) {
@@ -1177,21 +1177,21 @@ TSModifiers"), Ne = /* @__PURE__ */ f((s) => {
1177
1177
  return (0, eval)(t);
1178
1178
  }
1179
1179
  if (y.types.isFunctionExpression(e)) {
1180
- let { code: t } = (0, y.generate)(e, {}), i = e.id?.name, o = `(a, b) => {
1180
+ let { code: t } = (0, y.generate)(e, {}), i = e.id?.name, a = `(a, b) => {
1181
1181
  ${t};
1182
1182
  return ${i}(a, b)
1183
1183
  }`;
1184
- return (0, eval)(o);
1184
+ return (0, eval)(a);
1185
1185
  }
1186
- return y.types.isLiteral(e) || y.types.isArrayExpression(e) || y.types.isObjectExpression(e) ? oe(e) : T("storySort", !0);
1186
+ return y.types.isLiteral(e) || y.types.isArrayExpression(e) || y.types.isObjectExpression(e) ? oe(e) : C("storySort", !0);
1187
1187
  }
1188
1188
  }, "getStorySortParameter");
1189
1189
 
1190
1190
  // src/csf-tools/enrichCsf.ts
1191
1191
  var u = require("storybook/internal/babel");
1192
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.
1193
+ let i = e.getStoryExport(r), a = u.types.isCallExpression(i) && u.types.isMemberExpression(i.callee) && u.types.isIdentifier(i.callee.object) &&
1194
+ i.callee.object.name === "meta", o = !t?.disableSource && Te(i), c = !t?.disableDescription && ae(e._storyStatements[r]), p = [], d = a ? u.types.
1195
1195
  memberExpression(u.types.identifier(r), u.types.identifier("input")) : u.types.identifier(r), g = u.types.memberExpression(d, u.types.identifier(
1196
1196
  "parameters"));
1197
1197
  p.push(u.types.spreadElement(g));
@@ -1201,7 +1201,7 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
1201
1201
  !1,
1202
1202
  !0
1203
1203
  ), h = [];
1204
- if (a) {
1204
+ if (o) {
1205
1205
  let b = u.types.optionalMemberExpression(
1206
1206
  x,
1207
1207
  u.types.identifier("source"),
@@ -1212,13 +1212,13 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
1212
1212
  u.types.objectProperty(
1213
1213
  u.types.identifier("source"),
1214
1214
  u.types.objectExpression([
1215
- u.types.objectProperty(u.types.identifier("originalSource"), u.types.stringLiteral(a)),
1215
+ u.types.objectProperty(u.types.identifier("originalSource"), u.types.stringLiteral(o)),
1216
1216
  u.types.spreadElement(b)
1217
1217
  ])
1218
1218
  )
1219
1219
  );
1220
1220
  }
1221
- if (l) {
1221
+ if (c) {
1222
1222
  let b = u.types.optionalMemberExpression(
1223
1223
  x,
1224
1224
  u.types.identifier("description"),
@@ -1229,7 +1229,7 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
1229
1229
  u.types.objectProperty(
1230
1230
  u.types.identifier("description"),
1231
1231
  u.types.objectExpression([
1232
- u.types.objectProperty(u.types.identifier("story"), u.types.stringLiteral(l)),
1232
+ u.types.objectProperty(u.types.identifier("story"), u.types.stringLiteral(c)),
1233
1233
  u.types.spreadElement(b)
1234
1234
  ])
1235
1235
  )
@@ -1254,10 +1254,10 @@ var we = /* @__PURE__ */ f((s, e, r, t) => {
1254
1254
  ) || s.properties.unshift(r);
1255
1255
  return;
1256
1256
  }
1257
- let [t, ...i] = e, o = s.properties.find(
1258
- (l) => u.types.isObjectProperty(l) && u.types.isIdentifier(l.key) && l.key.name === t && u.types.isObjectExpression(l.value)
1259
- ), a;
1260
- o ? a = o.value : (a = u.types.objectExpression([]), s.properties.push(u.types.objectProperty(u.types.identifier(t), a))), Fe(a, i, r);
1257
+ let [t, ...i] = e, a = s.properties.find(
1258
+ (c) => u.types.isObjectProperty(c) && u.types.isIdentifier(c.key) && c.key.name === t && u.types.isObjectExpression(c.value)
1259
+ ), o;
1260
+ a ? o = a.value : (o = u.types.objectExpression([]), s.properties.push(u.types.objectProperty(u.types.identifier(t), o))), Fe(o, i, r);
1261
1261
  }, "addComponentDescription"), Ce = /* @__PURE__ */ f((s, e, r) => {
1262
1262
  let t = !r?.disableDescription && ae(e._metaStatement);
1263
1263
  if (t) {
@@ -1286,7 +1286,7 @@ var $e = require("storybook/internal/babel");
1286
1286
 
1287
1287
  // src/csf-tools/vitest-plugin/transformer.ts
1288
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);
1289
+ ce = z($(), 1);
1290
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
1291
  "isValidTest");
1292
1292
  async function Ae({
@@ -1295,19 +1295,17 @@ async function Ae({
1295
1295
  configDir: r,
1296
1296
  stories: t,
1297
1297
  tagsFilter: i,
1298
- previewLevelTags: o = []
1298
+ previewLevelTags: a = []
1299
1299
  }) {
1300
- if (!/\.stor(y|ies)\./.test(e))
1301
- return s;
1302
- let l = Q(s, {
1300
+ let o = Q(s, {
1303
1301
  fileName: e,
1304
1302
  transformInlineMeta: !0,
1305
- makeTitle: /* @__PURE__ */ f((_) => {
1303
+ makeTitle: /* @__PURE__ */ f((E) => {
1306
1304
  let S = (0, ke.getStoryTitle)({
1307
1305
  storyFilePath: e,
1308
1306
  configDir: r,
1309
1307
  stories: t,
1310
- userTitle: _
1308
+ userTitle: E
1311
1309
  }) || "unknown";
1312
1310
  return S === "unknown" && le.logger.warn(
1313
1311
  ce.dedent`
@@ -1316,10 +1314,10 @@ async function Ae({
1316
1314
  `
1317
1315
  ), S;
1318
1316
  }, "makeTitle")
1319
- }).parse(), p = l._ast, d = l._metaVariableName, g = l._metaNode, x = g.properties.find(
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.
1317
+ }).parse(), c = o._ast, p = o._metaVariableName, d = o._metaNode, g = d.properties.find(
1318
+ (E) => m.types.isObjectProperty(E) && m.types.isIdentifier(E.key) && E.key.name === "title"
1319
+ ), x = m.types.stringLiteral(o._meta?.title || "unknown");
1320
+ if (g ? m.types.isObjectProperty(g) && (g.value = x) : d.properties.push(m.types.objectProperty(m.types.identifier("title"), x)), !d || !o.
1323
1321
  _meta)
1324
1322
  throw new Error(
1325
1323
  `The Storybook vitest plugin could not detect the meta (default export) object in the story file.
@@ -1327,49 +1325,49 @@ async function Ae({
1327
1325
  Please make sure you have a default export with the meta object. If you are using a different export format that is not supported, please fi\
1328
1326
  le an issue with details about your use case.`
1329
1327
  );
1330
- let b = {};
1331
- Object.keys(l._stories).map((_) => {
1328
+ let h = {};
1329
+ Object.keys(o._stories).map((E) => {
1332
1330
  let S = (0, Ve.combineTags)(
1333
1331
  "test",
1334
1332
  "dev",
1335
- ...o,
1336
- ...l.meta?.tags || [],
1337
- ...l._stories[_].tags || []
1333
+ ...a,
1334
+ ...o.meta?.tags || [],
1335
+ ...o._stories[E].tags || []
1338
1336
  );
1339
- ft(S, i) && (b[_] = l._storyStatements[_]);
1337
+ ft(S, i) && (h[E] = o._storyStatements[E]);
1340
1338
  });
1341
- let E = l._file.path.scope.generateUidIdentifier("test"), I = l._file.path.scope.generateUidIdentifier("describe");
1342
- if (Object.keys(b).length === 0) {
1343
- let _ = m.types.expressionStatement(
1344
- m.types.callExpression(m.types.memberExpression(I, m.types.identifier("skip")), [
1339
+ let b = o._file.path.scope.generateUidIdentifier("test"), _ = o._file.path.scope.generateUidIdentifier("describe");
1340
+ if (Object.keys(h).length === 0) {
1341
+ let E = m.types.expressionStatement(
1342
+ m.types.callExpression(m.types.memberExpression(_, m.types.identifier("skip")), [
1345
1343
  m.types.stringLiteral("No valid tests found")
1346
1344
  ])
1347
1345
  );
1348
- p.program.body.push(_);
1346
+ c.program.body.push(E);
1349
1347
  let S = [
1350
1348
  m.types.importDeclaration(
1351
1349
  [
1352
- m.types.importSpecifier(E, m.types.identifier("test")),
1353
- m.types.importSpecifier(I, m.types.identifier("describe"))
1350
+ m.types.importSpecifier(b, m.types.identifier("test")),
1351
+ m.types.importSpecifier(_, m.types.identifier("describe"))
1354
1352
  ],
1355
1353
  m.types.stringLiteral("vitest")
1356
1354
  )
1357
1355
  ];
1358
- p.program.body.unshift(...S);
1356
+ c.program.body.unshift(...S);
1359
1357
  } else {
1360
1358
  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")), []),
1359
+ let j = o._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), I = m.types.memberExpression(
1360
+ m.types.callExpression(m.types.memberExpression(E, m.types.identifier("getState")), []),
1363
1361
  m.types.identifier("testPath")
1364
- ), k = m.types.memberExpression(
1362
+ ), T = m.types.memberExpression(
1365
1363
  m.types.memberExpression(m.types.identifier("globalThis"), m.types.identifier("__vitest_worker__")),
1366
1364
  m.types.identifier("filepath")
1367
- ), V = m.types.logicalExpression(
1365
+ ), k = m.types.logicalExpression(
1368
1366
  "??",
1369
1367
  // TODO: switch order of testPathProperty and filePathProperty when the bug is fixed
1370
1368
  // https://github.com/vitest-dev/vitest/issues/6367 (or probably just use testPathProperty)
1371
- k,
1372
- N
1369
+ T,
1370
+ I
1373
1371
  ), G = m.types.callExpression(
1374
1372
  m.types.memberExpression(
1375
1373
  m.types.callExpression(m.types.identifier("convertToFilePath"), [
@@ -1380,37 +1378,37 @@ le an issue with details about your use case.`
1380
1378
  ]),
1381
1379
  m.types.identifier("includes")
1382
1380
  ),
1383
- [V]
1381
+ [k]
1384
1382
  );
1385
1383
  return { isRunningFromThisFileDeclaration: m.types.variableDeclaration("const", [
1386
1384
  m.types.variableDeclarator(j, G)
1387
1385
  ]), isRunningFromThisFileId: j };
1388
1386
  };
1389
- var mt = pe;
1387
+ var W = pe;
1390
1388
  f(pe, "getTestGuardDeclaration");
1391
- let _ = l._file.path.scope.generateUidIdentifier("expect"), S = l._file.path.scope.generateUidIdentifier("testStory"), Re = m.types.identifier(
1389
+ let E = o._file.path.scope.generateUidIdentifier("expect"), S = o._file.path.scope.generateUidIdentifier("testStory"), Re = m.types.identifier(
1392
1390
  JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Le, isRunningFromThisFileId: Me } = pe();
1393
- p.program.body.push(Le);
1391
+ c.program.body.push(Le);
1394
1392
  let Ue = /* @__PURE__ */ f(({
1395
1393
  localName: j,
1396
- exportName: N,
1397
- testTitle: k,
1398
- node: V
1394
+ exportName: I,
1395
+ testTitle: T,
1396
+ node: k
1399
1397
  }) => {
1400
1398
  let G = m.types.expressionStatement(
1401
- m.types.callExpression(E, [
1402
- m.types.stringLiteral(k),
1399
+ m.types.callExpression(b, [
1400
+ m.types.stringLiteral(T),
1403
1401
  m.types.callExpression(S, [
1404
- m.types.stringLiteral(N),
1402
+ m.types.stringLiteral(I),
1405
1403
  m.types.identifier(j),
1406
- m.types.identifier(d),
1404
+ m.types.identifier(p),
1407
1405
  Re
1408
1406
  ])
1409
1407
  ])
1410
1408
  );
1411
- return G.loc = V.loc, G;
1412
- }, "getTestStatementForStory"), qe = Object.entries(b).map(([j, N]) => {
1413
- if (N === null) {
1409
+ return G.loc = k.loc, G;
1410
+ }, "getTestStatementForStory"), qe = Object.entries(h).map(([j, I]) => {
1411
+ if (I === null) {
1414
1412
  le.logger.warn(
1415
1413
  ce.dedent`
1416
1414
  [Storybook]: Could not transform "${j}" story into test at "${e}".
@@ -1419,15 +1417,15 @@ le an issue with details about your use case.`
1419
1417
  );
1420
1418
  return;
1421
1419
  }
1422
- let k = l._stories[j].localName ?? j, V = l._stories[j].name ?? j;
1423
- return Ue({ testTitle: V, localName: k, exportName: j, node: N });
1420
+ let T = o._stories[j].localName ?? j, k = o._stories[j].name ?? j;
1421
+ return Ue({ testTitle: k, localName: T, exportName: j, node: I });
1424
1422
  }).filter((j) => !!j), Be = m.types.ifStatement(Me, m.types.blockStatement(qe));
1425
- p.program.body.push(Be);
1423
+ c.program.body.push(Be);
1426
1424
  let We = [
1427
1425
  m.types.importDeclaration(
1428
1426
  [
1429
- m.types.importSpecifier(E, m.types.identifier("test")),
1430
- m.types.importSpecifier(_, m.types.identifier("expect"))
1427
+ m.types.importSpecifier(b, m.types.identifier("test")),
1428
+ m.types.importSpecifier(E, m.types.identifier("expect"))
1431
1429
  ],
1432
1430
  m.types.stringLiteral("vitest")
1433
1431
  ),
@@ -1439,8 +1437,8 @@ le an issue with details about your use case.`
1439
1437
  m.types.stringLiteral("@storybook/addon-vitest/internal/test-utils")
1440
1438
  )
1441
1439
  ];
1442
- p.program.body.unshift(...We);
1440
+ c.program.body.unshift(...We);
1443
1441
  }
1444
- return ie(l, { sourceMaps: !0, sourceFileName: e }, s);
1442
+ return ie(o, { sourceMaps: !0, sourceFileName: e }, s);
1445
1443
  }
1446
1444
  f(Ae, "vitestTransform");