@modern-js/storybook-builder 0.0.0-next-20230920091340 → 0.0.0-next-20231010141253
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +23 -19
- package/dist/cjs/addons/components/modern.js +9 -6
- package/dist/cjs/addons/constants.js +1 -0
- package/dist/cjs/addons/index.js +3 -2
- package/dist/cjs/addons/preset/preview.js +4 -1
- package/dist/cjs/addons/type.js +1 -0
- package/dist/cjs/addons/withPluginRuntime.js +2 -3
- package/dist/cjs/build.js +17 -19
- package/dist/cjs/core.js +2 -4
- package/dist/cjs/docgen/actualNameHandler.js +2 -4
- package/dist/cjs/docgen/index.js +8 -10
- package/dist/cjs/docgen/loader.js +1 -0
- package/dist/cjs/docgen/process.js +13 -15
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/plugin-storybook.js +114 -143
- package/dist/cjs/preset.js +7 -8
- package/dist/cjs/types.js +1 -0
- package/dist/cjs/utils.js +19 -18
- package/dist/esm/build.js +1 -1
- package/dist/types/core.d.ts +1 -1
- package/package.json +20 -20
- package/src/build.ts +1 -1
- package/src/core.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
> @modern-js/storybook-builder@2.31.2 build /home/runner/work/modern.js/modern.js/packages/storybook/builder
|
3
3
|
> modern-lib build
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
[1m[36minfo [39m[22m Build succeed in 36.1s
|
6
|
+
[1m[36minfo [39m[22m Bundleless generated 51 files, the total size is 83.1 KB
|
package/CHANGELOG.md
CHANGED
@@ -1,25 +1,29 @@
|
|
1
1
|
# @modern-js/storybook-builder
|
2
2
|
|
3
|
-
## 0.0.0-next-
|
3
|
+
## 0.0.0-next-20231010141253
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
-
|
7
|
+
- 251535116: feat: add storybook-framework
|
8
8
|
feat: 支持 storybook-framework
|
9
|
-
- Updated dependencies [
|
10
|
-
- Updated dependencies [
|
11
|
-
- Updated dependencies [
|
12
|
-
- Updated dependencies [
|
13
|
-
- Updated dependencies [
|
14
|
-
- Updated dependencies [
|
15
|
-
- Updated dependencies [
|
16
|
-
- Updated dependencies [
|
17
|
-
- Updated dependencies [
|
18
|
-
- Updated dependencies [
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- @modern-js/core@0.0.0-next-
|
24
|
-
- @modern-js/builder
|
25
|
-
- @modern-js/
|
9
|
+
- Updated dependencies [4fbc386a3]
|
10
|
+
- Updated dependencies [3448e8208]
|
11
|
+
- Updated dependencies [3473beecd]
|
12
|
+
- Updated dependencies [b98f8aaf4]
|
13
|
+
- Updated dependencies [3921cd46f]
|
14
|
+
- Updated dependencies [d90d83a25]
|
15
|
+
- Updated dependencies [5c8991041]
|
16
|
+
- Updated dependencies [bc25bcbd3]
|
17
|
+
- Updated dependencies [c1b0d1805]
|
18
|
+
- Updated dependencies [2675812d3]
|
19
|
+
- Updated dependencies [9d37401f4]
|
20
|
+
- Updated dependencies [eb602d263]
|
21
|
+
- Updated dependencies [4e3310bbe]
|
22
|
+
- Updated dependencies [5b4bf2188]
|
23
|
+
- @modern-js/core@0.0.0-next-20231010141253
|
24
|
+
- @modern-js/builder@0.0.0-next-20231010141253
|
25
|
+
- @modern-js/utils@0.0.0-next-20231010141253
|
26
|
+
- @modern-js/builder-rspack-provider@0.0.0-next-20231010141253
|
27
|
+
- @modern-js/builder-webpack-provider@0.0.0-next-20231010141253
|
28
|
+
- @modern-js/builder-shared@0.0.0-next-20231010141253
|
29
|
+
- @modern-js/runtime@0.0.0-next-20231010141253
|
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -62,12 +63,14 @@ const resolvePlugins = (runtime) => {
|
|
62
63
|
plugins.push((0, import_model.default)(runtime.state));
|
63
64
|
}
|
64
65
|
} else if (api === allowedRuntimeAPI.router) {
|
65
|
-
plugins.push(
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
plugins.push((0, import_router.default)({
|
67
|
+
...{
|
68
|
+
serverBase: [
|
69
|
+
"/"
|
70
|
+
]
|
71
|
+
},
|
72
|
+
...runtime.router
|
73
|
+
}));
|
71
74
|
}
|
72
75
|
}
|
73
76
|
});
|
package/dist/cjs/addons/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __defProp = Object.defineProperty;
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -20,8 +21,8 @@ __export(addons_exports, {
|
|
20
21
|
default: () => addons_default
|
21
22
|
});
|
22
23
|
module.exports = __toCommonJS(addons_exports);
|
23
|
-
var
|
24
|
-
if (
|
24
|
+
var _module_hot;
|
25
|
+
if (module === null || module === void 0 ? void 0 : (_module_hot = module.hot) === null || _module_hot === void 0 ? void 0 : _module_hot.decline) {
|
25
26
|
module.hot.decline();
|
26
27
|
}
|
27
28
|
var addons_default = {};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __defProp = Object.defineProperty;
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -21,7 +22,9 @@ __export(preview_exports, {
|
|
21
22
|
});
|
22
23
|
module.exports = __toCommonJS(preview_exports);
|
23
24
|
var import_withPluginRuntime = require("../withPluginRuntime");
|
24
|
-
const decorators = [
|
25
|
+
const decorators = [
|
26
|
+
import_withPluginRuntime.withPluginRuntime
|
27
|
+
];
|
25
28
|
// Annotate the CommonJS export names for ESM import in node:
|
26
29
|
0 && (module.exports = {
|
27
30
|
decorators
|
package/dist/cjs/addons/type.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __defProp = Object.defineProperty;
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -23,9 +24,7 @@ module.exports = __toCommonJS(withPluginRuntime_exports);
|
|
23
24
|
var import_preview_api = require("@storybook/preview-api");
|
24
25
|
var import_modern = require("./components/modern");
|
25
26
|
const withPluginRuntime = (storyFn) => {
|
26
|
-
const modernConfigRuntime = (0, import_preview_api.useParameter)(
|
27
|
-
"modernConfigRuntime"
|
28
|
-
);
|
27
|
+
const modernConfigRuntime = (0, import_preview_api.useParameter)("modernConfigRuntime");
|
29
28
|
const modernConfigDesignToken = (0, import_preview_api.useParameter)("modernConfigDesignToken");
|
30
29
|
return (0, import_modern.WrapProviders)(storyFn, {
|
31
30
|
modernConfigRuntime: modernConfigRuntime || {},
|
package/dist/cjs/build.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -34,7 +35,7 @@ __export(build_exports, {
|
|
34
35
|
});
|
35
36
|
module.exports = __toCommonJS(build_exports);
|
36
37
|
var import_path = require("path");
|
37
|
-
var import_webpack_dev_middleware = __toESM(require("@modern-js/
|
38
|
+
var import_webpack_dev_middleware = __toESM(require("@modern-js/builder-shared/webpack-dev-middleware"));
|
38
39
|
var import_webpack_hot_middleware = __toESM(require("webpack-hot-middleware"));
|
39
40
|
var import_serve_static = __toESM(require("serve-static"));
|
40
41
|
var import_utils = require("@modern-js/utils");
|
@@ -43,14 +44,12 @@ var import_plugin_storybook = require("./plugin-storybook");
|
|
43
44
|
const getConfig = async (options) => {
|
44
45
|
const { presets } = options;
|
45
46
|
const frameworkOptions = await presets.apply("frameworkOptions");
|
46
|
-
return (frameworkOptions
|
47
|
+
return (frameworkOptions === null || frameworkOptions === void 0 ? void 0 : frameworkOptions.options) || {};
|
47
48
|
};
|
48
49
|
const build = async ({ options }) => {
|
49
50
|
const config = await getConfig(options);
|
50
51
|
const compiler = await (0, import_core.getCompiler)(process.cwd(), config, options);
|
51
|
-
const previewResolvedDir = (0, import_path.dirname)(
|
52
|
-
require.resolve("@storybook/preview/package.json")
|
53
|
-
);
|
52
|
+
const previewResolvedDir = (0, import_path.dirname)(require.resolve("@storybook/preview/package.json"));
|
54
53
|
const previewDirOrigin = (0, import_path.join)(previewResolvedDir, "dist");
|
55
54
|
const previewDirTarget = (0, import_path.join)(options.outputDir || "", `sb-preview`);
|
56
55
|
const previewFiles = import_utils.fs.copy(previewDirOrigin, previewDirTarget, {
|
@@ -71,22 +70,19 @@ const build = async ({ options }) => {
|
|
71
70
|
}
|
72
71
|
});
|
73
72
|
});
|
74
|
-
const [stats] = await Promise.all([
|
73
|
+
const [stats] = await Promise.all([
|
74
|
+
compilation,
|
75
|
+
previewFiles
|
76
|
+
]);
|
75
77
|
return stats;
|
76
78
|
};
|
77
|
-
const start = async ({
|
78
|
-
|
79
|
-
router,
|
80
|
-
startTime
|
81
|
-
}) => {
|
82
|
-
const previewResolvedDir = (0, import_path.dirname)(
|
83
|
-
require.resolve("@storybook/preview/package.json")
|
84
|
-
);
|
79
|
+
const start = async ({ options, router, startTime }) => {
|
80
|
+
const previewResolvedDir = (0, import_path.dirname)(require.resolve("@storybook/preview/package.json"));
|
85
81
|
const previewDirOrigin = (0, import_path.join)(previewResolvedDir, "dist");
|
86
|
-
router.use(
|
87
|
-
|
88
|
-
|
89
|
-
);
|
82
|
+
router.use(`/sb-preview`, (0, import_serve_static.default)(previewDirOrigin, {
|
83
|
+
immutable: true,
|
84
|
+
maxAge: "5m"
|
85
|
+
}));
|
90
86
|
const config = await getConfig(options);
|
91
87
|
const compiler = await (0, import_core.getCompiler)(process.cwd(), config, options);
|
92
88
|
const middleware = (0, import_webpack_dev_middleware.default)(compiler, {
|
@@ -95,7 +91,9 @@ const start = async ({
|
|
95
91
|
stats: false
|
96
92
|
});
|
97
93
|
router.use(middleware);
|
98
|
-
router.use((0, import_webpack_hot_middleware.default)(compiler, {
|
94
|
+
router.use((0, import_webpack_hot_middleware.default)(compiler, {
|
95
|
+
log: false
|
96
|
+
}));
|
99
97
|
const stats = await new Promise((resolve) => {
|
100
98
|
middleware.waitUntilValid((stats2) => {
|
101
99
|
resolve(stats2);
|
package/dist/cjs/core.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __defProp = Object.defineProperty;
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -28,10 +29,7 @@ async function getCompiler(cwd, builderOptions, options) {
|
|
28
29
|
const bundler = builderOptions.bundler || "webpack";
|
29
30
|
const { presets } = options;
|
30
31
|
const entries = await presets.apply("entries", []);
|
31
|
-
const res = await (0, import_utils.runWithErrorMsg)(
|
32
|
-
() => (0, import_core.loadConfig)(cwd, builderOptions.configPath || (0, import_utils.getConfigFileName)()),
|
33
|
-
"Failed to load config"
|
34
|
-
);
|
32
|
+
const res = await (0, import_utils.runWithErrorMsg)(() => (0, import_core.loadConfig)(cwd, builderOptions.configPath || (0, import_utils.getConfigFileName)()), "Failed to load config");
|
35
33
|
const loadedConfig = res ? res.config : {};
|
36
34
|
const otherBuilderConfig = await presets.apply("modern", loadedConfig) || {};
|
37
35
|
const builderConfig = (0, import_builder.mergeBuilderConfig)(otherBuilderConfig, loadedConfig);
|
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __defProp = Object.defineProperty;
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -29,10 +30,7 @@ function actualNameHandler(documentation, path, importer) {
|
|
29
30
|
let currentPath = path;
|
30
31
|
while (currentPath.parent) {
|
31
32
|
if (import_ast_types.namedTypes.VariableDeclarator.check(currentPath.parent.node)) {
|
32
|
-
documentation.set(
|
33
|
-
"actualName",
|
34
|
-
(0, import_utils.getNameOrValue)(currentPath.parent.get("id"))
|
35
|
-
);
|
33
|
+
documentation.set("actualName", (0, import_utils.getNameOrValue)(currentPath.parent.get("id")));
|
36
34
|
return;
|
37
35
|
}
|
38
36
|
if (import_ast_types.namedTypes.AssignmentExpression.check(currentPath.parent.node)) {
|
package/dist/cjs/docgen/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -33,10 +34,7 @@ __export(docgen_exports, {
|
|
33
34
|
module.exports = __toCommonJS(docgen_exports);
|
34
35
|
var import_utils = require("@modern-js/utils");
|
35
36
|
async function applyDocgenWebpack(chain, options) {
|
36
|
-
const typescriptOptions = await options.presets.apply(
|
37
|
-
"typescript",
|
38
|
-
{}
|
39
|
-
);
|
37
|
+
const typescriptOptions = await options.presets.apply("typescript", {});
|
40
38
|
const { reactDocgen, reactDocgenTypescriptOptions } = typescriptOptions || {};
|
41
39
|
if (typeof reactDocgen !== "string") {
|
42
40
|
return;
|
@@ -64,19 +62,19 @@ async function applyDocgenWebpack(chain, options) {
|
|
64
62
|
}
|
65
63
|
}
|
66
64
|
async function applyDocgenRspack(config, options) {
|
67
|
-
var
|
65
|
+
var _config, _config_module;
|
68
66
|
const typescriptOptions = await options.presets.apply("typescript", {});
|
69
67
|
const { reactDocgen } = typescriptOptions || {};
|
70
68
|
if (reactDocgen !== "react-docgen") {
|
71
69
|
if (reactDocgen !== false && reactDocgen !== void 0) {
|
72
|
-
import_utils.logger.warn(
|
73
|
-
`Rspack currently only support 'typescript.reactDocgen: react-docgen' for auto docs generation, but you specified ${reactDocgen}`
|
74
|
-
);
|
70
|
+
import_utils.logger.warn(`Rspack currently only support 'typescript.reactDocgen: react-docgen' for auto docs generation, but you specified ${reactDocgen}`);
|
75
71
|
}
|
76
72
|
return;
|
77
73
|
}
|
78
|
-
|
79
|
-
(
|
74
|
+
var _module;
|
75
|
+
(_module = (_config = config).module) !== null && _module !== void 0 ? _module : _config.module = {};
|
76
|
+
var _rules;
|
77
|
+
(_rules = (_config_module = config.module).rules) !== null && _rules !== void 0 ? _rules : _config_module.rules = [];
|
80
78
|
config.module.rules.push({
|
81
79
|
test: /\.(tsx?|jsx?)$/,
|
82
80
|
exclude: /node_modules/,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -34,21 +35,15 @@ var import_react_docgen = require("react-docgen");
|
|
34
35
|
var import_actualNameHandler = __toESM(require("./actualNameHandler"));
|
35
36
|
const defaultHandlers = Object.values(import_react_docgen.handlers).map((handler) => handler);
|
36
37
|
const importer = import_react_docgen.importers.makeFsImporter();
|
37
|
-
var process_default = ({
|
38
|
-
source,
|
39
|
-
map,
|
40
|
-
filename
|
41
|
-
}) => {
|
38
|
+
var process_default = ({ source, map, filename }) => {
|
42
39
|
try {
|
43
|
-
const results = (0, import_react_docgen.parse)(
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
51
|
-
);
|
40
|
+
const results = (0, import_react_docgen.parse)(source, import_react_docgen.resolver.findAllExportedComponentDefinitions, [
|
41
|
+
...defaultHandlers,
|
42
|
+
import_actualNameHandler.default
|
43
|
+
], {
|
44
|
+
filename,
|
45
|
+
importer
|
46
|
+
});
|
52
47
|
const docgen = results.map((result) => {
|
53
48
|
const { actualName, ...docgenInfo } = result;
|
54
49
|
if (actualName) {
|
@@ -56,7 +51,10 @@ var process_default = ({
|
|
56
51
|
}
|
57
52
|
return "";
|
58
53
|
}).filter(Boolean).join(";");
|
59
|
-
return [
|
54
|
+
return [
|
55
|
+
docgen,
|
56
|
+
map
|
57
|
+
];
|
60
58
|
} catch (e) {
|
61
59
|
return null;
|
62
60
|
}
|
package/dist/cjs/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __defProp = Object.defineProperty;
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -28,7 +29,9 @@ module.exports = __toCommonJS(src_exports);
|
|
28
29
|
var import_path = require("path");
|
29
30
|
var import_build = require("./build");
|
30
31
|
__reExport(src_exports, require("./types"), module.exports);
|
31
|
-
const corePresets = [
|
32
|
+
const corePresets = [
|
33
|
+
(0, import_path.join)(__dirname, "./preset.js")
|
34
|
+
];
|
32
35
|
// Annotate the CommonJS export names for ESM import in node:
|
33
36
|
0 && (module.exports = {
|
34
37
|
bail,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -47,18 +48,18 @@ const onClose = (f) => {
|
|
47
48
|
closeFn.push(f);
|
48
49
|
};
|
49
50
|
async function finalize() {
|
50
|
-
await Promise.all([
|
51
|
+
await Promise.all([
|
52
|
+
closeFn.map((close) => close())
|
53
|
+
]);
|
51
54
|
}
|
52
55
|
const pluginStorybook = (cwd, options) => {
|
53
56
|
return {
|
54
57
|
name: "builder-plugin-storybook",
|
55
|
-
remove: [
|
58
|
+
remove: [
|
59
|
+
"builder-plugin-inline"
|
60
|
+
],
|
56
61
|
async setup(api) {
|
57
|
-
const matchers = await options.presets.apply(
|
58
|
-
"stories",
|
59
|
-
[],
|
60
|
-
options
|
61
|
-
);
|
62
|
+
const matchers = await options.presets.apply("stories", [], options);
|
62
63
|
const storyPatterns = (0, import_core_common.normalizeStories)(matchers, {
|
63
64
|
configDir: options.configDir,
|
64
65
|
workingDir: options.configDir
|
@@ -68,21 +69,16 @@ const pluginStorybook = (cwd, options) => {
|
|
68
69
|
return absolutePattern;
|
69
70
|
});
|
70
71
|
api.modifyBuilderConfig(async (builderConfig) => {
|
71
|
-
await prepareStorybookModules(
|
72
|
-
api.context.cachePath,
|
73
|
-
cwd,
|
74
|
-
options,
|
75
|
-
builderConfig,
|
76
|
-
storyPatterns
|
77
|
-
);
|
72
|
+
await prepareStorybookModules(api.context.cachePath, cwd, options, builderConfig, storyPatterns);
|
78
73
|
await applyDefines(builderConfig, options);
|
79
74
|
await applyHTML(builderConfig, options);
|
80
75
|
await applyReact(builderConfig, options);
|
81
76
|
applyExternals(builderConfig);
|
82
77
|
});
|
83
78
|
const modifyConfig = async (config) => {
|
84
|
-
var
|
85
|
-
|
79
|
+
var _config;
|
80
|
+
var _resolve;
|
81
|
+
(_resolve = (_config = config).resolve) !== null && _resolve !== void 0 ? _resolve : _config.resolve = {};
|
86
82
|
config.resolve.conditionNames = [
|
87
83
|
"require",
|
88
84
|
"node",
|
@@ -107,23 +103,22 @@ const pluginStorybook = (cwd, options) => {
|
|
107
103
|
};
|
108
104
|
};
|
109
105
|
async function applyCsfPlugin(config, options) {
|
110
|
-
var
|
106
|
+
var _addons_find;
|
107
|
+
var _config;
|
111
108
|
const { presets } = options;
|
112
109
|
const addons = await presets.apply("addons", []);
|
113
|
-
const {
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
(
|
121
|
-
config.plugins.push(
|
122
|
-
bundler === "rspack" ? import_csf_plugin.unplugin.rspack(docsOptions) : import_csf_plugin.unplugin.webpack(docsOptions)
|
123
|
-
);
|
110
|
+
const { options: { bundler } } = await presets.apply("frameworkOptions");
|
111
|
+
var _addons_find_options;
|
112
|
+
const docsOptions = (_addons_find_options = (_addons_find = addons.find((a) => [
|
113
|
+
a,
|
114
|
+
a.name
|
115
|
+
].includes("@storybook/addon-docs"))) === null || _addons_find === void 0 ? void 0 : _addons_find.options) !== null && _addons_find_options !== void 0 ? _addons_find_options : {};
|
116
|
+
var _plugins;
|
117
|
+
(_plugins = (_config = config).plugins) !== null && _plugins !== void 0 ? _plugins : _config.plugins = [];
|
118
|
+
config.plugins.push(bundler === "rspack" ? import_csf_plugin.unplugin.rspack(docsOptions) : import_csf_plugin.unplugin.webpack(docsOptions));
|
124
119
|
}
|
125
120
|
async function prepareStorybookModules(tempDir, cwd, options, builderConfig, storyPatterns) {
|
126
|
-
var
|
121
|
+
var _builderConfig;
|
127
122
|
const mappings = await createStorybookModules(cwd, options, storyPatterns);
|
128
123
|
const componentsPath = (0, import_utils2.maybeGetAbsolutePath)(`@storybook/components`);
|
129
124
|
const routerPath = (0, import_utils2.maybeGetAbsolutePath)(`@storybook/router`);
|
@@ -132,11 +127,16 @@ async function prepareStorybookModules(tempDir, cwd, options, builderConfig, sto
|
|
132
127
|
...componentsPath ? {
|
133
128
|
[`@storybook/components`]: componentsPath
|
134
129
|
} : {},
|
135
|
-
...routerPath ? {
|
136
|
-
|
130
|
+
...routerPath ? {
|
131
|
+
[`@storybook/router`]: routerPath
|
132
|
+
} : {},
|
133
|
+
...themingPath ? {
|
134
|
+
[`@storybook/theming`]: themingPath
|
135
|
+
} : {}
|
137
136
|
};
|
138
137
|
const [mappingsAlias, write] = await (0, import_utils2.virtualModule)(tempDir, cwd, mappings);
|
139
|
-
|
138
|
+
var _source;
|
139
|
+
(_source = (_builderConfig = builderConfig).source) !== null && _source !== void 0 ? _source : _builderConfig.source = {};
|
140
140
|
builderConfig.source.alias = {
|
141
141
|
...builderConfig.source.alias,
|
142
142
|
...storybookPaths,
|
@@ -150,10 +150,11 @@ async function prepareStorybookModules(tempDir, cwd, options, builderConfig, sto
|
|
150
150
|
}
|
151
151
|
}
|
152
152
|
async function applyDefines(builderConfig, options) {
|
153
|
-
var
|
153
|
+
var _builderConfig;
|
154
154
|
const { presets } = options;
|
155
155
|
const envs = await presets.apply("env");
|
156
|
-
|
156
|
+
var _source;
|
157
|
+
(_source = (_builderConfig = builderConfig).source) !== null && _source !== void 0 ? _source : _builderConfig.source = {};
|
157
158
|
builderConfig.source.define = {
|
158
159
|
...builderConfig.source.define,
|
159
160
|
...(0, import_core_common.stringifyProcessEnvs)(envs),
|
@@ -162,24 +163,9 @@ async function applyDefines(builderConfig, options) {
|
|
162
163
|
};
|
163
164
|
}
|
164
165
|
async function applyHTML(builderConfig, options) {
|
165
|
-
var
|
166
|
-
const {
|
167
|
-
|
168
|
-
packageJson,
|
169
|
-
configType,
|
170
|
-
features,
|
171
|
-
previewUrl,
|
172
|
-
serverChannelUrl
|
173
|
-
} = options;
|
174
|
-
const [
|
175
|
-
coreOptions,
|
176
|
-
frameworkOptions,
|
177
|
-
logLevel,
|
178
|
-
headHtmlSnippet,
|
179
|
-
bodyHtmlSnippet,
|
180
|
-
template,
|
181
|
-
docsOptions
|
182
|
-
] = await Promise.all([
|
166
|
+
var _builderConfig;
|
167
|
+
const { presets, packageJson, configType, features, previewUrl, serverChannelUrl } = options;
|
168
|
+
const [coreOptions, frameworkOptions, logLevel, headHtmlSnippet, bodyHtmlSnippet, template, docsOptions] = await Promise.all([
|
183
169
|
presets.apply("core"),
|
184
170
|
presets.apply("frameworkOptions"),
|
185
171
|
presets.apply("logLevel", void 0),
|
@@ -188,16 +174,14 @@ async function applyHTML(builderConfig, options) {
|
|
188
174
|
presets.apply("previewMainTemplate"),
|
189
175
|
presets.apply("docs")
|
190
176
|
]);
|
191
|
-
|
177
|
+
var _tools;
|
178
|
+
(_tools = (_builderConfig = builderConfig).tools) !== null && _tools !== void 0 ? _tools : _builderConfig.tools = {};
|
192
179
|
builderConfig.tools.htmlPlugin = {
|
193
180
|
...builderConfig.tools.htmlPlugin,
|
194
181
|
template,
|
195
182
|
filename: "iframe.html",
|
196
183
|
templateParameters: {
|
197
|
-
...builderConfig.tools.htmlPlugin ?
|
198
|
-
// @ts-expect-error
|
199
|
-
builderConfig.tools.htmlPlugin.templateParameters || {}
|
200
|
-
) : {},
|
184
|
+
...builderConfig.tools.htmlPlugin ? builderConfig.tools.htmlPlugin.templateParameters || {} : {},
|
201
185
|
version: packageJson.version || "",
|
202
186
|
globals: {
|
203
187
|
CONFIG_TYPE: configType,
|
@@ -216,65 +200,63 @@ async function applyHTML(builderConfig, options) {
|
|
216
200
|
};
|
217
201
|
}
|
218
202
|
async function applyMdxLoader(config, options) {
|
219
|
-
var
|
203
|
+
var _mdxPluginOptions_mdxCompileOptions, _options_features;
|
204
|
+
var _config, _config_module;
|
220
205
|
const { presets, mdxPluginOptions } = options;
|
221
206
|
const remarkExternalLinks = await Promise.resolve().then(() => __toESM(require("remark-external-links")));
|
222
207
|
const remarkSlug = await Promise.resolve().then(() => __toESM(require("remark-slug")));
|
208
|
+
var _mdxPluginOptions_mdxCompileOptions_remarkPlugins;
|
223
209
|
const mdxLoaderOptions = await presets.apply("mdxLoaderOptions", {
|
224
210
|
skipCsf: true,
|
225
211
|
mdxCompileOptions: {
|
226
212
|
providerImportSource: "@storybook/addon-docs/mdx-react-shim",
|
227
|
-
...mdxPluginOptions
|
213
|
+
...mdxPluginOptions === null || mdxPluginOptions === void 0 ? void 0 : mdxPluginOptions.mdxCompileOptions,
|
228
214
|
remarkPlugins: [
|
229
215
|
remarkSlug,
|
230
216
|
remarkExternalLinks,
|
231
|
-
...(
|
217
|
+
...(_mdxPluginOptions_mdxCompileOptions_remarkPlugins = mdxPluginOptions === null || mdxPluginOptions === void 0 ? void 0 : (_mdxPluginOptions_mdxCompileOptions = mdxPluginOptions.mdxCompileOptions) === null || _mdxPluginOptions_mdxCompileOptions === void 0 ? void 0 : _mdxPluginOptions_mdxCompileOptions.remarkPlugins) !== null && _mdxPluginOptions_mdxCompileOptions_remarkPlugins !== void 0 ? _mdxPluginOptions_mdxCompileOptions_remarkPlugins : []
|
232
218
|
]
|
233
219
|
}
|
234
220
|
});
|
235
|
-
const mdxLoader = ((
|
236
|
-
|
237
|
-
(
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
221
|
+
const mdxLoader = ((_options_features = options.features) === null || _options_features === void 0 ? void 0 : _options_features.legacyMdx1) ? require.resolve("@storybook/mdx1-csf/loader") : require.resolve("@storybook/mdx2-csf/loader");
|
222
|
+
var _module;
|
223
|
+
(_module = (_config = config).module) !== null && _module !== void 0 ? _module : _config.module = {};
|
224
|
+
var _rules;
|
225
|
+
(_rules = (_config_module = config.module).rules) !== null && _rules !== void 0 ? _rules : _config_module.rules = [];
|
226
|
+
config.module.rules.push({
|
227
|
+
test: /(stories|story)\.mdx$/,
|
228
|
+
use: [
|
229
|
+
{
|
230
|
+
loader: mdxLoader,
|
231
|
+
options: {
|
232
|
+
...mdxLoaderOptions,
|
233
|
+
skipCsf: false
|
248
234
|
}
|
249
|
-
]
|
250
|
-
},
|
251
|
-
{
|
252
|
-
test: /\.mdx$/,
|
253
|
-
exclude: /(stories|story)\.mdx$/,
|
254
|
-
use: [
|
255
|
-
{
|
256
|
-
loader: mdxLoader,
|
257
|
-
options: mdxLoaderOptions
|
258
|
-
}
|
259
|
-
]
|
260
|
-
}
|
261
|
-
);
|
262
|
-
}
|
263
|
-
function applyExternals(builderConfig) {
|
264
|
-
var _a;
|
265
|
-
const config = (0, import_builder_shared.mergeBuilderConfig)(
|
266
|
-
{
|
267
|
-
output: {
|
268
|
-
...builderConfig.output,
|
269
|
-
externals: (_a = builderConfig.output) == null ? void 0 : _a.externals
|
270
235
|
}
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
236
|
+
]
|
237
|
+
}, {
|
238
|
+
test: /\.mdx$/,
|
239
|
+
exclude: /(stories|story)\.mdx$/,
|
240
|
+
use: [
|
241
|
+
{
|
242
|
+
loader: mdxLoader,
|
243
|
+
options: mdxLoaderOptions
|
275
244
|
}
|
245
|
+
]
|
246
|
+
});
|
247
|
+
}
|
248
|
+
function applyExternals(builderConfig) {
|
249
|
+
var _builderConfig_output;
|
250
|
+
const config = (0, import_builder_shared.mergeBuilderConfig)({
|
251
|
+
output: {
|
252
|
+
...builderConfig.output,
|
253
|
+
externals: (_builderConfig_output = builderConfig.output) === null || _builderConfig_output === void 0 ? void 0 : _builderConfig_output.externals
|
254
|
+
}
|
255
|
+
}, {
|
256
|
+
output: {
|
257
|
+
externals: import_globals.globals
|
276
258
|
}
|
277
|
-
);
|
259
|
+
});
|
278
260
|
builderConfig.output = config.output;
|
279
261
|
}
|
280
262
|
function getStoriesEntryPath(cwd) {
|
@@ -290,11 +272,7 @@ async function createStorybookModules(cwd, options, storyPatterns) {
|
|
290
272
|
virtualModuleMappings[getStoriesEntryPath(cwd)] = storiesEntry;
|
291
273
|
const configEntryPath = getStoriesConfigPath(cwd);
|
292
274
|
const previewAnnotations = [
|
293
|
-
...(await presets.apply(
|
294
|
-
"previewAnnotations",
|
295
|
-
[],
|
296
|
-
options
|
297
|
-
)).map((entry) => {
|
275
|
+
...(await presets.apply("previewAnnotations", [], options)).map((entry) => {
|
298
276
|
if (typeof entry === "object") {
|
299
277
|
return entry.absolute;
|
300
278
|
}
|
@@ -302,62 +280,55 @@ async function createStorybookModules(cwd, options, storyPatterns) {
|
|
302
280
|
}),
|
303
281
|
(0, import_core_common.loadPreviewOrConfigFile)(options)
|
304
282
|
].filter(Boolean);
|
305
|
-
virtualModuleMappings[configEntryPath] = (0, import_core_common.handlebars)(
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
{
|
310
|
-
storiesFilename: STORIES_FILENAME,
|
311
|
-
previewAnnotations
|
312
|
-
}
|
313
|
-
).replace(/\\/g, "\\\\");
|
283
|
+
virtualModuleMappings[configEntryPath] = (0, import_core_common.handlebars)(await (0, import_core_common.readTemplate)(require.resolve("@modern-js/storybook-builder/templates/virtualModuleModernEntry.js.handlebars")), {
|
284
|
+
storiesFilename: STORIES_FILENAME,
|
285
|
+
previewAnnotations
|
286
|
+
}).replace(/\\/g, "\\\\");
|
314
287
|
return virtualModuleMappings;
|
315
288
|
}
|
316
289
|
async function createStoriesEntry(cwd, storyPatterns) {
|
317
|
-
const stories = (await Promise.all(
|
318
|
-
|
319
|
-
|
320
|
-
})
|
321
|
-
)).reduce((carry, stories2) => carry.concat(stories2), []);
|
290
|
+
const stories = (await Promise.all(storyPatterns.map((pattern) => {
|
291
|
+
return (0, import_utils.globby)((0, import_utils.slash)(pattern), {
|
292
|
+
followSymbolicLinks: true
|
293
|
+
});
|
294
|
+
}))).reduce((carry, stories2) => carry.concat(stories2), []);
|
322
295
|
return await (0, import_utils2.toImportFn)(cwd, stories);
|
323
296
|
}
|
324
297
|
async function applyReact(config, options) {
|
325
|
-
var _a, _b, _c;
|
326
298
|
let version = "18.0.0";
|
327
299
|
try {
|
328
300
|
({ version } = await Promise.resolve().then(() => __toESM(require("react-dom/package.json"))));
|
329
301
|
} catch (_) {
|
330
302
|
}
|
331
|
-
const { legacyRootApi } = await options.presets.apply(
|
332
|
-
"frameworkOptions"
|
333
|
-
) || {};
|
303
|
+
const { legacyRootApi } = await options.presets.apply("frameworkOptions") || {};
|
334
304
|
const isReact18 = version.startsWith("18") || version.startsWith("0.0.0");
|
335
|
-
const useReact17 = legacyRootApi
|
305
|
+
const useReact17 = legacyRootApi !== null && legacyRootApi !== void 0 ? legacyRootApi : !isReact18;
|
336
306
|
if (!useReact17) {
|
337
|
-
|
338
|
-
|
307
|
+
var _config, _config_source;
|
308
|
+
var _source;
|
309
|
+
(_source = (_config = config).source) !== null && _source !== void 0 ? _source : _config.source = {};
|
310
|
+
var _alias;
|
311
|
+
(_alias = (_config_source = config.source).alias) !== null && _alias !== void 0 ? _alias : _config_source.alias = {};
|
339
312
|
config.source.alias["@storybook/react-dom-shim"] = "@storybook/react-dom-shim/dist/react-18";
|
340
313
|
}
|
341
314
|
}
|
342
315
|
async function watchStories(patterns, cwd, writeModule) {
|
343
|
-
const watcher = (0, import_utils.watch)(
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
[/node_modules/]
|
360
|
-
);
|
316
|
+
const watcher = (0, import_utils.watch)(cwd, async ({ changeType, changedFilePath }) => {
|
317
|
+
if (changeType !== "add" && changeType !== "unlink") {
|
318
|
+
return;
|
319
|
+
}
|
320
|
+
if (patterns.some((entry) => (0, import_minimatch.minimatch)(changedFilePath, entry))) {
|
321
|
+
const stories = (await Promise.all(patterns.map((pattern) => {
|
322
|
+
return (0, import_utils.globby)((0, import_utils.slash)(pattern), {
|
323
|
+
followSymbolicLinks: true
|
324
|
+
});
|
325
|
+
}))).reduce((carry, stories2) => carry.concat(stories2), []);
|
326
|
+
const newStories = await (0, import_utils2.toImportFn)(cwd, stories);
|
327
|
+
writeModule(getStoriesEntryPath(cwd), newStories);
|
328
|
+
}
|
329
|
+
}, [
|
330
|
+
/node_modules/
|
331
|
+
]);
|
361
332
|
return watcher;
|
362
333
|
}
|
363
334
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/cjs/preset.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -45,25 +46,23 @@ const entries = async (_, options) => {
|
|
45
46
|
const result = [];
|
46
47
|
const { bundler } = await (0, import_build.getConfig)(options);
|
47
48
|
if (options.configType === "DEVELOPMENT") {
|
48
|
-
result.push(
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
].filter(Boolean)
|
53
|
-
);
|
49
|
+
result.push(...[
|
50
|
+
`${require.resolve("webpack-hot-middleware/client")}?reload=true&quiet=false&noInfo=${options.quiet}`,
|
51
|
+
bundler === "rspack" ? require.resolve("@rspack/dev-client/react-refresh-entry") : null
|
52
|
+
].filter(Boolean));
|
54
53
|
}
|
55
54
|
result.push(getStoriesConfigPath(process.cwd()));
|
56
55
|
return result;
|
57
56
|
};
|
58
57
|
const modern = (builderConfig, options) => {
|
59
|
-
var
|
58
|
+
var _builderConfig_output;
|
60
59
|
return {
|
61
60
|
...builderConfig,
|
62
61
|
output: {
|
63
62
|
...builderConfig.output,
|
64
63
|
disableInlineRuntimeChunk: true,
|
65
64
|
distPath: {
|
66
|
-
...(
|
65
|
+
...(_builderConfig_output = builderConfig.output) === null || _builderConfig_output === void 0 ? void 0 : _builderConfig_output.distPath,
|
67
66
|
root: options.outputDir
|
68
67
|
}
|
69
68
|
}
|
package/dist/cjs/types.js
CHANGED
package/dist/cjs/utils.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -48,8 +49,8 @@ const VIRTUAL_MODULE_BASE = ".MODERN_STORYBOOK";
|
|
48
49
|
const STORIES_FILENAME = "storybook-stories.js";
|
49
50
|
const STORYBOOK_CONFIG_ENTRY = "storybook-config-entry.js";
|
50
51
|
const requireResolve = (importer, path2) => {
|
51
|
-
const
|
52
|
-
|
52
|
+
const require1 = (0, import_node_module.createRequire)(importer);
|
53
|
+
require1.resolve(path2);
|
53
54
|
};
|
54
55
|
async function getProvider(bundler, builderConfig) {
|
55
56
|
try {
|
@@ -65,23 +66,19 @@ async function getProvider(bundler, builderConfig) {
|
|
65
66
|
});
|
66
67
|
}
|
67
68
|
} catch (e) {
|
68
|
-
import_utils.logger.error(
|
69
|
-
`Cannot find provider, you need to install @modern-js/builder-${bundler}-provider first`
|
70
|
-
);
|
69
|
+
import_utils.logger.error(`Cannot find provider, you need to install @modern-js/builder-${bundler}-provider first`);
|
71
70
|
}
|
72
71
|
}
|
73
72
|
async function virtualModule(tempDir, cwd, virtualModuleMap) {
|
74
73
|
import_utils.fs.ensureDirSync(tempDir);
|
75
74
|
const alias = {};
|
76
|
-
await Promise.all(
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
})
|
84
|
-
);
|
75
|
+
await Promise.all(Reflect.ownKeys(virtualModuleMap).map((k) => {
|
76
|
+
const virtualPath = k;
|
77
|
+
const relativePath = import_path.default.relative(cwd, virtualPath);
|
78
|
+
const realPath = import_path.default.join(tempDir, relativePath);
|
79
|
+
alias[virtualPath] = realPath;
|
80
|
+
return import_utils.fs.writeFile(realPath, virtualModuleMap[virtualPath]);
|
81
|
+
}));
|
85
82
|
return [
|
86
83
|
alias,
|
87
84
|
(virtualPath, content) => {
|
@@ -95,10 +92,14 @@ async function toImportFn(cwd, stories) {
|
|
95
92
|
const objectEntries = stories.map((file) => {
|
96
93
|
const ext = import_path.default.extname(file);
|
97
94
|
const relativePath = import_path.default.relative(cwd, file);
|
98
|
-
if (![
|
99
|
-
|
100
|
-
|
101
|
-
|
95
|
+
if (![
|
96
|
+
".js",
|
97
|
+
".jsx",
|
98
|
+
".ts",
|
99
|
+
".tsx",
|
100
|
+
".mdx"
|
101
|
+
].includes(ext)) {
|
102
|
+
import_utils.logger.warn(`Cannot process ${ext} file with storyStoreV7: ${relativePath}`);
|
102
103
|
}
|
103
104
|
return ` '${toImportPath(relativePath)}': async () => import('${file}')`;
|
104
105
|
});
|
package/dist/esm/build.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { dirname, join, parse } from "path";
|
2
|
-
import webpackDevMiddleware from "@modern-js/
|
2
|
+
import webpackDevMiddleware from "@modern-js/builder-shared/webpack-dev-middleware";
|
3
3
|
import webpackHotMiddleware from "webpack-hot-middleware";
|
4
4
|
import serveStatic from "serve-static";
|
5
5
|
import { fs } from "@modern-js/utils";
|
package/dist/types/core.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { Options } from '@storybook/types';
|
2
|
-
import type { Compiler } from '@modern-js/
|
2
|
+
import type { Compiler } from '@modern-js/builder-shared/webpack-dev-middleware';
|
3
3
|
import type { BuilderOptions } from './types';
|
4
4
|
export declare function getCompiler(cwd: string, builderOptions: BuilderOptions, options: Options): Promise<Compiler>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@modern-js/storybook-builder",
|
3
|
-
"version": "0.0.0-next-
|
3
|
+
"version": "0.0.0-next-20231010141253",
|
4
4
|
"description": "modern.js support for storybook",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -35,17 +35,17 @@
|
|
35
35
|
"license": "MIT",
|
36
36
|
"dependencies": {
|
37
37
|
"@rspack/dev-client": "0.3.2",
|
38
|
-
"@storybook/components": "^7.4.
|
39
|
-
"@storybook/core-common": "^7.4.
|
40
|
-
"@storybook/csf-plugin": "^7.4.
|
38
|
+
"@storybook/components": "^7.4.6",
|
39
|
+
"@storybook/core-common": "^7.4.6",
|
40
|
+
"@storybook/csf-plugin": "^7.4.6",
|
41
41
|
"@storybook/global": "^5.0.0",
|
42
42
|
"@storybook/mdx1-csf": "^1.0.0",
|
43
43
|
"@storybook/mdx2-csf": "^1.1.0",
|
44
|
-
"@storybook/preview": "^7.4.
|
45
|
-
"@storybook/preview-api": "^7.4.
|
44
|
+
"@storybook/preview": "^7.4.6",
|
45
|
+
"@storybook/preview-api": "^7.4.6",
|
46
46
|
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.0c3f3b7.0",
|
47
|
-
"@storybook/router": "^7.4.
|
48
|
-
"@storybook/theming": "^7.4.
|
47
|
+
"@storybook/router": "^7.4.6",
|
48
|
+
"@storybook/theming": "^7.4.6",
|
49
49
|
"ast-types": "^0.14.2",
|
50
50
|
"minimatch": "^9.0.3",
|
51
51
|
"react-docgen": "6.0.0-alpha.3",
|
@@ -54,26 +54,26 @@
|
|
54
54
|
"serve-static": "^1.14.1",
|
55
55
|
"tinypool": "^0.8.0",
|
56
56
|
"webpack-hot-middleware": "^2.25.4",
|
57
|
-
"@modern-js/builder": "0.0.0-next-
|
58
|
-
"@modern-js/builder-shared": "0.0.0-next-
|
59
|
-
"@modern-js/core": "0.0.0-next-
|
60
|
-
"@modern-js/runtime": "0.0.0-next-
|
61
|
-
"@modern-js/utils": "0.0.0-next-
|
57
|
+
"@modern-js/builder": "0.0.0-next-20231010141253",
|
58
|
+
"@modern-js/builder-shared": "0.0.0-next-20231010141253",
|
59
|
+
"@modern-js/core": "0.0.0-next-20231010141253",
|
60
|
+
"@modern-js/runtime": "0.0.0-next-20231010141253",
|
61
|
+
"@modern-js/utils": "0.0.0-next-20231010141253"
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
|
-
"@storybook/types": "^7.4.
|
64
|
+
"@storybook/types": "^7.4.6",
|
65
65
|
"@types/babel__core": "^7.20.1",
|
66
66
|
"@types/serve-static": "^1.13.10",
|
67
67
|
"@types/webpack-hot-middleware": "^2.25.6",
|
68
68
|
"typescript": "^5.2.2",
|
69
|
-
"@modern-js/builder-rspack-provider": "0.0.0-next-
|
70
|
-
"@modern-js/builder-webpack-provider": "0.0.0-next-
|
71
|
-
"@modern-js/core": "0.0.0-next-
|
72
|
-
"@scripts/build": "0.0.0-next-
|
69
|
+
"@modern-js/builder-rspack-provider": "0.0.0-next-20231010141253",
|
70
|
+
"@modern-js/builder-webpack-provider": "0.0.0-next-20231010141253",
|
71
|
+
"@modern-js/core": "0.0.0-next-20231010141253",
|
72
|
+
"@scripts/build": "0.0.0-next-20231010141253"
|
73
73
|
},
|
74
74
|
"peerDependencies": {
|
75
|
-
"@modern-js/builder-rspack-provider": "0.0.0-next-
|
76
|
-
"@modern-js/builder-webpack-provider": "0.0.0-next-
|
75
|
+
"@modern-js/builder-rspack-provider": "0.0.0-next-20231010141253",
|
76
|
+
"@modern-js/builder-webpack-provider": "0.0.0-next-20231010141253"
|
77
77
|
},
|
78
78
|
"peerDependenciesMeta": {
|
79
79
|
"@modern-js/builder-rspack-provider": {
|
package/src/build.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { dirname, join, parse } from 'path';
|
2
|
-
import webpackDevMiddleware from '@modern-js/
|
2
|
+
import webpackDevMiddleware from '@modern-js/builder-shared/webpack-dev-middleware';
|
3
3
|
import webpackHotMiddleware from 'webpack-hot-middleware';
|
4
4
|
import serveStatic from 'serve-static';
|
5
5
|
import type { Builder as RawStorybookBuilder, Stats } from '@storybook/types';
|
package/src/core.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createBuilder, mergeBuilderConfig } from '@modern-js/builder';
|
2
2
|
import { loadConfig } from '@modern-js/core';
|
3
3
|
import type { Options } from '@storybook/types';
|
4
|
-
import type { Compiler } from '@modern-js/
|
4
|
+
import type { Compiler } from '@modern-js/builder-shared/webpack-dev-middleware';
|
5
5
|
import type { BuilderConfig, BuilderOptions } from './types';
|
6
6
|
import { getConfigFileName, getProvider, runWithErrorMsg } from './utils';
|
7
7
|
import { pluginStorybook } from './plugin-storybook';
|