storybook 10.1.0-alpha.12 → 10.1.0-alpha.13

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 (87) 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/_node-chunks/{builder-manager-YUOHSIUB.js → builder-manager-DWDUVXZM.js} +27 -22
  5. package/dist/_node-chunks/{chunk-B6JWY6PC.js → camelcase-EETCRTJX.js} +8 -8
  6. package/dist/_node-chunks/{chunk-CZ5GHJCC.js → chunk-2W4GZCLE.js} +7 -7
  7. package/dist/_node-chunks/{chunk-E5FJS66Z.js → chunk-447655DM.js} +6 -6
  8. package/dist/_node-chunks/{chunk-WFLWJO24.js → chunk-4EJUC2SD.js} +4998 -1685
  9. package/dist/_node-chunks/chunk-4ZJOH2UN.js +61 -0
  10. package/dist/_node-chunks/chunk-654SJIMS.js +23 -0
  11. package/dist/_node-chunks/{chunk-2DMESZFJ.js → chunk-7IAVT2FU.js} +7 -7
  12. package/dist/_node-chunks/{chunk-5KLIDWFN.js → chunk-7KFHRNOT.js} +7 -7
  13. package/dist/_node-chunks/{chunk-XXPJ7XR3.js → chunk-AZIPBEBK.js} +6 -6
  14. package/dist/_node-chunks/{chunk-WUXQMQCB.js → chunk-B76FDKVB.js} +6 -6
  15. package/dist/_node-chunks/chunk-B7PGKETD.js +3781 -0
  16. package/dist/_node-chunks/{chunk-EZWWR7AR.js → chunk-CLUBH2LP.js} +55 -36
  17. package/dist/_node-chunks/{chunk-DUXPWBOK.js → chunk-CMYD2JNN.js} +7 -7
  18. package/dist/_node-chunks/{chunk-QCO2ZM7F.js → chunk-DIPKXLEP.js} +55 -32
  19. package/dist/_node-chunks/{chunk-DWXTZT3D.js → chunk-DPFYWXEA.js} +6 -6
  20. package/dist/_node-chunks/{chunk-FZLRAH4N.js → chunk-FCVNHU2F.js} +7 -7
  21. package/dist/_node-chunks/{chunk-QYQIZBS6.js → chunk-JQ7RQS5Q.js} +6 -6
  22. package/dist/_node-chunks/chunk-LEL5OSY3.js +18 -0
  23. package/dist/_node-chunks/{chunk-WA6KZQZ2.js → chunk-LPKSBF62.js} +6 -6
  24. package/dist/_node-chunks/chunk-LYEZOJ43.js +78 -0
  25. package/dist/_node-chunks/{chunk-JARUEMEP.js → chunk-MIA5324I.js} +7 -7
  26. package/dist/_node-chunks/{chunk-A4APXFQ2.js → chunk-MJM4TEMP.js} +14 -8
  27. package/dist/_node-chunks/{chunk-NAOYEL54.js → chunk-OVVZIUHS.js} +7 -7
  28. package/dist/_node-chunks/{chunk-5HV3B5OP.js → chunk-RUUNVQ6W.js} +1104 -13
  29. package/dist/_node-chunks/{chunk-2D2IODUU.js → chunk-URLNGLC2.js} +51 -71
  30. package/dist/_node-chunks/{chunk-OP3INKUD.js → chunk-WC2YEQHJ.js} +6 -6
  31. package/dist/_node-chunks/{chunk-4FT2DHGE.js → chunk-XKRVQL2G.js} +8 -8
  32. package/dist/_node-chunks/{chunk-SEMIAAWG.js → chunk-Z2OWEMX3.js} +8 -8
  33. package/dist/_node-chunks/{dist-DS2B5A3J.js → dist-22CLJ4BC.js} +9 -9
  34. package/dist/_node-chunks/{globby-6THB7HVX.js → globby-GR24TGSK.js} +9 -9
  35. package/dist/_node-chunks/{lib-5NKX4YGG.js → lib-G2LGVRPC.js} +7 -7
  36. package/dist/_node-chunks/{mdx-N42X6CFJ-ZLT3QOFF.js → mdx-N42X6CFJ-W6P6IDDW.js} +8 -8
  37. package/dist/_node-chunks/{p-limit-PDMWNG7W.js → p-limit-K4FZHG2F.js} +7 -7
  38. package/dist/babel/index.js +10 -11
  39. package/dist/bin/core.js +32 -26
  40. package/dist/bin/dispatcher.js +31 -20
  41. package/dist/bin/loader.js +10 -13
  42. package/dist/cli/index.d.ts +692 -133
  43. package/dist/cli/index.js +1005 -177
  44. package/dist/common/index.d.ts +139 -62
  45. package/dist/common/index.js +63 -49
  46. package/dist/core-server/index.d.ts +3 -2
  47. package/dist/core-server/index.js +96 -1413
  48. package/dist/core-server/presets/common-override-preset.js +9 -9
  49. package/dist/core-server/presets/common-preset.js +25 -65
  50. package/dist/csf-tools/index.js +9 -9
  51. package/dist/manager/globals-runtime.js +32 -3
  52. package/dist/manager/runtime.js +1 -1
  53. package/dist/manager-api/index.d.ts +1 -1
  54. package/dist/manager-api/index.js +4 -4
  55. package/dist/manager-errors.d.ts +6 -0
  56. package/dist/manager-errors.js +2 -2
  57. package/dist/mocking-utils/index.d.ts +1126 -0
  58. package/dist/{_node-chunks/chunk-ZXSD6L3S.js → mocking-utils/index.js} +441 -16
  59. package/dist/node-logger/index.d.ts +192 -24
  60. package/dist/node-logger/index.js +23 -3148
  61. package/dist/preview/runtime.js +31 -2
  62. package/dist/preview-api/index.d.ts +69 -68
  63. package/dist/preview-errors.d.ts +6 -0
  64. package/dist/preview-errors.js +2 -2
  65. package/dist/server-errors.d.ts +31 -1
  66. package/dist/server-errors.js +17 -10
  67. package/dist/telemetry/index.d.ts +23 -2
  68. package/dist/telemetry/index.js +25 -24
  69. package/dist/types/index.d.ts +71 -8
  70. package/dist/types/index.js +25 -1
  71. package/package.json +7 -9
  72. package/dist/_node-chunks/camelcase-JREIL7NV.js +0 -18
  73. package/dist/_node-chunks/chunk-FDXFVHIL.js +0 -1114
  74. package/dist/_node-chunks/chunk-HZG65SU3.js +0 -34
  75. package/dist/_node-chunks/chunk-IXVYNBMD.js +0 -18
  76. package/dist/_node-chunks/chunk-LIH7MTP7.js +0 -3214
  77. package/dist/_node-chunks/chunk-N5GIRUP5.js +0 -1047
  78. package/dist/_node-chunks/chunk-O5DA7YLO.js +0 -3171
  79. package/dist/_node-chunks/chunk-TS2UUH2J.js +0 -301
  80. package/dist/_node-chunks/chunk-Y4E6IGQF.js +0 -61
  81. package/dist/_node-chunks/chunk-ZL3AFKRX.js +0 -1029
  82. package/dist/_node-chunks/plugin-6XMWOGPO.js +0 -123
  83. package/dist/_node-chunks/plugin-LTOXVT6A.js +0 -109
  84. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-2SFE5LQS.js +0 -46582
  85. package/dist/_node-chunks/webpack-mock-plugin-CX5J2U56.js +0 -92
  86. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -32
  87. 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
- };