storybook-react-rsbuild 0.0.4 → 0.0.5

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.
@@ -4,7 +4,7 @@ import { LoaderContext } from 'webpack';
4
4
 
5
5
  declare function reactDocgenLoader(this: LoaderContext<{
6
6
  debug: boolean;
7
- }>, source: string): Promise<void>;
7
+ }>, source: string, map: any): Promise<void>;
8
8
  declare function getReactDocgenImporter(matchingPath: TsconfigPaths.MatchPath | undefined): react_docgen.Importer;
9
9
 
10
10
  export { reactDocgenLoader as default, getReactDocgenImporter };
@@ -144,7 +144,7 @@ var finishInitialization = () => {
144
144
  tsconfigPathsInitializeStatus = "initialized";
145
145
  };
146
146
  var matchPath;
147
- async function reactDocgenLoader(source) {
147
+ async function reactDocgenLoader(source, map) {
148
148
  const callback = this.async();
149
149
  const options = this.getOptions() || {};
150
150
  const { debug = false } = options;
@@ -184,11 +184,15 @@ async function reactDocgenLoader(source) {
184
184
  magicString.append(`;${actualName}.__docgenInfo=${docNode}`);
185
185
  }
186
186
  });
187
- const map = magicString.generateMap({
188
- includeContent: true,
189
- source: this.resourcePath
190
- });
191
- callback(null, magicString.toString(), map);
187
+ callback(
188
+ null,
189
+ magicString.toString(),
190
+ map ?? magicString.generateMap({
191
+ hires: true,
192
+ source: this.resourcePath,
193
+ includeContent: true
194
+ })
195
+ );
192
196
  } catch (error) {
193
197
  if (error.code === import_react_docgen.ERROR_CODES.MISSING_DEFINITION) {
194
198
  callback(null, source);
@@ -108,7 +108,7 @@ var finishInitialization = () => {
108
108
  tsconfigPathsInitializeStatus = "initialized";
109
109
  };
110
110
  var matchPath;
111
- async function reactDocgenLoader(source) {
111
+ async function reactDocgenLoader(source, map) {
112
112
  const callback = this.async();
113
113
  const options = this.getOptions() || {};
114
114
  const { debug = false } = options;
@@ -148,11 +148,15 @@ async function reactDocgenLoader(source) {
148
148
  magicString.append(`;${actualName}.__docgenInfo=${docNode}`);
149
149
  }
150
150
  });
151
- const map = magicString.generateMap({
152
- includeContent: true,
153
- source: this.resourcePath
154
- });
155
- callback(null, magicString.toString(), map);
151
+ callback(
152
+ null,
153
+ magicString.toString(),
154
+ map ?? magicString.generateMap({
155
+ hires: true,
156
+ source: this.resourcePath,
157
+ includeContent: true
158
+ })
159
+ );
156
160
  } catch (error) {
157
161
  if (error.code === ERROR_CODES.MISSING_DEFINITION) {
158
162
  callback(null, source);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-react-rsbuild",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Storybook for React and Rsbuild: Develop React components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -60,10 +60,11 @@
60
60
  "react-docgen": "^7.0.3",
61
61
  "resolve": "^1.22.8",
62
62
  "tsconfig-paths": "^4.2.0",
63
- "storybook-builder-rsbuild": "0.0.4"
63
+ "storybook-builder-rsbuild": "0.0.5"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@storybook/types": "^8.0.10",
67
+ "@types/resolve": "^1.20.6",
67
68
  "add": "^2.0.6",
68
69
  "typescript": "^5.3.2"
69
70
  },