@storybook/nextjs 10.1.0-alpha.10 → 10.1.0-alpha.11
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/_browser-chunks/{chunk-KX5HHFXV.js → chunk-2SBZPHE7.js} +50 -100
- package/dist/_browser-chunks/chunk-RDMFII4N.js +22 -0
- package/dist/_browser-chunks/{chunk-L5NVL7MD.js → chunk-SL3VIQZ3.js} +7 -13
- package/dist/_browser-chunks/react-18-PYSEDAWB.js +43 -0
- package/dist/_node-chunks/chunk-KG2CEDQ6.js +76 -0
- package/dist/_node-chunks/chunk-NVSKNSJK.js +205 -0
- package/dist/_node-chunks/chunk-XVBKFOBF.js +57 -0
- package/dist/_node-chunks/configureNextFont-QR356EAI.js +28 -0
- package/dist/_node-chunks/{loader-WPDBQYKQ.js → loader-GUPXITUF.js} +11 -16
- package/dist/_node-chunks/{loader-UJGK53PP.js → loader-VIIL5HSY.js} +15 -25
- package/dist/_node-chunks/{utils-G77XBOCW.js → utils-GFLYVHHC.js} +8 -9
- package/dist/_node-chunks/webpack-A6CKSXQU.js +24 -0
- package/dist/_node-chunks/webpack-HDYOTQDH.js +23 -0
- package/dist/_node-chunks/{webpack-AIYB3HRJ.js → webpack-K7FNPCWL.js} +13 -19
- package/dist/_node-chunks/webpack-KEI74OHK.js +30 -0
- package/dist/_node-chunks/{webpack-QCUACIS6.js → webpack-O4VJM34G.js} +9 -12
- package/dist/_node-chunks/webpack-S3SWBOVU.js +97 -0
- package/dist/_node-chunks/webpack-YFKESEJQ.js +60 -0
- package/dist/_node-chunks/webpack-YOXZVRLP.js +23 -0
- package/dist/compatibility/draft-mode.compat.js +1 -1
- package/dist/export-mocks/cache/index.js +3 -6
- package/dist/export-mocks/headers/index.js +6 -29
- package/dist/export-mocks/index.js +9 -10
- package/dist/export-mocks/navigation/index.js +17 -41
- package/dist/export-mocks/router/index.js +20 -54
- package/dist/font/webpack/loader/storybook-nextjs-font-loader.js +38 -80
- package/dist/image-context.js +1 -1
- package/dist/images/next-image.js +5 -11
- package/dist/images/next-legacy-image.js +3 -6
- package/dist/index.js +2865 -8413
- package/dist/next-image-loader-stub.js +9 -16
- package/dist/node/index.js +6 -10
- package/dist/preset.js +183 -462
- package/dist/preview.js +2 -2
- package/dist/rsc/server-only.js +1 -1
- package/dist/swc/next-swc-loader-patch.js +46 -84
- package/package.json +6 -6
- package/dist/_browser-chunks/chunk-I5RFHXDS.js +0 -40
- package/dist/_browser-chunks/react-18-G7Q4PNHD.js +0 -71
- package/dist/_node-chunks/chunk-2ADK3PCH.js +0 -74
- package/dist/_node-chunks/chunk-EVMWO5FG.js +0 -102
- package/dist/_node-chunks/chunk-RSBRC6AY.js +0 -475
- package/dist/_node-chunks/chunk-Z2RESD5M.js +0 -17
- package/dist/_node-chunks/configureNextFont-ZETH4V45.js +0 -36
- package/dist/_node-chunks/webpack-4ZO2PLAG.js +0 -107
- package/dist/_node-chunks/webpack-6QTUYRFB.js +0 -30
- package/dist/_node-chunks/webpack-KRJ4EWQZ.js +0 -27
- package/dist/_node-chunks/webpack-L5YFG573.js +0 -38
- package/dist/_node-chunks/webpack-QPCUFYIY.js +0 -77
- package/dist/_node-chunks/webpack-R5RMXZWI.js +0 -26
package/dist/preview.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
decorators,
|
|
3
3
|
loaders,
|
|
4
4
|
parameters
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
6
|
-
import "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-2SBZPHE7.js";
|
|
6
|
+
import "./_browser-chunks/chunk-SL3VIQZ3.js";
|
|
7
7
|
export {
|
|
8
8
|
decorators,
|
|
9
9
|
loaders,
|
package/dist/rsc/server-only.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h9mxauk5xyo from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h9mxauk5xyo from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h9mxauk5xyo from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h9mxauk5xyo.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h9mxauk5xyo.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h9mxauk5xyo.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
__name
|
|
14
|
-
} from "../_node-chunks/chunk-Z2RESD5M.js";
|
|
15
12
|
|
|
16
13
|
// src/swc/next-swc-loader-patch.ts
|
|
17
14
|
import { isAbsolute, relative } from "node:path";
|
|
18
15
|
import * as nextSwcUtils from "next/dist/build/swc/index.js";
|
|
19
16
|
import { getLoaderSWCOptions } from "next/dist/build/swc/options.js";
|
|
20
17
|
var mockCurrentTraceSpan = {
|
|
21
|
-
traceChild:
|
|
22
|
-
traceAsyncFn:
|
|
18
|
+
traceChild: (name) => mockCurrentTraceSpan,
|
|
19
|
+
traceAsyncFn: async (fn) => fn()
|
|
23
20
|
};
|
|
24
21
|
async function loaderTransform(parentTrace, source, inputSourceMap) {
|
|
25
|
-
|
|
26
|
-
const loaderOptions = this.getOptions() || {};
|
|
27
|
-
const {
|
|
22
|
+
let filename = this.resourcePath, loaderOptions = this.getOptions() || {}, {
|
|
28
23
|
isServer,
|
|
29
24
|
rootDir,
|
|
30
25
|
pagesDir,
|
|
@@ -36,35 +31,31 @@ async function loaderTransform(parentTrace, source, inputSourceMap) {
|
|
|
36
31
|
swcCacheDir,
|
|
37
32
|
serverComponents,
|
|
38
33
|
isReactServerLayer
|
|
39
|
-
} = loaderOptions
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
} = loaderOptions, isPageFile = filename.startsWith(pagesDir), relativeFilePathFromRoot = relative(rootDir, filename), programmaticOptions = {
|
|
35
|
+
...getLoaderSWCOptions({
|
|
36
|
+
pagesDir,
|
|
37
|
+
appDir,
|
|
38
|
+
filename,
|
|
39
|
+
isServer,
|
|
40
|
+
isPageFile,
|
|
41
|
+
development: this.mode === "development",
|
|
42
|
+
hasReactRefresh,
|
|
43
|
+
modularizeImports: nextConfig?.modularizeImports,
|
|
44
|
+
optimizePackageImports: nextConfig?.experimental?.optimizePackageImports,
|
|
45
|
+
swcPlugins: nextConfig?.experimental?.swcPlugins,
|
|
46
|
+
compilerOptions: nextConfig?.compiler,
|
|
47
|
+
optimizeServerReact: nextConfig?.experimental?.optimizeServerReact,
|
|
48
|
+
jsConfig,
|
|
49
|
+
supportedBrowsers,
|
|
50
|
+
swcCacheDir,
|
|
51
|
+
relativeFilePathFromRoot,
|
|
52
|
+
serverComponents,
|
|
53
|
+
// @ts-expect-error Relevant for Next.js < 14.1
|
|
54
|
+
// TODO: Remove this when Next.js < 14.1 is no longer supported
|
|
55
|
+
isReactServerLayer
|
|
56
|
+
}),
|
|
45
57
|
filename,
|
|
46
|
-
|
|
47
|
-
isPageFile,
|
|
48
|
-
development: this.mode === "development",
|
|
49
|
-
hasReactRefresh,
|
|
50
|
-
modularizeImports: nextConfig?.modularizeImports,
|
|
51
|
-
optimizePackageImports: nextConfig?.experimental?.optimizePackageImports,
|
|
52
|
-
swcPlugins: nextConfig?.experimental?.swcPlugins,
|
|
53
|
-
compilerOptions: nextConfig?.compiler,
|
|
54
|
-
optimizeServerReact: nextConfig?.experimental?.optimizeServerReact,
|
|
55
|
-
jsConfig,
|
|
56
|
-
supportedBrowsers,
|
|
57
|
-
swcCacheDir,
|
|
58
|
-
relativeFilePathFromRoot,
|
|
59
|
-
serverComponents,
|
|
60
|
-
// @ts-expect-error Relevant for Next.js < 14.1
|
|
61
|
-
// TODO: Remove this when Next.js < 14.1 is no longer supported
|
|
62
|
-
isReactServerLayer
|
|
63
|
-
});
|
|
64
|
-
const programmaticOptions = {
|
|
65
|
-
...swcOptions,
|
|
66
|
-
filename,
|
|
67
|
-
inputSourceMap: inputSourceMap && typeof inputSourceMap === "object" ? JSON.stringify(inputSourceMap) : void 0,
|
|
58
|
+
inputSourceMap: inputSourceMap && typeof inputSourceMap == "object" ? JSON.stringify(inputSourceMap) : void 0,
|
|
68
59
|
// Set the default sourcemap behavior based on Webpack's mapping flag,
|
|
69
60
|
sourceMaps: this.sourceMap,
|
|
70
61
|
inlineSourcesContent: this.sourceMap,
|
|
@@ -73,59 +64,31 @@ async function loaderTransform(parentTrace, source, inputSourceMap) {
|
|
|
73
64
|
// modules.
|
|
74
65
|
sourceFileName: filename
|
|
75
66
|
};
|
|
76
|
-
programmaticOptions.env.bugfixes =
|
|
77
|
-
if (!programmaticOptions.inputSourceMap) {
|
|
78
|
-
delete programmaticOptions.inputSourceMap;
|
|
79
|
-
}
|
|
80
|
-
if (this.mode && programmaticOptions.jsc && programmaticOptions.jsc.transform && programmaticOptions.jsc.transform.react && !Object.prototype.hasOwnProperty.call(programmaticOptions.jsc.transform.react, "development")) {
|
|
81
|
-
programmaticOptions.jsc.transform.react.development = this.mode === "development";
|
|
82
|
-
}
|
|
83
|
-
const swcSpan = parentTrace.traceChild("next-swc-transform");
|
|
84
|
-
return swcSpan.traceAsyncFn(
|
|
67
|
+
return programmaticOptions.env.bugfixes = !0, programmaticOptions.inputSourceMap || delete programmaticOptions.inputSourceMap, this.mode && programmaticOptions.jsc && programmaticOptions.jsc.transform && programmaticOptions.jsc.transform.react && !Object.prototype.hasOwnProperty.call(programmaticOptions.jsc.transform.react, "development") && (programmaticOptions.jsc.transform.react.development = this.mode === "development"), parentTrace.traceChild("next-swc-transform").traceAsyncFn(
|
|
85
68
|
() => nextSwcUtils.transform(source, programmaticOptions).then((output) => {
|
|
86
|
-
if (output.eliminatedPackages && this.eliminatedPackages)
|
|
87
|
-
for (
|
|
69
|
+
if (output.eliminatedPackages && this.eliminatedPackages)
|
|
70
|
+
for (let pkg of JSON.parse(output.eliminatedPackages))
|
|
88
71
|
this.eliminatedPackages.add(pkg);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
72
|
return [output.code, output.map ? JSON.parse(output.map) : void 0];
|
|
92
73
|
})
|
|
93
74
|
);
|
|
94
75
|
}
|
|
95
|
-
__name(loaderTransform, "loaderTransform");
|
|
96
76
|
var EXCLUDED_PATHS = /[\\/](cache[\\/][^\\/]+\.zip[\\/]node_modules|__virtual__)[\\/]/g;
|
|
97
77
|
function pitch() {
|
|
98
|
-
|
|
78
|
+
let callback = this.async();
|
|
99
79
|
(async () => {
|
|
100
|
-
let isWasm2 =
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
if (
|
|
108
|
-
// TODO: Evaluate if this is correct after removing pnp compatibility code in SB11
|
|
109
|
-
// TODO: investigate swc file reading in PnP mode?
|
|
110
|
-
!process.versions.pnp && !EXCLUDED_PATHS.test(this.resourcePath) && this.loaders.length - 1 === this.loaderIndex && isAbsolute(this.resourcePath) && !isWasm2
|
|
111
|
-
) {
|
|
112
|
-
const loaderSpan = mockCurrentTraceSpan.traceChild("next-swc-loader");
|
|
113
|
-
this.addDependency(this.resourcePath);
|
|
114
|
-
return loaderSpan.traceAsyncFn(() => loaderTransform.call(this, loaderSpan));
|
|
115
|
-
}
|
|
116
|
-
return null;
|
|
117
|
-
})().then((r) => {
|
|
118
|
-
if (r) {
|
|
119
|
-
return callback(null, ...r);
|
|
80
|
+
let isWasm2 = !1;
|
|
81
|
+
if (nextSwcUtils.isWasm ? isWasm2 = await nextSwcUtils.isWasm() : nextSwcUtils.getBindingsSync && (await nextSwcUtils.loadBindings(), isWasm2 = nextSwcUtils.getBindingsSync().isWasm), // TODO: Evaluate if this is correct after removing pnp compatibility code in SB11
|
|
82
|
+
// TODO: investigate swc file reading in PnP mode?
|
|
83
|
+
!process.versions.pnp && !EXCLUDED_PATHS.test(this.resourcePath) && this.loaders.length - 1 === this.loaderIndex && isAbsolute(this.resourcePath) && !isWasm2) {
|
|
84
|
+
let loaderSpan = mockCurrentTraceSpan.traceChild("next-swc-loader");
|
|
85
|
+
return this.addDependency(this.resourcePath), loaderSpan.traceAsyncFn(() => loaderTransform.call(this, loaderSpan));
|
|
120
86
|
}
|
|
121
|
-
callback();
|
|
122
87
|
return null;
|
|
123
|
-
}, callback);
|
|
88
|
+
})().then((r) => r ? callback(null, ...r) : (callback(), null), callback);
|
|
124
89
|
}
|
|
125
|
-
__name(pitch, "pitch");
|
|
126
90
|
function swcLoader(inputSource, inputSourceMap) {
|
|
127
|
-
|
|
128
|
-
const callback = this.async();
|
|
91
|
+
let loaderSpan = mockCurrentTraceSpan.traceChild("next-swc-loader"), callback = this.async();
|
|
129
92
|
loaderSpan.traceAsyncFn(() => loaderTransform.call(this, loaderSpan, inputSource, inputSourceMap)).then(
|
|
130
93
|
([transformedSource, outputSourceMap]) => {
|
|
131
94
|
callback(null, transformedSource, outputSourceMap || inputSourceMap);
|
|
@@ -135,8 +98,7 @@ function swcLoader(inputSource, inputSourceMap) {
|
|
|
135
98
|
}
|
|
136
99
|
);
|
|
137
100
|
}
|
|
138
|
-
|
|
139
|
-
var raw = true;
|
|
101
|
+
var raw = !0;
|
|
140
102
|
export {
|
|
141
103
|
swcLoader as default,
|
|
142
104
|
pitch,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/nextjs",
|
|
3
|
-
"version": "10.1.0-alpha.
|
|
3
|
+
"version": "10.1.0-alpha.11",
|
|
4
4
|
"description": "Storybook for Next.js: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"@babel/preset-typescript": "^7.24.1",
|
|
95
95
|
"@babel/runtime": "^7.24.4",
|
|
96
96
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
97
|
-
"@storybook/builder-webpack5": "10.1.0-alpha.
|
|
98
|
-
"@storybook/preset-react-webpack": "10.1.0-alpha.
|
|
99
|
-
"@storybook/react": "10.1.0-alpha.
|
|
97
|
+
"@storybook/builder-webpack5": "10.1.0-alpha.11",
|
|
98
|
+
"@storybook/preset-react-webpack": "10.1.0-alpha.11",
|
|
99
|
+
"@storybook/react": "10.1.0-alpha.11",
|
|
100
100
|
"@types/semver": "^7.3.4",
|
|
101
101
|
"babel-loader": "^9.1.3",
|
|
102
102
|
"css-loader": "^6.7.3",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"next": "^14.1.0 || ^15.0.0 || ^16.0.0",
|
|
131
131
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
132
132
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
133
|
-
"storybook": "^10.1.0-alpha.
|
|
133
|
+
"storybook": "^10.1.0-alpha.11",
|
|
134
134
|
"webpack": "^5.0.0"
|
|
135
135
|
},
|
|
136
136
|
"peerDependenciesMeta": {
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"publishConfig": {
|
|
145
145
|
"access": "public"
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
|
|
148
148
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-L5NVL7MD.js";
|
|
4
|
-
|
|
5
|
-
// src/images/next-image-default-loader.tsx
|
|
6
|
-
var defaultLoader = /* @__PURE__ */ __name(({ src, width, quality = 75 }) => {
|
|
7
|
-
const missingValues = [];
|
|
8
|
-
if (!src) {
|
|
9
|
-
missingValues.push("src");
|
|
10
|
-
}
|
|
11
|
-
if (!width) {
|
|
12
|
-
missingValues.push("width");
|
|
13
|
-
}
|
|
14
|
-
if (missingValues.length > 0) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`Next Image Optimization requires ${missingValues.join(
|
|
17
|
-
", "
|
|
18
|
-
)} to be provided. Make sure you pass them as props to the \`next/image\` component. Received: ${JSON.stringify(
|
|
19
|
-
{
|
|
20
|
-
src,
|
|
21
|
-
width,
|
|
22
|
-
quality
|
|
23
|
-
}
|
|
24
|
-
)}`
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
const url = new URL(src, window.location.href);
|
|
28
|
-
if (!url.searchParams.has("w") && !url.searchParams.has("q")) {
|
|
29
|
-
url.searchParams.set("w", width.toString());
|
|
30
|
-
url.searchParams.set("q", quality.toString());
|
|
31
|
-
}
|
|
32
|
-
if (!src.startsWith("http://") && !src.startsWith("https://")) {
|
|
33
|
-
return url.toString().slice(url.origin.length);
|
|
34
|
-
}
|
|
35
|
-
return url.toString();
|
|
36
|
-
}, "defaultLoader");
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
defaultLoader
|
|
40
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-L5NVL7MD.js";
|
|
4
|
-
|
|
5
|
-
// ../../lib/react-dom-shim/dist/_browser-chunks/chunk-JK72E6FR.js
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp(target, "name", { value, configurable: true }), "__name");
|
|
8
|
-
|
|
9
|
-
// ../../lib/react-dom-shim/dist/react-18.js
|
|
10
|
-
import * as React from "react";
|
|
11
|
-
import * as ReactDOM from "react-dom/client";
|
|
12
|
-
var nodes = /* @__PURE__ */ new Map();
|
|
13
|
-
function getIsReactActEnvironment() {
|
|
14
|
-
return globalThis.IS_REACT_ACT_ENVIRONMENT;
|
|
15
|
-
}
|
|
16
|
-
__name(getIsReactActEnvironment, "getIsReactActEnvironment");
|
|
17
|
-
__name2(getIsReactActEnvironment, "getIsReactActEnvironment");
|
|
18
|
-
var WithCallback = __name2(({
|
|
19
|
-
callback,
|
|
20
|
-
children
|
|
21
|
-
}) => {
|
|
22
|
-
const once = React.useRef();
|
|
23
|
-
React.useLayoutEffect(() => {
|
|
24
|
-
if (once.current === callback) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
once.current = callback;
|
|
28
|
-
callback();
|
|
29
|
-
}, [callback]);
|
|
30
|
-
return children;
|
|
31
|
-
}, "WithCallback");
|
|
32
|
-
if (typeof Promise.withResolvers === "undefined") {
|
|
33
|
-
Promise.withResolvers = () => {
|
|
34
|
-
let resolve = null;
|
|
35
|
-
let reject = null;
|
|
36
|
-
const promise = new Promise((res, rej) => {
|
|
37
|
-
resolve = res;
|
|
38
|
-
reject = rej;
|
|
39
|
-
});
|
|
40
|
-
return { promise, resolve, reject };
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
var renderElement = __name2(async (node, el, rootOptions) => {
|
|
44
|
-
const root = await getReactRoot(el, rootOptions);
|
|
45
|
-
if (getIsReactActEnvironment()) {
|
|
46
|
-
root.render(node);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const { promise, resolve } = Promise.withResolvers();
|
|
50
|
-
root.render(React.createElement(WithCallback, { callback: resolve }, node));
|
|
51
|
-
return promise;
|
|
52
|
-
}, "renderElement");
|
|
53
|
-
var unmountElement = __name2((el, shouldUseNewRootApi) => {
|
|
54
|
-
const root = nodes.get(el);
|
|
55
|
-
if (root) {
|
|
56
|
-
root.unmount();
|
|
57
|
-
nodes.delete(el);
|
|
58
|
-
}
|
|
59
|
-
}, "unmountElement");
|
|
60
|
-
var getReactRoot = __name2(async (el, rootOptions) => {
|
|
61
|
-
let root = nodes.get(el);
|
|
62
|
-
if (!root) {
|
|
63
|
-
root = ReactDOM.createRoot(el, rootOptions);
|
|
64
|
-
nodes.set(el, root);
|
|
65
|
-
}
|
|
66
|
-
return root;
|
|
67
|
-
}, "getReactRoot");
|
|
68
|
-
export {
|
|
69
|
-
renderElement,
|
|
70
|
-
unmountElement
|
|
71
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_1wy8hqz8e24 from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_1wy8hqz8e24 from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_1wy8hqz8e24 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_1wy8hqz8e24.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_1wy8hqz8e24.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_1wy8hqz8e24.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-EVMWO5FG.js";
|
|
17
|
-
import {
|
|
18
|
-
__name
|
|
19
|
-
} from "./chunk-Z2RESD5M.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
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_1wy8hqz8e24 from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_1wy8hqz8e24 from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_1wy8hqz8e24 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_1wy8hqz8e24.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_1wy8hqz8e24.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_1wy8hqz8e24.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-RSBRC6AY.js";
|
|
15
|
-
import {
|
|
16
|
-
__name
|
|
17
|
-
} from "./chunk-Z2RESD5M.js";
|
|
18
|
-
|
|
19
|
-
// src/utils.ts
|
|
20
|
-
import { readFileSync } from "node:fs";
|
|
21
|
-
import { dirname, join, sep } from "node:path";
|
|
22
|
-
import { fileURLToPath } from "node:url";
|
|
23
|
-
import { getProjectRoot } from "storybook/internal/common";
|
|
24
|
-
import { WebpackDefinePlugin } from "@storybook/builder-webpack5";
|
|
25
|
-
import { PHASE_DEVELOPMENT_SERVER } from "next/constants.js";
|
|
26
|
-
import nextJsLoadConfigModule from "next/dist/server/config.js";
|
|
27
|
-
import semver from "semver";
|
|
28
|
-
var configureRuntimeNextjsVersionResolution = /* @__PURE__ */ __name((baseConfig) => {
|
|
29
|
-
baseConfig.plugins?.push(
|
|
30
|
-
new WebpackDefinePlugin({
|
|
31
|
-
"process.env.__NEXT_VERSION": JSON.stringify(getNextjsVersion())
|
|
32
|
-
})
|
|
33
|
-
);
|
|
34
|
-
}, "configureRuntimeNextjsVersionResolution");
|
|
35
|
-
var getNextjsVersion = /* @__PURE__ */ __name(() => JSON.parse(readFileSync(join(resolvePackageDir("next"), "package.json"), "utf8")).version, "getNextjsVersion");
|
|
36
|
-
var isNextVersionGte = /* @__PURE__ */ __name((version) => {
|
|
37
|
-
const currentVersion = getNextjsVersion();
|
|
38
|
-
const coercedVersion = semver.coerce(currentVersion);
|
|
39
|
-
return coercedVersion ? semver.gte(coercedVersion, version) : false;
|
|
40
|
-
}, "isNextVersionGte");
|
|
41
|
-
var resolveNextConfig = /* @__PURE__ */ __name(async ({
|
|
42
|
-
nextConfigPath
|
|
43
|
-
}) => {
|
|
44
|
-
const dir = nextConfigPath ? dirname(nextConfigPath) : getProjectRoot();
|
|
45
|
-
const loadConfig = nextJsLoadConfigModule.default ?? nextJsLoadConfigModule;
|
|
46
|
-
const nextPrivateRenderWorker = process.env.__NEXT_PRIVATE_RENDER_WORKER;
|
|
47
|
-
process.env.__NEXT_PRIVATE_RENDER_WORKER = "defined";
|
|
48
|
-
const config = loadConfig(PHASE_DEVELOPMENT_SERVER, dir, void 0);
|
|
49
|
-
if (typeof nextPrivateRenderWorker === "undefined") {
|
|
50
|
-
delete process.env.__NEXT_PRIVATE_RENDER_WORKER;
|
|
51
|
-
} else {
|
|
52
|
-
process.env.__NEXT_PRIVATE_RENDER_WORKER = nextPrivateRenderWorker;
|
|
53
|
-
}
|
|
54
|
-
return config;
|
|
55
|
-
}, "resolveNextConfig");
|
|
56
|
-
function setAlias(baseConfig, name, alias) {
|
|
57
|
-
baseConfig.resolve ??= {};
|
|
58
|
-
baseConfig.resolve.alias ??= {};
|
|
59
|
-
const aliasConfig = baseConfig.resolve.alias;
|
|
60
|
-
if (Array.isArray(aliasConfig)) {
|
|
61
|
-
aliasConfig.push({
|
|
62
|
-
name,
|
|
63
|
-
alias
|
|
64
|
-
});
|
|
65
|
-
} else {
|
|
66
|
-
aliasConfig[name] = alias;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
__name(setAlias, "setAlias");
|
|
70
|
-
var addScopedAlias = /* @__PURE__ */ __name((baseConfig, name, alias) => {
|
|
71
|
-
const scopedAlias = scopedResolve(`${alias ?? name}`);
|
|
72
|
-
setAlias(baseConfig, name, scopedAlias);
|
|
73
|
-
}, "addScopedAlias");
|
|
74
|
-
var scopedResolve = /* @__PURE__ */ __name((id) => {
|
|
75
|
-
const scopedModulePath = fileURLToPath(import.meta.resolve(id));
|
|
76
|
-
const idWithNativePathSep = id.replace(/\//g, sep);
|
|
77
|
-
if (scopedModulePath.endsWith(idWithNativePathSep)) {
|
|
78
|
-
return scopedModulePath;
|
|
79
|
-
}
|
|
80
|
-
const moduleFolderStrPosition = scopedModulePath.lastIndexOf(idWithNativePathSep);
|
|
81
|
-
const beginningOfMainScriptPath = moduleFolderStrPosition + id.length;
|
|
82
|
-
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
83
|
-
}, "scopedResolve");
|
|
84
|
-
function getNodeModulesExcludeRegex(transpilePackages) {
|
|
85
|
-
if (!transpilePackages || transpilePackages.length === 0) {
|
|
86
|
-
return /node_modules/;
|
|
87
|
-
}
|
|
88
|
-
const escaped = transpilePackages.map((pkg) => pkg.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
89
|
-
return new RegExp(`node_modules/(?!(${escaped})/)`);
|
|
90
|
-
}
|
|
91
|
-
__name(getNodeModulesExcludeRegex, "getNodeModulesExcludeRegex");
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
configureRuntimeNextjsVersionResolution,
|
|
95
|
-
getNextjsVersion,
|
|
96
|
-
isNextVersionGte,
|
|
97
|
-
resolveNextConfig,
|
|
98
|
-
setAlias,
|
|
99
|
-
addScopedAlias,
|
|
100
|
-
scopedResolve,
|
|
101
|
-
getNodeModulesExcludeRegex
|
|
102
|
-
};
|