storybook 10.1.0-alpha.11 → 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.
- package/dist/_browser-chunks/{chunk-74YHFU5B.js → chunk-2XZMBGTA.js} +1 -1
- package/dist/_browser-chunks/{chunk-EBHB6RPS.js → chunk-FQ7SLVLR.js} +6 -1
- package/dist/_browser-chunks/{chunk-X3DUQ5RA.js → chunk-GFY5R5EY.js} +1 -1
- package/dist/_node-chunks/{builder-manager-PMPHOSM2.js → builder-manager-DWDUVXZM.js} +27 -22
- package/dist/_node-chunks/{chunk-MJ3WOS6F.js → camelcase-EETCRTJX.js} +8 -8
- package/dist/_node-chunks/{chunk-UY26MQLT.js → chunk-2W4GZCLE.js} +7 -7
- package/dist/_node-chunks/chunk-447655DM.js +20 -0
- package/dist/_node-chunks/{chunk-GG2WQZSG.js → chunk-4EJUC2SD.js} +4998 -1685
- package/dist/_node-chunks/chunk-4ZJOH2UN.js +61 -0
- package/dist/_node-chunks/chunk-654SJIMS.js +23 -0
- package/dist/_node-chunks/{chunk-5QK5MSOI.js → chunk-7IAVT2FU.js} +7 -7
- package/dist/_node-chunks/{chunk-WLHMN7AP.js → chunk-7KFHRNOT.js} +7 -7
- package/dist/_node-chunks/{chunk-6ZOLETQK.js → chunk-AZIPBEBK.js} +6 -6
- package/dist/_node-chunks/{chunk-AKTRSR3O.js → chunk-B76FDKVB.js} +6 -6
- package/dist/_node-chunks/chunk-B7PGKETD.js +3781 -0
- package/dist/_node-chunks/{chunk-QECOQWRJ.js → chunk-CLUBH2LP.js} +55 -36
- package/dist/_node-chunks/{chunk-PHOZWZZO.js → chunk-CMYD2JNN.js} +7 -7
- package/dist/_node-chunks/{chunk-LR3QITDI.js → chunk-DIPKXLEP.js} +55 -32
- package/dist/_node-chunks/{chunk-4GZCFQFG.js → chunk-DPFYWXEA.js} +6 -6
- package/dist/_node-chunks/{chunk-LCZO45L7.js → chunk-FCVNHU2F.js} +7 -7
- package/dist/_node-chunks/{chunk-R6HWGZWD.js → chunk-JQ7RQS5Q.js} +6 -6
- package/dist/_node-chunks/chunk-LEL5OSY3.js +18 -0
- package/dist/_node-chunks/{chunk-BBOP3XCK.js → chunk-LPKSBF62.js} +6 -6
- package/dist/_node-chunks/chunk-LYEZOJ43.js +78 -0
- package/dist/_node-chunks/{chunk-ZZALGOA6.js → chunk-MIA5324I.js} +7 -7
- package/dist/_node-chunks/{chunk-SPQXMU2Q.js → chunk-MJM4TEMP.js} +14 -8
- package/dist/_node-chunks/{chunk-32NE3UE3.js → chunk-OVVZIUHS.js} +7 -7
- package/dist/_node-chunks/{chunk-ZZSRFAC6.js → chunk-RUUNVQ6W.js} +1108 -17
- package/dist/_node-chunks/{chunk-YHRFI6BE.js → chunk-URLNGLC2.js} +52 -72
- package/dist/_node-chunks/{chunk-XGVLB4UJ.js → chunk-WC2YEQHJ.js} +6 -6
- package/dist/_node-chunks/{chunk-JCRM2YVK.js → chunk-XKRVQL2G.js} +8 -8
- package/dist/_node-chunks/{chunk-TXZY6V6O.js → chunk-Z2OWEMX3.js} +8 -8
- package/dist/_node-chunks/{dist-4DWOCZUD.js → dist-22CLJ4BC.js} +9 -9
- package/dist/_node-chunks/{globby-AAARUKEU.js → globby-GR24TGSK.js} +9 -9
- package/dist/_node-chunks/{lib-HEUKGL62.js → lib-G2LGVRPC.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-DCVRPS6N.js → mdx-N42X6CFJ-W6P6IDDW.js} +8 -8
- package/dist/_node-chunks/{p-limit-F5ZKJ6WZ.js → p-limit-K4FZHG2F.js} +7 -7
- package/dist/babel/index.js +10 -11
- package/dist/bin/core.js +32 -26
- package/dist/bin/dispatcher.js +31 -20
- package/dist/bin/loader.js +10 -13
- package/dist/cli/index.d.ts +692 -133
- package/dist/cli/index.js +1005 -177
- package/dist/common/index.d.ts +139 -62
- package/dist/common/index.js +63 -49
- package/dist/core-server/index.d.ts +3 -2
- package/dist/core-server/index.js +96 -1413
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +25 -65
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +32 -3
- package/dist/manager/runtime.js +1 -1
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +4 -4
- package/dist/manager-errors.d.ts +6 -0
- package/dist/manager-errors.js +2 -2
- package/dist/mocking-utils/index.d.ts +1126 -0
- package/dist/{_node-chunks/chunk-UGDPX5LE.js → mocking-utils/index.js} +441 -16
- package/dist/node-logger/index.d.ts +192 -24
- package/dist/node-logger/index.js +23 -3148
- package/dist/preview/runtime.js +31 -2
- package/dist/preview-api/index.d.ts +69 -68
- package/dist/preview-errors.d.ts +6 -0
- package/dist/preview-errors.js +2 -2
- package/dist/server-errors.d.ts +31 -1
- package/dist/server-errors.js +17 -10
- package/dist/telemetry/index.d.ts +23 -2
- package/dist/telemetry/index.js +25 -24
- package/dist/types/index.d.ts +71 -8
- package/dist/types/index.js +25 -1
- package/package.json +7 -9
- package/dist/_node-chunks/camelcase-K3IOOFQW.js +0 -18
- package/dist/_node-chunks/chunk-7I22Y76Z.js +0 -1047
- package/dist/_node-chunks/chunk-C2GQVDWI.js +0 -34
- package/dist/_node-chunks/chunk-GQJOWVVR.js +0 -3214
- package/dist/_node-chunks/chunk-KK4AT5F3.js +0 -1029
- package/dist/_node-chunks/chunk-L7MYXJUM.js +0 -1114
- package/dist/_node-chunks/chunk-LXG4DK35.js +0 -3171
- package/dist/_node-chunks/chunk-QH4V5YDB.js +0 -20
- package/dist/_node-chunks/chunk-WK3EMYK6.js +0 -61
- package/dist/_node-chunks/chunk-YK4KVMFW.js +0 -18
- package/dist/_node-chunks/chunk-ZZPBSYA5.js +0 -301
- package/dist/_node-chunks/plugin-7YY7JXCH.js +0 -123
- package/dist/_node-chunks/plugin-SZP3CW6W.js +0 -109
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +0 -46623
- package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +0 -92
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -32
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -28
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_843v2rliy1 from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_843v2rliy1 from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_843v2rliy1 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_843v2rliy1.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_843v2rliy1.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_843v2rliy1.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-ZZPBSYA5.js";
|
|
19
|
-
import "./chunk-BBOP3XCK.js";
|
|
20
|
-
import "./chunk-XGVLB4UJ.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_843v2rliy1 from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_843v2rliy1 from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_843v2rliy1 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_843v2rliy1.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_843v2rliy1.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_843v2rliy1.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-ZZPBSYA5.js";
|
|
15
|
-
import "../../../../_node-chunks/chunk-BBOP3XCK.js";
|
|
16
|
-
import "../../../../_node-chunks/chunk-XGVLB4UJ.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_843v2rliy1 from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_843v2rliy1 from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_843v2rliy1 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_843v2rliy1.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_843v2rliy1.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_843v2rliy1.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-UGDPX5LE.js";
|
|
15
|
-
import {
|
|
16
|
-
babelParser
|
|
17
|
-
} from "../../../../_node-chunks/chunk-ZZPBSYA5.js";
|
|
18
|
-
import "../../../../_node-chunks/chunk-BBOP3XCK.js";
|
|
19
|
-
import "../../../../_node-chunks/chunk-XGVLB4UJ.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
|
-
};
|