storybook-addon-rslib 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/preset.js +3 -47
  2. package/package.json +5 -8
package/dist/preset.js CHANGED
@@ -23,59 +23,15 @@ __export(preset_exports, {
23
23
  rsbuildFinal: () => rsbuildFinal
24
24
  });
25
25
  module.exports = __toCommonJS(preset_exports);
26
- var import_core3 = require("@rsbuild/core");
27
- var import_core4 = require("@rslib/core");
28
-
29
- // src/mf.ts
30
26
  var import_core = require("@rsbuild/core");
31
27
  var import_core2 = require("@rslib/core");
32
- async function startMFDevServer(config) {
33
- if (process.env.NODE_ENV === "production") {
34
- return;
35
- }
36
- const rsbuildInstance = await initMFRsbuild(config);
37
- return rsbuildInstance;
38
- }
39
- async function initMFRsbuild(rslibConfig) {
40
- const rsbuildConfigObject = await (0, import_core2.unstable_composeCreateRsbuildConfig)(rslibConfig);
41
- const mfRsbuildConfig = rsbuildConfigObject.find(
42
- (config) => config.format === "mf"
43
- );
44
- if (!mfRsbuildConfig) {
45
- return;
46
- }
47
- mfRsbuildConfig.config = changeEnvToDev(mfRsbuildConfig.config);
48
- const rsbuildInstance = await (0, import_core.createRsbuild)({
49
- rsbuildConfig: mfRsbuildConfig.config
50
- });
51
- await rsbuildInstance.startDevServer();
52
- return rsbuildInstance;
53
- }
54
- function changeEnvToDev(rsbuildConfig) {
55
- return (0, import_core.mergeRsbuildConfig)(rsbuildConfig, {
56
- mode: "development",
57
- dev: {
58
- writeToDisk: true
59
- },
60
- tools: {
61
- rspack: {
62
- optimization: {
63
- nodeEnv: "development"
64
- }
65
- }
66
- }
67
- });
68
- }
69
-
70
- // src/preset.ts
71
28
  var rsbuildFinal = async (config, options) => {
72
29
  const { rslib = {} } = options;
73
30
  const { cwd, configPath, libIndex = 0 } = rslib;
74
- const rslibConfig = await (0, import_core4.loadConfig)({
31
+ const rslibConfig = await (0, import_core2.loadConfig)({
75
32
  cwd,
76
33
  path: configPath
77
34
  });
78
- await startMFDevServer(rslibConfig);
79
35
  const libConfig = libIndex === false ? {} : rslibConfig.lib[libIndex];
80
36
  if (!libConfig) {
81
37
  throw new Error(
@@ -83,14 +39,14 @@ var rsbuildFinal = async (config, options) => {
83
39
  );
84
40
  }
85
41
  const { lib: _lib, ...nonLibConfig } = rslibConfig;
86
- const mergedLibConfig = (0, import_core3.mergeRsbuildConfig)(
42
+ const mergedLibConfig = (0, import_core.mergeRsbuildConfig)(
87
43
  nonLibConfig,
88
44
  libConfig
89
45
  );
90
46
  delete mergedLibConfig.source?.entry;
91
47
  delete mergedLibConfig.output?.distPath;
92
48
  delete mergedLibConfig.output?.filename;
93
- return (0, import_core3.mergeRsbuildConfig)(config, mergedLibConfig);
49
+ return (0, import_core.mergeRsbuildConfig)(config, mergedLibConfig);
94
50
  };
95
51
  // Annotate the CommonJS export names for ESM import in node:
96
52
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-addon-rslib",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Storybook addon for loading configuration of Rslib",
5
5
  "keywords": [
6
6
  "storybook",
@@ -37,12 +37,12 @@
37
37
  "!src/**/*"
38
38
  ],
39
39
  "devDependencies": {
40
- "@rsbuild/core": "1.0.19",
41
- "@rslib/core": "^0.0.16",
40
+ "@rsbuild/core": "^1.1.0",
41
+ "@rslib/core": "^0.0.18",
42
42
  "@types/node": "^18.0.0",
43
- "storybook": "8.4.0-alpha.7",
43
+ "storybook": "8.5.0-alpha.3",
44
44
  "typescript": "^5.6.3",
45
- "storybook-builder-rsbuild": "0.1.3"
45
+ "storybook-builder-rsbuild": "0.1.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@rsbuild/core": "^1.0.1",
@@ -54,9 +54,6 @@
54
54
  "optional": true
55
55
  }
56
56
  },
57
- "engines": {
58
- "node": ">=18.0.0"
59
- },
60
57
  "publishConfig": {
61
58
  "access": "public"
62
59
  },