@storybook/nextjs 9.2.0-alpha.2 → 10.0.0-beta.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.
Files changed (86) hide show
  1. package/README.md +3 -1
  2. package/dist/_browser-chunks/chunk-I5RFHXDS.js +40 -0
  3. package/dist/_browser-chunks/chunk-JOMP7DUK.js +261 -0
  4. package/dist/_browser-chunks/chunk-L5NVL7MD.js +37 -0
  5. package/dist/_browser-chunks/react-18-G7Q4PNHD.js +71 -0
  6. package/dist/_node-chunks/chunk-24UYJEDD.js +74 -0
  7. package/dist/_node-chunks/chunk-EZEBG77A.js +88 -0
  8. package/dist/_node-chunks/chunk-WCSGFZKZ.js +17 -0
  9. package/dist/_node-chunks/chunk-YMVPQWBH.js +167 -0
  10. package/dist/_node-chunks/configureNextFont-HBRWHAUG.js +36 -0
  11. package/dist/_node-chunks/loader-KXTZ5PJ5.js +51 -0
  12. package/dist/_node-chunks/loader-Z4IXWF5M.js +64 -0
  13. package/dist/_node-chunks/utils-4LRBHVQD.js +31 -0
  14. package/dist/_node-chunks/webpack-6HAXGE7X.js +38 -0
  15. package/dist/_node-chunks/webpack-AGNCA7HZ.js +77 -0
  16. package/dist/_node-chunks/webpack-CXSD35E6.js +30 -0
  17. package/dist/_node-chunks/webpack-EWT6TRQB.js +26 -0
  18. package/dist/_node-chunks/webpack-K2R3GUFU.js +29 -0
  19. package/dist/_node-chunks/webpack-PD7PIB6X.js +43 -0
  20. package/dist/_node-chunks/webpack-QFTZE3CE.js +27 -0
  21. package/dist/_node-chunks/webpack-SWQY6JJY.js +107 -0
  22. package/dist/compatibility/draft-mode.compat.js +7 -1
  23. package/dist/export-mocks/cache/index.d.ts +309 -1
  24. package/dist/export-mocks/cache/index.js +22 -1
  25. package/dist/export-mocks/headers/index.d.ts +309 -1
  26. package/dist/export-mocks/headers/index.js +77 -1
  27. package/dist/export-mocks/index.js +20 -1
  28. package/dist/export-mocks/navigation/index.d.ts +8 -1
  29. package/dist/export-mocks/navigation/index.js +88 -1
  30. package/dist/export-mocks/router/index.d.ts +2 -2
  31. package/dist/export-mocks/router/index.js +97 -1
  32. package/dist/font/webpack/loader/storybook-nextjs-font-loader.js +201 -14
  33. package/dist/image-context.js +8 -1
  34. package/dist/images/next-image.js +35 -1
  35. package/dist/images/next-legacy-image.js +21 -1
  36. package/dist/index.d.ts +53 -8
  37. package/dist/index.js +20237 -45
  38. package/dist/next-image-loader-stub.js +33 -1
  39. package/dist/node/index.d.ts +27 -6
  40. package/dist/node/index.js +23 -1
  41. package/dist/preset.js +830 -1
  42. package/dist/preview.d.ts +3 -18
  43. package/dist/preview.d.tsx +18 -0
  44. package/dist/preview.js +11 -1
  45. package/dist/rsc/server-only.js +7 -1
  46. package/dist/swc/next-swc-loader-patch.js +136 -1
  47. package/package.json +41 -122
  48. package/preset.js +1 -1
  49. package/template/cli/js/Configure.mdx +11 -11
  50. package/template/cli/ts/Configure.mdx +11 -11
  51. package/dist/chunk-2TZKD6A5.mjs +0 -20
  52. package/dist/chunk-ETFXNGLC.mjs +0 -3
  53. package/dist/chunk-L66KIASX.mjs +0 -3
  54. package/dist/chunk-NQ32RFK2.mjs +0 -6
  55. package/dist/compatibility/draft-mode.compat.d.ts +0 -1
  56. package/dist/compatibility/draft-mode.compat.mjs +0 -2
  57. package/dist/export-mocks/cache/index.mjs +0 -10
  58. package/dist/export-mocks/headers/index.mjs +0 -12
  59. package/dist/export-mocks/index.d.ts +0 -7
  60. package/dist/export-mocks/index.mjs +0 -11
  61. package/dist/export-mocks/navigation/index.mjs +0 -11
  62. package/dist/export-mocks/router/index.mjs +0 -10
  63. package/dist/font/webpack/loader/storybook-nextjs-font-loader.d.ts +0 -3
  64. package/dist/font/webpack/loader/storybook-nextjs-font-loader.mjs +0 -56
  65. package/dist/image-context.d.ts +0 -13
  66. package/dist/image-context.mjs +0 -6
  67. package/dist/images/decorator.d.ts +0 -6
  68. package/dist/images/decorator.js +0 -1
  69. package/dist/images/decorator.mjs +0 -2
  70. package/dist/images/next-image.d.ts +0 -28
  71. package/dist/images/next-image.mjs +0 -9
  72. package/dist/images/next-legacy-image.d.ts +0 -6
  73. package/dist/images/next-legacy-image.mjs +0 -9
  74. package/dist/index.d-ff220430.d.ts +0 -310
  75. package/dist/index.mjs +0 -58
  76. package/dist/next-image-loader-stub.d.ts +0 -10
  77. package/dist/next-image-loader-stub.mjs +0 -7
  78. package/dist/node/index.mjs +0 -5
  79. package/dist/preset.d.ts +0 -14
  80. package/dist/preview.mjs +0 -3
  81. package/dist/react-18-WSPZ3BUV.mjs +0 -7
  82. package/dist/rsc/server-only.d.ts +0 -3
  83. package/dist/rsc/server-only.mjs +0 -5
  84. package/dist/swc/next-swc-loader-patch.d.ts +0 -21
  85. package/dist/swc/next-swc-loader-patch.mjs +0 -8
  86. package/dist/types-f6ea2c09.d.ts +0 -54
