storybook-addon-rslib 2.0.0 → 2.0.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 +17 -1
- package/dist/preset.js +15 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import { RsbuildConfig } from '@rsbuild/core';
|
2
|
+
import { LibConfig } from '@rslib/core';
|
3
|
+
|
1
4
|
interface AddonOptions {
|
2
5
|
rslib?: {
|
3
6
|
/**
|
@@ -14,10 +17,23 @@ interface AddonOptions {
|
|
14
17
|
* The lib config index in `lib` field to use, will be merged with the other fields in the config.
|
15
18
|
* Set to a number to use the lib config at that index.
|
16
19
|
* Set to `false` to disable using the lib config.
|
17
|
-
* @experimental subject to change at any time
|
18
20
|
* @default 0
|
19
21
|
*/
|
20
22
|
libIndex?: number | false;
|
23
|
+
/**
|
24
|
+
* Modify the Rslib lib config before transforming it to Rsbuild config which will be merged
|
25
|
+
* with Storybook. You can modify the configuration in the config parameters in place.
|
26
|
+
* @experimental subject to change at any time
|
27
|
+
* @default undefined
|
28
|
+
*/
|
29
|
+
modifyLibConfig?: (config: LibConfig) => void;
|
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.
|
33
|
+
* @experimental subject to change at any time
|
34
|
+
* @default undefined
|
35
|
+
*/
|
36
|
+
modifyLibRsbuildConfig?: (config: RsbuildConfig) => void;
|
21
37
|
};
|
22
38
|
}
|
23
39
|
|
package/dist/preset.js
CHANGED
@@ -27,7 +27,13 @@ var import_core = require("@rsbuild/core");
|
|
27
27
|
var import_core2 = require("@rslib/core");
|
28
28
|
var rsbuildFinal = async (config, options) => {
|
29
29
|
const { rslib = {} } = options;
|
30
|
-
const {
|
30
|
+
const {
|
31
|
+
cwd,
|
32
|
+
configPath,
|
33
|
+
libIndex = 0,
|
34
|
+
modifyLibConfig,
|
35
|
+
modifyLibRsbuildConfig
|
36
|
+
} = rslib;
|
31
37
|
const { content } = await (0, import_core2.loadConfig)({
|
32
38
|
cwd,
|
33
39
|
path: configPath
|
@@ -38,6 +44,9 @@ var rsbuildFinal = async (config, options) => {
|
|
38
44
|
`Lib config not found at index ${libIndex}, expect a lib config but got ${libConfig}`
|
39
45
|
);
|
40
46
|
}
|
47
|
+
if (typeof modifyLibConfig === "function") {
|
48
|
+
modifyLibConfig(libConfig);
|
49
|
+
}
|
41
50
|
const { lib: _lib, ...nonLibConfig } = content;
|
42
51
|
const mergedLibConfig = (0, import_core.mergeRsbuildConfig)(
|
43
52
|
nonLibConfig,
|
@@ -46,6 +55,11 @@ var rsbuildFinal = async (config, options) => {
|
|
46
55
|
delete mergedLibConfig.source?.entry;
|
47
56
|
delete mergedLibConfig.output?.distPath;
|
48
57
|
delete mergedLibConfig.output?.filename;
|
58
|
+
delete mergedLibConfig.output?.assetPrefix;
|
59
|
+
delete mergedLibConfig.dev?.assetPrefix;
|
60
|
+
if (typeof modifyLibRsbuildConfig === "function") {
|
61
|
+
modifyLibRsbuildConfig(mergedLibConfig);
|
62
|
+
}
|
49
63
|
return (0, import_core.mergeRsbuildConfig)(config, mergedLibConfig);
|
50
64
|
};
|
51
65
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "storybook-addon-rslib",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.1",
|
4
4
|
"description": "Storybook addon for loading configuration of Rslib",
|
5
5
|
"keywords": [
|
6
6
|
"storybook",
|
@@ -44,7 +44,7 @@
|
|
44
44
|
"@types/node": "^18.19.110",
|
45
45
|
"storybook": "9.0.4",
|
46
46
|
"typescript": "^5.8.3",
|
47
|
-
"storybook-builder-rsbuild": "2.0.
|
47
|
+
"storybook-builder-rsbuild": "2.0.1"
|
48
48
|
},
|
49
49
|
"peerDependencies": {
|
50
50
|
"@rsbuild/core": "^1.0.1",
|