@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__export
|
|
3
|
-
|
|
4
|
-
} from "./chunk-L5NVL7MD.js";
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-SL3VIQZ3.js";
|
|
5
4
|
|
|
6
5
|
// src/preview.tsx
|
|
7
6
|
var preview_exports = {};
|
|
@@ -21,28 +20,18 @@ import * as React2 from "react";
|
|
|
21
20
|
import React, { useMemo } from "react";
|
|
22
21
|
import initHeadManager from "next/dist/client/head-manager";
|
|
23
22
|
import { HeadManagerContext } from "next/dist/shared/lib/head-manager-context.shared-runtime";
|
|
24
|
-
var HeadManagerProvider =
|
|
25
|
-
|
|
26
|
-
headManager.getIsSsr = () =>
|
|
27
|
-
|
|
28
|
-
}, "HeadManagerProvider");
|
|
29
|
-
var head_manager_provider_default = HeadManagerProvider;
|
|
23
|
+
var HeadManagerProvider = ({ children }) => {
|
|
24
|
+
let headManager = useMemo(initHeadManager, []);
|
|
25
|
+
return headManager.getIsSsr = () => !1, React.createElement(HeadManagerContext.Provider, { value: headManager }, children);
|
|
26
|
+
}, head_manager_provider_default = HeadManagerProvider;
|
|
30
27
|
|
|
31
28
|
// src/head-manager/decorator.tsx
|
|
32
|
-
var HeadManagerDecorator =
|
|
33
|
-
return React2.createElement(head_manager_provider_default, null, React2.createElement(Story, null));
|
|
34
|
-
}, "HeadManagerDecorator");
|
|
29
|
+
var HeadManagerDecorator = (Story) => React2.createElement(head_manager_provider_default, null, React2.createElement(Story, null));
|
|
35
30
|
|
|
36
31
|
// src/images/decorator.tsx
|
|
37
32
|
import * as React3 from "react";
|
|
38
33
|
import { ImageContext as ImageContextValue } from "@storybook/nextjs/image-context";
|
|
39
|
-
var ImageContext = ImageContextValue;
|
|
40
|
-
var ImageDecorator = /* @__PURE__ */ __name((Story, { parameters: parameters2 }) => {
|
|
41
|
-
if (!parameters2.nextjs?.image) {
|
|
42
|
-
return React3.createElement(Story, null);
|
|
43
|
-
}
|
|
44
|
-
return React3.createElement(ImageContext.Provider, { value: parameters2.nextjs.image }, React3.createElement(Story, null));
|
|
45
|
-
}, "ImageDecorator");
|
|
34
|
+
var ImageContext = ImageContextValue, ImageDecorator = (Story, { parameters: parameters2 }) => parameters2.nextjs?.image ? React3.createElement(ImageContext.Provider, { value: parameters2.nextjs.image }, React3.createElement(Story, null)) : React3.createElement(Story, null);
|
|
46
35
|
|
|
47
36
|
// src/routing/decorator.tsx
|
|
48
37
|
import * as React6 from "react";
|
|
@@ -62,43 +51,30 @@ import {
|
|
|
62
51
|
SearchParamsContext
|
|
63
52
|
} from "next/dist/shared/lib/hooks-client-context.shared-runtime";
|
|
64
53
|
import { PAGE_SEGMENT_KEY } from "next/dist/shared/lib/segment";
|
|
65
|
-
var getParallelRoutes =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
return [];
|
|
71
|
-
}, "getParallelRoutes");
|
|
72
|
-
var AppRouterProvider = /* @__PURE__ */ __name(({
|
|
54
|
+
var getParallelRoutes = (segmentsList) => {
|
|
55
|
+
let segment = segmentsList.shift();
|
|
56
|
+
return segment ? [segment, { children: getParallelRoutes(segmentsList) }] : [];
|
|
57
|
+
}, AppRouterProvider = ({
|
|
73
58
|
children,
|
|
74
59
|
routeParams
|
|
75
60
|
}) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const pathParams = useMemo2(() => {
|
|
79
|
-
const params = {};
|
|
80
|
-
const currentSegments = routeParams.segments;
|
|
61
|
+
let { pathname, query, segments = [] } = routeParams, tree = [pathname, { children: getParallelRoutes([...segments]) }], pathParams = useMemo2(() => {
|
|
62
|
+
let params = {}, currentSegments = routeParams.segments;
|
|
81
63
|
if (currentSegments) {
|
|
82
64
|
if (Array.isArray(currentSegments)) {
|
|
83
|
-
for (
|
|
84
|
-
if (Array.isArray(segmentEntry) && segmentEntry.length === 2 && typeof segmentEntry[0]
|
|
85
|
-
|
|
86
|
-
const value = segmentEntry[1];
|
|
65
|
+
for (let segmentEntry of currentSegments)
|
|
66
|
+
if (Array.isArray(segmentEntry) && segmentEntry.length === 2 && typeof segmentEntry[0] == "string") {
|
|
67
|
+
let key = segmentEntry[0], value = segmentEntry[1];
|
|
87
68
|
params[key] = value;
|
|
88
69
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (Object.prototype.hasOwnProperty.call(segmentObject, key)) {
|
|
94
|
-
params[key] = segmentObject[key];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
70
|
+
} else if (typeof currentSegments == "object" && !Array.isArray(currentSegments)) {
|
|
71
|
+
let segmentObject = currentSegments;
|
|
72
|
+
for (let key in segmentObject)
|
|
73
|
+
Object.prototype.hasOwnProperty.call(segmentObject, key) && (params[key] = segmentObject[key]);
|
|
97
74
|
}
|
|
98
75
|
}
|
|
99
76
|
return params;
|
|
100
|
-
}, [routeParams.segments])
|
|
101
|
-
const newLazyCacheNode = {
|
|
77
|
+
}, [routeParams.segments]), newLazyCacheNode = {
|
|
102
78
|
lazyData: null,
|
|
103
79
|
rsc: null,
|
|
104
80
|
prefetchRsc: null,
|
|
@@ -118,10 +94,10 @@ var AppRouterProvider = /* @__PURE__ */ __name(({
|
|
|
118
94
|
buildId: "storybook",
|
|
119
95
|
tree,
|
|
120
96
|
focusAndScrollRef: {
|
|
121
|
-
apply:
|
|
97
|
+
apply: !1,
|
|
122
98
|
hashFragment: null,
|
|
123
99
|
segmentPaths: [tree],
|
|
124
|
-
onlyHashChange:
|
|
100
|
+
onlyHashChange: !1
|
|
125
101
|
},
|
|
126
102
|
nextUrl: pathname
|
|
127
103
|
}
|
|
@@ -149,64 +125,47 @@ var AppRouterProvider = /* @__PURE__ */ __name(({
|
|
|
149
125
|
children
|
|
150
126
|
))
|
|
151
127
|
))));
|
|
152
|
-
}
|
|
128
|
+
};
|
|
153
129
|
|
|
154
130
|
// src/routing/page-router-provider.tsx
|
|
155
131
|
import React5 from "react";
|
|
156
132
|
import { getRouter as getRouter2 } from "@storybook/nextjs/router.mock";
|
|
157
133
|
import { RouterContext } from "next/dist/shared/lib/router-context.shared-runtime";
|
|
158
|
-
var PageRouterProvider =
|
|
134
|
+
var PageRouterProvider = ({ children }) => React5.createElement(RouterContext.Provider, { value: getRouter2() }, children);
|
|
159
135
|
|
|
160
136
|
// src/routing/decorator.tsx
|
|
161
137
|
var defaultRouterParams = {
|
|
162
138
|
pathname: "/",
|
|
163
139
|
query: {}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
140
|
+
}, RouterDecorator = (Story, { parameters: parameters2 }) => parameters2.nextjs?.appDirectory ?? !1 ? AppRouterProvider ? React6.createElement(
|
|
141
|
+
AppRouterProvider,
|
|
142
|
+
{
|
|
143
|
+
routeParams: {
|
|
144
|
+
...defaultRouterParams,
|
|
145
|
+
...parameters2.nextjs?.navigation
|
|
170
146
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
routeParams: {
|
|
175
|
-
...defaultRouterParams,
|
|
176
|
-
...parameters2.nextjs?.navigation
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
React6.createElement(RedirectBoundary, null, React6.createElement(Story, null))
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
return React6.createElement(PageRouterProvider, null, React6.createElement(Story, null));
|
|
183
|
-
}, "RouterDecorator");
|
|
147
|
+
},
|
|
148
|
+
React6.createElement(RedirectBoundary, null, React6.createElement(Story, null))
|
|
149
|
+
) : null : React6.createElement(PageRouterProvider, null, React6.createElement(Story, null));
|
|
184
150
|
|
|
185
151
|
// src/styledJsx/decorator.tsx
|
|
186
152
|
import * as React7 from "react";
|
|
187
153
|
import { StyleRegistry } from "styled-jsx";
|
|
188
|
-
var StyledJsxDecorator =
|
|
154
|
+
var StyledJsxDecorator = (Story) => React7.createElement(StyleRegistry, null, React7.createElement(Story, null));
|
|
189
155
|
|
|
190
156
|
// src/preview.tsx
|
|
191
157
|
function addNextHeadCount() {
|
|
192
|
-
|
|
193
|
-
meta.name = "next-head-count";
|
|
194
|
-
meta.content = "0";
|
|
195
|
-
document.head.appendChild(meta);
|
|
158
|
+
let meta = document.createElement("meta");
|
|
159
|
+
meta.name = "next-head-count", meta.content = "0", document.head.appendChild(meta);
|
|
196
160
|
}
|
|
197
|
-
__name(addNextHeadCount, "addNextHeadCount");
|
|
198
161
|
function isAsyncClientComponentError(error) {
|
|
199
|
-
return typeof error
|
|
162
|
+
return typeof error == "string" && (error.includes("Only Server Components can be async at the moment.") || error.includes("A component was suspended by an uncached promise.") || error.includes("async/await is not yet supported in Client Components"));
|
|
200
163
|
}
|
|
201
|
-
__name(isAsyncClientComponentError, "isAsyncClientComponentError");
|
|
202
164
|
addNextHeadCount();
|
|
203
165
|
var origConsoleError = globalThis.console.error;
|
|
204
166
|
globalThis.console.error = (...args) => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
origConsoleError.apply(globalThis.console, args);
|
|
167
|
+
let error = args[0];
|
|
168
|
+
isNextRouterError(error) || isAsyncClientComponentError(error) || origConsoleError.apply(globalThis.console, args);
|
|
210
169
|
};
|
|
211
170
|
globalThis.addEventListener("error", (ev) => {
|
|
212
171
|
if (isNextRouterError(ev.error) || isAsyncClientComponentError(ev.error)) {
|
|
@@ -219,31 +178,22 @@ var decorators = [
|
|
|
219
178
|
ImageDecorator,
|
|
220
179
|
RouterDecorator,
|
|
221
180
|
HeadManagerDecorator
|
|
222
|
-
]
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
locale: globals.locale,
|
|
230
|
-
...router
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}, "loaders");
|
|
234
|
-
var parameters = {
|
|
181
|
+
], loaders = async ({ globals, parameters: parameters2 }) => {
|
|
182
|
+
let { router, appDirectory } = parameters2.nextjs ?? {};
|
|
183
|
+
appDirectory ? createNavigation(router) : createRouter({
|
|
184
|
+
locale: globals.locale,
|
|
185
|
+
...router
|
|
186
|
+
});
|
|
187
|
+
}, parameters = {
|
|
235
188
|
docs: {
|
|
236
189
|
source: {
|
|
237
|
-
excludeDecorators:
|
|
190
|
+
excludeDecorators: !0
|
|
238
191
|
}
|
|
239
192
|
},
|
|
240
193
|
react: {
|
|
241
194
|
rootOptions: {
|
|
242
195
|
onCaughtError(error) {
|
|
243
|
-
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
console.error(error);
|
|
196
|
+
isNextRouterError(error) || console.error(error);
|
|
247
197
|
}
|
|
248
198
|
}
|
|
249
199
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/images/next-image-default-loader.tsx
|
|
2
|
+
var defaultLoader = ({ src, width, quality = 75 }) => {
|
|
3
|
+
let missingValues = [];
|
|
4
|
+
if (src || missingValues.push("src"), width || missingValues.push("width"), missingValues.length > 0)
|
|
5
|
+
throw new Error(
|
|
6
|
+
`Next Image Optimization requires ${missingValues.join(
|
|
7
|
+
", "
|
|
8
|
+
)} to be provided. Make sure you pass them as props to the \`next/image\` component. Received: ${JSON.stringify(
|
|
9
|
+
{
|
|
10
|
+
src,
|
|
11
|
+
width,
|
|
12
|
+
quality
|
|
13
|
+
}
|
|
14
|
+
)}`
|
|
15
|
+
);
|
|
16
|
+
let url = new URL(src, window.location.href);
|
|
17
|
+
return !url.searchParams.has("w") && !url.searchParams.has("q") && (url.searchParams.set("w", width.toString()), url.searchParams.set("q", quality.toString())), !src.startsWith("http://") && !src.startsWith("https://") ? url.toString().slice(url.origin.length) : url.toString();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
defaultLoader
|
|
22
|
+
};
|
|
@@ -2,22 +2,17 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __commonJS = (cb, mod) => function() {
|
|
9
7
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
8
|
};
|
|
11
9
|
var __export = (target, all) => {
|
|
12
10
|
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
12
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
17
14
|
for (let key of __getOwnPropNames(from))
|
|
18
|
-
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
15
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
16
|
return to;
|
|
22
17
|
};
|
|
23
18
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -25,12 +20,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
20
|
// file that has been converted to a CommonJS file using a Babel-
|
|
26
21
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
22
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
29
24
|
mod
|
|
30
25
|
));
|
|
31
26
|
|
|
32
27
|
export {
|
|
33
|
-
__name,
|
|
34
28
|
__commonJS,
|
|
35
29
|
__export,
|
|
36
30
|
__toESM
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "./chunk-SL3VIQZ3.js";
|
|
2
|
+
|
|
3
|
+
// ../../lib/react-dom-shim/dist/react-18.js
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as ReactDOM from "react-dom/client";
|
|
6
|
+
var nodes = /* @__PURE__ */ new Map();
|
|
7
|
+
function getIsReactActEnvironment() {
|
|
8
|
+
return globalThis.IS_REACT_ACT_ENVIRONMENT;
|
|
9
|
+
}
|
|
10
|
+
var WithCallback = ({
|
|
11
|
+
callback,
|
|
12
|
+
children
|
|
13
|
+
}) => {
|
|
14
|
+
let once = React.useRef();
|
|
15
|
+
return React.useLayoutEffect(() => {
|
|
16
|
+
once.current !== callback && (once.current = callback, callback());
|
|
17
|
+
}, [callback]), children;
|
|
18
|
+
};
|
|
19
|
+
typeof Promise.withResolvers > "u" && (Promise.withResolvers = () => {
|
|
20
|
+
let resolve = null, reject = null;
|
|
21
|
+
return { promise: new Promise((res, rej) => {
|
|
22
|
+
resolve = res, reject = rej;
|
|
23
|
+
}), resolve, reject };
|
|
24
|
+
});
|
|
25
|
+
var renderElement = async (node, el, rootOptions) => {
|
|
26
|
+
let root = await getReactRoot(el, rootOptions);
|
|
27
|
+
if (getIsReactActEnvironment()) {
|
|
28
|
+
root.render(node);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let { promise, resolve } = Promise.withResolvers();
|
|
32
|
+
return root.render(React.createElement(WithCallback, { callback: resolve }, node)), promise;
|
|
33
|
+
}, unmountElement = (el, shouldUseNewRootApi) => {
|
|
34
|
+
let root = nodes.get(el);
|
|
35
|
+
root && (root.unmount(), nodes.delete(el));
|
|
36
|
+
}, getReactRoot = async (el, rootOptions) => {
|
|
37
|
+
let root = nodes.get(el);
|
|
38
|
+
return root || (root = ReactDOM.createRoot(el, rootOptions), nodes.set(el, root)), root;
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
renderElement,
|
|
42
|
+
unmountElement
|
|
43
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
resolvePackageDir
|
|
14
|
+
} from "./chunk-NVSKNSJK.js";
|
|
15
|
+
|
|
16
|
+
// src/utils.ts
|
|
17
|
+
import { readFileSync } from "node:fs";
|
|
18
|
+
import { dirname, join, sep } from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
import { getProjectRoot } from "storybook/internal/common";
|
|
21
|
+
import { WebpackDefinePlugin } from "@storybook/builder-webpack5";
|
|
22
|
+
import { PHASE_DEVELOPMENT_SERVER } from "next/constants.js";
|
|
23
|
+
import nextJsLoadConfigModule from "next/dist/server/config.js";
|
|
24
|
+
import semver from "semver";
|
|
25
|
+
var configureRuntimeNextjsVersionResolution = (baseConfig) => {
|
|
26
|
+
baseConfig.plugins?.push(
|
|
27
|
+
new WebpackDefinePlugin({
|
|
28
|
+
"process.env.__NEXT_VERSION": JSON.stringify(getNextjsVersion())
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
}, getNextjsVersion = () => JSON.parse(readFileSync(join(resolvePackageDir("next"), "package.json"), "utf8")).version, isNextVersionGte = (version) => {
|
|
32
|
+
let currentVersion = getNextjsVersion(), coercedVersion = semver.coerce(currentVersion);
|
|
33
|
+
return coercedVersion ? semver.gte(coercedVersion, version) : !1;
|
|
34
|
+
}, resolveNextConfig = async ({
|
|
35
|
+
nextConfigPath
|
|
36
|
+
}) => {
|
|
37
|
+
let dir = nextConfigPath ? dirname(nextConfigPath) : getProjectRoot(), loadConfig = nextJsLoadConfigModule.default ?? nextJsLoadConfigModule, nextPrivateRenderWorker = process.env.__NEXT_PRIVATE_RENDER_WORKER;
|
|
38
|
+
process.env.__NEXT_PRIVATE_RENDER_WORKER = "defined";
|
|
39
|
+
let config = loadConfig(PHASE_DEVELOPMENT_SERVER, dir, void 0);
|
|
40
|
+
return typeof nextPrivateRenderWorker > "u" ? delete process.env.__NEXT_PRIVATE_RENDER_WORKER : process.env.__NEXT_PRIVATE_RENDER_WORKER = nextPrivateRenderWorker, config;
|
|
41
|
+
};
|
|
42
|
+
function setAlias(baseConfig, name, alias) {
|
|
43
|
+
baseConfig.resolve ??= {}, baseConfig.resolve.alias ??= {};
|
|
44
|
+
let aliasConfig = baseConfig.resolve.alias;
|
|
45
|
+
Array.isArray(aliasConfig) ? aliasConfig.push({
|
|
46
|
+
name,
|
|
47
|
+
alias
|
|
48
|
+
}) : aliasConfig[name] = alias;
|
|
49
|
+
}
|
|
50
|
+
var addScopedAlias = (baseConfig, name, alias) => {
|
|
51
|
+
let scopedAlias = scopedResolve(`${alias ?? name}`);
|
|
52
|
+
setAlias(baseConfig, name, scopedAlias);
|
|
53
|
+
}, scopedResolve = (id) => {
|
|
54
|
+
let scopedModulePath = fileURLToPath(import.meta.resolve(id)), idWithNativePathSep = id.replace(/\//g, sep);
|
|
55
|
+
if (scopedModulePath.endsWith(idWithNativePathSep))
|
|
56
|
+
return scopedModulePath;
|
|
57
|
+
let beginningOfMainScriptPath = scopedModulePath.lastIndexOf(idWithNativePathSep) + id.length;
|
|
58
|
+
return scopedModulePath.substring(0, beginningOfMainScriptPath);
|
|
59
|
+
};
|
|
60
|
+
function getNodeModulesExcludeRegex(transpilePackages) {
|
|
61
|
+
if (!transpilePackages || transpilePackages.length === 0)
|
|
62
|
+
return /node_modules/;
|
|
63
|
+
let escaped = transpilePackages.map((pkg) => pkg.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
64
|
+
return new RegExp(`node_modules/(?!(${escaped})/)`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
configureRuntimeNextjsVersionResolution,
|
|
69
|
+
getNextjsVersion,
|
|
70
|
+
isNextVersionGte,
|
|
71
|
+
resolveNextConfig,
|
|
72
|
+
setAlias,
|
|
73
|
+
addScopedAlias,
|
|
74
|
+
scopedResolve,
|
|
75
|
+
getNodeModulesExcludeRegex
|
|
76
|
+
};
|
|
@@ -0,0 +1,205 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// ../../core/src/shared/utils/module.ts
|
|
14
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
15
|
+
|
|
16
|
+
// ../../node_modules/exsolve/dist/index.mjs
|
|
17
|
+
import assert from "node:assert";
|
|
18
|
+
import v8 from "node:v8";
|
|
19
|
+
import { format, inspect } from "node:util";
|
|
20
|
+
var own$1 = {}.hasOwnProperty, classRegExp = /^([A-Z][a-z\d]*)+$/, kTypes = /* @__PURE__ */ new Set([
|
|
21
|
+
"string",
|
|
22
|
+
"function",
|
|
23
|
+
"number",
|
|
24
|
+
"object",
|
|
25
|
+
"Function",
|
|
26
|
+
"Object",
|
|
27
|
+
"boolean",
|
|
28
|
+
"bigint",
|
|
29
|
+
"symbol"
|
|
30
|
+
]), messages = /* @__PURE__ */ new Map(), nodeInternalPrefix = "__node_internal_", userStackTraceLimit;
|
|
31
|
+
function formatList(array, type = "and") {
|
|
32
|
+
return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
|
|
33
|
+
}
|
|
34
|
+
function createError(sym, value, constructor) {
|
|
35
|
+
return messages.set(sym, value), makeNodeErrorWithCode(constructor, sym);
|
|
36
|
+
}
|
|
37
|
+
function makeNodeErrorWithCode(Base, key) {
|
|
38
|
+
return function(...parameters) {
|
|
39
|
+
let limit = Error.stackTraceLimit;
|
|
40
|
+
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = 0);
|
|
41
|
+
let error = new Base();
|
|
42
|
+
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = limit);
|
|
43
|
+
let message = getMessage(key, parameters, error);
|
|
44
|
+
return Object.defineProperties(error, {
|
|
45
|
+
message: {
|
|
46
|
+
value: message,
|
|
47
|
+
enumerable: !1,
|
|
48
|
+
writable: !0,
|
|
49
|
+
configurable: !0
|
|
50
|
+
},
|
|
51
|
+
toString: {
|
|
52
|
+
value() {
|
|
53
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
54
|
+
},
|
|
55
|
+
enumerable: !1,
|
|
56
|
+
writable: !0,
|
|
57
|
+
configurable: !0
|
|
58
|
+
}
|
|
59
|
+
}), captureLargerStackTrace(error), error.code = key, error;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function isErrorStackTraceLimitWritable() {
|
|
63
|
+
try {
|
|
64
|
+
if (v8.startupSnapshot.isBuildingSnapshot()) return !1;
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
let desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
68
|
+
return desc === void 0 ? Object.isExtensible(Error) : own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
|
|
69
|
+
}
|
|
70
|
+
function hideStackFrames(wrappedFunction) {
|
|
71
|
+
let hidden = nodeInternalPrefix + wrappedFunction.name;
|
|
72
|
+
return Object.defineProperty(wrappedFunction, "name", { value: hidden }), wrappedFunction;
|
|
73
|
+
}
|
|
74
|
+
var captureLargerStackTrace = hideStackFrames(function(error) {
|
|
75
|
+
let stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
76
|
+
return stackTraceLimitIsWritable && (userStackTraceLimit = Error.stackTraceLimit, Error.stackTraceLimit = Number.POSITIVE_INFINITY), Error.captureStackTrace(error), stackTraceLimitIsWritable && (Error.stackTraceLimit = userStackTraceLimit), error;
|
|
77
|
+
});
|
|
78
|
+
function getMessage(key, parameters, self) {
|
|
79
|
+
let message = messages.get(key);
|
|
80
|
+
if (assert.ok(message !== void 0, "expected `message` to be found"), typeof message == "function")
|
|
81
|
+
return assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`), Reflect.apply(message, self, parameters);
|
|
82
|
+
let regex = /%[dfijoOs]/g, expectedLength = 0;
|
|
83
|
+
for (; regex.exec(message) !== null; ) expectedLength++;
|
|
84
|
+
return assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`), parameters.length === 0 ? message : (parameters.unshift(message), Reflect.apply(format, null, parameters));
|
|
85
|
+
}
|
|
86
|
+
function determineSpecificType(value) {
|
|
87
|
+
if (value == null) return String(value);
|
|
88
|
+
if (typeof value == "function" && value.name) return `function ${value.name}`;
|
|
89
|
+
if (typeof value == "object")
|
|
90
|
+
return value.constructor && value.constructor.name ? `an instance of ${value.constructor.name}` : `${inspect(value, { depth: -1 })}`;
|
|
91
|
+
let inspected = inspect(value, { colors: !1 });
|
|
92
|
+
return inspected.length > 28 && (inspected = `${inspected.slice(0, 25)}...`), `type ${typeof value} (${inspected})`;
|
|
93
|
+
}
|
|
94
|
+
var ERR_INVALID_ARG_TYPE = createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
|
|
95
|
+
assert.ok(typeof name == "string", "'name' must be a string"), Array.isArray(expected) || (expected = [expected]);
|
|
96
|
+
let message = "The ";
|
|
97
|
+
if (name.endsWith(" argument")) message += `${name} `;
|
|
98
|
+
else {
|
|
99
|
+
let type = name.includes(".") ? "property" : "argument";
|
|
100
|
+
message += `"${name}" ${type} `;
|
|
101
|
+
}
|
|
102
|
+
message += "must be ";
|
|
103
|
+
let types = [], instances = [], other = [];
|
|
104
|
+
for (let value of expected)
|
|
105
|
+
assert.ok(typeof value == "string", "All expected entries have to be of type string"), kTypes.has(value) ? types.push(value.toLowerCase()) : classRegExp.exec(value) === null ? (assert.ok(value !== "object", 'The value "object" should be written as "Object"'), other.push(value)) : instances.push(value);
|
|
106
|
+
if (instances.length > 0) {
|
|
107
|
+
let pos = types.indexOf("object");
|
|
108
|
+
pos !== -1 && (types.slice(pos, 1), instances.push("Object"));
|
|
109
|
+
}
|
|
110
|
+
return types.length > 0 && (message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`, (instances.length > 0 || other.length > 0) && (message += " or ")), instances.length > 0 && (message += `an instance of ${formatList(instances, "or")}`, other.length > 0 && (message += " or ")), other.length > 0 && (other.length > 1 ? message += `one of ${formatList(other, "or")}` : (other[0]?.toLowerCase() !== other[0] && (message += "an "), message += `${other[0]}`)), message += `. Received ${determineSpecificType(actual)}`, message;
|
|
111
|
+
}, TypeError), ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
112
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
113
|
+
/**
|
|
114
|
+
* @param {string} request
|
|
115
|
+
* @param {string} reason
|
|
116
|
+
* @param {string} [base]
|
|
117
|
+
*/
|
|
118
|
+
(request, reason, base) => `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`,
|
|
119
|
+
TypeError
|
|
120
|
+
), ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$1, base, message) => `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`, Error), ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = !1, base) => {
|
|
121
|
+
let relatedError = typeof target == "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
122
|
+
return key === "." ? (assert.ok(isImport === !1), `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`) : `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
|
123
|
+
}, Error), ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path$1, base, exactUrl = !1) => `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`, Error), ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error), ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`, TypeError), ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
124
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
125
|
+
/**
|
|
126
|
+
* @param {string} packagePath
|
|
127
|
+
* @param {string} subpath
|
|
128
|
+
* @param {string} [base]
|
|
129
|
+
*/
|
|
130
|
+
(packagePath, subpath, base) => subpath === "." ? `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}` : `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`,
|
|
131
|
+
Error
|
|
132
|
+
), ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error), ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.', TypeError), ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path$1) => `Unknown file extension "${extension}" for ${path$1}`, TypeError), ERR_INVALID_ARG_VALUE = createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
|
|
133
|
+
let inspected = inspect(value);
|
|
134
|
+
return inspected.length > 128 && (inspected = `${inspected.slice(0, 128)}...`), `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
|
|
135
|
+
}, TypeError), hasOwnProperty$1 = {}.hasOwnProperty;
|
|
136
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
137
|
+
var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.hasOwnProperty;
|
|
138
|
+
var isWindows = process.platform === "win32", globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
|
|
139
|
+
|
|
140
|
+
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
141
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
142
|
+
function normalizeWindowsPath(input = "") {
|
|
143
|
+
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
144
|
+
}
|
|
145
|
+
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
146
|
+
var normalize = function(path2) {
|
|
147
|
+
if (path2.length === 0)
|
|
148
|
+
return ".";
|
|
149
|
+
path2 = normalizeWindowsPath(path2);
|
|
150
|
+
let isUNCPath = path2.match(_UNC_REGEX), isPathAbsolute = isAbsolute(path2), trailingSeparator = path2[path2.length - 1] === "/";
|
|
151
|
+
return path2 = normalizeString(path2, !isPathAbsolute), path2.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path2 += "/"), _DRIVE_LETTER_RE.test(path2) && (path2 += "/"), isUNCPath ? isPathAbsolute ? `//${path2}` : `//./${path2}` : isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2);
|
|
152
|
+
}, join = function(...arguments_) {
|
|
153
|
+
if (arguments_.length === 0)
|
|
154
|
+
return ".";
|
|
155
|
+
let joined;
|
|
156
|
+
for (let argument of arguments_)
|
|
157
|
+
argument && argument.length > 0 && (joined === void 0 ? joined = argument : joined += `/${argument}`);
|
|
158
|
+
return joined === void 0 ? "." : normalize(joined.replace(/\/\/+/g, "/"));
|
|
159
|
+
};
|
|
160
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
161
|
+
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
162
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
163
|
+
if (index < path2.length)
|
|
164
|
+
char = path2[index];
|
|
165
|
+
else {
|
|
166
|
+
if (char === "/")
|
|
167
|
+
break;
|
|
168
|
+
char = "/";
|
|
169
|
+
}
|
|
170
|
+
if (char === "/") {
|
|
171
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
172
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
173
|
+
if (res.length > 2) {
|
|
174
|
+
let lastSlashIndex = res.lastIndexOf("/");
|
|
175
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
176
|
+
continue;
|
|
177
|
+
} else if (res.length > 0) {
|
|
178
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
183
|
+
} else
|
|
184
|
+
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
185
|
+
lastSlash = index, dots = 0;
|
|
186
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
187
|
+
}
|
|
188
|
+
return res;
|
|
189
|
+
}
|
|
190
|
+
var isAbsolute = function(p) {
|
|
191
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
192
|
+
};
|
|
193
|
+
var dirname = function(p) {
|
|
194
|
+
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
195
|
+
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// ../../core/src/shared/utils/module.ts
|
|
199
|
+
var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
|
|
200
|
+
"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"
|
|
201
|
+
), pathToFileURL(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) => dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
|
|
202
|
+
|
|
203
|
+
export {
|
|
204
|
+
resolvePackageDir
|
|
205
|
+
};
|