@@ -0,0 +1,167 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ __name
14
+ } from "./chunk-WCSGFZKZ.js";
15
+
16
+ // ../../core/src/shared/utils/module.ts
17
+ import { fileURLToPath, pathToFileURL } from "node:url";
18
+
19
+ // ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
20
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
21
+ function normalizeWindowsPath(input = "") {
22
+ if (!input) {
23
+ return input;
24
+ }
25
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
26
+ }
27
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
28
+ var _UNC_REGEX = /^[/\\]{2}/;
29
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
30
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
31
+ var normalize = /* @__PURE__ */ __name(function(path2) {
32
+ if (path2.length === 0) {
33
+ return ".";
34
+ }
35
+ path2 = normalizeWindowsPath(path2);
36
+ const isUNCPath = path2.match(_UNC_REGEX);
37
+ const isPathAbsolute = isAbsolute(path2);
38
+ const trailingSeparator = path2[path2.length - 1] === "/";
39
+ path2 = normalizeString(path2, !isPathAbsolute);
40
+ if (path2.length === 0) {
41
+ if (isPathAbsolute) {
42
+ return "/";
43
+ }
44
+ return trailingSeparator ? "./" : ".";
45
+ }
46
+ if (trailingSeparator) {
47
+ path2 += "/";
48
+ }
49
+ if (_DRIVE_LETTER_RE.test(path2)) {
50
+ path2 += "/";
51
+ }
52
+ if (isUNCPath) {
53
+ if (!isPathAbsolute) {
54
+ return `//./${path2}`;
55
+ }
56
+ return `//${path2}`;
57
+ }
58
+ return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
59
+ }, "normalize");
60
+ var join = /* @__PURE__ */ __name(function(...arguments_) {
61
+ if (arguments_.length === 0) {
62
+ return ".";
63
+ }
64
+ let joined;
65
+ for (const argument of arguments_) {
66
+ if (argument && argument.length > 0) {
67
+ if (joined === void 0) {
68
+ joined = argument;
69
+ } else {
70
+ joined += `/${argument}`;
71
+ }
72
+ }
73
+ }
74
+ if (joined === void 0) {
75
+ return ".";
76
+ }
77
+ return normalize(joined.replace(/\/\/+/g, "/"));
78
+ }, "join");
79
+ function normalizeString(path2, allowAboveRoot) {
80
+ let res = "";
81
+ let lastSegmentLength = 0;
82
+ let lastSlash = -1;
83
+ let dots = 0;
84
+ let char = null;
85
+ for (let index = 0; index <= path2.length; ++index) {
86
+ if (index < path2.length) {
87
+ char = path2[index];
88
+ } else if (char === "/") {
89
+ break;
90
+ } else {
91
+ char = "/";
92
+ }
93
+ if (char === "/") {
94
+ if (lastSlash === index - 1 || dots === 1) ;
95
+ else if (dots === 2) {
96
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
97
+ if (res.length > 2) {
98
+ const lastSlashIndex = res.lastIndexOf("/");
99
+ if (lastSlashIndex === -1) {
100
+ res = "";
101
+ lastSegmentLength = 0;
102
+ } else {
103
+ res = res.slice(0, lastSlashIndex);
104
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
105
+ }
106
+ lastSlash = index;
107
+ dots = 0;
108
+ continue;
109
+ } else if (res.length > 0) {
110
+ res = "";
111
+ lastSegmentLength = 0;
112
+ lastSlash = index;
113
+ dots = 0;
114
+ continue;
115
+ }
116
+ }
117
+ if (allowAboveRoot) {
118
+ res += res.length > 0 ? "/.." : "..";
119
+ lastSegmentLength = 2;
120
+ }
121
+ } else {
122
+ if (res.length > 0) {
123
+ res += `/${path2.slice(lastSlash + 1, index)}`;
124
+ } else {
125
+ res = path2.slice(lastSlash + 1, index);
126
+ }
127
+ lastSegmentLength = index - lastSlash - 1;
128
+ }
129
+ lastSlash = index;
130
+ dots = 0;
131
+ } else if (char === "." && dots !== -1) {
132
+ ++dots;
133
+ } else {
134
+ dots = -1;
135
+ }
136
+ }
137
+ return res;
138
+ }
139
+ __name(normalizeString, "normalizeString");
140
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
141
+ return _IS_ABSOLUTE_RE.test(p);
142
+ }, "isAbsolute");
143
+ var dirname = /* @__PURE__ */ __name(function(p) {
144
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
145
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
146
+ segments[0] += "/";
147
+ }
148
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
149
+ }, "dirname");
150
+
151
+ // ../../core/src/shared/utils/module.ts
152
+ var importMetaResolve = /* @__PURE__ */ __name((...args) => {
153
+ if (typeof import.meta.resolve !== "function" && process.env.VITEST === "true") {
154
+ console.warn(
155
+ "importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
156
+ );
157
+ return pathToFileURL(args[0]).href;
158
+ }
159
+ return import.meta.resolve(...args);
160
+ }, "importMetaResolve");
161
+ var resolvePackageDir = /* @__PURE__ */ __name((pkg, parent) => {
162
+ return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
163
+ }, "resolvePackageDir");
164
+
165
+ export {
166
+ resolvePackageDir
167
+ };
@@ -0,0 +1,36 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ __name
14
+ } from "./chunk-WCSGFZKZ.js";
15
+
16
+ // src/font/webpack/configureNextFont.ts
17
+ function configureNextFont(baseConfig, isSWC) {
18
+ if (isSWC) {
19
+ baseConfig.module?.rules?.push({
20
+ test: /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css$/,
21
+ loader: "@storybook/nextjs/storybook-nextjs-font-loader"
22
+ });
23
+ } else {
24
+ baseConfig.resolveLoader = {
25
+ ...baseConfig.resolveLoader,
26
+ alias: {
27
+ ...baseConfig.resolveLoader?.alias,
28
+ "storybook-nextjs-font-loader": "@storybook/nextjs/storybook-nextjs-font-loader"
29
+ }
30
+ };
31
+ }
32
+ }
33
+ __name(configureNextFont, "configureNextFont");
34
+ export {
35
+ configureNextFont
36
+ };
@@ -0,0 +1,51 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ getNodeModulesExcludeRegex
14
+ } from "./chunk-EZEBG77A.js";
15
+ import "./chunk-YMVPQWBH.js";
16
+ import {
17
+ __name
18
+ } from "./chunk-WCSGFZKZ.js";
19
+
20
+ // src/babel/loader.ts
21
+ import { fileURLToPath } from "node:url";
22
+ import { getProjectRoot, resolvePathInStorybookCache } from "storybook/internal/common";
23
+ import { getVirtualModules } from "@storybook/builder-webpack5";
24
+ var configureBabelLoader = /* @__PURE__ */ __name(async (baseConfig, options, nextConfig) => {
25
+ const { virtualModules } = await getVirtualModules(options);
26
+ const babelOptions = await options.presets.apply("babel", {}, options);
27
+ const typescriptOptions = await options.presets.apply("typescript", {}, options);
28
+ baseConfig.module.rules = [
29
+ ...baseConfig.module.rules,
30
+ {
31
+ test: typescriptOptions.skipCompiler ? /\.((c|m)?jsx?)$/ : /\.((c|m)?(j|t)sx?)$/,
32
+ use: [
33
+ {
34
+ loader: fileURLToPath(import.meta.resolve("babel-loader")),
35
+ options: {
36
+ cacheDirectory: resolvePathInStorybookCache("babel"),
37
+ ...babelOptions
38
+ }
39
+ }
40
+ ],
41
+ include: [getProjectRoot()],
42
+ exclude: [
43
+ getNodeModulesExcludeRegex(nextConfig.transpilePackages ?? []),
44
+ ...Object.keys(virtualModules)
45
+ ]
46
+ }
47
+ ];
48
+ }, "configureBabelLoader");
49
+ export {
50
+ configureBabelLoader
51
+ };
@@ -0,0 +1,64 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ getNodeModulesExcludeRegex
14
+ } from "./chunk-EZEBG77A.js";
15
+ import "./chunk-YMVPQWBH.js";
16
+ import {
17
+ __name
18
+ } from "./chunk-WCSGFZKZ.js";
19
+
20
+ // src/swc/loader.ts
21
+ import { join } from "node:path";
22
+ import { getProjectRoot } from "storybook/internal/common";
23
+ import { getVirtualModules } from "@storybook/builder-webpack5";
24
+ import nextJSLoadConfigModule from "next/dist/build/load-jsconfig.js";
25
+ import { getSupportedBrowsers } from "next/dist/build/utils.js";
26
+ var configureSWCLoader = /* @__PURE__ */ __name(async (baseConfig, options, nextConfig) => {
27
+ const isDevelopment = options.configType !== "PRODUCTION";
28
+ const { virtualModules } = await getVirtualModules(options);
29
+ const projectRoot = getProjectRoot();
30
+ const loadJsConfig = nextJSLoadConfigModule.default ?? nextJSLoadConfigModule;
31
+ const { jsConfig } = await loadJsConfig(projectRoot, nextConfig);
32
+ const rawRule = baseConfig.module?.rules?.find(
33
+ (rule) => typeof rule === "object" && rule?.resourceQuery?.toString() === "/raw/"
34
+ );
35
+ if (rawRule && typeof rawRule === "object") {
36
+ rawRule.exclude = /^__barrel_optimize__/;
37
+ }
38
+ const transpilePackages = nextConfig.transpilePackages ?? [];
39
+ baseConfig.module?.rules?.push({
40
+ test: /\.((c|m)?(j|t)sx?)$/,
41
+ include: [projectRoot],
42
+ exclude: [getNodeModulesExcludeRegex(transpilePackages), ...Object.keys(virtualModules)],
43
+ use: {
44
+ // we use our own patch because we need to remove tracing from the original code
45
+ // which is not possible otherwise
46
+ loader: "@storybook/nextjs/next-swc-loader-patch",
47
+ options: {
48
+ isServer: false,
49
+ rootDir: projectRoot,
50
+ pagesDir: `${projectRoot}/pages`,
51
+ appDir: `${projectRoot}/apps`,
52
+ hasReactRefresh: isDevelopment,
53
+ jsConfig,
54
+ nextConfig,
55
+ supportedBrowsers: getSupportedBrowsers(projectRoot, isDevelopment),
56
+ swcCacheDir: join(projectRoot, nextConfig?.distDir ?? ".next", "cache", "swc"),
57
+ bundleTarget: "default"
58
+ }
59
+ }
60
+ });
61
+ }, "configureSWCLoader");
62
+ export {
63
+ configureSWCLoader
64
+ };
@@ -0,0 +1,31 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ addScopedAlias,
14
+ configureRuntimeNextjsVersionResolution,
15
+ getNextjsVersion,
16
+ getNodeModulesExcludeRegex,
17
+ resolveNextConfig,
18
+ scopedResolve,
19
+ setAlias
20
+ } from "./chunk-EZEBG77A.js";
21
+ import "./chunk-YMVPQWBH.js";
22
+ import "./chunk-WCSGFZKZ.js";
23
+ export {
24
+ addScopedAlias,
25
+ configureRuntimeNextjsVersionResolution,
26
+ getNextjsVersion,
27
+ getNodeModulesExcludeRegex,
28
+ resolveNextConfig,
29
+ scopedResolve,
30
+ setAlias
31
+ };
@@ -0,0 +1,38 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ __name
14
+ } from "./chunk-WCSGFZKZ.js";
15
+
16
+ // src/imports/webpack.ts
17
+ import { loadConfig } from "tsconfig-paths";
18
+ import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
19
+ var configureImports = /* @__PURE__ */ __name(({
20
+ baseConfig,
21
+ configDir
22
+ }) => {
23
+ const configLoadResult = loadConfig(configDir);
24
+ if (configLoadResult.resultType === "failed") {
25
+ return;
26
+ }
27
+ baseConfig.resolve ??= {};
28
+ baseConfig.resolve.plugins ??= [];
29
+ baseConfig.resolve.plugins.push(
30
+ new TsconfigPathsPlugin({
31
+ configFile: configLoadResult.configFileAbsolutePath,
32
+ extensions: [".js", ".jsx", ".ts", ".tsx"]
33
+ })
34
+ );
35
+ }, "configureImports");
36
+ export {
37
+ configureImports
38
+ };
@@ -0,0 +1,77 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ getNextjsVersion
14
+ } from "./chunk-EZEBG77A.js";
15
+ import "./chunk-YMVPQWBH.js";
16
+ import {
17
+ __name
18
+ } from "./chunk-WCSGFZKZ.js";
19
+
20
+ // src/images/webpack.ts
21
+ import { fileURLToPath } from "node:url";
22
+ import semver from "semver";
23
+ var configureImages = /* @__PURE__ */ __name((baseConfig, nextConfig) => {
24
+ configureStaticImageImport(baseConfig, nextConfig);
25
+ configureImageDefaults(baseConfig);
26
+ }, "configureImages");
27
+ var fallbackFilename = "static/media/[path][name][ext]";
28
+ var configureImageDefaults = /* @__PURE__ */ __name((baseConfig) => {
29
+ const version = getNextjsVersion();
30
+ const resolve = baseConfig.resolve ?? {};
31
+ resolve.alias = {
32
+ ...resolve.alias,
33
+ "sb-original/next/image": fileURLToPath(import.meta.resolve("next/image")),
34
+ "next/image": "@storybook/nextjs/images/next-image"
35
+ };
36
+ if (semver.satisfies(version, ">=13.0.0")) {
37
+ resolve.alias = {
38
+ ...resolve.alias,
39
+ "sb-original/next/legacy/image": fileURLToPath(import.meta.resolve("next/legacy/image")),
40
+ "next/legacy/image": "@storybook/nextjs/images/next-legacy-image"
41
+ };
42
+ }
43
+ }, "configureImageDefaults");
44
+ var configureStaticImageImport = /* @__PURE__ */ __name((baseConfig, nextConfig) => {
45
+ const rules = baseConfig.module?.rules;
46
+ const assetRule = rules?.find(
47
+ (rule) => rule && typeof rule !== "string" && rule.test instanceof RegExp && rule.test.test("test.jpg")
48
+ );
49
+ if (!assetRule) {
50
+ return;
51
+ }
52
+ assetRule.test = /\.(apng|eot|otf|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/;
53
+ rules?.push({
54
+ test: /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,
55
+ issuer: { not: /\.(css|scss|sass)$/ },
56
+ use: [
57
+ {
58
+ loader: fileURLToPath(import.meta.resolve("@storybook/nextjs/next-image-loader-stub")),
59
+ options: {
60
+ filename: assetRule.generator?.filename ?? fallbackFilename,
61
+ nextConfig
62
+ }
63
+ }
64
+ ]
65
+ });
66
+ rules?.push({
67
+ test: /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,
68
+ issuer: /\.(css|scss|sass)$/,
69
+ type: "asset/resource",
70
+ generator: {
71
+ filename: assetRule.generator?.filename ?? fallbackFilename
72
+ }
73
+ });
74
+ }, "configureStaticImageImport");
75
+ export {
76
+ configureImages
77
+ };
@@ -0,0 +1,30 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ __name
14
+ } from "./chunk-WCSGFZKZ.js";
15
+
16
+ // src/nodePolyfills/webpack.ts
17
+ import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
18
+ var configureNodePolyfills = /* @__PURE__ */ __name((baseConfig) => {
19
+ baseConfig.plugins = [...baseConfig.plugins || [], new NodePolyfillPlugin()];
20
+ baseConfig.resolve = {
21
+ ...baseConfig.resolve,
22
+ fallback: {
23
+ fs: false
24
+ }
25
+ };
26
+ return baseConfig;
27
+ }, "configureNodePolyfills");
28
+ export {
29
+ configureNodePolyfills
30
+ };
@@ -0,0 +1,26 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ addScopedAlias
14
+ } from "./chunk-EZEBG77A.js";
15
+ import "./chunk-YMVPQWBH.js";
16
+ import {
17
+ __name
18
+ } from "./chunk-WCSGFZKZ.js";
19
+
20
+ // src/styledJsx/webpack.ts
21
+ var configureStyledJsx = /* @__PURE__ */ __name((baseConfig) => {
22
+ addScopedAlias(baseConfig, "styled-jsx");
23
+ }, "configureStyledJsx");
24
+ export {
25
+ configureStyledJsx
26
+ };
@@ -0,0 +1,29 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ __name
14
+ } from "./chunk-WCSGFZKZ.js";
15
+
16
+ // src/fastRefresh/webpack.ts
17
+ import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
18
+ var configureFastRefresh = /* @__PURE__ */ __name((baseConfig) => {
19
+ baseConfig.plugins = [
20
+ ...baseConfig.plugins ?? [],
21
+ // overlay is disabled as it is shown with caught errors in error boundaries
22
+ // and the next app router is using error boundaries to redirect
23
+ // TODO use the Next error overlay
24
+ new ReactRefreshWebpackPlugin({ overlay: false })
25
+ ];
26
+ }, "configureFastRefresh");
27
+ export {
28
+ configureFastRefresh
29
+ };
@@ -0,0 +1,43 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ configureCompatibilityAliases,
14
+ configureNextExportMocks
15
+ } from "./chunk-24UYJEDD.js";
16
+ import "./chunk-EZEBG77A.js";
17
+ import {
18
+ resolvePackageDir
19
+ } from "./chunk-YMVPQWBH.js";
20
+ import {
21
+ __name
22
+ } from "./chunk-WCSGFZKZ.js";
23
+
24
+ // src/aliases/webpack.ts
25
+ var configureAliases = /* @__PURE__ */ __name((baseConfig) => {
26
+ configureNextExportMocks(baseConfig);
27
+ configureCompatibilityAliases(baseConfig);
28
+ baseConfig.resolve = {
29
+ ...baseConfig.resolve ?? {},
30
+ alias: {
31
+ ...baseConfig.resolve?.alias ?? {},
32
+ "@opentelemetry/api": "next/dist/compiled/@opentelemetry/api",
33
+ next: resolvePackageDir("next")
34
+ }
35
+ };
36
+ baseConfig.ignoreWarnings = [
37
+ ...baseConfig.ignoreWarnings ?? [],
38
+ (warning) => warning.message.includes("export 'draftMode'") && warning.message.includes("next/dist/server/request/headers")
39
+ ];
40
+ }, "configureAliases");
41
+ export {
42
+ configureAliases
43
+ };
@@ -0,0 +1,27 @@
1
+ import CJS_COMPAT_NODE_URL_e3twfmexlgl from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_e3twfmexlgl from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_e3twfmexlgl from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_e3twfmexlgl.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_e3twfmexlgl.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_e3twfmexlgl.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ __name
14
+ } from "./chunk-WCSGFZKZ.js";
15
+
16
+ // src/rsc/webpack.ts
17
+ import { fileURLToPath } from "node:url";
18
+ var configureRSC = /* @__PURE__ */ __name((baseConfig) => {
19
+ const resolve = baseConfig.resolve ?? {};
20
+ resolve.alias = {
21
+ ...resolve.alias,
22
+ "server-only$": fileURLToPath(import.meta.resolve("@storybook/nextjs/rsc/server-only"))
23
+ };
24
+ }, "configureRSC");
25
+ export {
26
+ configureRSC
27
+ };