storybook-builder-rsbuild 1.0.1 → 2.0.0-alpha.1
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/dist/index.js +10 -17
- package/dist/index.mjs +9 -16
- package/package.json +8 -8
package/dist/index.js
CHANGED
@@ -125,7 +125,6 @@ var rsbuildReal = __toESM(require("@rsbuild/core"));
|
|
125
125
|
var import_fs_extra = __toESM(require("fs-extra"));
|
126
126
|
var import_pretty_hrtime = __toESM(require_pretty_hrtime());
|
127
127
|
var import_sirv = __toESM(require("sirv"));
|
128
|
-
var import_core_path = require("storybook/core-path");
|
129
128
|
var import_common3 = require("storybook/internal/common");
|
130
129
|
var import_server_errors = require("storybook/internal/server-errors");
|
131
130
|
|
@@ -305,19 +304,10 @@ var builtInResolveExtensions = [
|
|
305
304
|
".json",
|
306
305
|
".cjs"
|
307
306
|
];
|
308
|
-
var managerAPIPath = maybeGetAbsolutePath("@storybook/manager-api");
|
309
|
-
var componentsPath = maybeGetAbsolutePath("@storybook/components");
|
310
307
|
var globalPath = maybeGetAbsolutePath("@storybook/global");
|
311
|
-
var routerPath = maybeGetAbsolutePath("@storybook/router");
|
312
|
-
var themingPath = maybeGetAbsolutePath("@storybook/theming");
|
313
308
|
var storybookPaths = {
|
314
|
-
|
315
|
-
|
316
|
-
} : {},
|
317
|
-
...componentsPath ? { "@storybook/components": componentsPath } : {},
|
318
|
-
...globalPath ? { "@storybook/global": globalPath } : {},
|
319
|
-
...routerPath ? { "@storybook/router": routerPath } : {},
|
320
|
-
...themingPath ? { "@storybook/theming": themingPath } : {}
|
309
|
+
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
310
|
+
...globalPath ? { ["@storybook/global"]: globalPath } : {}
|
321
311
|
};
|
322
312
|
var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
|
323
313
|
const { rsbuildConfigPath, addonDocs } = await (0, import_common2.getBuilderOptions)(options);
|
@@ -602,7 +592,8 @@ var getIsReactVersion18or19 = async (options) => {
|
|
602
592
|
"resolvedReact",
|
603
593
|
{}
|
604
594
|
);
|
605
|
-
|
595
|
+
let reactDom = "";
|
596
|
+
reactDom = resolvedReact.reactDom || (0, import_node_path4.dirname)(require.resolve("react-dom/package.json"));
|
606
597
|
if (!(0, import_node_path4.isAbsolute)(reactDom)) {
|
607
598
|
return false;
|
608
599
|
}
|
@@ -626,6 +617,7 @@ var applyReactShims = async (config, options) => {
|
|
626
617
|
};
|
627
618
|
|
628
619
|
// src/index.ts
|
620
|
+
var corePath = (0, import_node_path5.dirname)(require.resolve("storybook/package.json"));
|
629
621
|
var printDuration = (startTime) => (0, import_pretty_hrtime.default)(process.hrtime(startTime)).replace(" ms", " milliseconds").replace(" s", " seconds").replace(" m", " minutes");
|
630
622
|
var executor = {
|
631
623
|
get: async (options) => {
|
@@ -650,13 +642,14 @@ var rsbuild = async (_, options) => {
|
|
650
642
|
"webpackFinal",
|
651
643
|
// TODO: using empty webpack config as base for now. It's better to using the composed rspack
|
652
644
|
// config in `iframe-rsbuild.config.ts` as base config. But when `tools.rspack` is an async function,
|
653
|
-
// the following `tools.rspack` raise an `
|
645
|
+
// the following `tools.rspack` raise an `Promises are not supported` error.
|
654
646
|
{
|
655
647
|
output: {},
|
656
648
|
module: {},
|
657
649
|
plugins: [],
|
658
650
|
resolve: {},
|
659
|
-
|
651
|
+
// https://github.com/web-infra-dev/rsbuild/blob/8dc35dc1d1500d2f119875d46b6a07e27986d532/packages/core/src/provider/rspackConfig.ts#L167
|
652
|
+
devServer: void 0,
|
660
653
|
optimization: {},
|
661
654
|
performance: {},
|
662
655
|
externals: {},
|
@@ -732,7 +725,7 @@ var start = async ({
|
|
732
725
|
error: new Error("Missing Rsbuild build instance at runtime!")
|
733
726
|
});
|
734
727
|
}
|
735
|
-
const previewResolvedDir = (0, import_node_path5.join)(
|
728
|
+
const previewResolvedDir = (0, import_node_path5.join)(corePath, "dist/preview");
|
736
729
|
const previewDirOrigin = previewResolvedDir;
|
737
730
|
router.use(
|
738
731
|
"/sb-preview",
|
@@ -755,7 +748,7 @@ var build = async ({ options }) => {
|
|
755
748
|
cwd: process.cwd(),
|
756
749
|
rsbuildConfig: config
|
757
750
|
});
|
758
|
-
const previewResolvedDir = (0, import_node_path5.join)(
|
751
|
+
const previewResolvedDir = (0, import_node_path5.join)(corePath, "dist/preview");
|
759
752
|
const previewDirOrigin = previewResolvedDir;
|
760
753
|
const previewDirTarget = (0, import_node_path5.join)(options.outputDir || "", "sb-preview");
|
761
754
|
let stats;
|
package/dist/index.mjs
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import { __commonJS, __toESM, __require } from './chunk-TTFRSOOU.mjs';
|
2
2
|
import { createServer } from 'net';
|
3
|
-
import path, { join, resolve, parse,
|
3
|
+
import path, { dirname, join, resolve, parse, isAbsolute } from 'path';
|
4
4
|
import * as rsbuildReal from '@rsbuild/core';
|
5
5
|
import { loadConfig, mergeRsbuildConfig } from '@rsbuild/core';
|
6
6
|
import fs2 from 'fs-extra';
|
7
7
|
import sirv from 'sirv';
|
8
|
-
import { corePath } from 'storybook/core-path';
|
9
8
|
import { normalizeStories, loadPreviewOrConfigFile, getBuilderOptions, readTemplate, resolveAddonName, getPresets, stringifyProcessEnvs, isPreservingSymlinks } from 'storybook/internal/common';
|
10
9
|
import { WebpackInvocationError } from 'storybook/internal/server-errors';
|
11
10
|
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
|
@@ -249,19 +248,10 @@ var builtInResolveExtensions = [
|
|
249
248
|
".json",
|
250
249
|
".cjs"
|
251
250
|
];
|
252
|
-
var managerAPIPath = maybeGetAbsolutePath("@storybook/manager-api");
|
253
|
-
var componentsPath = maybeGetAbsolutePath("@storybook/components");
|
254
251
|
var globalPath = maybeGetAbsolutePath("@storybook/global");
|
255
|
-
var routerPath = maybeGetAbsolutePath("@storybook/router");
|
256
|
-
var themingPath = maybeGetAbsolutePath("@storybook/theming");
|
257
252
|
var storybookPaths = {
|
258
|
-
|
259
|
-
|
260
|
-
} : {},
|
261
|
-
...componentsPath ? { "@storybook/components": componentsPath } : {},
|
262
|
-
...globalPath ? { "@storybook/global": globalPath } : {},
|
263
|
-
...routerPath ? { "@storybook/router": routerPath } : {},
|
264
|
-
...themingPath ? { "@storybook/theming": themingPath } : {}
|
253
|
+
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
254
|
+
...globalPath ? { ["@storybook/global"]: globalPath } : {}
|
265
255
|
};
|
266
256
|
var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
|
267
257
|
const { rsbuildConfigPath, addonDocs } = await getBuilderOptions(options);
|
@@ -544,7 +534,8 @@ var getIsReactVersion18or19 = async (options) => {
|
|
544
534
|
"resolvedReact",
|
545
535
|
{}
|
546
536
|
);
|
547
|
-
|
537
|
+
let reactDom = "";
|
538
|
+
reactDom = resolvedReact.reactDom || dirname(__require.resolve("react-dom/package.json"));
|
548
539
|
if (!isAbsolute(reactDom)) {
|
549
540
|
return false;
|
550
541
|
}
|
@@ -568,6 +559,7 @@ var applyReactShims = async (config, options) => {
|
|
568
559
|
};
|
569
560
|
|
570
561
|
// src/index.ts
|
562
|
+
var corePath = dirname(__require.resolve("storybook/package.json"));
|
571
563
|
var printDuration = (startTime) => (0, import_pretty_hrtime.default)(process.hrtime(startTime)).replace(" ms", " milliseconds").replace(" s", " seconds").replace(" m", " minutes");
|
572
564
|
var executor = {
|
573
565
|
get: async (options) => {
|
@@ -592,13 +584,14 @@ var rsbuild = async (_, options) => {
|
|
592
584
|
"webpackFinal",
|
593
585
|
// TODO: using empty webpack config as base for now. It's better to using the composed rspack
|
594
586
|
// config in `iframe-rsbuild.config.ts` as base config. But when `tools.rspack` is an async function,
|
595
|
-
// the following `tools.rspack` raise an `
|
587
|
+
// the following `tools.rspack` raise an `Promises are not supported` error.
|
596
588
|
{
|
597
589
|
output: {},
|
598
590
|
module: {},
|
599
591
|
plugins: [],
|
600
592
|
resolve: {},
|
601
|
-
|
593
|
+
// https://github.com/web-infra-dev/rsbuild/blob/8dc35dc1d1500d2f119875d46b6a07e27986d532/packages/core/src/provider/rspackConfig.ts#L167
|
594
|
+
devServer: void 0,
|
602
595
|
optimization: {},
|
603
596
|
performance: {},
|
604
597
|
externals: {},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "storybook-builder-rsbuild",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0-alpha.1",
|
4
4
|
"description": "Rsbuild builder for Storybook",
|
5
5
|
"keywords": [
|
6
6
|
"storybook",
|
@@ -58,8 +58,8 @@
|
|
58
58
|
],
|
59
59
|
"dependencies": {
|
60
60
|
"@rsbuild/plugin-type-check": "^1.2.1",
|
61
|
-
"@storybook/addon-docs": "^
|
62
|
-
"@storybook/core-webpack": "^
|
61
|
+
"@storybook/addon-docs": "^9.0.0-alpha.17",
|
62
|
+
"@storybook/core-webpack": "^9.0.0-alpha.17",
|
63
63
|
"browser-assert": "^1.2.1",
|
64
64
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
65
65
|
"cjs-module-lexer": "^1.4.3",
|
@@ -78,19 +78,19 @@
|
|
78
78
|
"util-deprecate": "^1.0.2"
|
79
79
|
},
|
80
80
|
"devDependencies": {
|
81
|
-
"@rsbuild/core": "^1.
|
81
|
+
"@rsbuild/core": "^1.2.19",
|
82
82
|
"@types/find-cache-dir": "^5.0.2",
|
83
83
|
"@types/fs-extra": "^11.0.4",
|
84
84
|
"@types/node": "^18.0.0",
|
85
85
|
"@types/pretty-hrtime": "^1.0.3",
|
86
86
|
"pretty-hrtime": "^1.0.3",
|
87
87
|
"slash": "^5.1.0",
|
88
|
-
"storybook": "
|
88
|
+
"storybook": "9.0.0-alpha.17",
|
89
89
|
"typescript": "^5.7.3"
|
90
90
|
},
|
91
91
|
"peerDependencies": {
|
92
92
|
"@rsbuild/core": "^1.0.1",
|
93
|
-
"storybook": "^
|
93
|
+
"storybook": "^9.0.0-alpha.17"
|
94
94
|
},
|
95
95
|
"peerDependenciesMeta": {
|
96
96
|
"typescript": {
|
@@ -110,7 +110,7 @@
|
|
110
110
|
},
|
111
111
|
"scripts": {
|
112
112
|
"build": "pnpm run prep --optimized",
|
113
|
-
"check": "
|
114
|
-
"prep": "
|
113
|
+
"check": "jiti ../../scripts/prepare/check.ts",
|
114
|
+
"prep": "jiti ../../scripts/prepare/bundle.ts"
|
115
115
|
}
|
116
116
|
}
|