storybook 10.1.0-alpha.0 → 10.1.0-alpha.2

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 (74) hide show
  1. package/dist/_browser-chunks/{chunk-I74EUU5O.js → chunk-B3S3ROIP.js} +2 -1
  2. package/dist/_node-chunks/{builder-manager-OTO33TIA.js → builder-manager-XRIDLU42.js} +12 -12
  3. package/dist/_node-chunks/camelcase-3IIGGJ6N.js +18 -0
  4. package/dist/_node-chunks/{chunk-27W6KHQ2.js → chunk-2L3QAN3W.js} +7 -7
  5. package/dist/_node-chunks/{chunk-XI2VU32X.js → chunk-3AR5SJTX.js} +7 -7
  6. package/dist/_node-chunks/{chunk-SV7ZHC5Z.js → chunk-5RN3IJGF.js} +7 -7
  7. package/dist/_node-chunks/{chunk-LOF6SIRE.js → chunk-6TX2TV3E.js} +12 -12
  8. package/dist/_node-chunks/{chunk-FWW4IJCM.js → chunk-6WXUZSNC.js} +10 -10
  9. package/dist/_node-chunks/{chunk-O4KUWXD6.js → chunk-BAE27Z3H.js} +8 -8
  10. package/dist/_node-chunks/{chunk-3ICYWJ3N.js → chunk-BB3ZKTWJ.js} +7 -7
  11. package/dist/_node-chunks/{chunk-2WZNP46P.js → chunk-BYQZFXRF.js} +8 -8
  12. package/dist/_node-chunks/{chunk-FDDQACQD.js → chunk-D43KJFPO.js} +7 -7
  13. package/dist/_node-chunks/{chunk-L5WAZZY3.js → chunk-EKPHXLN6.js} +7 -7
  14. package/dist/_node-chunks/{chunk-A6T2YN75.js → chunk-FI6CLUVL.js} +15 -15
  15. package/dist/_node-chunks/{chunk-NTB3C5XQ.js → chunk-FWBIPR34.js} +7 -7
  16. package/dist/_node-chunks/{chunk-ZFRTME73.js → chunk-GWSFLQQQ.js} +22 -21
  17. package/dist/_node-chunks/{chunk-NTAOH664.js → chunk-HFHQNHRU.js} +9 -9
  18. package/dist/_node-chunks/{chunk-HYNQ2IX4.js → chunk-IK3K67LJ.js} +7 -7
  19. package/dist/_node-chunks/{chunk-RKANIOER.js → chunk-L5J4RBU5.js} +8 -8
  20. package/dist/_node-chunks/{chunk-HHTKRAIE.js → chunk-LJPS53G5.js} +25 -7
  21. package/dist/_node-chunks/chunk-N3ZE2FCS.js +61 -0
  22. package/dist/_node-chunks/{chunk-HIGKW2KB.js → chunk-OM4TBMP7.js} +7 -7
  23. package/dist/_node-chunks/{chunk-Q4CZSEBO.js → chunk-Q5JSLT56.js} +7 -7
  24. package/dist/_node-chunks/{chunk-6M2IPO4E.js → chunk-QFET4WIW.js} +6 -6
  25. package/dist/_node-chunks/{chunk-YS6OLN4N.js → chunk-QS5MMNF7.js} +7 -7
  26. package/dist/_node-chunks/{chunk-AITYHU22.js → chunk-RIPSSVT6.js} +7 -7
  27. package/dist/_node-chunks/{chunk-6C7OBGYG.js → chunk-RQKELEE4.js} +7 -7
  28. package/dist/_node-chunks/{chunk-VL6WDGIU.js → chunk-RUJOX3JR.js} +6 -6
  29. package/dist/_node-chunks/{chunk-RR6Q3657.js → chunk-S6RYOO4I.js} +9 -9
  30. package/dist/_node-chunks/chunk-U6VJQXTG.js +18 -0
  31. package/dist/_node-chunks/{chunk-Q6QFW2Y7.js → chunk-VEZ6C62C.js} +39 -24
  32. package/dist/_node-chunks/{chunk-EFJRT54D.js → chunk-WHOPLOGE.js} +7 -7
  33. package/dist/_node-chunks/{chunk-OYGAWJQE.js → chunk-XVXUF5GE.js} +7 -7
  34. package/dist/_node-chunks/{chunk-O3OJUFKU.js → chunk-ZI3WVJBS.js} +8 -8
  35. package/dist/_node-chunks/{chunk-QOI32MCO.js → chunk-ZN2EDLIJ.js} +7 -7
  36. package/dist/_node-chunks/{chunk-VW3GGAQI.js → chunk-ZTHTAFLY.js} +12 -12
  37. package/dist/_node-chunks/{dist-BA2GAJJB.js → dist-Q25SOSXX.js} +9 -9
  38. package/dist/_node-chunks/{globby-4HAI4KJH.js → globby-I54LIY47.js} +9 -9
  39. package/dist/_node-chunks/{lib-ITRY6RT7.js → lib-KQD2WJWJ.js} +7 -7
  40. package/dist/_node-chunks/{mdx-N42X6CFJ-7PULFTZI.js → mdx-N42X6CFJ-CT3A7SBK.js} +8 -8
  41. package/dist/_node-chunks/{p-limit-63FY4KTG.js → p-limit-2NBKFARM.js} +7 -7
  42. package/dist/_node-chunks/{plugin-JEBMTDIB.js → plugin-2CCCBGGB.js} +10 -10
  43. package/dist/_node-chunks/{plugin-2BSKCSMA.js → plugin-RF5FICSG.js} +10 -10
  44. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-AZ7YPMMD.js → webpack-inject-mocker-runtime-plugin-RY56E77L.js} +10 -10
  45. package/dist/_node-chunks/{webpack-mock-plugin-7IF6PA2O.js → webpack-mock-plugin-6VDFRSC4.js} +9 -9
  46. package/dist/babel/index.js +11 -11
  47. package/dist/bin/core.js +11 -11
  48. package/dist/bin/dispatcher.js +11 -11
  49. package/dist/bin/loader.js +9 -9
  50. package/dist/cli/index.js +21 -21
  51. package/dist/common/index.d.ts +21 -2
  52. package/dist/common/index.js +22 -20
  53. package/dist/components/index.js +1 -1
  54. package/dist/core-server/index.js +150 -103
  55. package/dist/core-server/presets/common-manager.js +1 -1
  56. package/dist/core-server/presets/common-override-preset.js +9 -9
  57. package/dist/core-server/presets/common-preset.js +27 -27
  58. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  59. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  60. package/dist/csf-tools/index.d.ts +8 -4
  61. package/dist/csf-tools/index.js +9 -9
  62. package/dist/manager/globals-runtime.js +5 -4
  63. package/dist/manager-api/index.d.ts +1 -1
  64. package/dist/manager-api/index.js +1 -1
  65. package/dist/node-logger/index.js +14 -14
  66. package/dist/preview/runtime.js +2 -2
  67. package/dist/server-errors.js +10 -10
  68. package/dist/telemetry/index.js +24 -24
  69. package/dist/test/index.js +2 -2
  70. package/dist/types/index.d.ts +45 -5
  71. package/package.json +1 -1
  72. package/dist/_node-chunks/camelcase-HURSU73A.js +0 -18
  73. package/dist/_node-chunks/chunk-P7ZABCRS.js +0 -18
  74. package/dist/_node-chunks/chunk-QWBT2XCX.js +0 -61
