storybook-builder-rsbuild 3.3.3 → 3.4.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/compiled/@storybook/core-webpack/index.d.ts +4 -1
- package/compiled/@storybook/core-webpack/index.js +59 -83
- package/compiled/@storybook/core-webpack/package.json +1 -1
- package/dist/_node-chunks/{chunk-LTM5Q7YC.js → chunk-NXNFA2RX.js} +6 -6
- package/dist/index.d.ts +23 -2
- package/dist/index.js +257 -119
- package/dist/loaders/export-order-loader.js +7 -7
- package/dist/loaders/rsbuild-automock-loader.js +7 -7
- package/dist/loaders/storybook-mock-transform-loader.js +7 -7
- package/dist/preview-preset.js +33 -13
- package/package.json +12 -11
- package/templates/preview.ejs +1 -1
- package/templates/virtualModuleModernEntry.js +0 -1
|
@@ -15,7 +15,10 @@ interface WebpackConfiguration {
|
|
|
15
15
|
module?: ModuleConfig;
|
|
16
16
|
resolve?: ResolveConfig;
|
|
17
17
|
optimization?: any;
|
|
18
|
-
devtool?: false | string
|
|
18
|
+
devtool?: false | string | {
|
|
19
|
+
type: 'all' | 'javascript' | 'css';
|
|
20
|
+
use: any;
|
|
21
|
+
}[];
|
|
19
22
|
}
|
|
20
23
|
type BuilderOptions = {
|
|
21
24
|
fsCache?: boolean;
|
|
@@ -1,85 +1,7 @@
|
|
|
1
1
|
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_storybook_internal_common_7991bda6__ from "storybook/internal/common";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_storybook_internal_node_logger_87de4309__ from "storybook/internal/node-logger";
|
|
4
|
-
var
|
|
5
|
-
980: (__unused_webpack_module, exports) => {
|
|
6
|
-
var __webpack_unused_export__;
|
|
7
|
-
__webpack_unused_export__ = { value: true };
|
|
8
|
-
exports.TW = void 0;
|
|
9
|
-
function dedent(templ) {
|
|
10
|
-
var values = [];
|
|
11
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
12
|
-
values[_i - 1] = arguments[_i];
|
|
13
|
-
}
|
|
14
|
-
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
15
|
-
strings[strings.length - 1] = strings[strings.length - 1].replace(
|
|
16
|
-
/\r?\n([\t ]*)$/,
|
|
17
|
-
"",
|
|
18
|
-
);
|
|
19
|
-
var indentLengths = strings.reduce(function (arr, str) {
|
|
20
|
-
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
21
|
-
if (matches) {
|
|
22
|
-
return arr.concat(
|
|
23
|
-
matches.map(function (match) {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
return (_b =
|
|
26
|
-
(_a = match.match(/[\t ]/g)) === null || _a === void 0
|
|
27
|
-
? void 0
|
|
28
|
-
: _a.length) !== null && _b !== void 0
|
|
29
|
-
? _b
|
|
30
|
-
: 0;
|
|
31
|
-
}),
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
return arr;
|
|
35
|
-
}, []);
|
|
36
|
-
if (indentLengths.length) {
|
|
37
|
-
var pattern_1 = new RegExp(
|
|
38
|
-
"\n[\t ]{" + Math.min.apply(Math, indentLengths) + "}",
|
|
39
|
-
"g",
|
|
40
|
-
);
|
|
41
|
-
strings = strings.map(function (str) {
|
|
42
|
-
return str.replace(pattern_1, "\n");
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
46
|
-
var string = strings[0];
|
|
47
|
-
values.forEach(function (value, i) {
|
|
48
|
-
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
49
|
-
var endentation = endentations ? endentations[1] : "";
|
|
50
|
-
var indentedValue = value;
|
|
51
|
-
if (typeof value === "string" && value.includes("\n")) {
|
|
52
|
-
indentedValue = String(value)
|
|
53
|
-
.split("\n")
|
|
54
|
-
.map(function (str, i) {
|
|
55
|
-
return i === 0 ? str : "" + endentation + str;
|
|
56
|
-
})
|
|
57
|
-
.join("\n");
|
|
58
|
-
}
|
|
59
|
-
string += indentedValue + strings[i + 1];
|
|
60
|
-
});
|
|
61
|
-
return string;
|
|
62
|
-
}
|
|
63
|
-
exports.TW = dedent;
|
|
64
|
-
__webpack_unused_export__ = dedent;
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
var __webpack_module_cache__ = {};
|
|
68
|
-
function __nccwpck_require__(moduleId) {
|
|
69
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
70
|
-
if (cachedModule !== undefined) {
|
|
71
|
-
return cachedModule.exports;
|
|
72
|
-
}
|
|
73
|
-
var module = (__webpack_module_cache__[moduleId] = { exports: {} });
|
|
74
|
-
var threw = true;
|
|
75
|
-
try {
|
|
76
|
-
__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
77
|
-
threw = false;
|
|
78
|
-
} finally {
|
|
79
|
-
if (threw) delete __webpack_module_cache__[moduleId];
|
|
80
|
-
}
|
|
81
|
-
return module.exports;
|
|
82
|
-
}
|
|
4
|
+
var __nccwpck_require__ = {};
|
|
83
5
|
(() => {
|
|
84
6
|
__nccwpck_require__.d = (exports, definition) => {
|
|
85
7
|
for (var key in definition) {
|
|
@@ -147,7 +69,61 @@ const node_logger_namespaceObject = node_logger_x({
|
|
|
147
69
|
["logger"]: () =>
|
|
148
70
|
__WEBPACK_EXTERNAL_MODULE_storybook_internal_node_logger_87de4309__.logger,
|
|
149
71
|
});
|
|
150
|
-
|
|
72
|
+
function dedent(templ) {
|
|
73
|
+
var values = [];
|
|
74
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
75
|
+
values[_i - 1] = arguments[_i];
|
|
76
|
+
}
|
|
77
|
+
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
78
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(
|
|
79
|
+
/\r?\n([\t ]*)$/,
|
|
80
|
+
"",
|
|
81
|
+
);
|
|
82
|
+
var indentLengths = strings.reduce(function (arr, str) {
|
|
83
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
84
|
+
if (matches) {
|
|
85
|
+
return arr.concat(
|
|
86
|
+
matches.map(function (match) {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
return (_b =
|
|
89
|
+
(_a = match.match(/[\t ]/g)) === null || _a === void 0
|
|
90
|
+
? void 0
|
|
91
|
+
: _a.length) !== null && _b !== void 0
|
|
92
|
+
? _b
|
|
93
|
+
: 0;
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return arr;
|
|
98
|
+
}, []);
|
|
99
|
+
if (indentLengths.length) {
|
|
100
|
+
var pattern_1 = new RegExp(
|
|
101
|
+
"\n[\t ]{".concat(Math.min.apply(Math, indentLengths), "}"),
|
|
102
|
+
"g",
|
|
103
|
+
);
|
|
104
|
+
strings = strings.map(function (str) {
|
|
105
|
+
return str.replace(pattern_1, "\n");
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
109
|
+
var string = strings[0];
|
|
110
|
+
values.forEach(function (value, i) {
|
|
111
|
+
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
112
|
+
var endentation = endentations ? endentations[1] : "";
|
|
113
|
+
var indentedValue = value;
|
|
114
|
+
if (typeof value === "string" && value.includes("\n")) {
|
|
115
|
+
indentedValue = String(value)
|
|
116
|
+
.split("\n")
|
|
117
|
+
.map(function (str, i) {
|
|
118
|
+
return i === 0 ? str : "".concat(endentation).concat(str);
|
|
119
|
+
})
|
|
120
|
+
.join("\n");
|
|
121
|
+
}
|
|
122
|
+
string += indentedValue + strings[i + 1];
|
|
123
|
+
});
|
|
124
|
+
return string;
|
|
125
|
+
}
|
|
126
|
+
const esm = null && dedent;
|
|
151
127
|
var dist_filename = external_node_url_namespaceObject.fileURLToPath(
|
|
152
128
|
import.meta.url,
|
|
153
129
|
);
|
|
@@ -170,7 +146,7 @@ var checkWebpackVersion = (webpack, specifier, caption) => {
|
|
|
170
146
|
return;
|
|
171
147
|
}
|
|
172
148
|
webpack.version !== specifier &&
|
|
173
|
-
node_logger_namespaceObject.logger.warn(
|
|
149
|
+
node_logger_namespaceObject.logger.warn(dedent`
|
|
174
150
|
Unexpected webpack version in ${caption}:
|
|
175
151
|
- Received '${webpack.version}'
|
|
176
152
|
- Expected '${specifier}'
|
|
@@ -268,7 +244,7 @@ function webpackIncludeRegexp(specifier) {
|
|
|
268
244
|
}
|
|
269
245
|
function toImportFnPart(specifier) {
|
|
270
246
|
let { directory, importPathMatcher } = specifier;
|
|
271
|
-
return
|
|
247
|
+
return dedent`
|
|
272
248
|
async (path) => {
|
|
273
249
|
if (!${importPathMatcher}.exec(path)) {
|
|
274
250
|
return;
|
|
@@ -289,7 +265,7 @@ function toImportFn(stories, { needPipelinedImport } = {}) {
|
|
|
289
265
|
return (
|
|
290
266
|
needPipelinedImport &&
|
|
291
267
|
(pipelinedImport = `\n const importPipeline = ${importPipeline};\n const pipeline = importPipeline();\n `),
|
|
292
|
-
|
|
268
|
+
dedent`
|
|
293
269
|
${pipelinedImport}
|
|
294
270
|
|
|
295
271
|
const importers = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@storybook/core-webpack","version":"10.
|
|
1
|
+
{"name":"@storybook/core-webpack","version":"10.5.5","funding":{"type":"opencollective","url":"https://opencollective.com/storybook"},"license":"MIT","types":"index.d.ts","type":"module"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_95ee734c542e82b6 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_95ee734c542e82b6 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_95ee734c542e82b6 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_95ee734c542e82b6.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_95ee734c542e82b6.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_95ee734c542e82b6.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as rsbuildReal from '@rsbuild/core';
|
|
2
2
|
import { DevConfig, RsbuildConfig } from '@rsbuild/core';
|
|
3
|
-
import { BuilderResult as BuilderResult$1, Builder, Options, StorybookConfigRaw, TypescriptOptions as TypescriptOptions$1 } from 'storybook/internal/types';
|
|
3
|
+
import { BuilderResult as BuilderResult$1, Builder, Options, StorybookConfigRaw, TypescriptOptions as TypescriptOptions$1, NormalizedStoriesSpecifier } from 'storybook/internal/types';
|
|
4
4
|
import { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
|
|
5
5
|
|
|
6
6
|
type RsbuildStats = {
|
|
@@ -48,6 +48,19 @@ interface BuilderResult extends BuilderResult$1 {
|
|
|
48
48
|
stats?: Stats;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Re-assert Storybook core's intent to keep `node_modules` out of the stories
|
|
53
|
+
* context. Core's `(?!.*node_modules)` guard relies on webpack's context
|
|
54
|
+
* dropping `node_modules`; Rspack's `ContextModule` enumerates it, so a
|
|
55
|
+
* dependency shipping `.stories.*` gets swept in. We append a separator-anchored
|
|
56
|
+
* `webpackExclude` to every generated `webpackInclude`, except specifiers that
|
|
57
|
+
* intentionally glob into `node_modules` (real segment or alternation branch) —
|
|
58
|
+
* matching the webpack builder, which surfaces those.
|
|
59
|
+
*
|
|
60
|
+
* TODO: remove once the upstream Rspack fix ships in a released `@rspack/core`
|
|
61
|
+
* — https://github.com/web-infra-dev/rspack/pull/14576.
|
|
62
|
+
*/
|
|
63
|
+
declare const excludeNodeModulesFromStoryContext: (importFnSource: string, stories: NormalizedStoriesSpecifier[]) => string;
|
|
51
64
|
declare const getVirtualModules: (options: Options) => Promise<{
|
|
52
65
|
virtualModules: Record<string, string>;
|
|
53
66
|
entries: string[];
|
|
@@ -64,10 +77,18 @@ declare const executor: {
|
|
|
64
77
|
};
|
|
65
78
|
declare const getConfig: RsbuildBuilder['getConfig'];
|
|
66
79
|
declare function bail(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a {@link ChangeDetectionAdapter} bound to the Rspack compiler created by `start()`.
|
|
82
|
+
*
|
|
83
|
+
* Storybook core only invokes this after `start()` has resolved, so `activeCompiler` is populated
|
|
84
|
+
* in practice. The guard is defensive: it fails loudly on an unexpected call-before-start rather
|
|
85
|
+
* than silently binding to an undefined compiler.
|
|
86
|
+
*/
|
|
87
|
+
declare const changeDetectionAdapter: NonNullable<RsbuildBuilder['changeDetectionAdapter']>;
|
|
67
88
|
declare const start: RsbuildBuilder['start'];
|
|
68
89
|
declare const build: ({ options }: BuilderStartOptions) => Promise<Stats>;
|
|
69
90
|
declare const corePresets: string[];
|
|
70
91
|
declare const previewMainTemplate: () => string;
|
|
71
92
|
|
|
72
|
-
export { bail, build, corePresets, executor, getConfig, getVirtualModules, previewMainTemplate, printDuration, start };
|
|
93
|
+
export { bail, build, changeDetectionAdapter, corePresets, excludeNodeModulesFromStoryContext, executor, getConfig, getVirtualModules, previewMainTemplate, printDuration, start };
|
|
73
94
|
export type { BuilderOptions, BuilderResult, RsbuildBuilder, RsbuildFinal, Stats, StorybookConfigRsbuild, TypescriptOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_95ee734c542e82b6 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_95ee734c542e82b6 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_95ee734c542e82b6 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_95ee734c542e82b6.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_95ee734c542e82b6.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_95ee734c542e82b6.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
__commonJS,
|
|
14
14
|
__require,
|
|
15
15
|
__toESM
|
|
16
|
-
} from "./_node-chunks/chunk-
|
|
16
|
+
} from "./_node-chunks/chunk-NXNFA2RX.js";
|
|
17
17
|
|
|
18
18
|
// ../../node_modules/.pnpm/pretty-hrtime@1.0.3/node_modules/pretty-hrtime/index.js
|
|
19
19
|
var require_pretty_hrtime = __commonJS({
|
|
@@ -41,6 +41,66 @@ import sirv from "sirv";
|
|
|
41
41
|
import { getPresets, resolveAddonName } from "storybook/internal/common";
|
|
42
42
|
import { WebpackInvocationError } from "storybook/internal/server-errors";
|
|
43
43
|
|
|
44
|
+
// src/change-detection-adapter/index.ts
|
|
45
|
+
import { normalize } from "pathe";
|
|
46
|
+
import { logger } from "storybook/internal/node-logger";
|
|
47
|
+
function createRspackChangeDetectionAdapter(compiler) {
|
|
48
|
+
return {
|
|
49
|
+
async getResolveConfig() {
|
|
50
|
+
let resolveOpts = compiler.options.resolve;
|
|
51
|
+
return {
|
|
52
|
+
projectRoot: compiler.context,
|
|
53
|
+
alias: normaliseRspackAlias(resolveOpts.alias),
|
|
54
|
+
conditions: resolveOpts.conditionNames
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
onFileChange(handler) {
|
|
58
|
+
let active = !0, seeded = !1, seenFiles = /* @__PURE__ */ new Set();
|
|
59
|
+
return compiler.hooks.afterCompile.tap(
|
|
60
|
+
"StorybookChangeDetection",
|
|
61
|
+
(compilation) => {
|
|
62
|
+
for (let filePath of compilation.fileDependencies)
|
|
63
|
+
seenFiles.add(normalize(filePath));
|
|
64
|
+
seeded = !0;
|
|
65
|
+
}
|
|
66
|
+
), compiler.hooks.watchRun.tap(
|
|
67
|
+
"StorybookChangeDetection",
|
|
68
|
+
(watchingCompiler) => {
|
|
69
|
+
if (active) {
|
|
70
|
+
for (let filePath of watchingCompiler.modifiedFiles ?? []) {
|
|
71
|
+
let path = normalize(filePath), kind = seeded && !seenFiles.has(path) ? "add" : "change";
|
|
72
|
+
seenFiles.add(path), handler({ kind, path });
|
|
73
|
+
}
|
|
74
|
+
for (let filePath of watchingCompiler.removedFiles ?? []) {
|
|
75
|
+
let path = normalize(filePath);
|
|
76
|
+
seenFiles.delete(path), handler({ kind: "unlink", path });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
), () => {
|
|
81
|
+
active = !1;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function normaliseRspackAlias(alias) {
|
|
87
|
+
if (!alias) return;
|
|
88
|
+
let record = {};
|
|
89
|
+
for (let [key, value] of Object.entries(alias))
|
|
90
|
+
if (typeof value == "string")
|
|
91
|
+
record[key] = value;
|
|
92
|
+
else if (Array.isArray(value)) {
|
|
93
|
+
let stringValues = value.filter(
|
|
94
|
+
(item) => typeof item == "string"
|
|
95
|
+
), replacement = stringValues[0];
|
|
96
|
+
if (replacement == null) continue;
|
|
97
|
+
stringValues.length > 1 && logger.debug(
|
|
98
|
+
`Change detection: Rspack alias "${key}" has ${stringValues.length} values; using only the first: "${replacement}"`
|
|
99
|
+
), record[key] = replacement;
|
|
100
|
+
}
|
|
101
|
+
return Object.keys(record).length > 0 ? record : void 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
44
104
|
// src/chromatic-stats.ts
|
|
45
105
|
import { isAbsolute, relative } from "node:path";
|
|
46
106
|
var isRecord = (val) => val != null && typeof val == "object" && Array.isArray(val) === !1, toPosixPath = (filePath) => filePath.split("\\").join("/"), toNormalizedModulePath = (modulePath) => typeof modulePath != "string" || modulePath.length === 0 ? null : isAbsolute(modulePath) ? toPosixPath(relative(process.cwd(), modulePath)) : toPosixPath(modulePath), toAbsolutePathFromIdentifier = (identifier) => {
|
|
@@ -136,28 +196,28 @@ var isRecord = (val) => val != null && typeof val == "object" && Array.isArray(v
|
|
|
136
196
|
// src/logger.ts
|
|
137
197
|
import { logger as rsbuildLogger } from "@rsbuild/core";
|
|
138
198
|
import picocolors from "picocolors";
|
|
139
|
-
import { logger } from "storybook/internal/node-logger";
|
|
199
|
+
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
140
200
|
function overrideRsbuildLogger() {
|
|
141
201
|
let logWithPrefix = (fn) => (msg) => fn(
|
|
142
202
|
`${picocolors.black(picocolors.bgBlueBright("Rsbuild"))} ${String(msg)}`
|
|
143
203
|
);
|
|
144
204
|
rsbuildLogger.override({
|
|
145
|
-
error: logWithPrefix(
|
|
146
|
-
warn: logWithPrefix(
|
|
147
|
-
info: logWithPrefix((msg) =>
|
|
148
|
-
start: logWithPrefix(
|
|
149
|
-
ready: logWithPrefix(
|
|
150
|
-
success: logWithPrefix(
|
|
151
|
-
log: logWithPrefix(
|
|
152
|
-
debug: logWithPrefix(
|
|
205
|
+
error: logWithPrefix(logger2.error),
|
|
206
|
+
warn: logWithPrefix(logger2.warn),
|
|
207
|
+
info: logWithPrefix((msg) => logger2.log(msg, { spacing: 0 })),
|
|
208
|
+
start: logWithPrefix(logger2.info),
|
|
209
|
+
ready: logWithPrefix(logger2.info),
|
|
210
|
+
success: logWithPrefix(logger2.info),
|
|
211
|
+
log: logWithPrefix(logger2.info),
|
|
212
|
+
debug: logWithPrefix(logger2.debug)
|
|
153
213
|
});
|
|
154
214
|
}
|
|
155
215
|
|
|
156
216
|
// src/preview/iframe-rsbuild.config.ts
|
|
157
217
|
import { createRequire } from "node:module";
|
|
158
|
-
import { dirname, join as join2, resolve as
|
|
218
|
+
import { dirname, join as join2, resolve as resolve3 } from "node:path";
|
|
159
219
|
import { fileURLToPath } from "node:url";
|
|
160
|
-
import { loadConfig, mergeRsbuildConfig } from "@rsbuild/core";
|
|
220
|
+
import { loadConfig, mergeRsbuildConfig, rspack } from "@rsbuild/core";
|
|
161
221
|
import { pluginTypeCheck } from "@rsbuild/plugin-type-check";
|
|
162
222
|
import CaseSensitivePathsPlugin from "case-sensitive-paths-webpack-plugin";
|
|
163
223
|
import { pluginHtmlMinifierTerser } from "rsbuild-plugin-html-minifier-terser";
|
|
@@ -167,11 +227,26 @@ import {
|
|
|
167
227
|
normalizeStories as normalizeStories2,
|
|
168
228
|
stringifyProcessEnvs
|
|
169
229
|
} from "storybook/internal/common";
|
|
230
|
+
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
170
231
|
import { globalsNameReferenceMap } from "storybook/internal/preview/globals";
|
|
171
|
-
import { dedent } from "ts-dedent";
|
|
232
|
+
import { dedent as dedent2 } from "ts-dedent";
|
|
233
|
+
|
|
234
|
+
// src/preview/detect-msw.ts
|
|
235
|
+
import { existsSync } from "node:fs";
|
|
236
|
+
import { isAbsolute as isAbsolute2, resolve } from "node:path";
|
|
237
|
+
var MSW_SW_FILE = "mockServiceWorker.js";
|
|
238
|
+
async function isMswActive(options) {
|
|
239
|
+
let staticDirs = await options.presets.apply("staticDirs", []);
|
|
240
|
+
return Array.isArray(staticDirs) ? staticDirs.some((entry) => {
|
|
241
|
+
let dir = typeof entry == "string" ? entry : entry?.from;
|
|
242
|
+
if (typeof dir != "string" || dir.length === 0) return !1;
|
|
243
|
+
let abs = isAbsolute2(dir) ? dir : resolve(options.configDir, dir);
|
|
244
|
+
return existsSync(resolve(abs, MSW_SW_FILE));
|
|
245
|
+
}) : !1;
|
|
246
|
+
}
|
|
172
247
|
|
|
173
248
|
// src/preview/virtual-module-mapping.ts
|
|
174
|
-
import { join, resolve } from "node:path";
|
|
249
|
+
import { join, resolve as resolve2 } from "node:path";
|
|
175
250
|
|
|
176
251
|
// ../../node_modules/.pnpm/slash@5.1.0/node_modules/slash/index.js
|
|
177
252
|
function slash(path) {
|
|
@@ -190,65 +265,7 @@ import {
|
|
|
190
265
|
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
|
|
191
266
|
import * as __WEBPACK_EXTERNAL_MODULE_storybook_internal_common_7991bda6__ from "storybook/internal/common";
|
|
192
267
|
import * as __WEBPACK_EXTERNAL_MODULE_storybook_internal_node_logger_87de4309__ from "storybook/internal/node-logger";
|
|
193
|
-
var
|
|
194
|
-
980: (__unused_webpack_module, exports) => {
|
|
195
|
-
var __webpack_unused_export__;
|
|
196
|
-
__webpack_unused_export__ = { value: !0 }, exports.TW = void 0;
|
|
197
|
-
function dedent2(templ) {
|
|
198
|
-
for (var values = [], _i = 1; _i < arguments.length; _i++)
|
|
199
|
-
values[_i - 1] = arguments[_i];
|
|
200
|
-
var strings = Array.from(typeof templ == "string" ? [templ] : templ);
|
|
201
|
-
strings[strings.length - 1] = strings[strings.length - 1].replace(
|
|
202
|
-
/\r?\n([\t ]*)$/,
|
|
203
|
-
""
|
|
204
|
-
);
|
|
205
|
-
var indentLengths = strings.reduce(function(arr, str) {
|
|
206
|
-
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
207
|
-
return matches ? arr.concat(
|
|
208
|
-
matches.map(function(match) {
|
|
209
|
-
var _a, _b;
|
|
210
|
-
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
211
|
-
})
|
|
212
|
-
) : arr;
|
|
213
|
-
}, []);
|
|
214
|
-
if (indentLengths.length) {
|
|
215
|
-
var pattern_1 = new RegExp(
|
|
216
|
-
`
|
|
217
|
-
[ ]{` + Math.min.apply(Math, indentLengths) + "}",
|
|
218
|
-
"g"
|
|
219
|
-
);
|
|
220
|
-
strings = strings.map(function(str) {
|
|
221
|
-
return str.replace(pattern_1, `
|
|
222
|
-
`);
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
226
|
-
var string = strings[0];
|
|
227
|
-
return values.forEach(function(value, i) {
|
|
228
|
-
var endentations = string.match(/(?:^|\n)( *)$/), endentation = endentations ? endentations[1] : "", indentedValue = value;
|
|
229
|
-
typeof value == "string" && value.includes(`
|
|
230
|
-
`) && (indentedValue = String(value).split(`
|
|
231
|
-
`).map(function(str, i2) {
|
|
232
|
-
return i2 === 0 ? str : "" + endentation + str;
|
|
233
|
-
}).join(`
|
|
234
|
-
`)), string += indentedValue + strings[i + 1];
|
|
235
|
-
}), string;
|
|
236
|
-
}
|
|
237
|
-
exports.TW = dedent2, __webpack_unused_export__ = dedent2;
|
|
238
|
-
}
|
|
239
|
-
}, __webpack_module_cache__ = {};
|
|
240
|
-
function __nccwpck_require__(moduleId) {
|
|
241
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
242
|
-
if (cachedModule !== void 0)
|
|
243
|
-
return cachedModule.exports;
|
|
244
|
-
var module = __webpack_module_cache__[moduleId] = { exports: {} }, threw = !0;
|
|
245
|
-
try {
|
|
246
|
-
__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__), threw = !1;
|
|
247
|
-
} finally {
|
|
248
|
-
threw && delete __webpack_module_cache__[moduleId];
|
|
249
|
-
}
|
|
250
|
-
return module.exports;
|
|
251
|
-
}
|
|
268
|
+
var __nccwpck_require__ = {};
|
|
252
269
|
__nccwpck_require__.d = (exports, definition) => {
|
|
253
270
|
for (var key in definition)
|
|
254
271
|
__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key) && Object.defineProperty(exports, key, {
|
|
@@ -291,7 +308,48 @@ var common_namespaceObject = x({
|
|
|
291
308
|
};
|
|
292
309
|
var node_logger_namespaceObject = node_logger_x({
|
|
293
310
|
logger: () => __WEBPACK_EXTERNAL_MODULE_storybook_internal_node_logger_87de4309__.logger
|
|
294
|
-
})
|
|
311
|
+
});
|
|
312
|
+
function dedent(templ) {
|
|
313
|
+
for (var values = [], _i = 1; _i < arguments.length; _i++)
|
|
314
|
+
values[_i - 1] = arguments[_i];
|
|
315
|
+
var strings = Array.from(typeof templ == "string" ? [templ] : templ);
|
|
316
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(
|
|
317
|
+
/\r?\n([\t ]*)$/,
|
|
318
|
+
""
|
|
319
|
+
);
|
|
320
|
+
var indentLengths = strings.reduce(function(arr, str) {
|
|
321
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
322
|
+
return matches ? arr.concat(
|
|
323
|
+
matches.map(function(match) {
|
|
324
|
+
var _a, _b;
|
|
325
|
+
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
326
|
+
})
|
|
327
|
+
) : arr;
|
|
328
|
+
}, []);
|
|
329
|
+
if (indentLengths.length) {
|
|
330
|
+
var pattern_1 = new RegExp(
|
|
331
|
+
`
|
|
332
|
+
[ ]{`.concat(Math.min.apply(Math, indentLengths), "}"),
|
|
333
|
+
"g"
|
|
334
|
+
);
|
|
335
|
+
strings = strings.map(function(str) {
|
|
336
|
+
return str.replace(pattern_1, `
|
|
337
|
+
`);
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
341
|
+
var string = strings[0];
|
|
342
|
+
return values.forEach(function(value, i) {
|
|
343
|
+
var endentations = string.match(/(?:^|\n)( *)$/), endentation = endentations ? endentations[1] : "", indentedValue = value;
|
|
344
|
+
typeof value == "string" && value.includes(`
|
|
345
|
+
`) && (indentedValue = String(value).split(`
|
|
346
|
+
`).map(function(str, i2) {
|
|
347
|
+
return i2 === 0 ? str : "".concat(endentation).concat(str);
|
|
348
|
+
}).join(`
|
|
349
|
+
`)), string += indentedValue + strings[i + 1];
|
|
350
|
+
}), string;
|
|
351
|
+
}
|
|
352
|
+
var dist_filename = external_node_url_namespaceObject.fileURLToPath(
|
|
295
353
|
import.meta.url
|
|
296
354
|
), dist_dirname = external_node_path_namespaceObject.dirname(dist_filename), dist_require = external_node_module_namespaceObject.createRequire(
|
|
297
355
|
import.meta.url
|
|
@@ -306,7 +364,7 @@ var node_logger_namespaceObject = node_logger_x({
|
|
|
306
364
|
);
|
|
307
365
|
return;
|
|
308
366
|
}
|
|
309
|
-
webpack.version !== specifier && node_logger_namespaceObject.logger.warn(
|
|
367
|
+
webpack.version !== specifier && node_logger_namespaceObject.logger.warn(dedent`
|
|
310
368
|
Unexpected webpack version in ${caption}:
|
|
311
369
|
- Received '${webpack.version}'
|
|
312
370
|
- Expected '${specifier}'
|
|
@@ -375,7 +433,7 @@ function webpackIncludeRegexp(specifier) {
|
|
|
375
433
|
}
|
|
376
434
|
function toImportFnPart(specifier) {
|
|
377
435
|
let { directory, importPathMatcher } = specifier;
|
|
378
|
-
return
|
|
436
|
+
return dedent`
|
|
379
437
|
async (path) => {
|
|
380
438
|
if (!${importPathMatcher}.exec(path)) {
|
|
381
439
|
return;
|
|
@@ -396,7 +454,7 @@ function toImportFn(stories, { needPipelinedImport } = {}) {
|
|
|
396
454
|
return needPipelinedImport && (pipelinedImport = `
|
|
397
455
|
const importPipeline = ${importPipeline};
|
|
398
456
|
const pipeline = importPipeline();
|
|
399
|
-
`),
|
|
457
|
+
`), dedent`
|
|
400
458
|
${pipelinedImport}
|
|
401
459
|
|
|
402
460
|
const importers = [
|
|
@@ -427,7 +485,26 @@ var toRequireContext = (specifier) => {
|
|
|
427
485
|
}, __webpack_exports__checkWebpackVersion = __webpack_exports__.il, __webpack_exports__loadCustomWebpackConfig = __webpack_exports__.Tu, __webpack_exports__mergeConfigs = __webpack_exports__.SV, __webpack_exports__toImportFn = __webpack_exports__.T1, __webpack_exports__toImportFnPart = __webpack_exports__.i8, __webpack_exports__toRequireContext = __webpack_exports__.sg, __webpack_exports__toRequireContextString = __webpack_exports__.HO, __webpack_exports__webpackIncludeRegexp = __webpack_exports__.hO;
|
|
428
486
|
|
|
429
487
|
// src/preview/virtual-module-mapping.ts
|
|
430
|
-
var
|
|
488
|
+
var NODE_MODULES_GLOB_TOKEN = /(?:^|[\\/(|,{])node_modules(?:$|[\\/)|,}])/, toWebpackIncludeGlob = ({
|
|
489
|
+
directory,
|
|
490
|
+
files
|
|
491
|
+
}) => [".", ".."].includes(directory) ? files : `${directory.replace(/^(\.+\/)+/, "/")}/${files}`, targetsNodeModules = (specifier) => NODE_MODULES_GLOB_TOKEN.test(toWebpackIncludeGlob(specifier)), excludeNodeModulesFromStoryContext = (importFnSource, stories) => {
|
|
492
|
+
let specifierIndex = 0;
|
|
493
|
+
return importFnSource.split(`
|
|
494
|
+
`).flatMap((line) => {
|
|
495
|
+
if (!line.includes("webpackInclude:"))
|
|
496
|
+
return [line];
|
|
497
|
+
let specifier = stories[specifierIndex++];
|
|
498
|
+
if (specifier && targetsNodeModules(specifier))
|
|
499
|
+
return [line];
|
|
500
|
+
let indent = line.slice(0, line.length - line.trimStart().length);
|
|
501
|
+
return [
|
|
502
|
+
line,
|
|
503
|
+
`${indent}/* webpackExclude: /[\\\\/]node_modules[\\\\/]/ */`
|
|
504
|
+
];
|
|
505
|
+
}).join(`
|
|
506
|
+
`);
|
|
507
|
+
}, getVirtualModules = async (options) => {
|
|
431
508
|
let virtualModules = {}, builderOptions = await getBuilderOptions(options), workingDir = process.cwd(), isProd = options.configType === "PRODUCTION", nonNormalizedStories = await options.presets.apply("stories", []), entries = [], stories = normalizeStories(nonNormalizedStories, {
|
|
432
509
|
configDir: options.configDir,
|
|
433
510
|
workingDir
|
|
@@ -438,11 +515,14 @@ var getVirtualModules = async (options) => {
|
|
|
438
515
|
options
|
|
439
516
|
)).map((entry) => typeof entry == "object" ? entry.absolute : slash(entry)),
|
|
440
517
|
loadPreviewOrConfigFile(options)
|
|
441
|
-
].filter(Boolean), storiesFilename = "storybook-stories.js", storiesPath =
|
|
442
|
-
virtualModules[storiesPath] =
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
518
|
+
].filter(Boolean), storiesFilename = "storybook-stories.js", storiesPath = resolve2(join(workingDir, storiesFilename)), needPipelinedImport = builderOptions.lazyCompilation !== !1 && !isProd;
|
|
519
|
+
virtualModules[storiesPath] = excludeNodeModulesFromStoryContext(
|
|
520
|
+
__webpack_exports__toImportFn(stories, {
|
|
521
|
+
needPipelinedImport
|
|
522
|
+
}),
|
|
523
|
+
stories
|
|
524
|
+
);
|
|
525
|
+
let configEntryPath = resolve2(join(workingDir, "storybook-config-entry.js"));
|
|
446
526
|
return virtualModules[configEntryPath] = (await readTemplate(
|
|
447
527
|
__require.resolve(
|
|
448
528
|
"storybook-builder-rsbuild/templates/virtualModuleModernEntry.js"
|
|
@@ -488,7 +568,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
488
568
|
return null;
|
|
489
569
|
let major = Number.parseInt(version.split(".")[0] ?? "", 10);
|
|
490
570
|
return Number.isNaN(major) ? null : major;
|
|
491
|
-
}, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, globalPath = maybeGetAbsolutePath("@storybook/global"), storybookPaths = {
|
|
571
|
+
}, rspackMajorVersion = getRspackMajorVersion(rspack.rspackVersion), RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, globalPath = maybeGetAbsolutePath("@storybook/global"), storybookPaths = {
|
|
492
572
|
// biome-ignore lint/complexity/useLiteralKeys: dynamic key required for conditional spread
|
|
493
573
|
...globalPath ? { "@storybook/global": globalPath } : {}
|
|
494
574
|
}, iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
|
|
@@ -518,7 +598,8 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
518
598
|
nonNormalizedStories,
|
|
519
599
|
_modulesCount,
|
|
520
600
|
build2,
|
|
521
|
-
tagsOptions
|
|
601
|
+
tagsOptions,
|
|
602
|
+
htmlLang
|
|
522
603
|
] = await Promise.all([
|
|
523
604
|
presets.apply("core"),
|
|
524
605
|
presets.apply("frameworkOptions"),
|
|
@@ -532,24 +613,30 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
532
613
|
presets.apply("stories", []),
|
|
533
614
|
options.cache?.get("modulesCount", 1e3),
|
|
534
615
|
options.presets.apply("build"),
|
|
535
|
-
presets.apply("tags", {})
|
|
616
|
+
presets.apply("tags", {}),
|
|
617
|
+
presets.apply("htmlLang", "en")
|
|
536
618
|
]), stories = normalizeStories2(nonNormalizedStories, {
|
|
537
619
|
configDir: options.configDir,
|
|
538
620
|
workingDir
|
|
539
621
|
}), shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipCompiler, tsCheckOptions = typescriptOptions.checkOptions || {}, builderOptions = await getBuilderOptions2(options), cacheConfig = builderOptions.fsCache ? !0 : void 0, shouldDisableDevFeatures = process.env.SB_RSBUILD_TEST_MINIMAL_DEV === "true", lazyCompilationConfig;
|
|
540
|
-
isProd || (shouldDisableDevFeatures ? lazyCompilationConfig = !1 : lazyCompilationConfig = builderOptions.lazyCompilation
|
|
622
|
+
isProd || (shouldDisableDevFeatures ? lazyCompilationConfig = !1 : builderOptions.lazyCompilation !== void 0 ? lazyCompilationConfig = builderOptions.lazyCompilation : await isMswActive(options) ? (lazyCompilationConfig = !1, logger4.warn(dedent2`
|
|
623
|
+
Detected mockServiceWorker.js in staticDirs. Lazy compilation has been disabled
|
|
624
|
+
automatically to avoid a Service Worker race that can leave the preview iframe
|
|
625
|
+
blank on cold story loads. Set \`lazyCompilation\` explicitly in your builder
|
|
626
|
+
options to override.
|
|
627
|
+
`)) : lazyCompilationConfig = {
|
|
541
628
|
entries: !1
|
|
542
|
-
}
|
|
629
|
+
});
|
|
543
630
|
let shouldDisableHmr = shouldDisableDevFeatures;
|
|
544
631
|
if (!template)
|
|
545
|
-
throw new Error(
|
|
632
|
+
throw new Error(dedent2`
|
|
546
633
|
Storybook's Webpack5 builder requires a template to be specified.
|
|
547
634
|
Somehow you've ended up with a falsy value for the template option.
|
|
548
635
|
|
|
549
636
|
Please file an issue at https://github.com/storybookjs/storybook with a reproduction.
|
|
550
637
|
`);
|
|
551
638
|
let externals = globalsNameReferenceMap;
|
|
552
|
-
build2?.test?.disableBlocks && (externals["@storybook/blocks"] = "__STORYBOOK_BLOCKS_EMPTY_MODULE__");
|
|
639
|
+
build2?.test?.disableBlocks && (externals["@storybook/addon-docs/blocks"] = "__STORYBOOK_BLOCKS_EMPTY_MODULE__");
|
|
553
640
|
let { virtualModules: virtualModuleMapping, entries: dynamicEntries } = await getVirtualModules(options), contentFromConfig = {}, { content } = await loadConfig({
|
|
554
641
|
cwd: workingDir,
|
|
555
642
|
path: rsbuildConfigPath
|
|
@@ -593,7 +680,28 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
593
680
|
css: !options.build?.test?.disableSourcemaps
|
|
594
681
|
},
|
|
595
682
|
distPath: {
|
|
596
|
-
root:
|
|
683
|
+
root: resolve3(process.cwd(), outputDir),
|
|
684
|
+
// Flat output, matching the official webpack5 builder. With
|
|
685
|
+
// `assetPrefix: ''` every context resolves relative URLs against
|
|
686
|
+
// itself, so nesting breaks worker chunks and CSS url(). See the
|
|
687
|
+
// "Preview Output Layout" docs section (#522).
|
|
688
|
+
//
|
|
689
|
+
// Load-bearing — these four carry the relative URLs that break:
|
|
690
|
+
js: "",
|
|
691
|
+
jsAsync: "",
|
|
692
|
+
// does not inherit `js`, must be explicit
|
|
693
|
+
css: "",
|
|
694
|
+
cssAsync: "",
|
|
695
|
+
// does not inherit `css`, must be explicit
|
|
696
|
+
// Parity with the webpack5 builder's flat layout. `filename` stacks on
|
|
697
|
+
// top of `distPath`, so image/font/media still land under the
|
|
698
|
+
// `static/media/` prefix set below.
|
|
699
|
+
svg: "",
|
|
700
|
+
font: "",
|
|
701
|
+
image: "",
|
|
702
|
+
media: "",
|
|
703
|
+
wasm: "",
|
|
704
|
+
assets: ""
|
|
597
705
|
},
|
|
598
706
|
filename: {
|
|
599
707
|
js: isProd ? "[name].[contenthash:8].iframe.bundle.js" : "[name].iframe.bundle.js",
|
|
@@ -624,14 +732,25 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
624
732
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
|
625
733
|
}
|
|
626
734
|
},
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
735
|
+
// Rsbuild v1 compatible: `performance.chunkSplit` is deprecated in Rsbuild v2, use top-level `splitChunks` instead.
|
|
736
|
+
...rspackMajorVersion === 1 ? {
|
|
737
|
+
performance: {
|
|
738
|
+
chunkSplit: {
|
|
739
|
+
strategy: "custom",
|
|
740
|
+
splitChunks: {
|
|
741
|
+
chunks: "all"
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
buildCache: cacheConfig
|
|
745
|
+
}
|
|
746
|
+
} : {
|
|
747
|
+
splitChunks: {
|
|
748
|
+
preset: "none",
|
|
749
|
+
chunks: "all"
|
|
633
750
|
},
|
|
634
|
-
|
|
751
|
+
performance: {
|
|
752
|
+
buildCache: cacheConfig
|
|
753
|
+
}
|
|
635
754
|
},
|
|
636
755
|
plugins: [
|
|
637
756
|
shouldCheckTs ? pluginTypeCheck(tsCheckOptions) : null,
|
|
@@ -648,7 +767,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
648
767
|
swc: (config) => {
|
|
649
768
|
config.env ??= {}, config.env.bugfixes = !0;
|
|
650
769
|
},
|
|
651
|
-
rspack: (config, { addRules, appendRules, rspack, mergeConfig }) => {
|
|
770
|
+
rspack: (config, { addRules, appendRules, rspack: rspack2, mergeConfig }) => {
|
|
652
771
|
if (addRules({
|
|
653
772
|
test: /\.stories\.([tj])sx?$|(stories|story)\.mdx$/,
|
|
654
773
|
exclude: /node_modules/,
|
|
@@ -665,7 +784,13 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
665
784
|
...config.resolve.extensions ?? [],
|
|
666
785
|
...builtInResolveExtensions
|
|
667
786
|
])
|
|
668
|
-
), config.
|
|
787
|
+
), config.resolve.conditionNames = [
|
|
788
|
+
...config.resolve.conditionNames ?? [],
|
|
789
|
+
"storybook",
|
|
790
|
+
"stories",
|
|
791
|
+
"test",
|
|
792
|
+
"..."
|
|
793
|
+
], config.watchOptions = {
|
|
669
794
|
ignored: /node_modules/
|
|
670
795
|
}, config.ignoreWarnings = [
|
|
671
796
|
...config.ignoreWarnings || [],
|
|
@@ -679,21 +804,21 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
679
804
|
url: require2.resolve("url"),
|
|
680
805
|
fs: !1,
|
|
681
806
|
constants: require2.resolve("constants-browserify")
|
|
682
|
-
}, config.optimization ??= {}, config.optimization.runtimeChunk = !0, config.optimization.usedExports = options.build?.test?.disableTreeShaking ? !1 : isProd, config.optimization.moduleIds = "named", config.module ??= {}, config.module.parser ??= {}, config.module.parser.javascript ??= {}, config.module.parser.javascript.exportsPresence = !1, !
|
|
807
|
+
}, config.optimization ??= {}, config.optimization.runtimeChunk = !0, config.optimization.usedExports = options.build?.test?.disableTreeShaking ? !1 : isProd, config.optimization.moduleIds = "named", config.module ??= {}, config.module.parser ??= {}, config.module.parser.javascript ??= {}, config.module.parser.javascript.exportsPresence = !1, !rspack2.experiments?.VirtualModulesPlugin)
|
|
683
808
|
throw new Error(
|
|
684
809
|
"rspack.experiments.VirtualModulesPlugin requires at least 1.5.0 version of @rsbuild/core, please upgrade or downgrade storybook-rsbuild-builder to lower version."
|
|
685
810
|
);
|
|
686
811
|
if (config.plugins ??= [], config.plugins.push(
|
|
687
812
|
...[
|
|
688
|
-
Object.keys(virtualModuleMapping).length > 0 ? new
|
|
813
|
+
Object.keys(virtualModuleMapping).length > 0 ? new rspack2.experiments.VirtualModulesPlugin(
|
|
689
814
|
virtualModuleMapping
|
|
690
815
|
) : null,
|
|
691
|
-
new
|
|
816
|
+
new rspack2.ProvidePlugin({
|
|
692
817
|
process: require2.resolve("process/browser.js")
|
|
693
818
|
}),
|
|
694
819
|
new CaseSensitivePathsPlugin()
|
|
695
820
|
].filter(Boolean)
|
|
696
|
-
),
|
|
821
|
+
), rspackMajorVersion === 1) {
|
|
697
822
|
let experiments = config.experiments ??= {};
|
|
698
823
|
experiments.outputModule = !1;
|
|
699
824
|
}
|
|
@@ -730,6 +855,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
730
855
|
TAGS_OPTIONS: tagsOptions,
|
|
731
856
|
...build2?.test?.disableBlocks ? { __STORYBOOK_BLOCKS_EMPTY_MODULE__: {} } : {}
|
|
732
857
|
},
|
|
858
|
+
htmlLang,
|
|
733
859
|
headHtmlSnippet,
|
|
734
860
|
bodyHtmlSnippet
|
|
735
861
|
}
|
|
@@ -743,7 +869,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
743
869
|
|
|
744
870
|
// src/react-shims.ts
|
|
745
871
|
import { readFile } from "node:fs/promises";
|
|
746
|
-
import { isAbsolute as
|
|
872
|
+
import { isAbsolute as isAbsolute3, join as join3 } from "node:path";
|
|
747
873
|
import { resolvePackageDir } from "storybook/internal/common";
|
|
748
874
|
var getIsReactVersion18or19 = async (options) => {
|
|
749
875
|
let { legacyRootApi } = await options.presets.apply(
|
|
@@ -755,7 +881,7 @@ var getIsReactVersion18or19 = async (options) => {
|
|
|
755
881
|
"resolvedReact",
|
|
756
882
|
{}
|
|
757
883
|
)).reactDom || resolvePackageDir("react-dom");
|
|
758
|
-
if (!
|
|
884
|
+
if (!isAbsolute3(reactDom))
|
|
759
885
|
return !1;
|
|
760
886
|
let { version } = JSON.parse(
|
|
761
887
|
await readFile(join3(reactDom, "package.json"), "utf-8")
|
|
@@ -817,11 +943,17 @@ var rsbuild = async (_, options) => {
|
|
|
817
943
|
typescriptOptions,
|
|
818
944
|
frameworkOptions
|
|
819
945
|
});
|
|
820
|
-
}, server;
|
|
946
|
+
}, server, activeCompiler;
|
|
821
947
|
async function bail() {
|
|
822
|
-
return server?.close();
|
|
948
|
+
return activeCompiler = void 0, server?.close();
|
|
823
949
|
}
|
|
824
|
-
var
|
|
950
|
+
var changeDetectionAdapter = () => {
|
|
951
|
+
if (!activeCompiler)
|
|
952
|
+
throw new Error(
|
|
953
|
+
"builder-rsbuild: changeDetectionAdapter() called before start(); the Rspack compiler is not ready yet."
|
|
954
|
+
);
|
|
955
|
+
return createRspackChangeDetectionAdapter(activeCompiler);
|
|
956
|
+
}, start = async ({
|
|
825
957
|
startTime,
|
|
826
958
|
options,
|
|
827
959
|
router,
|
|
@@ -840,9 +972,13 @@ var start = async ({
|
|
|
840
972
|
printUrls: !1
|
|
841
973
|
}
|
|
842
974
|
}
|
|
843
|
-
})
|
|
975
|
+
});
|
|
976
|
+
rsbuildBuild.onAfterCreateCompiler(({ compiler }) => {
|
|
977
|
+
activeCompiler = "compilers" in compiler ? compiler.compilers[0] : compiler;
|
|
978
|
+
});
|
|
979
|
+
let rsbuildServer = await rsbuildBuild.createDevServer(), waitFirstCompileDone = new Promise((resolve4) => {
|
|
844
980
|
rsbuildBuild.onDevCompileDone(({ stats: stats2, isFirstCompile }) => {
|
|
845
|
-
isFirstCompile &&
|
|
981
|
+
isFirstCompile && resolve4(stats2);
|
|
846
982
|
});
|
|
847
983
|
});
|
|
848
984
|
if (server = rsbuildServer, !rsbuildBuild)
|
|
@@ -879,12 +1015,12 @@ var start = async ({
|
|
|
879
1015
|
return await close(), withStatsJsonCompat(stats);
|
|
880
1016
|
}, corePresets = [join4(__dirname, "./preview-preset.js")], previewMainTemplate = () => __require.resolve("storybook-builder-rsbuild/templates/preview.ejs");
|
|
881
1017
|
function getRandomPort(host) {
|
|
882
|
-
return new Promise((
|
|
1018
|
+
return new Promise((resolve4, reject) => {
|
|
883
1019
|
let server2 = createServer();
|
|
884
1020
|
server2.unref(), server2.on("error", reject), server2.listen({ port: 0, host }, () => {
|
|
885
1021
|
let { port } = server2.address();
|
|
886
1022
|
server2.close(() => {
|
|
887
|
-
|
|
1023
|
+
resolve4(port);
|
|
888
1024
|
});
|
|
889
1025
|
});
|
|
890
1026
|
});
|
|
@@ -892,7 +1028,9 @@ function getRandomPort(host) {
|
|
|
892
1028
|
export {
|
|
893
1029
|
bail,
|
|
894
1030
|
build,
|
|
1031
|
+
changeDetectionAdapter,
|
|
895
1032
|
corePresets,
|
|
1033
|
+
excludeNodeModulesFromStoryContext,
|
|
896
1034
|
executor,
|
|
897
1035
|
getConfig,
|
|
898
1036
|
getVirtualModules,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_95ee734c542e82b6 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_95ee734c542e82b6 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_95ee734c542e82b6 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_95ee734c542e82b6.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_95ee734c542e82b6.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_95ee734c542e82b6.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-NXNFA2RX.js";
|
|
13
13
|
|
|
14
14
|
// src/loaders/export-order-loader.ts
|
|
15
15
|
import assert from "node:assert";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_95ee734c542e82b6 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_95ee734c542e82b6 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_95ee734c542e82b6 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_95ee734c542e82b6.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_95ee734c542e82b6.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_95ee734c542e82b6.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-NXNFA2RX.js";
|
|
13
13
|
|
|
14
14
|
// src/loaders/rsbuild-automock-loader.ts
|
|
15
15
|
import { babelParser, getAutomockCode } from "storybook/internal/mocking-utils";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_95ee734c542e82b6 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_95ee734c542e82b6 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_95ee734c542e82b6 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_95ee734c542e82b6.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_95ee734c542e82b6.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_95ee734c542e82b6.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-NXNFA2RX.js";
|
|
13
13
|
|
|
14
14
|
// src/loaders/storybook-mock-transform-loader.ts
|
|
15
15
|
import { rewriteSbMockImportCalls } from "storybook/internal/mocking-utils";
|
package/dist/preview-preset.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_95ee734c542e82b6 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_95ee734c542e82b6 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_95ee734c542e82b6 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_95ee734c542e82b6.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_95ee734c542e82b6.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_95ee734c542e82b6.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-NXNFA2RX.js";
|
|
13
13
|
|
|
14
14
|
// src/preview-preset.ts
|
|
15
15
|
import { createRequire } from "node:module";
|
|
@@ -19,6 +19,9 @@ import { findConfigFile } from "storybook/internal/common";
|
|
|
19
19
|
// src/plugins/rspack-inject-mocker-runtime-plugin.ts
|
|
20
20
|
import { getMockerRuntime } from "storybook/internal/mocking-utils";
|
|
21
21
|
var PLUGIN_NAME = "RspackInjectMockerRuntimePlugin", RspackInjectMockerRuntimePlugin = class {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.cachedRuntime = null;
|
|
24
|
+
}
|
|
22
25
|
getHtmlPlugin(compiler) {
|
|
23
26
|
try {
|
|
24
27
|
return compiler.options.plugins?.find((plugin) => {
|
|
@@ -42,15 +45,15 @@ var PLUGIN_NAME = "RspackInjectMockerRuntimePlugin", RspackInjectMockerRuntimePl
|
|
|
42
45
|
PLUGIN_NAME,
|
|
43
46
|
(data, cb) => {
|
|
44
47
|
try {
|
|
45
|
-
let runtimeScriptContent = getMockerRuntime(), runtimeAssetName = "mocker-runtime-injected.js", Sources = compiler.webpack?.sources;
|
|
48
|
+
let runtimeScriptContent = this.cachedRuntime ?? (this.cachedRuntime = getMockerRuntime()), runtimeAssetName = "mocker-runtime-injected.js", Sources = compiler.webpack?.sources;
|
|
46
49
|
if (!Sources?.RawSource)
|
|
47
50
|
throw new Error(
|
|
48
51
|
"rspack sources is not available on compiler.webpack"
|
|
49
52
|
);
|
|
50
|
-
compilation.emitAsset(
|
|
53
|
+
compilation.getAsset(runtimeAssetName) || (compilation.emitAsset(
|
|
51
54
|
runtimeAssetName,
|
|
52
55
|
new Sources.RawSource(runtimeScriptContent)
|
|
53
|
-
), data.assets.js.unshift(runtimeAssetName), cb(null, data);
|
|
56
|
+
), data.assets.js.unshift(runtimeAssetName)), cb(null, data);
|
|
54
57
|
} catch (error) {
|
|
55
58
|
cb(error);
|
|
56
59
|
}
|
|
@@ -79,22 +82,32 @@ function normalizePath(filePath) {
|
|
|
79
82
|
var RspackMockPlugin = class {
|
|
80
83
|
constructor(options) {
|
|
81
84
|
this.mockMap = /* @__PURE__ */ new Map();
|
|
85
|
+
this.candidateSpecifiers = /* @__PURE__ */ new Set();
|
|
82
86
|
if (!options.previewConfigPath)
|
|
83
87
|
throw new Error(`[${PLUGIN_NAME2}] \`previewConfigPath\` is required.`);
|
|
84
88
|
this.options = options;
|
|
85
89
|
}
|
|
86
90
|
apply(compiler) {
|
|
87
91
|
let logger = compiler.getInfrastructureLogger(PLUGIN_NAME2), updateMocks = () => {
|
|
92
|
+
let mTimePreviewConfig = this.getPreviewConfigMtime(compiler);
|
|
93
|
+
if (this.lastPreviewMtime !== void 0 && mTimePreviewConfig !== void 0 && mTimePreviewConfig === this.lastPreviewMtime)
|
|
94
|
+
return;
|
|
95
|
+
let resolved = this.extractAndResolveMocks(compiler);
|
|
88
96
|
this.mockMap = new Map(
|
|
89
|
-
|
|
97
|
+
resolved.flatMap((mock) => [
|
|
90
98
|
[normalizePath(mock.absolutePath), mock],
|
|
91
99
|
[normalizePath(mock.absolutePath.replace(/\.[^.]+$/, "")), mock]
|
|
92
100
|
])
|
|
93
|
-
), logger.info(`Mock map updated with ${
|
|
101
|
+
), this.candidateSpecifiers = new Set(resolved.map((mock) => mock.path)), this.lastPreviewMtime = mTimePreviewConfig, resolved.length > 0 && logger.info(`Mock map updated with ${resolved.length} mocks.`);
|
|
94
102
|
};
|
|
95
103
|
compiler.hooks.beforeRun.tap(PLUGIN_NAME2, updateMocks), compiler.hooks.watchRun.tap(PLUGIN_NAME2, updateMocks), new rspack.NormalModuleReplacementPlugin(/.*/, (resource) => {
|
|
96
104
|
try {
|
|
97
|
-
|
|
105
|
+
if (this.mockMap.size === 0)
|
|
106
|
+
return;
|
|
107
|
+
let path = resource.request, importer = resource.context, isExternal = getIsExternal(path, importer);
|
|
108
|
+
if (isExternal && !this.candidateSpecifiers.has(path))
|
|
109
|
+
return;
|
|
110
|
+
let absolutePath = isExternal ? resolveExternalModule(path, importer) : resolveWithExtensions(path, importer), normalizedAbsolutePath = normalizePath(absolutePath);
|
|
98
111
|
this.mockMap.has(normalizedAbsolutePath) && (resource.request = this.mockMap.get(
|
|
99
112
|
normalizedAbsolutePath
|
|
100
113
|
).replacementResource);
|
|
@@ -107,6 +120,13 @@ var RspackMockPlugin = class {
|
|
|
107
120
|
isAbsolute(mock.replacementResource) && mock.replacementResource.includes("__mocks__") && compilation.contextDependencies.add(dirname(mock.replacementResource));
|
|
108
121
|
});
|
|
109
122
|
}
|
|
123
|
+
getPreviewConfigMtime(compiler) {
|
|
124
|
+
try {
|
|
125
|
+
return compiler.inputFileSystem.statSync?.(this.options.previewConfigPath)?.mtime?.getTime?.();
|
|
126
|
+
} catch {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
110
130
|
extractAndResolveMocks(compiler) {
|
|
111
131
|
let { previewConfigPath, configDir } = this.options, logger = compiler.getInfrastructureLogger(PLUGIN_NAME2), mocks = extractMockCalls(
|
|
112
132
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-builder-rsbuild",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Rsbuild builder for Storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -43,42 +43,43 @@
|
|
|
43
43
|
"!src/**/*"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@rsbuild/plugin-type-check": "^1.
|
|
47
|
-
"@vitest/mocker": "3.2.
|
|
46
|
+
"@rsbuild/plugin-type-check": "^1.6.0",
|
|
47
|
+
"@vitest/mocker": "3.2.7",
|
|
48
48
|
"browser-assert": "^1.2.1",
|
|
49
49
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
50
50
|
"cjs-module-lexer": "^2.2.0",
|
|
51
51
|
"constants-browserify": "^1.0.0",
|
|
52
52
|
"es-module-lexer": "^1.7.0",
|
|
53
|
-
"fs-extra": "^11.
|
|
53
|
+
"fs-extra": "^11.4.0",
|
|
54
54
|
"magic-string": "^0.30.21",
|
|
55
55
|
"path-browserify": "^1.0.1",
|
|
56
|
+
"pathe": "^2.0.3",
|
|
56
57
|
"picocolors": "^1.1.1",
|
|
57
58
|
"process": "^0.11.10",
|
|
58
|
-
"rsbuild-plugin-html-minifier-terser": "^1.1.
|
|
59
|
+
"rsbuild-plugin-html-minifier-terser": "^1.1.5",
|
|
59
60
|
"sirv": "^2.0.4",
|
|
60
|
-
"ts-dedent": "^2.
|
|
61
|
+
"ts-dedent": "^2.3.0",
|
|
61
62
|
"url": "^0.11.4",
|
|
62
63
|
"util": "^0.12.5",
|
|
63
64
|
"util-deprecate": "^1.0.2"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
|
-
"@rsbuild/core": "^2.
|
|
67
|
-
"@storybook/core-webpack": "10.
|
|
67
|
+
"@rsbuild/core": "^2.1.9",
|
|
68
|
+
"@storybook/core-webpack": "10.5.5",
|
|
68
69
|
"@types/fs-extra": "^11.0.4",
|
|
69
70
|
"@types/node": "^22.0.0",
|
|
70
71
|
"@types/pretty-hrtime": "^1.0.3",
|
|
71
|
-
"prebundle": "^1.6.
|
|
72
|
+
"prebundle": "^1.6.5",
|
|
72
73
|
"pretty-hrtime": "^1.0.3",
|
|
73
74
|
"slash": "^5.1.0",
|
|
74
|
-
"storybook": "10.
|
|
75
|
+
"storybook": "10.5.5",
|
|
75
76
|
"typescript": "^5.9.3"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
79
|
"@rsbuild/core": "^1.5.0 || ^2.0.0-0",
|
|
79
80
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
80
81
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
81
|
-
"storybook": "^10.
|
|
82
|
+
"storybook": "^10.5.5"
|
|
82
83
|
},
|
|
83
84
|
"peerDependenciesMeta": {
|
|
84
85
|
"react": {
|
package/templates/preview.ejs
CHANGED
|
@@ -28,7 +28,6 @@ const preview = new PreviewWeb(importFn, getProjectAnnotations)
|
|
|
28
28
|
|
|
29
29
|
window.__STORYBOOK_PREVIEW__ = preview
|
|
30
30
|
window.__STORYBOOK_STORY_STORE__ = preview.storyStore
|
|
31
|
-
window.__STORYBOOK_ADDONS_CHANNEL__ = channel
|
|
32
31
|
|
|
33
32
|
if (import.meta.webpackHot) {
|
|
34
33
|
import.meta.webpackHot.addStatusHandler((status) => {
|