@storybook/nextjs 9.2.0-alpha.3 → 10.0.0-beta.1
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/README.md +3 -1
- package/dist/_browser-chunks/chunk-I5RFHXDS.js +40 -0
- package/dist/_browser-chunks/chunk-JOMP7DUK.js +261 -0
- package/dist/_browser-chunks/chunk-L5NVL7MD.js +37 -0
- package/dist/_browser-chunks/react-18-G7Q4PNHD.js +71 -0
- package/dist/_node-chunks/chunk-254AWWVV.js +95 -0
- package/dist/_node-chunks/chunk-4Q3WLK5D.js +167 -0
- package/dist/_node-chunks/chunk-DF7TGUJT.js +17 -0
- package/dist/_node-chunks/chunk-N47GZ6ZF.js +74 -0
- package/dist/_node-chunks/configureNextFont-YCA4Y2MY.js +36 -0
- package/dist/_node-chunks/loader-BMOR26K7.js +64 -0
- package/dist/_node-chunks/loader-W6JNOWKU.js +51 -0
- package/dist/_node-chunks/utils-TOBNY3XG.js +31 -0
- package/dist/_node-chunks/webpack-422IPQRP.js +38 -0
- package/dist/_node-chunks/webpack-7CTFG24J.js +107 -0
- package/dist/_node-chunks/webpack-AGJ2TY75.js +29 -0
- package/dist/_node-chunks/webpack-E2SJEFJM.js +27 -0
- package/dist/_node-chunks/webpack-GIA2WMBH.js +77 -0
- package/dist/_node-chunks/webpack-MCDIAAFL.js +43 -0
- package/dist/_node-chunks/webpack-UPXNFNSK.js +26 -0
- package/dist/_node-chunks/webpack-WWJ5TQDG.js +30 -0
- package/dist/compatibility/draft-mode.compat.js +7 -1
- package/dist/export-mocks/cache/index.d.ts +309 -1
- package/dist/export-mocks/cache/index.js +22 -1
- package/dist/export-mocks/headers/index.d.ts +309 -1
- package/dist/export-mocks/headers/index.js +77 -1
- package/dist/export-mocks/index.js +20 -1
- package/dist/export-mocks/navigation/index.js +88 -1
- package/dist/export-mocks/router/index.d.ts +2 -2
- package/dist/export-mocks/router/index.js +97 -1
- package/dist/font/webpack/loader/storybook-nextjs-font-loader.js +201 -14
- package/dist/image-context.js +8 -1
- package/dist/images/next-image.js +35 -1
- package/dist/images/next-legacy-image.js +21 -1
- package/dist/index.d.ts +53 -8
- package/dist/index.js +20237 -45
- package/dist/next-image-loader-stub.js +33 -1
- package/dist/node/index.d.ts +27 -6
- package/dist/node/index.js +23 -1
- package/dist/preset.js +830 -1
- package/dist/preview.d.ts +3 -18
- package/dist/preview.d.tsx +18 -0
- package/dist/preview.js +11 -1
- package/dist/rsc/server-only.js +7 -1
- package/dist/swc/next-swc-loader-patch.js +136 -1
- package/package.json +41 -122
- package/preset.js +1 -1
- package/template/cli/js/Configure.mdx +11 -11
- package/template/cli/ts/Configure.mdx +11 -11
- package/dist/chunk-2TZKD6A5.mjs +0 -20
- package/dist/chunk-ETFXNGLC.mjs +0 -3
- package/dist/chunk-L66KIASX.mjs +0 -3
- package/dist/chunk-NQ32RFK2.mjs +0 -6
- package/dist/compatibility/draft-mode.compat.d.ts +0 -1
- package/dist/compatibility/draft-mode.compat.mjs +0 -2
- package/dist/export-mocks/cache/index.mjs +0 -10
- package/dist/export-mocks/headers/index.mjs +0 -12
- package/dist/export-mocks/index.d.ts +0 -7
- package/dist/export-mocks/index.mjs +0 -11
- package/dist/export-mocks/navigation/index.mjs +0 -11
- package/dist/export-mocks/router/index.mjs +0 -10
- package/dist/font/webpack/loader/storybook-nextjs-font-loader.d.ts +0 -3
- package/dist/font/webpack/loader/storybook-nextjs-font-loader.mjs +0 -56
- package/dist/image-context.d.ts +0 -13
- package/dist/image-context.mjs +0 -6
- package/dist/images/decorator.d.ts +0 -6
- package/dist/images/decorator.js +0 -1
- package/dist/images/decorator.mjs +0 -2
- package/dist/images/next-image.d.ts +0 -28
- package/dist/images/next-image.mjs +0 -9
- package/dist/images/next-legacy-image.d.ts +0 -6
- package/dist/images/next-legacy-image.mjs +0 -9
- package/dist/index.d-ff220430.d.ts +0 -310
- package/dist/index.mjs +0 -58
- package/dist/next-image-loader-stub.d.ts +0 -10
- package/dist/next-image-loader-stub.mjs +0 -7
- package/dist/node/index.mjs +0 -5
- package/dist/preset.d.ts +0 -14
- package/dist/preview.mjs +0 -3
- package/dist/react-18-WSPZ3BUV.mjs +0 -7
- package/dist/rsc/server-only.d.ts +0 -3
- package/dist/rsc/server-only.mjs +0 -5
- package/dist/swc/next-swc-loader-patch.d.ts +0 -21
- package/dist/swc/next-swc-loader-patch.mjs +0 -8
- package/dist/types-f6ea2c09.d.ts +0 -54
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
__name
|
|
17
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
addScopedAlias,
|
|
14
|
+
getNextjsVersion,
|
|
15
|
+
setAlias
|
|
16
|
+
} from "./chunk-254AWWVV.js";
|
|
17
|
+
import {
|
|
18
|
+
__name
|
|
19
|
+
} from "./chunk-DF7TGUJT.js";
|
|
20
|
+
|
|
21
|
+
// src/compatibility/compatibility-map.ts
|
|
22
|
+
import semver from "semver";
|
|
23
|
+
var mapping = {
|
|
24
|
+
"<15.0.0": {
|
|
25
|
+
"next/dist/server/request/headers": "next/dist/client/components/headers",
|
|
26
|
+
// this path only exists from Next 15 onwards
|
|
27
|
+
"next/dist/server/request/draft-mode": "@storybook/nextjs/compatibility/draft-mode.compat"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var getCompatibilityAliases = /* @__PURE__ */ __name(() => {
|
|
31
|
+
const version = getNextjsVersion();
|
|
32
|
+
const result = {};
|
|
33
|
+
Object.keys(mapping).forEach((key) => {
|
|
34
|
+
if (semver.intersects(version, key)) {
|
|
35
|
+
Object.assign(result, mapping[key]);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return result;
|
|
39
|
+
}, "getCompatibilityAliases");
|
|
40
|
+
var configureCompatibilityAliases = /* @__PURE__ */ __name((baseConfig) => {
|
|
41
|
+
const aliases = getCompatibilityAliases();
|
|
42
|
+
Object.entries(aliases).forEach(([name, alias]) => {
|
|
43
|
+
if (typeof alias === "string") {
|
|
44
|
+
addScopedAlias(baseConfig, name, alias);
|
|
45
|
+
} else {
|
|
46
|
+
setAlias(baseConfig, name, alias);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}, "configureCompatibilityAliases");
|
|
50
|
+
|
|
51
|
+
// src/export-mocks/webpack.ts
|
|
52
|
+
var mapping2 = {
|
|
53
|
+
"next/headers": "@storybook/nextjs/headers.mock",
|
|
54
|
+
"next/navigation": "@storybook/nextjs/navigation.mock",
|
|
55
|
+
"next/router": "@storybook/nextjs/router.mock",
|
|
56
|
+
"next/cache": "@storybook/nextjs/cache.mock",
|
|
57
|
+
...getCompatibilityAliases()
|
|
58
|
+
};
|
|
59
|
+
var getPackageAliases = /* @__PURE__ */ __name(() => {
|
|
60
|
+
return mapping2;
|
|
61
|
+
}, "getPackageAliases");
|
|
62
|
+
var configureNextExportMocks = /* @__PURE__ */ __name((baseConfig) => {
|
|
63
|
+
const resolve = baseConfig.resolve ?? {};
|
|
64
|
+
resolve.alias = {
|
|
65
|
+
...resolve.alias,
|
|
66
|
+
...mapping2
|
|
67
|
+
};
|
|
68
|
+
}, "configureNextExportMocks");
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
configureCompatibilityAliases,
|
|
72
|
+
getPackageAliases,
|
|
73
|
+
configureNextExportMocks
|
|
74
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-DF7TGUJT.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,64 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-254AWWVV.js";
|
|
15
|
+
import "./chunk-4Q3WLK5D.js";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-DF7TGUJT.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,51 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-254AWWVV.js";
|
|
15
|
+
import "./chunk-4Q3WLK5D.js";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-DF7TGUJT.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,31 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-254AWWVV.js";
|
|
21
|
+
import "./chunk-4Q3WLK5D.js";
|
|
22
|
+
import "./chunk-DF7TGUJT.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_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-DF7TGUJT.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,107 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-4Q3WLK5D.js";
|
|
15
|
+
import {
|
|
16
|
+
__name
|
|
17
|
+
} from "./chunk-DF7TGUJT.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
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-DF7TGUJT.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,27 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-DF7TGUJT.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
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-254AWWVV.js";
|
|
15
|
+
import "./chunk-4Q3WLK5D.js";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-DF7TGUJT.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,43 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-N47GZ6ZF.js";
|
|
16
|
+
import "./chunk-254AWWVV.js";
|
|
17
|
+
import {
|
|
18
|
+
resolvePackageDir
|
|
19
|
+
} from "./chunk-4Q3WLK5D.js";
|
|
20
|
+
import {
|
|
21
|
+
__name
|
|
22
|
+
} from "./chunk-DF7TGUJT.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,26 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-254AWWVV.js";
|
|
15
|
+
import "./chunk-4Q3WLK5D.js";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-DF7TGUJT.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,30 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nafzxsaqn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nafzxsaqn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nafzxsaqn from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nafzxsaqn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nafzxsaqn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nafzxsaqn.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-DF7TGUJT.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 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "../_browser-chunks/chunk-L5NVL7MD.js";
|
|
2
|
+
|
|
3
|
+
// src/compatibility/draft-mode.compat.ts
|
|
4
|
+
import { draftMode } from "next/dist/client/components/headers";
|
|
5
|
+
export {
|
|
6
|
+
draftMode
|
|
7
|
+
};
|