@storybook/nextjs 10.1.0-alpha.8 → 10.1.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 (51) hide show
  1. package/dist/_browser-chunks/{chunk-KX5HHFXV.js → chunk-2SBZPHE7.js} +50 -100
  2. package/dist/_browser-chunks/chunk-RDMFII4N.js +22 -0
  3. package/dist/_browser-chunks/{chunk-L5NVL7MD.js → chunk-SL3VIQZ3.js} +7 -13
  4. package/dist/_browser-chunks/react-18-PYSEDAWB.js +43 -0
  5. package/dist/_node-chunks/chunk-AU547LNK.js +76 -0
  6. package/dist/_node-chunks/chunk-EONFLREF.js +57 -0
  7. package/dist/_node-chunks/chunk-NVHRUSN5.js +211 -0
  8. package/dist/_node-chunks/configureNextFont-3RPVM2N7.js +28 -0
  9. package/dist/_node-chunks/{loader-SKCOTR5I.js → loader-PBLFQE7I.js} +15 -25
  10. package/dist/_node-chunks/{loader-PTNYR6I7.js → loader-UX42M74F.js} +11 -16
  11. package/dist/_node-chunks/{utils-ONLCV4PV.js → utils-MPWEOWV4.js} +8 -9
  12. package/dist/_node-chunks/webpack-5IZRQF33.js +23 -0
  13. package/dist/_node-chunks/{webpack-QAHMKC4Y.js → webpack-C4DEBGCG.js} +13 -19
  14. package/dist/_node-chunks/webpack-EFCFZKO7.js +97 -0
  15. package/dist/_node-chunks/{webpack-3MPPBO7O.js → webpack-KW7MEY7C.js} +9 -12
  16. package/dist/_node-chunks/webpack-TVYIGXMK.js +24 -0
  17. package/dist/_node-chunks/webpack-UAKFJEYJ.js +30 -0
  18. package/dist/_node-chunks/webpack-WL4FYVO5.js +23 -0
  19. package/dist/_node-chunks/webpack-WZC6ZANM.js +60 -0
  20. package/dist/compatibility/draft-mode.compat.js +1 -1
  21. package/dist/export-mocks/cache/index.js +3 -6
  22. package/dist/export-mocks/headers/index.js +6 -29
  23. package/dist/export-mocks/index.js +9 -10
  24. package/dist/export-mocks/navigation/index.js +17 -41
  25. package/dist/export-mocks/router/index.d.ts +4 -7
  26. package/dist/export-mocks/router/index.js +20 -54
  27. package/dist/font/webpack/loader/storybook-nextjs-font-loader.js +38 -80
  28. package/dist/image-context.js +1 -1
  29. package/dist/images/next-image.js +5 -11
  30. package/dist/images/next-legacy-image.js +3 -6
  31. package/dist/index.js +2865 -8413
  32. package/dist/next-image-loader-stub.js +9 -16
  33. package/dist/node/index.js +6 -10
  34. package/dist/preset.js +183 -462
  35. package/dist/preview.js +2 -2
  36. package/dist/rsc/server-only.js +1 -1
  37. package/dist/swc/next-swc-loader-patch.js +46 -84
  38. package/package.json +6 -6
  39. package/dist/_browser-chunks/chunk-I5RFHXDS.js +0 -40
  40. package/dist/_browser-chunks/react-18-G7Q4PNHD.js +0 -71
  41. package/dist/_node-chunks/chunk-6MGNTEEA.js +0 -475
  42. package/dist/_node-chunks/chunk-LARGD3DA.js +0 -74
  43. package/dist/_node-chunks/chunk-TZWXYEHU.js +0 -102
  44. package/dist/_node-chunks/chunk-YE4AS3Q5.js +0 -17
  45. package/dist/_node-chunks/configureNextFont-5VGP6R4M.js +0 -36
  46. package/dist/_node-chunks/webpack-EXHZOTZ7.js +0 -30
  47. package/dist/_node-chunks/webpack-PBFKV6UK.js +0 -27
  48. package/dist/_node-chunks/webpack-R54SMZ7U.js +0 -26
  49. package/dist/_node-chunks/webpack-SFOC3ZEG.js +0 -77
  50. package/dist/_node-chunks/webpack-SPGYDJQ3.js +0 -107
  51. package/dist/_node-chunks/webpack-TDMUT5LM.js +0 -38
