storybook-builder-rsbuild 3.0.0-beta.4 → 3.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_fce6c4dfb22448c4 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_fce6c4dfb22448c4.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4.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_fce6c4dfb22448c4 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_fce6c4dfb22448c4.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4.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-B3T3OBDC.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.
|
|
@@ -535,6 +564,9 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
535
564
|
}))
|
|
536
565
|
].filter(Boolean),
|
|
537
566
|
tools: {
|
|
567
|
+
swc: (config) => {
|
|
568
|
+
config.env ??= {}, config.env.bugfixes = !0;
|
|
569
|
+
},
|
|
538
570
|
rspack: (config, { addRules, rspack: rspack2, mergeConfig }) => {
|
|
539
571
|
if (addRules({
|
|
540
572
|
test: /\.stories\.([tj])sx?$|(stories|story)\.mdx$/,
|
|
@@ -542,7 +574,7 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
542
574
|
enforce: "post",
|
|
543
575
|
use: [
|
|
544
576
|
{
|
|
545
|
-
loader:
|
|
577
|
+
loader: require2.resolve(
|
|
546
578
|
"storybook-builder-rsbuild/loaders/export-order-loader"
|
|
547
579
|
)
|
|
548
580
|
}
|
|
@@ -560,12 +592,12 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
560
592
|
/export '\S+' was not found in '@storybook\/global'/
|
|
561
593
|
], config.resolve ??= {}, config.resolve.fallback ??= {
|
|
562
594
|
stream: !1,
|
|
563
|
-
path:
|
|
564
|
-
assert:
|
|
565
|
-
util:
|
|
566
|
-
url:
|
|
595
|
+
path: require2.resolve("path-browserify"),
|
|
596
|
+
assert: require2.resolve("browser-assert"),
|
|
597
|
+
util: require2.resolve("util"),
|
|
598
|
+
url: require2.resolve("url"),
|
|
567
599
|
fs: !1,
|
|
568
|
-
constants:
|
|
600
|
+
constants: require2.resolve("constants-browserify")
|
|
569
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)
|
|
570
602
|
throw new Error(
|
|
571
603
|
"rspack.experiments.VirtualModulesPlugin requires at least 1.5.0 version of @rsbuild/core, please upgrade or downgrade storybook-rsbuild-builder to lower version."
|
|
@@ -576,14 +608,11 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
576
608
|
virtualModuleMapping
|
|
577
609
|
) : null,
|
|
578
610
|
new rspack2.ProvidePlugin({
|
|
579
|
-
process:
|
|
611
|
+
process: require2.resolve("process/browser.js")
|
|
580
612
|
}),
|
|
581
613
|
new CaseSensitivePathsPlugin()
|
|
582
614
|
].filter(Boolean)
|
|
583
|
-
), 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.
|
|
584
|
-
...config.experiments,
|
|
585
|
-
...lazyCompilationConfig
|
|
586
|
-
}, 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(
|
|
587
616
|
config,
|
|
588
617
|
extraWebpackConfig || {},
|
|
589
618
|
webpackConfigFromPresets
|
|
@@ -626,18 +655,19 @@ var getAbsolutePath = (input) => dirname(__require.resolve(join2(input, "package
|
|
|
626
655
|
|
|
627
656
|
// src/react-shims.ts
|
|
628
657
|
import { readFile } from "node:fs/promises";
|
|
629
|
-
import {
|
|
658
|
+
import { isAbsolute, join as join3 } from "node:path";
|
|
659
|
+
import { resolvePackageDir } from "storybook/internal/common";
|
|
630
660
|
var getIsReactVersion18or19 = async (options) => {
|
|
631
661
|
let { legacyRootApi } = await options.presets.apply(
|
|
632
662
|
"frameworkOptions"
|
|
633
663
|
) || {};
|
|
634
664
|
if (legacyRootApi)
|
|
635
665
|
return !1;
|
|
636
|
-
let
|
|
666
|
+
let reactDom = (await options.presets.apply(
|
|
637
667
|
"resolvedReact",
|
|
638
668
|
{}
|
|
639
|
-
)
|
|
640
|
-
if (
|
|
669
|
+
)).reactDom || resolvePackageDir("react-dom");
|
|
670
|
+
if (!isAbsolute(reactDom))
|
|
641
671
|
return !1;
|
|
642
672
|
let { version } = JSON.parse(
|
|
643
673
|
await readFile(join3(reactDom, "package.json"), "utf-8")
|
|
@@ -652,7 +682,7 @@ var getIsReactVersion18or19 = async (options) => {
|
|
|
652
682
|
};
|
|
653
683
|
|
|
654
684
|
// src/index.ts
|
|
655
|
-
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 = {
|
|
656
686
|
get: async (options) => await options.presets.apply("rsbuildInstance") || rsbuildReal
|
|
657
687
|
}, isObject = (val) => val != null && typeof val == "object" && Array.isArray(val) === !1;
|
|
658
688
|
function nonNullables(value) {
|
|
@@ -710,6 +740,7 @@ var start = async ({
|
|
|
710
740
|
server: storybookServer,
|
|
711
741
|
channel
|
|
712
742
|
}) => {
|
|
743
|
+
overrideRsbuildLogger();
|
|
713
744
|
let { createRsbuild } = await executor.get(options), config = await getConfig(options), rsbuildBuild = await createRsbuild({
|
|
714
745
|
cwd: process.cwd(),
|
|
715
746
|
rsbuildConfig: {
|
|
@@ -744,6 +775,7 @@ var start = async ({
|
|
|
744
775
|
totalTime: process.hrtime(startTime)
|
|
745
776
|
};
|
|
746
777
|
}, build = async ({ options }) => {
|
|
778
|
+
overrideRsbuildLogger();
|
|
747
779
|
let { createRsbuild } = await executor.get(options), config = await getConfig(options), rsbuildBuild = await createRsbuild({
|
|
748
780
|
cwd: process.cwd(),
|
|
749
781
|
rsbuildConfig: config
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_fce6c4dfb22448c4 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_fce6c4dfb22448c4.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4.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-B3T3OBDC.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_fce6c4dfb22448c4 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_fce6c4dfb22448c4.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_fce6c4dfb22448c4.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_fce6c4dfb22448c4.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-B3T3OBDC.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-beta.
|
|
3
|
+
"version": "3.0.0-beta.6",
|
|
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": {
|