storybook-builder-rsbuild 3.3.2 → 3.3.4
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/package.json +1 -1
- package/dist/_node-chunks/{chunk-ZYJCAKXK.js → chunk-L73IVHZJ.js} +6 -6
- package/dist/index.js +67 -36
- 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 +8 -8
- package/package.json +8 -8
- package/templates/preview.ejs +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@storybook/core-webpack","version":"10.
|
|
1
|
+
{"name":"@storybook/core-webpack","version":"10.3.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_9822f21edcc46e85 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_9822f21edcc46e85 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_9822f21edcc46e85 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_9822f21edcc46e85.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_9822f21edcc46e85.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_9822f21edcc46e85.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,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_9822f21edcc46e85 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_9822f21edcc46e85 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_9822f21edcc46e85 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_9822f21edcc46e85.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_9822f21edcc46e85.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_9822f21edcc46e85.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-L73IVHZJ.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({
|
|
@@ -155,9 +155,9 @@ function overrideRsbuildLogger() {
|
|
|
155
155
|
|
|
156
156
|
// src/preview/iframe-rsbuild.config.ts
|
|
157
157
|
import { createRequire } from "node:module";
|
|
158
|
-
import { dirname, join as join2, resolve as
|
|
158
|
+
import { dirname, join as join2, resolve as resolve3 } from "node:path";
|
|
159
159
|
import { fileURLToPath } from "node:url";
|
|
160
|
-
import { loadConfig, mergeRsbuildConfig } from "@rsbuild/core";
|
|
160
|
+
import { loadConfig, mergeRsbuildConfig, rspack } from "@rsbuild/core";
|
|
161
161
|
import { pluginTypeCheck } from "@rsbuild/plugin-type-check";
|
|
162
162
|
import CaseSensitivePathsPlugin from "case-sensitive-paths-webpack-plugin";
|
|
163
163
|
import { pluginHtmlMinifierTerser } from "rsbuild-plugin-html-minifier-terser";
|
|
@@ -167,11 +167,26 @@ import {
|
|
|
167
167
|
normalizeStories as normalizeStories2,
|
|
168
168
|
stringifyProcessEnvs
|
|
169
169
|
} from "storybook/internal/common";
|
|
170
|
+
import { logger as logger3 } from "storybook/internal/node-logger";
|
|
170
171
|
import { globalsNameReferenceMap } from "storybook/internal/preview/globals";
|
|
171
172
|
import { dedent } from "ts-dedent";
|
|
172
173
|
|
|
174
|
+
// src/preview/detect-msw.ts
|
|
175
|
+
import { existsSync } from "node:fs";
|
|
176
|
+
import { isAbsolute as isAbsolute2, resolve } from "node:path";
|
|
177
|
+
var MSW_SW_FILE = "mockServiceWorker.js";
|
|
178
|
+
async function isMswActive(options) {
|
|
179
|
+
let staticDirs = await options.presets.apply("staticDirs", []);
|
|
180
|
+
return Array.isArray(staticDirs) ? staticDirs.some((entry) => {
|
|
181
|
+
let dir = typeof entry == "string" ? entry : entry?.from;
|
|
182
|
+
if (typeof dir != "string" || dir.length === 0) return !1;
|
|
183
|
+
let abs = isAbsolute2(dir) ? dir : resolve(options.configDir, dir);
|
|
184
|
+
return existsSync(resolve(abs, MSW_SW_FILE));
|
|
185
|
+
}) : !1;
|
|
186
|
+
}
|
|
187
|
+
|
|
173
188
|
// src/preview/virtual-module-mapping.ts
|
|
174
|
-
import { join, resolve } from "node:path";
|
|
189
|
+
import { join, resolve as resolve2 } from "node:path";
|
|
175
190
|
|
|
176
191
|
// ../../node_modules/.pnpm/slash@5.1.0/node_modules/slash/index.js
|
|
177
192
|
function slash(path) {
|
|
@@ -438,11 +453,11 @@ var getVirtualModules = async (options) => {
|
|
|
438
453
|
options
|
|
439
454
|
)).map((entry) => typeof entry == "object" ? entry.absolute : slash(entry)),
|
|
440
455
|
loadPreviewOrConfigFile(options)
|
|
441
|
-
].filter(Boolean), storiesFilename = "storybook-stories.js", storiesPath =
|
|
456
|
+
].filter(Boolean), storiesFilename = "storybook-stories.js", storiesPath = resolve2(join(workingDir, storiesFilename)), needPipelinedImport = builderOptions.lazyCompilation !== !1 && !isProd;
|
|
442
457
|
virtualModules[storiesPath] = __webpack_exports__toImportFn(stories, {
|
|
443
458
|
needPipelinedImport
|
|
444
459
|
});
|
|
445
|
-
let configEntryPath =
|
|
460
|
+
let configEntryPath = resolve2(join(workingDir, "storybook-config-entry.js"));
|
|
446
461
|
return virtualModules[configEntryPath] = (await readTemplate(
|
|
447
462
|
__require.resolve(
|
|
448
463
|
"storybook-builder-rsbuild/templates/virtualModuleModernEntry.js"
|
|
@@ -488,7 +503,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
488
503
|
return null;
|
|
489
504
|
let major = Number.parseInt(version.split(".")[0] ?? "", 10);
|
|
490
505
|
return Number.isNaN(major) ? null : major;
|
|
491
|
-
}, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, globalPath = maybeGetAbsolutePath("@storybook/global"), storybookPaths = {
|
|
506
|
+
}, rspackMajorVersion = getRspackMajorVersion(rspack.rspackVersion), RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, globalPath = maybeGetAbsolutePath("@storybook/global"), storybookPaths = {
|
|
492
507
|
// biome-ignore lint/complexity/useLiteralKeys: dynamic key required for conditional spread
|
|
493
508
|
...globalPath ? { "@storybook/global": globalPath } : {}
|
|
494
509
|
}, iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
|
|
@@ -537,9 +552,14 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
537
552
|
configDir: options.configDir,
|
|
538
553
|
workingDir
|
|
539
554
|
}), 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
|
|
555
|
+
isProd || (shouldDisableDevFeatures ? lazyCompilationConfig = !1 : builderOptions.lazyCompilation !== void 0 ? lazyCompilationConfig = builderOptions.lazyCompilation : await isMswActive(options) ? (lazyCompilationConfig = !1, logger3.warn(dedent`
|
|
556
|
+
Detected mockServiceWorker.js in staticDirs. Lazy compilation has been disabled
|
|
557
|
+
automatically to avoid a Service Worker race that can leave the preview iframe
|
|
558
|
+
blank on cold story loads. Set \`lazyCompilation\` explicitly in your builder
|
|
559
|
+
options to override.
|
|
560
|
+
`)) : lazyCompilationConfig = {
|
|
541
561
|
entries: !1
|
|
542
|
-
}
|
|
562
|
+
});
|
|
543
563
|
let shouldDisableHmr = shouldDisableDevFeatures;
|
|
544
564
|
if (!template)
|
|
545
565
|
throw new Error(dedent`
|
|
@@ -584,7 +604,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
584
604
|
let resourceFilename = isProd ? "static/media/[name].[contenthash:8][ext]" : "static/media/[path][name][ext]", rsbuildConfig = mergeRsbuildConfig(contentFromConfig, {
|
|
585
605
|
output: {
|
|
586
606
|
cleanDistPath: !1,
|
|
587
|
-
assetPrefix: "
|
|
607
|
+
assetPrefix: "",
|
|
588
608
|
dataUriLimit: {
|
|
589
609
|
media: 1e4
|
|
590
610
|
},
|
|
@@ -593,7 +613,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
593
613
|
css: !options.build?.test?.disableSourcemaps
|
|
594
614
|
},
|
|
595
615
|
distPath: {
|
|
596
|
-
root:
|
|
616
|
+
root: resolve3(process.cwd(), outputDir)
|
|
597
617
|
},
|
|
598
618
|
filename: {
|
|
599
619
|
js: isProd ? "[name].[contenthash:8].iframe.bundle.js" : "[name].iframe.bundle.js",
|
|
@@ -609,7 +629,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
609
629
|
publicDir: !1
|
|
610
630
|
},
|
|
611
631
|
dev: {
|
|
612
|
-
assetPrefix: "
|
|
632
|
+
assetPrefix: "",
|
|
613
633
|
progressBar: !quiet,
|
|
614
634
|
hmr: shouldDisableHmr ? !1 : void 0
|
|
615
635
|
},
|
|
@@ -624,14 +644,25 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
624
644
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
|
625
645
|
}
|
|
626
646
|
},
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
647
|
+
// Rsbuild v1 compatible: `performance.chunkSplit` is deprecated in Rsbuild v2, use top-level `splitChunks` instead.
|
|
648
|
+
...rspackMajorVersion === 1 ? {
|
|
649
|
+
performance: {
|
|
650
|
+
chunkSplit: {
|
|
651
|
+
strategy: "custom",
|
|
652
|
+
splitChunks: {
|
|
653
|
+
chunks: "all"
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
buildCache: cacheConfig
|
|
657
|
+
}
|
|
658
|
+
} : {
|
|
659
|
+
splitChunks: {
|
|
660
|
+
preset: "none",
|
|
661
|
+
chunks: "all"
|
|
633
662
|
},
|
|
634
|
-
|
|
663
|
+
performance: {
|
|
664
|
+
buildCache: cacheConfig
|
|
665
|
+
}
|
|
635
666
|
},
|
|
636
667
|
plugins: [
|
|
637
668
|
shouldCheckTs ? pluginTypeCheck(tsCheckOptions) : null,
|
|
@@ -648,7 +679,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
648
679
|
swc: (config) => {
|
|
649
680
|
config.env ??= {}, config.env.bugfixes = !0;
|
|
650
681
|
},
|
|
651
|
-
rspack: (config, { addRules, appendRules, rspack, mergeConfig }) => {
|
|
682
|
+
rspack: (config, { addRules, appendRules, rspack: rspack2, mergeConfig }) => {
|
|
652
683
|
if (addRules({
|
|
653
684
|
test: /\.stories\.([tj])sx?$|(stories|story)\.mdx$/,
|
|
654
685
|
exclude: /node_modules/,
|
|
@@ -679,21 +710,21 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
679
710
|
url: require2.resolve("url"),
|
|
680
711
|
fs: !1,
|
|
681
712
|
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, !
|
|
713
|
+
}, 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
714
|
throw new Error(
|
|
684
715
|
"rspack.experiments.VirtualModulesPlugin requires at least 1.5.0 version of @rsbuild/core, please upgrade or downgrade storybook-rsbuild-builder to lower version."
|
|
685
716
|
);
|
|
686
717
|
if (config.plugins ??= [], config.plugins.push(
|
|
687
718
|
...[
|
|
688
|
-
Object.keys(virtualModuleMapping).length > 0 ? new
|
|
719
|
+
Object.keys(virtualModuleMapping).length > 0 ? new rspack2.experiments.VirtualModulesPlugin(
|
|
689
720
|
virtualModuleMapping
|
|
690
721
|
) : null,
|
|
691
|
-
new
|
|
722
|
+
new rspack2.ProvidePlugin({
|
|
692
723
|
process: require2.resolve("process/browser.js")
|
|
693
724
|
}),
|
|
694
725
|
new CaseSensitivePathsPlugin()
|
|
695
726
|
].filter(Boolean)
|
|
696
|
-
),
|
|
727
|
+
), rspackMajorVersion === 1) {
|
|
697
728
|
let experiments = config.experiments ??= {};
|
|
698
729
|
experiments.outputModule = !1;
|
|
699
730
|
}
|
|
@@ -743,7 +774,7 @@ var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
|
743
774
|
|
|
744
775
|
// src/react-shims.ts
|
|
745
776
|
import { readFile } from "node:fs/promises";
|
|
746
|
-
import { isAbsolute as
|
|
777
|
+
import { isAbsolute as isAbsolute3, join as join3 } from "node:path";
|
|
747
778
|
import { resolvePackageDir } from "storybook/internal/common";
|
|
748
779
|
var getIsReactVersion18or19 = async (options) => {
|
|
749
780
|
let { legacyRootApi } = await options.presets.apply(
|
|
@@ -755,7 +786,7 @@ var getIsReactVersion18or19 = async (options) => {
|
|
|
755
786
|
"resolvedReact",
|
|
756
787
|
{}
|
|
757
788
|
)).reactDom || resolvePackageDir("react-dom");
|
|
758
|
-
if (!
|
|
789
|
+
if (!isAbsolute3(reactDom))
|
|
759
790
|
return !1;
|
|
760
791
|
let { version } = JSON.parse(
|
|
761
792
|
await readFile(join3(reactDom, "package.json"), "utf-8")
|
|
@@ -840,9 +871,9 @@ var start = async ({
|
|
|
840
871
|
printUrls: !1
|
|
841
872
|
}
|
|
842
873
|
}
|
|
843
|
-
}), rsbuildServer = await rsbuildBuild.createDevServer(), waitFirstCompileDone = new Promise((
|
|
874
|
+
}), rsbuildServer = await rsbuildBuild.createDevServer(), waitFirstCompileDone = new Promise((resolve4) => {
|
|
844
875
|
rsbuildBuild.onDevCompileDone(({ stats: stats2, isFirstCompile }) => {
|
|
845
|
-
isFirstCompile &&
|
|
876
|
+
isFirstCompile && resolve4(stats2);
|
|
846
877
|
});
|
|
847
878
|
});
|
|
848
879
|
if (server = rsbuildServer, !rsbuildBuild)
|
|
@@ -879,12 +910,12 @@ var start = async ({
|
|
|
879
910
|
return await close(), withStatsJsonCompat(stats);
|
|
880
911
|
}, corePresets = [join4(__dirname, "./preview-preset.js")], previewMainTemplate = () => __require.resolve("storybook-builder-rsbuild/templates/preview.ejs");
|
|
881
912
|
function getRandomPort(host) {
|
|
882
|
-
return new Promise((
|
|
913
|
+
return new Promise((resolve4, reject) => {
|
|
883
914
|
let server2 = createServer();
|
|
884
915
|
server2.unref(), server2.on("error", reject), server2.listen({ port: 0, host }, () => {
|
|
885
916
|
let { port } = server2.address();
|
|
886
917
|
server2.close(() => {
|
|
887
|
-
|
|
918
|
+
resolve4(port);
|
|
888
919
|
});
|
|
889
920
|
});
|
|
890
921
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_9822f21edcc46e85 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_9822f21edcc46e85 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_9822f21edcc46e85 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_9822f21edcc46e85.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_9822f21edcc46e85.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_9822f21edcc46e85.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-L73IVHZJ.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_9822f21edcc46e85 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_9822f21edcc46e85 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_9822f21edcc46e85 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_9822f21edcc46e85.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_9822f21edcc46e85.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_9822f21edcc46e85.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-L73IVHZJ.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_9822f21edcc46e85 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_9822f21edcc46e85 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_9822f21edcc46e85 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_9822f21edcc46e85.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_9822f21edcc46e85.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_9822f21edcc46e85.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-L73IVHZJ.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_9822f21edcc46e85 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_9822f21edcc46e85 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_9822f21edcc46e85 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_9822f21edcc46e85.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_9822f21edcc46e85.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_9822f21edcc46e85.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-L73IVHZJ.js";
|
|
13
13
|
|
|
14
14
|
// src/preview-preset.ts
|
|
15
15
|
import { createRequire } from "node:module";
|
|
@@ -42,7 +42,7 @@ var PLUGIN_NAME = "RspackInjectMockerRuntimePlugin", RspackInjectMockerRuntimePl
|
|
|
42
42
|
PLUGIN_NAME,
|
|
43
43
|
(data, cb) => {
|
|
44
44
|
try {
|
|
45
|
-
let runtimeScriptContent = getMockerRuntime(), runtimeAssetName = "
|
|
45
|
+
let runtimeScriptContent = getMockerRuntime(), runtimeAssetName = "mocker-runtime-injected.js", Sources = compiler.webpack?.sources;
|
|
46
46
|
if (!Sources?.RawSource)
|
|
47
47
|
throw new Error(
|
|
48
48
|
"rspack sources is not available on compiler.webpack"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-builder-rsbuild",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"description": "Rsbuild builder for Storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"!src/**/*"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@rsbuild/plugin-type-check": "^1.3.
|
|
46
|
+
"@rsbuild/plugin-type-check": "^1.3.4",
|
|
47
47
|
"@vitest/mocker": "3.2.4",
|
|
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.3.
|
|
53
|
+
"fs-extra": "^11.3.5",
|
|
54
54
|
"magic-string": "^0.30.21",
|
|
55
55
|
"path-browserify": "^1.0.1",
|
|
56
56
|
"picocolors": "^1.1.1",
|
|
@@ -63,22 +63,22 @@
|
|
|
63
63
|
"util-deprecate": "^1.0.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@rsbuild/core": "^2.0.
|
|
67
|
-
"@storybook/core-webpack": "10.
|
|
66
|
+
"@rsbuild/core": "^2.0.5",
|
|
67
|
+
"@storybook/core-webpack": "10.3.5",
|
|
68
68
|
"@types/fs-extra": "^11.0.4",
|
|
69
69
|
"@types/node": "^22.0.0",
|
|
70
70
|
"@types/pretty-hrtime": "^1.0.3",
|
|
71
|
-
"prebundle": "^1.6.
|
|
71
|
+
"prebundle": "^1.6.4",
|
|
72
72
|
"pretty-hrtime": "^1.0.3",
|
|
73
73
|
"slash": "^5.1.0",
|
|
74
|
-
"storybook": "10.
|
|
74
|
+
"storybook": "10.3.5",
|
|
75
75
|
"typescript": "^5.9.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@rsbuild/core": "^1.5.0 || ^2.0.0-0",
|
|
79
79
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
80
80
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
81
|
-
"storybook": "^10.
|
|
81
|
+
"storybook": "^10.3.5"
|
|
82
82
|
},
|
|
83
83
|
"peerDependenciesMeta": {
|
|
84
84
|
"react": {
|
package/templates/preview.ejs
CHANGED
|
@@ -73,8 +73,9 @@
|
|
|
73
73
|
<% } %>
|
|
74
74
|
<script type="module">
|
|
75
75
|
import './sb-preview/runtime.js';
|
|
76
|
+
<%/* Diverges from webpack5 template: preserve absolute/root-relative URLs for CDN deployment (storybookjs/storybook#23481) */%>
|
|
76
77
|
<% htmlWebpackPlugin.files.js.forEach(file => { %>
|
|
77
|
-
import '<%= file %>';
|
|
78
|
+
import '<%= /^(https?:)?\//.test(file) ? file : "./" + file %>';
|
|
78
79
|
<% }); %>
|
|
79
80
|
</script>
|
|
80
81
|
</body>
|