storybook-builder-rsbuild 2.0.0-alpha.1 → 2.0.0-alpha.3

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
@@ -29,7 +29,12 @@ type BuilderOptions = {
29
29
  /**
30
30
  * Enable Rspack's lazy compilation (experimental).
31
31
  */
32
- lazyCompilation?: boolean;
32
+ lazyCompilation?: NonNullable<RsbuildConfig['performance']>['buildCache'];
33
+ /**
34
+ * Enable Rspack's [persistent cache(experimental)](https://rspack.dev/config/experiments#experimentscache).
35
+ * We continue to use the name `fsCache` here to maintain better compatibility with the webpack builder.
36
+ */
37
+ fsCache?: boolean;
33
38
  /**
34
39
  * Which environment to use from the Rsbuild config.
35
40
  */
package/dist/index.js CHANGED
@@ -132,7 +132,7 @@ var import_server_errors = require("storybook/internal/server-errors");
132
132
  var import_node_path3 = require("path");
133
133
  var import_core = require("@rsbuild/core");
134
134
  var import_plugin_type_check = require("@rsbuild/plugin-type-check");
135
- var import_preset = require("@storybook/addon-docs/dist/preset");
135
+ var import_preset = require("@storybook/addon-docs/preset");
136
136
  var import_case_sensitive_paths_webpack_plugin = __toESM(require("case-sensitive-paths-webpack-plugin"));
137
137
  var import_rsbuild_plugin_html_minifier_terser = require("rsbuild-plugin-html-minifier-terser");
138
138
  var import_common2 = require("storybook/internal/common");
@@ -360,6 +360,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
360
360
  const shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipCompiler;
361
361
  const tsCheckOptions = typescriptOptions.checkOptions || {};
362
362
  const builderOptions = await (0, import_common2.getBuilderOptions)(options);
363
+ const cacheConfig = builderOptions.fsCache ? true : void 0;
363
364
  const lazyCompilationConfig = builderOptions.lazyCompilation && !isProd ? {
364
365
  lazyCompilation: { entries: false }
365
366
  } : {};
@@ -449,13 +450,15 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
449
450
  assetPrefix: "/",
450
451
  progressBar: !quiet
451
452
  },
453
+ resolve: {
454
+ alias: {
455
+ ...storybookPaths
456
+ }
457
+ },
452
458
  source: {
453
459
  // TODO: Rspack doesn't support virtual modules yet, use cache dir instead
454
460
  // we needed to explicitly set the module in `node_modules` to be compiled
455
461
  include: [/[\\/]node_modules[\\/].*[\\/]storybook-config-entry\.js/],
456
- alias: {
457
- ...storybookPaths
458
- },
459
462
  entry: {
460
463
  // to avoid `It's not allowed to load an initial chunk on demand. The chunk name "main" is already used by an entrypoint` of
461
464
  main: [...entries ?? [], ...dynamicEntries]
@@ -471,7 +474,8 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
471
474
  splitChunks: {
472
475
  chunks: "all"
473
476
  }
474
- }
477
+ },
478
+ buildCache: cacheConfig
475
479
  },
476
480
  plugins: [
477
481
  shouldCheckTs ? (0, import_plugin_type_check.pluginTypeCheck)(tsCheckOptions) : null,
@@ -543,7 +547,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
543
547
  ...config.experiments,
544
548
  ...lazyCompilationConfig
545
549
  };
546
- return mergeConfig(config, extraWebpackConfig, appliedDocsWebpack);
550
+ return mergeConfig(config, extraWebpackConfig || {}, appliedDocsWebpack);
547
551
  },
