storybook-react-rsbuild 0.0.7 → 0.0.9

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,6 +1,6 @@
1
+ import { PluginOptions } from '@storybook/react-docgen-typescript-plugin';
1
2
  import { BuilderOptions, StorybookConfigRsbuild, TypescriptOptions as TypescriptOptions$1 } from 'storybook-builder-rsbuild';
2
3
  import { StorybookConfig as StorybookConfig$1, TypescriptOptions } from 'storybook/internal/types';
3
- import { PluginOptions } from '@storybook/react-docgen-typescript-plugin';
4
4
 
5
5
  type FrameworkName = 'storybook-react-rsbuild';
6
6
  type BuilderName = 'storybook-builder-rsbuild';
@@ -34,14 +34,14 @@ __export(react_docgen_loader_exports, {
34
34
  getReactDocgenImporter: () => getReactDocgenImporter
35
35
  });
36
36
  module.exports = __toCommonJS(react_docgen_loader_exports);
37
- var import_react_docgen = require("react-docgen");
38
- var TsconfigPaths = __toESM(require("tsconfig-paths"));
39
37
  var import_find_up = __toESM(require("find-up"));
40
38
  var import_magic_string = __toESM(require("magic-string"));
39
+ var import_react_docgen = require("react-docgen");
41
40
  var import_node_logger = require("storybook/internal/node-logger");
41
+ var TsconfigPaths = __toESM(require("tsconfig-paths"));
42
42
 
43
43
  // src/loaders/docgen-resolver.ts
44
- var import_path = require("path");
44
+ var import_node_path = require("path");
45
45
  var import_resolve = __toESM(require("resolve"));
46
46
  var ReactDocgenResolveError = class extends Error {
47
47
  constructor(filename) {
@@ -78,7 +78,7 @@ function defaultLookupModule(filename, basedir) {
78
78
  try {
79
79
  return import_resolve.default.sync(filename, resolveOptions);
80
80
  } catch (error) {
81
- const ext = (0, import_path.extname)(filename);
81
+ const ext = (0, import_node_path.extname)(filename);
82
82
  let newFilename;
83
83
  switch (ext) {
84
84
  case ".js":
@@ -177,13 +177,13 @@ async function reactDocgenLoader(source, map) {
177
177
  }
178
178
  });
179
179
  const magicString = new import_magic_string.default(source);
180
- docgenResults.forEach((info) => {
180
+ for (const info of docgenResults) {
181
181
  const { actualName, definedInFile, ...docgenInfo } = info;
182
182
  if (actualName && definedInFile === this.resourcePath) {
183
183
  const docNode = JSON.stringify(docgenInfo);
184
184
  magicString.append(`;${actualName}.__docgenInfo=${docNode}`);
185
185
  }
186
- });
186
+ }
187
187
  callback(
188
188
  null,
189
189
  magicString.toString(),
@@ -217,9 +217,8 @@ function getReactDocgenImporter(matchingPath) {
217
217
  if (matchingPath) {
218
218
  const match = matchingPath(filename);
219
219
  return match || filename;
220
- } else {
221
- return filename;
222
220
  }
221
+ return filename;
223
222
  })();
224
223
  const result = defaultLookupModule(mappedFilenameByPaths, basedir);
225
224
  if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext))) {
@@ -1,8 +1,8 @@
1
- import { builtinHandlers, builtinResolvers, parse, ERROR_CODES, makeFsImporter, utils } from 'react-docgen';
2
- import * as TsconfigPaths from 'tsconfig-paths';
3
1
  import findUp from 'find-up';
4
2
  import MagicString from 'magic-string';
3
+ import { builtinHandlers, builtinResolvers, parse, ERROR_CODES, makeFsImporter, utils } from 'react-docgen';
5
4
  import { logger } from 'storybook/internal/node-logger';
5
+ import * as TsconfigPaths from 'tsconfig-paths';
6
6
  import { extname } from 'path';
7
7
  import resolve from 'resolve';
8
8
 
@@ -141,13 +141,13 @@ async function reactDocgenLoader(source, map) {
141
141
  }
142
142
  });
