storybook-react-rsbuild 0.0.4 → 0.0.6-beta.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,52 @@
1
- export { F as FrameworkOptions, S as StorybookConfig } from './index-0d1103e1.js';
2
- import 'storybook-builder-rsbuild';
3
- import 'file-system-cache';
4
- import 'http';
5
- import '@storybook/react-docgen-typescript-plugin';
1
+ import { BuilderOptions, StorybookConfigRsbuild, TypescriptOptions as TypescriptOptions$1 } from 'storybook-builder-rsbuild';
2
+ import { StorybookConfig as StorybookConfig$1, TypescriptOptions } from 'storybook/internal/types';
3
+ import { PluginOptions } from '@storybook/react-docgen-typescript-plugin';
4
+
5
+ type FrameworkName = 'storybook-react-rsbuild';
6
+ type BuilderName = 'storybook-builder-rsbuild';
7
+ type FrameworkOptions = {
8
+ builder?: BuilderOptions;
9
+ strictMode?: boolean;
10
+ /**
11
+ * Use React's legacy root API to mount components
12
+ * @description
13
+ * React has introduced a new root API with React 18.x to enable a whole set of new features (e.g. concurrent features)
14
+ * If this flag is true, the legacy Root API is used to mount components to make it easier to migrate step by step to React 18.
15
+ * @default false
16
+ */
17
+ legacyRootApi?: boolean;
18
+ };
19
+ type TypescriptOptionsReact = {
20
+ /**
21
+ * Sets the type of Docgen when working with React and TypeScript
22
+ *
23
+ * @default `'react-docgen'`
24
+ */
25
+ reactDocgen: 'react-docgen-typescript' | 'react-docgen' | false;
26
+ /**
27
+ * Configures `react-docgen-typescript-plugin`
28
+ *
29
+ * @default
30
+ * @see https://github.com/storybookjs/storybook/blob/next/code/builders/builder-webpack5/src/config/defaults.js#L4-L6
31
+ */
32
+ reactDocgenTypescriptOptions: PluginOptions;
33
+ };
34
+ type StorybookConfigFramework = {
35
+ framework: FrameworkName | {
36
+ name: FrameworkName;
37
+ options: FrameworkOptions;
38
+ };
39
+ core?: StorybookConfig$1['core'] & {
40
+ builder?: BuilderName | {
41
+ name: BuilderName;
42
+ options: BuilderOptions;
43
+ };
44
+ };
45
+ typescript?: Partial<TypescriptOptions & TypescriptOptions$1 & TypescriptOptionsReact>;
46
+ };
47
+ /**
48
+ * The interface for Storybook configuration in `main.ts` files.
49
+ */
50
+ type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigRsbuild | keyof StorybookConfigFramework> & StorybookConfigRsbuild & StorybookConfigFramework;
51
+
52
+ export { FrameworkOptions, StorybookConfig };
@@ -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 };
@@ -38,7 +38,7 @@ var import_react_docgen = require("react-docgen");
38
38
  var TsconfigPaths = __toESM(require("tsconfig-paths"));
39
39
  var import_find_up = __toESM(require("find-up"));
40
40
  var import_magic_string = __toESM(require("magic-string"));
41
- var import_node_logger = require("@storybook/node-logger");
41
+ var import_node_logger = require("storybook/internal/node-logger");
42
42
 
43
43
  // src/loaders/docgen-resolver.ts
44
44
  var import_path = require("path");
@@ -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);
@@ -2,7 +2,7 @@ import { builtinHandlers, builtinResolvers, parse, ERROR_CODES, makeFsImporter,
2
2
  import * as TsconfigPaths from 'tsconfig-paths';
3
3
  import findUp from 'find-up';
4
4
  import MagicString from 'magic-string';
5
- import { logger } from '@storybook/node-logger';
5
+ import { logger } from 'storybook/internal/node-logger';
6
6
  import { extname } from 'path';
7
7
  import resolve from 'resolve';
8
8
 
@@ -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/dist/preset.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { S as StorybookConfig, P as PresetProperty } from './index-0d1103e1.js';
1
+ import { PresetProperty } from 'storybook/internal/types';
2
+ import { StorybookConfig } from './index.js';
2
3
  import 'storybook-builder-rsbuild';
3
- import 'file-system-cache';
4
- import 'http';
5
4
  import '@storybook/react-docgen-typescript-plugin';
6
5
 
7
6
  declare const rsbuildFinal: StorybookConfig['rsbuildFinal'];
package/dist/preset.js CHANGED
@@ -27,7 +27,7 @@ module.exports = __toCommonJS(preset_exports);
27
27
  var import_path = require("path");
28
28
 
29
29
  // src/react-docs.ts
30
- var import_docs_tools = require("@storybook/docs-tools");
30
+ var import_docs_tools = require("storybook/internal/docs-tools");
31
31
  var import_core = require("@rsbuild/core");
32
32
 
33
33
  // src/requirer.ts
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.6-beta.1",
4
4
  "description": "Storybook for React and Rsbuild: Develop React components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -49,10 +49,7 @@
49
49
  "!src/**/*"
50
50
  ],
51
51
  "dependencies": {
52
- "@rsbuild/core": "0.6.15",
53
- "@storybook/docs-tools": "^8.0.10",
54
- "@storybook/node-logger": "^8.0.10",
55
- "@storybook/react": "^8.0.10",
52
+ "@storybook/react": "^8.2.1",
56
53
  "@storybook/react-docgen-typescript-plugin": "^1.0.1",
57
54
  "@types/node": "^18.0.0",
58
55
  "find-up": "^5.0.0",
@@ -60,16 +57,21 @@
60
57
  "react-docgen": "^7.0.3",
61
58
  "resolve": "^1.22.8",
62
59
  "tsconfig-paths": "^4.2.0",
63
- "storybook-builder-rsbuild": "0.0.4"
60
+ "storybook-builder-rsbuild": "0.0.6-beta.1"
64
61
  },
65
62
  "devDependencies": {
66
- "@storybook/types": "^8.0.10",
63
+ "@rsbuild/core": "1.0.0-alpha.9",
64
+ "@storybook/types": "^8.2.1",
65
+ "@types/resolve": "^1.20.6",
67
66
  "add": "^2.0.6",
67
+ "storybook": "^8.2.1",
68
68
  "typescript": "^5.3.2"
69
69
  },
70
70
  "peerDependencies": {
71
+ "@rsbuild/core": ">= 1.0.0-alpha.9",
71
72
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
72
73
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
74
+ "storybook": "^8.2.1",
73
75
  "typescript": ">= 4.2.x"
74
76
  },
75
77
  "peerDependenciesMeta": {