storybook 9.1.0-alpha.7 → 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.
@@ -27,10 +27,10 @@ var U = (s, e, r) => (r = s != null ? ke($e(s)) : {}, Me(
27
27
  ));
28
28
 
29
29
  // ../node_modules/ts-dedent/dist/index.js
30
- var V = Le((k) => {
30
+ var k = Le((T) => {
31
31
  "use strict";
32
- Object.defineProperty(k, "__esModule", { value: !0 });
33
- k.dedent = void 0;
32
+ Object.defineProperty(T, "__esModule", { value: !0 });
33
+ T.dedent = void 0;
34
34
  function se(s) {
35
35
  for (var e = [], r = 1; r < arguments.length; r++)
36
36
  e[r - 1] = arguments[r];
@@ -44,32 +44,32 @@ var V = Le((k) => {
44
44
  })) : l;
45
45
  }, []);
46
46
  if (i.length) {
47
- var o = new RegExp(`
47
+ var a = new RegExp(`
48
48
  [ ]{` + Math.min.apply(Math, i) + "}", "g");
49
49
  t = t.map(function(l) {
50
- return l.replace(o, `
50
+ return l.replace(a, `
51
51
  `);
52
52
  });
53
53
  }
54
54
  t[0] = t[0].replace(/^\r?\n/, "");
55
- var a = t[0];
55
+ var o = t[0];
56
56
  return e.forEach(function(l, p) {
57
- var d = a.match(/(?:^|\n)( *)$/), u = d ? d[1] : "", x = l;
57
+ var d = o.match(/(?:^|\n)( *)$/), u = d ? d[1] : "", x = l;
58
58
  typeof l == "string" && l.includes(`
59
59
  `) && (x = String(l).split(`
60
60
  `).map(function(b, y) {
61
61
  return y === 0 ? b : "" + u + b;
62
62
  }).join(`
63
- `)), a += x + t[p + 1];
64
- }), a;
63
+ `)), o += x + t[p + 1];
64
+ }), o;
65
65
  }
66
66
  f(se, "dedent");
67
- k.dedent = se;
68
- k.default = se;
67
+ T.dedent = se;
68
+ T.default = se;
69
69
  });
70
70
 
71
71
  // src/csf-tools/CsfFile.ts
72
- var O = U(V(), 1);
72
+ var O = U(k(), 1);
73
73
  import { readFile as Ue, writeFile as qe } from "node:fs/promises";
74
74
  import {
75
75
  BabelFileClass as Be,
@@ -83,11 +83,11 @@ import { isExportStory as ne, storyNameFromExport as oe, toId as ze } from "stor
83
83
  import { logger as ae } from "storybook/internal/node-logger";
84
84
 
85
85
  // src/csf-tools/findVarInitialization.ts
86
- import { types as A } from "storybook/internal/babel";
86
+ import { types as V } from "storybook/internal/babel";
87
87
  var P = /* @__PURE__ */ f((s, e) => {
88
88
  let r = null, t = null;
89
- return e.body.find((i) => (A.isVariableDeclaration(i) ? t = i.declarations : A.isExportNamedDeclaration(i) && A.isVariableDeclaration(i.declaration) &&
90
- (t = i.declaration.declarations), t && t.find((o) => A.isVariableDeclarator(o) && A.isIdentifier(o.id) && o.id.name === s ? (r = o.init, !0) :
89
+ return e.body.find((i) => (V.isVariableDeclaration(i) ? t = i.declarations : V.isExportNamedDeclaration(i) && V.isVariableDeclaration(i.declaration) &&
90
+ (t = i.declaration.declarations), t && t.find((a) => V.isVariableDeclarator(a) && V.isIdentifier(a.id) && a.id.name === s ? (r = a.init, !0) :
91
91
  !1))), r;
92
92
  }, "findVarInitialization");
93
93
 
@@ -127,11 +127,11 @@ var v = /* @__PURE__ */ f((s, e) => {
127
127
  }, "formatLocation"), Qe = /* @__PURE__ */ f((s) => Ze.test(s), "isModuleMock"), ce = /* @__PURE__ */ f((s, e, r) => {
128
128
  let t = s;
129
129
  if (c.isCallExpression(s)) {
130
- let { callee: i, arguments: o } = s;
130
+ let { callee: i, arguments: a } = s;
131
131
  if (c.isProgram(e) && c.isMemberExpression(i) && c.isIdentifier(i.object) && c.isIdentifier(i.property) && i.property.name === "bind" &&
132
- (o.length === 0 || o.length === 1 && c.isObjectExpression(o[0]) && o[0].properties.length === 0)) {
133
- let a = i.object.name, l = P(a, e);
134
- l && (r._templates[a] = l, t = l);
132
+ (a.length === 0 || a.length === 1 && c.isObjectExpression(a[0]) && a[0].properties.length === 0)) {
133
+ let o = i.object.name, l = P(o, e);
134
+ l && (r._templates[o] = l, t = l);
135
135
  }
136
136
  }
137
137
  return c.isArrowFunctionExpression(t) || c.isFunctionDeclaration(t) ? t.params.length > 0 : !1;
@@ -248,9 +248,9 @@ var v = /* @__PURE__ */ f((s, e) => {
248
248
  else if (["includeStories", "excludeStories"].includes(i.key.name))
249
249
  t[i.key.name] = Je(i.value);
250
250
  else if (i.key.name === "component") {
251
- let o = i.value;
252
- if (c.isIdentifier(o)) {
253
- let l = o.name, p = r.body.find(
251
+ let a = i.value;
252
+ if (c.isIdentifier(a)) {
253
+ let l = a.name, p = r.body.find(
254
254
  (d) => c.isImportDeclaration(d) && d.specifiers.find((u) => u.local.name === l)
255
255
  );
256
256
  if (p) {
@@ -258,11 +258,11 @@ var v = /* @__PURE__ */ f((s, e) => {
258
258
  c.isStringLiteral(d) && (this._rawComponentPath = d.value);
259
259
  }
260
260
  }
261
- let { code: a } = de.print(i.value, {});
262
- t.component = a;
261
+ let { code: o } = de.print(i.value, {});
262
+ t.component = o;
263
263
  } else if (i.key.name === "tags") {
264
- let o = i.value;
265
- c.isIdentifier(o) && (o = P(o.name, this._ast.program)), t.tags = le(o);
264
+ let a = i.value;
265
+ c.isIdentifier(a) && (a = P(a.name, this._ast.program)), t.tags = le(a);
266
266
  } else if (i.key.name === "id")
267
267
  if (c.isStringLiteral(i.value))
268
268
  t.id = i.value.value;
@@ -277,8 +277,8 @@ var v = /* @__PURE__ */ f((s, e) => {
277
277
  let { callee: t, arguments: i } = r;
278
278
  if (c.isMemberExpression(t) && c.isIdentifier(t.object) && c.isIdentifier(t.property) && t.property.name === "bind" && (i.length === 0 ||
279
279
  i.length === 1 && c.isObjectExpression(i[0]) && i[0].properties.length === 0)) {
280
- let { name: o } = t.object;
281
- r = this._templates[o];
280
+ let { name: a } = t.object;
281
+ r = this._templates[a];
282
282
  }
283
283
  }
284
284
  return r;
@@ -288,8 +288,8 @@ var v = /* @__PURE__ */ f((s, e) => {
288
288
  if (Ge(this._ast, {
289
289
  ExportDefaultDeclaration: {
290
290
  enter(t) {
291
- let { node: i, parent: o } = t, a = c.isIdentifier(i.declaration) && c.isProgram(o);
292
- if (e._options.transformInlineMeta && !a && c.isExpression(i.declaration)) {
291
+ let { node: i, parent: a } = t, o = c.isIdentifier(i.declaration) && c.isProgram(a);
292
+ if (e._options.transformInlineMeta && !o && c.isExpression(i.declaration)) {
293
293
  let d = t.scope.generateUidIdentifier("meta");
294
294
  e._metaVariableName = d.name;
295
295
  let u = [
@@ -300,7 +300,7 @@ var v = /* @__PURE__ */ f((s, e) => {
300
300
  return;
301
301
  }
302
302
  let l, p;
303
- if (a) {
303
+ if (o) {
304
304
  let d = i.declaration.name;
305
305
  e._metaVariableName = d;
306
306
  let u = /* @__PURE__ */ f((x) => c.isIdentifier(x.id) && x.id.name === d, "isVariableDeclarator");
@@ -314,7 +314,7 @@ var v = /* @__PURE__ */ f((s, e) => {
314
314
  if (c.isObjectExpression(p) ? l = p : (
315
315
  // export default { ... } as Meta<...>
316
316
  (c.isTSAsExpression(p) || c.isTSSatisfiesExpression(p)) && c.isObjectExpression(p.expression) && (l = p.expression)
317
- ), l && c.isProgram(o) && e._parseMeta(l, o), e._metaStatement && !e._metaNode)
317
+ ), l && c.isProgram(a) && e._parseMeta(l, a), e._metaStatement && !e._metaNode)
318
318
  throw new q(
319
319
  "default export must be an object",
320
320
  e._metaStatement,
@@ -325,9 +325,9 @@ var v = /* @__PURE__ */ f((s, e) => {
325
325
  },
326
326
  ExportNamedDeclaration: {
327
327
  enter(t) {
328
- let { node: i, parent: o } = t, a;
329
- c.isVariableDeclaration(i.declaration) ? a = i.declaration.declarations.filter((l) => c.isVariableDeclarator(l)) : c.isFunctionDeclaration(
330
- i.declaration) && (a = [i.declaration]), a ? a.forEach((l) => {
328
+ let { node: i, parent: a } = t, o;
329
+ c.isVariableDeclaration(i.declaration) ? o = i.declaration.declarations.filter((l) => c.isVariableDeclarator(l)) : c.isFunctionDeclaration(
330
+ i.declaration) && (o = [i.declaration]), o ? o.forEach((l) => {
331
331
  if (c.isIdentifier(l.id)) {
332
332
  let p = !1, { name: d } = l.id;
333
333
  if (d === "__namedExportsOrder" && c.isVariableDeclarator(l)) {
@@ -364,7 +364,7 @@ var v = /* @__PURE__ */ f((s, e) => {
364
364
  if (y.key.name === "render")
365
365
  b.__isArgsStory = ce(
366
366
  y.value,
367
- o,
367
+ a,
368
368
  e
369
369
  );
370
370
  else if (y.key.name === "name" && c.isStringLiteral(y.value))
@@ -374,14 +374,14 @@ var v = /* @__PURE__ */ f((s, e) => {
374
374
  `Unexpected usage of "storyName" in "${d}". Please use "name" instead.`
375
375
  );
376
376
  else if (y.key.name === "parameters" && c.isObjectExpression(y.value)) {
377
- let E = y.value.properties.find(
378
- (D) => c.isObjectProperty(D) && c.isIdentifier(D.key) && D.key.name === "__id"
377
+ let _ = y.value.properties.find(
378
+ (L) => c.isObjectProperty(L) && c.isIdentifier(L.key) && L.key.name === "__id"
379
379
  );
380
- E && (b.__id = E.value.value);
380
+ _ && (b.__id = _.value.value);
381
381
  }
382
382
  e._storyAnnotations[d][y.key.name] = y.value;
383
383
  }
384
- })) : b.__isArgsStory = ce(x, o, e), e._stories[d] = {
384
+ })) : b.__isArgsStory = ce(x, a, e), e._stories[d] = {
385
385
  id: "FIXME",
386
386
  name: u,
387
387
  parameters: b,
@@ -392,13 +392,13 @@ var v = /* @__PURE__ */ f((s, e) => {
392
392
  }
393
393
  }) : i.specifiers.length > 0 && i.specifiers.forEach((l) => {
394
394
  if (c.isExportSpecifier(l) && c.isIdentifier(l.exported)) {
395
- let { name: p } = l.exported, { name: d } = l.local, u = c.isProgram(o) ? P(d, o) : l.local;
395
+ let { name: p } = l.exported, { name: d } = l.local, u = c.isProgram(a) ? P(d, a) : l.local;
396
396
  if (p === "default") {
397
397
  let x;
398
398
  c.isObjectExpression(u) ? x = u : (
399
399
  // export default { ... } as Meta<...>
400
400
  c.isTSAsExpression(u) && c.isObjectExpression(u.expression) && (x = u.expression)
401
- ), x && c.isProgram(o) && e._parseMeta(x, o);
401
+ ), x && c.isProgram(a) && e._parseMeta(x, a);
402
402
  } else {
403
403
  let x = {}, b = u;
404
404
  c.isObjectExpression(b) && b.properties.forEach((y) => {
@@ -417,14 +417,14 @@ var v = /* @__PURE__ */ f((s, e) => {
417
417
  },
418
418
  ExpressionStatement: {
419
419
  enter({ node: t, parent: i }) {
420
- let { expression: o } = t;
421
- if (c.isProgram(i) && c.isAssignmentExpression(o) && c.isMemberExpression(o.left) && c.isIdentifier(o.left.object) && c.isIdentifier(
422
- o.left.property)) {
423
- let a = o.left.object.name, l = o.left.property.name, p = o.right;
424
- if (e._storyAnnotations[a] && (l === "story" && c.isObjectExpression(p) ? p.properties.forEach((d) => {
425
- c.isIdentifier(d.key) && (e._storyAnnotations[a][d.key.name] = d.value);
426
- }) : e._storyAnnotations[a][l] = p), l === "storyName" && c.isStringLiteral(p)) {
427
- let d = p.value, u = e._stories[a];
420
+ let { expression: a } = t;
421
+ if (c.isProgram(i) && c.isAssignmentExpression(a) && c.isMemberExpression(a.left) && c.isIdentifier(a.left.object) && c.isIdentifier(
422
+ a.left.property)) {
423
+ let o = a.left.object.name, l = a.left.property.name, p = a.right;
424
+ if (e._storyAnnotations[o] && (l === "story" && c.isObjectExpression(p) ? p.properties.forEach((d) => {
425
+ c.isIdentifier(d.key) && (e._storyAnnotations[o][d.key.name] = d.value);
426
+ }) : e._storyAnnotations[o][l] = p), l === "storyName" && c.isStringLiteral(p)) {
427
+ let d = p.value, u = e._stories[o];
428
428
  if (!u)
429
429
  return;
430
430
  u.name = d;
@@ -434,20 +434,20 @@ var v = /* @__PURE__ */ f((s, e) => {
434
434
  },
435
435
  CallExpression: {
436
436
  enter(t) {
437
- let { node: i } = t, { callee: o } = i;
438
- if (c.isIdentifier(o) && o.name === "storiesOf")
437
+ let { node: i } = t, { callee: a } = i;
438
+ if (c.isIdentifier(a) && a.name === "storiesOf")
439
439
  throw new Error(O.dedent`
440
440
  Unexpected \`storiesOf\` usage: ${v(i, e._options.fileName)}.
441
441
 
442
442
  SB8 does not support \`storiesOf\`.
443
443
  `);
444
- if (c.isMemberExpression(o) && c.isIdentifier(o.property) && o.property.name === "meta" && c.isIdentifier(o.object) && i.arguments.
444
+ if (c.isMemberExpression(a) && c.isIdentifier(a.property) && a.property.name === "meta" && c.isIdentifier(a.object) && i.arguments.
445
445
  length > 0) {
446
- let l = t.scope.getBinding(o.object.name)?.path?.parentPath?.node;
446
+ let l = t.scope.getBinding(a.object.name)?.path?.parentPath?.node;
447
447
  if (c.isImportDeclaration(l))
448
448
  if (Ke(l.source.value)) {
449
449
  let p = i.arguments[0];
450
- e._metaVariableName = o.property.name, e._metaIsFactory = !0, e._parseMeta(p, e._ast.program);
450
+ e._metaVariableName = a.property.name, e._metaIsFactory = !0, e._parseMeta(p, e._ast.program);
451
451
  } else
452
452
  throw new W(
453
453
  "meta() factory must be imported from .storybook/preview configuration",
@@ -471,25 +471,25 @@ var v = /* @__PURE__ */ f((s, e) => {
471
471
  let r = Object.entries(e._stories);
472
472
  if (e._meta.title = this._options.makeTitle(e._meta?.title), e._metaAnnotations.play && (e._meta.tags = [...e._meta.tags || [], "play-fn"]),
473
473
  e._stories = r.reduce(
474
- (t, [i, o]) => {
474
+ (t, [i, a]) => {
475
475
  if (!ne(i, e._meta))
476
476
  return t;
477
- let a = o.parameters?.__id ?? ze(e._meta?.id || e._meta?.title, oe(i)), l = { ...o.parameters, __id: a }, { includeStories: p } = e.
477
+ let o = a.parameters?.__id ?? ze(e._meta?.id || e._meta?.title, oe(i)), l = { ...a.parameters, __id: o }, { includeStories: p } = e.
478
478
  _meta || {};
479
- i === "__page" && (r.length === 1 || Array.isArray(p) && p.length === 1) && (l.docsOnly = !0), t[i] = { ...o, id: a, parameters: l };
479
+ i === "__page" && (r.length === 1 || Array.isArray(p) && p.length === 1) && (l.docsOnly = !0), t[i] = { ...a, id: o, parameters: l };
480
480
  let d = e._storyAnnotations[i], { tags: u, play: x } = d;
481
481
  if (u) {
482
- let E = c.isIdentifier(u) ? P(u.name, this._ast.program) : u;
483
- t[i].tags = le(E);
482
+ let _ = c.isIdentifier(u) ? P(u.name, this._ast.program) : u;
483
+ t[i].tags = le(_);
484
484
  }
485
485
  x && (t[i].tags = [...t[i].tags || [], "play-fn"]);
486
486
  let b = t[i].__stats;
487
- ["play", "render", "loaders", "beforeEach", "globals", "tags"].forEach((E) => {
488
- b[E] = !!d[E] || !!e._metaAnnotations[E];
487
+ ["play", "render", "loaders", "beforeEach", "globals", "tags"].forEach((_) => {
488
+ b[_] = !!d[_] || !!e._metaAnnotations[_];
489
489
  });
490
490
  let y = e.getStoryExport(i);
491
491
  return b.storyFn = !!(c.isArrowFunctionExpression(y) || c.isFunctionDeclaration(y)), b.mount = Ye(d.play ?? e._metaAnnotations.play),
492
- b.moduleMock = !!e.imports.find((E) => Qe(E)), t;
492
+ b.moduleMock = !!e.imports.find((_) => Qe(_)), t;
493
493
  },
494
494
  {}
495
495
  ), Object.keys(e._storyExports).forEach((t) => {
@@ -501,7 +501,7 @@ var v = /* @__PURE__ */ f((s, e) => {
501
501
  if (t.length !== i.length)
502
502
  throw new Error(
503
503
  `Missing exports after sort: ${t.filter(
504
- (o) => !i.includes(o)
504
+ (a) => !i.includes(a)
505
505
  )}`
506
506
  );
507
507
  }
@@ -546,17 +546,17 @@ var v = /* @__PURE__ */ f((s, e) => {
546
546
  }, "loadCsf"), me = /* @__PURE__ */ f((s, e = { sourceMaps: !1 }, r) => {
547
547
  let t = We(s._ast, e, r);
548
548
  return e.sourceMaps ? t : t.code;
549
- }, "formatCsf"), tt = /* @__PURE__ */ f((s, e = {}) => de.print(s._ast, e), "printCsf"), Ct = /* @__PURE__ */ f(async (s, e) => {
549
+ }, "formatCsf"), tt = /* @__PURE__ */ f((s, e = {}) => de.print(s._ast, e), "printCsf"), Ft = /* @__PURE__ */ f(async (s, e) => {
550
550
  let r = (await Ue(s, "utf-8")).toString();
551
551
  return Q(r, { ...e, fileName: s });
552
- }, "readCsf"), Tt = /* @__PURE__ */ f(async (s, e) => {
552
+ }, "readCsf"), Ct = /* @__PURE__ */ f(async (s, e) => {
553
553
  if (!(e || s._options.fileName))
554
554
  throw new Error("Please specify a fileName for writeCsf");
555
555
  await qe(e, tt(s).code);
556
556
  }, "writeCsf");
557
557
 
558
558
  // src/csf-tools/ConfigFile.ts
559
- var ye = U(V(), 1);
559
+ var ye = U(k(), 1);
560
560
  import { readFile as rt, writeFile as it } from "node:fs/promises";
561
561
  import {
562
562
  babelParse as xe,
@@ -572,13 +572,13 @@ var Y = /* @__PURE__ */ f(({
572
572
  node: r
573
573
  }) => ye.dedent`
574
574
  CSF Parsing error: Expected '${s}' but found '${e}' instead in '${r?.type}'.
575
- `, "getCsfParsingErrorMessage"), w = /* @__PURE__ */ f((s) => n.isIdentifier(s.key) ? s.key.name : n.isStringLiteral(s.key) ? s.key.value :
575
+ `, "getCsfParsingErrorMessage"), N = /* @__PURE__ */ f((s) => n.isIdentifier(s.key) ? s.key.name : n.isStringLiteral(s.key) ? s.key.value :
576
576
  null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSatisfiesExpression(s) ? G(s.expression) : s, "unwrap"), be = /* @__PURE__ */ f(
577
577
  (s, e) => {
578
578
  if (s.length === 0)
579
579
  return e;
580
580
  if (n.isObjectExpression(e)) {
581
- let [r, ...t] = s, i = e.properties.find((o) => w(o) === r);
581
+ let [r, ...t] = s, i = e.properties.find((a) => N(a) === r);
582
582
  if (i)
583
583
  return be(t, i.value);
584
584
  }
@@ -589,26 +589,26 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
589
589
  throw new Error("Expected object expression");
590
590
  }
591
591
  if (n.isObjectExpression(e)) {
592
- let [r, ...t] = s, i = e.properties.find((o) => w(o) === r);
592
+ let [r, ...t] = s, i = e.properties.find((a) => N(a) === r);
593
593
  if (i)
594
594
  return t.length === 0 ? e.properties : he(t, i.value);
595
595
  }
596
596
  }, "_getPathProperties"), z = /* @__PURE__ */ f((s, e) => {
597
597
  let r = null, t = null;
598
598
  return e.body.find((i) => (n.isVariableDeclaration(i) ? t = i.declarations : n.isExportNamedDeclaration(i) && n.isVariableDeclaration(i.declaration) &&
599
- (t = i.declaration.declarations), t && t.find((o) => n.isVariableDeclarator(o) && n.isIdentifier(o.id) && o.id.name === s ? (r = o, !0) : !1))),
599
+ (t = i.declaration.declarations), t && t.find((a) => n.isVariableDeclarator(a) && n.isIdentifier(a.id) && a.id.name === s ? (r = a, !0) : !1))),
600
600
  r;
601
- }, "_findVarDeclarator"), N = /* @__PURE__ */ f((s, e) => z(s, e)?.init, "_findVarInitialization"), R = /* @__PURE__ */ f((s, e) => {
601
+ }, "_findVarDeclarator"), I = /* @__PURE__ */ f((s, e) => z(s, e)?.init, "_findVarInitialization"), $ = /* @__PURE__ */ f((s, e) => {
602
602
  if (s.length === 0)
603
603
  return e;
604
- let [r, ...t] = s, i = R(t, e);
604
+ let [r, ...t] = s, i = $(t, e);
605
605
  return n.objectExpression([n.objectProperty(n.identifier(r), i)]);
606
- }, "_makeObjectExpression"), $ = /* @__PURE__ */ f((s, e, r) => {
607
- let [t, ...i] = s, o = r.properties.find(
608
- (a) => w(a) === t
606
+ }, "_makeObjectExpression"), A = /* @__PURE__ */ f((s, e, r) => {
607
+ let [t, ...i] = s, a = r.properties.find(
608
+ (o) => N(o) === t
609
609
  );
610
- o ? n.isObjectExpression(o.value) && i.length > 0 ? $(i, e, o.value) : o.value = R(i, e) : r.properties.push(
611
- n.objectProperty(n.identifier(t), R(i, e))
610
+ a ? n.isObjectExpression(a.value) && i.length > 0 ? A(i, e, a.value) : a.value = $(i, e) : r.properties.push(
611
+ n.objectProperty(n.identifier(t), $(i, e))
612
612
  );
613
613
  }, "_updateExportNode"), Z = class {
614
614
  constructor(e, r, t) {
@@ -625,10 +625,10 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
625
625
  }
626
626
  _parseExportsObject(e) {
627
627
  this._exportsObject = e, e.properties.forEach((r) => {
628
- let t = w(r);
628
+ let t = N(r);
629
629
  if (t) {
630
630
  let i = r.value;
631
- n.isIdentifier(i) && (i = N(i.name, this._ast.program)), this._exports[t] = i;
631
+ n.isIdentifier(i) && (i = I(i.name, this._ast.program)), this._exports[t] = i;
632
632
  }
633
633
  });
634
634
  }
@@ -638,7 +638,7 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
638
638
  ExportDefaultDeclaration: {
639
639
  enter({ node: r, parent: t }) {
640
640
  e.hasDefaultExport = !0;
641
- let i = n.isIdentifier(r.declaration) && n.isProgram(t) ? N(r.declaration.name, t) : r.declaration;
641
+ let i = n.isIdentifier(r.declaration) && n.isProgram(t) ? I(r.declaration.name, t) : r.declaration;
642
642
  i = G(i), n.isCallExpression(i) && n.isObjectExpression(i.arguments[0]) && (i = i.arguments[0]), n.isObjectExpression(i) ? e._parseExportsObject(
643
643
  i) : H.warn(
644
644
  Y({
@@ -654,20 +654,20 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
654
654
  if (n.isVariableDeclaration(r.declaration))
655
655
  r.declaration.declarations.forEach((i) => {
656
656
  if (n.isVariableDeclarator(i) && n.isIdentifier(i.id)) {
657
- let { name: o } = i.id, a = i.init;
658
- n.isIdentifier(a) && (a = N(a.name, t)), e._exports[o] = a, e._exportDecls[o] = i;
657
+ let { name: a } = i.id, o = i.init;
658
+ n.isIdentifier(o) && (o = I(o.name, t)), e._exports[a] = o, e._exportDecls[a] = i;
659
659
  }
660
660
  });
661
661
  else if (n.isFunctionDeclaration(r.declaration)) {
662
662
  let i = r.declaration;
663
663
  if (n.isIdentifier(i.id)) {
664
- let { name: o } = i.id;
665
- e._exportDecls[o] = i;
664
+ let { name: a } = i.id;
665
+ e._exportDecls[a] = i;
666
666
  }
667
667
  } else r.specifiers ? r.specifiers.forEach((i) => {
668
668
  if (n.isExportSpecifier(i) && n.isIdentifier(i.local) && n.isIdentifier(i.exported)) {
669
- let { name: o } = i.local, { name: a } = i.exported, l = z(o, t);
670
- l && (e._exports[a] = l.init, e._exportDecls[a] = l);
669
+ let { name: a } = i.local, { name: o } = i.exported, l = z(a, t);
670
+ l && (e._exports[o] = l.init, e._exportDecls[o] = l);
671
671
  }
672
672
  }) : H.warn(
673
673
  Y({
@@ -681,15 +681,15 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
681
681
  ExpressionStatement: {
682
682
  enter({ node: r, parent: t }) {
683
683
  if (n.isAssignmentExpression(r.expression) && r.expression.operator === "=") {
684
- let { left: i, right: o } = r.expression;
684
+ let { left: i, right: a } = r.expression;
685
685
  if (n.isMemberExpression(i) && n.isIdentifier(i.object) && i.object.name === "module" && n.isIdentifier(i.property) && i.property.
686
686
  name === "exports") {
687
- let a = o;
688
- n.isIdentifier(o) && (a = N(o.name, t)), a = G(a), n.isObjectExpression(a) ? (e._exportsObject = a, a.properties.forEach((l) => {
689
- let p = w(l);
687
+ let o = a;
688
+ n.isIdentifier(a) && (o = I(a.name, t)), o = G(o), n.isObjectExpression(o) ? (e._exportsObject = o, o.properties.forEach((l) => {
689
+ let p = N(l);
690
690
  if (p) {
691
691
  let d = l.value;
692
- n.isIdentifier(d) && (d = N(
692
+ n.isIdentifier(d) && (d = I(
693
693
  d.name,
694
694
  t
695
695
  )), e._exports[p] = d;
@@ -697,8 +697,8 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
697
697
  })) : H.warn(
698
698
  Y({
699
699
  expectedType: "ObjectExpression",
700
- foundType: a?.type,
701
- node: a
700
+ foundType: o?.type,
701
+ node: o
702
702
  })
703
703
  );
704
704
  }
@@ -737,31 +737,31 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
737
737
  }
738
738
  }
739
739
  setFieldNode(e, r) {
740
- let [t, ...i] = e, o = this._exports[t];
740
+ let [t, ...i] = e, a = this._exports[t];
741
741
  if (this._exportsObject) {
742
- let p = this._exportsObject.properties.find((d) => w(d) === t);
742
+ let p = this._exportsObject.properties.find((d) => N(d) === t);
743
743
  if (p && n.isIdentifier(p.value)) {
744
744
  let d = z(p.value.name, this._ast.program);
745
745
  if (d && n.isObjectExpression(d.init)) {
746
- $(i, r, d.init);
746
+ A(i, r, d.init);
747
747
  return;
748
748
  }
749
749
  }
750
- $(e, r, this._exportsObject), this._exports[e[0]] = r;
750
+ A(e, r, this._exportsObject), this._exports[e[0]] = r;
751
751
  return;
752
752
  }
753
- if (o && n.isObjectExpression(o) && i.length > 0) {
754
- $(i, r, o);
753
+ if (a && n.isObjectExpression(a) && i.length > 0) {
754
+ A(i, r, a);
755
755
  return;
756
756
  }
757
- let a = z(t, this._ast.program);
758
- if (a && n.isObjectExpression(a.init)) {
759
- $(i, r, a.init);
757
+ let o = z(t, this._ast.program);
758
+ if (o && n.isObjectExpression(o.init)) {
759
+ A(i, r, o.init);
760
760
  return;
761
761
  }
762
- if (o && i.length === 0 && this._exportDecls[e[0]]) {
762
+ if (a && i.length === 0 && this._exportDecls[e[0]]) {
763
763
  let l = this._exportDecls[e[0]];
764
- n.isVariableDeclarator(l) && (l.init = R([], r));
764
+ n.isVariableDeclarator(l) && (l.init = $([], r));
765
765
  } else {
766
766
  if (this.hasDefaultExport)
767
767
  throw new Error(
@@ -770,7 +770,7 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
770
770
  )}" field as the default export is not an object in this file.`
771
771
  );
772
772
  {
773
- let l = R(i, r), p = n.exportNamedDeclaration(
773
+ let l = $(i, r), p = n.exportNamedDeclaration(
774
774
  n.variableDeclaration("const", [n.variableDeclarator(n.identifier(t), l)])
775
775
  );
776
776
  this._exports[t] = l, this._ast.program.body.push(p);
@@ -840,31 +840,31 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
840
840
  return t;
841
841
  }
842
842
  removeField(e) {
843
- let r = /* @__PURE__ */ f((i, o) => {
844
- let a = i.findIndex(
845
- (l) => n.isIdentifier(l.key) && l.key.name === o || n.isStringLiteral(l.key) && l.key.value === o
843
+ let r = /* @__PURE__ */ f((i, a) => {
844
+ let o = i.findIndex(
845
+ (l) => n.isIdentifier(l.key) && l.key.name === a || n.isStringLiteral(l.key) && l.key.value === a
846
846
  );
847
- a >= 0 && i.splice(a, 1);
847
+ o >= 0 && i.splice(o, 1);
848
848
  }, "removeProperty");
849
849
  if (e.length === 1) {
850
850
  let i = !1;
851
- if (this._ast.program.body.forEach((o) => {
852
- if (n.isExportNamedDeclaration(o) && n.isVariableDeclaration(o.declaration)) {
853
- let a = o.declaration.declarations[0];
854
- n.isIdentifier(a.id) && a.id.name === e[0] && (this._ast.program.body.splice(this._ast.program.body.indexOf(o), 1), i = !0);
851
+ if (this._ast.program.body.forEach((a) => {
852
+ if (n.isExportNamedDeclaration(a) && n.isVariableDeclaration(a.declaration)) {
853
+ let o = a.declaration.declarations[0];
854
+ n.isIdentifier(o.id) && o.id.name === e[0] && (this._ast.program.body.splice(this._ast.program.body.indexOf(a), 1), i = !0);
855
855
  }
856
- if (n.isExportDefaultDeclaration(o)) {
857
- let a = o.declaration;
858
- if (n.isIdentifier(a) && (a = N(a.name, this._ast.program)), a = G(a), n.isObjectExpression(a)) {
859
- let l = a.properties;
856
+ if (n.isExportDefaultDeclaration(a)) {
857
+ let o = a.declaration;
858
+ if (n.isIdentifier(o) && (o = I(o.name, this._ast.program)), o = G(o), n.isObjectExpression(o)) {
859
+ let l = o.properties;
860
860
  r(l, e[0]), i = !0;
861
861
  }
862
862
  }
863
- if (n.isExpressionStatement(o) && n.isAssignmentExpression(o.expression) && n.isMemberExpression(o.expression.left) && n.isIdentifier(
864
- o.expression.left.object) && o.expression.left.object.name === "module" && n.isIdentifier(o.expression.left.property) && o.expression.
865
- left.property.name === "exports" && n.isObjectExpression(o.expression.right)) {
866
- let a = o.expression.right.properties;
867
- r(a, e[0]), i = !0;
863
+ if (n.isExpressionStatement(a) && n.isAssignmentExpression(a.expression) && n.isMemberExpression(a.expression.left) && n.isIdentifier(
864
+ a.expression.left.object) && a.expression.left.object.name === "module" && n.isIdentifier(a.expression.left.property) && a.expression.
865
+ left.property.name === "exports" && n.isObjectExpression(a.expression.right)) {
866
+ let o = a.expression.right.properties;
867
+ r(o, e[0]), i = !0;
868
868
  }
869
869
  }), i)
870
870
  return;
@@ -896,8 +896,8 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
896
896
  let t = this.getFieldNode(e);
897
897
  if (t)
898
898
  if (n.isArrayExpression(t)) {
899
- let i = t.elements.findIndex((o) => n.isStringLiteral(o) ? o.value === r : n.isObjectExpression(o) ? this._getPresetValue(o, "name") ===
900
- r : this._getPnpWrappedValue(o) === r);
899
+ let i = t.elements.findIndex((a) => n.isStringLiteral(a) ? a.value === r : n.isObjectExpression(a) ? this._getPresetValue(a, "name") ===
900
+ r : this._getPnpWrappedValue(a) === r);
901
901
  if (i >= 0)
902
902
  t.elements.splice(i, 1);
903
903
  else
@@ -918,12 +918,12 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
918
918
  valueToNode(e) {
919
919
  let r = this._inferQuotes(), t;
920
920
  if (r === "single") {
921
- let { code: i } = ue(n.valueToNode(e), { jsescOption: { quotes: r } }), o = xe(`const __x = ${i}`);
922
- ge(o, {
921
+ let { code: i } = ue(n.valueToNode(e), { jsescOption: { quotes: r } }), a = xe(`const __x = ${i}`);
922
+ ge(a, {
923
923
  VariableDeclaration: {
924
- enter({ node: a }) {
925
- a.declarations.length === 1 && n.isVariableDeclarator(a.declarations[0]) && n.isIdentifier(a.declarations[0].id) && a.declarations[0].
926
- id.name === "__x" && (t = a.declarations[0].init);
924
+ enter({ node: o }) {
925
+ o.declarations.length === 1 && n.isVariableDeclarator(o.declarations[0]) && n.isIdentifier(o.declarations[0].id) && o.declarations[0].
926
+ id.name === "__x" && (t = o.declarations[0].init);
927
927
  }
928
928
  }
929
929
  });
@@ -961,18 +961,18 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
961
961
  * @param fromImport - The module to import from
962
962
  */
963
963
  setRequireImport(e, r) {
964
- let t = this._ast.program.body.find((a) => {
965
- let l = n.isVariableDeclaration(a) && a.declarations.length === 1 && n.isVariableDeclarator(a.declarations[0]) && n.isCallExpression(a.
966
- declarations[0].init) && n.isIdentifier(a.declarations[0].init.callee) && a.declarations[0].init.callee.name === "require" && n.isStringLiteral(
967
- a.declarations[0].init.arguments[0]) && (a.declarations[0].init.arguments[0].value === r || a.declarations[0].init.arguments[0].value ===
964
+ let t = this._ast.program.body.find((o) => {
965
+ let l = n.isVariableDeclaration(o) && o.declarations.length === 1 && n.isVariableDeclarator(o.declarations[0]) && n.isCallExpression(o.
966
+ declarations[0].init) && n.isIdentifier(o.declarations[0].init.callee) && o.declarations[0].init.callee.name === "require" && n.isStringLiteral(
967
+ o.declarations[0].init.arguments[0]) && (o.declarations[0].init.arguments[0].value === r || o.declarations[0].init.arguments[0].value ===
968
968
  r.split("node:")[1]);
969
- return l && (r = a.declarations[0].init.arguments[0].value), l;
970
- }), i = /* @__PURE__ */ f((a) => n.isObjectPattern(t?.declarations[0].id) && t?.declarations[0].id.properties.find(
971
- (l) => n.isObjectProperty(l) && n.isIdentifier(l.key) && l.key.name === a
972
- ), "hasRequireSpecifier"), o = /* @__PURE__ */ f((a, l) => a.declarations.length === 1 && n.isVariableDeclarator(a.declarations[0]) && n.
973
- isIdentifier(a.declarations[0].id) && a.declarations[0].id.name === l, "hasDefaultRequireSpecifier");
969
+ return l && (r = o.declarations[0].init.arguments[0].value), l;
970
+ }), i = /* @__PURE__ */ f((o) => n.isObjectPattern(t?.declarations[0].id) && t?.declarations[0].id.properties.find(
971
+ (l) => n.isObjectProperty(l) && n.isIdentifier(l.key) && l.key.name === o
972
+ ), "hasRequireSpecifier"), a = /* @__PURE__ */ f((o, l) => o.declarations.length === 1 && n.isVariableDeclarator(o.declarations[0]) && n.
973
+ isIdentifier(o.declarations[0].id) && o.declarations[0].id.name === l, "hasDefaultRequireSpecifier");
974
974
  if (typeof e == "string") {
975
- let a = /* @__PURE__ */ f(() => {
975
+ let o = /* @__PURE__ */ f(() => {
976
976
  this._ast.program.body.unshift(
977
977
  n.variableDeclaration("const", [
978
978
  n.variableDeclarator(
@@ -982,17 +982,17 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
982
982
  ])
983
983
  );
984
984
  }, "addDefaultRequireSpecifier");
985
- t && o(t, e) || a();
986
- } else t ? e.forEach((a) => {
987
- i(a) || t.declarations[0].id.properties.push(
988
- n.objectProperty(n.identifier(a), n.identifier(a), void 0, !0)
985
+ t && a(t, e) || o();
986
+ } else t ? e.forEach((o) => {
987
+ i(o) || t.declarations[0].id.properties.push(
988
+ n.objectProperty(n.identifier(o), n.identifier(o), void 0, !0)
989
989
  );
990
990
  }) : this._ast.program.body.unshift(
991
991
  n.variableDeclaration("const", [
992
992
  n.variableDeclarator(
993
993
  n.objectPattern(
994
994
  e.map(
995
- (a) => n.objectProperty(n.identifier(a), n.identifier(a), void 0, !0)
995
+ (o) => n.objectProperty(n.identifier(o), n.identifier(o), void 0, !0)
996
996
  )
997
997
  ),
998
998
  n.callExpression(n.identifier("require"), [n.stringLiteral(r)])
@@ -1029,10 +1029,10 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
1029
1029
  let t = this._ast.program.body.find((p) => {
1030
1030
  let d = n.isImportDeclaration(p) && (p.source.value === r || p.source.value === r.split("node:")[1]);
1031
1031
  return d && (r = p.source.value), d;
1032
- }), i = /* @__PURE__ */ f((p) => n.importSpecifier(n.identifier(p), n.identifier(p)), "getNewImportSpecifier"), o = /* @__PURE__ */ f((p, d) => p.
1032
+ }), i = /* @__PURE__ */ f((p) => n.importSpecifier(n.identifier(p), n.identifier(p)), "getNewImportSpecifier"), a = /* @__PURE__ */ f((p, d) => p.
1033
1033
  specifiers.find(
1034
1034
  (u) => n.isImportSpecifier(u) && n.isIdentifier(u.imported) && u.imported.name === d
1035
- ), "hasImportSpecifier"), a = /* @__PURE__ */ f((p, d) => p.specifiers.find(
1035
+ ), "hasImportSpecifier"), o = /* @__PURE__ */ f((p, d) => p.specifiers.find(
1036
1036
  (u) => n.isImportNamespaceSpecifier(u) && n.isIdentifier(u.local) && u.local.name === d
1037
1037
  ), "hasNamespaceImportSpecifier");
1038
1038
  e === null ? t || this._ast.program.body.unshift(n.importDeclaration([], n.stringLiteral(r))) : typeof e == "string" ? t ? (/* @__PURE__ */ f(
@@ -1046,13 +1046,13 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
1046
1046
  n.stringLiteral(r)
1047
1047
  )
1048
1048
  ) : Array.isArray(e) ? t ? e.forEach((p) => {
1049
- o(t, p) || t.specifiers.push(i(p));
1049
+ a(t, p) || t.specifiers.push(i(p));
1050
1050
  }) : this._ast.program.body.unshift(
1051
1051
  n.importDeclaration(
1052
1052
  e.map(i),
1053
1053
  n.stringLiteral(r)
1054
1054
  )
1055
- ) : e.namespace && (t ? a(t, e.namespace) || t.specifiers.push(
1055
+ ) : e.namespace && (t ? o(t, e.namespace) || t.specifiers.push(
1056
1056
  n.importNamespaceSpecifier(n.identifier(e.namespace))
1057
1057
  ) : this._ast.program.body.unshift(
1058
1058
  n.importDeclaration(
@@ -1065,20 +1065,20 @@ null, "propKey"), G = /* @__PURE__ */ f((s) => n.isTSAsExpression(s) || n.isTSSa
1065
1065
  let r = xe(s);
1066
1066
  return new Z(r, s, e);
1067
1067
  }, "loadConfig"), ot = /* @__PURE__ */ f((s) => at(s).code, "formatConfig"), at = /* @__PURE__ */ f((s, e = {}) => st.print(s._ast, e), "pri\
1068
- ntConfig"), Lt = /* @__PURE__ */ f(async (s) => {
1068
+ ntConfig"), Rt = /* @__PURE__ */ f(async (s) => {
1069
1069
  let e = (await rt(s, "utf-8")).toString();
1070
1070
  return nt(e, s).parse();
1071
- }, "readConfig"), Mt = /* @__PURE__ */ f(async (s, e) => {
1071
+ }, "readConfig"), Lt = /* @__PURE__ */ f(async (s, e) => {
1072
1072
  let r = e || s.fileName;
1073
1073
  if (!r)
1074
1074
  throw new Error("Please specify a fileName for writeConfig");
1075
1075
  await it(r, ot(s));
1076
- }, "writeConfig"), Ut = /* @__PURE__ */ f((s) => !!s._ast.program.body.find((r) => n.isImportDeclaration(r) && r.source.value.includes("@sto\
1076
+ }, "writeConfig"), Mt = /* @__PURE__ */ f((s) => !!s._ast.program.body.find((r) => n.isImportDeclaration(r) && r.source.value.includes("@sto\
1077
1077
  rybook") && r.specifiers.some((t) => n.isImportSpecifier(t) && n.isIdentifier(t.imported) && t.imported.name === "definePreview")), "isCsfFa\
1078
1078
  ctoryPreview");
1079
1079
 
1080
1080
  // src/csf-tools/getStorySortParameter.ts
1081
- var je = U(V(), 1);
1081
+ var je = U(k(), 1);
1082
1082
  import { babelParse as lt, generate as Ee, types as h, traverse as ct } from "storybook/internal/babel";
1083
1083
  import { logger as pt } from "storybook/internal/node-logger";
1084
1084
  var ee = /* @__PURE__ */ f((s, e) => {
@@ -1087,7 +1087,7 @@ var ee = /* @__PURE__ */ f((s, e) => {
1087
1087
  h.isIdentifier(t.key) && t.key.name === e && (r = t.value);
1088
1088
  }), r;
1089
1089
  }, "getValue"), te = /* @__PURE__ */ f((s) => {
1090
- let e = L(s);
1090
+ let e = R(s);
1091
1091
  if (h.isArrayExpression(e))
1092
1092
  return e.elements.map((r) => te(r));
1093
1093
  if (h.isObjectExpression(e))
@@ -1095,9 +1095,9 @@ var ee = /* @__PURE__ */ f((s, e) => {
1095
1095
  if (h.isLiteral(e))
1096
1096
  return e.value;
1097
1097
  if (h.isIdentifier(e))
1098
- return F(e.name, !0);
1098
+ return w(e.name, !0);
1099
1099
  throw new Error(`Unknown node type ${e.type}`);
1100
- }, "parseValue"), F = /* @__PURE__ */ f((s, e) => {
1100
+ }, "parseValue"), w = /* @__PURE__ */ f((s, e) => {
1101
1101
  let r = je.dedent`
1102
1102
  Unexpected '${s}'. Parameter 'options.storySort' should be defined inline e.g.:
1103
1103
 
@@ -1112,26 +1112,26 @@ var ee = /* @__PURE__ */ f((s, e) => {
1112
1112
  if (e)
1113
1113
  throw new Error(r);
1114
1114
  pt.log(r);
1115
- }, "unsupported"), L = /* @__PURE__ */ f((s) => h.isTSAsExpression(s) || h.isTSSatisfiesExpression(s) ? s.expression : s, "stripTSModifiers"),
1115
+ }, "unsupported"), R = /* @__PURE__ */ f((s) => h.isTSAsExpression(s) || h.isTSSatisfiesExpression(s) ? s.expression : s, "stripTSModifiers"),
1116
1116
  Se = /* @__PURE__ */ f((s) => {
1117
- let e = L(s);
1117
+ let e = R(s);
1118
1118
  if (h.isObjectExpression(e)) {
1119
1119
  let r = ee(e, "options");
1120
1120
  if (r) {
1121
1121
  if (h.isObjectExpression(r))
1122
1122
  return ee(r, "storySort");
1123
- F("options", !0);
1123
+ w("options", !0);
1124
1124
  }
1125
1125
  }
1126
1126
  }, "parseParameters"), _e = /* @__PURE__ */ f((s, e) => {
1127
- let r = L(s);
1127
+ let r = R(s);
1128
1128
  if (h.isObjectExpression(r)) {
1129
1129
  let t = ee(r, "parameters");
1130
1130
  if (h.isIdentifier(t) && (t = P(t.name, e)), t)
1131
1131
  return Se(t);
1132
1132
  } else
1133
- F("default", !0);
1134
- }, "parseDefault"), Xt = /* @__PURE__ */ f((s) => {
1133
+ w("default", !0);
1134
+ }, "parseDefault"), zt = /* @__PURE__ */ f((s) => {
1135
1135
  if (!s.includes("storySort"))
1136
1136
  return;
1137
1137
  let e, r = lt(s);
@@ -1140,22 +1140,22 @@ Se = /* @__PURE__ */ f((s) => {
1140
1140
  enter({ node: t }) {
1141
1141
  h.isVariableDeclaration(t.declaration) ? t.declaration.declarations.forEach((i) => {
1142
1142
  if (h.isVariableDeclarator(i) && h.isIdentifier(i.id)) {
1143
- let { name: o } = i.id;
1144
- if (o === "parameters" && i.init) {
1145
- let a = L(i.init);
1146
- e = Se(a);
1143
+ let { name: a } = i.id;
1144
+ if (a === "parameters" && i.init) {
1145
+ let o = R(i.init);
1146
+ e = Se(o);
1147
1147
  }
1148
1148
  }
1149
1149
  }) : t.specifiers.forEach((i) => {
1150
- h.isIdentifier(i.exported) && i.exported.name === "parameters" && F("parameters", !1);
1150
+ h.isIdentifier(i.exported) && i.exported.name === "parameters" && w("parameters", !1);
1151
1151
  });
1152
1152
  }
1153
1153
  },
1154
1154
  ExportDefaultDeclaration: {
1155
1155
  enter({ node: t }) {
1156
1156
  let i = t.declaration;
1157
- h.isIdentifier(i) && (i = P(i.name, r.program)), i = L(i), h.isCallExpression(i) && h.isObjectExpression(i.arguments?.[0]) ? e = _e(
1158
- i.arguments[0], r.program) : h.isObjectExpression(i) ? e = _e(i, r.program) : F("default", !1);
1157
+ h.isIdentifier(i) && (i = P(i.name, r.program)), i = R(i), h.isCallExpression(i) && h.isObjectExpression(i.arguments?.[0]) ? e = _e(
1158
+ i.arguments[0], r.program) : h.isObjectExpression(i) ? e = _e(i, r.program) : w("default", !1);
1159
1159
  }
1160
1160
  }
1161
1161
  }), !!e) {
@@ -1164,21 +1164,21 @@ Se = /* @__PURE__ */ f((s) => {
1164
1164
  return (0, eval)(t);
1165
1165
  }
1166
1166
  if (h.isFunctionExpression(e)) {
1167
- let { code: t } = Ee(e, {}), i = e.id?.name, o = `(a, b) => {
1167
+ let { code: t } = Ee(e, {}), i = e.id?.name, a = `(a, b) => {
1168
1168
  ${t};
1169
1169
  return ${i}(a, b)
1170
1170
  }`;
1171
- return (0, eval)(o);
1171
+ return (0, eval)(a);
1172
1172
  }
1173
- return h.isLiteral(e) || h.isArrayExpression(e) || h.isObjectExpression(e) ? te(e) : F("storySort", !0);
1173
+ return h.isLiteral(e) || h.isArrayExpression(e) || h.isObjectExpression(e) ? te(e) : w("storySort", !0);
1174
1174
  }
1175
1175
  }, "getStorySortParameter");
1176
1176
 
1177
1177
  // src/csf-tools/enrichCsf.ts
1178
1178
  import { generate as ft, types as g } from "storybook/internal/babel";
1179
1179
  var dt = /* @__PURE__ */ f((s, e, r, t) => {
1180
- let i = e.getStoryExport(r), o = g.isCallExpression(i) && g.isMemberExpression(i.callee) && g.isIdentifier(i.callee.object) && i.callee.object.
1181
- name === "meta", a = !t?.disableSource && ut(i), l = !t?.disableDescription && Oe(e._storyStatements[r]), p = [], d = o ? g.memberExpression(
1180
+ let i = e.getStoryExport(r), a = g.isCallExpression(i) && g.isMemberExpression(i.callee) && g.isIdentifier(i.callee.object) && i.callee.object.
1181
+ name === "meta", o = !t?.disableSource && ut(i), l = !t?.disableDescription && Oe(e._storyStatements[r]), p = [], d = a ? g.memberExpression(
1182
1182
  g.identifier(r), g.identifier("input")) : g.identifier(r), u = g.memberExpression(d, g.identifier("parameters"));
1183
1183
  p.push(g.spreadElement(u));
1184
1184
  let x = g.optionalMemberExpression(
@@ -1187,7 +1187,7 @@ var dt = /* @__PURE__ */ f((s, e, r, t) => {
1187
1187
  !1,
1188
1188
  !0
1189
1189
  ), b = [];
1190
- if (a) {
1190
+ if (o) {
1191
1191
  let y = g.optionalMemberExpression(
1192
1192
  x,
1193
1193
  g.identifier("source"),
@@ -1198,7 +1198,7 @@ var dt = /* @__PURE__ */ f((s, e, r, t) => {
1198
1198
  g.objectProperty(
1199
1199
  g.identifier("source"),
1200
1200
  g.objectExpression([
1201
- g.objectProperty(g.identifier("originalSource"), g.stringLiteral(a)),
1201
+ g.objectProperty(g.identifier("originalSource"), g.stringLiteral(o)),
1202
1202
  g.spreadElement(y)
1203
1203
  ])
1204
1204
  )
@@ -1240,10 +1240,10 @@ var dt = /* @__PURE__ */ f((s, e, r, t) => {
1240
1240
  ) || s.properties.unshift(r);
1241
1241
  return;
1242
1242
  }
1243
- let [t, ...i] = e, o = s.properties.find(
1243
+ let [t, ...i] = e, a = s.properties.find(
1244
1244
  (l) => g.isObjectProperty(l) && g.isIdentifier(l.key) && l.key.name === t && g.isObjectExpression(l.value)
1245
- ), a;
1246
- o ? a = o.value : (a = g.objectExpression([]), s.properties.push(g.objectProperty(g.identifier(t), a))), Pe(a, i, r);
1245
+ ), o;
1246
+ a ? o = a.value : (o = g.objectExpression([]), s.properties.push(g.objectProperty(g.identifier(t), o))), Pe(o, i, r);
1247
1247
  }, "addComponentDescription"), mt = /* @__PURE__ */ f((s, e, r) => {
1248
1248
  let t = !r?.disableDescription && Oe(e._metaStatement);
1249
1249
  if (t) {
@@ -1254,7 +1254,7 @@ var dt = /* @__PURE__ */ f((s, e, r, t) => {
1254
1254
  g.objectProperty(g.identifier("component"), g.stringLiteral(t))
1255
1255
  );
1256
1256
  }
1257
- }, "enrichCsfMeta"), Ht = /* @__PURE__ */ f((s, e, r) => {
1257
+ }, "enrichCsfMeta"), Qt = /* @__PURE__ */ f((s, e, r) => {
1258
1258
  mt(s, e, r), Object.keys(s._storyExports).forEach((t) => {
1259
1259
  dt(s, e, t, r);
1260
1260
  });
@@ -1268,10 +1268,10 @@ var dt = /* @__PURE__ */ f((s, e, r, t) => {
1268
1268
  `) : "", "extractDescription");
1269
1269
 
1270
1270
  // src/csf-tools/index.ts
1271
- import { babelParse as mr } from "storybook/internal/babel";
1271
+ import { babelParse as dr } from "storybook/internal/babel";
1272
1272
 
1273
1273
  // src/csf-tools/vitest-plugin/transformer.ts
1274
- var re = U(V(), 1);
1274
+ var re = U(k(), 1);
1275
1275
  import { types as m } from "storybook/internal/babel";
1276
1276
  import { getStoryTitle as gt } from "storybook/internal/common";
1277
1277
  import { combineTags as xt } from "storybook/internal/csf";
@@ -1284,19 +1284,17 @@ async function bt({
1284
1284
  configDir: r,
1285
1285
  stories: t,
1286
1286
  tagsFilter: i,
1287
- previewLevelTags: o = []
1287
+ previewLevelTags: a = []
1288
1288
  }) {
1289
- if (!/\.stor(y|ies)\./.test(e))
1290
- return s;
1291
- let l = Q(s, {
1289
+ let o = Q(s, {
1292
1290
  fileName: e,
1293
1291
  transformInlineMeta: !0,
1294
- makeTitle: /* @__PURE__ */ f((_) => {
1292
+ makeTitle: /* @__PURE__ */ f((E) => {
1295
1293
  let S = gt({
1296
1294
  storyFilePath: e,
1297
1295
  configDir: r,
1298
1296
  stories: t,
1299
- userTitle: _
1297
+ userTitle: E
1300
1298
  }) || "unknown";
1301
1299
  return S === "unknown" && ve.warn(
1302
1300
  re.dedent`
@@ -1305,59 +1303,59 @@ async function bt({
1305
1303
  `
1306
1304
  ), S;
1307
1305
  }, "makeTitle")
1308
- }).parse(), p = l._ast, d = l._metaVariableName, u = l._metaNode, x = u.properties.find(
1309
- (_) => m.isObjectProperty(_) && m.isIdentifier(_.key) && _.key.name === "title"
1310
- ), b = m.stringLiteral(l._meta?.title || "unknown");
1311
- if (x ? m.isObjectProperty(x) && (x.value = b) : u.properties.push(m.objectProperty(m.identifier("title"), b)), !u || !l._meta)
1306
+ }).parse(), l = o._ast, p = o._metaVariableName, d = o._metaNode, u = d.properties.find(
1307
+ (E) => m.isObjectProperty(E) && m.isIdentifier(E.key) && E.key.name === "title"
1308
+ ), x = m.stringLiteral(o._meta?.title || "unknown");
1309
+ if (u ? m.isObjectProperty(u) && (u.value = x) : d.properties.push(m.objectProperty(m.identifier("title"), x)), !d || !o._meta)
1312
1310
  throw new Error(
1313
1311
  `The Storybook vitest plugin could not detect the meta (default export) object in the story file.
1314
1312
 
1315
1313
  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\
1316
1314
  le an issue with details about your use case.`
1317
1315
  );
1318
- let y = {};
1319
- Object.keys(l._stories).map((_) => {
1316
+ let b = {};
1317
+ Object.keys(o._stories).map((E) => {
1320
1318
  let S = xt(
1321
1319
  "test",
1322
1320
  "dev",
1323
- ...o,
1324
- ...l.meta?.tags || [],
1325
- ...l._stories[_].tags || []
1321
+ ...a,
1322
+ ...o.meta?.tags || [],
1323
+ ...o._stories[E].tags || []
1326
1324
  );
1327
- yt(S, i) && (y[_] = l._storyStatements[_]);
1325
+ yt(S, i) && (b[E] = o._storyStatements[E]);
1328
1326
  });
1329
- let E = l._file.path.scope.generateUidIdentifier("test"), D = l._file.path.scope.generateUidIdentifier("describe");
1330
- if (Object.keys(y).length === 0) {
1331
- let _ = m.expressionStatement(
1332
- m.callExpression(m.memberExpression(D, m.identifier("skip")), [
1327
+ let y = o._file.path.scope.generateUidIdentifier("test"), _ = o._file.path.scope.generateUidIdentifier("describe");
1328
+ if (Object.keys(b).length === 0) {
1329
+ let E = m.expressionStatement(
1330
+ m.callExpression(m.memberExpression(_, m.identifier("skip")), [
1333
1331
  m.stringLiteral("No valid tests found")
1334
1332
  ])
1335
1333
  );
1336
- p.program.body.push(_);
1334
+ l.program.body.push(E);
1337
1335
  let S = [
1338
1336
  m.importDeclaration(
1339
1337
  [
1340
- m.importSpecifier(E, m.identifier("test")),
1341
- m.importSpecifier(D, m.identifier("describe"))
1338
+ m.importSpecifier(y, m.identifier("test")),
1339
+ m.importSpecifier(_, m.identifier("describe"))
1342
1340
  ],
1343
1341
  m.stringLiteral("vitest")
1344
1342
  )
1345
1343
  ];
1346
- p.program.body.unshift(...S);
1344
+ l.program.body.unshift(...S);
1347
1345
  } else {
1348
1346
  let ie = function() {
1349
- let j = l._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), I = m.memberExpression(
1350
- m.callExpression(m.memberExpression(_, m.identifier("getState")), []),
1347
+ let j = o._file.path.scope.generateUidIdentifier("isRunningFromThisFile"), D = m.memberExpression(
1348
+ m.callExpression(m.memberExpression(E, m.identifier("getState")), []),
1351
1349
  m.identifier("testPath")
1352
- ), C = m.memberExpression(
1350
+ ), F = m.memberExpression(
1353
1351
  m.memberExpression(m.identifier("globalThis"), m.identifier("__vitest_worker__")),
1354
1352
  m.identifier("filepath")
1355
- ), T = m.logicalExpression(
1353
+ ), C = m.logicalExpression(
1356
1354
  "??",
1357
1355
  // TODO: switch order of testPathProperty and filePathProperty when the bug is fixed
1358
1356
  // https://github.com/vitest-dev/vitest/issues/6367 (or probably just use testPathProperty)
1359
- C,
1360
- I
1357
+ F,
1358
+ D
1361
1359
  ), M = m.callExpression(
1362
1360
  m.memberExpression(
1363
1361
  m.callExpression(m.identifier("convertToFilePath"), [
@@ -1368,37 +1366,37 @@ le an issue with details about your use case.`
1368
1366
  ]),
1369
1367
  m.identifier("includes")
1370
1368
  ),
1371
- [T]
1369
+ [C]
1372
1370
  );
1373
1371
  return { isRunningFromThisFileDeclaration: m.variableDeclaration("const", [
1374
1372
  m.variableDeclarator(j, M)
1375
1373
  ]), isRunningFromThisFileId: j };
1376
1374
  };
1377
- var ht = ie;
1375
+ var L = ie;
1378
1376
  f(ie, "getTestGuardDeclaration");
1379
- let _ = l._file.path.scope.generateUidIdentifier("expect"), S = l._file.path.scope.generateUidIdentifier("testStory"), De = m.identifier(
1377
+ let E = o._file.path.scope.generateUidIdentifier("expect"), S = o._file.path.scope.generateUidIdentifier("testStory"), De = m.identifier(
1380
1378
  JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Ie, isRunningFromThisFileId: Ne } = ie();
1381
- p.program.body.push(Ie);
1379
+ l.program.body.push(Ie);
1382
1380
  let we = /* @__PURE__ */ f(({
1383
1381
  localName: j,
1384
- exportName: I,
1385
- testTitle: C,
1386
- node: T
1382
+ exportName: D,
1383
+ testTitle: F,
1384
+ node: C
1387
1385
  }) => {
1388
1386
  let M = m.expressionStatement(
1389
- m.callExpression(E, [
1390
- m.stringLiteral(C),
1387
+ m.callExpression(y, [
1388
+ m.stringLiteral(F),
1391
1389
  m.callExpression(S, [
1392
- m.stringLiteral(I),
1390
+ m.stringLiteral(D),
1393
1391
  m.identifier(j),
1394
- m.identifier(d),
1392
+ m.identifier(p),
1395
1393
  De
1396
1394
  ])
1397
1395
  ])
1398
1396
  );
1399
- return M.loc = T.loc, M;
1400
- }, "getTestStatementForStory"), Fe = Object.entries(y).map(([j, I]) => {
1401
- if (I === null) {
1397
+ return M.loc = C.loc, M;
1398
+ }, "getTestStatementForStory"), Fe = Object.entries(b).map(([j, D]) => {
1399
+ if (D === null) {
1402
1400
  ve.warn(
1403
1401
  re.dedent`
1404
1402
  [Storybook]: Could not transform "${j}" story into test at "${e}".
@@ -1407,15 +1405,15 @@ le an issue with details about your use case.`
1407
1405
  );
1408
1406
  return;
1409
1407
  }
1410
- let C = l._stories[j].localName ?? j, T = l._stories[j].name ?? j;
1411
- return we({ testTitle: T, localName: C, exportName: j, node: I });
1408
+ let F = o._stories[j].localName ?? j, C = o._stories[j].name ?? j;
1409
+ return we({ testTitle: C, localName: F, exportName: j, node: D });
1412
1410
  }).filter((j) => !!j), Ce = m.ifStatement(Ne, m.blockStatement(Fe));
1413
- p.program.body.push(Ce);
1411
+ l.program.body.push(Ce);
1414
1412
  let Te = [
1415
1413
  m.importDeclaration(
1416
1414
  [
1417
- m.importSpecifier(E, m.identifier("test")),
1418
- m.importSpecifier(_, m.identifier("expect"))
1415
+ m.importSpecifier(y, m.identifier("test")),
1416
+ m.importSpecifier(E, m.identifier("expect"))
1419
1417
  ],
1420
1418
  m.stringLiteral("vitest")
1421
1419
  ),
@@ -1427,9 +1425,9 @@ le an issue with details about your use case.`
1427
1425
  m.stringLiteral("@storybook/addon-vitest/internal/test-utils")
1428
1426
  )
1429
1427
  ];
1430
- p.program.body.unshift(...Te);
1428
+ l.program.body.unshift(...Te);
1431
1429
  }
1432
- return me(l, { sourceMaps: !0, sourceFileName: e }, s);
1430
+ return me(o, { sourceMaps: !0, sourceFileName: e }, s);
1433
1431
  }
1434
1432
  f(bt, "vitestTransform");
1435
1433
  export {
@@ -1439,26 +1437,26 @@ export {
1439
1437
  B as MixedFactoryError,
1440
1438
  K as MultipleMetaError,
1441
1439
  q as NoMetaError,
1442
- mr as babelParse,
1440
+ dr as babelParse,
1443
1441
  et as babelParseFile,
1444
- Ht as enrichCsf,
1442
+ Qt as enrichCsf,
1445
1443
  mt as enrichCsfMeta,
1446
1444
  dt as enrichCsfStory,
1447
1445
  Oe as extractDescription,
1448
1446
  ut as extractSource,
1449
1447
  ot as formatConfig,
1450
1448
  me as formatCsf,
1451
- Xt as getStorySortParameter,
1452
- Ut as isCsfFactoryPreview,
1449
+ zt as getStorySortParameter,
1450
+ Mt as isCsfFactoryPreview,
1453
1451
  Qe as isModuleMock,
1454
1452
  Ke as isValidPreviewPath,
1455
1453
  nt as loadConfig,
1456
1454
  Q as loadCsf,
1457
1455
  at as printConfig,
1458
1456
  tt as printCsf,
1459
- Lt as readConfig,
1460
- Ct as readCsf,
1457
+ Rt as readConfig,
1458
+ Ft as readCsf,
1461
1459
  bt as vitestTransform,
1462
- Mt as writeConfig,
1463
- Tt as writeCsf
1460
+ Lt as writeConfig,
1461
+ Ct as writeCsf
1464
1462
  };