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
@@ -511,6 +511,13 @@ var map = /* @__PURE__ */ __name((arg, argType) => {
511
511
  const mapped = map(val, { type: type.value[key] });
512
512
  return mapped === INCOMPATIBLE ? acc : Object.assign(acc, { [key]: mapped });
513
513
  }, {});
514
+ case "other": {
515
+ const isPrimitiveArg = typeof arg === "string" || typeof arg === "number" || typeof arg === "boolean";
516
+ if (type.value === "ReactNode" && isPrimitiveArg) {
517
+ return arg;
518
+ }
519
+ return INCOMPATIBLE;
520
+ }
514
521
  default:
515
522
  return INCOMPATIBLE;
516
523
  }
@@ -880,7 +887,7 @@ __name(normalizeStory, "normalizeStory");
880
887
 
881
888
  // src/preview-api/modules/store/csf/processCSFFile.ts
882
889
  import { logger as logger4 } from "storybook/internal/client-logger";
883
- import { isExportStory, isStory } from "storybook/internal/csf";
890
+ import { getStoryChildren, isExportStory, isStory, toTestId } from "storybook/internal/csf";
884
891
 
885
892
  // src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts
886
893
  import { sanitize } from "storybook/internal/csf";
@@ -934,9 +941,17 @@ function processCSFFile(moduleExports, importPath, title) {
934
941
  const csfFile2 = { meta: meta2, stories: {}, moduleExports };
935
942
  Object.keys(namedExports).forEach((key) => {
936
943
  if (isExportStory(key, meta2)) {
937
- const storyMeta = normalizeStory(key, namedExports[key].input, meta2);
944
+ const story = namedExports[key];
945
+ const storyMeta = normalizeStory(key, story.input, meta2);
938
946
  checkDisallowedParameters(storyMeta.parameters);
939
947
  csfFile2.stories[storyMeta.id] = storyMeta;
948
+ getStoryChildren(story).forEach((child) => {
949
+ const name = child.input.name;
950
+ const childId = toTestId(storyMeta.id, name);
951
+ child.input.parameters ??= {};
952
+ child.input.parameters.__id = childId;
953
+ csfFile2.stories[childId] = normalizeStory(name, child.input, meta2);
954
+ });
940
955
  }
941
956
  });
942
957
  csfFile2.projectAnnotations = firstStory.meta.preview.composed;
@@ -1167,11 +1182,13 @@ __name(prepareMeta, "prepareMeta");
1167
1182
  function preparePartialAnnotations(storyAnnotations, componentAnnotations, projectAnnotations) {
1168
1183
  const defaultTags = ["dev", "test"];
1169
1184
  const extraTags = globalThis2.DOCS_OPTIONS?.autodocs === true ? ["autodocs"] : [];
1185
+ const overrideTags = storyAnnotations?.tags?.includes("test-fn") ? ["!autodocs"] : [];
1170
1186
  const tags = combineTags(
1171
1187
  ...defaultTags,
1172
1188
  ...extraTags,
1173
1189
  ...projectAnnotations.tags ?? [],
1174
1190
  ...componentAnnotations.tags ?? [],
1191
+ ...overrideTags,
1175
1192
  ...storyAnnotations?.tags ?? []
1176
1193
  );
1177
1194
  const parameters = combineParameters(
@@ -1542,13 +1559,13 @@ __name(_ReporterAPI, "ReporterAPI");
1542
1559
  var ReporterAPI = _ReporterAPI;
1543
1560
 
1544
1561
  // src/preview-api/modules/store/csf/csf-factory-utils.ts
1545
- import { isStory as isStory2 } from "storybook/internal/csf";
1562
+ import { isMeta, isStory as isStory2 } from "storybook/internal/csf";
1546
1563
  function getCsfFactoryAnnotations(story, meta, projectAnnotations) {
1547
1564
  return isStory2(story) ? {
1548
1565
  story: story.input,
1549
1566
  meta: story.meta.input,
1550
1567
  preview: story.meta.preview.composed
1551
- } : { story, meta, preview: projectAnnotations };
1568
+ } : { story, meta: isMeta(meta) ? meta.input : meta, preview: projectAnnotations };
1552
1569
  }
1553
1570
  __name(getCsfFactoryAnnotations, "getCsfFactoryAnnotations");
1554
1571
 
@@ -1947,7 +1964,7 @@ var _StoryStore = class _StoryStore {
1947
1964
  return { entryExports, csfFiles };
1948
1965
  }
1949
1966
  // A prepared story does not include args, globals or hooks. These are stored in the story store
1950
- // and updated separtely to the (immutable) story.
1967
+ // and updated separately to the (immutable) story.
1951
1968
  getStoryContext(story, { forceInitialArgs = false } = {}) {
1952
1969
  const userGlobals = this.userGlobals.get();
1953
1970
  const { initialGlobals } = this.userGlobals;
@@ -1981,21 +1998,25 @@ var _StoryStore = class _StoryStore {
1981
1998
  }
1982
1999
  extract(options = { includeDocsOnly: false }) {
1983
2000
  const { cachedCSFFiles } = this;
2001
+ console.log("extract: extracting stories", cachedCSFFiles);
1984
2002
  if (!cachedCSFFiles) {
1985
2003
  throw new CalledExtractOnStoreError();
1986
2004
  }
1987
- return Object.entries(this.storyIndex.entries).reduce(
1988
- (acc, [storyId, { type, importPath }]) => {
1989
- if (type === "docs") {
2005
+ const stories = Object.entries(this.storyIndex.entries).reduce(
2006
+ (acc, [storyId, entry]) => {
2007
+ if (entry.type === "docs") {
1990
2008
  return acc;
1991
2009
  }
1992
- const csfFile = cachedCSFFiles[importPath];
2010
+ const csfFile = cachedCSFFiles[entry.importPath];
1993
2011
  const story = this.storyFromCSFFile({ storyId, csfFile });
1994
2012
  if (!options.includeDocsOnly && story.parameters.docsOnly) {
1995
2013
  return acc;
1996
2014
  }
1997
2015
  acc[storyId] = Object.entries(story).reduce(
1998
2016
  (storyAcc, [key, value]) => {
2017
+ if (key === "story" && entry.subtype === "test") {
2018
+ return { ...storyAcc, story: entry.parentName };
2019
+ }
1999
2020
  if (key === "moduleExport") {
2000
2021
  return storyAcc;
2001
2022
  }
@@ -2008,19 +2029,21 @@ var _StoryStore = class _StoryStore {
2008
2029
  return Object.assign(storyAcc, { [key]: value });
2009
2030
  },
2010
2031
  {
2011
- //
2012
2032
  args: story.initialArgs,
2013
2033
  globals: {
2014
2034
  ...this.userGlobals.initialGlobals,
2015
2035
  ...this.userGlobals.globals,
2016
2036
  ...story.storyGlobals
2017
- }
2037
+ },
2038
+ storyId: entry.parent ? entry.parent : storyId
2018
2039
  }
2019
2040
  );
2020
2041
  return acc;
2021
2042
  },
2022
2043
  {}
2023
2044
  );
2045
+ console.log("extract: stories", stories);
2046
+ return stories;
2024
2047
  }
2025
2048
  };
2026
2049
  __name(_StoryStore, "StoryStore");
@@ -2181,7 +2204,7 @@ var sortStoriesV7 = /* @__PURE__ */ __name((stories, storySortParameter, fileNam
2181
2204
  Error sorting stories with sort parameter ${storySortParameter}:
2182
2205
 
2183
2206
  > ${err.message}
2184
-
2207
+
2185
2208
  Are you using a V6-style sort function in V7 mode?
2186
2209
 
2187
2210
  More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#v7-style-story-sort
@@ -2277,16 +2300,15 @@ var _StoryRender = class _StoryRender {
2277
2300
  }
2278
2301
  }
2279
2302
  checkIfAborted(signal) {
2280
- if (signal.aborted) {
2303
+ if (signal.aborted && !["finished", "aborted", "errored"].includes(this.phase)) {
2281
2304
  this.phase = "aborted";
2282
2305
  this.channel.emit(STORY_RENDER_PHASE_CHANGED, {
2283
2306
  newPhase: this.phase,
2284
2307
  renderId: this.renderId,
2285
2308
  storyId: this.id
2286
2309
  });
2287
- return true;
2288
2310
  }
2289
- return false;
2311
+ return signal.aborted;
2290
2312
  }
2291
2313
  async prepare() {
2292
2314
  await this.runPhase(this.abortController.signal, "preparing", async () => {
@@ -4123,6 +4145,7 @@ export {
4123
4145
  combineArgs,
4124
4146
  normalizeArrays,
4125
4147
  normalizeStory,
4148
+ mountDestructured,
4126
4149
  decorateStory,
4127
4150
  sanitizeStoryContextUpdate,
4128
4151
  defaultDecorateStory,
@@ -1,5 +1,5 @@
1
1
  // src/viewport/defaults.ts
2
- var INITIAL_VIEWPORTS_DATA = {
2
+ var INITIAL_VIEWPORTS = {
3
3
  iphone5: {
4
4
  name: "iPhone 5",
5
5
  styles: {
@@ -225,7 +225,6 @@ var INITIAL_VIEWPORTS_DATA = {
225
225
  type: "mobile"
226
226
  }
227
227
  };
228
- var INITIAL_VIEWPORTS = INITIAL_VIEWPORTS_DATA;
229
228
  var DEFAULT_VIEWPORT = "responsive";
230
229
  var MINIMAL_VIEWPORTS = {
231
230
  mobile1: {
@@ -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,23 +13,21 @@ import {
13
13
  BROWSER_TARGETS,
14
14
  NODE_TARGET,
15
15
  SUPPORTED_FEATURES
16
- } from "./chunk-VSC6LSCQ.js";
16
+ } from "./chunk-EMCS3ZKS.js";
17
17
  import {
18
18
  require_build
19
- } from "./chunk-4TOI4VSK.js";
20
- import {
21
- resolveModulePath
22
- } from "./chunk-2DMFI367.js";
19
+ } from "./chunk-YMZK6547.js";
23
20
  import {
21
+ resolveModulePath,
24
22
  resolvePackageDir
25
- } from "./chunk-TJIMCNYJ.js";
23
+ } from "./chunk-7JZFWQN4.js";
26
24
  import {
27
25
  join,
28
26
  parse
29
- } from "./chunk-7WH7AGOR.js";
27
+ } from "./chunk-WS3L7DA7.js";
30
28
  import {
31
29
  slash
32
- } from "./chunk-JNHUDBJL.js";
30
+ } from "./chunk-HRBWZFVH.js";
33
31
  import {
34
32
  __commonJS,
35
33
  __esm,
@@ -38,7 +36,7 @@ import {
38
36
  __require,
39
37
  __toCommonJS,
40
38
  __toESM
41
- } from "./chunk-XZTBG2TG.js";
39
+ } from "./chunk-FRTUAT3V.js";
42
40
 
43
41
  // ../node_modules/tslib/tslib.es6.mjs
44
42
  var tslib_es6_exports = {};
@@ -2221,6 +2219,15 @@ var globalsNameReferenceMap = {
2221
2219
  var globalPackages = Object.keys(globalsNameReferenceMap);
2222
2220
 
2223
2221
  // src/manager/globals/globals-module-info.ts
2222
+ var duplicatedKeys = [
2223
+ "storybook/theming",
2224
+ "storybook/theming/create",
2225
+ "storybook/manager-api",
2226
+ "storybook/test",
2227
+ "storybook/actions",
2228
+ "storybook/highlight",
2229
+ "storybook/viewport"
2230
+ ];
2224
2231
  var globalsModuleInfoMap = globalPackages.reduce(
2225
2232
  (acc, key) => {
2226
2233
  acc[key] = {
@@ -2229,6 +2236,14 @@ var globalsModuleInfoMap = globalPackages.reduce(
2229
2236
  namedExports: exports_default[key],
2230
2237
  defaultExport: true
2231
2238
  };
2239
+ if (duplicatedKeys.includes(key)) {
2240
+ acc[key.replace("storybook", "storybook/internal")] = {
2241
+ type: "esm",
2242
+ varName: globalsNameReferenceMap[key],
2243
+ namedExports: exports_default[key],
2244
+ defaultExport: true
2245
+ };
2246
+ }
2232
2247
  return acc;
2233
2248
  },
2234
2249
  {}
@@ -0,0 +1,18 @@
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
+
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
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ camelCase
14
+ } from "./chunk-3VCGPS3V.js";
15
+ import "./chunk-FRTUAT3V.js";
16
+ export {
17
+ camelCase as default
18
+ };
@@ -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/camelcase/index.js
17
17
  var UPPERCASE = /[\p{Lu}]/u;
@@ -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
  camelCase
14
- } from "./chunk-A7CUP23N.js";
14
+ } from "./chunk-3VCGPS3V.js";
15
15
  import {
16
16
  __commonJS,
17
17
  __name,
18
18
  __toESM
19
- } from "./chunk-XZTBG2TG.js";
19
+ } from "./chunk-FRTUAT3V.js";
20
20
 
21
21
  // ../node_modules/boxen/node_modules/emoji-regex/index.js
22
22
  var require_emoji_regex = __commonJS({
@@ -1,46 +1,43 @@
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
  version
14
- } from "./chunk-R5DIBOM6.js";
14
+ } from "./chunk-T46D5USU.js";
15
15
  import {
16
16
  createFileSystemCache,
17
17
  resolvePathInStorybookCache,
18
18
  up
19
- } from "./chunk-RIPA4LFD.js";
19
+ } from "./chunk-AZWKFSEJ.js";
20
20
  import {
21
21
  globalSettings
22
- } from "./chunk-7NJGTQ3W.js";
22
+ } from "./chunk-CL53RP5L.js";
23
23
  import {
24
24
  execaCommand,
25
25
  getProjectRoot
26
- } from "./chunk-55VWKF63.js";
26
+ } from "./chunk-IE2VBA4V.js";
27
27
  import {
28
28
  resolvePackageDir
29
- } from "./chunk-TJIMCNYJ.js";
30
- import {
31
- join
32
- } from "./chunk-7WH7AGOR.js";
29
+ } from "./chunk-7JZFWQN4.js";
33
30
  import {
34
31
  slash
35
- } from "./chunk-JNHUDBJL.js";
32
+ } from "./chunk-HRBWZFVH.js";
36
33
  import {
37
34
  require_picocolors
38
- } from "./chunk-5IEY46LQ.js";
35
+ } from "./chunk-JEIQPNWQ.js";
39
36
  import {
40
37
  __commonJS,
41
38
  __name,
42
39
  __toESM
43
- } from "./chunk-XZTBG2TG.js";
40
+ } from "./chunk-FRTUAT3V.js";
44
41
 
45
42
  // ../node_modules/fetch-retry/index.js
46
43
  var require_fetch_retry = __commonJS({
@@ -348,10 +345,7 @@ var getActualPackageJson = /* @__PURE__ */ __name(async (packageName) => {
348
345
  cwd: fileURLToPath(import.meta.resolve(packageName, process.cwd()))
349
346
  });
350
347
  if (!resolvedPackageJsonPath) {
351
- resolvedPackageJsonPath = import.meta.resolve(
352
- join(packageName, "package.json"),
353
- process.cwd()
354
- );
348
+ resolvedPackageJsonPath = import.meta.resolve(`${packageName}/package.json`, process.cwd());
355
349
  }
356
350
  const { default: packageJson } = await import(pathToFileURL(resolvedPackageJsonPath).href, {
357
351
  with: { type: "json" }
@@ -453,7 +447,7 @@ __name(getHasRouterPackage, "getHasRouterPackage");
453
447
 
454
448
  // src/telemetry/get-monorepo-type.ts
455
449
  import { existsSync, readFileSync } from "node:fs";
456
- import { join as join2 } from "node:path";
450
+ import { join } from "node:path";
457
451
  import { getProjectRoot as getProjectRoot2 } from "storybook/internal/common";
458
452
  var monorepoConfigs = {
459
453
  Nx: "nx.json",
@@ -465,17 +459,17 @@ var monorepoConfigs = {
465
459
  var getMonorepoType = /* @__PURE__ */ __name(() => {
466
460
  const keys = Object.keys(monorepoConfigs);
467
461
  const monorepoType = keys.find((monorepo) => {
468
- const configFile = join2(getProjectRoot2(), monorepoConfigs[monorepo]);
462
+ const configFile = join(getProjectRoot2(), monorepoConfigs[monorepo]);
469
463
  return existsSync(configFile);
470
464
  });
471
465
  if (monorepoType) {
472
466
  return monorepoType;
473
467
  }
474
- if (!existsSync(join2(getProjectRoot2(), "package.json"))) {
468
+ if (!existsSync(join(getProjectRoot2(), "package.json"))) {
475
469
  return void 0;
476
470
  }
477
471
  const packageJson = JSON.parse(
478
- readFileSync(join2(getProjectRoot2(), "package.json"), { encoding: "utf8" })
472
+ readFileSync(join(getProjectRoot2(), "package.json"), { encoding: "utf8" })
479
473
  );
480
474
  if (packageJson?.workspaces) {
481
475
  return "Workspaces";
@@ -1022,7 +1016,7 @@ var getStorybookMetadata = /* @__PURE__ */ __name(async (_configDir) => {
1022
1016
  var import_fetch_retry = __toESM(require_fetch_retry(), 1);
1023
1017
  import { readFileSync as readFileSync2 } from "node:fs";
1024
1018
  import * as os from "node:os";
1025
- import { join as join3 } from "node:path";
1019
+ import { join as join2 } from "node:path";
1026
1020
  import { isCI as isCI2 } from "storybook/internal/common";
1027
1021
 
1028
1022
  // ../node_modules/nanoid/index.js
@@ -1205,7 +1199,7 @@ var prepareRequest = /* @__PURE__ */ __name(async (data, context, options) => {
1205
1199
  }, "prepareRequest");
1206
1200
  function getVersionNumber() {
1207
1201
  try {
1208
- return JSON.parse(readFileSync2(join3(resolvePackageDir("storybook"), "package.json"), "utf8")).version;
1202
+ return JSON.parse(readFileSync2(join2(resolvePackageDir("storybook"), "package.json"), "utf8")).version;
1209
1203
  } catch (e) {
1210
1204
  return version;
1211
1205
  }
@@ -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
  __commonJS,
14
14
  __name
15
- } from "./chunk-XZTBG2TG.js";
15
+ } from "./chunk-FRTUAT3V.js";
16
16
 
17
17
  // ../node_modules/ts-dedent/dist/index.js
18
18
  var require_dist = __commonJS({
@@ -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
@@ -16,10 +16,10 @@ import {
16
16
  join,
17
17
  normalize,
18
18
  resolve
19
- } from "./chunk-7WH7AGOR.js";
19
+ } from "./chunk-WS3L7DA7.js";
20
20
  import {
21
21
  __name
22
- } from "./chunk-XZTBG2TG.js";
22
+ } from "./chunk-FRTUAT3V.js";
23
23
 
24
24
  // src/core-server/mocking-utils/resolve.ts
25
25
  import { readFileSync as readFileSync2, realpathSync } from "node:fs";
@@ -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
  __commonJS
14
- } from "./chunk-XZTBG2TG.js";
14
+ } from "./chunk-FRTUAT3V.js";
15
15
 
16
16
  // ../node_modules/pretty-hrtime/index.js
17
17
  var require_pretty_hrtime = __commonJS({
@@ -1,17 +1,21 @@
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
+ import {
13
+ dirname,
14
+ join
15
+ } from "./chunk-WS3L7DA7.js";
12
16
  import {
13
17
  __name
14
- } from "./chunk-XZTBG2TG.js";
18
+ } from "./chunk-FRTUAT3V.js";
15
19
 
16
20
  // ../node_modules/exsolve/dist/index.mjs
17
21
  import fs, { realpathSync, statSync, lstatSync } from "node:fs";
@@ -1471,6 +1475,66 @@ function _parseInput(input) {
1471
1475
  }
1472
1476
  __name(_parseInput, "_parseInput");
1473
1477
 
1478
+ // src/shared/utils/module.ts
1479
+ import { statSync as statSync2 } from "node:fs";
1480
+ import { createRequire, register } from "node:module";
1481
+ import { win32 } from "node:path/win32";
1482
+ import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
1483
+ var importMetaResolve = /* @__PURE__ */ __name((...args) => {
1484
+ if (typeof import.meta.resolve !== "function" && process.env.VITEST === "true") {
1485
+ console.warn(
1486
+ "importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
1487
+ );
1488
+ return pathToFileURL2(args[0]).href;
1489
+ }
1490
+ return import.meta.resolve(...args);
1491
+ }, "importMetaResolve");
1492
+ var resolvePackageDir = /* @__PURE__ */ __name((pkg, parent) => {
1493
+ return dirname(fileURLToPath2(importMetaResolve(join(pkg, "package.json"), parent)));
1494
+ }, "resolvePackageDir");
1495
+ var isTypescriptLoaderRegistered = false;
1496
+ async function importModule(path2) {
1497
+ if (!isTypescriptLoaderRegistered) {
1498
+ const typescriptLoaderUrl = importMetaResolve("storybook/internal/bin/loader");
1499
+ register(typescriptLoaderUrl, import.meta.url);
1500
+ isTypescriptLoaderRegistered = true;
1501
+ }
1502
+ let mod;
1503
+ try {
1504
+ const resolvedPath = win32.isAbsolute(path2) ? pathToFileURL2(path2).href : path2;
1505
+ mod = await import(resolvedPath);
1506
+ } catch (importError) {
1507
+ try {
1508
+ const require2 = createRequire(import.meta.url);
1509
+ mod = require2(path2);
1510
+ } catch (requireError) {
1511
+ throw importError;
1512
+ }
1513
+ }
1514
+ return mod.default ?? mod;
1515
+ }
1516
+ __name(importModule, "importModule");
1517
+ var safeResolveModule = /* @__PURE__ */ __name(({
1518
+ specifier,
1519
+ parent,
1520
+ extensions = [".mjs", ".js", ".cjs"]
1521
+ }) => {
1522
+ try {
1523
+ const resolvedPath = resolveModulePath(specifier, {
1524
+ from: parent,
1525
+ extensions: [""].concat(extensions)
1526
+ });
1527
+ if (statSync2(resolvedPath).isFile()) {
1528
+ return resolvedPath;
1529
+ }
1530
+ } catch (e) {
1531
+ }
1532
+ }, "safeResolveModule");
1533
+
1474
1534
  export {
1475
- resolveModulePath
1535
+ resolveModulePath,
1536
+ importMetaResolve,
1537
+ resolvePackageDir,
1538
+ importModule,
1539
+ safeResolveModule
1476
1540
  };