storybook 10.0.0-beta.6 → 10.0.0-beta.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 (80) hide show
  1. package/dist/_browser-chunks/{chunk-YQV3EGQ5.js → chunk-OQ6NCFPL.js} +38 -15
  2. package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
  3. package/dist/_node-chunks/{builder-manager-V33CQT2M.js → builder-manager-Y34L3HC4.js} +30 -15
  4. package/dist/_node-chunks/camelcase-W6EWLMZP.js +18 -0
  5. package/dist/_node-chunks/{chunk-A7CUP23N.js → chunk-3VCGPS3V.js} +7 -7
  6. package/dist/_node-chunks/{chunk-EAOPWIKA.js → chunk-4QSDBUYK.js} +8 -8
  7. package/dist/_node-chunks/{chunk-UYKQJMQY.js → chunk-4SIVISOF.js} +21 -27
  8. package/dist/_node-chunks/{chunk-MLBTKECD.js → chunk-5SPDSTWP.js} +7 -7
  9. package/dist/_node-chunks/{chunk-VQH4ZFTS.js → chunk-6NAUDAPE.js} +8 -8
  10. package/dist/_node-chunks/{chunk-NUVGSFQI.js → chunk-6SXRGPL6.js} +7 -7
  11. package/dist/_node-chunks/{chunk-2DMFI367.js → chunk-7JZFWQN4.js} +72 -8
  12. package/dist/_node-chunks/{chunk-IINJT47N.js → chunk-7Q5EKYUL.js} +7 -7
  13. package/dist/_node-chunks/{chunk-B3AMFGAL.js → chunk-AND2M2X5.js} +7 -7
  14. package/dist/_node-chunks/{chunk-RIPA4LFD.js → chunk-AZWKFSEJ.js} +108 -76
  15. package/dist/_node-chunks/{chunk-7NJGTQ3W.js → chunk-CL53RP5L.js} +8 -8
  16. package/dist/_node-chunks/{chunk-BNOZ3EKF.js → chunk-CZLW5B2W.js} +7 -7
  17. package/dist/_node-chunks/{chunk-DC7OWBHB.js → chunk-DRNU7FEF.js} +12 -12
  18. package/dist/_node-chunks/{chunk-VSC6LSCQ.js → chunk-EMCS3ZKS.js} +6 -6
  19. package/dist/_node-chunks/{chunk-EY5PTUZL.js → chunk-F43CI3CD.js} +10 -10
  20. package/dist/_node-chunks/{chunk-XZTBG2TG.js → chunk-FRTUAT3V.js} +6 -6
  21. package/dist/_node-chunks/{chunk-JNHUDBJL.js → chunk-HRBWZFVH.js} +7 -7
  22. package/dist/_node-chunks/{chunk-55VWKF63.js → chunk-IE2VBA4V.js} +9 -9
  23. package/dist/_node-chunks/{chunk-5IEY46LQ.js → chunk-JEIQPNWQ.js} +7 -7
  24. package/dist/_node-chunks/{chunk-NKZ4UPPV.js → chunk-JG7IEUS3.js} +7 -7
  25. package/dist/_node-chunks/{chunk-HEBHWRWL.js → chunk-LKGWQEHR.js} +7 -7
  26. package/dist/_node-chunks/{chunk-6PTV7XGR.js → chunk-MIJKYKSO.js} +264 -109
  27. package/dist/_node-chunks/{chunk-F3PO67U3.js → chunk-O33XSHQE.js} +7 -7
  28. package/dist/_node-chunks/{chunk-HPFXREVG.js → chunk-SOIRRZYG.js} +7 -7
  29. package/dist/_node-chunks/chunk-T46D5USU.js +18 -0
  30. package/dist/_node-chunks/{chunk-NJXBURX7.js → chunk-T5VNV7FG.js} +7 -7
  31. package/dist/_node-chunks/{chunk-E6TLN2J2.js → chunk-TL5UYDH2.js} +7 -7
  32. package/dist/_node-chunks/{chunk-JOXYGIZK.js → chunk-UORO6DG4.js} +9 -9
  33. package/dist/_node-chunks/chunk-USP6T4QU.js +62 -0
  34. package/dist/_node-chunks/{chunk-7WH7AGOR.js → chunk-WS3L7DA7.js} +7 -7
  35. package/dist/_node-chunks/{chunk-4TOI4VSK.js → chunk-YMZK6547.js} +7 -7
  36. package/dist/_node-chunks/{dist-CGGAYWME.js → dist-RINWIIFC.js} +9 -9
  37. package/dist/_node-chunks/{globby-3IFB7BJC.js → globby-G3CLKE4Y.js} +9 -9
  38. package/dist/_node-chunks/{lib-IT6OBSID.js → lib-67I574Z7.js} +7 -7
  39. package/dist/_node-chunks/{mdx-N42X6CFJ-WM36SSZ6.js → mdx-N42X6CFJ-6DP2YFMY.js} +8 -8
  40. package/dist/_node-chunks/{p-limit-3V5XIKA7.js → p-limit-JBOY5PGK.js} +7 -7
  41. package/dist/_node-chunks/{plugin-3YREMMJJ.js → plugin-2IR6AOYP.js} +10 -10
  42. package/dist/_node-chunks/{plugin-GJUBUKCT.js → plugin-5XCSTKS6.js} +10 -10
  43. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-DCJQFJQ5.js → webpack-inject-mocker-runtime-plugin-5FUND5HJ.js} +10 -10
  44. package/dist/_node-chunks/{webpack-mock-plugin-XJNFAHBI.js → webpack-mock-plugin-JVWSZ2PI.js} +9 -9
  45. package/dist/babel/index.js +11 -11
  46. package/dist/bin/core.js +11 -11
  47. package/dist/bin/dispatcher.js +11 -11
  48. package/dist/bin/loader.js +8 -8
  49. package/dist/cli/index.js +20 -20
  50. package/dist/common/index.js +20 -21
  51. package/dist/components/index.js +7 -3
  52. package/dist/core-server/index.js +90 -63
  53. package/dist/core-server/presets/common-manager.js +575 -531
  54. package/dist/core-server/presets/common-override-preset.js +9 -9
  55. package/dist/core-server/presets/common-preset.js +22 -22
  56. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  57. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  58. package/dist/csf/index.d.ts +9 -4
  59. package/dist/csf/index.js +37 -8
  60. package/dist/csf-tools/index.d.ts +13 -6
  61. package/dist/csf-tools/index.js +9 -9
  62. package/dist/manager/globals-runtime.js +73 -34
  63. package/dist/manager/runtime.js +501 -257
  64. package/dist/manager-api/index.d.ts +11 -6
  65. package/dist/manager-api/index.js +69 -34
  66. package/dist/node-logger/index.js +14 -14
  67. package/dist/preview/globals.js +1 -1
  68. package/dist/preview/runtime.js +97 -63
  69. package/dist/preview-api/index.d.ts +70 -71
  70. package/dist/preview-api/index.js +1 -1
  71. package/dist/server-errors.js +10 -10
  72. package/dist/telemetry/index.js +23 -24
  73. package/dist/types/index.d.ts +24 -7
  74. package/dist/viewport/index.d.ts +36 -4
  75. package/dist/viewport/index.js +1 -1
  76. package/package.json +1 -33
  77. package/dist/_node-chunks/camelcase-BZ55OCHI.js +0 -18
  78. package/dist/_node-chunks/chunk-FDDJHDCE.js +0 -62
  79. package/dist/_node-chunks/chunk-R5DIBOM6.js +0 -18
  80. package/dist/_node-chunks/chunk-TJIMCNYJ.js +0 -80
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_0v1evul49qdo from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_0v1evul49qdo from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_0v1evul49qdo from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7kszd2fgfzq from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7kszd2fgfzq from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7kszd2fgfzq from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_0v1evul49qdo.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_0v1evul49qdo.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_0v1evul49qdo.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7kszd2fgfzq.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7kszd2fgfzq.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7kszd2fgfzq.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,7 +13,7 @@ import {
13
13
  __commonJS,
14
14
  __name,
15
15
  __require
16
- } from "./chunk-XZTBG2TG.js";
16
+ } from "./chunk-FRTUAT3V.js";
17
17
 
