@modern-js/storybook-builder 2.54.6 → 2.55.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.
@@ -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
- var import_shared = require("@rsbuild/shared");
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(import_shared.CHAIN_ID.RULE.JS).use("react-docgen").loader(loader).options({
53
+ chain.module.rule(CHAIN_ID.RULE.JS).use("react-docgen").loader(loader).options({
55
54
  resolveOptions
56
- }).after(import_shared.CHAIN_ID.USE.BABEL).after("esbuild").after(import_shared.CHAIN_ID.USE.SWC).end();
57
- const tsRuls = chain.module.rule(import_shared.CHAIN_ID.RULE.TS);
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(import_shared.CHAIN_ID.USE.TS).after("esbuild").after(import_shared.CHAIN_ID.USE.SWC).end();
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) => {
@@ -1,6 +1,5 @@
1
1
  import { logger } from "@modern-js/utils";
2
- import { CHAIN_ID } from "@rsbuild/shared";
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 { mergeRsbuildConfig } from "@rsbuild/core";
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 { RspackConfig, RspackChain } from '@rsbuild/shared';
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: RspackConfig, options: Options): Promise<void>;
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/shared';
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;
@@ -1,4 +1,4 @@
1
- import type { RsbuildPlugin } from '@rsbuild/shared';
1
+ import type { RsbuildPlugin } from '@rsbuild/core';
2
2
  import type { UniBuilderConfig } from '@modern-js/uni-builder';
3
3
  export type BundlerType = 'webpack' | 'rspack';
4
4
  export type BuilderOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/storybook-builder",
3
- "version": "2.54.6",
3
+ "version": "2.55.0",
4
4
  "description": "modern.js support for storybook",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,7 +51,6 @@
51
51
  },
52
52
  "license": "MIT",
53
53
  "dependencies": {
54
- "@rsbuild/shared": "0.7.10",
55
54
  "@rsbuild/core": "0.7.10",
56
55
  "@storybook/components": "~7.6.12",
57
56
  "@storybook/core-common": "~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/core": "2.54.6",
75
- "@modern-js/runtime": "2.54.6",
76
- "@modern-js/uni-builder": "2.54.6",
77
- "@modern-js/utils": "2.54.6"
73
+ "@modern-js/uni-builder": "2.55.0",
74
+ "@modern-js/core": "2.55.0",
75
+ "@modern-js/runtime": "2.55.0",
76
+ "@modern-js/utils": "2.55.0"
78
77
  },
79
78
  "devDependencies": {
80
79
  "@storybook/types": "~7.6.12",
81
80
  "@types/babel__core": "^7.20.1",
82
81
  "@types/serve-static": "^1.13.10",
83
82
  "typescript": "^5.2.2",
84
- "@scripts/build": "2.54.6",
85
- "@modern-js/core": "2.54.6"
83
+ "@scripts/build": "2.55.0",
84
+ "@modern-js/core": "2.55.0"
86
85
  },
87
86
  "publishConfig": {
88
87
  "registry": "https://registry.npmjs.org/",