storybook-addon-rslib 2.1.6 → 3.0.0-beta.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 +3 -40
- package/dist/index.js +10 -17
- package/dist/preset.js +22 -55
- package/package.json +11 -12
- package/preset.js +1 -1
- package/dist/index.mjs +0 -1
- package/dist/preset.d.ts +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface AddonOptions {
|
|
5
|
-
rslib?: {
|
|
6
|
-
/**
|
|
7
|
-
* `cwd` passed to loadConfig of Rslib
|
|
8
|
-
* @default undefined
|
|
9
|
-
*/
|
|
10
|
-
cwd?: string;
|
|
11
|
-
/**
|
|
12
|
-
* `path` passed to loadConfig of Rslib
|
|
13
|
-
* @default undefined
|
|
14
|
-
*/
|
|
15
|
-
configPath?: string;
|
|
16
|
-
/**
|
|
17
|
-
* The lib config index in `lib` field to use, will be merged with the other fields in the config.
|
|
18
|
-
* Set to a number to use the lib config at that index.
|
|
19
|
-
* Set to `false` to disable using the lib config.
|
|
20
|
-
* @default 0
|
|
21
|
-
*/
|
|
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;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { AddonOptions };
|
|
1
|
+
// auto generated file from file:///Users/bytedance/Projects/storybook-rsbuild/scripts/build/utils/generate-type-mappers.ts, do not edit
|
|
2
|
+
export * from '../src/index.ts';
|
|
3
|
+
export type * from '../src/index.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
import CJS_COMPAT_NODE_URL_a2ed18b302464553 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_a2ed18b302464553 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_a2ed18b302464553 from "node:module";
|
|
15
4
|
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_a2ed18b302464553.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_a2ed18b302464553.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_a2ed18b302464553.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
package/dist/preset.js
CHANGED
|
@@ -1,73 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
import CJS_COMPAT_NODE_URL_a2ed18b302464553 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_a2ed18b302464553 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_a2ed18b302464553 from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_a2ed18b302464553.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_a2ed18b302464553.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_a2ed18b302464553.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
19
12
|
|
|
20
13
|
// src/preset.ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
rsbuildFinal: () => rsbuildFinal
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(preset_exports);
|
|
26
|
-
var import_core = require("@rsbuild/core");
|
|
27
|
-
var import_core2 = require("@rslib/core");
|
|
14
|
+
import { mergeRsbuildConfig } from "@rsbuild/core";
|
|
15
|
+
import { loadConfig } from "@rslib/core";
|
|
28
16
|
var rsbuildFinal = async (config, options) => {
|
|
29
|
-
|
|
30
|
-
const {
|
|
17
|
+
let { rslib = {} } = options, {
|
|
31
18
|
cwd,
|
|
32
19
|
configPath,
|
|
33
20
|
libIndex = 0,
|
|
34
21
|
modifyLibConfig,
|
|
35
22
|
modifyLibRsbuildConfig
|
|
36
|
-
} = rslib
|
|
37
|
-
const { content } = await (0, import_core2.loadConfig)({
|
|
23
|
+
} = rslib, { content } = await loadConfig({
|
|
38
24
|
cwd,
|
|
39
25
|
path: configPath
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (!libConfig) {
|
|
26
|
+
}), libConfig = libIndex === !1 ? {} : content.lib[libIndex];
|
|
27
|
+
if (!libConfig)
|
|
43
28
|
throw new Error(
|
|
44
29
|
`Lib config not found at index ${libIndex}, expect a lib config but got ${libConfig}`
|
|
45
30
|
);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
modifyLibConfig(libConfig);
|
|
49
|
-
}
|
|
50
|
-
const { lib: _lib, ...nonLibConfig } = content;
|
|
51
|
-
const mergedLibConfig = (0, import_core.mergeRsbuildConfig)(
|
|
31
|
+
typeof modifyLibConfig == "function" && modifyLibConfig(libConfig);
|
|
32
|
+
let { lib: _lib, ...nonLibConfig } = content, mergedLibConfig = mergeRsbuildConfig(
|
|
52
33
|
nonLibConfig,
|
|
53
34
|
libConfig
|
|
54
35
|
);
|
|
55
|
-
delete mergedLibConfig.source?.entry;
|
|
56
|
-
delete mergedLibConfig.output?.distPath;
|
|
57
|
-
delete mergedLibConfig.output?.filename;
|
|
58
|
-
delete mergedLibConfig.output?.cleanDistPath;
|
|
59
|
-
delete mergedLibConfig.output?.assetPrefix;
|
|
60
|
-
delete mergedLibConfig.output?.externals;
|
|
61
|
-
delete mergedLibConfig.server?.publicDir;
|
|
62
|
-
delete mergedLibConfig.dev?.progressBar;
|
|
63
|
-
delete mergedLibConfig.output?.assetPrefix;
|
|
64
|
-
delete mergedLibConfig.dev?.assetPrefix;
|
|
65
|
-
if (typeof modifyLibRsbuildConfig === "function") {
|
|
66
|
-
modifyLibRsbuildConfig(mergedLibConfig);
|
|
67
|
-
}
|
|
68
|
-
return (0, import_core.mergeRsbuildConfig)(config, mergedLibConfig);
|
|
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.dev?.assetPrefix, typeof modifyLibRsbuildConfig == "function" && modifyLibRsbuildConfig(mergedLibConfig), mergeRsbuildConfig(config, mergedLibConfig);
|
|
69
37
|
};
|
|
70
|
-
|
|
71
|
-
0 && (module.exports = {
|
|
38
|
+
export {
|
|
72
39
|
rsbuildFinal
|
|
73
|
-
}
|
|
40
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-addon-rslib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "Storybook addon for loading configuration of Rslib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -19,15 +19,14 @@
|
|
|
19
19
|
"directory": "packages/addon-rslib"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
22
23
|
"exports": {
|
|
23
24
|
".": {
|
|
24
25
|
"types": "./dist/index.d.ts",
|
|
25
|
-
"
|
|
26
|
-
"require": "./dist/index.js",
|
|
27
|
-
"import": "./dist/index.mjs"
|
|
26
|
+
"default": "./dist/index.js"
|
|
28
27
|
},
|
|
29
|
-
"./
|
|
30
|
-
"./
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
"./preset": "./dist/preset.js"
|
|
31
30
|
},
|
|
32
31
|
"main": "dist/index.js",
|
|
33
32
|
"types": "dist/index.d.ts",
|
|
@@ -41,10 +40,10 @@
|
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"@rsbuild/core": "^1.5.17",
|
|
43
42
|
"@rslib/core": "^0.16.1",
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"storybook": "
|
|
43
|
+
"@types/node": "^22.0.0",
|
|
44
|
+
"storybook": "10.0.7",
|
|
46
45
|
"typescript": "^5.9.3",
|
|
47
|
-
"storybook-builder-rsbuild": "
|
|
46
|
+
"storybook-builder-rsbuild": "3.0.0-beta.2"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
49
|
"@rsbuild/core": "^1.5.0",
|
|
@@ -67,8 +66,8 @@
|
|
|
67
66
|
"platform": "node"
|
|
68
67
|
},
|
|
69
68
|
"scripts": {
|
|
70
|
-
"build": "pnpm run prep
|
|
71
|
-
"check": "jiti ../../scripts/
|
|
72
|
-
"prep": "jiti ../../scripts/
|
|
69
|
+
"build": "pnpm run prep",
|
|
70
|
+
"check": "jiti ../../scripts/check/check-package.ts",
|
|
71
|
+
"prep": "jiti ../../scripts/build/build-package.ts"
|
|
73
72
|
}
|
|
74
73
|
}
|
package/preset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './dist/preset.js'
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|