storybook-builder-rsbuild 2.1.4 → 2.1.6
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.
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_modules__ = {
|
|
4
|
+
830: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if ((from && typeof from == "object") || typeof from == "function")
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
!__hasOwnProp.call(to, key) &&
|
|
17
|
+
key !== except &&
|
|
18
|
+
__defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable:
|
|
21
|
+
!(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
22
|
+
});
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) =>
|
|
26
|
+
__copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
27
|
+
var index_exports = {};
|
|
28
|
+
__export(index_exports, {
|
|
29
|
+
checkWebpackVersion: () => checkWebpackVersion,
|
|
30
|
+
loadCustomWebpackConfig: () => loadCustomWebpackConfig,
|
|
31
|
+
mergeConfigs: () => mergeConfigs,
|
|
32
|
+
toImportFn: () => toImportFn,
|
|
33
|
+
toImportFnPart: () => toImportFnPart,
|
|
34
|
+
toRequireContext: () => toRequireContext,
|
|
35
|
+
toRequireContextString: () => toRequireContextString,
|
|
36
|
+
webpackIncludeRegexp: () => webpackIncludeRegexp,
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
|
+
var import_node_path = __nccwpck_require__(928),
|
|
40
|
+
import_common = __nccwpck_require__(253),
|
|
41
|
+
webpackConfigs = ["webpack.config", "webpackfile"],
|
|
42
|
+
loadCustomWebpackConfig = (configDir) =>
|
|
43
|
+
(0, import_common.serverRequire)(
|
|
44
|
+
webpackConfigs.map((configName) =>
|
|
45
|
+
(0, import_node_path.resolve)(configDir, configName),
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
var import_node_logger = __nccwpck_require__(519),
|
|
49
|
+
import_ts_dedent = __nccwpck_require__(980),
|
|
50
|
+
checkWebpackVersion = (webpack, specifier, caption) => {
|
|
51
|
+
if (!webpack.version) {
|
|
52
|
+
import_node_logger.logger.info(
|
|
53
|
+
"Skipping webpack version check, no version available",
|
|
54
|
+
);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
webpack.version !== specifier &&
|
|
58
|
+
import_node_logger.logger.warn(import_ts_dedent.dedent`
|
|
59
|
+
Unexpected webpack version in ${caption}:
|
|
60
|
+
- Received '${webpack.version}'
|
|
61
|
+
- Expected '${specifier}'
|
|
62
|
+
|
|
63
|
+
If you're using Webpack 5 in SB6.2 and upgrading, consider: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5-manager-build
|
|
64
|
+
|
|
65
|
+
For more info about Webpack 5 support: https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#troubleshooting
|
|
66
|
+
`);
|
|
67
|
+
};
|
|
68
|
+
function mergePluginsField(defaultPlugins = [], customPlugins = []) {
|
|
69
|
+
return [...defaultPlugins, ...customPlugins];
|
|
70
|
+
}
|
|
71
|
+
function mergeRulesField(defaultRules = [], customRules = []) {
|
|
72
|
+
return [...defaultRules, ...customRules];
|
|
73
|
+
}
|
|
74
|
+
function mergeExtensionsField(
|
|
75
|
+
{ extensions: defaultExtensions = [] },
|
|
76
|
+
{ extensions: customExtensions = [] },
|
|
77
|
+
) {
|
|
78
|
+
return [...defaultExtensions, ...customExtensions];
|
|
79
|
+
}
|
|
80
|
+
function mergeAliasField(
|
|
81
|
+
{ alias: defaultAlias = {} },
|
|
82
|
+
{ alias: customAlias = {} },
|
|
83
|
+
) {
|
|
84
|
+
return { ...defaultAlias, ...customAlias };
|
|
85
|
+
}
|
|
86
|
+
function mergeModuleField(a, b) {
|
|
87
|
+
return {
|
|
88
|
+
...a,
|
|
89
|
+
...b,
|
|
90
|
+
rules: mergeRulesField(a.rules || [], b.rules || []),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function mergeResolveField(
|
|
94
|
+
{ resolve: defaultResolve = {} },
|
|
95
|
+
{ resolve: customResolve = {} },
|
|
96
|
+
) {
|
|
97
|
+
return {
|
|
98
|
+
...defaultResolve,
|
|
99
|
+
...customResolve,
|
|
100
|
+
alias: mergeAliasField(defaultResolve, customResolve),
|
|
101
|
+
extensions: mergeExtensionsField(defaultResolve, customResolve),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function mergeOptimizationField(
|
|
105
|
+
{ optimization: defaultOptimization = {} },
|
|
106
|
+
{ optimization: customOptimization = {} },
|
|
107
|
+
) {
|
|
108
|
+
return { ...defaultOptimization, ...customOptimization };
|
|
109
|
+
}
|
|
110
|
+
function mergeConfigs(config, customConfig) {
|
|
111
|
+
return {
|
|
112
|
+
...customConfig,
|
|
113
|
+
...config,
|
|
114
|
+
devtool: customConfig.devtool || config.devtool,
|
|
115
|
+
plugins: mergePluginsField(config.plugins, customConfig.plugins),
|
|
116
|
+
module: mergeModuleField(
|
|
117
|
+
config.module || {},
|
|
118
|
+
customConfig.module || {},
|
|
119
|
+
),
|
|
120
|
+
resolve: mergeResolveField(config, customConfig),
|
|
121
|
+
optimization: mergeOptimizationField(config, customConfig),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
var import_common2 = __nccwpck_require__(253),
|
|
125
|
+
import_ts_dedent2 = __nccwpck_require__(980);
|
|
126
|
+
function importPipeline() {
|
|
127
|
+
let importGate = Promise.resolve();
|
|
128
|
+
return async (importFn) => {
|
|
129
|
+
await importGate;
|
|
130
|
+
let moduleExportsPromise = importFn();
|
|
131
|
+
return (
|
|
132
|
+
(importGate = importGate.then(async () => {
|
|
133
|
+
await moduleExportsPromise;
|
|
134
|
+
})),
|
|
135
|
+
moduleExportsPromise
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function adjustRegexToExcludeNodeModules(originalRegex) {
|
|
140
|
+
let originalRegexString = originalRegex.source,
|
|
141
|
+
startsWithCaret = originalRegexString.startsWith("^"),
|
|
142
|
+
excludeNodeModulesPattern = startsWithCaret
|
|
143
|
+
? "(?!.*node_modules)"
|
|
144
|
+
: "^(?!.*node_modules)",
|
|
145
|
+
adjustedRegexString = startsWithCaret
|
|
146
|
+
? `^${excludeNodeModulesPattern}${originalRegexString.substring(1)}`
|
|
147
|
+
: excludeNodeModulesPattern + originalRegexString;
|
|
148
|
+
return new RegExp(adjustedRegexString);
|
|
149
|
+
}
|
|
150
|
+
function webpackIncludeRegexp(specifier) {
|
|
151
|
+
let { directory, files } = specifier,
|
|
152
|
+
directoryWithoutLeadingDots = directory.replace(/^(\.+\/)+/, "/"),
|
|
153
|
+
webpackIncludeGlob = [".", ".."].includes(directory)
|
|
154
|
+
? files
|
|
155
|
+
: `${directoryWithoutLeadingDots}/${files}`,
|
|
156
|
+
webpackIncludeRegexpWithCaret = webpackIncludeGlob.includes(
|
|
157
|
+
"node_modules",
|
|
158
|
+
)
|
|
159
|
+
? (0, import_common2.globToRegexp)(webpackIncludeGlob)
|
|
160
|
+
: adjustRegexToExcludeNodeModules(
|
|
161
|
+
(0, import_common2.globToRegexp)(webpackIncludeGlob),
|
|
162
|
+
);
|
|
163
|
+
return new RegExp(
|
|
164
|
+
webpackIncludeRegexpWithCaret.source.replace(/^\^/, ""),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
function toImportFnPart(specifier) {
|
|
168
|
+
let { directory, importPathMatcher } = specifier;
|
|
169
|
+
return import_ts_dedent2.dedent`
|
|
170
|
+
async (path) => {
|
|
171
|
+
if (!${importPathMatcher}.exec(path)) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const pathRemainder = path.substring(${directory.length + 1});
|
|
176
|
+
return import(
|
|
177
|
+
/* webpackChunkName: "[request]" */
|
|
178
|
+
/* webpackInclude: ${webpackIncludeRegexp(specifier)} */
|
|
179
|
+
'${directory}/' + pathRemainder
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
function toImportFn(stories, { needPipelinedImport } = {}) {
|
|
186
|
+
let pipelinedImport = "const pipeline = (x) => x();";
|
|
187
|
+
return (
|
|
188
|
+
needPipelinedImport &&
|
|
189
|
+
(pipelinedImport = `\n const importPipeline = ${importPipeline};\n const pipeline = importPipeline();\n `),
|
|
190
|
+
import_ts_dedent2.dedent`
|
|
191
|
+
${pipelinedImport}
|
|
192
|
+
|
|
193
|
+
const importers = [
|
|
194
|
+
${stories.map(toImportFnPart).join(`,\n`)}
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
export async function importFn(path) {
|
|
198
|
+
for (let i = 0; i < importers.length; i++) {
|
|
199
|
+
const moduleExports = await pipeline(() => importers[i](path));
|
|
200
|
+
if (moduleExports) {
|
|
201
|
+
return moduleExports;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
var import_common3 = __nccwpck_require__(253),
|
|
209
|
+
toRequireContext = (specifier) => {
|
|
210
|
+
let { directory, files } = specifier,
|
|
211
|
+
match = (0, import_common3.globToRegexp)(`./${files}`);
|
|
212
|
+
return {
|
|
213
|
+
path: directory,
|
|
214
|
+
recursive: files.includes("**") || files.split("/").length > 1,
|
|
215
|
+
match,
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
toRequireContextString = (specifier) => {
|
|
219
|
+
let { path: p, recursive: r, match: m } = toRequireContext(specifier);
|
|
220
|
+
return `require.context('${p}', ${r}, ${m})`;
|
|
221
|
+
};
|
|
222
|
+
0 && 0;
|
|
223
|
+
},
|
|
224
|
+
980: (__unused_webpack_module, exports) => {
|
|
225
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
226
|
+
exports.dedent = void 0;
|
|
227
|
+
function dedent(templ) {
|
|
228
|
+
var values = [];
|
|
229
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
230
|
+
values[_i - 1] = arguments[_i];
|
|
231
|
+
}
|
|
232
|
+
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
233
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(
|
|
234
|
+
/\r?\n([\t ]*)$/,
|
|
235
|
+
"",
|
|
236
|
+
);
|
|
237
|
+
var indentLengths = strings.reduce(function (arr, str) {
|
|
238
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
239
|
+
if (matches) {
|
|
240
|
+
return arr.concat(
|
|
241
|
+
matches.map(function (match) {
|
|
242
|
+
var _a, _b;
|
|
243
|
+
return (_b =
|
|
244
|
+
(_a = match.match(/[\t ]/g)) === null || _a === void 0
|
|
245
|
+
? void 0
|
|
246
|
+
: _a.length) !== null && _b !== void 0
|
|
247
|
+
? _b
|
|
248
|
+
: 0;
|
|
249
|
+
}),
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
return arr;
|
|
253
|
+
}, []);
|
|
254
|
+
if (indentLengths.length) {
|
|
255
|
+
var pattern_1 = new RegExp(
|
|
256
|
+
"\n[\t ]{" + Math.min.apply(Math, indentLengths) + "}",
|
|
257
|
+
"g",
|
|
258
|
+
);
|
|
259
|
+
strings = strings.map(function (str) {
|
|
260
|
+
return str.replace(pattern_1, "\n");
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
264
|
+
var string = strings[0];
|
|
265
|
+
values.forEach(function (value, i) {
|
|
266
|
+
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
267
|
+
var endentation = endentations ? endentations[1] : "";
|
|
268
|
+
var indentedValue = value;
|
|
269
|
+
if (typeof value === "string" && value.includes("\n")) {
|
|
270
|
+
indentedValue = String(value)
|
|
271
|
+
.split("\n")
|
|
272
|
+
.map(function (str, i) {
|
|
273
|
+
return i === 0 ? str : "" + endentation + str;
|
|
274
|
+
})
|
|
275
|
+
.join("\n");
|
|
276
|
+
}
|
|
277
|
+
string += indentedValue + strings[i + 1];
|
|
278
|
+
});
|
|
279
|
+
return string;
|
|
280
|
+
}
|
|
281
|
+
exports.dedent = dedent;
|
|
282
|
+
exports["default"] = dedent;
|
|
283
|
+
},
|
|
284
|
+
928: (module) => {
|
|
285
|
+
module.exports = require("path");
|
|
286
|
+
},
|
|
287
|
+
253: (module) => {
|
|
288
|
+
module.exports = require("storybook/internal/common");
|
|
289
|
+
},
|
|
290
|
+
519: (module) => {
|
|
291
|
+
module.exports = require("storybook/internal/node-logger");
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
var __webpack_module_cache__ = {};
|
|
295
|
+
function __nccwpck_require__(moduleId) {
|
|
296
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
297
|
+
if (cachedModule !== undefined) {
|
|
298
|
+
return cachedModule.exports;
|
|
299
|
+
}
|
|
300
|
+
var module = (__webpack_module_cache__[moduleId] = { exports: {} });
|
|
301
|
+
var threw = true;
|
|
302
|
+
try {
|
|
303
|
+
__webpack_modules__[moduleId](
|
|
304
|
+
module,
|
|
305
|
+
module.exports,
|
|
306
|
+
__nccwpck_require__,
|
|
307
|
+
);
|
|
308
|
+
threw = false;
|
|
309
|
+
} finally {
|
|
310
|
+
if (threw) delete __webpack_module_cache__[moduleId];
|
|
311
|
+
}
|
|
312
|
+
return module.exports;
|
|
313
|
+
}
|
|
314
|
+
if (typeof __nccwpck_require__ !== "undefined")
|
|
315
|
+
__nccwpck_require__.ab = __dirname + "/";
|
|
316
|
+
var __webpack_exports__ = __nccwpck_require__(830);
|
|
317
|
+
module.exports = __webpack_exports__;
|
|
318
|
+
})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@storybook/core-webpack","version":"9.1.15","funding":{"type":"opencollective","url":"https://opencollective.com/storybook"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/index.js
CHANGED
|
@@ -102,6 +102,278 @@ var require_pretty_hrtime = __commonJS({
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
+
// compiled/@storybook/core-webpack/index.js
|
|
106
|
+
var require_core_webpack = __commonJS({
|
|
107
|
+
"compiled/@storybook/core-webpack/index.js"(exports, module2) {
|
|
108
|
+
"use strict";
|
|
109
|
+
(() => {
|
|
110
|
+
"use strict";
|
|
111
|
+
var __webpack_modules__ = {
|
|
112
|
+
830: (module3, __unused_webpack_exports, __nccwpck_require__2) => {
|
|
113
|
+
var __defProp2 = Object.defineProperty;
|
|
114
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
115
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
116
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
117
|
+
var __export2 = (target, all) => {
|
|
118
|
+
for (var name in all)
|
|
119
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
120
|
+
}, __copyProps2 = (to, from, except, desc) => {
|
|
121
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
122
|
+
for (let key of __getOwnPropNames2(from))
|
|
123
|
+
!__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, {
|
|
124
|
+
get: () => from[key],
|
|
125
|
+
enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
|
|
126
|
+
});
|
|
127
|
+
return to;
|
|
128
|
+
};
|
|
129
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
130
|
+
var index_exports = {};
|
|
131
|
+
__export2(index_exports, {
|
|
132
|
+
checkWebpackVersion: () => checkWebpackVersion,
|
|
133
|
+
loadCustomWebpackConfig: () => loadCustomWebpackConfig,
|
|
134
|
+
mergeConfigs: () => mergeConfigs,
|
|
135
|
+
toImportFn: () => toImportFn2,
|
|
136
|
+
toImportFnPart: () => toImportFnPart,
|
|
137
|
+
toRequireContext: () => toRequireContext,
|
|
138
|
+
toRequireContextString: () => toRequireContextString,
|
|
139
|
+
webpackIncludeRegexp: () => webpackIncludeRegexp
|
|
140
|
+
});
|
|
141
|
+
module3.exports = __toCommonJS2(index_exports);
|
|
142
|
+
var import_node_path5 = __nccwpck_require__2(928), import_common4 = __nccwpck_require__2(253), webpackConfigs = ["webpack.config", "webpackfile"], loadCustomWebpackConfig = (configDir) => (0, import_common4.serverRequire)(
|
|
143
|
+
webpackConfigs.map(
|
|
144
|
+
(configName) => (0, import_node_path5.resolve)(configDir, configName)
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
var import_node_logger = __nccwpck_require__2(519), import_ts_dedent2 = __nccwpck_require__2(980), checkWebpackVersion = (webpack, specifier, caption) => {
|
|
148
|
+
if (!webpack.version) {
|
|
149
|
+
import_node_logger.logger.info(
|
|
150
|
+
"Skipping webpack version check, no version available"
|
|
151
|
+
);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
webpack.version !== specifier && import_node_logger.logger.warn(import_ts_dedent2.dedent`
|
|
155
|
+
Unexpected webpack version in ${caption}:
|
|
156
|
+
- Received '${webpack.version}'
|
|
157
|
+
- Expected '${specifier}'
|
|
158
|
+
|
|
159
|
+
If you're using Webpack 5 in SB6.2 and upgrading, consider: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5-manager-build
|
|
160
|
+
|
|
161
|
+
For more info about Webpack 5 support: https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#troubleshooting
|
|
162
|
+
`);
|
|
163
|
+
};
|
|
164
|
+
function mergePluginsField(defaultPlugins = [], customPlugins = []) {
|
|
165
|
+
return [...defaultPlugins, ...customPlugins];
|
|
166
|
+
}
|
|
167
|
+
function mergeRulesField(defaultRules = [], customRules = []) {
|
|
168
|
+
return [...defaultRules, ...customRules];
|
|
169
|
+
}
|
|
170
|
+
function mergeExtensionsField({ extensions: defaultExtensions = [] }, { extensions: customExtensions = [] }) {
|
|
171
|
+
return [...defaultExtensions, ...customExtensions];
|
|
172
|
+
}
|
|
173
|
+
function mergeAliasField({ alias: defaultAlias = {} }, { alias: customAlias = {} }) {
|
|
174
|
+
return { ...defaultAlias, ...customAlias };
|
|
175
|
+
}
|
|
176
|
+
function mergeModuleField(a, b) {
|
|
177
|
+
return {
|
|
178
|
+
...a,
|
|
179
|
+
...b,
|
|
180
|
+
rules: mergeRulesField(a.rules || [], b.rules || [])
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function mergeResolveField({ resolve: defaultResolve = {} }, { resolve: customResolve = {} }) {
|
|
184
|
+
return {
|
|
185
|
+
...defaultResolve,
|
|
186
|
+
...customResolve,
|
|
187
|
+
alias: mergeAliasField(defaultResolve, customResolve),
|
|
188
|
+
extensions: mergeExtensionsField(defaultResolve, customResolve)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function mergeOptimizationField({ optimization: defaultOptimization = {} }, { optimization: customOptimization = {} }) {
|
|
192
|
+
return { ...defaultOptimization, ...customOptimization };
|
|
193
|
+
}
|
|
194
|
+
function mergeConfigs(config, customConfig) {
|
|
195
|
+
return {
|
|
196
|
+
...customConfig,
|
|
197
|
+
...config,
|
|
198
|
+
devtool: customConfig.devtool || config.devtool,
|
|
199
|
+
plugins: mergePluginsField(config.plugins, customConfig.plugins),
|
|
200
|
+
module: mergeModuleField(
|
|
201
|
+
config.module || {},
|
|
202
|
+
customConfig.module || {}
|
|
203
|
+
),
|
|
204
|
+
resolve: mergeResolveField(config, customConfig),
|
|
205
|
+
optimization: mergeOptimizationField(config, customConfig)
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
var import_common22 = __nccwpck_require__2(253), import_ts_dedent22 = __nccwpck_require__2(980);
|
|
209
|
+
function importPipeline() {
|
|
210
|
+
let importGate = Promise.resolve();
|
|
211
|
+
return async (importFn) => {
|
|
212
|
+
await importGate;
|
|
213
|
+
let moduleExportsPromise = importFn();
|
|
214
|
+
return importGate = importGate.then(async () => {
|
|
215
|
+
await moduleExportsPromise;
|
|
216
|
+
}), moduleExportsPromise;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function adjustRegexToExcludeNodeModules(originalRegex) {
|
|
220
|
+
let originalRegexString = originalRegex.source, startsWithCaret = originalRegexString.startsWith("^"), excludeNodeModulesPattern = startsWithCaret ? "(?!.*node_modules)" : "^(?!.*node_modules)", adjustedRegexString = startsWithCaret ? `^${excludeNodeModulesPattern}${originalRegexString.substring(1)}` : excludeNodeModulesPattern + originalRegexString;
|
|
221
|
+
return new RegExp(adjustedRegexString);
|
|
222
|
+
}
|
|
223
|
+
function webpackIncludeRegexp(specifier) {
|
|
224
|
+
let { directory, files } = specifier, directoryWithoutLeadingDots = directory.replace(/^(\.+\/)+/, "/"), webpackIncludeGlob = [".", ".."].includes(directory) ? files : `${directoryWithoutLeadingDots}/${files}`, webpackIncludeRegexpWithCaret = webpackIncludeGlob.includes(
|
|
225
|
+
"node_modules"
|
|
226
|
+
) ? (0, import_common22.globToRegexp)(webpackIncludeGlob) : adjustRegexToExcludeNodeModules(
|
|
227
|
+
(0, import_common22.globToRegexp)(webpackIncludeGlob)
|
|
228
|
+
);
|
|
229
|
+
return new RegExp(
|
|
230
|
+
webpackIncludeRegexpWithCaret.source.replace(/^\^/, "")
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
function toImportFnPart(specifier) {
|
|
234
|
+
let { directory, importPathMatcher } = specifier;
|
|
235
|
+
return import_ts_dedent22.dedent`
|
|
236
|
+
async (path) => {
|
|
237
|
+
if (!${importPathMatcher}.exec(path)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const pathRemainder = path.substring(${directory.length + 1});
|
|
242
|
+
return import(
|
|
243
|
+
/* webpackChunkName: "[request]" */
|
|
244
|
+
/* webpackInclude: ${webpackIncludeRegexp(specifier)} */
|
|
245
|
+
'${directory}/' + pathRemainder
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
function toImportFn2(stories, { needPipelinedImport } = {}) {
|
|
252
|
+
let pipelinedImport = "const pipeline = (x) => x();";
|
|
253
|
+
return needPipelinedImport && (pipelinedImport = `
|
|
254
|
+
const importPipeline = ${importPipeline};
|
|
255
|
+
const pipeline = importPipeline();
|
|
256
|
+
`), import_ts_dedent22.dedent`
|
|
257
|
+
${pipelinedImport}
|
|
258
|
+
|
|
259
|
+
const importers = [
|
|
260
|
+
${stories.map(toImportFnPart).join(`,
|
|
261
|
+
`)}
|
|
262
|
+
];
|
|
263
|
+
|
|
264
|
+
export async function importFn(path) {
|
|
265
|
+
for (let i = 0; i < importers.length; i++) {
|
|
266
|
+
const moduleExports = await pipeline(() => importers[i](path));
|
|
267
|
+
if (moduleExports) {
|
|
268
|
+
return moduleExports;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
`;
|
|
273
|
+
}
|
|
274
|
+
var import_common32 = __nccwpck_require__2(253), toRequireContext = (specifier) => {
|
|
275
|
+
let { directory, files } = specifier, match = (0, import_common32.globToRegexp)(`./${files}`);
|
|
276
|
+
return {
|
|
277
|
+
path: directory,
|
|
278
|
+
recursive: files.includes("**") || files.split("/").length > 1,
|
|
279
|
+
match
|
|
280
|
+
};
|
|
281
|
+
}, toRequireContextString = (specifier) => {
|
|
282
|
+
let { path: p, recursive: r, match: m } = toRequireContext(specifier);
|
|
283
|
+
return `require.context('${p}', ${r}, ${m})`;
|
|
284
|
+
};
|
|
285
|
+
},
|
|
286
|
+
980: (__unused_webpack_module, exports2) => {
|
|
287
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
288
|
+
exports2.dedent = void 0;
|
|
289
|
+
function dedent2(templ) {
|
|
290
|
+
var values = [];
|
|
291
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
292
|
+
values[_i - 1] = arguments[_i];
|
|
293
|
+
}
|
|
294
|
+
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
295
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(
|
|
296
|
+
/\r?\n([\t ]*)$/,
|
|
297
|
+
""
|
|
298
|
+
);
|
|
299
|
+
var indentLengths = strings.reduce(function(arr, str) {
|
|
300
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
301
|
+
if (matches) {
|
|
302
|
+
return arr.concat(
|
|
303
|
+
matches.map(function(match) {
|
|
304
|
+
var _a, _b;
|
|
305
|
+
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
306
|
+
})
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
return arr;
|
|
310
|
+
}, []);
|
|
311
|
+
if (indentLengths.length) {
|
|
312
|
+
var pattern_1 = new RegExp(
|
|
313
|
+
"\n[ ]{" + Math.min.apply(Math, indentLengths) + "}",
|
|
314
|
+
"g"
|
|
315
|
+
);
|
|
316
|
+
strings = strings.map(function(str) {
|
|
317
|
+
return str.replace(pattern_1, "\n");
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
321
|
+
var string = strings[0];
|
|
322
|
+
values.forEach(function(value, i) {
|
|
323
|
+
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
324
|
+
var endentation = endentations ? endentations[1] : "";
|
|
325
|
+
var indentedValue = value;
|
|
326
|
+
if (typeof value === "string" && value.includes("\n")) {
|
|
327
|
+
indentedValue = String(value).split("\n").map(function(str, i2) {
|
|
328
|
+
return i2 === 0 ? str : "" + endentation + str;
|
|
329
|
+
}).join("\n");
|
|
330
|
+
}
|
|
331
|
+
string += indentedValue + strings[i + 1];
|
|
332
|
+
});
|
|
333
|
+
return string;
|
|
334
|
+
}
|
|
335
|
+
exports2.dedent = dedent2;
|
|
336
|
+
exports2["default"] = dedent2;
|
|
337
|
+
},
|
|
338
|
+
928: (module3) => {
|
|
339
|
+
module3.exports = require("path");
|
|
340
|
+
},
|
|
341
|
+
253: (module3) => {
|
|
342
|
+
module3.exports = require("storybook/internal/common");
|
|
343
|
+
},
|
|
344
|
+
519: (module3) => {
|
|
345
|
+
module3.exports = require("storybook/internal/node-logger");
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
var __webpack_module_cache__ = {};
|
|
349
|
+
function __nccwpck_require__(moduleId) {
|
|
350
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
351
|
+
if (cachedModule !== void 0) {
|
|
352
|
+
return cachedModule.exports;
|
|
353
|
+
}
|
|
354
|
+
var module3 = __webpack_module_cache__[moduleId] = { exports: {} };
|
|
355
|
+
var threw = true;
|
|
356
|
+
try {
|
|
357
|
+
__webpack_modules__[moduleId](
|
|
358
|
+
module3,
|
|
359
|
+
module3.exports,
|
|
360
|
+
__nccwpck_require__
|
|
361
|
+
);
|
|
362
|
+
threw = false;
|
|
363
|
+
} finally {
|
|
364
|
+
if (threw)
|
|
365
|
+
delete __webpack_module_cache__[moduleId];
|
|
366
|
+
}
|
|
367
|
+
return module3.exports;
|
|
368
|
+
}
|
|
369
|
+
if (typeof __nccwpck_require__ !== "undefined")
|
|
370
|
+
__nccwpck_require__.ab = __dirname + "/";
|
|
371
|
+
var __webpack_exports__ = __nccwpck_require__(830);
|
|
372
|
+
module2.exports = __webpack_exports__;
|
|
373
|
+
})();
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
105
377
|
// src/index.ts
|
|
106
378
|
var src_exports = {};
|
|
107
379
|
__export(src_exports, {
|
|
@@ -129,7 +401,6 @@ var import_server_errors = require("storybook/internal/server-errors");
|
|
|
129
401
|
var import_node_path2 = require("path");
|
|
130
402
|
var import_core = require("@rsbuild/core");
|
|
131
403
|
var import_plugin_type_check = require("@rsbuild/plugin-type-check");
|
|
132
|
-
var import_preset = require("@storybook/addon-docs/preset");
|
|
133
404
|
var import_case_sensitive_paths_webpack_plugin = __toESM(require("case-sensitive-paths-webpack-plugin"));
|
|
134
405
|
var import_rsbuild_plugin_html_minifier_terser = require("rsbuild-plugin-html-minifier-terser");
|
|
135
406
|
var import_common2 = require("storybook/internal/common");
|
|
@@ -138,7 +409,6 @@ var import_ts_dedent = require("ts-dedent");
|
|
|
138
409
|
|
|
139
410
|
// src/preview/virtual-module-mapping.ts
|
|
140
411
|
var import_node_path = require("path");
|
|
141
|
-
var import_core_webpack = require("@storybook/core-webpack");
|
|
142
412
|
|
|
143
413
|
// ../../node_modules/.pnpm/slash@5.1.0/node_modules/slash/index.js
|
|
144
414
|
function slash(path) {
|
|
@@ -151,6 +421,7 @@ function slash(path) {
|
|
|
151
421
|
|
|
152
422
|
// src/preview/virtual-module-mapping.ts
|
|
153
423
|
var import_common = require("storybook/internal/common");
|
|
424
|
+
var import_core_webpack = __toESM(require_core_webpack());
|
|
154
425
|
var getVirtualModules = async (options) => {
|
|
155
426
|
const virtualModules = {};
|
|
156
427
|
const builderOptions = await (0, import_common.getBuilderOptions)(options);
|
|
@@ -223,7 +494,12 @@ var storybookPaths = {
|
|
|
223
494
|
};
|
|
224
495
|
var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
|
|
225
496
|
const { rsbuildConfigPath, addonDocs } = await (0, import_common2.getBuilderOptions)(options);
|
|
226
|
-
const
|
|
497
|
+
const webpackConfigFromPresets = await options.presets.apply("webpack", {}, options);
|
|
498
|
+
if (addonDocs) {
|
|
499
|
+
console.warn(
|
|
500
|
+
"`addonDocs` option is deprecated and will be removed in future versions. Please use `@storybook/addon-docs` option instead."
|
|
501
|
+
);
|
|
502
|
+
}
|
|
227
503
|
const {
|
|
228
504
|
outputDir = (0, import_node_path2.join)(".", "public"),
|
|
229
505
|
quiet,
|
|
@@ -469,7 +745,11 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
|
|
|
469
745
|
...config.experiments,
|
|
470
746
|
...lazyCompilationConfig
|
|
471
747
|
};
|
|
472
|
-
return mergeConfig(
|
|
748
|
+
return mergeConfig(
|
|
749
|
+
config,
|
|
750
|
+
extraWebpackConfig || {},
|
|
751
|
+
webpackConfigFromPresets
|
|
752
|
+
);
|
|
473
753
|
},
|
|
474
754
|
htmlPlugin: {
|
|
475
755
|
filename: "iframe.html",
|