@@ -1,29 +1,29 @@
1
- import CJS_COMPAT_NODE_URL_viqf41uklqm from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_viqf41uklqm from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_viqf41uklqm from "node:module";
1
+ import CJS_COMPAT_NODE_URL_gimmxetvr7 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_gimmxetvr7 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_gimmxetvr7 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_viqf41uklqm.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_viqf41uklqm.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_viqf41uklqm.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_gimmxetvr7.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_gimmxetvr7.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_gimmxetvr7.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
  detectPnp
14
- } from "../_node-chunks/chunk-LOF6SIRE.js";
14
+ } from "../_node-chunks/chunk-6TX2TV3E.js";
15
15
  import {
16
16
  require_pretty_hrtime
17
- } from "../_node-chunks/chunk-QOI32MCO.js";
17
+ } from "../_node-chunks/chunk-ZN2EDLIJ.js";
18
18
  import {
19
19
  boxen,
20
20
  require_string_width
21
- } from "../_node-chunks/chunk-2WZNP46P.js";
22
- import "../_node-chunks/chunk-SV7ZHC5Z.js";
21
+ } from "../_node-chunks/chunk-BYQZFXRF.js";
22
+ import "../_node-chunks/chunk-5RN3IJGF.js";
23
23
  import {
24
24
  StatusTypeIdMismatchError,
25
25
  StorybookError
26
- } from "../_node-chunks/chunk-NTAOH664.js";
26
+ } from "../_node-chunks/chunk-HFHQNHRU.js";
27
27
  import {
28
28
  getErrorLevel,
29
29
  mapStaticDir,
@@ -31,59 +31,61 @@ import {
31
31
  sendTelemetryError,
32
32
  useStatics,
33
33
  withTelemetry
34
- } from "../_node-chunks/chunk-VW3GGAQI.js";
35
- import "../_node-chunks/chunk-6C7OBGYG.js";
34
+ } from "../_node-chunks/chunk-ZTHTAFLY.js";
35
+ import "../_node-chunks/chunk-RQKELEE4.js";
36
36
  import {
37
37
  telemetry
38
- } from "../_node-chunks/chunk-A6T2YN75.js";
39
- import "../_node-chunks/chunk-P7ZABCRS.js";
38
+ } from "../_node-chunks/chunk-FI6CLUVL.js";
39
+ import "../_node-chunks/chunk-U6VJQXTG.js";
40
40
  import {
41
41
  userOrAutoTitleFromSpecifier
42
- } from "../_node-chunks/chunk-ZFRTME73.js";
43
- import "../_node-chunks/chunk-OYGAWJQE.js";
44
- import "../_node-chunks/chunk-QWBT2XCX.js";
45
- import "../_node-chunks/chunk-RKANIOER.js";
42
+ } from "../_node-chunks/chunk-GWSFLQQQ.js";
43
+ import "../_node-chunks/chunk-XVXUF5GE.js";
44
+ import "../_node-chunks/chunk-N3ZE2FCS.js";
45
+ import "../_node-chunks/chunk-L5J4RBU5.js";
46
46
  import {
47
47
  optionalEnvToBoolean,
48
48
  require_cross_spawn
49
- } from "../_node-chunks/chunk-RR6Q3657.js";
49
+ } from "../_node-chunks/chunk-S6RYOO4I.js";
50
50
  import {
51
51
  up2 as up
52
- } from "../_node-chunks/chunk-XI2VU32X.js";
53
- import "../_node-chunks/chunk-HIGKW2KB.js";
52
+ } from "../_node-chunks/chunk-3AR5SJTX.js";
53
+ import "../_node-chunks/chunk-OM4TBMP7.js";
54
54
  import {
55
55
  invariant
56
- } from "../_node-chunks/chunk-FDDQACQD.js";
56
+ } from "../_node-chunks/chunk-D43KJFPO.js";
57
57
  import {
58
58
  importModule,
59
59
  resolvePackageDir
60
- } from "../_node-chunks/chunk-O3OJUFKU.js";
60
+ } from "../_node-chunks/chunk-ZI3WVJBS.js";
61
61
  import {
62
+ join,
63
+ relative,
62
64
  resolve
63
- } from "../_node-chunks/chunk-HHTKRAIE.js";
65
+ } from "../_node-chunks/chunk-LJPS53G5.js";
64
66
  import {
65
67
  require_prompts
66
- } from "../_node-chunks/chunk-3ICYWJ3N.js";
67
- import "../_node-chunks/chunk-Q4CZSEBO.js";
68
+ } from "../_node-chunks/chunk-BB3ZKTWJ.js";
69
+ import "../_node-chunks/chunk-Q5JSLT56.js";
68
70
  import {
69
71
  slash
70
- } from "../_node-chunks/chunk-L5WAZZY3.js";
72
+ } from "../_node-chunks/chunk-EKPHXLN6.js";
71
73
  import {
72
74
  require_dist
73
- } from "../_node-chunks/chunk-HYNQ2IX4.js";
75
+ } from "../_node-chunks/chunk-IK3K67LJ.js";
74
76
  import {
75
77
  require_lib,
76
78
  require_src
77
- } from "../_node-chunks/chunk-YS6OLN4N.js";
79
+ } from "../_node-chunks/chunk-QS5MMNF7.js";
78
80
  import {
79
81
  require_picocolors
80
- } from "../_node-chunks/chunk-27W6KHQ2.js";
82
+ } from "../_node-chunks/chunk-2L3QAN3W.js";
81
83
  import {
82
84
  __commonJS,
83
85
  __name,
84
86
  __require,
85
87
  __toESM
86
- } from "../_node-chunks/chunk-VL6WDGIU.js";
88
+ } from "../_node-chunks/chunk-RUJOX3JR.js";
87
89
 