143
143
  const magicString = new MagicString(source);
144
- docgenResults.forEach((info) => {
144
+ for (const info of docgenResults) {
145
145
  const { actualName, definedInFile, ...docgenInfo } = info;
146
146
  if (actualName && definedInFile === this.resourcePath) {
147
147
  const docNode = JSON.stringify(docgenInfo);
148
148
  magicString.append(`;${actualName}.__docgenInfo=${docNode}`);
149
149
  }
150
- });
150
+ }
151
151
  callback(
152
152
  null,
153
153
  magicString.toString(),
@@ -181,9 +181,8 @@ function getReactDocgenImporter(matchingPath) {
181
181
  if (matchingPath) {
182
182
  const match = matchingPath(filename);
183
183
  return match || filename;
184
- } else {
185
- return filename;
186
184
  }
185
+ return filename;
187
186
  })();
188
187
  const result = defaultLookupModule(mappedFilenameByPaths, basedir);
189
188
  if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext))) {
package/dist/preset.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PresetProperty } from 'storybook/internal/types';
2
2
  import { StorybookConfig } from './index.js';
3
- import 'storybook-builder-rsbuild';
4
3
  import '@storybook/react-docgen-typescript-plugin';
4
+ import 'storybook-builder-rsbuild';
5
5
 
6
6
  declare const rsbuildFinal: StorybookConfig['rsbuildFinal'];
7
7
  declare const core: PresetProperty<'core'>;
package/dist/preset.js CHANGED
@@ -24,11 +24,11 @@ __export(preset_exports, {
24
24
  rsbuildFinal: () => rsbuildFinal
25
25
  });
26
26
  module.exports = __toCommonJS(preset_exports);
27
- var import_path = require("path");
27
+ var import_node_path = require("path");
28
28
 
29
29
  // src/react-docs.ts
30
- var import_docs_tools = require("storybook/internal/docs-tools");
31
30
  var import_core = require("@rsbuild/core");
31
+ var import_docs_tools = require("storybook/internal/docs-tools");
32
32
 
33
33
  // src/requirer.ts
34
34
  function requirer(resolver, path) {
@@ -75,7 +75,7 @@ var rsbuildFinalDocs = async (config, options) => {
75
75
  };
76
76
 
77
77
  // src/preset.ts
78
- var getAbsolutePath = (input) => (0, import_path.dirname)(require.resolve((0, import_path.join)(input, "package.json")));
78
+ var getAbsolutePath = (input) => (0, import_node_path.dirname)(require.resolve((0, import_node_path.join)(input, "package.json")));
79
79
  var rsbuildFinal = async (config, options) => {
80
80
  const finalConfig = rsbuildFinalDocs(config, options);
81
81
  return finalConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-react-rsbuild",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Storybook for React and Rsbuild: Develop React components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -14,7 +14,7 @@
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "https://github.com/rspack-contrib/storybook-rsbuild",
17
- "directory": "packages/builder-react"
17
+ "directory": "packages/react-rsbuild"
18
18
  },
19
19
  "license": "MIT",
20
20
  "exports": {
@@ -57,10 +57,10 @@
57
57
  "react-docgen": "^7.0.3",
58
58
  "resolve": "^1.22.8",
59
59
  "tsconfig-paths": "^4.2.0",
60
- "storybook-builder-rsbuild": "0.0.7"
60
+ "storybook-builder-rsbuild": "0.0.9"
61
61
  },
62
62
  "devDependencies": {
63
- "@rsbuild/core": "1.0.0-alpha.9",
63
+ "@rsbuild/core": "1.0.1-beta.0",
64
64
  "@storybook/types": "^8.2.1",
65
65
  "@types/resolve": "^1.20.6",
66
66
  "add": "^2.0.6",
@@ -94,6 +94,7 @@
94
94
  "platform": "node"
95
95
  },
96
96
  "scripts": {
97
+ "build": "pnpm run prep --optimized",
97
98
  "check": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/check.ts",
98
99
  "prep": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/bundle.ts"
99
100
  }