18
18
  // ../node_modules/picomatch/lib/constants.js
19
19
  var require_constants = __commonJS({
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_0v1evul49qdo from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_0v1evul49qdo from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_0v1evul49qdo from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7kszd2fgfzq from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7kszd2fgfzq from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7kszd2fgfzq from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_0v1evul49qdo.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_0v1evul49qdo.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_0v1evul49qdo.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7kszd2fgfzq.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7kszd2fgfzq.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7kszd2fgfzq.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __name
14
- } from "./chunk-XZTBG2TG.js";
14
+ } from "./chunk-FRTUAT3V.js";
15
15
 
16
16
  // ../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
17
17
  var comma = ",".charCodeAt(0);
@@ -1,23 +1,20 @@
1
- import CJS_COMPAT_NODE_URL_0v1evul49qdo from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_0v1evul49qdo from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_0v1evul49qdo from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7kszd2fgfzq from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7kszd2fgfzq from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7kszd2fgfzq from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_0v1evul49qdo.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_0v1evul49qdo.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_0v1evul49qdo.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7kszd2fgfzq.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7kszd2fgfzq.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7kszd2fgfzq.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  require_picomatch
14
- } from "./chunk-IINJT47N.js";
15
- import {
16
- resolveModulePath
17
- } from "./chunk-2DMFI367.js";
14
+ } from "./chunk-7Q5EKYUL.js";
18
15
  import {
19
16
  versions_default
20
- } from "./chunk-FDDJHDCE.js";
17
+ } from "./chunk-USP6T4QU.js";
21
18
  import {
22
19
  BUN_LOCKFILE,
23
20
  BUN_LOCKFILE_BINARY,
@@ -30,41 +27,42 @@ import {
30
27
  getProjectRoot,
31
28
  normalizeStoryPath,
32
29
  require_cross_spawn
33
- } from "./chunk-55VWKF63.js";
30
+ } from "./chunk-IE2VBA4V.js";
34
31
  import {
35
32
  any,
36
33
  from,
37
34
  up2 as up
38
- } from "./chunk-F3PO67U3.js";
35
+ } from "./chunk-O33XSHQE.js";
39
36
  import {
40
37
  invariant
41
- } from "./chunk-HPFXREVG.js";
38
+ } from "./chunk-SOIRRZYG.js";
42
39
  import {
43
40
  importModule,
41
+ resolveModulePath,
44
42
  resolvePackageDir,
45
43
  safeResolveModule
46
- } from "./chunk-TJIMCNYJ.js";
44
+ } from "./chunk-7JZFWQN4.js";
47
45
  import {
48
46
  join,
49
47
  parse,
50
48
  resolve
51
- } from "./chunk-7WH7AGOR.js";
49
+ } from "./chunk-WS3L7DA7.js";
52
50
  import {
53
51
  require_prompts
54
- } from "./chunk-E6TLN2J2.js";
52
+ } from "./chunk-TL5UYDH2.js";
55
53
  import {
56
54
  glob,
57
55
  globSync
58
- } from "./chunk-NJXBURX7.js";
56
+ } from "./chunk-T5VNV7FG.js";
59
57
  import {
60
58
  slash
61
- } from "./chunk-JNHUDBJL.js";
59
+ } from "./chunk-HRBWZFVH.js";
62
60
  import {
63
61
  require_dist
64
- } from "./chunk-MLBTKECD.js";
62
+ } from "./chunk-5SPDSTWP.js";
65
63
  import {
66
64
  require_picocolors
67
- } from "./chunk-5IEY46LQ.js";
65
+ } from "./chunk-JEIQPNWQ.js";
68
66
  import {
69
67
  __commonJS,
70
68
  __esm,
@@ -73,7 +71,7 @@ import {
73
71
  __require,
74
72
  __toCommonJS,
75
73
  __toESM
76
- } from "./chunk-XZTBG2TG.js";
74
+ } from "./chunk-FRTUAT3V.js";
77
75
 
