@modern-js/storybook-builder 2.40.0 → 2.42.0

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/cjs/core.js CHANGED
@@ -26,15 +26,19 @@ var import_core = require("@modern-js/core");
26
26
  var import_utils = require("./utils");
27
27
  var import_plugin_storybook = require("./plugin-storybook");
28
28
  async function getCompiler(cwd, builderOptions, options) {
29
- const bundler = builderOptions.bundler || "webpack";
29
+ const { bundler } = builderOptions;
30
30
  const { presets } = options;
31
31
  const entries = await presets.apply("entries", []);
32
32
  const res = await (0, import_utils.runWithErrorMsg)(() => (0, import_core.loadConfig)(cwd, builderOptions.configPath || (0, import_utils.getConfigFileName)()), "Failed to load config");
33
33
  const loadedConfig = res ? res.config : {};
34
34
  const finalConfig = await presets.apply("modern", loadedConfig) || loadedConfig;
35
- const provider = await (0, import_utils.getProvider)(bundler, finalConfig);
35
+ const provider = await (0, import_utils.getProvider)(bundler, (0, import_builder.mergeBuilderConfig)(finalConfig, builderOptions.builderConfig) || {});
36
36
  if (!provider) {
37
- throw new Error(`@modern-js/builder-${bundler}-provider not found `);
37
+ if (bundler) {
38
+ throw new Error(`You choose to use ${bundler}, but @modern-js/builder-${bundler}-provider not found in your project, please install it`);
39
+ } else {
40
+ throw new Error(`Please install one provider first, try install @modern-js/builder-rspack-provider or @modern-js/builder-webpack-provider first`);
41
+ }
38
42
  }
39
43
  const builder = await (0, import_builder.createBuilder)(provider, {
40
44
  cwd,
@@ -89,6 +89,7 @@ const pluginStorybook = (cwd, options) => {
89
89
  await applyCsfPlugin(config, options);
90
90
  };
91
91
  if ("modifyWebpackConfig" in api) {
92
+ addonAdapter(api, options);
92
93
  api.modifyWebpackConfig(modifyConfig);
93
94
  api.modifyWebpackChain(async (chain) => {
94
95
  await (0, import_docgen.applyDocgenWebpack)(chain, options);
@@ -223,6 +224,12 @@ async function applyMdxLoader(config, options) {
223
224
  var _rules;
224
225
  (_rules = (_config_module = config.module).rules) !== null && _rules !== void 0 ? _rules : _config_module.rules = [];
225
226
  config.module.rules.push({
227
+ resourceQuery: /raw/,
228
+ type: "asset/source"
229
+ }, {
230
+ test: /\.md$/,
231
+ type: "asset/source"
232
+ }, {
226
233
  test: /(stories|story)\.mdx$/,
227
234
  use: [
228
235
  {
@@ -253,7 +260,7 @@ function applyExternals(builderConfig) {
253
260
  }
254
261
  }, {
255
262
  output: {
256
- externals: import_globals.globals
263
+ externals: import_globals.globalsNameReferenceMap
257
264
  }
258
265
  });
259
266
  builderConfig.output = config.output;
@@ -330,6 +337,57 @@ async function watchStories(patterns, cwd, writeModule) {
330
337
  ]);
331
338
  return watcher;
332
339
  }
340
+ function addonAdapter(api, options) {
341
+ const { presets } = options;
342
+ api.modifyBuilderConfig(async (finalConfig) => {
343
+ var _finalConfig;
344
+ const babelOptions = await presets.apply("babel", {}, {
345
+ ...options
346
+ });
347
+ var _tools;
348
+ (_tools = (_finalConfig = finalConfig).tools) !== null && _tools !== void 0 ? _tools : _finalConfig.tools = {};
349
+ const userConfig = finalConfig.tools.babel;
350
+ finalConfig.tools.babel = (config, utils) => {
351
+ const getPluginName = (plugin) => Array.isArray(plugin) ? plugin[0] : plugin;
352
+ const getOptions = (plugin) => Array.isArray(plugin) ? plugin[1] : null;
353
+ const replaceOrInsert = (plugin, plugins) => {
354
+ const pluginName = getPluginName(plugin);
355
+ for (let i = 0; i < plugins.length; i++) {
356
+ if (getPluginName(plugins[i]) === pluginName) {
357
+ if (getOptions(plugin)) {
358
+ import_utils.logger.info(`Detected duplicated babel plugin or presets: ${pluginName}, overrides with the new one`);
359
+ plugins[i] = plugin;
360
+ }
361
+ return;
362
+ }
363
+ }
364
+ plugins.push(plugin);
365
+ };
366
+ const currentPlugins = config.plugins || [];
367
+ const currentPresets = config.presets || [];
368
+ for (const plugin of babelOptions.plugins || []) {
369
+ replaceOrInsert(plugin, currentPlugins);
370
+ }
371
+ for (const preset of babelOptions.presets || []) {
372
+ replaceOrInsert(preset, currentPresets);
373
+ }
374
+ const finalConfig2 = {
375
+ ...babelOptions,
376
+ plugins: currentPlugins,
377
+ presets: currentPresets
378
+ };
379
+ if (userConfig) {
380
+ return (0, import_utils.applyOptionsChain)(finalConfig2, userConfig, utils);
381
+ } else {
382
+ return finalConfig2;
383
+ }
384
+ };
385
+ });
386
+ api.modifyWebpackConfig(async (config) => {
387
+ const finalDefaultConfig = await presets.apply("webpackFinal", config, options);
388
+ return finalDefaultConfig;
389
+ });
390
+ }
333
391
  // Annotate the CommonJS export names for ESM import in node:
334
392
  0 && (module.exports = {
335
393
  finalize,
@@ -48,7 +48,7 @@ const entries = async (_, options) => {
48
48
  if (options.configType === "DEVELOPMENT") {
49
49
  result.push(...[
50
50
  `${require.resolve("webpack-hot-middleware/client")}?reload=true&quiet=false&noInfo=${options.quiet}`,
51
- bundler === "rspack" ? require.resolve("@rspack/dev-client/react-refresh-entry") : null
51
+ bundler === "rspack" ? require.resolve("@rspack/plugin-react-refresh/react-refresh-entry") : null
52
52
  ].filter(Boolean));
53
53
  }
54
54
  result.push(getStoriesConfigPath(process.cwd()));
package/dist/cjs/utils.js CHANGED
@@ -59,14 +59,15 @@ async function getProvider(bundler, builderConfig) {
59
59
  return builderWebpackProvider({
60
60
  builderConfig
61
61
  });
62
- } else {
62
+ } else if (bundler === "rspack") {
63
63
  const { builderRspackProvider } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-rspack-provider")));
64
64
  return builderRspackProvider({
65
65
  builderConfig
66
66
  });
67
+ } else {
68
+ return await getProvider("webpack", builderConfig) || await getProvider("rspack", builderConfig);
67
69
  }
68
70
  } catch (e) {
69
- import_utils.logger.error(`Cannot find provider, you need to install @modern-js/builder-${bundler}-provider first`);
70
71
  }
71
72
  }
72
73
  async function virtualModule(tempDir, cwd, virtualModuleMap) {
package/dist/esm/core.js CHANGED
@@ -1,9 +1,9 @@
1
- import { createBuilder } from "@modern-js/builder";
1
+ import { createBuilder, mergeBuilderConfig } from "@modern-js/builder";
2
2
  import { loadConfig } from "@modern-js/core";
3
3
  import { getConfigFileName, getProvider, runWithErrorMsg } from "./utils";
4
4
  import { pluginStorybook } from "./plugin-storybook";
5
5
  async function getCompiler(cwd, builderOptions, options) {
6
- const bundler = builderOptions.bundler || "webpack";
6
+ const { bundler } = builderOptions;
7
7
  const { presets } = options;
8
8
  const entries = await presets.apply("entries", []);
9
9
  const res = await runWithErrorMsg(
@@ -12,9 +12,20 @@ async function getCompiler(cwd, builderOptions, options) {
12
12
  );
13
13
  const loadedConfig = res ? res.config : {};
14
14
  const finalConfig = await presets.apply("modern", loadedConfig) || loadedConfig;
15
- const provider = await getProvider(bundler, finalConfig);
15
+ const provider = await getProvider(
16
+ bundler,
17
+ mergeBuilderConfig(finalConfig, builderOptions.builderConfig) || {}
18
+ );
16
19
  if (!provider) {
17
- throw new Error(`@modern-js/builder-${bundler}-provider not found `);
20
+ if (bundler) {
21
+ throw new Error(
22
+ `You choose to use ${bundler}, but @modern-js/builder-${bundler}-provider not found in your project, please install it`
23
+ );
24
+ } else {
25
+ throw new Error(
26
+ `Please install one provider first, try install @modern-js/builder-rspack-provider or @modern-js/builder-webpack-provider first`
27
+ );
28
+ }
18
29
  }
19
30
  const builder = await createBuilder(provider, {
20
31
  cwd,
@@ -1,5 +1,11 @@
1
1
  import { isAbsolute, join, resolve } from "path";
2
- import { slash, watch, globby, applyOptionsChain } from "@modern-js/utils";
2
+ import {
3
+ slash,
4
+ watch,
5
+ globby,
6
+ applyOptionsChain,
7
+ logger
8
+ } from "@modern-js/utils";
3
9
  import {
4
10
  mergeBuilderConfig
5
11
  } from "@modern-js/builder-shared";
@@ -10,7 +16,7 @@ import {
10
16
  readTemplate,
11
17
  loadPreviewOrConfigFile
12
18
  } from "@storybook/core-common";
13
- import { globals } from "@storybook/preview/globals";
19
+ import { globalsNameReferenceMap } from "@storybook/preview/globals";
14
20
  import { unplugin as csfPlugin } from "@storybook/csf-plugin";
15
21
  import { minimatch } from "minimatch";
16
22
  import {
@@ -73,6 +79,7 @@ const pluginStorybook = (cwd, options) => {
73
79
  await applyCsfPlugin(config, options);
74
80
  };
75
81
  if ("modifyWebpackConfig" in api) {
82
+ addonAdapter(api, options);
76
83
  api.modifyWebpackConfig(modifyConfig);
77
84
  api.modifyWebpackChain(async (chain) => {
78
85
  await applyDocgenWebpack(chain, options);
@@ -218,6 +225,14 @@ async function applyMdxLoader(config, options) {
218
225
  (_d = config.module) != null ? _d : config.module = {};
219
226
  (_f = (_e = config.module).rules) != null ? _f : _e.rules = [];
220
227
  config.module.rules.push(
228
+ {
229
+ resourceQuery: /raw/,
230
+ type: "asset/source"
231
+ },
232
+ {
233
+ test: /\.md$/,
234
+ type: "asset/source"
235
+ },
221
236
  {
222
237
  test: /(stories|story)\.mdx$/,
223
238
  use: [
@@ -253,7 +268,7 @@ function applyExternals(builderConfig) {
253
268
  },
254
269
  {
255
270
  output: {
256
- externals: globals
271
+ externals: globalsNameReferenceMap
257
272
  }
258
273
  }
259
274
  );
@@ -346,6 +361,60 @@ async function watchStories(patterns, cwd, writeModule) {
346
361
  );
347
362
  return watcher;
348
363
  }
364
+ function addonAdapter(api, options) {
365
+ const { presets } = options;
366
+ api.modifyBuilderConfig(async (finalConfig) => {
367
+ var _a;
368
+ const babelOptions = await presets.apply("babel", {}, { ...options });
369
+ (_a = finalConfig.tools) != null ? _a : finalConfig.tools = {};
370
+ const userConfig = finalConfig.tools.babel;
371
+ finalConfig.tools.babel = (config, utils) => {
372
+ const getPluginName = (plugin) => Array.isArray(plugin) ? plugin[0] : plugin;
373
+ const getOptions = (plugin) => Array.isArray(plugin) ? plugin[1] : null;
374
+ const replaceOrInsert = (plugin, plugins) => {
375
+ const pluginName = getPluginName(plugin);
376
+ for (let i = 0; i < plugins.length; i++) {
377
+ if (getPluginName(plugins[i]) === pluginName) {
378
+ if (getOptions(plugin)) {
379
+ logger.info(
380
+ `Detected duplicated babel plugin or presets: ${pluginName}, overrides with the new one`
381
+ );
382
+ plugins[i] = plugin;
383
+ }
384
+ return;
385
+ }
386
+ }
387
+ plugins.push(plugin);
388
+ };
389
+ const currentPlugins = config.plugins || [];
390
+ const currentPresets = config.presets || [];
391
+ for (const plugin of babelOptions.plugins || []) {
392
+ replaceOrInsert(plugin, currentPlugins);
393
+ }
394
+ for (const preset of babelOptions.presets || []) {
395
+ replaceOrInsert(preset, currentPresets);
396
+ }
397
+ const finalConfig2 = {
398
+ ...babelOptions,
399
+ plugins: currentPlugins,
400
+ presets: currentPresets
401
+ };
402
+ if (userConfig) {
403
+ return applyOptionsChain(finalConfig2, userConfig, utils);
404
+ } else {
405
+ return finalConfig2;
406
+ }
407
+ };
408
+ });
409
+ api.modifyWebpackConfig(async (config) => {
410
+ const finalDefaultConfig = await presets.apply(
411
+ "webpackFinal",
412
+ config,
413
+ options
414
+ );
415
+ return finalDefaultConfig;
416
+ });
417
+ }
349
418
  export {
350
419
  finalize,
351
420
  pluginStorybook
@@ -14,7 +14,7 @@ const entries = async (_, options) => {
14
14
  result.push(
15
15
  ...[
16
16
  `${require.resolve("webpack-hot-middleware/client")}?reload=true&quiet=false&noInfo=${options.quiet}`,
17
- bundler === "rspack" ? require.resolve("@rspack/dev-client/react-refresh-entry") : null
17
+ bundler === "rspack" ? require.resolve("@rspack/plugin-react-refresh/react-refresh-entry") : null
18
18
  ].filter(Boolean)
19
19
  );
20
20
  }
package/dist/esm/utils.js CHANGED
@@ -15,16 +15,15 @@ async function getProvider(bundler, builderConfig) {
15
15
  return builderWebpackProvider({
16
16
  builderConfig
17
17
  });
18
- } else {
18
+ } else if (bundler === "rspack") {
19
19
  const { builderRspackProvider } = await import("@modern-js/builder-rspack-provider");
20
20
  return builderRspackProvider({
21
21
  builderConfig
22
22
  });
23
+ } else {
24
+ return await getProvider("webpack", builderConfig) || await getProvider("rspack", builderConfig);
23
25
  }
24
26
  } catch (e) {
25
- logger.error(
26
- `Cannot find provider, you need to install @modern-js/builder-${bundler}-provider first`
27
- );
28
27
  }
29
28
  }
30
29
  async function virtualModule(tempDir, cwd, virtualModuleMap) {
@@ -2,4 +2,4 @@
2
2
  import type { Plugin } from '@modern-js/runtime';
3
3
  import type { IConfig } from '../type';
4
4
  export declare const WrapProviders: (storyFn: any, config: IConfig) => JSX.Element;
5
- export declare const resolvePlugins: (runtime: IConfig['modernConfigRuntime']) => Plugin[];
5
+ export declare const resolvePlugins: (runtime: IConfig['modernConfigRuntime']) => Plugin[];
@@ -1 +1 @@
1
- export declare const ADDON_ID = "storybook/modern-runtime";
1
+ export declare const ADDON_ID = "storybook/modern-runtime";
@@ -1,2 +1,2 @@
1
1
  declare const _default: {};
2
- export default _default;
2
+ export default _default;
@@ -1 +1 @@
1
- export declare const decorators: import("@storybook/types").DecoratorFunction[];
1
+ export declare const decorators: import("@storybook/types").DecoratorFunction[];
@@ -1,4 +1,4 @@
1
1
  export interface IConfig {
2
- modernConfigRuntime: any;
3
- modernConfigDesignToken: any;
4
- }
2
+ modernConfigRuntime: any;
3
+ modernConfigDesignToken: any;
4
+ }
@@ -1,2 +1,2 @@
1
1
  import { DecoratorFunction } from '@storybook/types';
2
- export declare const withPluginRuntime: DecoratorFunction;
2
+ export declare const withPluginRuntime: DecoratorFunction;
@@ -4,4 +4,4 @@ export type StorybookBuilder = RawStorybookBuilder<BuilderOptions, Stats>;
4
4
  export declare const getConfig: StorybookBuilder['getConfig'];
5
5
  export declare const build: StorybookBuilder['build'];
6
6
  export declare const start: StorybookBuilder['start'];
7
- export declare const bail: () => Promise<void>;
7
+ export declare const bail: () => Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import type { Options } from '@storybook/types';
2
2
  import type { Compiler } from '@modern-js/builder-shared/webpack-dev-middleware';
3
3
  import type { BuilderOptions } from './types';
4
- export declare function getCompiler(cwd: string, builderOptions: BuilderOptions, options: Options): Promise<Compiler>;
4
+ export declare function getCompiler(cwd: string, builderOptions: BuilderOptions, options: Options): Promise<Compiler>;
@@ -11,4 +11,4 @@
11
11
  import type { NodePath } from 'ast-types/lib/node-path';
12
12
  import type { Importer } from 'react-docgen/dist/parse';
13
13
  import type Documentation from 'react-docgen/dist/Documentation';
14
- export default function actualNameHandler(documentation: Documentation, path: NodePath, importer: Importer): void;
14
+ export default function actualNameHandler(documentation: Documentation, path: NodePath, importer: Importer): void;
@@ -2,8 +2,8 @@ import type { Options } from '@storybook/types';
2
2
  import { RspackConfig } from '@modern-js/builder-rspack-provider';
3
3
  import { WebpackChain } from '@modern-js/builder-webpack-provider';
4
4
  export type DocgenOptions = {
5
- reactDocgen?: 'react-docgen' | 'react-docgen-typescript' | false;
6
- reactDocgenTypescriptOptions?: any;
5
+ reactDocgen?: 'react-docgen' | 'react-docgen-typescript' | false;
6
+ reactDocgenTypescriptOptions?: any;
7
7
  };
8
8
  export declare function applyDocgenWebpack(chain: WebpackChain, options: Options): Promise<void>;
9
- export declare function applyDocgenRspack(config: RspackConfig, options: Options): Promise<void>;
9
+ export declare function applyDocgenRspack(config: RspackConfig, options: Options): Promise<void>;
@@ -1,2 +1,2 @@
1
1
  declare function docLoader(this: any, source: string, map: string, data: any): Promise<void>;
2
- export default docLoader;
2
+ export default docLoader;
@@ -1,10 +1,6 @@
1
- declare const _default: ({
2
- source,
3
- map,
4
- filename
5
- }: {
6
- source: string;
7
- map: string;
8
- filename: string;
1
+ declare const _default: ({ source, map, filename, }: {
2
+ source: string;
3
+ map: string;
4
+ filename: string;
9
5
  }) => string[] | null;
10
- export default _default;
6
+ export default _default;
@@ -1,3 +1,3 @@
1
1
  export { start, build, bail, getConfig } from './build';
2
2
  export * from './types';
3
- export declare const corePresets: string[];
3
+ export declare const corePresets: string[];
@@ -3,4 +3,4 @@ import type { Options } from '@storybook/types';
3
3
  import type { BuilderPluginAPI as WebpackAPI } from '@modern-js/builder-webpack-provider';
4
4
  import type { BuilderPluginAPI as RspackAPI } from '@modern-js/builder-rspack-provider';
5
5
  export declare function finalize(): Promise<void>;
6
- export declare const pluginStorybook: (cwd: string, options: Options) => BuilderPlugin<WebpackAPI | RspackAPI>;
6
+ export declare const pluginStorybook: (cwd: string, options: Options) => BuilderPlugin<WebpackAPI | RspackAPI>;
@@ -2,4 +2,4 @@ import type { Options } from '@storybook/types';
2
2
  import { BuilderConfig } from './types';
3
3
  export declare const previewMainTemplate: () => string;
4
4
  export declare const entries: (_: unknown, options: Options) => Promise<string[]>;
5
- export declare const modern: (builderConfig: BuilderConfig, options: Options) => BuilderConfig;
5
+ export declare const modern: (builderConfig: BuilderConfig, options: Options) => BuilderConfig;
@@ -5,11 +5,11 @@ export type BundlerType = 'webpack' | 'rspack';
5
5
  export type { WebpackBuilderConfig, RspackBuilderConfig };
6
6
  export type AllBuilderConfig = WebpackBuilderConfig | RspackBuilderConfig;
7
7
  export type BuilderOptions = {
8
- bundler?: BundlerType;
9
- builderConfig?: AllBuilderConfig;
10
- configPath?: string;
8
+ bundler?: BundlerType;
9
+ builderConfig?: AllBuilderConfig;
10
+ configPath?: string;
11
11
  };
12
12
  export type BuilderConfig = AllBuilderConfig & {
13
- builderPlugins?: BuilderPlugin[];
13
+ builderPlugins?: BuilderPlugin[];
14
14
  };
15
- export { defineConfig } from '@modern-js/builder/cli';
15
+ export { defineConfig } from '@modern-js/builder/cli';
@@ -1,13 +1,15 @@
1
+ import { BuilderWebpackProvider } from '@modern-js/builder-webpack-provider';
2
+ import { BuilderRspackProvider } from '@modern-js/builder-rspack-provider';
1
3
  import { AllBuilderConfig } from './types';
2
4
  export declare const VIRTUAL_MODULE_BASE = ".MODERN_STORYBOOK";
3
5
  export declare const STORIES_FILENAME = "storybook-stories.js";
4
6
  export declare const STORYBOOK_CONFIG_ENTRY = "storybook-config-entry.js";
5
7
  export declare const requireResolve: (importer: string, path: string) => void;
6
- export declare function getProvider(bundler: 'webpack' | 'rspack', builderConfig: AllBuilderConfig): Promise<import("@modern-js/builder-webpack-provider").BuilderWebpackProvider | import("@modern-js/builder-rspack-provider").BuilderRspackProvider | undefined>;
8
+ export declare function getProvider(bundler: 'webpack' | 'rspack' | undefined, builderConfig: AllBuilderConfig): Promise<BuilderWebpackProvider | BuilderRspackProvider | undefined>;
7
9
  export declare function virtualModule(tempDir: string, cwd: string, virtualModuleMap: Record<string, string>): Promise<[Record<string, string>, (p: string, content: string) => void]>;
8
10
  export declare function toImportFn(cwd: string, stories: string[]): Promise<string>;
9
11
  export declare function getAbsolutePath<I extends string>(input: I): I;
10
12
  export declare function maybeGetAbsolutePath<I extends string>(input: I): I | false;
11
13
  export declare function runWithErrorMsg<T>(op: () => Promise<T>, msg: string): Promise<T | undefined>;
12
14
  export declare function isDev(): boolean;
13
- export declare function getConfigFileName(): string;
15
+ export declare function getConfigFileName(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/storybook-builder",
3
- "version": "2.40.0",
3
+ "version": "2.42.0",
4
4
  "description": "modern.js support for storybook",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,19 +17,19 @@
17
17
  ],
18
18
  "exports": {
19
19
  ".": {
20
- "jsnext:source": "./src/index.ts",
21
20
  "types": "./dist/types/index.d.ts",
21
+ "jsnext:source": "./src/index.ts",
22
22
  "default": "./dist/cjs/index.js"
23
23
  },
24
24
  "./preset": "./dist/esm/preset.js",
25
25
  "./addons": {
26
- "jsnext:source": "./src/addons/preset/preview.ts",
27
26
  "types": "./dist/types/addons/preset/preview.d.ts",
27
+ "jsnext:source": "./src/addons/preset/preview.ts",
28
28
  "default": "./dist/esm/addons/preset/preview.js"
29
29
  },
30
30
  "./types": {
31
- "jsnext:source": "./src/types.ts",
32
31
  "types": "./dist/types/types.d.ts",
32
+ "jsnext:source": "./src/types.ts",
33
33
  "default": "./dist/cjs/types.js"
34
34
  },
35
35
  "./templates/preview.ejs": "./templates/preview.ejs",
@@ -51,18 +51,18 @@
51
51
  },
52
52
  "license": "MIT",
53
53
  "dependencies": {
54
- "@rspack/dev-client": "0.3.2",
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",
54
+ "@rspack/plugin-react-refresh": "0.4.2",
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,22 +71,34 @@
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": "2.40.0",
75
- "@modern-js/builder-shared": "2.40.0",
76
- "@modern-js/core": "2.40.0",
77
- "@modern-js/runtime": "2.40.0",
78
- "@modern-js/utils": "2.40.0"
74
+ "@modern-js/builder": "2.42.0",
75
+ "@modern-js/builder-shared": "2.42.0",
76
+ "@modern-js/utils": "2.42.0",
77
+ "@modern-js/runtime": "2.42.0",
78
+ "@modern-js/core": "2.42.0"
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": "2.40.0",
87
- "@modern-js/builder-webpack-provider": "2.40.0",
88
- "@modern-js/core": "2.40.0",
89
- "@scripts/build": "2.40.0"
86
+ "@modern-js/builder-webpack-provider": "2.42.0",
87
+ "@modern-js/builder-rspack-provider": "2.42.0",
88
+ "@modern-js/core": "2.42.0",
89
+ "@scripts/build": "2.42.0"
90
+ },
91
+ "peerDependencies": {
92
+ "@modern-js/builder-webpack-provider": "^2.42.0",
93
+ "@modern-js/builder-rspack-provider": "^2.42.0"
94
+ },
95
+ "peerDependenciesMeta": {
96
+ "@modern-js/builder-webpack-provider": {
97
+ "optional": true
98
+ },
99
+ "@modern-js/builder-rspack-provider": {
100
+ "optional": true
101
+ }
90
102
  },
91
103
  "publishConfig": {
92
104
  "registry": "https://registry.npmjs.org/",
@@ -27,13 +27,13 @@ window.__STORYBOOK_CLIENT_API__ = new ClientApi({ storyStore: preview.storyStore
27
27
 
28
28
  preview.initialize({ importFn, getProjectAnnotations });
29
29
 
30
- if (import.meta.webpackHot) {
31
- import.meta.webpackHot.accept('./{{storiesFilename}}', () => {
30
+ if (module.hot) {
31
+ module.hot.accept('./{{storiesFilename}}', () => {
32
32
  // importFn has changed so we need to patch the new one in
33
33
  preview.onStoriesChanged({ importFn });
34
34
  });
35
35
 
36
- import.meta.webpackHot.accept([
36
+ module.hot.accept([
37
37
  {{#each previewAnnotations}}'{{this}}',
38
38
  {{/each}}
39
39
  ], () => {