548
552
  htmlPlugin: {
549
553
  filename: "iframe.html",
@@ -608,7 +612,7 @@ var applyReactShims = async (config, options) => {
608
612
  return void 0;
609
613
  }
610
614
  return {
611
- source: {
615
+ resolve: {
612
616
  alias: {
613
617
  "@storybook/react-dom-shim": "@storybook/react-dom-shim/dist/react-16"
614
618
  }
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import sirv from 'sirv';
8
8
  import { normalizeStories, loadPreviewOrConfigFile, getBuilderOptions, readTemplate, resolveAddonName, getPresets, stringifyProcessEnvs, isPreservingSymlinks } from 'storybook/internal/common';
9
9
  import { WebpackInvocationError } from 'storybook/internal/server-errors';
10
10
  import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
11
- import { webpack } from '@storybook/addon-docs/dist/preset';
11
+ import { webpack } from '@storybook/addon-docs/preset';
12
12
  import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
13
13
  import { pluginHtmlMinifierTerser } from 'rsbuild-plugin-html-minifier-terser';
14
14
  import { globalsNameReferenceMap } from 'storybook/internal/preview/globals';
@@ -304,6 +304,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
304
304
  const shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipCompiler;
305
305
  const tsCheckOptions = typescriptOptions.checkOptions || {};
306
306
  const builderOptions = await getBuilderOptions(options);
307
+ const cacheConfig = builderOptions.fsCache ? true : void 0;
307
308
  const lazyCompilationConfig = builderOptions.lazyCompilation && !isProd ? {
308
309
  lazyCompilation: { entries: false }
309
310
  } : {};
@@ -393,13 +394,15 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
393
394
  assetPrefix: "/",
394
395
  progressBar: !quiet
395
396
  },
397
+ resolve: {
398
+ alias: {
399
+ ...storybookPaths
400
+ }
401
+ },
396
402
  source: {
397
403
  // TODO: Rspack doesn't support virtual modules yet, use cache dir instead
398
404
  // we needed to explicitly set the module in `node_modules` to be compiled
399
405
  include: [/[\\/]node_modules[\\/].*[\\/]storybook-config-entry\.js/],
400
- alias: {
401
- ...storybookPaths
402
- },
403
406
  entry: {
404
407
  // to avoid `It's not allowed to load an initial chunk on demand. The chunk name "main" is already used by an entrypoint` of
405
408
  main: [...entries ?? [], ...dynamicEntries]
@@ -415,7 +418,8 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
415
418
  splitChunks: {
416
419
  chunks: "all"
417
420
  }
418
- }
421
+ },
422
+ buildCache: cacheConfig
419
423
  },
420
424
  plugins: [
421
425
  shouldCheckTs ? pluginTypeCheck(tsCheckOptions) : null,
@@ -489,7 +493,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
489
493
  ...config.experiments,
490
494
  ...lazyCompilationConfig
491
495
  };
492
- return mergeConfig(config, extraWebpackConfig, appliedDocsWebpack);
496
+ return mergeConfig(config, extraWebpackConfig || {}, appliedDocsWebpack);
493
497
  },
494
498
  htmlPlugin: {
495
499
  filename: "iframe.html",
@@ -550,7 +554,7 @@ var applyReactShims = async (config, options) => {
550
554
  return void 0;
551
555
  }
552
556
  return {
553
- source: {
557
+ resolve: {
554
558
  alias: {
555
559
  "@storybook/react-dom-shim": "@storybook/react-dom-shim/dist/react-16"
556
560
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "storybook-builder-rsbuild",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.3",
4
4
  "description": "Rsbuild builder for Storybook",
5
5
  "keywords": [
6
6
  "storybook",
7
7
  "rsbuild",
8
8
  "rspack"
9
9
  ],
10
- "homepage": "https://storybook-rsbuild.netlify.app",
10
+ "homepage": "https://storybook.rsbuild.dev",
11
11
  "bugs": {
12
12
  "url": "https://github.com/rspack-contrib/storybook-rsbuild/issues"
13
13
  },
@@ -57,14 +57,14 @@
57
57
  "!src/**/*"
58
58
  ],
59
59
  "dependencies": {
60
- "@rsbuild/plugin-type-check": "^1.2.1",
61
- "@storybook/addon-docs": "^9.0.0-alpha.17",
62
- "@storybook/core-webpack": "^9.0.0-alpha.17",
60
+ "@rsbuild/plugin-type-check": "^1.2.2",
61
+ "@storybook/addon-docs": "^9.0.4",
62
+ "@storybook/core-webpack": "^9.0.4",
63
63
  "browser-assert": "^1.2.1",
64
64
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
65
65
  "cjs-module-lexer": "^1.4.3",
66
66
  "constants-browserify": "^1.0.0",
67
- "es-module-lexer": "^1.6.0",
67
+ "es-module-lexer": "^1.7.0",
68
68
  "find-cache-dir": "^5.0.0",
69
69
  "fs-extra": "^11.3.0",
70
70
  "magic-string": "^0.30.17",
@@ -78,21 +78,29 @@
78
78
  "util-deprecate": "^1.0.2"
79
79
  },
80
80
  "devDependencies": {
81
- "@rsbuild/core": "^1.2.19",
81
+ "@rsbuild/core": "^1.3.22",
82
82
  "@types/find-cache-dir": "^5.0.2",
83
83
  "@types/fs-extra": "^11.0.4",
84
- "@types/node": "^18.0.0",
84
+ "@types/node": "^18.19.110",
85
85
  "@types/pretty-hrtime": "^1.0.3",
86
86
  "pretty-hrtime": "^1.0.3",
87
87
  "slash": "^5.1.0",
88
- "storybook": "9.0.0-alpha.17",
89
- "typescript": "^5.7.3"
88
+ "storybook": "9.0.4",
89
+ "typescript": "^5.8.3"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@rsbuild/core": "^1.0.1",
93
- "storybook": "^9.0.0-alpha.17"
93
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
94
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
95
+ "storybook": "^9.0.0"
94
96
  },
95
97
  "peerDependenciesMeta": {
98
+ "react": {
99
+ "optional": true
100
+ },
101
+ "react-dom": {
102
+ "optional": true
103
+ },
96
104
  "typescript": {
97
105
  "optional": true
98
106
  }