78
76
  // ../node_modules/@yarnpkg/fslib/node_modules/tslib/tslib.es6.js
79
77
  var tslib_es6_exports = {};
@@ -12208,7 +12206,10 @@ function serverRequire(filePath) {
12208
12206
  __name(serverRequire, "serverRequire");
12209
12207
 
12210
12208
  // src/common/utils/load-main-config.ts
12211
- import { relative, resolve as resolve4 } from "node:path";
12209
+ var import_ts_dedent4 = __toESM(require_dist(), 1);
12210
+ import { readFile as readFile4, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
12211
+ import { join as join9, parse as parse2, relative, resolve as resolve4 } from "node:path";
12212
+ import { logger as logger5 } from "storybook/internal/node-logger";
12212
12213
  import { MainFileEvaluationError } from "storybook/internal/server-errors";
12213
12214
  async function loadMainConfig({
12214
12215
  configDir = ".storybook",
@@ -12223,6 +12224,34 @@ async function loadMainConfig({
12223
12224
  if (!(e instanceof Error)) {
12224
12225
  throw e;
12225
12226
  }
12227
+ if (e.message.includes("require is not defined")) {
12228
+ logger5.info(
12229
+ "Loading main config failed, trying a temporary fix, Please ensure the main config is valid ESM"
12230
+ );
12231
+ const comment = "// end of Storybook 10 migration assistant header, you can delete the above code";
12232
+ const content = await readFile4(mainPath, "utf-8");
12233
+ if (!content.includes(comment)) {
12234
+ const header = import_ts_dedent4.dedent`
12235
+ import { createRequire } from "node:module";
12236
+ import { dirname } from "node:path";
12237
+ import { fileURLToPath } from "node:url";
12238
+
12239
+ const __filename = fileURLToPath(import.meta.url);
12240
+ const __dirname = dirname(__filename);
12241
+ const require = createRequire(import.meta.url);
12242
+ `;
12243
+ const { ext, name, dir } = parse2(mainPath);
12244
+ const modifiedMainPath = join9(dir, `${name}.tmp.${ext}`);
12245
+ await writeFile3(modifiedMainPath, [header, comment, content].join("\n\n"));
12246
+ let out;
12247
+ try {
12248
+ out = await importModule(modifiedMainPath);
12249
+ } finally {
12250
+ await rm3(modifiedMainPath);
12251
+ }
12252
+ return out;
12253
+ }
12254
+ }
12226
12255
  throw new MainFileEvaluationError({
12227
12256
  location: relative(process.cwd(), mainPath),
12228
12257
  error: e
@@ -12232,17 +12261,17 @@ async function loadMainConfig({
12232
12261
  __name(loadMainConfig, "loadMainConfig");
12233
12262
 
12234
12263
  // src/common/utils/load-manager-or-addons-file.ts
12235
- var import_ts_dedent4 = __toESM(require_dist(), 1);
12264
+ var import_ts_dedent5 = __toESM(require_dist(), 1);
12236
12265
  import { resolve as resolve5 } from "node:path";
12237
- import { logger as logger5 } from "storybook/internal/node-logger";
12266
+ import { logger as logger6 } from "storybook/internal/node-logger";
12238
12267
  function loadManagerOrAddonsFile({ configDir }) {
12239
12268
  const storybookCustomAddonsPath = getInterpretedFile(resolve5(configDir, "addons"));
12240
12269
  const storybookCustomManagerPath = getInterpretedFile(resolve5(configDir, "manager"));
12241
12270
  if (storybookCustomAddonsPath || storybookCustomManagerPath) {
12242
- logger5.info("=> Loading custom manager config");
12271
+ logger6.info("=> Loading custom manager config");
12243
12272
  }
12244
12273
  if (storybookCustomAddonsPath && storybookCustomManagerPath) {
12245
- throw new Error(import_ts_dedent4.dedent`
12274
+ throw new Error(import_ts_dedent5.dedent`
12246
12275
  You have both a "addons.js" and a "manager.js", remove the "addons.js" file from your configDir (${resolve5(
12247
12276
  configDir,
12248
12277
  "addons"
@@ -12253,13 +12282,13 @@ function loadManagerOrAddonsFile({ configDir }) {
12253
12282
  __name(loadManagerOrAddonsFile, "loadManagerOrAddonsFile");
12254
12283
 
12255
12284
  // src/common/utils/load-preview-or-config-file.ts
12256
- var import_ts_dedent5 = __toESM(require_dist(), 1);
12285
+ var import_ts_dedent6 = __toESM(require_dist(), 1);
12257
12286
  import { resolve as resolve6 } from "node:path";
12258
12287
  function loadPreviewOrConfigFile({ configDir }) {
12259
12288
  const storybookConfigPath = getInterpretedFile(resolve6(configDir, "config"));
12260
12289
  const storybookPreviewPath = getInterpretedFile(resolve6(configDir, "preview"));
12261
12290
  if (storybookConfigPath && storybookPreviewPath) {
12262
- throw new Error(import_ts_dedent5.dedent`
12291
+ throw new Error(import_ts_dedent6.dedent`
12263
12292
  You have both a "config.js" and a "preview.js", remove the "config.js" file from your configDir (${resolve6(
12264
12293
  configDir,
12265
12294
  "config"
@@ -12271,20 +12300,20 @@ __name(loadPreviewOrConfigFile, "loadPreviewOrConfigFile");
12271
12300
 
12272
12301
  // src/common/utils/log.ts
12273
12302
  var import_picocolors2 = __toESM(require_picocolors(), 1);
12274
- import { logger as logger6 } from "storybook/internal/node-logger";
12303
+ import { logger as logger7 } from "storybook/internal/node-logger";
12275
12304
  var commandLog = /* @__PURE__ */ __name((message) => {
12276
12305
  process.stdout.write(import_picocolors2.default.cyan(" \u2022 ") + message);
12277
12306
  return (errorMessage, errorInfo) => {
12278
12307
  if (errorMessage) {
12279
12308
  process.stdout.write(`. ${import_picocolors2.default.red("\u2716")}
12280
12309
  `);
12281
- logger6.error(`
12310
+ logger7.error(`
12282
12311
  ${import_picocolors2.default.red(errorMessage)}`);
12283
12312
  if (!errorInfo) {
12284
12313
  return;
12285
12314
  }
12286
12315
  const newErrorInfo = errorInfo.split("\n").map((line) => ` ${import_picocolors2.default.dim(line)}`).join("\n");
12287
- logger6.error(`${newErrorInfo}
12316
+ logger7.error(`${newErrorInfo}
12288
12317
  `);
12289
12318
  return;
12290
12319
  }
@@ -12294,7 +12323,7 @@ var commandLog = /* @__PURE__ */ __name((message) => {
12294
12323
  }, "commandLog");
12295
12324
  function paddedLog(message) {
12296
12325
  const newMessage = message.split("\n").map((line) => ` ${line}`).join("\n");
12297
- logger6.log(newMessage);
12326
+ logger7.log(newMessage);
12298
12327
  }
12299
12328
  __name(paddedLog, "paddedLog");
12300
12329
  function getChars(char, amount) {
@@ -12317,7 +12346,7 @@ function codeLog(codeLines, leftPadAmount) {
12317
12346
  newLine = getChars(" ", leftPadAmount || 2) + import_picocolors2.default.inverse(` ${newLine} `);
12318
12347
  return newLine;
12319
12348
  }).join("\n");
12320
- logger6.log(finalResult);
12349
+ logger7.log(finalResult);
12321
12350
  }
12322
12351
  __name(codeLog, "codeLog");
12323
12352
 
@@ -12408,44 +12437,44 @@ var normalizeStories = /* @__PURE__ */ __name((entries, options) => {
12408
12437
  }, "normalizeStories");
12409
12438
 
12410
12439
  // src/common/utils/readTemplate.ts
12411
- import { readFile as readFile4 } from "node:fs/promises";
12440
+ import { readFile as readFile5 } from "node:fs/promises";
12412
12441
  async function readTemplate(filename) {
12413
- return readFile4(filename, {
12442
+ return readFile5(filename, {
12414
12443
  encoding: "utf8"
12415
12444
  });
12416
12445
  }
12417
12446
  __name(readTemplate, "readTemplate");
12418
12447
 
12419
12448
  // src/common/utils/remove.ts
12420
- var import_ts_dedent6 = __toESM(require_dist(), 1);
12449
+ var import_ts_dedent7 = __toESM(require_dist(), 1);
12421
12450
  import { readConfig, writeConfig } from "storybook/internal/csf-tools";
12422
- import { logger as logger7 } from "storybook/internal/node-logger";
12451
+ import { logger as logger8 } from "storybook/internal/node-logger";
12423
12452
  async function removeAddon(addon, options) {
12424
12453
  const { packageManager, skipInstall } = options;
12425
12454
  const { mainConfigPath, configDir } = getConfigInfo(options.configDir);
12426
12455
  if (typeof configDir === "undefined") {
12427
- throw new Error(import_ts_dedent6.dedent`
12456
+ throw new Error(import_ts_dedent7.dedent`
12428
12457
  Unable to find storybook config directory
12429
12458
  `);
12430
12459
  }
12431
12460
  if (!mainConfigPath) {
12432
- logger7.error("Unable to find storybook main.js config");
12461
+ logger8.error("Unable to find storybook main.js config");
12433
12462
  return;
12434
12463
  }
12435
12464
  const main = await readConfig(mainConfigPath);
12436
- logger7.debug(`Uninstalling ${addon}`);
12465
+ logger8.debug(`Uninstalling ${addon}`);
12437
12466
  await packageManager.removeDependencies([addon]);
12438
12467
  if (!skipInstall) {
12439
12468
  await packageManager.installDependencies();
12440
12469
  }
12441
12470
  const currentAddons = main.getNamesFromPath(["addons"]) ?? [];
12442
12471
  if (currentAddons.includes(addon)) {
12443
- logger7.debug(`Removing '${addon}' from main.js addons field.`);
12472
+ logger8.debug(`Removing '${addon}' from main.js addons field.`);
12444
12473
  try {
12445
12474
  main.removeEntryFromArray(["addons"], addon);
12446
12475
  await writeConfig(main);
12447
12476
  } catch (err) {
12448
- logger7.warn(`Failed to remove '${addon}' from main.js addons field. ${String(err)}`);
12477
+ logger8.warn(`Failed to remove '${addon}' from main.js addons field. ${String(err)}`);
12449
12478
  }
12450
12479
  }
12451
12480
  }
@@ -12489,7 +12518,7 @@ function getPreviewHeadTemplate(configDirPath, interpolations) {
12489
12518
  __name(getPreviewHeadTemplate, "getPreviewHeadTemplate");
12490
12519
 
12491
12520
  // src/common/utils/validate-config.ts
12492
- import { join as join9 } from "node:path";
12521
+ import { join as join10 } from "node:path";
12493
12522
  import {
12494
12523
  CouldNotEvaluateFrameworkError,
12495
12524
  InvalidFrameworkNameError,
@@ -12508,7 +12537,7 @@ function validateFrameworkName(frameworkName) {
12508
12537
  return;
12509
12538
  }
12510
12539
  try {
12511
- resolveModulePath(join9(frameworkName, "preset"), {
12540
+ resolveModulePath(join10(frameworkName, "preset"), {
12512
12541
  extensions: [".mjs", ".js", ".cjs"],
12513
12542
  conditions: ["node", "import", "require"]
12514
12543
  });
@@ -12563,14 +12592,14 @@ async function formatWithEditorConfig(filePath, content) {
12563
12592
  __name(formatWithEditorConfig, "formatWithEditorConfig");
12564
12593
 
12565
12594
  // src/common/utils/get-story-id.ts
12566
- var import_ts_dedent8 = __toESM(require_dist(), 1);
12595
+ var import_ts_dedent9 = __toESM(require_dist(), 1);
12567
12596
  import { relative as relative3 } from "node:path";
12568
12597
  import { normalizeStories as normalizeStories2, normalizeStoryPath as normalizeStoryPath2 } from "storybook/internal/common";
12569
12598
  import { sanitize as sanitize2, storyNameFromExport, toId } from "storybook/internal/csf";
12570
12599
 
12571
12600
  // src/preview-api/modules/store/autoTitle.ts
12572
12601
  import { once as once2 } from "storybook/internal/client-logger";
12573
- var import_ts_dedent7 = __toESM(require_dist(), 1);
12602
+ var import_ts_dedent8 = __toESM(require_dist(), 1);
12574
12603
  var sanitize = /* @__PURE__ */ __name((parts) => {
12575
12604
  if (parts.length === 0) {
12576
12605
  return parts;
@@ -12593,7 +12622,7 @@ __name(pathJoin, "pathJoin");
12593
12622
  var userOrAutoTitleFromSpecifier = /* @__PURE__ */ __name((fileName, entry, userTitle) => {
12594
12623
  const { directory, importPathMatcher, titlePrefix = "" } = entry || {};
12595
12624
  if (typeof fileName === "number") {
12596
- once2.warn(import_ts_dedent7.dedent`
12625
+ once2.warn(import_ts_dedent8.dedent`
12597
12626
  CSF Auto-title received a numeric fileName. This typically happens when
12598
12627
  webpack is mis-configured in production mode. To force webpack to produce
12599
12628
  filenames, set optimization.moduleIds = "named" in your webpack config.
@@ -12628,7 +12657,7 @@ async function getStoryId(data, options) {
12628
12657
  configDir: options.configDir
12629
12658
  });
12630
12659
  if (autoTitle === void 0) {
12631
- throw new Error(import_ts_dedent8.dedent`
12660
+ throw new Error(import_ts_dedent9.dedent`
12632
12661
  The new story file was successfully generated, but we are unable to index it. Please ensure that the new Story file is matched by the 'stories' glob pattern in your Storybook configuration.
12633
12662
  `);
12634
12663
  }
@@ -12683,7 +12712,7 @@ import {
12683
12712
  readConfig as readConfig2,
12684
12713
  writeConfig as writeConfig2
12685
12714
  } from "storybook/internal/csf-tools";
12686
- import { logger as logger8 } from "storybook/internal/node-logger";
12715
+ import { logger as logger9 } from "storybook/internal/node-logger";
12687
12716
 
12688
12717
  // src/common/utils/get-addon-annotations.ts
12689
12718
  function getAnnotationsName(addonName) {
@@ -12724,12 +12753,15 @@ async function getSyncedStorybookAddons(mainConfig, previewConfig, configDir) {
12724
12753
  if (!isCsfFactory) {
12725
12754
  return previewConfig;
12726
12755
  }
12756
+ const existingAddons = previewConfig.getFieldNode(["addons"]);
12757
+ if (!existingAddons) {
12758
+ previewConfig.setFieldNode(["addons"], t.arrayExpression([]));
12759
+ }
12727
12760
  const addons = getAddonNames(mainConfig);
12728
12761
  if (!addons) {
12729
12762
  return previewConfig;
12730
12763
  }
12731
12764
  const syncedAddons = [];
12732
- const existingAddons = previewConfig.getFieldNode(["addons"]);
12733
12765
  for (const addon of addons) {
12734
12766
  const annotations = await getAddonAnnotations(addon, configDir);
12735
12767
  if (annotations) {
@@ -12757,7 +12789,7 @@ async function getSyncedStorybookAddons(mainConfig, previewConfig, configDir) {
12757
12789
  }
12758
12790
  }
12759
12791
  if (syncedAddons.length > 0) {
12760
- logger8.log(
12792
+ logger9.log(
12761
12793
  `Synchronizing addons from main config in ${import_picocolors4.default.cyan(previewConfig.fileName)}:
12762
12794
  ${syncedAddons.map(import_picocolors4.default.magenta).join(", ")}`
12763
12795
  );
@@ -12768,13 +12800,13 @@ __name(getSyncedStorybookAddons, "getSyncedStorybookAddons");
12768
12800
 
12769
12801
  // src/common/js-package-manager/JsPackageManagerFactory.ts
12770
12802
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
12771
- import { basename as basename2, parse as parse2, relative as relative4 } from "node:path";
12803
+ import { basename as basename2, parse as parse3, relative as relative4 } from "node:path";
12772
12804
 
12773
12805
  // src/common/js-package-manager/BUNProxy.ts
12774
12806
  import { readFileSync as readFileSync5 } from "node:fs";
12775
12807
  import { platform } from "node:os";
12776
- import { join as join10 } from "node:path";
12777
- import { logger as logger9 } from "storybook/internal/node-logger";
12808
+ import { join as join11 } from "node:path";
12809
+ import { logger as logger10 } from "storybook/internal/node-logger";
12778
12810
  import { FindPackageVersionsError } from "storybook/internal/server-errors";
12779
12811
  import sort from "semver/functions/sort.js";
12780
12812
  var NPM_ERROR_REGEX = /npm ERR! code (\w+)/;
@@ -12832,7 +12864,7 @@ var BUNProxy = class extends JsPackageManager {
12832
12864
  return `bunx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
12833
12865
  }
12834
12866
  async getModulePackageJSON(packageName) {
12835
- const wantedPath = join10("node_modules", packageName, "package.json");
12867
+ const wantedPath = join11("node_modules", packageName, "package.json");
12836
12868
  const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
12837
12869
  if (!packageJsonPath) {
12838
12870
  return null;
@@ -12890,7 +12922,7 @@ var BUNProxy = class extends JsPackageManager {
12890
12922
  const parsedOutput = JSON.parse(commandResult);
12891
12923
  return this.mapDependencies(parsedOutput, pattern);
12892
12924
  } catch (err) {
12893
- logger9.debug(`An issue occurred while trying to find dependencies metadata using npm.`);
12925
+ logger10.debug(`An issue occurred while trying to find dependencies metadata using npm.`);
12894
12926
  return void 0;
12895
12927
  }
12896
12928
  }
@@ -13015,8 +13047,8 @@ var BUNProxy = class extends JsPackageManager {
13015
13047
  // src/common/js-package-manager/NPMProxy.ts
13016
13048
  import { readFileSync as readFileSync6 } from "node:fs";
13017
13049
  import { platform as platform2 } from "node:os";
13018
- import { join as join11 } from "node:path";
13019
- import { logger as logger10, prompt as prompt2 } from "storybook/internal/node-logger";
13050
+ import { join as join12 } from "node:path";
13051
+ import { logger as logger11, prompt as prompt2 } from "storybook/internal/node-logger";
13020
13052
  import { FindPackageVersionsError as FindPackageVersionsError2 } from "storybook/internal/server-errors";
13021
13053
  import sort2 from "semver/functions/sort.js";
13022
13054
  var NPM_ERROR_REGEX2 = /npm (ERR!|error) (code|errno) (\w+)/i;
@@ -13068,7 +13100,7 @@ var NPMProxy = class extends JsPackageManager {
13068
13100
  return `npx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
13069
13101
  }
13070
13102
  async getModulePackageJSON(packageName) {
13071
- const wantedPath = join11("node_modules", packageName, "package.json");
13103
+ const wantedPath = join12("node_modules", packageName, "package.json");
13072
13104
  const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
13073
13105
  if (!packageJsonPath) {
13074
13106
  return null;
@@ -13130,7 +13162,7 @@ var NPMProxy = class extends JsPackageManager {
13130
13162
  const parsedOutput = JSON.parse(commandResult);
13131
13163
  return this.mapDependencies(parsedOutput, pattern);
13132
13164
  } catch (err) {
13133
- logger10.debug(`An issue occurred while trying to find dependencies metadata using npm.`);
13165
+ logger11.debug(`An issue occurred while trying to find dependencies metadata using npm.`);
13134
13166
  return void 0;
13135
13167
  }
13136
13168
  }
@@ -13254,7 +13286,7 @@ var NPMProxy = class extends JsPackageManager {
13254
13286
 
13255
13287
  // src/common/js-package-manager/PNPMProxy.ts
13256
13288
  import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
13257
- import { join as join12 } from "node:path";
13289
+ import { join as join13 } from "node:path";
13258
13290
  import { pathToFileURL } from "node:url";
13259
13291
  import { prompt as prompt3 } from "storybook/internal/node-logger";
13260
13292
  import { FindPackageVersionsError as FindPackageVersionsError3 } from "storybook/internal/server-errors";
@@ -13357,7 +13389,7 @@ var PNPMProxy = class extends JsPackageManager {
13357
13389
  const pkgLocator = pnpApi.findPackageLocator(resolvedPath);
13358
13390
  const pkg = pnpApi.getPackageInformation(pkgLocator);
13359
13391
  const packageJSON = JSON.parse(
13360
- readFileSync7(join12(pkg.packageLocation, "package.json"), "utf-8")
13392
+ readFileSync7(join13(pkg.packageLocation, "package.json"), "utf-8")
13361
13393
  );
13362
13394
  return packageJSON;
13363
13395
  } catch (error) {
@@ -13367,7 +13399,7 @@ var PNPMProxy = class extends JsPackageManager {
13367
13399
  return null;
13368
13400
  }
13369
13401
  }
13370
- const wantedPath = join12("node_modules", packageName, "package.json");
13402
+ const wantedPath = join13("node_modules", packageName, "package.json");
13371
13403
  const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
13372
13404
  if (!packageJsonPath) {
13373
13405
  return null;
@@ -13480,7 +13512,7 @@ var PNPMProxy = class extends JsPackageManager {
13480
13512
 
13481
13513
  // src/common/js-package-manager/Yarn1Proxy.ts
13482
13514
  import { readFileSync as readFileSync8 } from "node:fs";
13483
- import { join as join13 } from "node:path";
13515
+ import { join as join14 } from "node:path";
13484
13516
  import process2 from "node:process";
13485
13517
  import { prompt as prompt4 } from "storybook/internal/node-logger";
13486
13518
  import { FindPackageVersionsError as FindPackageVersionsError4 } from "storybook/internal/server-errors";
@@ -13531,7 +13563,7 @@ var Yarn1Proxy = class extends JsPackageManager {
13531
13563
  return this.executeCommand({ command: `yarn`, args: [command, ...args], cwd, stdio });
13532
13564
  }
13533
13565
  async getModulePackageJSON(packageName) {
13534
- const wantedPath = join13("node_modules", packageName, "package.json");
13566
+ const wantedPath = join14("node_modules", packageName, "package.json");
13535
13567
  const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
13536
13568
  if (!packageJsonPath) {
13537
13569
  return null;
@@ -13670,7 +13702,7 @@ var Yarn1Proxy = class extends JsPackageManager {
13670
13702
  var import_fslib = __toESM(require_lib(), 1);
13671
13703
  var import_libzip = __toESM(require_sync(), 1);
13672
13704
  import { readFileSync as readFileSync9 } from "node:fs";
13673
- import { join as join14 } from "node:path";
13705
+ import { join as join15 } from "node:path";
13674
13706
  import { pathToFileURL as pathToFileURL2 } from "node:url";
13675
13707
  import { prompt as prompt5 } from "storybook/internal/node-logger";
13676
13708
  import { FindPackageVersionsError as FindPackageVersionsError5 } from "storybook/internal/server-errors";
@@ -13805,7 +13837,7 @@ var Yarn2Proxy = class extends JsPackageManager {
13805
13837
  });
13806
13838
  const virtualFs = new import_fslib.VirtualFS({ baseFs: zipOpenFs });
13807
13839
  const crossFs = new import_fslib.PosixFS(virtualFs);
13808
- const virtualPath = join14(pkg.packageLocation, "package.json");
13840
+ const virtualPath = join15(pkg.packageLocation, "package.json");
13809
13841
  return crossFs.readJsonSync(virtualPath);
13810
13842
  } catch (error) {
13811
13843
  if (error.code !== "ERR_MODULE_NOT_FOUND") {
@@ -13814,7 +13846,7 @@ var Yarn2Proxy = class extends JsPackageManager {
13814
13846
  return null;
13815
13847
  }
13816
13848
  }
13817
- const wantedPath = join14("node_modules", packageName, "package.json");
13849
+ const wantedPath = join15("node_modules", packageName, "package.json");
13818
13850
  const packageJsonPath = up(wantedPath, {
13819
13851
  cwd: this.primaryPackageJson.operationDir,
13820
13852
  last: getProjectRoot()
@@ -13967,8 +13999,8 @@ var JsPackageManagerFactory = class {
13967
13999
  up(BUN_LOCKFILE, { cwd, last: root }),
13968
14000
  up(BUN_LOCKFILE_BINARY, { cwd, last: root })
13969
14001
  ].filter(Boolean).sort((a, b) => {
13970
- const dirA = parse2(a).dir;
13971
- const dirB = parse2(b).dir;
14002
+ const dirA = parse3(a).dir;
14003
+ const dirB = parse3(b).dir;
13972
14004
  const compare = relative4(dirA, dirB);
13973
14005
  if (dirA === dirB) {
13974
14006
  return 0;
@@ -14127,7 +14159,7 @@ async function scanAndTransformFiles({
14127
14159
  initial: defaultGlob
14128
14160
  });
14129
14161
  console.log("Scanning for affected files...");
14130
- const globby = (await import("./globby-3IFB7BJC.js")).globby;
14162
+ const globby = (await import("./globby-G3CLKE4Y.js")).globby;
14131
14163
  const sourceFiles = await globby([glob2], {
14132
14164
  ...commonGlobOptions(""),
14133
14165
  ignore: ["**/node_modules/**"],
@@ -14141,7 +14173,7 @@ async function scanAndTransformFiles({
14141
14173
  __name(scanAndTransformFiles, "scanAndTransformFiles");
14142
14174
 
14143
14175
  // src/common/utils/transform-imports.ts
14144
- import { readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
14176
+ import { readFile as readFile6, writeFile as writeFile4 } from "node:fs/promises";
14145
14177
  function transformImports(source, renamedImports) {
14146
14178
  let hasChanges = false;
14147
14179
  let transformed = source;
@@ -14157,16 +14189,16 @@ function transformImports(source, renamedImports) {
14157
14189
  __name(transformImports, "transformImports");
14158
14190
  var transformImportFiles = /* @__PURE__ */ __name(async (files, renamedImports, dryRun) => {
14159
14191
  const errors = [];
14160
- const { default: pLimit } = await import("./p-limit-3V5XIKA7.js");
14192
+ const { default: pLimit } = await import("./p-limit-JBOY5PGK.js");
14161
14193
  const limit = pLimit(10);
14162
14194
  await Promise.all(
14163
14195
  files.map(
14164
14196
  (file) => limit(async () => {
14165
14197
  try {
14166
- const contents = await readFile5(file, "utf-8");
14198
+ const contents = await readFile6(file, "utf-8");
14167
14199
  const transformed = transformImports(contents, renamedImports);
14168
14200
  if (!dryRun && transformed) {
14169
- await writeFile3(file, transformed);
14201
+ await writeFile4(file, transformed);
14170
14202
  }
14171
14203
  } catch (error) {
14172
14204
  errors.push({ file, error });
@@ -1,22 +1,22 @@
1
- import CJS_COMPAT_NODE_URL_0v1evul49qdo from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_0v1evul49qdo from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_0v1evul49qdo from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7kszd2fgfzq from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7kszd2fgfzq from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7kszd2fgfzq from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_0v1evul49qdo.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_0v1evul49qdo.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_0v1evul49qdo.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7kszd2fgfzq.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7kszd2fgfzq.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7kszd2fgfzq.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  require_dist
14
- } from "./chunk-MLBTKECD.js";
14
+ } from "./chunk-5SPDSTWP.js";
15
15
  import {
16
16
  __export,
17
17
  __name,
18
18
  __toESM
19
- } from "./chunk-XZTBG2TG.js";
19
+ } from "./chunk-FRTUAT3V.js";
20
20
 
21
21
  // src/cli/globalSettings.ts
22
22
  var import_ts_dedent = __toESM(require_dist(), 1);
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_0v1evul49qdo from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_0v1evul49qdo from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_0v1evul49qdo from "node:module";
1
+ import CJS_COMPAT_NODE_URL_7kszd2fgfzq from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_7kszd2fgfzq from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_7kszd2fgfzq from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_0v1evul49qdo.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_0v1evul49qdo.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_0v1evul49qdo.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_7kszd2fgfzq.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_7kszd2fgfzq.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_7kszd2fgfzq.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_0v1evul49qdo.createRequire(import.meta.url)
12
12
  import {
13
13
  __name,
14
14
  __require
15
- } from "./chunk-XZTBG2TG.js";
15
+ } from "./chunk-FRTUAT3V.js";
16
16
 
17
17
  // ../node_modules/@storybook/docs-mdx/dist/chunk-H6DQNFQR.js
18
18
  var __create = Object.create;