storybook-react-rsbuild 3.6.0 → 3.6.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.
@@ -10,7 +10,7 @@ const getDocgen = async (config)=>{
10
10
  };
11
11
  return docGen.withCompilerOptions({}, docgenOptions);
12
12
  };
13
- const startWatch = async (config, onProgramCreatedOrUpdated)=>{
13
+ const startProgram = async (config, isBuild, onProgramCreatedOrUpdated)=>{
14
14
  const { default: ts } = await import("typescript");
15
15
  const { getTSConfigFile } = await import("./typescript-69cd7fa9.js");
16
16
  let compilerOptions = {
@@ -30,6 +30,21 @@ const startWatch = async (config, onProgramCreatedOrUpdated)=>{
30
30
  ...tsOptions
31
31
  };
32
32
  }
33
+ if (isBuild) {
34
+ const tsConfig = getTSConfigFile(tsconfigPath);
35
+ const program = ts.createProgram({
36
+ rootNames: tsConfig.fileNames ?? [],
37
+ options: {
38
+ ...tsConfig.options,
39
+ ...compilerOptions
40
+ },
41
+ projectReferences: tsConfig.projectReferences
42
+ });
43
+ return [
44
+ program,
45
+ ()=>{}
46
+ ];
47
+ }
33
48
  const host = ts.createWatchCompilerHost(tsconfigPath, compilerOptions, ts.sys, ts.createSemanticDiagnosticsBuilderProgram, void 0, ()=>{});
34
49
  host.afterProgramCreate = (program)=>{
35
50
  onProgramCreatedOrUpdated(program.getProgram());
@@ -58,7 +73,7 @@ const react_docgen_typescript = (config = {})=>{
58
73
  generateDocgenCodeBlock = (await import("./generate-1782ed11.js")).generateDocgenCodeBlock;
59
74
  docGenParser = await getDocgen(config);
60
75
  generateOptions = getGenerateOptions(config);
61
- [tsProgram, closeWatch] = await startWatch(config, (program)=>{
76
+ [tsProgram, closeWatch] = await startProgram(config, 'build' === api.context.action, (program)=>{
62
77
  tsProgram = program;
63
78
  for (const [filepath, invalidateModule] of moduleInvalidationQueue.entries()){
64
79
  invalidateModule();
@@ -90,9 +105,9 @@ const react_docgen_typescript = (config = {})=>{
90
105
  return src;
91
106
  }
92
107
  });
93
- api.onCloseBuild(()=>{
94
- closeWatch();
95
- });
108
+ const close = ()=>closeWatch?.();
109
+ api.onCloseBuild(close);
110
+ api.onCloseDevServer(close);
96
111
  }
97
112
  };
98
113
  };
package/dist/preset.js CHANGED
@@ -41,7 +41,7 @@ const rsbuildFinalDocs = async (config, options)=>{
41
41
  }
42
42
  }
43
43
  });
44
- const reactDocGenTsPlugin = await import("./chunks/react-docgen-typescript-9f56b1df.js");
44
+ const reactDocGenTsPlugin = await import("./chunks/react-docgen-typescript-16ec96c4.js");
45
45
  return mergeRsbuildConfig(config, {
46
46
  tools: {
47
47
  rspack: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-react-rsbuild",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Storybook for React and Rsbuild: Develop React components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -49,16 +49,16 @@
49
49
  "@rollup/pluginutils": "^5.4.0",
50
50
  "@storybook/react": "^10.6.0",
51
51
  "@storybook/react-docgen-typescript-plugin": "^1.0.1",
52
- "magic-string": "^1.4.1",
53
- "react-docgen": "^8.0.3",
52
+ "magic-string": "^1.4.2",
53
+ "react-docgen": "^8.0.4",
54
54
  "react-docgen-typescript": "^2.4.0",
55
55
  "resolve": "^1.22.12",
56
56
  "tsconfig-paths": "^4.2.0",
57
- "storybook-builder-rsbuild": "3.6.0"
57
+ "storybook-builder-rsbuild": "3.6.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@microsoft/api-extractor": "^7.59.1",
61
- "@rsbuild/core": "^2.2.6",
60
+ "@microsoft/api-extractor": "^7.59.3",
61
+ "@rsbuild/core": "^2.2.11",
62
62
  "@types/node": "^22.0.0",
63
63
  "@types/react": "^18.3.31",
64
64
  "@types/resolve": "^1.20.6",