storybook 10.1.0-alpha.12 → 10.1.0-alpha.14

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 (99) hide show
  1. package/dist/_browser-chunks/{chunk-74YHFU5B.js → chunk-2XZMBGTA.js} +1 -1
  2. package/dist/_browser-chunks/{chunk-EBHB6RPS.js → chunk-FQ7SLVLR.js} +6 -1
  3. package/dist/_browser-chunks/{chunk-X3DUQ5RA.js → chunk-GFY5R5EY.js} +1 -1
  4. package/dist/_browser-chunks/{chunk-WXP2XJ3O.js → chunk-P4F4UVXX.js} +1 -0
  5. package/dist/_browser-chunks/{chunk-BE2DAXKJ.js → chunk-SS2NHR7W.js} +4 -1
  6. package/dist/_browser-chunks/{syntaxhighlighter-WKBQ5RC7.js → syntaxhighlighter-IQDEPFLK.js} +1 -1
  7. package/dist/_node-chunks/{builder-manager-YUOHSIUB.js → builder-manager-FQ5J6V3U.js} +32 -22
  8. package/dist/_node-chunks/{chunk-B6JWY6PC.js → camelcase-VGUYV77Z.js} +8 -8
  9. package/dist/_node-chunks/{chunk-FZLRAH4N.js → chunk-2JR3QBT2.js} +7 -7
  10. package/dist/_node-chunks/chunk-3EBH66BB.js +23 -0
  11. package/dist/_node-chunks/{chunk-E5FJS66Z.js → chunk-4ZFHN3ZY.js} +6 -6
  12. package/dist/_node-chunks/{chunk-5HV3B5OP.js → chunk-63PL4NNE.js} +1104 -13
  13. package/dist/_node-chunks/{chunk-NAOYEL54.js → chunk-A4KENTXT.js} +7 -7
  14. package/dist/_node-chunks/{chunk-4FT2DHGE.js → chunk-ALIA3J6S.js} +44 -10
  15. package/dist/_node-chunks/{chunk-WFLWJO24.js → chunk-C2HKH2XQ.js} +5710 -2414
  16. package/dist/_node-chunks/{chunk-WA6KZQZ2.js → chunk-DQNBAQYT.js} +6 -6
  17. package/dist/_node-chunks/{chunk-JARUEMEP.js → chunk-F74UHHR6.js} +7 -7
  18. package/dist/_node-chunks/{chunk-WUXQMQCB.js → chunk-H5XWXVWR.js} +6 -6
  19. package/dist/_node-chunks/{chunk-OP3INKUD.js → chunk-JMP7YFX2.js} +6 -6
  20. package/dist/_node-chunks/{chunk-DWXTZT3D.js → chunk-JZR4DHG2.js} +19 -7
  21. package/dist/_node-chunks/{chunk-QCO2ZM7F.js → chunk-KEA7CVMZ.js} +122 -32
  22. package/dist/_node-chunks/{chunk-DUXPWBOK.js → chunk-KF3WTAEP.js} +7 -7
  23. package/dist/_node-chunks/{chunk-2D2IODUU.js → chunk-LPPM7L5D.js} +51 -71
  24. package/dist/_node-chunks/{chunk-2DMESZFJ.js → chunk-MJUDR7HQ.js} +7 -7
  25. package/dist/_node-chunks/chunk-NPB4THZQ.js +18 -0
  26. package/dist/_node-chunks/chunk-NZBK3DSJ.js +29 -0
  27. package/dist/_node-chunks/{chunk-5KLIDWFN.js → chunk-Q2QUNQK6.js} +7 -7
  28. package/dist/_node-chunks/{chunk-EZWWR7AR.js → chunk-TMCKISJR.js} +101 -118
  29. package/dist/_node-chunks/chunk-TWK7AR3U.js +6024 -0
  30. package/dist/_node-chunks/{chunk-CZ5GHJCC.js → chunk-V7CXWJXC.js} +7 -7
  31. package/dist/_node-chunks/chunk-W4F3T6CY.js +3781 -0
  32. package/dist/_node-chunks/{chunk-SEMIAAWG.js → chunk-WACDSFMO.js} +9 -9
  33. package/dist/_node-chunks/{chunk-A4APXFQ2.js → chunk-WVXZFQQU.js} +14 -8
  34. package/dist/_node-chunks/chunk-XBPE4PT7.js +78 -0
  35. package/dist/_node-chunks/chunk-YMM6BYF2.js +61 -0
  36. package/dist/_node-chunks/{chunk-XXPJ7XR3.js → chunk-ZGZKNZ5S.js} +6 -6
  37. package/dist/_node-chunks/{dist-DS2B5A3J.js → dist-DR3AP3RJ.js} +9 -9
  38. package/dist/_node-chunks/{globby-6THB7HVX.js → globby-D4FPSHY2.js} +9 -9
  39. package/dist/_node-chunks/{lib-5NKX4YGG.js → lib-ZEFOVNTK.js} +7 -7
  40. package/dist/_node-chunks/{mdx-N42X6CFJ-ZLT3QOFF.js → mdx-N42X6CFJ-PJF3ICCG.js} +8 -8
  41. package/dist/_node-chunks/{p-limit-PDMWNG7W.js → p-limit-CYQOFYPV.js} +7 -7
  42. package/dist/babel/index.js +10 -11
  43. package/dist/bin/core.js +33 -26
  44. package/dist/bin/dispatcher.js +31 -20
  45. package/dist/bin/loader.js +10 -13
  46. package/dist/cli/index.d.ts +1479 -133
  47. package/dist/cli/index.js +30 -5159
  48. package/dist/common/index.d.ts +139 -62
  49. package/dist/common/index.js +66 -51
  50. package/dist/components/index.d.ts +136 -26
  51. package/dist/components/index.js +3163 -2859
  52. package/dist/core-server/index.d.ts +3 -2
  53. package/dist/core-server/index.js +112 -1486
  54. package/dist/core-server/presets/common-manager.js +5 -5
  55. package/dist/core-server/presets/common-override-preset.js +9 -9
  56. package/dist/core-server/presets/common-preset.js +272 -81
  57. package/dist/csf/index.js +2 -2
  58. package/dist/csf-tools/index.js +9 -9
  59. package/dist/manager/globals-runtime.js +21557 -21133
  60. package/dist/manager/manager-stores.d.ts +1 -0
  61. package/dist/manager/manager-stores.js +23 -0
  62. package/dist/manager/runtime.js +6695 -720
  63. package/dist/manager-api/index.d.ts +1802 -1
  64. package/dist/manager-api/index.js +105 -11
  65. package/dist/manager-errors.d.ts +6 -0
  66. package/dist/manager-errors.js +2 -2
  67. package/dist/mocking-utils/index.d.ts +1126 -0
  68. package/dist/{_node-chunks/chunk-ZXSD6L3S.js → mocking-utils/index.js} +441 -16
  69. package/dist/node-logger/index.d.ts +192 -24
  70. package/dist/node-logger/index.js +23 -3148
  71. package/dist/preview/runtime.js +35 -3
  72. package/dist/preview-api/index.d.ts +69 -68
  73. package/dist/preview-api/index.js +2 -2
  74. package/dist/preview-errors.d.ts +6 -0
  75. package/dist/preview-errors.js +2 -2
  76. package/dist/server-errors.d.ts +31 -1
  77. package/dist/server-errors.js +17 -10
  78. package/dist/telemetry/index.d.ts +24 -3
  79. package/dist/telemetry/index.js +25 -24
  80. package/dist/types/index.d.ts +71 -8
  81. package/dist/types/index.js +25 -1
  82. package/package.json +11 -9
  83. package/dist/_node-chunks/camelcase-JREIL7NV.js +0 -18
  84. package/dist/_node-chunks/chunk-FDXFVHIL.js +0 -1114
  85. package/dist/_node-chunks/chunk-HZG65SU3.js +0 -34
  86. package/dist/_node-chunks/chunk-IXVYNBMD.js +0 -18
  87. package/dist/_node-chunks/chunk-LIH7MTP7.js +0 -3214
  88. package/dist/_node-chunks/chunk-N5GIRUP5.js +0 -1047
  89. package/dist/_node-chunks/chunk-O5DA7YLO.js +0 -3171
  90. package/dist/_node-chunks/chunk-QYQIZBS6.js +0 -26
  91. package/dist/_node-chunks/chunk-TS2UUH2J.js +0 -301
  92. package/dist/_node-chunks/chunk-Y4E6IGQF.js +0 -61
  93. package/dist/_node-chunks/chunk-ZL3AFKRX.js +0 -1029
  94. package/dist/_node-chunks/plugin-6XMWOGPO.js +0 -123
  95. package/dist/_node-chunks/plugin-LTOXVT6A.js +0 -109
  96. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-2SFE5LQS.js +0 -46582
  97. package/dist/_node-chunks/webpack-mock-plugin-CX5J2U56.js +0 -92
  98. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -32
  99. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -28
