@storybook/builder-webpack5 10.1.0-alpha.8 → 10.1.0-beta.0
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/_node-chunks/chunk-FARUMDKN.js +60 -0
- package/dist/_node-chunks/{chunk-WL32LAJP.js → chunk-IXWOR6TE.js} +14 -19
- package/dist/index.js +610 -912
- package/dist/loaders/export-order-loader.js +15 -22
- package/dist/loaders/storybook-mock-transform-loader.js +29 -0
- package/dist/loaders/webpack-automock-loader.js +22 -0
- package/dist/presets/custom-webpack-preset.js +192 -73
- package/dist/presets/preview-preset.js +51 -71
- package/package.json +7 -4
- package/dist/_node-chunks/chunk-727LOYGO.js +0 -85
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/builder-webpack5",
|
|
3
|
-
"version": "10.1.0-
|
|
3
|
+
"version": "10.1.0-beta.0",
|
|
4
4
|
"description": "A Storybook builder to dev and build with Webpack",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
"default": "./dist/index.js"
|
|
33
33
|
},
|
|
34
34
|
"./loaders/export-order-loader": "./dist/loaders/export-order-loader.js",
|
|
35
|
+
"./loaders/storybook-mock-transform-loader": "./dist/loaders/storybook-mock-transform-loader.js",
|
|
36
|
+
"./loaders/webpack-automock-loader": "./dist/loaders/webpack-automock-loader.js",
|
|
35
37
|
"./package.json": "./package.json",
|
|
36
38
|
"./presets/custom-webpack-preset": "./dist/presets/custom-webpack-preset.js",
|
|
37
39
|
"./presets/preview-preset": "./dist/presets/preview-preset.js",
|
|
@@ -53,7 +55,8 @@
|
|
|
53
55
|
"prep": "jiti ../../../scripts/build/build-package.ts"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
|
-
"@storybook/core-webpack": "10.1.0-
|
|
58
|
+
"@storybook/core-webpack": "10.1.0-beta.0",
|
|
59
|
+
"@vitest/mocker": "3.2.4",
|
|
57
60
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
58
61
|
"cjs-module-lexer": "^1.2.3",
|
|
59
62
|
"css-loader": "^7.1.2",
|
|
@@ -79,7 +82,7 @@
|
|
|
79
82
|
"typescript": "^5.8.3"
|
|
80
83
|
},
|
|
81
84
|
"peerDependencies": {
|
|
82
|
-
"storybook": "^10.1.0-
|
|
85
|
+
"storybook": "^10.1.0-beta.0"
|
|
83
86
|
},
|
|
84
87
|
"peerDependenciesMeta": {
|
|
85
88
|
"typescript": {
|
|
@@ -89,5 +92,5 @@
|
|
|
89
92
|
"publishConfig": {
|
|
90
93
|
"access": "public"
|
|
91
94
|
},
|
|
92
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
|
|
93
96
|
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_rnh1x51h7lg from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_rnh1x51h7lg from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_rnh1x51h7lg from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_rnh1x51h7lg.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_rnh1x51h7lg.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_rnh1x51h7lg.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
__name
|
|
14
|
-
} from "./chunk-WL32LAJP.js";
|
|
15
|
-
|
|
16
|
-
// src/preview/virtual-module-mapping.ts
|
|
17
|
-
import { join, resolve } from "node:path";
|
|
18
|
-
import { fileURLToPath } from "node:url";
|
|
19
|
-
import {
|
|
20
|
-
getBuilderOptions,
|
|
21
|
-
loadPreviewOrConfigFile,
|
|
22
|
-
normalizeStories,
|
|
23
|
-
readTemplate
|
|
24
|
-
} from "storybook/internal/common";
|
|
25
|
-
import { toImportFn } from "@storybook/core-webpack";
|
|
26
|
-
|
|
27
|
-
// ../../node_modules/slash/index.js
|
|
28
|
-
function slash(path) {
|
|
29
|
-
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
30
|
-
if (isExtendedLengthPath) {
|
|
31
|
-
return path;
|
|
32
|
-
}
|
|
33
|
-
return path.replace(/\\/g, "/");
|
|
34
|
-
}
|
|
35
|
-
__name(slash, "slash");
|
|
36
|
-
|
|
37
|
-
// src/preview/virtual-module-mapping.ts
|
|
38
|
-
var getVirtualModules = /* @__PURE__ */ __name(async (options) => {
|
|
39
|
-
const virtualModules = {};
|
|
40
|
-
const builderOptions = await getBuilderOptions(options);
|
|
41
|
-
const workingDir = process.cwd();
|
|
42
|
-
const isProd = options.configType === "PRODUCTION";
|
|
43
|
-
const nonNormalizedStories = await options.presets.apply("stories", []);
|
|
44
|
-
const entries = [];
|
|
45
|
-
const stories = normalizeStories(nonNormalizedStories, {
|
|
46
|
-
configDir: options.configDir,
|
|
47
|
-
workingDir
|
|
48
|
-
});
|
|
49
|
-
const previewAnnotations = [
|
|
50
|
-
...(await options.presets.apply("previewAnnotations", [], options)).map(
|
|
51
|
-
(entry) => {
|
|
52
|
-
if (typeof entry === "object") {
|
|
53
|
-
return entry.absolute;
|
|
54
|
-
}
|
|
55
|
-
return slash(entry);
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
loadPreviewOrConfigFile(options)
|
|
59
|
-
].filter(Boolean);
|
|
60
|
-
const storiesFilename = "storybook-stories.js";
|
|
61
|
-
const storiesPath = resolve(join(workingDir, storiesFilename));
|
|
62
|
-
const needPipelinedImport = !!builderOptions.lazyCompilation && !isProd;
|
|
63
|
-
virtualModules[storiesPath] = toImportFn(stories, { needPipelinedImport });
|
|
64
|
-
const configEntryPath = resolve(join(workingDir, "storybook-config-entry.js"));
|
|
65
|
-
virtualModules[configEntryPath] = (await readTemplate(
|
|
66
|
-
fileURLToPath(
|
|
67
|
-
import.meta.resolve("@storybook/builder-webpack5/templates/virtualModuleModernEntry.js")
|
|
68
|
-
)
|
|
69
|
-
)).replaceAll(`'{{storiesFilename}}'`, `'./${storiesFilename}'`).replaceAll(
|
|
70
|
-
`'{{previewAnnotations}}'`,
|
|
71
|
-
previewAnnotations.filter(Boolean).map((entry) => `'${entry}'`).join(",")
|
|
72
|
-
).replaceAll(
|
|
73
|
-
`'{{previewAnnotations_requires}}'`,
|
|
74
|
-
previewAnnotations.filter(Boolean).map((entry) => `require('${entry}')`).join(",")
|
|
75
|
-
).replace(/\\/g, "\\\\");
|
|
76
|
-
entries.push(configEntryPath);
|
|
77
|
-
return {
|
|
78
|
-
virtualModules,
|
|
79
|
-
entries
|
|
80
|
-
};
|
|
81
|
-
}, "getVirtualModules");
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
getVirtualModules
|
|
85
|
-
};
|