88
90
  // ../node_modules/tsconfig-paths/lib/filesystem.js
89
91
  var require_filesystem = __commonJS({
@@ -1827,7 +1829,7 @@ var require_parse_chunked = __commonJS({
1827
1829
  module.exports = function(chunkEmitter) {
1828
1830
  let parser = new ChunkParser();
1829
1831
  if (isObject(chunkEmitter) && isReadableStream(chunkEmitter)) {
1830
- return new Promise((resolve7, reject) => {
1832
+ return new Promise((resolve4, reject) => {
1831
1833
  chunkEmitter.on("data", (chunk) => {
1832
1834
  try {
1833
1835
  parser.push(chunk);
@@ -1840,7 +1842,7 @@ var require_parse_chunked = __commonJS({
1840
1842
  reject(e);
1841
1843
  }).on("end", () => {
1842
1844
  try {
1843
- resolve7(parser.finish());
1845
+ resolve4(parser.finish());
1844
1846
  } catch (e) {
1845
1847
  reject(adjustPosition(e, parser));
1846
1848
  } finally {
@@ -1852,12 +1854,12 @@ var require_parse_chunked = __commonJS({
1852
1854
  if (typeof chunkEmitter === "function") {
1853
1855
  const iterator = chunkEmitter();
1854
1856
  if (isObject(iterator) && (Symbol.iterator in iterator || Symbol.asyncIterator in iterator)) {
1855
- return new Promise(async (resolve7, reject) => {
1857
+ return new Promise(async (resolve4, reject) => {
1856
1858
  try {
1857
1859
  for await (const chunk of iterator) {
1858
1860
  parser.push(chunk);
1859
1861
  }
1860
- resolve7(parser.finish());
1862
+ resolve4(parser.finish());
1861
1863
  } catch (e) {
1862
1864
  reject(adjustPosition(e, parser));
1863
1865
  } finally {
@@ -2628,8 +2630,8 @@ var require_graceful_fs = __commonJS({
2628
2630
  }
2629
2631
  __name(readFile5, "readFile");
2630
2632
  var fs$writeFile = fs7.writeFile;
2631
- fs7.writeFile = writeFile4;
2632
- function writeFile4(path2, data, options, cb) {
2633
+ fs7.writeFile = writeFile5;
2634
+ function writeFile5(path2, data, options, cb) {
2633
2635
  if (typeof options === "function")
2634
2636
  cb = options, options = null;
2635
2637
  return go$writeFile(path2, data, options, cb);
@@ -2645,7 +2647,7 @@ var require_graceful_fs = __commonJS({
2645
2647
  }
2646
2648
  __name(go$writeFile, "go$writeFile");
2647
2649
  }
2648
- __name(writeFile4, "writeFile");
2650
+ __name(writeFile5, "writeFile");
2649
2651
  var fs$appendFile = fs7.appendFile;
2650
2652
  if (fs$appendFile)
2651
2653
  fs7.appendFile = appendFile;
@@ -6585,9 +6587,9 @@ var require_detect_port = __commonJS({
6585
6587
  if (typeof callback === "function") {
6586
6588
  return tryListen(port, maxPort, hostname, callback);
6587
6589
  }
6588
- return new Promise((resolve7) => {
6590
+ return new Promise((resolve4) => {
6589
6591
  tryListen(port, maxPort, hostname, (_, realPort) => {
6590
- resolve7(realPort);
6592
+ resolve4(realPort);
6591
6593
  });
6592
6594
  });
6593
6595
  };
@@ -6668,7 +6670,7 @@ var require_wait_port = __commonJS({
6668
6670
  "use strict";
6669
6671
  var debug = require_src()("wait-port");
6670
6672
  var detect = require_detect_port();
6671
- var sleep = /* @__PURE__ */ __name((ms) => new Promise((resolve7) => setTimeout(resolve7, ms)), "sleep");
6673
+ var sleep = /* @__PURE__ */ __name((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)), "sleep");
6672
6674
  async function waitPort(port, options = {}) {
6673
6675
  const { retryInterval = 1e3, retries = Infinity } = options;
6674
6676
  let count = 1;
@@ -8471,10 +8473,8 @@ var require_cli_table3 = __commonJS({
8471
8473
  import { getPreviewHeadTemplate, getPreviewBodyTemplate } from "storybook/internal/common";
8472
8474
 
8473
8475
  // src/core-server/build-static.ts
8474
- var import_picocolors4 = __toESM(require_picocolors(), 1);
8475
- import { cp as cp2, mkdir } from "node:fs/promises";
8476
+ import { cp as cp2, mkdir, writeFile as writeFile3 } from "node:fs/promises";
8476
8477
  import { rm } from "node:fs/promises";
8477
- import { join as join5, relative as relative4, resolve as resolve4 } from "node:path";
8478
8478
  import {
8479
8479
  loadAllPresets,
8480
8480
  loadMainConfig,
@@ -8485,11 +8485,12 @@ import {
8485
8485
  import { logger as logger4 } from "storybook/internal/node-logger";
8486
8486
  import { getPrecedingUpgrade, telemetry as telemetry2 } from "storybook/internal/telemetry";
8487
8487
  import { global as global2 } from "@storybook/global";
8488
+ var import_picocolors4 = __toESM(require_picocolors(), 1);
8488
8489
 
8489
8490
  // src/core-server/utils/StoryIndexGenerator.ts
8490
8491
  import { existsSync } from "node:fs";
8491
8492
  import { readFile } from "node:fs/promises";
8492
- import { dirname, extname, join, normalize, relative, resolve as resolve2, sep } from "node:path";
8493
+ import { dirname, extname, join as join2, normalize, relative as relative2, resolve as resolve2, sep } from "node:path";
8493
8494
  import { commonGlobOptions, getProjectRoot, normalizeStoryPath } from "storybook/internal/common";
8494
8495
  import { combineTags, storyNameFromExport, toId } from "storybook/internal/csf";
8495
8496
  import { getStorySortParameter, loadConfig } from "storybook/internal/csf-tools";
@@ -8683,7 +8684,7 @@ function isMdxEntry({ tags }) {
8683
8684
  return tags?.includes(UNATTACHED_MDX_TAG) || tags?.includes(ATTACHED_MDX_TAG);
8684
8685
  }
8685
8686
  __name(isMdxEntry, "isMdxEntry");
8686
- var makeAbsolute = /* @__PURE__ */ __name((otherImport, normalizedPath, workingDir) => otherImport.startsWith(".") ? slash(resolve2(workingDir, normalizeStoryPath(join(dirname(normalizedPath), otherImport)))) : otherImport, "makeAbsolute");
8687
+ var makeAbsolute = /* @__PURE__ */ __name((otherImport, normalizedPath, workingDir) => otherImport.startsWith(".") ? slash(resolve2(workingDir, normalizeStoryPath(join2(dirname(normalizedPath), otherImport)))) : otherImport, "makeAbsolute");
8687
8688
  var StoryIndexGenerator = class _StoryIndexGenerator {
8688
8689
  constructor(specifiers, options) {
8689
8690
  this.specifiers = specifiers;
@@ -8717,8 +8718,8 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
8717
8718
  return cached;
8718
8719
  }
8719
8720
  const pathToSubIndex = {};
8720
- const fullGlob = slash(join(specifier.directory, specifier.files));
8721
- const { globby } = await import("../_node-chunks/globby-4HAI4KJH.js");
8721
+ const fullGlob = slash(join2(specifier.directory, specifier.files));
8722
+ const { globby } = await import("../_node-chunks/globby-I54LIY47.js");
8722
8723
  const files = await globby(fullGlob, {
8723
8724
  absolute: true,
8724
8725
  cwd: workingDir,
@@ -8727,14 +8728,14 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
8727
8728
  if (files.length === 0 && !ignoreWarnings) {
8728
8729
  once.warn(
8729
8730
  `No story files found for the specified pattern: ${import_picocolors.default.blue(
8730
- join(specifier.directory, specifier.files)
8731
+ join2(specifier.directory, specifier.files)
8731
8732
  )}`
8732
8733
  );
8733
8734
  }
8734
8735
  files.sort().forEach((absolutePath) => {
8735
8736
  const ext = extname(absolutePath);
8736
8737
  if (ext === ".storyshot") {
8737
- const relativePath = relative(workingDir, absolutePath);
8738
+ const relativePath = relative2(workingDir, absolutePath);
8738
8739
  logger.info(`Skipping ${ext} file ${relativePath}`);
8739
8740
  return;
8740
8741
  }
@@ -8786,7 +8787,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
8786
8787
  try {
8787
8788
  entry[absolutePath] = await updater(specifier, absolutePath, entry[absolutePath]);
8788
8789
  } catch (err) {
8789
- const relativePath = `.${sep}${relative(this.options.workingDir, absolutePath)}`;
8790
+ const relativePath = `.${sep}${relative2(this.options.workingDir, absolutePath)}`;
8790
8791
  entry[absolutePath] = {
8791
8792
  type: "error",
8792
8793
  err: new IndexingError(
@@ -8874,13 +8875,13 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
8874
8875
  const absoluteComponentPath = resolve2(dirname(absolutePath), rawPath);
8875
8876
  const existing = ["", ".js", ".ts", ".jsx", ".tsx", ".mjs", ".mts"].map((ext) => `${absoluteComponentPath}${ext}`).find((candidate) => existsSync(candidate));
8876
8877
  if (existing) {
8877
- const relativePath = relative(this.options.workingDir, existing);
8878
+ const relativePath = relative2(this.options.workingDir, existing);
8878
8879
  return slash(normalizeStoryPath(relativePath));
8879
8880
  }
8880
8881
  return rawComponentPath;
8881
8882
  }
8882
8883
  async extractStories(specifier, absolutePath, projectTags = []) {
8883
- const relativePath = relative(this.options.workingDir, absolutePath);
8884
+ const relativePath = relative2(this.options.workingDir, absolutePath);
8884
8885
  const importPath = slash(normalizeStoryPath(relativePath));
8885
8886
  const defaultMakeTitle = /* @__PURE__ */ __name((userTitle) => {
8886
8887
  const title = userOrAutoTitleFromSpecifier(importPath, specifier, userTitle);
@@ -8971,12 +8972,12 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
8971
8972
  };
8972
8973
  }
8973
8974
  async extractDocs(specifier, absolutePath, projectTags = []) {
8974
- const relativePath = relative(this.options.workingDir, absolutePath);
8975
+ const relativePath = relative2(this.options.workingDir, absolutePath);
8975
8976
  try {
8976
8977
  const normalizedPath = normalizeStoryPath(relativePath);
8977
8978
  const importPath = slash(normalizedPath);
8978
8979
  const content = await readFile(absolutePath, { encoding: "utf8" });
8979
- const { analyze } = await import("../_node-chunks/dist-BA2GAJJB.js");
8980
+ const { analyze } = await import("../_node-chunks/dist-Q25SOSXX.js");
8980
8981
  const result = await analyze(content);
8981
8982
  if (result.isTemplate) {
8982
8983
  return false;
@@ -9223,7 +9224,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
9223
9224
  this.lastError = null;
9224
9225
  }
9225
9226
  async getPreviewCode() {
9226
- const previewFile = ["js", "jsx", "ts", "tsx", "mjs", "cjs", "mts"].map((ext) => join(this.options.configDir, `preview.${ext}`)).find((fname) => existsSync(fname));
9227
+ const previewFile = ["js", "jsx", "ts", "tsx", "mjs", "cjs", "mts"].map((ext) => join2(this.options.configDir, `preview.${ext}`)).find((fname) => existsSync(fname));
9227
9228
  return previewFile && (await readFile(previewFile, { encoding: "utf8" })).toString();
9228
9229
  }
9229
9230
  getProjectTags(previewCode) {
@@ -9280,7 +9281,7 @@ __name(buildOrThrow, "buildOrThrow");
9280
9281
  // src/core-server/utils/copy-all-static-files.ts
9281
9282
  var import_picocolors2 = __toESM(require_picocolors(), 1);
9282
9283
  import { cp } from "node:fs/promises";
9283
- import { join as join2, relative as relative2 } from "node:path";
9284
+ import { join as join3, relative as relative3 } from "node:path";
9284
9285
  import { getDirectoryFromWorkingDir } from "storybook/internal/common";
9285
9286
  import { logger as logger2 } from "storybook/internal/node-logger";
9286
9287
  async function copyAllStaticFilesRelativeToMain(staticDirs, outputDir, configDir) {
@@ -9295,8 +9296,8 @@ async function copyAllStaticFilesRelativeToMain(staticDirs, outputDir, configDir
9295
9296
  directory: staticDirAndTarget
9296
9297
  })
9297
9298
  );
9298
- const targetPath = join2(outputDir, to);
9299
- const skipPaths = ["index.html", "iframe.html"].map((f) => join2(outputDir, f));
9299
+ const targetPath = join3(outputDir, to);
9300
+ const skipPaths = ["index.html", "iframe.html"].map((f) => join3(outputDir, f));
9300
9301
  if (!from.includes("node_modules")) {
9301
9302
  logger2.info(
9302
9303
  `=> Copying static files: ${import_picocolors2.default.cyan(print(from))} at ${import_picocolors2.default.cyan(print(targetPath))}`
@@ -9312,14 +9313,14 @@ async function copyAllStaticFilesRelativeToMain(staticDirs, outputDir, configDir
9312
9313
  }
9313
9314
  __name(copyAllStaticFilesRelativeToMain, "copyAllStaticFilesRelativeToMain");
9314
9315
  function print(p) {
9315
- return relative2(process.cwd(), p);
9316
+ return relative3(process.cwd(), p);
9316
9317
  }
9317
9318
  __name(print, "print");
9318
9319
 
9319
9320
  // src/core-server/utils/get-builders.ts
9320
9321
  import { MissingBuilderError } from "storybook/internal/server-errors";
9321
9322
  async function getManagerBuilder() {
9322
- return await import("../_node-chunks/builder-manager-OTO33TIA.js");
9323
+ return await import("../_node-chunks/builder-manager-XRIDLU42.js");
9323
9324
  }
9324
9325
  __name(getManagerBuilder, "getManagerBuilder");
9325
9326
  async function getPreviewBuilder(resolvedPreviewBuilder) {
@@ -9358,7 +9359,7 @@ __name(useStorybookMetadata, "useStorybookMetadata");
9358
9359
  var import_json_ext = __toESM(require_src2(), 1);
9359
9360
  var import_picocolors3 = __toESM(require_picocolors(), 1);
9360
9361
  import { createWriteStream } from "node:fs";
9361
- import { join as join3 } from "node:path";
9362
+ import { join as join4 } from "node:path";
9362
9363
  import { logger as logger3 } from "storybook/internal/node-logger";
9363
9364
  async function outputStats(directory, previewStats, managerStats) {
9364
9365
  if (previewStats) {
@@ -9372,10 +9373,10 @@ async function outputStats(directory, previewStats, managerStats) {
9372
9373
  }
9373
9374
  __name(outputStats, "outputStats");
9374
9375
  var writeStats = /* @__PURE__ */ __name(async (directory, name, stats) => {
9375
- const filePath = join3(directory, `${name}-stats.json`);
9376
+ const filePath = join4(directory, `${name}-stats.json`);
9376
9377
  const { chunks, ...data } = stats.toJson();
9377
- await new Promise((resolve7, reject) => {
9378
- (0, import_json_ext.stringifyStream)(data, null, 2).on("error", reject).pipe(createWriteStream(filePath)).on("error", reject).on("finish", resolve7);
9378
+ await new Promise((resolve4, reject) => {
9379
+ (0, import_json_ext.stringifyStream)(data, null, 2).on("error", reject).pipe(createWriteStream(filePath)).on("error", reject).on("finish", resolve4);
9379
9380
  });
9380
9381
  return filePath;
9381
9382
  }, "writeStats");
@@ -9497,7 +9498,7 @@ var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
9497
9498
 
9498
9499
  // src/core-server/utils/watch-story-specifiers.ts
9499
9500
  import { lstatSync, readdirSync } from "node:fs";
9500
- import { basename as basename2, join as join4, relative as relative3, resolve as resolve3 } from "node:path";
9501
+ import { basename as basename2, join as join5, relative as relative4, resolve as resolve3 } from "node:path";
9501
9502
  import { commonGlobOptions as commonGlobOptions2 } from "storybook/internal/common";
9502
9503
  var import_watchpack = __toESM(require_watchpack(), 1);
9503
9504
  var isDirectory = /* @__PURE__ */ __name((directory) => {
@@ -9516,9 +9517,9 @@ function getNestedFilesAndDirectories(directories) {
9516
9517
  }
9517
9518
  readdirSync(directory, { withFileTypes: true }).forEach((ent) => {
9518
9519
  if (ent.isDirectory()) {
9519
- traverse(join4(directory, ent.name));
9520
+ traverse(join5(directory, ent.name));
9520
9521
  } else if (ent.isFile()) {
9521
- files.add(join4(directory, ent.name));
9522
+ files.add(join5(directory, ent.name));
9522
9523
  }
9523
9524
  });
9524
9525
  traversedDirectories.add(directory);
@@ -9538,7 +9539,7 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
9538
9539
  });
9539
9540
  wp.watch({ files, directories });
9540
9541
  const toImportPath = /* @__PURE__ */ __name((absolutePath) => {
9541
- const relativePath = relative3(options.workingDir, absolutePath);
9542
+ const relativePath = relative4(options.workingDir, absolutePath);
9542
9543
  return slash(relativePath.startsWith(".") ? relativePath : `./${relativePath}`);
9543
9544
  }, "toImportPath");
9544
9545
  async function onChangeOrRemove(absolutePath, removed) {
@@ -9551,14 +9552,14 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
9551
9552
  if (!removed && isDirectory(absolutePath)) {
9552
9553
  await Promise.all(
9553
9554
  specifiers.filter((specifier) => importPath.startsWith(specifier.directory)).map(async (specifier) => {
9554
- const dirGlob = join4(
9555
+ const dirGlob = join5(
9555
9556
  absolutePath,
9556
9557
  "**",
9557
9558
  // files can be e.g. '**/foo/*/*.js' so we just want the last bit,
9558
9559
  // because the directory could already be within the files part (e.g. './x/foo/bar')
9559
9560
  basename2(specifier.files)
9560
9561
  );
9561
- const { globby } = await import("../_node-chunks/globby-4HAI4KJH.js");
9562
+ const { globby } = await import("../_node-chunks/globby-I54LIY47.js");
9562
9563
  const addedFiles = await globby(slash(dirGlob), commonGlobOptions2(dirGlob));
9563
9564
  addedFiles.forEach((filePath) => {
9564
9565
  const fileImportPath = toImportPath(filePath);
@@ -9762,10 +9763,10 @@ async function buildStaticStandalone(options) {
9762
9763
  if (options.outputDir === "") {
9763
9764
  throw new Error("Won't remove current directory. Check your outputDir!");
9764
9765
  }
9765
- options.outputDir = resolve4(options.outputDir);
9766
- options.configDir = resolve4(options.configDir);
9766
+ options.outputDir = resolve(options.outputDir);
9767
+ options.configDir = resolve(options.configDir);
9767
9768
  logger4.info(
9768
- `=> Cleaning outputDir: ${import_picocolors4.default.cyan(relative4(process.cwd(), options.outputDir))}`
9769
+ `=> Cleaning outputDir: ${import_picocolors4.default.cyan(relative(process.cwd(), options.outputDir))}`
9769
9770
  );
9770
9771
  if (options.outputDir === "/") {
9771
9772
  throw new Error("Won't remove directory '/'. Check your outputDir!");
@@ -9778,11 +9779,11 @@ async function buildStaticStandalone(options) {
9778
9779
  const corePresets = [];
9779
9780
  const frameworkName = typeof framework === "string" ? framework : framework?.name;
9780
9781
  if (frameworkName) {
9781
- corePresets.push(join5(frameworkName, "preset"));
9782
+ corePresets.push(join(frameworkName, "preset"));
9782
9783
  } else if (!options.ignorePreview) {
9783
9784
  logger4.warn(`you have not specified a framework in your ${options.configDir}/main.js`);
9784
9785
  }
9785
- const commonPreset = join5(
9786
+ const commonPreset = join(
9786
9787
  resolvePackageDir("storybook"),
9787
9788
  "dist/core-server/presets/common-preset.js"
9788
9789
  );
@@ -9842,7 +9843,7 @@ async function buildStaticStandalone(options) {
9842
9843
  copyAllStaticFilesRelativeToMain(staticDirs, options.outputDir, options.configDir)
9843
9844
  );
9844
9845
  }
9845
- const coreServerPublicDir = join5(resolvePackageDir("storybook"), "assets/browser");
9846
+ const coreServerPublicDir = join(resolvePackageDir("storybook"), "assets/browser");
9846
9847
  effects.push(cp2(coreServerPublicDir, options.outputDir, { recursive: true }));
9847
9848
  let initializedStoryIndexGenerator = Promise.resolve(void 0);
9848
9849
  if (!options.ignorePreview) {
@@ -9861,14 +9862,35 @@ async function buildStaticStandalone(options) {
9861
9862
  initializedStoryIndexGenerator = generator.initialize().then(() => generator);
9862
9863
  effects.push(
9863
9864
  extractStoriesJson(
9864
- join5(options.outputDir, "index.json"),
9865
+ join(options.outputDir, "index.json"),
9865
9866
  initializedStoryIndexGenerator
9866
9867
  )
9867
9868
  );
9869
+ if (features?.experimentalComponentsManifest) {
9870
+ const componentManifestGenerator = await presets.apply(
9871
+ "experimental_componentManifestGenerator"
9872
+ );
9873
+ const indexGenerator = await initializedStoryIndexGenerator;
9874
+ if (componentManifestGenerator && indexGenerator) {
9875
+ try {
9876
+ const manifests = await componentManifestGenerator(
9877
+ indexGenerator
9878
+ );
9879
+ await mkdir(join(options.outputDir, "manifests"), { recursive: true });
9880
+ await writeFile3(
9881
+ join(options.outputDir, "manifests", "components.json"),
9882
+ JSON.stringify(manifests)
9883
+ );
9884
+ } catch (e) {
9885
+ logger4.error("Failed to generate manifests/components.json");
9886
+ logger4.error(e instanceof Error ? e : String(e));
9887
+ }
9888
+ }
9889
+ }
9868
9890
  }
9869
9891
  if (!core2?.disableProjectJson) {
9870
9892
  effects.push(
9871
- extractStorybookMetadata(join5(options.outputDir, "project.json"), options.configDir)
9893
+ extractStorybookMetadata(join(options.outputDir, "project.json"), options.configDir)
9872
9894
  );
9873
9895
  }
9874
9896
  if (options.debugWebpack) {
@@ -9921,9 +9943,7 @@ async function buildStaticStandalone(options) {
9921
9943
  __name(buildStaticStandalone, "buildStaticStandalone");
9922
9944
 
9923
9945
  // src/core-server/build-dev.ts
9924
- var import_prompts = __toESM(require_prompts(), 1);
9925
9946
  import { readFile as readFile4 } from "node:fs/promises";
9926
- import { join as join7, relative as relative5, resolve as resolve5 } from "node:path";
9927
9947
  import {
9928
9948
  JsPackageManagerFactory,
9929
9949
  getConfigInfo,
@@ -9940,6 +9960,7 @@ import { deprecate, logger as logger11 } from "storybook/internal/node-logger";
9940
9960
  import { MissingBuilderError as MissingBuilderError3, NoStatsForViteDevError } from "storybook/internal/server-errors";
9941
9961
  import { oneWayHash, telemetry as telemetry4 } from "storybook/internal/telemetry";
9942
9962
  import { global as global3 } from "@storybook/global";
9963
+ var import_prompts = __toESM(require_prompts(), 1);
9943
9964
  var import_ts_dedent8 = __toESM(require_dist(), 1);
9944
9965
 
9945
9966
  // src/core-server/dev-server.ts
@@ -10418,13 +10439,13 @@ var UniversalStore = class _UniversalStore {
10418
10439
  } else {
10419
10440
  let syncingResolve;
10420
10441
  let syncingReject;
10421
- const syncingPromise = new Promise((resolve7, reject) => {
10442
+ const syncingPromise = new Promise((resolve4, reject) => {
10422
10443
  syncingResolve = /* @__PURE__ */ __name(() => {
10423
10444
  if (this.syncing.state !== ProgressState.PENDING) {
10424
10445
  return;
10425
10446
  }
10426
10447
  this.syncing.state = ProgressState.RESOLVED;
10427
- resolve7();
10448
+ resolve4();
10428
10449
  }, "syncingResolve");
10429
10450
  syncingReject = /* @__PURE__ */ __name((reason) => {
10430
10451
  if (this.syncing.state !== ProgressState.PENDING) {
@@ -10521,9 +10542,9 @@ var UniversalStore = class _UniversalStore {
10521
10542
  let resolveRef;
10522
10543
  let rejectRef;
10523
10544
  const promise = new Promise(
10524
- (resolve7, reject) => {
10545
+ (resolve4, reject) => {
10525
10546
  resolveRef = /* @__PURE__ */ __name((args) => {
10526
- resolve7(args);
10547
+ resolve4(args);
10527
10548
  }, "resolveRef");
10528
10549
  rejectRef = /* @__PURE__ */ __name((...args) => {
10529
10550
  reject(args);
@@ -11362,14 +11383,14 @@ var baseOpen = /* @__PURE__ */ __name(async (options) => {
11362
11383
  }
11363
11384
  const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
11364
11385
  if (options.wait) {
11365
- return new Promise((resolve7, reject) => {
11386
+ return new Promise((resolve4, reject) => {
11366
11387
  subprocess.once("error", reject);
11367
11388
  subprocess.once("close", (exitCode) => {
11368
11389
  if (!options.allowNonzeroExitCode && exitCode > 0) {
11369
11390
  reject(new Error(`Exited with code ${exitCode}`));
11370
11391
  return;
11371
11392
  }
11372
- resolve7(subprocess);
11393
+ resolve4(subprocess);
11373
11394
  });
11374
11395
  });
11375
11396
  }
@@ -11718,9 +11739,9 @@ async function storybookDevServer(options) {
11718
11739
  throw e;
11719
11740
  });
11720
11741
  }
11721
- const listening = new Promise((resolve7, reject) => {
11742
+ const listening = new Promise((resolve4, reject) => {
11722
11743
  server.once("error", reject);
11723
- app.listen({ port, host }, resolve7);
11744
+ app.listen({ port, host }, resolve4);
11724
11745
  });
11725
11746
  await Promise.all([initializedStoryIndexGenerator, listening]).then(async ([indexGenerator]) => {
11726
11747
  if (indexGenerator && !options.ci && !options.smokeTest && options.open) {
@@ -11734,6 +11755,33 @@ async function storybookDevServer(options) {
11734
11755
  await previewBuilder?.bail().catch();
11735
11756
  throw indexError;
11736
11757
  }
11758
+ const features = await options.presets.apply("features");
11759
+ if (features?.experimentalComponentsManifest) {
11760
+ app.use("/manifests/components.json", async (req, res) => {
11761
+ try {
11762
+ const componentManifestGenerator = await options.presets.apply(
11763
+ "experimental_componentManifestGenerator"
11764
+ );
11765
+ const indexGenerator = await initializedStoryIndexGenerator;
11766
+ if (componentManifestGenerator && indexGenerator) {
11767
+ const manifest = await componentManifestGenerator(
11768
+ indexGenerator
11769
+ );
11770
+ res.setHeader("Content-Type", "application/json");
11771
+ res.end(JSON.stringify(manifest));
11772
+ return;
11773
+ }
11774
+ res.statusCode = 400;
11775
+ res.end("No component manifest generator configured.");
11776
+ return;
11777
+ } catch (e) {
11778
+ logger8.error(e instanceof Error ? e : String(e));
11779
+ res.statusCode = 500;
11780
+ res.end(e instanceof Error ? e.toString() : String(e));
11781
+ return;
11782
+ }
11783
+ });
11784
+ }
11737
11785
  doTelemetry(app, core2, initializedStoryIndexGenerator, options);
11738
11786
  async function cancelTelemetry() {
11739
11787
  const payload = { eventType: "dev" };
@@ -12089,7 +12137,7 @@ __name(warnWhenUsingArgTypesRegex, "warnWhenUsingArgTypesRegex");
12089
12137
  async function buildDevStandalone(options) {
12090
12138
  const { packageJson, versionUpdates } = options;
12091
12139
  let { storybookVersion, previewConfigPath } = options;
12092
- const configDir = resolve5(options.configDir);
12140
+ const configDir = resolve(options.configDir);
12093
12141
  if (packageJson) {
12094
12142
  invariant(
12095
12143
  packageJson.version !== void 0,
@@ -12117,9 +12165,9 @@ async function buildDevStandalone(options) {
12117
12165
  process.exit(1);
12118
12166
  }
12119
12167
  }
12120
- const cacheKey = oneWayHash(relative5(getProjectRoot2(), configDir));
12168
+ const cacheKey = oneWayHash(relative(getProjectRoot2(), configDir));
12121
12169
  const cacheOutputDir = resolvePathInStorybookCache("public", cacheKey);
12122
- let outputDir = resolve5(options.outputDir || cacheOutputDir);
12170
+ let outputDir = resolve(options.outputDir || cacheOutputDir);
12123
12171
  if (options.smokeTest) {
12124
12172
  outputDir = cacheOutputDir;
12125
12173
  }
@@ -12147,7 +12195,7 @@ async function buildDevStandalone(options) {
12147
12195
  validateFrameworkName(frameworkName);
12148
12196
  }
12149
12197
  if (frameworkName) {
12150
- corePresets.push(join7(frameworkName, "preset"));
12198
+ corePresets.push(join(frameworkName, "preset"));
12151
12199
  }
12152
12200
  frameworkName = frameworkName || "custom";
12153
12201
  const packageManager = JsPackageManagerFactory.getPackageManager({
@@ -12189,7 +12237,7 @@ async function buildDevStandalone(options) {
12189
12237
  const deprecationMessage = (0, import_ts_dedent8.dedent)(`Using CommonJS in your main configuration file is deprecated with Vite.
12190
12238
  - Refer to the migration guide at https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#commonjs-with-vite-is-deprecated`);
12191
12239
  const mainJsPath = getInterpretedFile(
12192
- resolve5(options.configDir || ".storybook", "main")
12240
+ resolve(options.configDir || ".storybook", "main")
12193
12241
  );
12194
12242
  if (/\.c[jt]s$/.test(mainJsPath)) {
12195
12243
  deprecate(deprecationMessage);
@@ -12203,7 +12251,7 @@ async function buildDevStandalone(options) {
12203
12251
  const resolvedRenderer = renderer && resolveAddonName2(options.configDir, renderer, options);
12204
12252
  presets = await loadAllPresets2({
12205
12253
  corePresets: [
12206
- join7(resolvePackageDir("storybook"), "dist/core-server/presets/common-preset.js"),
12254
+ join(resolvePackageDir("storybook"), "dist/core-server/presets/common-preset.js"),
12207
12255
  ...managerBuilder.corePresets || [],
12208
12256
  ...previewBuilder.corePresets || [],
12209
12257
  ...resolvedRenderer ? [resolvedRenderer] : [],
@@ -12269,12 +12317,11 @@ async function buildDevStandalone(options) {
12269
12317
  __name(buildDevStandalone, "buildDevStandalone");
12270
12318
 
12271
12319
  // src/core-server/build-index.ts
12272
- import { writeFile as writeFile3 } from "node:fs/promises";
12320
+ import { writeFile as writeFile4 } from "node:fs/promises";
12273
12321
  import { normalizeStories as normalizeStories3 } from "storybook/internal/common";
12274
12322
  import { logger as logger12 } from "storybook/internal/node-logger";
12275
12323
 
12276
12324
  // src/core-server/load.ts
12277
- import { join as join8, relative as relative6, resolve as resolve6 } from "node:path";
12278
12325
  import {
12279
12326
  getProjectRoot as getProjectRoot3,
12280
12327
  loadAllPresets as loadAllPresets3,
@@ -12285,8 +12332,8 @@ import {
12285
12332
  import { oneWayHash as oneWayHash2 } from "storybook/internal/telemetry";
12286
12333
  import { global as global4 } from "@storybook/global";
12287
12334
  async function loadStorybook(options) {
12288
- const configDir = resolve6(options.configDir);
12289
- const cacheKey = oneWayHash2(relative6(getProjectRoot3(), configDir));
12335
+ const configDir = resolve(options.configDir);
12336
+ const cacheKey = oneWayHash2(relative(getProjectRoot3(), configDir));
12290
12337
  options.configType = "DEVELOPMENT";
12291
12338
  options.configDir = configDir;
12292
12339
  options.cacheKey = cacheKey;
@@ -12298,7 +12345,7 @@ async function loadStorybook(options) {
12298
12345
  validateFrameworkName2(frameworkName);
12299
12346
  }
12300
12347
  if (frameworkName) {
12301
- corePresets.push(join8(frameworkName, "preset"));
12348
+ corePresets.push(join(frameworkName, "preset"));
12302
12349
  }
12303
12350
  frameworkName = frameworkName || "custom";
12304
12351
  let presets = await loadAllPresets3({
@@ -12313,7 +12360,7 @@ async function loadStorybook(options) {
12313
12360
  const resolvedRenderer = renderer && resolveAddonName3(options.configDir, renderer, options);
12314
12361
  presets = await loadAllPresets3({
12315
12362
  corePresets: [
12316
- join8(resolvePackageDir("storybook"), "dist/core-server/presets/common-preset.js"),
12363
+ join(resolvePackageDir("storybook"), "dist/core-server/presets/common-preset.js"),
12317
12364
  ...resolvedRenderer ? [resolvedRenderer] : [],
12318
12365
  ...corePresets
12319
12366
  ],
@@ -12359,7 +12406,7 @@ var buildIndex = /* @__PURE__ */ __name(async (options) => {
12359
12406
  var buildIndexStandalone = /* @__PURE__ */ __name(async (options) => {
12360
12407
  const index = await buildIndex(options);
12361
12408
  logger12.info(`Writing index to ${options.outputFile}`);
12362
- await writeFile3(options.outputFile, JSON.stringify(index));
12409
+ await writeFile4(options.outputFile, JSON.stringify(index));
12363
12410
  }, "buildIndexStandalone");
12364
12411
 
12365
12412
  // src/core-server/standalone.ts