@@ -1,92 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_57ru1wfqqjv from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_57ru1wfqqjv from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_57ru1wfqqjv from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_57ru1wfqqjv.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_57ru1wfqqjv.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_57ru1wfqqjv.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- babelParser,
14
- extractMockCalls,
15
- getIsExternal,
16
- resolveExternalModule,
17
- resolveWithExtensions
18
- } from "./chunk-TS2UUH2J.js";
19
- import "./chunk-WA6KZQZ2.js";
20
- import "./chunk-OP3INKUD.js";
21
-
22
- // src/core-server/presets/webpack/plugins/webpack-mock-plugin.ts
23
- import { createRequire } from "node:module";
24
- import { dirname, isAbsolute } from "node:path";
25
- import { fileURLToPath } from "node:url";
26
- var require2 = createRequire(import.meta.url), PLUGIN_NAME = "storybook-mock-plugin", WebpackMockPlugin = class {
27
- constructor(options) {
28
- this.mockMap = /* @__PURE__ */ new Map();
29
- if (!options.previewConfigPath)
30
- throw new Error(`[${PLUGIN_NAME}] \`previewConfigPath\` is required.`);
31
- this.options = options;
32
- }
33
- /**
34
- * The main entry point for the Webpack plugin.
35
- *
36
- * @param {Compiler} compiler The Webpack compiler instance.
37
- */
38
- apply(compiler) {
39
- let logger = compiler.getInfrastructureLogger(PLUGIN_NAME), updateMocks = () => {
40
- this.mockMap = new Map(
41
- this.extractAndResolveMocks(compiler).flatMap((mock) => [
42
- // first one, full path
43
- [mock.absolutePath, mock],
44
- // second one, without the extension
45
- [mock.absolutePath.replace(/\.[^.]+$/, ""), mock]
46
- ])
47
- ), logger.info(`Mock map updated with ${this.mockMap.size / 2} mocks.`);
48
- };
49
- compiler.hooks.beforeRun.tap(PLUGIN_NAME, updateMocks), compiler.hooks.watchRun.tap(PLUGIN_NAME, updateMocks), new compiler.webpack.NormalModuleReplacementPlugin(/.*/, (resource) => {
50
- try {
51
- let path = resource.request, importer = resource.context, absolutePath = getIsExternal(path, importer) ? resolveExternalModule(path, importer) : resolveWithExtensions(path, importer);
52
- this.mockMap.has(absolutePath) && (resource.request = this.mockMap.get(absolutePath).replacementResource);
53
- } catch {
54
- logger.debug(`Could not resolve mock for "${resource.request}".`);
55
- }
56
- }).apply(compiler), compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => {
57
- compilation.fileDependencies.add(this.options.previewConfigPath);
58
- for (let mock of this.mockMap.values())
59
- isAbsolute(mock.replacementResource) && mock.replacementResource.includes("__mocks__") && compilation.contextDependencies.add(dirname(mock.replacementResource));
60
- });
61
- }
62
- /**
63
- * Reads the preview config, parses it to find all `sb.mock()` calls, and resolves their
64
- * corresponding mock implementations.
65
- *
66
- * @param {Compiler} compiler The Webpack compiler instance.
67
- * @returns {ResolvedMock[]} An array of fully processed mocks.
68
- */
69
- extractAndResolveMocks(compiler) {
70
- let { previewConfigPath } = this.options, logger = compiler.getInfrastructureLogger(PLUGIN_NAME), mocks = extractMockCalls(
71
- { previewConfigPath, configDir: dirname(previewConfigPath) },
72
- babelParser,
73
- compiler.context
74
- ), resolvedMocks = [];
75
- for (let mock of mocks)
76
- try {
77
- let { absolutePath, redirectPath } = mock, replacementResource;
78
- redirectPath ? replacementResource = redirectPath : replacementResource = `${fileURLToPath(
79
- import.meta.resolve("storybook/webpack/loaders/webpack-automock-loader")
80
- )}?spy=${mock.spy}!${absolutePath}`, resolvedMocks.push({
81
- ...mock,
82
- replacementResource
83
- });
84
- } catch {
85
- logger.warn(`Could not resolve mock for "${mock.path}". It will be ignored.`);
86
- }
87
- return resolvedMocks;
88
- }
89
- };
90
- export {
91
- WebpackMockPlugin
92
- };
@@ -1,32 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_57ru1wfqqjv from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_57ru1wfqqjv from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_57ru1wfqqjv from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_57ru1wfqqjv.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_57ru1wfqqjv.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_57ru1wfqqjv.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- rewriteSbMockImportCalls
14
- } from "../../../../_node-chunks/chunk-TS2UUH2J.js";
15
- import "../../../../_node-chunks/chunk-WA6KZQZ2.js";
16
- import "../../../../_node-chunks/chunk-OP3INKUD.js";
17
-
18
- // src/core-server/presets/webpack/loaders/storybook-mock-transform-loader.ts
19
- import { logger } from "storybook/internal/node-logger";
20
- var storybookMockTransformLoader = function(source, sourceMap, meta) {
21
- let callback = this.async();
22
- try {
23
- let result = rewriteSbMockImportCalls(source);
24
- callback(null, result.code, result.map || void 0, meta);
25
- } catch (error) {
26
- let filePath = this.resourcePath;
27
- logger.debug(`Could not transform sb.mock(import(...)) calls in ${filePath}: ${error}`), callback(null, source, sourceMap, meta);
28
- }
29
- }, storybook_mock_transform_loader_default = storybookMockTransformLoader;
30
- export {
31
- storybook_mock_transform_loader_default as default
32
- };
@@ -1,28 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_57ru1wfqqjv from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_57ru1wfqqjv from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_57ru1wfqqjv from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_57ru1wfqqjv.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_57ru1wfqqjv.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_57ru1wfqqjv.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- getAutomockCode
14
- } from "../../../../_node-chunks/chunk-ZXSD6L3S.js";
15
- import {
16
- babelParser
17
- } from "../../../../_node-chunks/chunk-TS2UUH2J.js";
18
- import "../../../../_node-chunks/chunk-WA6KZQZ2.js";
19
- import "../../../../_node-chunks/chunk-OP3INKUD.js";
20
-
21
- // src/core-server/presets/webpack/loaders/webpack-automock-loader.ts
22
- function webpackAutomockLoader(source) {
23
- let isSpy = this.getOptions().spy === "true";
24
- return getAutomockCode(source, isSpy, babelParser).toString();
25
- }
26
- export {
27
- webpackAutomockLoader as default
28
- };