storybook-addon-rslib 3.4.0 → 3.4.2

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
@@ -28,8 +28,9 @@ interface AddonOptions {
28
28
  */
29
29
  modifyLibConfig?: (config: LibConfig) => void;
30
30
  /**
31
- * Modify the Rsbuild config transformed from lib config before merging with Storybook
32
- * config. You can modify the configuration in the config parameters in place.
31
+ * Modify the Rsbuild config transformed from lib config after inherited fields are stripped
32
+ * and before merging with Storybook config. You can modify the configuration in the config
33
+ * parameters in place, including explicitly restoring stripped fields.
33
34
  * @experimental subject to change at any time
34
35
  * @default undefined
35
36
  */
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_c02e18c6a5b2c61d from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_c02e18c6a5b2c61d from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_c02e18c6a5b2c61d from "node:module";
1
+ import CJS_COMPAT_NODE_URL_dde08712c3d45749 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_dde08712c3d45749 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_dde08712c3d45749 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_c02e18c6a5b2c61d.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_c02e18c6a5b2c61d.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_c02e18c6a5b2c61d.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_dde08712c3d45749.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_dde08712c3d45749.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_dde08712c3d45749.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_c02e18c6a5b2c61d from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_c02e18c6a5b2c61d from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_c02e18c6a5b2c61d from "node:module";
1
+ import CJS_COMPAT_NODE_URL_dde08712c3d45749 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_dde08712c3d45749 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_dde08712c3d45749 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_c02e18c6a5b2c61d.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_c02e18c6a5b2c61d.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_c02e18c6a5b2c61d.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_dde08712c3d45749.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_dde08712c3d45749.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_dde08712c3d45749.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,6 +13,9 @@ var require = CJS_COMPAT_NODE_MODULE_c02e18c6a5b2c61d.createRequire(import.meta.
13
13
  // src/preset.ts
14
14
  import { mergeRsbuildConfig } from "@rsbuild/core";
15
15
  import { loadConfig } from "@rslib/core";
16
+ import {
17
+ stripInheritedConfig
18
+ } from "storybook-builder-rsbuild";
16
19
  var rsbuildFinal = async (config, options) => {
17
20
  let { rslib = {} } = options, {
18
21
  cwd,
@@ -23,7 +26,7 @@ var rsbuildFinal = async (config, options) => {
23
26
  } = rslib, { content } = await loadConfig({
24
27
  cwd,
25
28
  path: configPath
26
- }), libConfig = libIndex === !1 ? {} : content.lib[libIndex];
29
+ }), libConfigs = content.lib === void 0 ? [{}] : content.lib, libConfig = libIndex === !1 ? {} : Array.isArray(libConfigs) ? libConfigs[libIndex] : void 0;
27
30
  if (!libConfig)
28
31
  throw new Error(
29
32
  `Lib config not found at index ${libIndex}, expect a lib config but got ${libConfig}`
@@ -33,7 +36,7 @@ var rsbuildFinal = async (config, options) => {
33
36
  nonLibConfig,
34
37
  libConfig
35
38
  );
36
- return delete mergedLibConfig.source?.entry, delete mergedLibConfig.output?.distPath, delete mergedLibConfig.output?.filename, delete mergedLibConfig.output?.cleanDistPath, delete mergedLibConfig.output?.externals, delete mergedLibConfig.server?.publicDir, delete mergedLibConfig.dev?.progressBar, delete mergedLibConfig.output?.assetPrefix, delete mergedLibConfig.dev?.assetPrefix, typeof modifyLibRsbuildConfig == "function" && modifyLibRsbuildConfig(mergedLibConfig), mergeRsbuildConfig(config, mergedLibConfig);
39
+ return stripInheritedConfig(mergedLibConfig, "the loaded Rslib config"), typeof modifyLibRsbuildConfig == "function" && modifyLibRsbuildConfig(mergedLibConfig), mergeRsbuildConfig(config, mergedLibConfig);
37
40
  };
38
41
  export {
39
42
  rsbuildFinal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-addon-rslib",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "Storybook addon for loading configuration of Rslib",
5
5
  "keywords": [
6
6
  "storybook",
@@ -36,17 +36,17 @@
36
36
  "!src/**/*"
37
37
  ],
38
38
  "devDependencies": {
39
- "@rsbuild/core": "^2.1.9",
39
+ "@rsbuild/core": "^2.1.10",
40
40
  "@rslib/core": "^0.23.2",
41
41
  "@types/node": "^22.0.0",
42
42
  "storybook": "10.5.5",
43
43
  "typescript": "^5.9.3",
44
- "storybook-builder-rsbuild": "3.4.0"
44
+ "storybook-builder-rsbuild": "3.4.2"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@rsbuild/core": "^1.5.0 || ^2.0.0-0",
48
48
  "@rslib/core": ">= 0.1.1 || >= 0.2",
49
- "storybook-builder-rsbuild": "*"
49
+ "storybook-builder-rsbuild": "^3.4.2"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "typescript": {