storybook-builder-rsbuild 3.0.0-beta.5 → 3.0.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.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_8698d093820fd910 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_8698d093820fd910 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_8698d093820fd910 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_8698d093820fd910.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_8698d093820fd910.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_8698d093820fd910.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_8698d093820fd910 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_8698d093820fd910 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_8698d093820fd910 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_8698d093820fd910.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_8698d093820fd910.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_8698d093820fd910.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-EUKC5ATQ.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({
|
|
@@ -34,15 +34,35 @@ var require_pretty_hrtime = __commonJS({
|
|
|
34
34
|
// src/index.ts
|
|
35
35
|
var import_pretty_hrtime = __toESM(require_pretty_hrtime(), 1);
|
|
36
36
|
import { createServer } from "node:net";
|
|
37
|
-
import { dirname as
|
|
37
|
+
import { dirname as dirname2, join as join4, parse } from "node:path";
|
|
38
38
|
import * as rsbuildReal from "@rsbuild/core";
|
|
39
39
|
import fs from "fs-extra";
|
|
40
40
|
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/logger.ts
|
|
45
|
+
import { logger as rsbuildLogger } from "@rsbuild/core";
|
|
46
|
+
import picocolors from "picocolors";
|
|
47
|
+
import { logger } from "storybook/internal/node-logger";
|
|
48
|
+
function overrideRsbuildLogger() {
|
|
49
|
+
let logWithPrefix = (fn) => (msg) => fn(`${picocolors.bgCyanBright(" Rsbuild ")} ${String(msg)}`);
|
|
50
|
+
rsbuildLogger.override({
|
|
51
|
+
error: logWithPrefix(logger.error),
|
|
52
|
+
warn: logWithPrefix(logger.warn),
|
|
53
|
+
info: logWithPrefix(logger.info),
|
|
54
|
+
success: logWithPrefix(logger.info),
|
|
55
|
+
debug: logWithPrefix(logger.info),
|
|
56
|
+
log: logWithPrefix(logger.info),
|
|
57
|
+
ready: logWithPrefix(logger.info),
|
|
58
|
+
start: logWithPrefix(logger.info)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
44
62
|
// src/preview/iframe-rsbuild.config.ts
|
|
63
|
+
import { createRequire } from "node:module";
|
|
45
64
|
import { dirname, join as join2, resolve as resolve2 } from "node:path";
|
|
65
|
+
import { fileURLToPath } from "node:url";
|
|
46
66
|
import { loadConfig, mergeRsbuildConfig } from "@rsbuild/core";
|
|
47
67
|
import { pluginTypeCheck } from "@rsbuild/plugin-type-check";
|
|
48
68
|
import CaseSensitivePathsPlugin from "case-sensitive-paths-webpack-plugin";
|
|
@@ -364,7 +384,16 @@ var getVirtualModules = async (options) => {
|
|
|
364
384
|
};
|
|
365
385
|
|
|
366
386
|
// src/preview/iframe-rsbuild.config.ts
|
|
367
|
-
var
|
|
387
|
+
var require2 = createRequire(import.meta.url), getAbsolutePath = (input) => {
|
|
388
|
+
let storybookPath = fileURLToPath(
|
|
389
|
+
import.meta.resolve("storybook/package.json")
|
|
390
|
+
);
|
|
391
|
+
return dirname(
|
|
392
|
+
require2.resolve(join2(input, "package.json"), {
|
|
393
|
+
paths: [dirname(storybookPath)]
|
|
394
|
+
})
|
|
395
|
+
);
|
|
396
|
+
}, maybeGetAbsolutePath = (input) => {
|
|
368
397
|
try {
|
|
369
398
|
return getAbsolutePath(input);
|
|
370
399
|
} catch {
|
|
@@ -427,8 +456,8 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
427
456
|
configDir: options.configDir,
|
|
428
457
|
workingDir
|
|
429
458
|
}), shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipCompiler, tsCheckOptions = typescriptOptions.checkOptions || {}, builderOptions = await getBuilderOptions2(options), cacheConfig = builderOptions.fsCache ? !0 : void 0, lazyCompilationConfig = builderOptions.lazyCompilation && !isProd ? {
|
|
430
|
-
|
|
431
|
-
} :
|
|
459
|
+
entries: !1
|
|
460
|
+
} : void 0;
|
|
432
461
|
if (!template)
|
|
433
462
|
throw new Error(dedent`
|
|
434
463
|
Storybook's Webpack5 builder requires a template to be specified.
|
|
@@ -545,7 +574,7 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
545
574
|
enforce: "post",
|
|
546
575
|
use: [
|
|
547
576
|
{
|
|
548
|
-
loader:
|
|
577
|
+
loader: require2.resolve(
|
|
549
578
|
"storybook-builder-rsbuild/loaders/export-order-loader"
|
|
550
579
|
)
|
|
551
580
|
}
|
|
@@ -563,12 +592,12 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
563
592
|
/export '\S+' was not found in '@storybook\/global'/
|
|
564
593
|
], config.resolve ??= {}, config.resolve.fallback ??= {
|
|
565
594
|
stream: !1,
|
|
566
|
-
path:
|
|
567
|
-
assert:
|
|
568
|
-
util:
|
|
569
|
-
url:
|
|
595
|
+
path: require2.resolve("path-browserify"),
|
|
596
|
+
assert: require2.resolve("browser-assert"),
|
|
597
|
+
util: require2.resolve("util"),
|
|
598
|
+
url: require2.resolve("url"),
|
|
570
599
|
fs: !1,
|
|
571
|
-
constants:
|
|
600
|
+
constants: require2.resolve("constants-browserify")
|
|
572
601
|
}, 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)
|
|
573
602
|
throw new Error(
|
|
574
603
|
"rspack.experiments.VirtualModulesPlugin requires at least 1.5.0 version of @rsbuild/core, please upgrade or downgrade storybook-rsbuild-builder to lower version."
|
|
@@ -579,14 +608,11 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
579
608
|
virtualModuleMapping
|
|
580
609
|
) : null,
|
|
581
610
|
new rspack2.ProvidePlugin({
|
|
582
|
-
process:
|
|
611
|
+
process: require2.resolve("process/browser.js")
|
|
583
612
|
}),
|
|
584
613
|
new CaseSensitivePathsPlugin()
|
|
585
614
|
].filter(Boolean)
|
|
586
|
-
), config.experiments ??= {}, config.experiments.outputModule = !1, config.externalsType = "var", config.output ??= {}, config.output.module = !1, config.output.chunkFormat = "array-push", config.output.chunkLoading = "jsonp", config.
|
|
587
|
-
...config.experiments,
|
|
588
|
-
...lazyCompilationConfig
|
|
589
|
-
}, mergeConfig(
|
|
615
|
+
), config.experiments ??= {}, config.experiments.outputModule = !1, config.externalsType = "var", config.output ??= {}, config.output.module = !1, config.output.chunkFormat = "array-push", config.output.chunkLoading = "jsonp", lazyCompilationConfig !== void 0 && (config.lazyCompilation = lazyCompilationConfig), mergeConfig(
|
|
590
616
|
config,
|
|
591
617
|
extraWebpackConfig || {},
|
|
592
618
|
webpackConfigFromPresets
|
|
@@ -629,18 +655,19 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
629
655
|
|
|
630
656
|
// src/react-shims.ts
|
|
631
657
|
import { readFile } from "node:fs/promises";
|
|
632
|
-
import {
|
|
658
|
+
import { isAbsolute, join as join3 } from "node:path";
|
|
659
|
+
import { resolvePackageDir } from "storybook/internal/common";
|
|
633
660
|
var getIsReactVersion18or19 = async (options) => {
|
|
634
661
|
let { legacyRootApi } = await options.presets.apply(
|
|
635
662
|
"frameworkOptions"
|
|
636
663
|
) || {};
|
|
637
664
|
if (legacyRootApi)
|
|
638
665
|
return !1;
|
|
639
|
-
let
|
|
666
|
+
let reactDom = (await options.presets.apply(
|
|
640
667
|
"resolvedReact",
|
|
641
668
|
{}
|
|
642
|
-
)
|
|
643
|
-
if (
|
|
669
|
+
)).reactDom || resolvePackageDir("react-dom");
|
|
670
|
+
if (!isAbsolute(reactDom))
|
|
644
671
|
return !1;
|
|
645
672
|
let { version } = JSON.parse(
|
|
646
673
|
await readFile(join3(reactDom, "package.json"), "utf-8")
|
|
@@ -655,7 +682,7 @@ var getIsReactVersion18or19 = async (options) => {
|
|
|
655
682
|
};
|
|
656
683
|
|
|
657
684
|
// src/index.ts
|
|
658
|
-
var corePath =
|
|
685
|
+
var corePath = dirname2(__require.resolve("storybook/package.json")), printDuration = (startTime) => (0, import_pretty_hrtime.default)(process.hrtime(startTime)).replace(" ms", " milliseconds").replace(" s", " seconds").replace(" m", " minutes"), executor = {
|
|
659
686
|
get: async (options) => await options.presets.apply("rsbuildInstance") || rsbuildReal
|
|
660
687
|
}, isObject = (val) => val != null && typeof val == "object" && Array.isArray(val) === !1;
|
|
661
688
|
function nonNullables(value) {
|
|
@@ -713,6 +740,7 @@ var start = async ({
|
|
|
713
740
|
server: storybookServer,
|
|
714
741
|
channel
|
|
715
742
|
}) => {
|
|
743
|
+
overrideRsbuildLogger();
|
|
716
744
|
let { createRsbuild } = await executor.get(options), config = await getConfig(options), rsbuildBuild = await createRsbuild({
|
|
717
745
|
cwd: process.cwd(),
|
|
718
746
|
rsbuildConfig: {
|
|
@@ -747,6 +775,7 @@ var start = async ({
|
|
|
747
775
|
totalTime: process.hrtime(startTime)
|
|
748
776
|
};
|
|
749
777
|
}, build = async ({ options }) => {
|
|
778
|
+
overrideRsbuildLogger();
|
|
750
779
|
let { createRsbuild } = await executor.get(options), config = await getConfig(options), rsbuildBuild = await createRsbuild({
|
|
751
780
|
cwd: process.cwd(),
|
|
752
781
|
rsbuildConfig: config
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_8698d093820fd910 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_8698d093820fd910 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_8698d093820fd910 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_8698d093820fd910.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_8698d093820fd910.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_8698d093820fd910.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-EUKC5ATQ.js";
|
|
13
13
|
|
|
14
14
|
// src/loaders/export-order-loader.ts
|
|
15
15
|
import assert from "node:assert";
|
package/dist/preview-preset.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_8698d093820fd910 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_8698d093820fd910 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_8698d093820fd910 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_8698d093820fd910.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_8698d093820fd910.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_8698d093820fd910.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
__require
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-EUKC5ATQ.js";
|
|
15
15
|
|
|
16
16
|
// src/preview-preset.ts
|
|
17
17
|
var previewMainTemplate = () => __require.resolve("storybook-builder-rsbuild/templates/preview.ejs");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-builder-rsbuild",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Rsbuild builder for Storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -31,9 +31,6 @@
|
|
|
31
31
|
"./templates/virtualModuleModernEntry.js": "./templates/virtualModuleModernEntry.js",
|
|
32
32
|
"./templates/virtualModuleStory.template.js": "./templates/virtualModuleStory.template.js"
|
|
33
33
|
},
|
|
34
|
-
"main": "dist/index.js",
|
|
35
|
-
"module": "dist/index.mjs",
|
|
36
|
-
"types": "dist/index.d.ts",
|
|
37
34
|
"files": [
|
|
38
35
|
"dist/**/*",
|
|
39
36
|
"compiled/**/*",
|
|
@@ -53,6 +50,7 @@
|
|
|
53
50
|
"fs-extra": "^11.3.2",
|
|
54
51
|
"magic-string": "^0.30.21",
|
|
55
52
|
"path-browserify": "^1.0.1",
|
|
53
|
+
"picocolors": "^1.1.0",
|
|
56
54
|
"process": "^0.11.10",
|
|
57
55
|
"rsbuild-plugin-html-minifier-terser": "^1.1.2",
|
|
58
56
|
"sirv": "^2.0.4",
|
|
@@ -62,7 +60,7 @@
|
|
|
62
60
|
"util-deprecate": "^1.0.2"
|
|
63
61
|
},
|
|
64
62
|
"devDependencies": {
|
|
65
|
-
"@rsbuild/core": "^1.
|
|
63
|
+
"@rsbuild/core": "^1.6.7",
|
|
66
64
|
"@storybook/core-webpack": "^10.0.0",
|
|
67
65
|
"@types/find-cache-dir": "^5.0.2",
|
|
68
66
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -72,7 +70,7 @@
|
|
|
72
70
|
"prebundle": "^1.6.0",
|
|
73
71
|
"pretty-hrtime": "^1.0.3",
|
|
74
72
|
"slash": "^5.1.0",
|
|
75
|
-
"storybook": "10.0.
|
|
73
|
+
"storybook": "10.0.8",
|
|
76
74
|
"typescript": "^5.9.3"
|
|
77
75
|
},
|
|
78
76
|
"peerDependencies": {
|