@modern-js/storybook-builder 0.0.0-nightly-20231128170637 → 0.0.0-nightly-20231130170642

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.
@@ -224,6 +224,12 @@ async function applyMdxLoader(config, options) {
224
224
  var _rules;
225
225
  (_rules = (_config_module = config.module).rules) !== null && _rules !== void 0 ? _rules : _config_module.rules = [];
226
226
  config.module.rules.push({
227
+ resourceQuery: /raw/,
228
+ type: "asset/source"
229
+ }, {
230
+ test: /\.md$/,
231
+ type: "asset/source"
232
+ }, {
227
233
  test: /(stories|story)\.mdx$/,
228
234
  use: [
229
235
  {
@@ -346,18 +352,16 @@ function addonAdapter(api, options) {
346
352
  const getOptions = (plugin) => Array.isArray(plugin) ? plugin[1] : null;
347
353
  const replaceOrInsert = (plugin, plugins) => {
348
354
  const pluginName = getPluginName(plugin);
349
- const append = [];
350
355
  for (let i = 0; i < plugins.length; i++) {
351
356
  if (getPluginName(plugins[i]) === pluginName) {
352
357
  if (getOptions(plugin)) {
353
358
  import_utils.logger.info(`Detected duplicated babel plugin or presets: ${pluginName}, overrides with the new one`);
354
359
  plugins[i] = plugin;
355
360
  }
356
- } else {
357
- append.push(plugin);
361
+ return;
358
362
  }
359
363
  }
360
- plugins.push(...append);
364
+ plugins.push(plugin);
361
365
  };
362
366
  const currentPlugins = config.plugins || [];
363
367
  const currentPresets = config.presets || [];
@@ -368,18 +372,12 @@ function addonAdapter(api, options) {
368
372
  replaceOrInsert(preset, currentPresets);
369
373
  }
370
374
  const finalConfig2 = {
371
- ...config,
372
375
  ...babelOptions,
373
376
  plugins: currentPlugins,
374
377
  presets: currentPresets
375
378
  };
376
- if (typeof userConfig === "function") {
377
- return userConfig(finalConfig2, utils);
378
- } else if (typeof userConfig === "object") {
379
- return {
380
- ...finalConfig2,
381
- ...userConfig
382
- };
379
+ if (userConfig) {
380
+ return (0, import_utils.applyOptionsChain)(finalConfig2, userConfig, utils);
383
381
  } else {
384
382
  return finalConfig2;
385
383
  }
@@ -225,6 +225,14 @@ async function applyMdxLoader(config, options) {
225
225
  (_d = config.module) != null ? _d : config.module = {};
226
226
  (_f = (_e = config.module).rules) != null ? _f : _e.rules = [];
227
227
  config.module.rules.push(
228
+ {
229
+ resourceQuery: /raw/,
230
+ type: "asset/source"
231
+ },
232
+ {
233
+ test: /\.md$/,
234
+ type: "asset/source"
235
+ },
228
236
  {
229
237
  test: /(stories|story)\.mdx$/,
230
238
  use: [
@@ -365,7 +373,6 @@ function addonAdapter(api, options) {
365
373
  const getOptions = (plugin) => Array.isArray(plugin) ? plugin[1] : null;
366
374
  const replaceOrInsert = (plugin, plugins) => {
367
375
  const pluginName = getPluginName(plugin);
368
- const append = [];
369
376
  for (let i = 0; i < plugins.length; i++) {
370
377
  if (getPluginName(plugins[i]) === pluginName) {
371
378
  if (getOptions(plugin)) {
@@ -374,11 +381,10 @@ function addonAdapter(api, options) {
374
381
  );
375
382
  plugins[i] = plugin;
376
383
  }
377
- } else {
378
- append.push(plugin);
384
+ return;
379
385
  }
380
386
  }
381
- plugins.push(...append);
387
+ plugins.push(plugin);
382
388
  };
383
389
  const currentPlugins = config.plugins || [];
384
390
  const currentPresets = config.presets || [];
@@ -389,15 +395,12 @@ function addonAdapter(api, options) {
389
395
  replaceOrInsert(preset, currentPresets);
390
396
  }
391
397
  const finalConfig2 = {
392
- ...config,
393
398
  ...babelOptions,
394
399
  plugins: currentPlugins,
395
400
  presets: currentPresets
396
401
  };
397
- if (typeof userConfig === "function") {
398
- return userConfig(finalConfig2, utils);
399
- } else if (typeof userConfig === "object") {
400
- return { ...finalConfig2, ...userConfig };
402
+ if (userConfig) {
403
+ return applyOptionsChain(finalConfig2, userConfig, utils);
401
404
  } else {
402
405
  return finalConfig2;
403
406
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/storybook-builder",
3
- "version": "0.0.0-nightly-20231128170637",
3
+ "version": "0.0.0-nightly-20231130170642",
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-canary-a9e7d87-20231127152134",
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-nightly-20231128170637",
75
- "@modern-js/builder-shared": "0.0.0-nightly-20231128170637",
76
- "@modern-js/runtime": "0.0.0-nightly-20231128170637",
77
- "@modern-js/utils": "0.0.0-nightly-20231128170637",
78
- "@modern-js/core": "0.0.0-nightly-20231128170637"
74
+ "@modern-js/builder": "0.0.0-nightly-20231130170642",
75
+ "@modern-js/core": "0.0.0-nightly-20231130170642",
76
+ "@modern-js/runtime": "0.0.0-nightly-20231130170642",
77
+ "@modern-js/builder-shared": "0.0.0-nightly-20231130170642",
78
+ "@modern-js/utils": "0.0.0-nightly-20231130170642"
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-nightly-20231128170637",
87
- "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231128170637",
88
- "@modern-js/core": "0.0.0-nightly-20231128170637",
89
- "@scripts/build": "0.0.0-nightly-20231128170637"
86
+ "@modern-js/core": "0.0.0-nightly-20231130170642",
87
+ "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231130170642",
88
+ "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231130170642",
89
+ "@scripts/build": "0.0.0-nightly-20231130170642"
90
90
  },
91
91
  "peerDependencies": {
92
- "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231128170637",
93
- "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231128170637"
92
+ "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231130170642",
93
+ "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231130170642"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "@modern-js/builder-webpack-provider": {