storybook-builder-rsbuild 2.1.2 → 2.1.4

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.js CHANGED
@@ -365,15 +365,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
365
365
  ...storybookPaths
366
366
  }
367
367
  },
368
- // Reset `config.source.entry` field, do not use provided entry
369
- // see https://github.com/rspack-contrib/storybook-rsbuild/issues/43
370
368
  source: {
371
- entry: {
372
- main: [...entries ?? [], ...dynamicEntries]
373
- },
374
- // TODO: Rspack doesn't support virtual modules yet, use cache dir instead
375
- // we needed to explicitly set the module in `node_modules` to be compiled
376
- include: [/[\\/]node_modules[\\/].*[\\/]storybook-config-entry\.js/],
377
369
  define: {
378
370
  ...(0, import_common2.stringifyProcessEnvs)(envs),
379
371
  NODE_ENV: JSON.stringify(process.env.NODE_ENV)
@@ -400,7 +392,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
400
392
  }))
401
393
  ].filter(Boolean),
402
394
  tools: {
403
- rspack: (config, { addRules, appendPlugins, rspack: rspack2, mergeConfig }) => {
395
+ rspack: (config, { addRules, rspack: rspack2, mergeConfig }) => {
404
396
  addRules({
405
397
  test: /\.stories\.([tj])sx?$|(stories|story)\.mdx$/,
406
398
  exclude: /node_modules/,
@@ -454,8 +446,9 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
454
446
  "rspack.experiments.VirtualModulesPlugin requires at least 1.5.0 version of @rsbuild/core, please upgrade or downgrade storybook-rsbuild-builder to lower version."
455
447
  );
456
448
  }
457
- appendPlugins(
458
- [
449
+ config.plugins ??= [];
450
+ config.plugins.push(
451
+ ...[
459
452
  Object.keys(virtualModuleMapping).length > 0 ? new rspack2.experiments.VirtualModulesPlugin(
460
453
  virtualModuleMapping
461
454
  ) : null,
@@ -508,6 +501,10 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
508
501
  }
509
502
  }
510
503
  });
504
+ rsbuildConfig.source ??= {};
505
+ rsbuildConfig.source.entry = {
506
+ main: [...entries ?? [], ...dynamicEntries]
507
+ };
511
508
  return rsbuildConfig;
512
509
  };
513
510
 
@@ -538,7 +535,7 @@ var getIsReactVersion18or19 = async (options) => {
538
535
  var applyReactShims = async (config, options) => {
539
536
  const isReactVersion18 = await getIsReactVersion18or19(options);
540
537
  if (isReactVersion18) {
541
- return void 0;
538
+ return {};
542
539
  }
543
540
  return {
544
541
  resolve: {
package/dist/index.mjs CHANGED
@@ -314,15 +314,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
314
314
  ...storybookPaths
315
315
  }
316
316
  },
317
- // Reset `config.source.entry` field, do not use provided entry
318
- // see https://github.com/rspack-contrib/storybook-rsbuild/issues/43
319
317
  source: {
320
- entry: {
321
- main: [...entries ?? [], ...dynamicEntries]
322
- },
323
- // TODO: Rspack doesn't support virtual modules yet, use cache dir instead
324
- // we needed to explicitly set the module in `node_modules` to be compiled
325
- include: [/[\\/]node_modules[\\/].*[\\/]storybook-config-entry\.js/],
326
318
  define: {
327
319
  ...stringifyProcessEnvs(envs),
328
320
  NODE_ENV: JSON.stringify(process.env.NODE_ENV)
@@ -349,7 +341,7 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
349
341
  }))
350
342
  ].filter(Boolean),
351
343
  tools: {
352
- rspack: (config, { addRules, appendPlugins, rspack: rspack2, mergeConfig }) => {
344
+ rspack: (config, { addRules, rspack: rspack2, mergeConfig }) => {
353
345
  addRules({
354
346
  test: /\.stories\.([tj])sx?$|(stories|story)\.mdx$/,
355
347
  exclude: /node_modules/,
@@ -405,8 +397,9 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
405
397
  "rspack.experiments.VirtualModulesPlugin requires at least 1.5.0 version of @rsbuild/core, please upgrade or downgrade storybook-rsbuild-builder to lower version."
406
398
  );
407
399
  }
408
- appendPlugins(
409
- [
400
+ config.plugins ??= [];
401
+ config.plugins.push(
402
+ ...[
410
403
  Object.keys(virtualModuleMapping).length > 0 ? new rspack2.experiments.VirtualModulesPlugin(
411
404
  virtualModuleMapping
412
405
  ) : null,
@@ -459,6 +452,10 @@ var iframe_rsbuild_config_default = async (options, extraWebpackConfig) => {
459
452
  }
460
453
  }
461
454
  });
455
+ rsbuildConfig.source ??= {};
456
+ rsbuildConfig.source.entry = {
457
+ main: [...entries ?? [], ...dynamicEntries]
458
+ };
462
459
  return rsbuildConfig;
463
460
  };
464
461
  var getIsReactVersion18or19 = async (options) => {
@@ -485,7 +482,7 @@ var getIsReactVersion18or19 = async (options) => {
485
482
  var applyReactShims = async (config, options) => {
486
483
  const isReactVersion18 = await getIsReactVersion18or19(options);
487
484
  if (isReactVersion18) {
488
- return void 0;
485
+ return {};
489
486
  }
490
487
  return {
491
488
  resolve: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-builder-rsbuild",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Rsbuild builder for Storybook",
5
5
  "keywords": [
6
6
  "storybook",
@@ -58,15 +58,15 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "@rsbuild/plugin-type-check": "^1.2.4",
61
- "@storybook/addon-docs": "^9.1.7",
62
- "@storybook/core-webpack": "^9.1.7",
61
+ "@storybook/addon-docs": "^9.1.15",
62
+ "@storybook/core-webpack": "^9.1.15",
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
67
  "es-module-lexer": "^1.7.0",
68
68
  "fs-extra": "^11.3.2",
69
- "magic-string": "^0.30.19",
69
+ "magic-string": "^0.30.21",
70
70
  "path-browserify": "^1.0.1",
71
71
  "process": "^0.11.10",
72
72
  "rsbuild-plugin-html-minifier-terser": "^1.1.2",
@@ -77,7 +77,7 @@
77
77
  "util-deprecate": "^1.0.2"
78
78
  },
79
79
  "devDependencies": {
80
- "@rsbuild/core": "^1.5.11",
80
+ "@rsbuild/core": "^1.5.17",
81
81
  "@types/find-cache-dir": "^5.0.2",
82
82
  "@types/fs-extra": "^11.0.4",
83
83
  "@types/node": "^18.19.110",
@@ -85,8 +85,8 @@
85
85
  "find-cache-dir": "^5.0.0",
86
86
  "pretty-hrtime": "^1.0.3",
87
87
  "slash": "^5.1.0",
88
- "storybook": "9.1.5",
89
- "typescript": "^5.9.2"
88
+ "storybook": "9.1.10",
89
+ "typescript": "^5.9.3"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@rsbuild/core": "^1.5.0",