@storybook/builder-webpack5 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.
- package/dist/_node-chunks/{chunk-PNIJKQ6N.js → chunk-KU5MRVPI.js} +6 -6
- package/dist/_node-chunks/{chunk-NLTG2HNE.js → chunk-YGASIQTS.js} +6 -6
- package/dist/index.js +8 -8
- package/dist/loaders/export-order-loader.js +7 -7
- 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 +153 -12
- package/dist/presets/preview-preset.js +8 -8
- package/package.json +6 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.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
|
getVirtualModules
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-YGASIQTS.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
19
|
-
} from "./_node-chunks/chunk-
|
|
19
|
+
} from "./_node-chunks/chunk-KU5MRVPI.js";
|
|
20
20
|
|
|
21
21
|
// ../../node_modules/pretty-hrtime/index.js
|
|
22
22
|
var require_pretty_hrtime = __commonJS({
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.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 "../_node-chunks/chunk-
|
|
12
|
+
import "../_node-chunks/chunk-KU5MRVPI.js";
|
|
13
13
|
|
|
14
14
|
// src/loaders/export-order-loader.ts
|
|
15
15
|
import assert from "node:assert";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import "../_node-chunks/chunk-KU5MRVPI.js";
|
|
13
|
+
|
|
14
|
+
// src/loaders/storybook-mock-transform-loader.ts
|
|
15
|
+
import { rewriteSbMockImportCalls } from "storybook/internal/mocking-utils";
|
|
16
|
+
import { logger } from "storybook/internal/node-logger";
|
|
17
|
+
var storybookMockTransformLoader = function(source, sourceMap, meta) {
|
|
18
|
+
let callback = this.async();
|
|
19
|
+
try {
|
|
20
|
+
let result = rewriteSbMockImportCalls(source);
|
|
21
|
+
callback(null, result.code, result.map || void 0, meta);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
let filePath = this.resourcePath;
|
|
24
|
+
logger.debug(`Could not transform sb.mock(import(...)) calls in ${filePath}: ${error}`), callback(null, source, sourceMap, meta);
|
|
25
|
+
}
|
|
26
|
+
}, storybook_mock_transform_loader_default = storybookMockTransformLoader;
|
|
27
|
+
export {
|
|
28
|
+
storybook_mock_transform_loader_default as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import "../_node-chunks/chunk-KU5MRVPI.js";
|
|
13
|
+
|
|
14
|
+
// src/loaders/webpack-automock-loader.ts
|
|
15
|
+
import { babelParser, getAutomockCode } from "storybook/internal/mocking-utils";
|
|
16
|
+
function webpackAutomockLoader(source) {
|
|
17
|
+
let isSpy = this.getOptions().spy === "true";
|
|
18
|
+
return getAutomockCode(source, isSpy, babelParser).toString();
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
webpackAutomockLoader as default
|
|
22
|
+
};
|
|
@@ -1,23 +1,144 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.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
|
|
12
|
+
import {
|
|
13
|
+
__require
|
|
14
|
+
} from "../_node-chunks/chunk-KU5MRVPI.js";
|
|
13
15
|
|
|
14
16
|
// src/presets/custom-webpack-preset.ts
|
|
17
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
18
|
+
import { findConfigFile } from "storybook/internal/common";
|
|
15
19
|
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
16
20
|
import { loadCustomWebpackConfig } from "@storybook/core-webpack";
|
|
17
21
|
import webpackModule from "webpack";
|
|
18
22
|
|
|
19
|
-
// src/
|
|
23
|
+
// src/plugins/webpack-inject-mocker-runtime-plugin.ts
|
|
24
|
+
import { getMockerRuntime } from "storybook/internal/mocking-utils";
|
|
25
|
+
var PLUGIN_NAME = "WebpackInjectMockerRuntimePlugin", WebpackInjectMockerRuntimePlugin = class {
|
|
26
|
+
// We need to lazy-require HtmlWebpackPlugin because it's an optional peer dependency.
|
|
27
|
+
getHtmlWebpackPlugin(compiler) {
|
|
28
|
+
try {
|
|
29
|
+
let constructor = compiler.options.plugins.find(
|
|
30
|
+
(p) => p?.constructor?.name === "HtmlWebpackPlugin"
|
|
31
|
+
)?.constructor;
|
|
32
|
+
return constructor || __require("html-webpack-plugin");
|
|
33
|
+
} catch {
|
|
34
|
+
return compiler.getInfrastructureLogger(PLUGIN_NAME).warn("html-webpack-plugin is not installed. Cannot inject mocker runtime."), null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The main entry point for the Webpack plugin.
|
|
39
|
+
*
|
|
40
|
+
* @param {Compiler} compiler The Webpack compiler instance.
|
|
41
|
+
*/
|
|
42
|
+
apply(compiler) {
|
|
43
|
+
let HtmlWebpackPlugin = this.getHtmlWebpackPlugin(compiler);
|
|
44
|
+
HtmlWebpackPlugin && compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
45
|
+
HtmlWebpackPlugin.getHooks(compilation).beforeAssetTagGeneration.tapAsync(
|
|
46
|
+
PLUGIN_NAME,
|
|
47
|
+
(data, cb) => {
|
|
48
|
+
try {
|
|
49
|
+
let runtimeScriptContent = getMockerRuntime(), runtimeAssetName = "mocker-runtime-injected.js";
|
|
50
|
+
compilation.emitAsset(
|
|
51
|
+
runtimeAssetName,
|
|
52
|
+
new compiler.webpack.sources.RawSource(runtimeScriptContent)
|
|
53
|
+
), data.assets.js.unshift(runtimeAssetName), cb(null, data);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
cb(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/plugins/webpack-mock-plugin.ts
|
|
64
|
+
import { dirname, isAbsolute } from "node:path";
|
|
20
65
|
import { fileURLToPath } from "node:url";
|
|
66
|
+
import {
|
|
67
|
+
babelParser,
|
|
68
|
+
extractMockCalls,
|
|
69
|
+
getIsExternal,
|
|
70
|
+
resolveExternalModule,
|
|
71
|
+
resolveWithExtensions
|
|
72
|
+
} from "storybook/internal/mocking-utils";
|
|
73
|
+
import { findMockRedirect } from "@vitest/mocker/redirect";
|
|
74
|
+
var PLUGIN_NAME2 = "storybook-mock-plugin", WebpackMockPlugin = class {
|
|
75
|
+
constructor(options) {
|
|
76
|
+
this.mockMap = /* @__PURE__ */ new Map();
|
|
77
|
+
if (!options.previewConfigPath)
|
|
78
|
+
throw new Error(`[${PLUGIN_NAME2}] \`previewConfigPath\` is required.`);
|
|
79
|
+
this.options = options;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The main entry point for the Webpack plugin.
|
|
83
|
+
*
|
|
84
|
+
* @param {Compiler} compiler The Webpack compiler instance.
|
|
85
|
+
*/
|
|
86
|
+
apply(compiler) {
|
|
87
|
+
let logger3 = compiler.getInfrastructureLogger(PLUGIN_NAME2), updateMocks = () => {
|
|
88
|
+
this.mockMap = new Map(
|
|
89
|
+
this.extractAndResolveMocks(compiler).flatMap((mock) => [
|
|
90
|
+
// first one, full path
|
|
91
|
+
[mock.absolutePath, mock],
|
|
92
|
+
// second one, without the extension
|
|
93
|
+
[mock.absolutePath.replace(/\.[^.]+$/, ""), mock]
|
|
94
|
+
])
|
|
95
|
+
), logger3.info(`Mock map updated with ${this.mockMap.size / 2} mocks.`);
|
|
96
|
+
};
|
|
97
|
+
compiler.hooks.beforeRun.tap(PLUGIN_NAME2, updateMocks), compiler.hooks.watchRun.tap(PLUGIN_NAME2, updateMocks), new compiler.webpack.NormalModuleReplacementPlugin(/.*/, (resource) => {
|
|
98
|
+
try {
|
|
99
|
+
let path = resource.request, importer = resource.context, absolutePath = getIsExternal(path, importer) ? resolveExternalModule(path, importer) : resolveWithExtensions(path, importer);
|
|
100
|
+
this.mockMap.has(absolutePath) && (resource.request = this.mockMap.get(absolutePath).replacementResource);
|
|
101
|
+
} catch {
|
|
102
|
+
logger3.debug(`Could not resolve mock for "${resource.request}".`);
|
|
103
|
+
}
|
|
104
|
+
}).apply(compiler), compiler.hooks.afterCompile.tap(PLUGIN_NAME2, (compilation) => {
|
|
105
|
+
compilation.fileDependencies.add(this.options.previewConfigPath);
|
|
106
|
+
for (let mock of this.mockMap.values())
|
|
107
|
+
isAbsolute(mock.replacementResource) && mock.replacementResource.includes("__mocks__") && compilation.contextDependencies.add(dirname(mock.replacementResource));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Reads the preview config, parses it to find all `sb.mock()` calls, and resolves their
|
|
112
|
+
* corresponding mock implementations.
|
|
113
|
+
*
|
|
114
|
+
* @param {Compiler} compiler The Webpack compiler instance.
|
|
115
|
+
* @returns {ResolvedMock[]} An array of fully processed mocks.
|
|
116
|
+
*/
|
|
117
|
+
extractAndResolveMocks(compiler) {
|
|
118
|
+
let { previewConfigPath } = this.options, logger3 = compiler.getInfrastructureLogger(PLUGIN_NAME2), mocks = extractMockCalls(
|
|
119
|
+
{ previewConfigPath, configDir: dirname(previewConfigPath) },
|
|
120
|
+
babelParser,
|
|
121
|
+
compiler.context,
|
|
122
|
+
findMockRedirect
|
|
123
|
+
), resolvedMocks = [];
|
|
124
|
+
for (let mock of mocks)
|
|
125
|
+
try {
|
|
126
|
+
let { absolutePath, redirectPath } = mock, replacementResource;
|
|
127
|
+
redirectPath ? replacementResource = redirectPath : replacementResource = `${fileURLToPath(
|
|
128
|
+
import.meta.resolve("@storybook/builder-webpack5/loaders/webpack-automock-loader")
|
|
129
|
+
)}?spy=${mock.spy}!${absolutePath}`, resolvedMocks.push({
|
|
130
|
+
...mock,
|
|
131
|
+
replacementResource
|
|
132
|
+
});
|
|
133
|
+
} catch {
|
|
134
|
+
logger3.warn(`Could not resolve mock for "${mock.path}". It will be ignored.`);
|
|
135
|
+
}
|
|
136
|
+
return resolvedMocks;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// src/preview/base-webpack.config.ts
|
|
141
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
21
142
|
import { logger } from "storybook/internal/node-logger";
|
|
22
143
|
async function createDefaultWebpackConfig(storybookBaseConfig, options) {
|
|
23
144
|
if (options.presetsList?.some(
|
|
@@ -29,7 +150,7 @@ async function createDefaultWebpackConfig(storybookBaseConfig, options) {
|
|
|
29
150
|
let hasPostcssAddon = options.presetsList?.some(
|
|
30
151
|
(preset) => /@storybook(\/|\\)addon-postcss/.test(typeof preset == "string" ? preset : preset.name)
|
|
31
152
|
), cssLoaders = {};
|
|
32
|
-
hasPostcssAddon || (logger.info("
|
|
153
|
+
hasPostcssAddon || (logger.info("Using implicit CSS loaders"), cssLoaders = {
|
|
33
154
|
test: /\.css$/,
|
|
34
155
|
sideEffects: !0,
|
|
35
156
|
use: [
|
|
@@ -37,9 +158,9 @@ async function createDefaultWebpackConfig(storybookBaseConfig, options) {
|
|
|
37
158
|
// Trying to apply style-loader or css-loader to files that already have been
|
|
38
159
|
// processed by them causes webpack to crash, so no one else can add similar
|
|
39
160
|
// loader configurations to the `.css` extension.
|
|
40
|
-
|
|
161
|
+
fileURLToPath2(import.meta.resolve("style-loader")),
|
|
41
162
|
{
|
|
42
|
-
loader:
|
|
163
|
+
loader: fileURLToPath2(import.meta.resolve("css-loader")),
|
|
43
164
|
options: {
|
|
44
165
|
importLoaders: 1
|
|
45
166
|
}
|
|
@@ -49,6 +170,12 @@ async function createDefaultWebpackConfig(storybookBaseConfig, options) {
|
|
|
49
170
|
let isProd = storybookBaseConfig.mode !== "development";
|
|
50
171
|
return {
|
|
51
172
|
...storybookBaseConfig,
|
|
173
|
+
// TODO: Implement the clearing functionality of StyledConsoleLogger so that we can use it for webpack
|
|
174
|
+
// The issue currently is that the status line is not cleared when the webpack compiler is run,
|
|
175
|
+
// which causes the status line to be printed multiple times.
|
|
176
|
+
// infrastructureLogging: {
|
|
177
|
+
// console: new StyledConsoleLogger({ prefix: 'Webpack', color: 'bgBlue' }),
|
|
178
|
+
// },
|
|
52
179
|
module: {
|
|
53
180
|
...storybookBaseConfig.module,
|
|
54
181
|
rules: [
|
|
@@ -117,16 +244,30 @@ var swc = (config) => ({
|
|
|
117
244
|
bugfixes: config?.env?.bugfixes ?? !0
|
|
118
245
|
}
|
|
119
246
|
});
|
|
247
|
+
async function webpackFinal(config, options) {
|
|
248
|
+
let previewConfigPath = findConfigFile("preview", options.configDir);
|
|
249
|
+
return previewConfigPath && (config.plugins = config.plugins || [], config.module.rules.push({
|
|
250
|
+
test: /preview\.(t|j)sx?$/,
|
|
251
|
+
use: [
|
|
252
|
+
{
|
|
253
|
+
loader: fileURLToPath3(
|
|
254
|
+
import.meta.resolve("@storybook/builder-webpack5/loaders/storybook-mock-transform-loader")
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
}), config.plugins.push(new WebpackMockPlugin({ previewConfigPath })), config.plugins.push(new WebpackInjectMockerRuntimePlugin())), config;
|
|
259
|
+
}
|
|
120
260
|
async function webpack(config, options) {
|
|
121
261
|
let { configDir, configType, presets } = options, coreOptions = await presets.apply("core"), defaultConfig = config;
|
|
122
262
|
coreOptions?.disableWebpackDefaults || (defaultConfig = await createDefaultWebpackConfig(config, options));
|
|
123
263
|
let finalDefaultConfig = await presets.apply("webpackFinal", defaultConfig, options), customConfig = await loadCustomWebpackConfig(configDir);
|
|
124
|
-
return typeof customConfig == "function" ? (logger2.info("
|
|
264
|
+
return typeof customConfig == "function" ? (logger2.info("Loading custom Webpack config (full-control mode)."), customConfig({ config: finalDefaultConfig, mode: configType })) : (logger2.info("Using default Webpack5 setup"), finalDefaultConfig);
|
|
125
265
|
}
|
|
126
266
|
var webpackInstance = async () => webpackModule, webpackVersion = async () => "5";
|
|
127
267
|
export {
|
|
128
268
|
swc,
|
|
129
269
|
webpack,
|
|
270
|
+
webpackFinal,
|
|
130
271
|
webpackInstance,
|
|
131
272
|
webpackVersion
|
|
132
273
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0i1wf1q6y4l from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0i1wf1q6y4l from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0i1wf1q6y4l.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0i1wf1q6y4l.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0i1wf1q6y4l.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
|
getVirtualModules
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
15
|
-
import "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-YGASIQTS.js";
|
|
15
|
+
import "../_node-chunks/chunk-KU5MRVPI.js";
|
|
16
16
|
|
|
17
17
|
// src/presets/preview-preset.ts
|
|
18
18
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/builder-webpack5",
|
|
3
|
-
"version": "10.1.0-alpha.
|
|
3
|
+
"version": "10.1.0-alpha.14",
|
|
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-alpha.
|
|
58
|
+
"@storybook/core-webpack": "10.1.0-alpha.14",
|
|
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-alpha.
|
|
85
|
+
"storybook": "^10.1.0-alpha.14"
|
|
83
86
|
},
|
|
84
87
|
"peerDependenciesMeta": {
|
|
85
88
|
"typescript": {
|