@modern-js/storybook-builder 0.0.0-next-20231127105004 → 0.0.0-next-20231129181734

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.
@@ -346,16 +346,18 @@ function addonAdapter(api, options) {
346
346
  const getOptions = (plugin) => Array.isArray(plugin) ? plugin[1] : null;
347
347
  const replaceOrInsert = (plugin, plugins) => {
348
348
  const pluginName = getPluginName(plugin);
349
+ const append = [];
349
350
  for (let i = 0; i < plugins.length; i++) {
350
351
  if (getPluginName(plugins[i]) === pluginName) {
351
352
  if (getOptions(plugin)) {
352
353
  import_utils.logger.info(`Detected duplicated babel plugin or presets: ${pluginName}, overrides with the new one`);
353
354
  plugins[i] = plugin;
354
355
  }
355
- return;
356
+ } else {
357
+ append.push(plugin);
356
358
  }
357
359
  }
358
- plugins.push(plugin);
360
+ plugins.push(...append);
359
361
  };
360
362
  const currentPlugins = config.plugins || [];
361
363
  const currentPresets = config.presets || [];
@@ -366,12 +368,18 @@ function addonAdapter(api, options) {
366
368
  replaceOrInsert(preset, currentPresets);
367
369
  }
368
370
  const finalConfig2 = {
371
+ ...config,
369
372
  ...babelOptions,
370
373
  plugins: currentPlugins,
371
374
  presets: currentPresets
372
375
  };
373
- if (userConfig) {
374
- return (0, import_utils.applyOptionsChain)(finalConfig2, userConfig, utils);
376
+ if (typeof userConfig === "function") {
377
+ return userConfig(finalConfig2, utils);
378
+ } else if (typeof userConfig === "object") {
379
+ return {
380
+ ...finalConfig2,
381
+ ...userConfig
382
+ };
375
383
  } else {
376
384
  return finalConfig2;
377
385
  }
@@ -365,6 +365,7 @@ function addonAdapter(api, options) {
365
365
  const getOptions = (plugin) => Array.isArray(plugin) ? plugin[1] : null;
366
366
  const replaceOrInsert = (plugin, plugins) => {
367
367
  const pluginName = getPluginName(plugin);
368
+ const append = [];
368
369
  for (let i = 0; i < plugins.length; i++) {
369
370
  if (getPluginName(plugins[i]) === pluginName) {
370
371
  if (getOptions(plugin)) {
@@ -373,10 +374,11 @@ function addonAdapter(api, options) {
373
374
  );
374
375
  plugins[i] = plugin;
375
376
  }
376
- return;
377
+ } else {
378
+ append.push(plugin);
377
379
  }
378
380
  }
379
- plugins.push(plugin);
381
+ plugins.push(...append);
380
382
  };
381
383
  const currentPlugins = config.plugins || [];
382
384
  const currentPresets = config.presets || [];
@@ -387,12 +389,15 @@ function addonAdapter(api, options) {
387
389
  replaceOrInsert(preset, currentPresets);
388
390
  }
389
391
  const finalConfig2 = {
392
+ ...config,
390
393
  ...babelOptions,
391
394
  plugins: currentPlugins,
392
395
  presets: currentPresets
393
396
  };
394
- if (userConfig) {
395
- return applyOptionsChain(finalConfig2, userConfig, utils);
397
+ if (typeof userConfig === "function") {
398
+ return userConfig(finalConfig2, utils);
399
+ } else if (typeof userConfig === "object") {
400
+ return { ...finalConfig2, ...userConfig };
396
401
  } else {
397
402
  return finalConfig2;
398
403
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/storybook-builder",
3
- "version": "0.0.0-next-20231127105004",
3
+ "version": "0.0.0-next-20231129181734",
4
4
  "description": "modern.js support for storybook",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "license": "MIT",
53
53
  "dependencies": {
54
- "@rspack/dev-client": "0.4.0",
54
+ "@rspack/dev-client": "0.4.1",
55
55
  "@storybook/components": "^7.5.1",
56
56
  "@storybook/core-common": "^7.5.1",
57
57
  "@storybook/csf-plugin": "^7.5.1",
@@ -71,11 +71,11 @@
71
71
  "serve-static": "^1.14.1",
72
72
  "tinypool": "^0.8.0",
73
73
  "webpack-hot-middleware": "^2.25.4",
74
- "@modern-js/builder": "0.0.0-next-20231127105004",
75
- "@modern-js/builder-shared": "0.0.0-next-20231127105004",
76
- "@modern-js/core": "0.0.0-next-20231127105004",
77
- "@modern-js/utils": "0.0.0-next-20231127105004",
78
- "@modern-js/runtime": "0.0.0-next-20231127105004"
74
+ "@modern-js/builder": "0.0.0-next-20231129181734",
75
+ "@modern-js/builder-shared": "0.0.0-next-20231129181734",
76
+ "@modern-js/core": "0.0.0-next-20231129181734",
77
+ "@modern-js/runtime": "0.0.0-next-20231129181734",
78
+ "@modern-js/utils": "0.0.0-next-20231129181734"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@storybook/types": "^7.5.1",
@@ -83,14 +83,14 @@
83
83
  "@types/serve-static": "^1.13.10",
84
84
  "@types/webpack-hot-middleware": "^2.25.6",
85
85
  "typescript": "^5.2.2",
86
- "@modern-js/builder-rspack-provider": "0.0.0-next-20231127105004",
87
- "@modern-js/builder-webpack-provider": "0.0.0-next-20231127105004",
88
- "@modern-js/core": "0.0.0-next-20231127105004",
89
- "@scripts/build": "0.0.0-next-20231127105004"
86
+ "@modern-js/builder-webpack-provider": "0.0.0-next-20231129181734",
87
+ "@modern-js/builder-rspack-provider": "0.0.0-next-20231129181734",
88
+ "@modern-js/core": "0.0.0-next-20231129181734",
89
+ "@scripts/build": "0.0.0-next-20231129181734"
90
90
  },
91
91
  "peerDependencies": {
92
- "@modern-js/builder-webpack-provider": "0.0.0-next-20231127105004",
93
- "@modern-js/builder-rspack-provider": "0.0.0-next-20231127105004"
92
+ "@modern-js/builder-webpack-provider": "0.0.0-next-20231129181734",
93
+ "@modern-js/builder-rspack-provider": "0.0.0-next-20231129181734"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "@modern-js/builder-webpack-provider": {