storybook-addon-rslib 2.1.5 → 3.0.0-beta.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 CHANGED
@@ -1,40 +1,3 @@
1
- import { RsbuildConfig } from '@rsbuild/core';
2
- import { LibConfig } from '@rslib/core';
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
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
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_67415b8ec8dab7f5 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_67415b8ec8dab7f5 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_67415b8ec8dab7f5 from "node:module";
15
4
 
16
- // src/index.ts
17
- var src_exports = {};
18
- module.exports = __toCommonJS(src_exports);
5
+ var __filename = CJS_COMPAT_NODE_URL_67415b8ec8dab7f5.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_67415b8ec8dab7f5.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_67415b8ec8dab7f5.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
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
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_67415b8ec8dab7f5 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_67415b8ec8dab7f5 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_67415b8ec8dab7f5 from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_67415b8ec8dab7f5.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_67415b8ec8dab7f5.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_67415b8ec8dab7f5.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
- var preset_exports = {};
22
- __export(preset_exports, {
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
- const { rslib = {} } = options;
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
- const libConfig = libIndex === false ? {} : content.lib[libIndex];
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
- if (typeof modifyLibConfig === "function") {
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
- // Annotate the CommonJS export names for ESM import in node:
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": "2.1.5",
3
+ "version": "3.0.0-beta.1",
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
- "node": "./dist/index.js",
26
- "require": "./dist/index.js",
27
- "import": "./dist/index.mjs"
26
+ "default": "./dist/index.js"
28
27
  },
29
- "./preset": "./dist/preset.js",
30
- "./package.json": "./package.json"
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": "^18.19.110",
45
- "storybook": "9.1.10",
43
+ "@types/node": "^22.0.0",
44
+ "storybook": "10.0.7",
46
45
  "typescript": "^5.9.3",
47
- "storybook-builder-rsbuild": "2.1.5"
46
+ "storybook-builder-rsbuild": "3.0.0-beta.1"
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 --optimized",
71
- "check": "jiti ../../scripts/prepare/check.ts",
72
- "prep": "jiti ../../scripts/prepare/bundle.ts"
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
- module.exports = require('./dist/preset')
1
+ export * from './dist/preset.js'
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
-
package/dist/preset.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { StorybookConfigRsbuild } from 'storybook-builder-rsbuild';
2
-
3
- declare const rsbuildFinal: StorybookConfigRsbuild['rsbuildFinal'];
4
-
5
- export { rsbuildFinal };