@@ -1,36 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_tpzzyiu8f1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tpzzyiu8f1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tpzzyiu8f1 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_tpzzyiu8f1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tpzzyiu8f1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tpzzyiu8f1.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-YE4AS3Q5.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
- };
@@ -1,30 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_tpzzyiu8f1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tpzzyiu8f1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tpzzyiu8f1 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_tpzzyiu8f1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tpzzyiu8f1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tpzzyiu8f1.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-YE4AS3Q5.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
- };
@@ -1,27 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_tpzzyiu8f1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tpzzyiu8f1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tpzzyiu8f1 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_tpzzyiu8f1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tpzzyiu8f1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tpzzyiu8f1.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-YE4AS3Q5.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
- };
@@ -1,26 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_tpzzyiu8f1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tpzzyiu8f1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tpzzyiu8f1 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_tpzzyiu8f1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tpzzyiu8f1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tpzzyiu8f1.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-TZWXYEHU.js";
15
- import "./chunk-6MGNTEEA.js";
16
- import {
17
- __name
18
- } from "./chunk-YE4AS3Q5.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
- };
@@ -1,77 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_tpzzyiu8f1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tpzzyiu8f1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tpzzyiu8f1 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_tpzzyiu8f1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tpzzyiu8f1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tpzzyiu8f1.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-TZWXYEHU.js";
15
- import "./chunk-6MGNTEEA.js";
16
- import {
17
- __name
18
- } from "./chunk-YE4AS3Q5.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
- };
@@ -1,107 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_tpzzyiu8f1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tpzzyiu8f1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tpzzyiu8f1 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_tpzzyiu8f1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tpzzyiu8f1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tpzzyiu8f1.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- resolvePackageDir
14
- } from "./chunk-6MGNTEEA.js";
15
- import {
16
- __name
17
- } from "./chunk-YE4AS3Q5.js";
18
-
19
- // src/css/webpack.ts
20
- import { readFileSync } from "node:fs";
21
- import { join } from "node:path";
22
- import { fileURLToPath } from "node:url";
23
- import { cssFileResolve } from "next/dist/build/webpack/config/blocks/css/loaders/file-resolve.js";
24
- import { getCssModuleLocalIdent } from "next/dist/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent.js";
25
- import semver from "semver";
26
- var configureCss = /* @__PURE__ */ __name((baseConfig, nextConfig) => {
27
- const rules = baseConfig.module?.rules;
28
- rules?.forEach((rule, i) => {
29
- if (rule && typeof rule !== "string" && rule.test instanceof RegExp && rule.test.test("test.css")) {
30
- rules[i] = {
31
- test: /\.css$/,
32
- use: [
33
- fileURLToPath(import.meta.resolve("style-loader")),
34
- {
35
- loader: fileURLToPath(import.meta.resolve("css-loader")),
36
- options: {
37
- importLoaders: 1,
38
- ...getImportAndUrlCssLoaderOptions(nextConfig),
39
- modules: {
40
- auto: true,
41
- getLocalIdent: getCssModuleLocalIdent
42
- }
43
- }
44
- },
45
- fileURLToPath(import.meta.resolve("postcss-loader"))
46
- ],
47
- // We transform the "target.css" files from next.js into Javascript
48
- // for Next.js to support fonts, so it should be ignored by the css-loader.
49
- exclude: /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css$/
50
- };
51
- }
52
- });
53
- rules?.push({
54
- test: /\.(scss|sass)$/,
55
- use: [
56
- fileURLToPath(import.meta.resolve("style-loader")),
57
- {
58
- loader: fileURLToPath(import.meta.resolve("css-loader")),
59
- options: {
60
- importLoaders: 3,
61
- ...getImportAndUrlCssLoaderOptions(nextConfig),
62
- modules: { auto: true, getLocalIdent: getCssModuleLocalIdent }
63
- }
64
- },
65
- fileURLToPath(import.meta.resolve("postcss-loader")),
66
- fileURLToPath(import.meta.resolve("resolve-url-loader")),
67
- {
68
- loader: fileURLToPath(import.meta.resolve("sass-loader")),
69
- options: {
70
- sourceMap: true,
71
- sassOptions: nextConfig.sassOptions,
72
- additionalData: nextConfig.sassOptions?.prependData || nextConfig.sassOptions?.additionalData
73
- }
74
- }
75
- ]
76
- });
77
- }, "configureCss");
78
- var getImportAndUrlCssLoaderOptions = /* @__PURE__ */ __name((nextConfig) => isCssLoaderV6() ? {
79
- url: {
80
- filter: getUrlResolver(nextConfig)
81
- },
82
- import: {
83
- filter: getImportResolver(nextConfig)
84
- }
85
- } : {
86
- url: getUrlResolver(nextConfig),
87
- import: getImportResolver(nextConfig)
88
- }, "getImportAndUrlCssLoaderOptions");
89
- var getUrlResolver = /* @__PURE__ */ __name((nextConfig) => (url, resourcePath) => cssFileResolve(url, resourcePath, nextConfig.experimental?.urlImports), "getUrlResolver");
90
- var getImportResolver = /* @__PURE__ */ __name((nextConfig) => (url, _, resourcePath) => cssFileResolve(
91
- typeof url === "string" ? url : url.url,
92
- resourcePath,
93
- nextConfig.experimental?.urlImports
94
- ), "getImportResolver");
95
- var isCssLoaderV6 = /* @__PURE__ */ __name(() => {
96
- try {
97
- const cssLoaderVersion = JSON.parse(
98
- readFileSync(join(resolvePackageDir("css-loader"), "package.json"), "utf8")
99
- ).version;
100
- return semver.gte(cssLoaderVersion, "6.0.0");
101
- } catch {
102
- return false;
103
- }
104
- }, "isCssLoaderV6");
105
- export {
106
- configureCss
107
- };
@@ -1,38 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_tpzzyiu8f1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_tpzzyiu8f1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_tpzzyiu8f1 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_tpzzyiu8f1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_tpzzyiu8f1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_tpzzyiu8f1.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-YE4AS3Q5.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
- };