@modern-js/storybook-builder 2.54.6 → 2.56.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/dist/cjs/core.js +7 -5
- package/dist/cjs/docgen/index.js +5 -6
- package/dist/cjs/plugin-storybook.js +2 -2
- package/dist/esm/core.js +6 -5
- package/dist/esm/docgen/index.js +1 -2
- package/dist/esm/plugin-storybook.js +5 -3
- package/dist/types/docgen/index.d.ts +3 -3
- package/dist/types/plugin-storybook.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +9 -10
package/dist/cjs/core.js
CHANGED
@@ -27,6 +27,7 @@ var import_core2 = require("@modern-js/core");
|
|
27
27
|
var import_utils = require("./utils");
|
28
28
|
var import_plugin_storybook = require("./plugin-storybook");
|
29
29
|
async function createBuilder(cwd, builderOptions, options) {
|
30
|
+
var _uniBuilderConfig;
|
30
31
|
const { bundler } = builderOptions;
|
31
32
|
const { presets } = options;
|
32
33
|
const entries = await presets.apply("entries", []);
|
@@ -34,16 +35,17 @@ async function createBuilder(cwd, builderOptions, options) {
|
|
34
35
|
const loadedConfig = res ? res.config : {};
|
35
36
|
const finalConfig = await presets.apply("modern", loadedConfig) || loadedConfig;
|
36
37
|
const uniBuilderConfig = builderOptions.builderConfig ? (0, import_core.mergeRsbuildConfig)(finalConfig, builderOptions.builderConfig) : finalConfig || {};
|
38
|
+
var _source;
|
39
|
+
(_source = (_uniBuilderConfig = uniBuilderConfig).source) !== null && _source !== void 0 ? _source : _uniBuilderConfig.source = {};
|
40
|
+
uniBuilderConfig.source.entry = {
|
41
|
+
main: entries
|
42
|
+
};
|
37
43
|
const bundlerType = bundler || "webpack";
|
38
44
|
const builder = await (0, import_uni_builder.createUniBuilder)({
|
39
45
|
bundlerType,
|
40
46
|
cwd,
|
41
|
-
target: "web",
|
42
47
|
frameworkConfigPath: (res === null || res === void 0 ? void 0 : res.path) ? res.path : void 0,
|
43
|
-
config: bundlerType === "webpack" ? await (0, import_plugin_storybook.addonBabelAdapter)(uniBuilderConfig, options) : uniBuilderConfig
|
44
|
-
entry: {
|
45
|
-
main: entries
|
46
|
-
}
|
48
|
+
config: bundlerType === "webpack" ? await (0, import_plugin_storybook.addonBabelAdapter)(uniBuilderConfig, options) : uniBuilderConfig
|
47
49
|
});
|
48
50
|
builder.addPlugins([
|
49
51
|
(0, import_plugin_storybook.pluginStorybook)(cwd, options),
|
package/dist/cjs/docgen/index.js
CHANGED
@@ -33,8 +33,7 @@ __export(docgen_exports, {
|
|
33
33
|
});
|
34
34
|
module.exports = __toCommonJS(docgen_exports);
|
35
35
|
var import_utils = require("@modern-js/utils");
|
36
|
-
|
37
|
-
async function applyDocgenWebpack(chain, options) {
|
36
|
+
async function applyDocgenWebpack(chain, CHAIN_ID, options) {
|
38
37
|
const typescriptOptions = await options.presets.apply("typescript", {});
|
39
38
|
const { reactDocgen, reactDocgenTypescriptOptions } = typescriptOptions || {};
|
40
39
|
if (typeof reactDocgen !== "string") {
|
@@ -51,14 +50,14 @@ async function applyDocgenWebpack(chain, options) {
|
|
51
50
|
} else if (reactDocgen === "react-docgen") {
|
52
51
|
const loader = require.resolve("./loader");
|
53
52
|
const resolveOptions = chain.toConfig().resolve;
|
54
|
-
chain.module.rule(
|
53
|
+
chain.module.rule(CHAIN_ID.RULE.JS).use("react-docgen").loader(loader).options({
|
55
54
|
resolveOptions
|
56
|
-
}).after(
|
57
|
-
const tsRuls = chain.module.rule(
|
55
|
+
}).after(CHAIN_ID.USE.BABEL).after("esbuild").after(CHAIN_ID.USE.SWC).end();
|
56
|
+
const tsRuls = chain.module.rule(CHAIN_ID.RULE.TS);
|
58
57
|
if (tsRuls.uses.values().length !== 0) {
|
59
58
|
tsRuls.use("react-docgen").loader(loader).options({
|
60
59
|
resolveOptions
|
61
|
-
}).after(
|
60
|
+
}).after(CHAIN_ID.USE.TS).after("esbuild").after(CHAIN_ID.USE.SWC).end();
|
62
61
|
}
|
63
62
|
}
|
64
63
|
}
|
@@ -88,8 +88,8 @@ const pluginStorybook = (cwd, options) => {
|
|
88
88
|
if (api.context.bundlerType === "webpack") {
|
89
89
|
addonAdapter(api, options);
|
90
90
|
api.modifyWebpackConfig(modifyConfig);
|
91
|
-
api.modifyWebpackChain(async (chain) => {
|
92
|
-
await (0, import_docgen.applyDocgenWebpack)(chain, options);
|
91
|
+
api.modifyWebpackChain(async (chain, { CHAIN_ID }) => {
|
92
|
+
await (0, import_docgen.applyDocgenWebpack)(chain, CHAIN_ID, options);
|
93
93
|
});
|
94
94
|
} else {
|
95
95
|
api.modifyRspackConfig(async (config) => {
|
package/dist/esm/core.js
CHANGED
@@ -4,6 +4,7 @@ import { loadConfig } from "@modern-js/core";
|
|
4
4
|
import { getConfigFileName, runWithErrorMsg } from "./utils";
|
5
5
|
import { pluginStorybook, addonBabelAdapter } from "./plugin-storybook";
|
6
6
|
async function createBuilder(cwd, builderOptions, options) {
|
7
|
+
var _a;
|
7
8
|
const { bundler } = builderOptions;
|
8
9
|
const { presets } = options;
|
9
10
|
const entries = await presets.apply("entries", []);
|
@@ -17,16 +18,16 @@ async function createBuilder(cwd, builderOptions, options) {
|
|
17
18
|
finalConfig,
|
18
19
|
builderOptions.builderConfig
|
19
20
|
) : finalConfig || {};
|
21
|
+
(_a = uniBuilderConfig.source) != null ? _a : uniBuilderConfig.source = {};
|
22
|
+
uniBuilderConfig.source.entry = {
|
23
|
+
main: entries
|
24
|
+
};
|
20
25
|
const bundlerType = bundler || "webpack";
|
21
26
|
const builder = await createUniBuilder({
|
22
27
|
bundlerType,
|
23
28
|
cwd,
|
24
|
-
target: "web",
|
25
29
|
frameworkConfigPath: (res == null ? void 0 : res.path) ? res.path : void 0,
|
26
|
-
config: bundlerType === "webpack" ? await addonBabelAdapter(uniBuilderConfig, options) : uniBuilderConfig
|
27
|
-
entry: {
|
28
|
-
main: entries
|
29
|
-
}
|
30
|
+
config: bundlerType === "webpack" ? await addonBabelAdapter(uniBuilderConfig, options) : uniBuilderConfig
|
30
31
|
});
|
31
32
|
builder.addPlugins([
|
32
33
|
pluginStorybook(cwd, options),
|
package/dist/esm/docgen/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { logger } from "@modern-js/utils";
|
2
|
-
|
3
|
-
async function applyDocgenWebpack(chain, options) {
|
2
|
+
async function applyDocgenWebpack(chain, CHAIN_ID, options) {
|
4
3
|
const typescriptOptions = await options.presets.apply(
|
5
4
|
"typescript",
|
6
5
|
{}
|
@@ -14,7 +14,9 @@ import {
|
|
14
14
|
loadPreviewOrConfigFile
|
15
15
|
} from "@storybook/core-common";
|
16
16
|
import { globalsNameReferenceMap } from "@storybook/preview/globals";
|
17
|
-
import {
|
17
|
+
import {
|
18
|
+
mergeRsbuildConfig
|
19
|
+
} from "@rsbuild/core";
|
18
20
|
import { unplugin as csfPlugin } from "@storybook/csf-plugin";
|
19
21
|
import { minimatch } from "minimatch";
|
20
22
|
import {
|
@@ -75,8 +77,8 @@ const pluginStorybook = (cwd, options) => {
|
|
75
77
|
if (api.context.bundlerType === "webpack") {
|
76
78
|
addonAdapter(api, options);
|
77
79
|
api.modifyWebpackConfig(modifyConfig);
|
78
|
-
api.modifyWebpackChain(async (chain) => {
|
79
|
-
await applyDocgenWebpack(chain, options);
|
80
|
+
api.modifyWebpackChain(async (chain, { CHAIN_ID }) => {
|
81
|
+
await applyDocgenWebpack(chain, CHAIN_ID, options);
|
80
82
|
});
|
81
83
|
} else {
|
82
84
|
api.modifyRspackConfig(async (config) => {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { Options } from '@storybook/types';
|
2
|
-
import type {
|
2
|
+
import type { Rspack, RspackChain, ChainIdentifier } from '@rsbuild/core';
|
3
3
|
export type DocgenOptions = {
|
4
4
|
reactDocgen?: 'react-docgen' | 'react-docgen-typescript' | false;
|
5
5
|
reactDocgenTypescriptOptions?: any;
|
6
6
|
};
|
7
|
-
export declare function applyDocgenWebpack(chain: RspackChain, options: Options): Promise<void>;
|
8
|
-
export declare function applyDocgenRspack(config:
|
7
|
+
export declare function applyDocgenWebpack(chain: RspackChain, CHAIN_ID: ChainIdentifier, options: Options): Promise<void>;
|
8
|
+
export declare function applyDocgenRspack(config: Rspack.Configuration, options: Options): Promise<void>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Options } from '@storybook/types';
|
2
|
-
import { type RsbuildPlugin } from '@rsbuild/
|
2
|
+
import { type RsbuildPlugin } from '@rsbuild/core';
|
3
3
|
import { BuilderConfig } from './types';
|
4
4
|
export declare function finalize(): Promise<void>;
|
5
5
|
export declare const pluginStorybook: (cwd: string, options: Options) => RsbuildPlugin;
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@modern-js/storybook-builder",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.56.0",
|
4
4
|
"description": "modern.js support for storybook",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -51,8 +51,7 @@
|
|
51
51
|
},
|
52
52
|
"license": "MIT",
|
53
53
|
"dependencies": {
|
54
|
-
"@rsbuild/
|
55
|
-
"@rsbuild/core": "0.7.10",
|
54
|
+
"@rsbuild/core": "1.0.1-beta.3",
|
56
55
|
"@storybook/components": "~7.6.12",
|
57
56
|
"@storybook/core-common": "~7.6.12",
|
58
57
|
"@storybook/csf-plugin": "~7.6.12",
|
@@ -71,18 +70,18 @@
|
|
71
70
|
"remark-slug": "^7.0.1",
|
72
71
|
"serve-static": "^1.14.1",
|
73
72
|
"tinypool": "^0.8.0",
|
74
|
-
"@modern-js/
|
75
|
-
"@modern-js/
|
76
|
-
"@modern-js/
|
77
|
-
"@modern-js/utils": "2.
|
73
|
+
"@modern-js/uni-builder": "2.56.0",
|
74
|
+
"@modern-js/core": "2.56.0",
|
75
|
+
"@modern-js/runtime": "2.56.0",
|
76
|
+
"@modern-js/utils": "2.56.0"
|
78
77
|
},
|
79
78
|
"devDependencies": {
|
80
79
|
"@storybook/types": "~7.6.12",
|
81
|
-
"@types/babel__core": "^7.20.
|
80
|
+
"@types/babel__core": "^7.20.5",
|
82
81
|
"@types/serve-static": "^1.13.10",
|
83
82
|
"typescript": "^5.2.2",
|
84
|
-
"@
|
85
|
-
"@
|
83
|
+
"@modern-js/core": "2.56.0",
|
84
|
+
"@scripts/build": "2.56.0"
|
86
85
|
},
|
87
86
|
"publishConfig": {
|
88
87
|
"registry": "https://registry.npmjs.org/",
|