@modern-js/storybook-builder 0.0.0-nightly-20231129170639 → 0.0.0-nightly-20231201170631

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
  {
@@ -254,7 +260,7 @@ function applyExternals(builderConfig) {
254
260
  }
255
261
  }, {
256
262
  output: {
257
- externals: import_globals.globals
263
+ externals: import_globals.globalsNameReferenceMap
258
264
  }
259
265
  });
260
266
  builderConfig.output = config.output;
@@ -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
  }
@@ -16,7 +16,7 @@ import {
16
16
  readTemplate,
17
17
  loadPreviewOrConfigFile
18
18
  } from "@storybook/core-common";
19
- import { globals } from "@storybook/preview/globals";
19
+ import { globalsNameReferenceMap } from "@storybook/preview/globals";
20
20
  import { unplugin as csfPlugin } from "@storybook/csf-plugin";
21
21
  import { minimatch } from "minimatch";
22
22
  import {
@@ -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: [
@@ -260,7 +268,7 @@ function applyExternals(builderConfig) {
260
268
  },
261
269
  {
262
270
  output: {
263
- externals: globals
271
+ externals: globalsNameReferenceMap
264
272
  }
265
273
  }
266
274
  );
@@ -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-20231129170639",
3
+ "version": "0.0.0-nightly-20231201170631",
4
4
  "description": "modern.js support for storybook",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,17 +52,17 @@
52
52
  "license": "MIT",
53
53
  "dependencies": {
54
54
  "@rspack/dev-client": "0.4.1",
55
- "@storybook/components": "^7.5.1",
56
- "@storybook/core-common": "^7.5.1",
57
- "@storybook/csf-plugin": "^7.5.1",
58
- "@storybook/global": "^5.0.0",
59
- "@storybook/mdx1-csf": "^1.0.0",
60
- "@storybook/mdx2-csf": "^1.1.0",
61
- "@storybook/preview": "^7.5.1",
62
- "@storybook/preview-api": "^7.5.1",
55
+ "@storybook/components": "~7.6.1",
56
+ "@storybook/core-common": "~7.6.1",
57
+ "@storybook/csf-plugin": "~7.6.1",
58
+ "@storybook/global": "~5.0.0",
59
+ "@storybook/mdx1-csf": "~1.0.0",
60
+ "@storybook/mdx2-csf": "~1.1.0",
61
+ "@storybook/preview": "~7.6.1",
62
+ "@storybook/preview-api": "~7.6.1",
63
63
  "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.0c3f3b7.0",
64
- "@storybook/router": "^7.5.1",
65
- "@storybook/theming": "^7.5.1",
64
+ "@storybook/router": "~7.6.1",
65
+ "@storybook/theming": "~7.6.1",
66
66
  "ast-types": "^0.14.2",
67
67
  "minimatch": "^9.0.3",
68
68
  "react-docgen": "6.0.0-alpha.3",
@@ -71,26 +71,26 @@
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-20231129170639",
75
- "@modern-js/builder-shared": "0.0.0-nightly-20231129170639",
76
- "@modern-js/runtime": "0.0.0-nightly-20231129170639",
77
- "@modern-js/core": "0.0.0-nightly-20231129170639",
78
- "@modern-js/utils": "0.0.0-nightly-20231129170639"
74
+ "@modern-js/builder": "0.0.0-nightly-20231201170631",
75
+ "@modern-js/builder-shared": "0.0.0-nightly-20231201170631",
76
+ "@modern-js/runtime": "0.0.0-nightly-20231201170631",
77
+ "@modern-js/core": "0.0.0-nightly-20231201170631",
78
+ "@modern-js/utils": "0.0.0-nightly-20231201170631"
79
79
  },
80
80
  "devDependencies": {
81
- "@storybook/types": "^7.5.1",
81
+ "@storybook/types": "~7.6.1",
82
82
  "@types/babel__core": "^7.20.1",
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-20231129170639",
87
- "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231129170639",
88
- "@modern-js/core": "0.0.0-nightly-20231129170639",
89
- "@scripts/build": "0.0.0-nightly-20231129170639"
86
+ "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231201170631",
87
+ "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231201170631",
88
+ "@modern-js/core": "0.0.0-nightly-20231201170631",
89
+ "@scripts/build": "0.0.0-nightly-20231201170631"
90
90
  },
91
91
  "peerDependencies": {
92
- "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231129170639",
93
- "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231129170639"
92
+ "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231201170631",
93
+ "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231201170631"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "@modern-js/builder-webpack-provider": {