@dodopayments/nextjs 0.3.1 → 0.3.2
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/index.cjs +752 -467
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +752 -467
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/index.cjs
CHANGED
|
@@ -26,10 +26,9 @@ var detectDomainLocale = {};
|
|
|
26
26
|
detectedLocale = detectedLocale.toLowerCase();
|
|
27
27
|
}
|
|
28
28
|
for (const item of domainItems){
|
|
29
|
-
var _item_domain, _item_locales;
|
|
30
29
|
// remove port if present
|
|
31
|
-
const domainHostname =
|
|
32
|
-
if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() ||
|
|
30
|
+
const domainHostname = item.domain?.split(':', 1)[0].toLowerCase();
|
|
31
|
+
if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || item.locales?.some((locale)=>locale.toLowerCase() === detectedLocale)) {
|
|
33
32
|
return item;
|
|
34
33
|
}
|
|
35
34
|
}
|
|
@@ -124,7 +123,7 @@ var parsePath = {};
|
|
|
124
123
|
return path;
|
|
125
124
|
}
|
|
126
125
|
const { pathname, query, hash } = (0, _parsepath.parsePath)(path);
|
|
127
|
-
return
|
|
126
|
+
return `${prefix}${pathname}${query}${hash}`;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
|
|
@@ -148,7 +147,7 @@ var addPathSuffix = {};
|
|
|
148
147
|
return path;
|
|
149
148
|
}
|
|
150
149
|
const { pathname, query, hash } = (0, _parsepath.parsePath)(path);
|
|
151
|
-
return
|
|
150
|
+
return `${pathname}${suffix}${query}${hash}`;
|
|
152
151
|
}
|
|
153
152
|
|
|
154
153
|
|
|
@@ -201,10 +200,10 @@ var pathHasPrefix = {};
|
|
|
201
200
|
// don't need to prefix the path.
|
|
202
201
|
if (!ignorePrefix) {
|
|
203
202
|
if ((0, _pathhasprefix.pathHasPrefix)(lower, '/api')) return path;
|
|
204
|
-
if ((0, _pathhasprefix.pathHasPrefix)(lower,
|
|
203
|
+
if ((0, _pathhasprefix.pathHasPrefix)(lower, `/${locale.toLowerCase()}`)) return path;
|
|
205
204
|
}
|
|
206
205
|
// Add the locale prefix to the path.
|
|
207
|
-
return (0, _addpathprefix.addPathPrefix)(path,
|
|
206
|
+
return (0, _addpathprefix.addPathPrefix)(path, `/${locale}`);
|
|
208
207
|
}
|
|
209
208
|
|
|
210
209
|
|
|
@@ -230,7 +229,7 @@ var pathHasPrefix = {};
|
|
|
230
229
|
pathname = (0, _removetrailingslash.removeTrailingSlash)(pathname);
|
|
231
230
|
}
|
|
232
231
|
if (info.buildId) {
|
|
233
|
-
pathname = (0, _addpathsuffix.addPathSuffix)((0, _addpathprefix.addPathPrefix)(pathname,
|
|
232
|
+
pathname = (0, _addpathsuffix.addPathSuffix)((0, _addpathprefix.addPathPrefix)(pathname, `/_next/data/${info.buildId}`), info.pathname === '/' ? 'index.json' : '.json');
|
|
234
233
|
}
|
|
235
234
|
pathname = (0, _addpathprefix.addPathPrefix)(pathname, info.basePath);
|
|
236
235
|
return !info.buildId && info.trailingSlash ? !pathname.endsWith('/') ? (0, _addpathsuffix.addPathSuffix)(pathname, '/') : pathname : (0, _removetrailingslash.removeTrailingSlash)(pathname);
|
|
@@ -255,7 +254,7 @@ var getHostname = {};
|
|
|
255
254
|
// Get the hostname from the headers if it exists, otherwise use the parsed
|
|
256
255
|
// hostname.
|
|
257
256
|
let hostname;
|
|
258
|
-
if (
|
|
257
|
+
if (headers?.host && !Array.isArray(headers.host)) {
|
|
259
258
|
hostname = headers.host.toString().split(':', 1)[0];
|
|
260
259
|
} else if (parsed.hostname) {
|
|
261
260
|
hostname = parsed.hostname;
|
|
@@ -363,7 +362,7 @@ var removePathPrefix = {};
|
|
|
363
362
|
}
|
|
364
363
|
// If the path without the prefix doesn't start with a `/` we need to add it
|
|
365
364
|
// back to the path to make sure it's a valid path.
|
|
366
|
-
return
|
|
365
|
+
return `/${withoutPrefix}`;
|
|
367
366
|
}
|
|
368
367
|
|
|
369
368
|
|
|
@@ -383,8 +382,7 @@ var removePathPrefix = {};
|
|
|
383
382
|
const _removepathprefix = removePathPrefix;
|
|
384
383
|
const _pathhasprefix = pathHasPrefix;
|
|
385
384
|
function getNextPathnameInfo(pathname, options) {
|
|
386
|
-
|
|
387
|
-
const { basePath, i18n, trailingSlash } = (_options_nextConfig = options.nextConfig) != null ? _options_nextConfig : {};
|
|
385
|
+
const { basePath, i18n, trailingSlash } = options.nextConfig ?? {};
|
|
388
386
|
const info = {
|
|
389
387
|
pathname,
|
|
390
388
|
trailingSlash: pathname !== '/' ? pathname.endsWith('/') : trailingSlash
|
|
@@ -398,7 +396,7 @@ var removePathPrefix = {};
|
|
|
398
396
|
const paths = info.pathname.replace(/^\/_next\/data\//, '').replace(/\.json$/, '').split('/');
|
|
399
397
|
const buildId = paths[0];
|
|
400
398
|
info.buildId = buildId;
|
|
401
|
-
pathnameNoDataPrefix = paths[1] !== 'index' ?
|
|
399
|
+
pathnameNoDataPrefix = paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/';
|
|
402
400
|
// update pathname with normalized if enabled although
|
|
403
401
|
// we use normalized to populate locale info still
|
|
404
402
|
if (options.parseData === true) {
|
|
@@ -410,8 +408,7 @@ var removePathPrefix = {};
|
|
|
410
408
|
if (i18n) {
|
|
411
409
|
let result = options.i18nProvider ? options.i18nProvider.analyze(info.pathname) : (0, _normalizelocalepath.normalizeLocalePath)(info.pathname, i18n.locales);
|
|
412
410
|
info.locale = result.detectedLocale;
|
|
413
|
-
|
|
414
|
-
info.pathname = (_result_pathname = result.pathname) != null ? _result_pathname : info.pathname;
|
|
411
|
+
info.pathname = result.pathname ?? info.pathname;
|
|
415
412
|
if (!result.detectedLocale && info.buildId) {
|
|
416
413
|
result = options.i18nProvider ? options.i18nProvider.analyze(pathnameNoDataPrefix) : (0, _normalizelocalepath.normalizeLocalePath)(pathnameNoDataPrefix, i18n.locales);
|
|
417
414
|
if (result.detectedLocale) {
|
|
@@ -661,12 +658,18 @@ var constants = {};
|
|
|
661
658
|
GSSP_NO_RETURNED_VALUE: function() {
|
|
662
659
|
return GSSP_NO_RETURNED_VALUE;
|
|
663
660
|
},
|
|
661
|
+
HTML_CONTENT_TYPE_HEADER: function() {
|
|
662
|
+
return HTML_CONTENT_TYPE_HEADER;
|
|
663
|
+
},
|
|
664
664
|
INFINITE_CACHE: function() {
|
|
665
665
|
return INFINITE_CACHE;
|
|
666
666
|
},
|
|
667
667
|
INSTRUMENTATION_HOOK_FILENAME: function() {
|
|
668
668
|
return INSTRUMENTATION_HOOK_FILENAME;
|
|
669
669
|
},
|
|
670
|
+
JSON_CONTENT_TYPE_HEADER: function() {
|
|
671
|
+
return JSON_CONTENT_TYPE_HEADER;
|
|
672
|
+
},
|
|
670
673
|
MATCHED_PATH_HEADER: function() {
|
|
671
674
|
return MATCHED_PATH_HEADER;
|
|
672
675
|
},
|
|
@@ -727,6 +730,12 @@ var constants = {};
|
|
|
727
730
|
PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: function() {
|
|
728
731
|
return PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER;
|
|
729
732
|
},
|
|
733
|
+
PROXY_FILENAME: function() {
|
|
734
|
+
return PROXY_FILENAME;
|
|
735
|
+
},
|
|
736
|
+
PROXY_LOCATION_REGEXP: function() {
|
|
737
|
+
return PROXY_LOCATION_REGEXP;
|
|
738
|
+
},
|
|
730
739
|
PUBLIC_DIR_MIDDLEWARE_CONFLICT: function() {
|
|
731
740
|
return PUBLIC_DIR_MIDDLEWARE_CONFLICT;
|
|
732
741
|
},
|
|
@@ -787,6 +796,9 @@ var constants = {};
|
|
|
787
796
|
STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: function() {
|
|
788
797
|
return STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR;
|
|
789
798
|
},
|
|
799
|
+
TEXT_PLAIN_CONTENT_TYPE_HEADER: function() {
|
|
800
|
+
return TEXT_PLAIN_CONTENT_TYPE_HEADER;
|
|
801
|
+
},
|
|
790
802
|
UNSTABLE_REVALIDATE_RENAME_ERROR: function() {
|
|
791
803
|
return UNSTABLE_REVALIDATE_RENAME_ERROR;
|
|
792
804
|
},
|
|
@@ -795,8 +807,14 @@ var constants = {};
|
|
|
795
807
|
},
|
|
796
808
|
WEBPACK_RESOURCE_QUERIES: function() {
|
|
797
809
|
return WEBPACK_RESOURCE_QUERIES;
|
|
810
|
+
},
|
|
811
|
+
WEB_SOCKET_MAX_RECONNECTIONS: function() {
|
|
812
|
+
return WEB_SOCKET_MAX_RECONNECTIONS;
|
|
798
813
|
}
|
|
799
814
|
});
|
|
815
|
+
const TEXT_PLAIN_CONTENT_TYPE_HEADER = 'text/plain';
|
|
816
|
+
const HTML_CONTENT_TYPE_HEADER = 'text/html; charset=utf-8';
|
|
817
|
+
const JSON_CONTENT_TYPE_HEADER = 'application/json; charset=utf-8';
|
|
800
818
|
const NEXT_QUERY_PARAM_PREFIX = 'nxtP';
|
|
801
819
|
const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI';
|
|
802
820
|
const MATCHED_PATH_HEADER = 'x-matched-path';
|
|
@@ -822,6 +840,8 @@ var constants = {};
|
|
|
822
840
|
const INFINITE_CACHE = 0xfffffffe;
|
|
823
841
|
const MIDDLEWARE_FILENAME = 'middleware';
|
|
824
842
|
const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`;
|
|
843
|
+
const PROXY_FILENAME = 'proxy';
|
|
844
|
+
const PROXY_LOCATION_REGEXP = `(?:src/)?${PROXY_FILENAME}`;
|
|
825
845
|
const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation';
|
|
826
846
|
const PAGES_DIR_ALIAS = 'private-next-pages';
|
|
827
847
|
const DOT_NEXT_ALIAS = 'private-dot-next';
|
|
@@ -858,6 +878,7 @@ var constants = {};
|
|
|
858
878
|
experimentalEdge: 'experimental-edge',
|
|
859
879
|
nodejs: 'nodejs'
|
|
860
880
|
};
|
|
881
|
+
const WEB_SOCKET_MAX_RECONNECTIONS = 12;
|
|
861
882
|
/**
|
|
862
883
|
* The names of the webpack layers. These layers are the primitives for the
|
|
863
884
|
* webpack chunks.
|
|
@@ -1943,7 +1964,8 @@ var asyncLocalStorage = {};
|
|
|
1943
1964
|
}
|
|
1944
1965
|
return new FakeAsyncLocalStorage();
|
|
1945
1966
|
}
|
|
1946
|
-
function bindSnapshot(
|
|
1967
|
+
function bindSnapshot(// WARNING: Don't pass a named function to this argument! See: https://github.com/facebook/react/pull/34911
|
|
1968
|
+
fn) {
|
|
1947
1969
|
if (maybeGlobalAsyncLocalStorage) {
|
|
1948
1970
|
return maybeGlobalAsyncLocalStorage.bind(fn);
|
|
1949
1971
|
}
|
|
@@ -2095,9 +2117,15 @@ var appRouterHeaders = {exports: {}};
|
|
|
2095
2117
|
NEXT_HMR_REFRESH_HEADER: function() {
|
|
2096
2118
|
return NEXT_HMR_REFRESH_HEADER;
|
|
2097
2119
|
},
|
|
2120
|
+
NEXT_HTML_REQUEST_ID_HEADER: function() {
|
|
2121
|
+
return NEXT_HTML_REQUEST_ID_HEADER;
|
|
2122
|
+
},
|
|
2098
2123
|
NEXT_IS_PRERENDER_HEADER: function() {
|
|
2099
2124
|
return NEXT_IS_PRERENDER_HEADER;
|
|
2100
2125
|
},
|
|
2126
|
+
NEXT_REQUEST_ID_HEADER: function() {
|
|
2127
|
+
return NEXT_REQUEST_ID_HEADER;
|
|
2128
|
+
},
|
|
2101
2129
|
NEXT_REWRITTEN_PATH_HEADER: function() {
|
|
2102
2130
|
return NEXT_REWRITTEN_PATH_HEADER;
|
|
2103
2131
|
},
|
|
@@ -2129,14 +2157,14 @@ var appRouterHeaders = {exports: {}};
|
|
|
2129
2157
|
return RSC_HEADER;
|
|
2130
2158
|
}
|
|
2131
2159
|
});
|
|
2132
|
-
const RSC_HEADER = '
|
|
2133
|
-
const ACTION_HEADER = '
|
|
2134
|
-
const NEXT_ROUTER_STATE_TREE_HEADER = '
|
|
2135
|
-
const NEXT_ROUTER_PREFETCH_HEADER = '
|
|
2136
|
-
const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER = '
|
|
2137
|
-
const NEXT_HMR_REFRESH_HEADER = '
|
|
2160
|
+
const RSC_HEADER = 'rsc';
|
|
2161
|
+
const ACTION_HEADER = 'next-action';
|
|
2162
|
+
const NEXT_ROUTER_STATE_TREE_HEADER = 'next-router-state-tree';
|
|
2163
|
+
const NEXT_ROUTER_PREFETCH_HEADER = 'next-router-prefetch';
|
|
2164
|
+
const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER = 'next-router-segment-prefetch';
|
|
2165
|
+
const NEXT_HMR_REFRESH_HEADER = 'next-hmr-refresh';
|
|
2138
2166
|
const NEXT_HMR_REFRESH_HASH_COOKIE = '__next_hmr_refresh_hash__';
|
|
2139
|
-
const NEXT_URL = '
|
|
2167
|
+
const NEXT_URL = 'next-url';
|
|
2140
2168
|
const RSC_CONTENT_TYPE_HEADER = 'text/x-component';
|
|
2141
2169
|
const FLIGHT_HEADERS = [
|
|
2142
2170
|
RSC_HEADER,
|
|
@@ -2152,6 +2180,8 @@ var appRouterHeaders = {exports: {}};
|
|
|
2152
2180
|
const NEXT_REWRITTEN_QUERY_HEADER = 'x-nextjs-rewritten-query';
|
|
2153
2181
|
const NEXT_IS_PRERENDER_HEADER = 'x-nextjs-prerender';
|
|
2154
2182
|
const NEXT_ACTION_NOT_FOUND_HEADER = 'x-nextjs-action-not-found';
|
|
2183
|
+
const NEXT_REQUEST_ID_HEADER = 'x-nextjs-request-id';
|
|
2184
|
+
const NEXT_HTML_REQUEST_ID_HEADER = 'x-nextjs-html-request-id';
|
|
2155
2185
|
|
|
2156
2186
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
2157
2187
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
@@ -2164,6 +2194,28 @@ var appRouterHeaders = {exports: {}};
|
|
|
2164
2194
|
|
|
2165
2195
|
var appRouterHeadersExports = appRouterHeaders.exports;
|
|
2166
2196
|
|
|
2197
|
+
var invariantError = {};
|
|
2198
|
+
|
|
2199
|
+
(function (exports) {
|
|
2200
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2201
|
+
value: true
|
|
2202
|
+
});
|
|
2203
|
+
Object.defineProperty(exports, "InvariantError", {
|
|
2204
|
+
enumerable: true,
|
|
2205
|
+
get: function() {
|
|
2206
|
+
return InvariantError;
|
|
2207
|
+
}
|
|
2208
|
+
});
|
|
2209
|
+
class InvariantError extends Error {
|
|
2210
|
+
constructor(message, options){
|
|
2211
|
+
super(`Invariant: ${message.endsWith('.') ? message : message + '.'} This is a bug in Next.js.`, options);
|
|
2212
|
+
this.name = 'InvariantError';
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
|
|
2217
|
+
} (invariantError));
|
|
2218
|
+
|
|
2167
2219
|
(function (exports) {
|
|
2168
2220
|
Object.defineProperty(exports, "__esModule", {
|
|
2169
2221
|
value: true
|
|
@@ -2175,12 +2227,12 @@ var appRouterHeadersExports = appRouterHeaders.exports;
|
|
|
2175
2227
|
});
|
|
2176
2228
|
}
|
|
2177
2229
|
_export(exports, {
|
|
2230
|
+
getCacheSignal: function() {
|
|
2231
|
+
return getCacheSignal;
|
|
2232
|
+
},
|
|
2178
2233
|
getDraftModeProviderForCacheScope: function() {
|
|
2179
2234
|
return getDraftModeProviderForCacheScope;
|
|
2180
2235
|
},
|
|
2181
|
-
getExpectedRequestStore: function() {
|
|
2182
|
-
return getExpectedRequestStore;
|
|
2183
|
-
},
|
|
2184
2236
|
getHmrRefreshHash: function() {
|
|
2185
2237
|
return getHmrRefreshHash;
|
|
2186
2238
|
},
|
|
@@ -2190,50 +2242,28 @@ var appRouterHeadersExports = appRouterHeaders.exports;
|
|
|
2190
2242
|
getRenderResumeDataCache: function() {
|
|
2191
2243
|
return getRenderResumeDataCache;
|
|
2192
2244
|
},
|
|
2245
|
+
getRuntimeStagePromise: function() {
|
|
2246
|
+
return getRuntimeStagePromise;
|
|
2247
|
+
},
|
|
2248
|
+
getServerComponentsHmrCache: function() {
|
|
2249
|
+
return getServerComponentsHmrCache;
|
|
2250
|
+
},
|
|
2251
|
+
isHmrRefresh: function() {
|
|
2252
|
+
return isHmrRefresh;
|
|
2253
|
+
},
|
|
2193
2254
|
throwForMissingRequestStore: function() {
|
|
2194
2255
|
return throwForMissingRequestStore;
|
|
2195
2256
|
},
|
|
2257
|
+
throwInvariantForMissingStore: function() {
|
|
2258
|
+
return throwInvariantForMissingStore;
|
|
2259
|
+
},
|
|
2196
2260
|
workUnitAsyncStorage: function() {
|
|
2197
2261
|
return _workunitasyncstorageinstance.workUnitAsyncStorageInstance;
|
|
2198
2262
|
}
|
|
2199
2263
|
});
|
|
2200
2264
|
const _workunitasyncstorageinstance = workUnitAsyncStorageInstance;
|
|
2201
2265
|
const _approuterheaders = appRouterHeadersExports;
|
|
2202
|
-
|
|
2203
|
-
const workUnitStore = _workunitasyncstorageinstance.workUnitAsyncStorageInstance.getStore();
|
|
2204
|
-
if (!workUnitStore) {
|
|
2205
|
-
throwForMissingRequestStore(callingExpression);
|
|
2206
|
-
}
|
|
2207
|
-
switch(workUnitStore.type){
|
|
2208
|
-
case 'request':
|
|
2209
|
-
return workUnitStore;
|
|
2210
|
-
case 'prerender':
|
|
2211
|
-
case 'prerender-client':
|
|
2212
|
-
case 'prerender-ppr':
|
|
2213
|
-
case 'prerender-legacy':
|
|
2214
|
-
// This should not happen because we should have checked it already.
|
|
2215
|
-
throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside a prerender. This is a bug in Next.js.`), "__NEXT_ERROR_CODE", {
|
|
2216
|
-
value: "E401",
|
|
2217
|
-
enumerable: false,
|
|
2218
|
-
configurable: true
|
|
2219
|
-
});
|
|
2220
|
-
case 'cache':
|
|
2221
|
-
throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside "use cache". Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
2222
|
-
value: "E37",
|
|
2223
|
-
enumerable: false,
|
|
2224
|
-
configurable: true
|
|
2225
|
-
});
|
|
2226
|
-
case 'unstable-cache':
|
|
2227
|
-
throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside unstable_cache. Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
|
|
2228
|
-
value: "E69",
|
|
2229
|
-
enumerable: false,
|
|
2230
|
-
configurable: true
|
|
2231
|
-
});
|
|
2232
|
-
default:
|
|
2233
|
-
const _exhaustiveCheck = workUnitStore;
|
|
2234
|
-
return _exhaustiveCheck;
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2266
|
+
const _invarianterror = invariantError;
|
|
2237
2267
|
function throwForMissingRequestStore(callingExpression) {
|
|
2238
2268
|
throw Object.defineProperty(new Error(`\`${callingExpression}\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), "__NEXT_ERROR_CODE", {
|
|
2239
2269
|
value: "E251",
|
|
@@ -2241,18 +2271,45 @@ var appRouterHeadersExports = appRouterHeaders.exports;
|
|
|
2241
2271
|
configurable: true
|
|
2242
2272
|
});
|
|
2243
2273
|
}
|
|
2274
|
+
function throwInvariantForMissingStore() {
|
|
2275
|
+
throw Object.defineProperty(new _invarianterror.InvariantError('Expected workUnitAsyncStorage to have a store.'), "__NEXT_ERROR_CODE", {
|
|
2276
|
+
value: "E696",
|
|
2277
|
+
enumerable: false,
|
|
2278
|
+
configurable: true
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2244
2281
|
function getPrerenderResumeDataCache(workUnitStore) {
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2282
|
+
switch(workUnitStore.type){
|
|
2283
|
+
case 'prerender':
|
|
2284
|
+
case 'prerender-runtime':
|
|
2285
|
+
case 'prerender-ppr':
|
|
2286
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
2287
|
+
case 'prerender-client':
|
|
2288
|
+
// TODO eliminate fetch caching in client scope and stop exposing this data
|
|
2289
|
+
// cache during SSR.
|
|
2290
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
2291
|
+
case 'request':
|
|
2292
|
+
{
|
|
2293
|
+
// In dev, we might fill caches even during a dynamic request.
|
|
2294
|
+
if (workUnitStore.prerenderResumeDataCache) {
|
|
2295
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
2296
|
+
}
|
|
2297
|
+
// fallthrough
|
|
2298
|
+
}
|
|
2299
|
+
case 'prerender-legacy':
|
|
2300
|
+
case 'cache':
|
|
2301
|
+
case 'private-cache':
|
|
2302
|
+
case 'unstable-cache':
|
|
2303
|
+
return null;
|
|
2304
|
+
default:
|
|
2305
|
+
return workUnitStore;
|
|
2248
2306
|
}
|
|
2249
|
-
return null;
|
|
2250
2307
|
}
|
|
2251
2308
|
function getRenderResumeDataCache(workUnitStore) {
|
|
2252
2309
|
switch(workUnitStore.type){
|
|
2253
2310
|
case 'request':
|
|
2254
|
-
return workUnitStore.renderResumeDataCache;
|
|
2255
2311
|
case 'prerender':
|
|
2312
|
+
case 'prerender-runtime':
|
|
2256
2313
|
case 'prerender-client':
|
|
2257
2314
|
if (workUnitStore.renderResumeDataCache) {
|
|
2258
2315
|
// If we are in a prerender, we might have a render resume data cache
|
|
@@ -2263,31 +2320,107 @@ var appRouterHeadersExports = appRouterHeaders.exports;
|
|
|
2263
2320
|
case 'prerender-ppr':
|
|
2264
2321
|
// Otherwise we return the mutable resume data cache here as an immutable
|
|
2265
2322
|
// version of the cache as it can also be used for reading.
|
|
2266
|
-
return workUnitStore.prerenderResumeDataCache;
|
|
2267
|
-
|
|
2323
|
+
return workUnitStore.prerenderResumeDataCache ?? null;
|
|
2324
|
+
case 'cache':
|
|
2325
|
+
case 'private-cache':
|
|
2326
|
+
case 'unstable-cache':
|
|
2327
|
+
case 'prerender-legacy':
|
|
2268
2328
|
return null;
|
|
2329
|
+
default:
|
|
2330
|
+
return workUnitStore;
|
|
2269
2331
|
}
|
|
2270
2332
|
}
|
|
2271
2333
|
function getHmrRefreshHash(workStore, workUnitStore) {
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2334
|
+
if (workStore.dev) {
|
|
2335
|
+
switch(workUnitStore.type){
|
|
2336
|
+
case 'cache':
|
|
2337
|
+
case 'private-cache':
|
|
2338
|
+
case 'prerender':
|
|
2339
|
+
case 'prerender-runtime':
|
|
2340
|
+
return workUnitStore.hmrRefreshHash;
|
|
2341
|
+
case 'request':
|
|
2342
|
+
var _workUnitStore_cookies_get;
|
|
2343
|
+
return (_workUnitStore_cookies_get = workUnitStore.cookies.get(_approuterheaders.NEXT_HMR_REFRESH_HASH_COOKIE)) == null ? void 0 : _workUnitStore_cookies_get.value;
|
|
2344
|
+
}
|
|
2275
2345
|
}
|
|
2276
|
-
return
|
|
2346
|
+
return undefined;
|
|
2347
|
+
}
|
|
2348
|
+
function isHmrRefresh(workStore, workUnitStore) {
|
|
2349
|
+
if (workStore.dev) {
|
|
2350
|
+
switch(workUnitStore.type){
|
|
2351
|
+
case 'cache':
|
|
2352
|
+
case 'private-cache':
|
|
2353
|
+
case 'request':
|
|
2354
|
+
return workUnitStore.isHmrRefresh ?? false;
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
return false;
|
|
2358
|
+
}
|
|
2359
|
+
function getServerComponentsHmrCache(workStore, workUnitStore) {
|
|
2360
|
+
if (workStore.dev) {
|
|
2361
|
+
switch(workUnitStore.type){
|
|
2362
|
+
case 'cache':
|
|
2363
|
+
case 'private-cache':
|
|
2364
|
+
case 'request':
|
|
2365
|
+
return workUnitStore.serverComponentsHmrCache;
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
return undefined;
|
|
2277
2369
|
}
|
|
2278
2370
|
function getDraftModeProviderForCacheScope(workStore, workUnitStore) {
|
|
2279
2371
|
if (workStore.isDraftMode) {
|
|
2280
2372
|
switch(workUnitStore.type){
|
|
2281
2373
|
case 'cache':
|
|
2374
|
+
case 'private-cache':
|
|
2282
2375
|
case 'unstable-cache':
|
|
2376
|
+
case 'prerender-runtime':
|
|
2283
2377
|
case 'request':
|
|
2284
2378
|
return workUnitStore.draftMode;
|
|
2285
|
-
default:
|
|
2286
|
-
return undefined;
|
|
2287
2379
|
}
|
|
2288
2380
|
}
|
|
2289
2381
|
return undefined;
|
|
2290
2382
|
}
|
|
2383
|
+
function getCacheSignal(workUnitStore) {
|
|
2384
|
+
switch(workUnitStore.type){
|
|
2385
|
+
case 'prerender':
|
|
2386
|
+
case 'prerender-client':
|
|
2387
|
+
case 'prerender-runtime':
|
|
2388
|
+
return workUnitStore.cacheSignal;
|
|
2389
|
+
case 'request':
|
|
2390
|
+
{
|
|
2391
|
+
// In dev, we might fill caches even during a dynamic request.
|
|
2392
|
+
if (workUnitStore.cacheSignal) {
|
|
2393
|
+
return workUnitStore.cacheSignal;
|
|
2394
|
+
}
|
|
2395
|
+
// fallthrough
|
|
2396
|
+
}
|
|
2397
|
+
case 'prerender-ppr':
|
|
2398
|
+
case 'prerender-legacy':
|
|
2399
|
+
case 'cache':
|
|
2400
|
+
case 'private-cache':
|
|
2401
|
+
case 'unstable-cache':
|
|
2402
|
+
return null;
|
|
2403
|
+
default:
|
|
2404
|
+
return workUnitStore;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
function getRuntimeStagePromise(workUnitStore) {
|
|
2408
|
+
switch(workUnitStore.type){
|
|
2409
|
+
case 'prerender-runtime':
|
|
2410
|
+
case 'private-cache':
|
|
2411
|
+
return workUnitStore.runtimeStagePromise;
|
|
2412
|
+
case 'prerender':
|
|
2413
|
+
case 'prerender-client':
|
|
2414
|
+
case 'prerender-ppr':
|
|
2415
|
+
case 'prerender-legacy':
|
|
2416
|
+
case 'request':
|
|
2417
|
+
case 'cache':
|
|
2418
|
+
case 'unstable-cache':
|
|
2419
|
+
return null;
|
|
2420
|
+
default:
|
|
2421
|
+
return workUnitStore;
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2291
2424
|
|
|
2292
2425
|
|
|
2293
2426
|
} (workUnitAsyncStorage_external));
|
|
@@ -4174,7 +4307,7 @@ var hooksServerContext = {exports: {}};
|
|
|
4174
4307
|
const DYNAMIC_ERROR_CODE = 'DYNAMIC_SERVER_USAGE';
|
|
4175
4308
|
class DynamicServerError extends Error {
|
|
4176
4309
|
constructor(description){
|
|
4177
|
-
super(
|
|
4310
|
+
super(`Dynamic server usage: ${description}`), this.description = description, this.digest = DYNAMIC_ERROR_CODE;
|
|
4178
4311
|
}
|
|
4179
4312
|
}
|
|
4180
4313
|
function isDynamicServerError(err) {
|
|
@@ -4255,6 +4388,9 @@ var dynamicRenderingUtils = {};
|
|
|
4255
4388
|
isHangingPromiseRejectionError: function() {
|
|
4256
4389
|
return isHangingPromiseRejectionError;
|
|
4257
4390
|
},
|
|
4391
|
+
makeDevtoolsIOAwarePromise: function() {
|
|
4392
|
+
return makeDevtoolsIOAwarePromise;
|
|
4393
|
+
},
|
|
4258
4394
|
makeHangingPromise: function() {
|
|
4259
4395
|
return makeHangingPromise;
|
|
4260
4396
|
}
|
|
@@ -4267,17 +4403,17 @@ var dynamicRenderingUtils = {};
|
|
|
4267
4403
|
}
|
|
4268
4404
|
const HANGING_PROMISE_REJECTION = 'HANGING_PROMISE_REJECTION';
|
|
4269
4405
|
class HangingPromiseRejectionError extends Error {
|
|
4270
|
-
constructor(expression){
|
|
4271
|
-
super(`During prerendering, ${expression} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${expression} to a different context by using \`setTimeout\`, \`after\`, or similar functions you may observe this error and you should handle it in that context.`), this.expression = expression, this.digest = HANGING_PROMISE_REJECTION;
|
|
4406
|
+
constructor(route, expression){
|
|
4407
|
+
super(`During prerendering, ${expression} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${expression} to a different context by using \`setTimeout\`, \`after\`, or similar functions you may observe this error and you should handle it in that context. This occurred at route "${route}".`), this.route = route, this.expression = expression, this.digest = HANGING_PROMISE_REJECTION;
|
|
4272
4408
|
}
|
|
4273
4409
|
}
|
|
4274
4410
|
const abortListenersBySignal = new WeakMap();
|
|
4275
|
-
function makeHangingPromise(signal, expression) {
|
|
4411
|
+
function makeHangingPromise(signal, route, expression) {
|
|
4276
4412
|
if (signal.aborted) {
|
|
4277
|
-
return Promise.reject(new HangingPromiseRejectionError(expression));
|
|
4413
|
+
return Promise.reject(new HangingPromiseRejectionError(route, expression));
|
|
4278
4414
|
} else {
|
|
4279
4415
|
const hangingPromise = new Promise((_, reject)=>{
|
|
4280
|
-
const boundRejection = reject.bind(null, new HangingPromiseRejectionError(expression));
|
|
4416
|
+
const boundRejection = reject.bind(null, new HangingPromiseRejectionError(route, expression));
|
|
4281
4417
|
let currentListeners = abortListenersBySignal.get(signal);
|
|
4282
4418
|
if (currentListeners) {
|
|
4283
4419
|
currentListeners.push(boundRejection);
|
|
@@ -4303,11 +4439,25 @@ var dynamicRenderingUtils = {};
|
|
|
4303
4439
|
}
|
|
4304
4440
|
}
|
|
4305
4441
|
function ignoreReject() {}
|
|
4442
|
+
function makeDevtoolsIOAwarePromise(underlying, requestStore, stage) {
|
|
4443
|
+
if (requestStore.stagedRendering) {
|
|
4444
|
+
// We resolve each stage in a timeout, so React DevTools will pick this up as IO.
|
|
4445
|
+
return requestStore.stagedRendering.delayUntilStage(stage, undefined, underlying);
|
|
4446
|
+
}
|
|
4447
|
+
// in React DevTools if we resolve in a setTimeout we will observe
|
|
4448
|
+
// the promise resolution as something that can suspend a boundary or root.
|
|
4449
|
+
return new Promise((resolve)=>{
|
|
4450
|
+
// Must use setTimeout to be considered IO React DevTools. setImmediate will not work.
|
|
4451
|
+
setTimeout(()=>{
|
|
4452
|
+
resolve(underlying);
|
|
4453
|
+
}, 0);
|
|
4454
|
+
});
|
|
4455
|
+
}
|
|
4306
4456
|
|
|
4307
4457
|
|
|
4308
4458
|
} (dynamicRenderingUtils));
|
|
4309
4459
|
|
|
4310
|
-
var
|
|
4460
|
+
var boundaryConstants = {};
|
|
4311
4461
|
|
|
4312
4462
|
(function (exports) {
|
|
4313
4463
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4326,6 +4476,9 @@ var metadataConstants = {};
|
|
|
4326
4476
|
OUTLET_BOUNDARY_NAME: function() {
|
|
4327
4477
|
return OUTLET_BOUNDARY_NAME;
|
|
4328
4478
|
},
|
|
4479
|
+
ROOT_LAYOUT_BOUNDARY_NAME: function() {
|
|
4480
|
+
return ROOT_LAYOUT_BOUNDARY_NAME;
|
|
4481
|
+
},
|
|
4329
4482
|
VIEWPORT_BOUNDARY_NAME: function() {
|
|
4330
4483
|
return VIEWPORT_BOUNDARY_NAME;
|
|
4331
4484
|
}
|
|
@@ -4333,9 +4486,10 @@ var metadataConstants = {};
|
|
|
4333
4486
|
const METADATA_BOUNDARY_NAME = '__next_metadata_boundary__';
|
|
4334
4487
|
const VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__';
|
|
4335
4488
|
const OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__';
|
|
4489
|
+
const ROOT_LAYOUT_BOUNDARY_NAME = '__next_root_layout_boundary__';
|
|
4336
4490
|
|
|
4337
4491
|
|
|
4338
|
-
} (
|
|
4492
|
+
} (boundaryConstants));
|
|
4339
4493
|
|
|
4340
4494
|
var scheduler = {};
|
|
4341
4495
|
|
|
@@ -4399,6 +4553,198 @@ var scheduler = {};
|
|
|
4399
4553
|
|
|
4400
4554
|
} (scheduler));
|
|
4401
4555
|
|
|
4556
|
+
var bailoutToCsr = {};
|
|
4557
|
+
|
|
4558
|
+
(function (exports) {
|
|
4559
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4560
|
+
value: true
|
|
4561
|
+
});
|
|
4562
|
+
function _export(target, all) {
|
|
4563
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
4564
|
+
enumerable: true,
|
|
4565
|
+
get: all[name]
|
|
4566
|
+
});
|
|
4567
|
+
}
|
|
4568
|
+
_export(exports, {
|
|
4569
|
+
BailoutToCSRError: function() {
|
|
4570
|
+
return BailoutToCSRError;
|
|
4571
|
+
},
|
|
4572
|
+
isBailoutToCSRError: function() {
|
|
4573
|
+
return isBailoutToCSRError;
|
|
4574
|
+
}
|
|
4575
|
+
});
|
|
4576
|
+
const BAILOUT_TO_CSR = 'BAILOUT_TO_CLIENT_SIDE_RENDERING';
|
|
4577
|
+
class BailoutToCSRError extends Error {
|
|
4578
|
+
constructor(reason){
|
|
4579
|
+
super(`Bail out to client-side rendering: ${reason}`), this.reason = reason, this.digest = BAILOUT_TO_CSR;
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
function isBailoutToCSRError(err) {
|
|
4583
|
+
if (typeof err !== 'object' || err === null || !('digest' in err)) {
|
|
4584
|
+
return false;
|
|
4585
|
+
}
|
|
4586
|
+
return err.digest === BAILOUT_TO_CSR;
|
|
4587
|
+
}
|
|
4588
|
+
|
|
4589
|
+
|
|
4590
|
+
} (bailoutToCsr));
|
|
4591
|
+
|
|
4592
|
+
var stagedRendering = {};
|
|
4593
|
+
|
|
4594
|
+
var promiseWithResolvers = {};
|
|
4595
|
+
|
|
4596
|
+
(function (exports) {
|
|
4597
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4598
|
+
value: true
|
|
4599
|
+
});
|
|
4600
|
+
Object.defineProperty(exports, "createPromiseWithResolvers", {
|
|
4601
|
+
enumerable: true,
|
|
4602
|
+
get: function() {
|
|
4603
|
+
return createPromiseWithResolvers;
|
|
4604
|
+
}
|
|
4605
|
+
});
|
|
4606
|
+
function createPromiseWithResolvers() {
|
|
4607
|
+
// Shim of Stage 4 Promise.withResolvers proposal
|
|
4608
|
+
let resolve;
|
|
4609
|
+
let reject;
|
|
4610
|
+
const promise = new Promise((res, rej)=>{
|
|
4611
|
+
resolve = res;
|
|
4612
|
+
reject = rej;
|
|
4613
|
+
});
|
|
4614
|
+
return {
|
|
4615
|
+
resolve: resolve,
|
|
4616
|
+
reject: reject,
|
|
4617
|
+
promise
|
|
4618
|
+
};
|
|
4619
|
+
}
|
|
4620
|
+
|
|
4621
|
+
|
|
4622
|
+
} (promiseWithResolvers));
|
|
4623
|
+
|
|
4624
|
+
(function (exports) {
|
|
4625
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4626
|
+
value: true
|
|
4627
|
+
});
|
|
4628
|
+
function _export(target, all) {
|
|
4629
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
4630
|
+
enumerable: true,
|
|
4631
|
+
get: all[name]
|
|
4632
|
+
});
|
|
4633
|
+
}
|
|
4634
|
+
_export(exports, {
|
|
4635
|
+
RenderStage: function() {
|
|
4636
|
+
return RenderStage;
|
|
4637
|
+
},
|
|
4638
|
+
StagedRenderingController: function() {
|
|
4639
|
+
return StagedRenderingController;
|
|
4640
|
+
}
|
|
4641
|
+
});
|
|
4642
|
+
const _invarianterror = invariantError;
|
|
4643
|
+
const _promisewithresolvers = promiseWithResolvers;
|
|
4644
|
+
var RenderStage = /*#__PURE__*/ function(RenderStage) {
|
|
4645
|
+
RenderStage[RenderStage["Static"] = 1] = "Static";
|
|
4646
|
+
RenderStage[RenderStage["Runtime"] = 2] = "Runtime";
|
|
4647
|
+
RenderStage[RenderStage["Dynamic"] = 3] = "Dynamic";
|
|
4648
|
+
return RenderStage;
|
|
4649
|
+
}({});
|
|
4650
|
+
class StagedRenderingController {
|
|
4651
|
+
constructor(abortSignal = null){
|
|
4652
|
+
this.abortSignal = abortSignal;
|
|
4653
|
+
this.currentStage = 1;
|
|
4654
|
+
this.runtimeStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
4655
|
+
this.dynamicStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
4656
|
+
if (abortSignal) {
|
|
4657
|
+
abortSignal.addEventListener('abort', ()=>{
|
|
4658
|
+
const { reason } = abortSignal;
|
|
4659
|
+
if (this.currentStage < 2) {
|
|
4660
|
+
this.runtimeStagePromise.promise.catch(ignoreReject) // avoid unhandled rejections
|
|
4661
|
+
;
|
|
4662
|
+
this.runtimeStagePromise.reject(reason);
|
|
4663
|
+
}
|
|
4664
|
+
if (this.currentStage < 3) {
|
|
4665
|
+
this.dynamicStagePromise.promise.catch(ignoreReject) // avoid unhandled rejections
|
|
4666
|
+
;
|
|
4667
|
+
this.dynamicStagePromise.reject(reason);
|
|
4668
|
+
}
|
|
4669
|
+
}, {
|
|
4670
|
+
once: true
|
|
4671
|
+
});
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4674
|
+
advanceStage(stage) {
|
|
4675
|
+
// If we're already at the target stage or beyond, do nothing.
|
|
4676
|
+
// (this can happen e.g. if sync IO advanced us to the dynamic stage)
|
|
4677
|
+
if (this.currentStage >= stage) {
|
|
4678
|
+
return;
|
|
4679
|
+
}
|
|
4680
|
+
this.currentStage = stage;
|
|
4681
|
+
// Note that we might be going directly from Static to Dynamic,
|
|
4682
|
+
// so we need to resolve the runtime stage as well.
|
|
4683
|
+
if (stage >= 2) {
|
|
4684
|
+
this.runtimeStagePromise.resolve();
|
|
4685
|
+
}
|
|
4686
|
+
if (stage >= 3) {
|
|
4687
|
+
this.dynamicStagePromise.resolve();
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
getStagePromise(stage) {
|
|
4691
|
+
switch(stage){
|
|
4692
|
+
case 2:
|
|
4693
|
+
{
|
|
4694
|
+
return this.runtimeStagePromise.promise;
|
|
4695
|
+
}
|
|
4696
|
+
case 3:
|
|
4697
|
+
{
|
|
4698
|
+
return this.dynamicStagePromise.promise;
|
|
4699
|
+
}
|
|
4700
|
+
default:
|
|
4701
|
+
{
|
|
4702
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`Invalid render stage: ${stage}`), "__NEXT_ERROR_CODE", {
|
|
4703
|
+
value: "E881",
|
|
4704
|
+
enumerable: false,
|
|
4705
|
+
configurable: true
|
|
4706
|
+
});
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
waitForStage(stage) {
|
|
4711
|
+
return this.getStagePromise(stage);
|
|
4712
|
+
}
|
|
4713
|
+
delayUntilStage(stage, displayName, resolvedValue) {
|
|
4714
|
+
const ioTriggerPromise = this.getStagePromise(stage);
|
|
4715
|
+
const promise = makeDevtoolsIOPromiseFromIOTrigger(ioTriggerPromise, displayName, resolvedValue);
|
|
4716
|
+
// Analogously to `makeHangingPromise`, we might reject this promise if the signal is invoked.
|
|
4717
|
+
// (e.g. in the case where we don't want want the render to proceed to the dynamic stage and abort it).
|
|
4718
|
+
// We shouldn't consider this an unhandled rejection, so we attach a noop catch handler here to suppress this warning.
|
|
4719
|
+
if (this.abortSignal) {
|
|
4720
|
+
promise.catch(ignoreReject);
|
|
4721
|
+
}
|
|
4722
|
+
return promise;
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
function ignoreReject() {}
|
|
4726
|
+
// TODO(restart-on-cache-miss): the layering of `delayUntilStage`,
|
|
4727
|
+
// `makeDevtoolsIOPromiseFromIOTrigger` and and `makeDevtoolsIOAwarePromise`
|
|
4728
|
+
// is confusing, we should clean it up.
|
|
4729
|
+
function makeDevtoolsIOPromiseFromIOTrigger(ioTrigger, displayName, resolvedValue) {
|
|
4730
|
+
// If we create a `new Promise` and give it a displayName
|
|
4731
|
+
// (with no userspace code above us in the stack)
|
|
4732
|
+
// React Devtools will use it as the IO cause when determining "suspended by".
|
|
4733
|
+
// In particular, it should shadow any inner IO that resolved/rejected the promise
|
|
4734
|
+
// (in case of staged rendering, this will be the `setTimeout` that triggers the relevant stage)
|
|
4735
|
+
const promise = new Promise((resolve, reject)=>{
|
|
4736
|
+
ioTrigger.then(resolve.bind(null, resolvedValue), reject);
|
|
4737
|
+
});
|
|
4738
|
+
if (displayName !== undefined) {
|
|
4739
|
+
// @ts-expect-error
|
|
4740
|
+
promise.displayName = displayName;
|
|
4741
|
+
}
|
|
4742
|
+
return promise;
|
|
4743
|
+
}
|
|
4744
|
+
|
|
4745
|
+
|
|
4746
|
+
} (stagedRendering));
|
|
4747
|
+
|
|
4402
4748
|
/**
|
|
4403
4749
|
* The functions provided by this module are used to communicate certain properties
|
|
4404
4750
|
* about the currently running code so that Next.js can make decisions on how to handle
|
|
@@ -4462,8 +4808,11 @@ var scheduler = {};
|
|
|
4462
4808
|
createHangingInputAbortSignal: function() {
|
|
4463
4809
|
return createHangingInputAbortSignal;
|
|
4464
4810
|
},
|
|
4465
|
-
|
|
4466
|
-
return
|
|
4811
|
+
createRenderInBrowserAbortSignal: function() {
|
|
4812
|
+
return createRenderInBrowserAbortSignal;
|
|
4813
|
+
},
|
|
4814
|
+
delayUntilRuntimeStage: function() {
|
|
4815
|
+
return delayUntilRuntimeStage;
|
|
4467
4816
|
},
|
|
4468
4817
|
formatDynamicAPIAccesses: function() {
|
|
4469
4818
|
return formatDynamicAPIAccesses;
|
|
@@ -4477,6 +4826,9 @@ var scheduler = {};
|
|
|
4477
4826
|
isPrerenderInterruptedError: function() {
|
|
4478
4827
|
return isPrerenderInterruptedError;
|
|
4479
4828
|
},
|
|
4829
|
+
logDisallowedDynamicError: function() {
|
|
4830
|
+
return logDisallowedDynamicError;
|
|
4831
|
+
},
|
|
4480
4832
|
markCurrentScopeAsDynamic: function() {
|
|
4481
4833
|
return markCurrentScopeAsDynamic;
|
|
4482
4834
|
},
|
|
@@ -4495,17 +4847,14 @@ var scheduler = {};
|
|
|
4495
4847
|
trackDynamicDataInDynamicRender: function() {
|
|
4496
4848
|
return trackDynamicDataInDynamicRender;
|
|
4497
4849
|
},
|
|
4498
|
-
trackFallbackParamAccessed: function() {
|
|
4499
|
-
return trackFallbackParamAccessed;
|
|
4500
|
-
},
|
|
4501
4850
|
trackSynchronousPlatformIOAccessInDev: function() {
|
|
4502
4851
|
return trackSynchronousPlatformIOAccessInDev;
|
|
4503
4852
|
},
|
|
4504
|
-
trackSynchronousRequestDataAccessInDev: function() {
|
|
4505
|
-
return trackSynchronousRequestDataAccessInDev;
|
|
4506
|
-
},
|
|
4507
4853
|
useDynamicRouteParams: function() {
|
|
4508
4854
|
return useDynamicRouteParams;
|
|
4855
|
+
},
|
|
4856
|
+
useDynamicSearchParams: function() {
|
|
4857
|
+
return useDynamicSearchParams;
|
|
4509
4858
|
}
|
|
4510
4859
|
});
|
|
4511
4860
|
const _react = /*#__PURE__*/ _interop_require_default(reactExports);
|
|
@@ -4514,8 +4863,11 @@ var scheduler = {};
|
|
|
4514
4863
|
const _workunitasyncstorageexternal = workUnitAsyncStorage_external;
|
|
4515
4864
|
const _workasyncstorageexternal = workAsyncStorage_external;
|
|
4516
4865
|
const _dynamicrenderingutils = dynamicRenderingUtils;
|
|
4517
|
-
const
|
|
4866
|
+
const _boundaryconstants = boundaryConstants;
|
|
4518
4867
|
const _scheduler = scheduler;
|
|
4868
|
+
const _bailouttocsr = bailoutToCsr;
|
|
4869
|
+
const _invarianterror = invariantError;
|
|
4870
|
+
const _stagedrendering = stagedRendering;
|
|
4519
4871
|
function _interop_require_default(obj) {
|
|
4520
4872
|
return obj && obj.__esModule ? obj : {
|
|
4521
4873
|
default: obj
|
|
@@ -4544,11 +4896,17 @@ var scheduler = {};
|
|
|
4544
4896
|
}
|
|
4545
4897
|
function markCurrentScopeAsDynamic(store, workUnitStore, expression) {
|
|
4546
4898
|
if (workUnitStore) {
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4899
|
+
switch(workUnitStore.type){
|
|
4900
|
+
case 'cache':
|
|
4901
|
+
case 'unstable-cache':
|
|
4902
|
+
// Inside cache scopes, marking a scope as dynamic has no effect,
|
|
4903
|
+
// because the outer cache scope creates a cache boundary. This is
|
|
4904
|
+
// subtly different from reading a dynamic data source, which is
|
|
4905
|
+
// forbidden inside a cache scope.
|
|
4906
|
+
return;
|
|
4907
|
+
case 'private-cache':
|
|
4908
|
+
// A private cache scope is already dynamic by definition.
|
|
4909
|
+
return;
|
|
4552
4910
|
}
|
|
4553
4911
|
}
|
|
4554
4912
|
// If we're forcing dynamic rendering or we're forcing static rendering, we
|
|
@@ -4563,29 +4921,29 @@ var scheduler = {};
|
|
|
4563
4921
|
});
|
|
4564
4922
|
}
|
|
4565
4923
|
if (workUnitStore) {
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4924
|
+
switch(workUnitStore.type){
|
|
4925
|
+
case 'prerender-ppr':
|
|
4926
|
+
return postponeWithTracking(store.route, expression, workUnitStore.dynamicTracking);
|
|
4927
|
+
case 'prerender-legacy':
|
|
4928
|
+
workUnitStore.revalidate = 0;
|
|
4929
|
+
// We aren't prerendering, but we are generating a static page. We need
|
|
4930
|
+
// to bail out of static generation.
|
|
4931
|
+
const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
|
|
4932
|
+
value: "E550",
|
|
4933
|
+
enumerable: false,
|
|
4934
|
+
configurable: true
|
|
4935
|
+
});
|
|
4936
|
+
store.dynamicUsageDescription = expression;
|
|
4937
|
+
store.dynamicUsageStack = err.stack;
|
|
4938
|
+
throw err;
|
|
4939
|
+
case 'request':
|
|
4940
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4941
|
+
workUnitStore.usedDynamic = true;
|
|
4942
|
+
}
|
|
4943
|
+
break;
|
|
4581
4944
|
}
|
|
4582
4945
|
}
|
|
4583
4946
|
}
|
|
4584
|
-
function trackFallbackParamAccessed(store, expression) {
|
|
4585
|
-
const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
4586
|
-
if (!prerenderStore || prerenderStore.type !== 'prerender-ppr') return;
|
|
4587
|
-
postponeWithTracking(store.route, expression, prerenderStore.dynamicTracking);
|
|
4588
|
-
}
|
|
4589
4947
|
function throwToInterruptStaticGeneration(expression, store, prerenderStore) {
|
|
4590
4948
|
// We aren't prerendering but we are generating a static page. We need to bail out of static generation
|
|
4591
4949
|
const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
|
|
@@ -4598,21 +4956,29 @@ var scheduler = {};
|
|
|
4598
4956
|
store.dynamicUsageStack = err.stack;
|
|
4599
4957
|
throw err;
|
|
4600
4958
|
}
|
|
4601
|
-
function trackDynamicDataInDynamicRender(
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
//
|
|
4959
|
+
function trackDynamicDataInDynamicRender(workUnitStore) {
|
|
4960
|
+
switch(workUnitStore.type){
|
|
4961
|
+
case 'cache':
|
|
4962
|
+
case 'unstable-cache':
|
|
4963
|
+
// Inside cache scopes, marking a scope as dynamic has no effect,
|
|
4964
|
+
// because the outer cache scope creates a cache boundary. This is
|
|
4965
|
+
// subtly different from reading a dynamic data source, which is
|
|
4606
4966
|
// forbidden inside a cache scope.
|
|
4607
4967
|
return;
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4968
|
+
case 'private-cache':
|
|
4969
|
+
// A private cache scope is already dynamic by definition.
|
|
4970
|
+
return;
|
|
4971
|
+
case 'prerender':
|
|
4972
|
+
case 'prerender-runtime':
|
|
4973
|
+
case 'prerender-legacy':
|
|
4974
|
+
case 'prerender-ppr':
|
|
4975
|
+
case 'prerender-client':
|
|
4976
|
+
break;
|
|
4977
|
+
case 'request':
|
|
4978
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4979
|
+
workUnitStore.usedDynamic = true;
|
|
4980
|
+
}
|
|
4981
|
+
break;
|
|
4616
4982
|
}
|
|
4617
4983
|
}
|
|
4618
4984
|
function abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore) {
|
|
@@ -4644,8 +5010,12 @@ var scheduler = {};
|
|
|
4644
5010
|
}
|
|
4645
5011
|
function trackSynchronousPlatformIOAccessInDev(requestStore) {
|
|
4646
5012
|
// We don't actually have a controller to abort but we do the semantic equivalent by
|
|
4647
|
-
// advancing the request store out of prerender
|
|
4648
|
-
requestStore.
|
|
5013
|
+
// advancing the request store out of the prerender stage
|
|
5014
|
+
if (requestStore.stagedRendering) {
|
|
5015
|
+
// TODO: error for sync IO in the runtime stage
|
|
5016
|
+
// (which is not currently covered by the validation render in `spawnDynamicValidationInDev`)
|
|
5017
|
+
requestStore.stagedRendering.advanceStage(_stagedrendering.RenderStage.Dynamic);
|
|
5018
|
+
}
|
|
4649
5019
|
}
|
|
4650
5020
|
function abortAndThrowOnSynchronousRequestDataAccess(route, expression, errorWithStack, prerenderStore) {
|
|
4651
5021
|
const prerenderSignal = prerenderStore.controller.signal;
|
|
@@ -4669,7 +5039,6 @@ var scheduler = {};
|
|
|
4669
5039
|
}
|
|
4670
5040
|
throw createPrerenderInterruptedError(`Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`);
|
|
4671
5041
|
}
|
|
4672
|
-
const trackSynchronousRequestDataAccessInDev = trackSynchronousPlatformIOAccessInDev;
|
|
4673
5042
|
function Postpone({ reason, route }) {
|
|
4674
5043
|
const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
4675
5044
|
const dynamicTracking = prerenderStore && prerenderStore.type === 'prerender-ppr' ? prerenderStore.dynamicTracking : null;
|
|
@@ -4761,35 +5130,57 @@ var scheduler = {};
|
|
|
4761
5130
|
});
|
|
4762
5131
|
}
|
|
4763
5132
|
}
|
|
4764
|
-
function
|
|
4765
|
-
assertPostpone();
|
|
5133
|
+
function createRenderInBrowserAbortSignal() {
|
|
4766
5134
|
const controller = new AbortController();
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
}
|
|
5135
|
+
controller.abort(Object.defineProperty(new _bailouttocsr.BailoutToCSRError('Render in Browser'), "__NEXT_ERROR_CODE", {
|
|
5136
|
+
value: "E721",
|
|
5137
|
+
enumerable: false,
|
|
5138
|
+
configurable: true
|
|
5139
|
+
}));
|
|
4773
5140
|
return controller.signal;
|
|
4774
5141
|
}
|
|
4775
5142
|
function createHangingInputAbortSignal(workUnitStore) {
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
5143
|
+
switch(workUnitStore.type){
|
|
5144
|
+
case 'prerender':
|
|
5145
|
+
case 'prerender-runtime':
|
|
5146
|
+
const controller = new AbortController();
|
|
5147
|
+
if (workUnitStore.cacheSignal) {
|
|
5148
|
+
// If we have a cacheSignal it means we're in a prospective render. If
|
|
5149
|
+
// the input we're waiting on is coming from another cache, we do want
|
|
5150
|
+
// to wait for it so that we can resolve this cache entry too.
|
|
5151
|
+
workUnitStore.cacheSignal.inputReady().then(()=>{
|
|
5152
|
+
controller.abort();
|
|
5153
|
+
});
|
|
5154
|
+
} else {
|
|
5155
|
+
// Otherwise we're in the final render and we should already have all
|
|
5156
|
+
// our caches filled.
|
|
5157
|
+
// If the prerender uses stages, we have wait until the runtime stage,
|
|
5158
|
+
// at which point all runtime inputs will be resolved.
|
|
5159
|
+
// (otherwise, a runtime prerender might consider `cookies()` hanging
|
|
5160
|
+
// even though they'd resolve in the next task.)
|
|
5161
|
+
//
|
|
5162
|
+
// We might still be waiting on some microtasks so we
|
|
5163
|
+
// wait one tick before giving up. When we give up, we still want to
|
|
5164
|
+
// render the content of this cache as deeply as we can so that we can
|
|
5165
|
+
// suspend as deeply as possible in the tree or not at all if we don't
|
|
5166
|
+
// end up waiting for the input.
|
|
5167
|
+
const runtimeStagePromise = (0, _workunitasyncstorageexternal.getRuntimeStagePromise)(workUnitStore);
|
|
5168
|
+
if (runtimeStagePromise) {
|
|
5169
|
+
runtimeStagePromise.then(()=>(0, _scheduler.scheduleOnNextTick)(()=>controller.abort()));
|
|
5170
|
+
} else {
|
|
5171
|
+
(0, _scheduler.scheduleOnNextTick)(()=>controller.abort());
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
return controller.signal;
|
|
5175
|
+
case 'prerender-client':
|
|
5176
|
+
case 'prerender-ppr':
|
|
5177
|
+
case 'prerender-legacy':
|
|
5178
|
+
case 'request':
|
|
5179
|
+
case 'cache':
|
|
5180
|
+
case 'private-cache':
|
|
5181
|
+
case 'unstable-cache':
|
|
5182
|
+
return undefined;
|
|
4791
5183
|
}
|
|
4792
|
-
return controller.signal;
|
|
4793
5184
|
}
|
|
4794
5185
|
function annotateDynamicAccess(expression, prerenderStore) {
|
|
4795
5186
|
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
@@ -4802,31 +5193,111 @@ var scheduler = {};
|
|
|
4802
5193
|
}
|
|
4803
5194
|
function useDynamicRouteParams(expression) {
|
|
4804
5195
|
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
5196
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
5197
|
+
if (workStore && workUnitStore) {
|
|
5198
|
+
switch(workUnitStore.type){
|
|
5199
|
+
case 'prerender-client':
|
|
5200
|
+
case 'prerender':
|
|
5201
|
+
{
|
|
5202
|
+
const fallbackParams = workUnitStore.fallbackRouteParams;
|
|
5203
|
+
if (fallbackParams && fallbackParams.size > 0) {
|
|
5204
|
+
// We are in a prerender with cacheComponents semantics. We are going to
|
|
5205
|
+
// hang here and never resolve. This will cause the currently
|
|
5206
|
+
// rendering component to effectively be a dynamic hole.
|
|
5207
|
+
_react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression));
|
|
5208
|
+
}
|
|
5209
|
+
break;
|
|
5210
|
+
}
|
|
5211
|
+
case 'prerender-ppr':
|
|
5212
|
+
{
|
|
5213
|
+
const fallbackParams = workUnitStore.fallbackRouteParams;
|
|
5214
|
+
if (fallbackParams && fallbackParams.size > 0) {
|
|
5215
|
+
return postponeWithTracking(workStore.route, expression, workUnitStore.dynamicTracking);
|
|
5216
|
+
}
|
|
5217
|
+
break;
|
|
5218
|
+
}
|
|
5219
|
+
case 'prerender-runtime':
|
|
5220
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called during a runtime prerender. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
5221
|
+
value: "E771",
|
|
5222
|
+
enumerable: false,
|
|
5223
|
+
configurable: true
|
|
5224
|
+
});
|
|
5225
|
+
case 'cache':
|
|
5226
|
+
case 'private-cache':
|
|
5227
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
5228
|
+
value: "E745",
|
|
5229
|
+
enumerable: false,
|
|
5230
|
+
configurable: true
|
|
5231
|
+
});
|
|
4822
5232
|
}
|
|
4823
5233
|
}
|
|
4824
5234
|
}
|
|
5235
|
+
function useDynamicSearchParams(expression) {
|
|
5236
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
5237
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
5238
|
+
if (!workStore) {
|
|
5239
|
+
// We assume pages router context and just return
|
|
5240
|
+
return;
|
|
5241
|
+
}
|
|
5242
|
+
if (!workUnitStore) {
|
|
5243
|
+
(0, _workunitasyncstorageexternal.throwForMissingRequestStore)(expression);
|
|
5244
|
+
}
|
|
5245
|
+
switch(workUnitStore.type){
|
|
5246
|
+
case 'prerender-client':
|
|
5247
|
+
{
|
|
5248
|
+
_react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression));
|
|
5249
|
+
break;
|
|
5250
|
+
}
|
|
5251
|
+
case 'prerender-legacy':
|
|
5252
|
+
case 'prerender-ppr':
|
|
5253
|
+
{
|
|
5254
|
+
if (workStore.forceStatic) {
|
|
5255
|
+
return;
|
|
5256
|
+
}
|
|
5257
|
+
throw Object.defineProperty(new _bailouttocsr.BailoutToCSRError(expression), "__NEXT_ERROR_CODE", {
|
|
5258
|
+
value: "E394",
|
|
5259
|
+
enumerable: false,
|
|
5260
|
+
configurable: true
|
|
5261
|
+
});
|
|
5262
|
+
}
|
|
5263
|
+
case 'prerender':
|
|
5264
|
+
case 'prerender-runtime':
|
|
5265
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called from a Server Component. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
5266
|
+
value: "E795",
|
|
5267
|
+
enumerable: false,
|
|
5268
|
+
configurable: true
|
|
5269
|
+
});
|
|
5270
|
+
case 'cache':
|
|
5271
|
+
case 'unstable-cache':
|
|
5272
|
+
case 'private-cache':
|
|
5273
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
5274
|
+
value: "E745",
|
|
5275
|
+
enumerable: false,
|
|
5276
|
+
configurable: true
|
|
5277
|
+
});
|
|
5278
|
+
case 'request':
|
|
5279
|
+
return;
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
4825
5282
|
const hasSuspenseRegex = /\n\s+at Suspense \(<anonymous>\)/;
|
|
4826
|
-
|
|
4827
|
-
const
|
|
4828
|
-
|
|
4829
|
-
|
|
5283
|
+
// Common implicit body tags that React will treat as body when placed directly in html
|
|
5284
|
+
const bodyAndImplicitTags = 'body|div|main|section|article|aside|header|footer|nav|form|p|span|h1|h2|h3|h4|h5|h6';
|
|
5285
|
+
// Detects when RootLayoutBoundary (our framework marker component) appears
|
|
5286
|
+
// after Suspense in the component stack, indicating the root layout is wrapped
|
|
5287
|
+
// within a Suspense boundary. Ensures no body/html/implicit-body components are in between.
|
|
5288
|
+
//
|
|
5289
|
+
// Example matches:
|
|
5290
|
+
// at Suspense (<anonymous>)
|
|
5291
|
+
// at __next_root_layout_boundary__ (<anonymous>)
|
|
5292
|
+
//
|
|
5293
|
+
// Or with other components in between (but not body/html/implicit-body):
|
|
5294
|
+
// at Suspense (<anonymous>)
|
|
5295
|
+
// at SomeComponent (<anonymous>)
|
|
5296
|
+
// at __next_root_layout_boundary__ (<anonymous>)
|
|
5297
|
+
const hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex = new RegExp(`\\n\\s+at Suspense \\(<anonymous>\\)(?:(?!\\n\\s+at (?:${bodyAndImplicitTags}) \\(<anonymous>\\))[\\s\\S])*?\\n\\s+at ${_boundaryconstants.ROOT_LAYOUT_BOUNDARY_NAME} \\([^\\n]*\\)`);
|
|
5298
|
+
const hasMetadataRegex = new RegExp(`\\n\\s+at ${_boundaryconstants.METADATA_BOUNDARY_NAME}[\\n\\s]`);
|
|
5299
|
+
const hasViewportRegex = new RegExp(`\\n\\s+at ${_boundaryconstants.VIEWPORT_BOUNDARY_NAME}[\\n\\s]`);
|
|
5300
|
+
const hasOutletRegex = new RegExp(`\\n\\s+at ${_boundaryconstants.OUTLET_BOUNDARY_NAME}[\\n\\s]`);
|
|
4830
5301
|
function trackAllowedDynamicAccess(workStore, componentStack, dynamicValidation, clientDynamic) {
|
|
4831
5302
|
if (hasOutletRegex.test(componentStack)) {
|
|
4832
5303
|
// We don't need to track that this is dynamic. It is only so when something else is also dynamic.
|
|
@@ -4837,9 +5308,10 @@ var scheduler = {};
|
|
|
4837
5308
|
} else if (hasViewportRegex.test(componentStack)) {
|
|
4838
5309
|
dynamicValidation.hasDynamicViewport = true;
|
|
4839
5310
|
return;
|
|
4840
|
-
} else if (
|
|
4841
|
-
//
|
|
4842
|
-
//
|
|
5311
|
+
} else if (hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(componentStack)) {
|
|
5312
|
+
// For Suspense within body, the prelude wouldn't be empty so it wouldn't violate the empty static shells rule.
|
|
5313
|
+
// But if you have Suspense above body, the prelude is empty but we allow that because having Suspense
|
|
5314
|
+
// is an explicit signal from the user that they acknowledge the empty shell and want dynamic rendering.
|
|
4843
5315
|
dynamicValidation.hasAllowedDynamic = true;
|
|
4844
5316
|
dynamicValidation.hasSuspenseAboveBody = true;
|
|
4845
5317
|
return;
|
|
@@ -4853,7 +5325,7 @@ var scheduler = {};
|
|
|
4853
5325
|
dynamicValidation.dynamicErrors.push(clientDynamic.syncDynamicErrorWithStack);
|
|
4854
5326
|
return;
|
|
4855
5327
|
} else {
|
|
4856
|
-
const message = `Route "${workStore.route}":
|
|
5328
|
+
const message = `Route "${workStore.route}": Uncached data was accessed outside of ` + '<Suspense>. This delays the entire page from rendering, resulting in a ' + 'slow user experience. Learn more: ' + 'https://nextjs.org/docs/messages/blocking-route';
|
|
4857
5329
|
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
4858
5330
|
dynamicValidation.dynamicErrors.push(error);
|
|
4859
5331
|
return;
|
|
@@ -4891,8 +5363,8 @@ var scheduler = {};
|
|
|
4891
5363
|
}
|
|
4892
5364
|
}
|
|
4893
5365
|
function throwIfDisallowedDynamic(workStore, prelude, dynamicValidation, serverDynamic) {
|
|
4894
|
-
if (
|
|
4895
|
-
logDisallowedDynamicError(workStore,
|
|
5366
|
+
if (serverDynamic.syncDynamicErrorWithStack) {
|
|
5367
|
+
logDisallowedDynamicError(workStore, serverDynamic.syncDynamicErrorWithStack);
|
|
4896
5368
|
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
4897
5369
|
}
|
|
4898
5370
|
if (prelude !== 0) {
|
|
@@ -4902,13 +5374,6 @@ var scheduler = {};
|
|
|
4902
5374
|
// a lack of a shell is not considered disallowed so we simply return
|
|
4903
5375
|
return;
|
|
4904
5376
|
}
|
|
4905
|
-
if (serverDynamic.syncDynamicErrorWithStack) {
|
|
4906
|
-
// There is no shell and the server did something sync dynamic likely
|
|
4907
|
-
// leading to an early termination of the prerender before the shell
|
|
4908
|
-
// could be completed. We terminate the build/validating render.
|
|
4909
|
-
logDisallowedDynamicError(workStore, serverDynamic.syncDynamicErrorWithStack);
|
|
4910
|
-
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
4911
|
-
}
|
|
4912
5377
|
// We didn't have any sync bailouts but there may be user code which
|
|
4913
5378
|
// blocked the root. We would have captured these during the prerender
|
|
4914
5379
|
// and can log them here and then terminate the build/validating render
|
|
@@ -4941,6 +5406,12 @@ var scheduler = {};
|
|
|
4941
5406
|
}
|
|
4942
5407
|
}
|
|
4943
5408
|
}
|
|
5409
|
+
function delayUntilRuntimeStage(prerenderStore, result) {
|
|
5410
|
+
if (prerenderStore.runtimeStagePromise) {
|
|
5411
|
+
return prerenderStore.runtimeStagePromise.then(()=>result);
|
|
5412
|
+
}
|
|
5413
|
+
return result;
|
|
5414
|
+
}
|
|
4944
5415
|
|
|
4945
5416
|
|
|
4946
5417
|
} (dynamicRendering));
|
|
@@ -4999,22 +5470,12 @@ var afterTaskAsyncStorageInstance = {};
|
|
|
4999
5470
|
throwForSearchParamsAccessInUseCache: function() {
|
|
5000
5471
|
return throwForSearchParamsAccessInUseCache;
|
|
5001
5472
|
},
|
|
5002
|
-
throwWithStaticGenerationBailoutError: function() {
|
|
5003
|
-
return throwWithStaticGenerationBailoutError;
|
|
5004
|
-
},
|
|
5005
5473
|
throwWithStaticGenerationBailoutErrorWithDynamicError: function() {
|
|
5006
5474
|
return throwWithStaticGenerationBailoutErrorWithDynamicError;
|
|
5007
5475
|
}
|
|
5008
5476
|
});
|
|
5009
5477
|
const _staticgenerationbailout = staticGenerationBailoutExports;
|
|
5010
5478
|
const _aftertaskasyncstorageexternal = afterTaskAsyncStorage_external;
|
|
5011
|
-
function throwWithStaticGenerationBailoutError(route, expression) {
|
|
5012
|
-
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${route} couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
5013
|
-
value: "E576",
|
|
5014
|
-
enumerable: false,
|
|
5015
|
-
configurable: true
|
|
5016
|
-
});
|
|
5017
|
-
}
|
|
5018
5479
|
function throwWithStaticGenerationBailoutErrorWithDynamicError(route, expression) {
|
|
5019
5480
|
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${route} with \`dynamic = "error"\` couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
5020
5481
|
value: "E543",
|
|
@@ -5023,8 +5484,8 @@ var afterTaskAsyncStorageInstance = {};
|
|
|
5023
5484
|
});
|
|
5024
5485
|
}
|
|
5025
5486
|
function throwForSearchParamsAccessInUseCache(workStore, constructorOpt) {
|
|
5026
|
-
const error = Object.defineProperty(new Error(`Route ${workStore.route} used
|
|
5027
|
-
value: "
|
|
5487
|
+
const error = Object.defineProperty(new Error(`Route ${workStore.route} used \`searchParams\` inside "use cache". Accessing dynamic request data inside a cache scope is not supported. If you need some search params inside a cached function await \`searchParams\` outside of the cached function and pass only the required search params as arguments to the cached function. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
5488
|
+
value: "E842",
|
|
5028
5489
|
enumerable: false,
|
|
5029
5490
|
configurable: true
|
|
5030
5491
|
});
|
|
@@ -5056,294 +5517,100 @@ var afterTaskAsyncStorageInstance = {};
|
|
|
5056
5517
|
const _staticgenerationbailout = staticGenerationBailoutExports;
|
|
5057
5518
|
const _dynamicrenderingutils = dynamicRenderingUtils;
|
|
5058
5519
|
const _utils = utils;
|
|
5520
|
+
const _stagedrendering = stagedRendering;
|
|
5059
5521
|
function connection() {
|
|
5522
|
+
const callingExpression = 'connection';
|
|
5060
5523
|
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
5061
5524
|
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
5062
5525
|
if (workStore) {
|
|
5063
5526
|
if (workUnitStore && workUnitStore.phase === 'after' && !(0, _utils.isRequestAPICallableInsideAfter)()) {
|
|
5064
|
-
throw Object.defineProperty(new Error(`Route ${workStore.route} used
|
|
5065
|
-
value: "
|
|
5527
|
+
throw Object.defineProperty(new Error(`Route ${workStore.route} used \`connection()\` inside \`after()\`. The \`connection()\` function is used to indicate the subsequent code must only run when there is an actual Request, but \`after()\` executes after the request, so this function is not allowed in this scope. See more info here: https://nextjs.org/docs/canary/app/api-reference/functions/after`), "__NEXT_ERROR_CODE", {
|
|
5528
|
+
value: "E827",
|
|
5066
5529
|
enumerable: false,
|
|
5067
5530
|
configurable: true
|
|
5068
5531
|
});
|
|
5069
5532
|
}
|
|
5070
5533
|
if (workStore.forceStatic) {
|
|
5071
|
-
// When using forceStatic we override all other logic and always just
|
|
5072
|
-
//
|
|
5534
|
+
// When using forceStatic, we override all other logic and always just
|
|
5535
|
+
// return a resolving promise without tracking.
|
|
5073
5536
|
return Promise.resolve(undefined);
|
|
5074
5537
|
}
|
|
5075
|
-
if (workUnitStore) {
|
|
5076
|
-
if (workUnitStore.type === 'cache') {
|
|
5077
|
-
throw Object.defineProperty(new Error(`Route ${workStore.route} used "connection" inside "use cache". The \`connection()\` function is used to indicate the subsequent code must only run when there is an actual Request, but caches must be able to be produced before a Request so this function is not allowed in this scope. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
5078
|
-
value: "E111",
|
|
5079
|
-
enumerable: false,
|
|
5080
|
-
configurable: true
|
|
5081
|
-
});
|
|
5082
|
-
} else if (workUnitStore.type === 'unstable-cache') {
|
|
5083
|
-
throw Object.defineProperty(new Error(`Route ${workStore.route} used "connection" inside a function cached with "unstable_cache(...)". The \`connection()\` function is used to indicate the subsequent code must only run when there is an actual Request, but caches must be able to be produced before a Request so this function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
|
|
5084
|
-
value: "E1",
|
|
5085
|
-
enumerable: false,
|
|
5086
|
-
configurable: true
|
|
5087
|
-
});
|
|
5088
|
-
}
|
|
5089
|
-
}
|
|
5090
5538
|
if (workStore.dynamicShouldError) {
|
|
5091
|
-
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${workStore.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`connection\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
5092
|
-
value: "
|
|
5539
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${workStore.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`connection()\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
5540
|
+
value: "E847",
|
|
5093
5541
|
enumerable: false,
|
|
5094
5542
|
configurable: true
|
|
5095
5543
|
});
|
|
5096
5544
|
}
|
|
5097
5545
|
if (workUnitStore) {
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
(0, _dynamicrendering.throwToInterruptStaticGeneration)('connection', workStore, workUnitStore);
|
|
5110
|
-
}
|
|
5111
|
-
}
|
|
5112
|
-
// We fall through to the dynamic context below but we still track dynamic access
|
|
5113
|
-
// because in dev we can still error for things like using headers inside a cache context
|
|
5114
|
-
(0, _dynamicrendering.trackDynamicDataInDynamicRender)(workStore, workUnitStore);
|
|
5115
|
-
}
|
|
5116
|
-
return Promise.resolve(undefined);
|
|
5117
|
-
}
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
} (connection));
|
|
5121
|
-
|
|
5122
|
-
var rootParams = {};
|
|
5123
|
-
|
|
5124
|
-
var invariantError = {};
|
|
5125
|
-
|
|
5126
|
-
(function (exports) {
|
|
5127
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5128
|
-
value: true
|
|
5129
|
-
});
|
|
5130
|
-
Object.defineProperty(exports, "InvariantError", {
|
|
5131
|
-
enumerable: true,
|
|
5132
|
-
get: function() {
|
|
5133
|
-
return InvariantError;
|
|
5134
|
-
}
|
|
5135
|
-
});
|
|
5136
|
-
class InvariantError extends Error {
|
|
5137
|
-
constructor(message, options){
|
|
5138
|
-
super("Invariant: " + (message.endsWith('.') ? message : message + '.') + " This is a bug in Next.js.", options);
|
|
5139
|
-
this.name = 'InvariantError';
|
|
5140
|
-
}
|
|
5141
|
-
}
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
} (invariantError));
|
|
5145
|
-
|
|
5146
|
-
var reflectUtils = {};
|
|
5147
|
-
|
|
5148
|
-
(function (exports) {
|
|
5149
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5150
|
-
value: true
|
|
5151
|
-
});
|
|
5152
|
-
function _export(target, all) {
|
|
5153
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
5154
|
-
enumerable: true,
|
|
5155
|
-
get: all[name]
|
|
5156
|
-
});
|
|
5157
|
-
}
|
|
5158
|
-
_export(exports, {
|
|
5159
|
-
describeHasCheckingStringProperty: function() {
|
|
5160
|
-
return describeHasCheckingStringProperty;
|
|
5161
|
-
},
|
|
5162
|
-
describeStringPropertyAccess: function() {
|
|
5163
|
-
return describeStringPropertyAccess;
|
|
5164
|
-
},
|
|
5165
|
-
wellKnownProperties: function() {
|
|
5166
|
-
return wellKnownProperties;
|
|
5167
|
-
}
|
|
5168
|
-
});
|
|
5169
|
-
const isDefinitelyAValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
5170
|
-
function describeStringPropertyAccess(target, prop) {
|
|
5171
|
-
if (isDefinitelyAValidIdentifier.test(prop)) {
|
|
5172
|
-
return "`" + target + "." + prop + "`";
|
|
5173
|
-
}
|
|
5174
|
-
return "`" + target + "[" + JSON.stringify(prop) + "]`";
|
|
5175
|
-
}
|
|
5176
|
-
function describeHasCheckingStringProperty(target, prop) {
|
|
5177
|
-
const stringifiedProp = JSON.stringify(prop);
|
|
5178
|
-
return "`Reflect.has(" + target + ", " + stringifiedProp + ")`, `" + stringifiedProp + " in " + target + "`, or similar";
|
|
5179
|
-
}
|
|
5180
|
-
const wellKnownProperties = new Set([
|
|
5181
|
-
'hasOwnProperty',
|
|
5182
|
-
'isPrototypeOf',
|
|
5183
|
-
'propertyIsEnumerable',
|
|
5184
|
-
'toString',
|
|
5185
|
-
'valueOf',
|
|
5186
|
-
'toLocaleString',
|
|
5187
|
-
// Promise prototype
|
|
5188
|
-
// fallthrough
|
|
5189
|
-
'then',
|
|
5190
|
-
'catch',
|
|
5191
|
-
'finally',
|
|
5192
|
-
// React Promise extension
|
|
5193
|
-
// fallthrough
|
|
5194
|
-
'status',
|
|
5195
|
-
// React introspection
|
|
5196
|
-
'displayName',
|
|
5197
|
-
'_debugInfo',
|
|
5198
|
-
// Common tested properties
|
|
5199
|
-
// fallthrough
|
|
5200
|
-
'toJSON',
|
|
5201
|
-
'$$typeof',
|
|
5202
|
-
'__esModule'
|
|
5203
|
-
]);
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
} (reflectUtils));
|
|
5207
|
-
|
|
5208
|
-
(function (exports) {
|
|
5209
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5210
|
-
value: true
|
|
5211
|
-
});
|
|
5212
|
-
Object.defineProperty(exports, "unstable_rootParams", {
|
|
5213
|
-
enumerable: true,
|
|
5214
|
-
get: function() {
|
|
5215
|
-
return unstable_rootParams;
|
|
5216
|
-
}
|
|
5217
|
-
});
|
|
5218
|
-
const _invarianterror = invariantError;
|
|
5219
|
-
const _dynamicrendering = dynamicRendering;
|
|
5220
|
-
const _workasyncstorageexternal = workAsyncStorage_external;
|
|
5221
|
-
const _workunitasyncstorageexternal = workUnitAsyncStorage_external;
|
|
5222
|
-
const _dynamicrenderingutils = dynamicRenderingUtils;
|
|
5223
|
-
const _reflectutils = reflectUtils;
|
|
5224
|
-
const CachedParams = new WeakMap();
|
|
5225
|
-
async function unstable_rootParams() {
|
|
5226
|
-
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
5227
|
-
if (!workStore) {
|
|
5228
|
-
throw Object.defineProperty(new _invarianterror.InvariantError('Missing workStore in unstable_rootParams'), "__NEXT_ERROR_CODE", {
|
|
5229
|
-
value: "E615",
|
|
5230
|
-
enumerable: false,
|
|
5231
|
-
configurable: true
|
|
5232
|
-
});
|
|
5233
|
-
}
|
|
5234
|
-
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
5235
|
-
if (!workUnitStore) {
|
|
5236
|
-
throw Object.defineProperty(new Error(`Route ${workStore.route} used \`unstable_rootParams()\` in Pages Router. This API is only available within App Router.`), "__NEXT_ERROR_CODE", {
|
|
5237
|
-
value: "E641",
|
|
5238
|
-
enumerable: false,
|
|
5239
|
-
configurable: true
|
|
5240
|
-
});
|
|
5241
|
-
}
|
|
5242
|
-
switch(workUnitStore.type){
|
|
5243
|
-
case 'unstable-cache':
|
|
5244
|
-
case 'cache':
|
|
5245
|
-
{
|
|
5246
|
-
throw Object.defineProperty(new Error(`Route ${workStore.route} used \`unstable_rootParams()\` inside \`"use cache"\` or \`unstable_cache\`. Support for this API inside cache scopes is planned for a future version of Next.js.`), "__NEXT_ERROR_CODE", {
|
|
5247
|
-
value: "E642",
|
|
5248
|
-
enumerable: false,
|
|
5249
|
-
configurable: true
|
|
5250
|
-
});
|
|
5251
|
-
}
|
|
5252
|
-
case 'prerender':
|
|
5253
|
-
case 'prerender-client':
|
|
5254
|
-
case 'prerender-ppr':
|
|
5255
|
-
case 'prerender-legacy':
|
|
5256
|
-
return createPrerenderRootParams(workUnitStore.rootParams, workStore, workUnitStore);
|
|
5257
|
-
default:
|
|
5258
|
-
return Promise.resolve(workUnitStore.rootParams);
|
|
5259
|
-
}
|
|
5260
|
-
}
|
|
5261
|
-
function createPrerenderRootParams(underlyingParams, workStore, prerenderStore) {
|
|
5262
|
-
const fallbackParams = workStore.fallbackRouteParams;
|
|
5263
|
-
if (fallbackParams) {
|
|
5264
|
-
let hasSomeFallbackParams = false;
|
|
5265
|
-
for(const key in underlyingParams){
|
|
5266
|
-
if (fallbackParams.has(key)) {
|
|
5267
|
-
hasSomeFallbackParams = true;
|
|
5268
|
-
break;
|
|
5269
|
-
}
|
|
5270
|
-
}
|
|
5271
|
-
if (hasSomeFallbackParams) {
|
|
5272
|
-
// params need to be treated as dynamic because we have at least one fallback param
|
|
5273
|
-
switch(prerenderStore.type){
|
|
5274
|
-
case 'prerender':
|
|
5275
|
-
// We are in a dynamicIO prerender
|
|
5276
|
-
const cachedParams = CachedParams.get(underlyingParams);
|
|
5277
|
-
if (cachedParams) {
|
|
5278
|
-
return cachedParams;
|
|
5546
|
+
switch(workUnitStore.type){
|
|
5547
|
+
case 'cache':
|
|
5548
|
+
{
|
|
5549
|
+
const error = Object.defineProperty(new Error(`Route ${workStore.route} used \`connection()\` inside "use cache". The \`connection()\` function is used to indicate the subsequent code must only run when there is an actual request, but caches must be able to be produced before a request, so this function is not allowed in this scope. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
5550
|
+
value: "E841",
|
|
5551
|
+
enumerable: false,
|
|
5552
|
+
configurable: true
|
|
5553
|
+
});
|
|
5554
|
+
Error.captureStackTrace(error, connection);
|
|
5555
|
+
workStore.invalidDynamicUsageError ??= error;
|
|
5556
|
+
throw error;
|
|
5279
5557
|
}
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5558
|
+
case 'private-cache':
|
|
5559
|
+
{
|
|
5560
|
+
// It might not be intuitive to throw for private caches as well, but
|
|
5561
|
+
// we don't consider runtime prefetches as "actual requests" (in the
|
|
5562
|
+
// navigation sense), despite allowing them to read cookies.
|
|
5563
|
+
const error = Object.defineProperty(new Error(`Route ${workStore.route} used \`connection()\` inside "use cache: private". The \`connection()\` function is used to indicate the subsequent code must only run when there is an actual navigation request, but caches must be able to be produced before a navigation request, so this function is not allowed in this scope. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
5564
|
+
value: "E837",
|
|
5565
|
+
enumerable: false,
|
|
5566
|
+
configurable: true
|
|
5567
|
+
});
|
|
5568
|
+
Error.captureStackTrace(error, connection);
|
|
5569
|
+
workStore.invalidDynamicUsageError ??= error;
|
|
5570
|
+
throw error;
|
|
5571
|
+
}
|
|
5572
|
+
case 'unstable-cache':
|
|
5573
|
+
throw Object.defineProperty(new Error(`Route ${workStore.route} used \`connection()\` inside a function cached with \`unstable_cache()\`. The \`connection()\` function is used to indicate the subsequent code must only run when there is an actual Request, but caches must be able to be produced before a Request so this function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
|
|
5574
|
+
value: "E840",
|
|
5287
5575
|
enumerable: false,
|
|
5288
5576
|
configurable: true
|
|
5289
5577
|
});
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
//
|
|
5294
|
-
//
|
|
5295
|
-
return
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
// instrument the promise with spreadable properties of ReactPromise.
|
|
5313
|
-
const promise = Promise.resolve(augmentedUnderlying);
|
|
5314
|
-
CachedParams.set(underlyingParams, promise);
|
|
5315
|
-
Object.keys(underlyingParams).forEach((prop)=>{
|
|
5316
|
-
if (_reflectutils.wellKnownProperties.has(prop)) ; else {
|
|
5317
|
-
if (fallbackParams.has(prop)) {
|
|
5318
|
-
Object.defineProperty(augmentedUnderlying, prop, {
|
|
5319
|
-
get () {
|
|
5320
|
-
const expression = (0, _reflectutils.describeStringPropertyAccess)('unstable_rootParams', prop);
|
|
5321
|
-
// In most dynamic APIs we also throw if `dynamic = "error"` however
|
|
5322
|
-
// for params is only dynamic when we're generating a fallback shell
|
|
5323
|
-
// and even when `dynamic = "error"` we still support generating dynamic
|
|
5324
|
-
// fallback shells
|
|
5325
|
-
// TODO remove this comment when dynamicIO is the default since there
|
|
5326
|
-
// will be no `dynamic = "error"`
|
|
5327
|
-
if (prerenderStore.type === 'prerender-ppr') {
|
|
5328
|
-
// PPR Prerender (no dynamicIO)
|
|
5329
|
-
(0, _dynamicrendering.postponeWithTracking)(workStore.route, expression, prerenderStore.dynamicTracking);
|
|
5330
|
-
} else {
|
|
5331
|
-
// Legacy Prerender
|
|
5332
|
-
(0, _dynamicrendering.throwToInterruptStaticGeneration)(expression, workStore, prerenderStore);
|
|
5578
|
+
case 'prerender':
|
|
5579
|
+
case 'prerender-client':
|
|
5580
|
+
case 'prerender-runtime':
|
|
5581
|
+
// We return a promise that never resolves to allow the prerender to
|
|
5582
|
+
// stall at this point.
|
|
5583
|
+
return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, '`connection()`');
|
|
5584
|
+
case 'prerender-ppr':
|
|
5585
|
+
// We use React's postpone API to interrupt rendering here to create a
|
|
5586
|
+
// dynamic hole
|
|
5587
|
+
return (0, _dynamicrendering.postponeWithTracking)(workStore.route, 'connection', workUnitStore.dynamicTracking);
|
|
5588
|
+
case 'prerender-legacy':
|
|
5589
|
+
// We throw an error here to interrupt prerendering to mark the route
|
|
5590
|
+
// as dynamic
|
|
5591
|
+
return (0, _dynamicrendering.throwToInterruptStaticGeneration)('connection', workStore, workUnitStore);
|
|
5592
|
+
case 'request':
|
|
5593
|
+
(0, _dynamicrendering.trackDynamicDataInDynamicRender)(workUnitStore);
|
|
5594
|
+
if (process.env.NODE_ENV === 'development') {
|
|
5595
|
+
// Semantically we only need the dev tracking when running in `next dev`
|
|
5596
|
+
// but since you would never use next dev with production NODE_ENV we use this
|
|
5597
|
+
// as a proxy so we can statically exclude this code from production builds.
|
|
5598
|
+
if (workUnitStore.asyncApiPromises) {
|
|
5599
|
+
return workUnitStore.asyncApiPromises.connection;
|
|
5333
5600
|
}
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
promise[prop] = underlyingParams[prop];
|
|
5601
|
+
return (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, _stagedrendering.RenderStage.Dynamic);
|
|
5602
|
+
} else {
|
|
5603
|
+
return Promise.resolve(undefined);
|
|
5604
|
+
}
|
|
5339
5605
|
}
|
|
5340
5606
|
}
|
|
5341
|
-
}
|
|
5342
|
-
|
|
5607
|
+
}
|
|
5608
|
+
// If we end up here, there was no work store or work unit store present.
|
|
5609
|
+
(0, _workunitasyncstorageexternal.throwForMissingRequestStore)(callingExpression);
|
|
5343
5610
|
}
|
|
5344
5611
|
|
|
5345
5612
|
|
|
5346
|
-
} (
|
|
5613
|
+
} (connection));
|
|
5347
5614
|
|
|
5348
5615
|
(function (module, exports) {
|
|
5349
5616
|
const serverExports = {
|
|
@@ -5361,8 +5628,6 @@ var reflectUtils = {};
|
|
|
5361
5628
|
.URLPattern,
|
|
5362
5629
|
after: after$1.after,
|
|
5363
5630
|
connection: connection.connection,
|
|
5364
|
-
unstable_rootParams: rootParams
|
|
5365
|
-
.unstable_rootParams,
|
|
5366
5631
|
};
|
|
5367
5632
|
|
|
5368
5633
|
// https://nodejs.org/api/esm.html#commonjs-namespaces
|
|
@@ -5377,8 +5642,7 @@ var reflectUtils = {};
|
|
|
5377
5642
|
exports.userAgent = serverExports.userAgent;
|
|
5378
5643
|
exports.URLPattern = serverExports.URLPattern;
|
|
5379
5644
|
exports.after = serverExports.after;
|
|
5380
|
-
exports.connection = serverExports.connection;
|
|
5381
|
-
exports.unstable_rootParams = serverExports.unstable_rootParams;
|
|
5645
|
+
exports.connection = serverExports.connection;
|
|
5382
5646
|
} (server, server.exports));
|
|
5383
5647
|
|
|
5384
5648
|
var serverExports = server.exports;
|
|
@@ -12546,6 +12810,13 @@ var checkoutSessionCustomizationSchema = objectType({
|
|
|
12546
12810
|
}).optional();
|
|
12547
12811
|
var checkoutSessionFeatureFlagsSchema = objectType({
|
|
12548
12812
|
allow_currency_selection: booleanType().optional(),
|
|
12813
|
+
allow_customer_editing_city: booleanType().optional(),
|
|
12814
|
+
allow_customer_editing_country: booleanType().optional(),
|
|
12815
|
+
allow_customer_editing_email: booleanType().optional(),
|
|
12816
|
+
allow_customer_editing_name: booleanType().optional(),
|
|
12817
|
+
allow_customer_editing_state: booleanType().optional(),
|
|
12818
|
+
allow_customer_editing_street: booleanType().optional(),
|
|
12819
|
+
allow_customer_editing_zipcode: booleanType().optional(),
|
|
12549
12820
|
allow_discount_code: booleanType().optional(),
|
|
12550
12821
|
allow_phone_number_collection: booleanType().optional(),
|
|
12551
12822
|
allow_tax_id: booleanType().optional(),
|
|
@@ -12646,7 +12917,11 @@ var buildCheckoutUrl = async ({
|
|
|
12646
12917
|
if (!sessionPayload) {
|
|
12647
12918
|
throw new Error("sessionPayload is required when type is 'session'");
|
|
12648
12919
|
}
|
|
12649
|
-
const
|
|
12920
|
+
const finalPayload = {
|
|
12921
|
+
...sessionPayload,
|
|
12922
|
+
return_url: sessionPayload.return_url ?? returnUrl
|
|
12923
|
+
};
|
|
12924
|
+
const session = await createCheckoutSession(finalPayload, {
|
|
12650
12925
|
bearerToken,
|
|
12651
12926
|
environment
|
|
12652
12927
|
});
|
|
@@ -13277,6 +13552,12 @@ var SubscriptionExpiredPayloadSchema = objectType({
|
|
|
13277
13552
|
timestamp: stringType().transform((d) => new Date(d)),
|
|
13278
13553
|
data: SubscriptionSchema
|
|
13279
13554
|
});
|
|
13555
|
+
var SubscriptionUpdatedPayloadSchema = objectType({
|
|
13556
|
+
business_id: stringType(),
|
|
13557
|
+
type: literalType("subscription.updated"),
|
|
13558
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
13559
|
+
data: SubscriptionSchema
|
|
13560
|
+
});
|
|
13280
13561
|
var LicenseKeyCreatedPayloadSchema = objectType({
|
|
13281
13562
|
business_id: stringType(),
|
|
13282
13563
|
type: literalType("license_key.created"),
|
|
@@ -13305,6 +13586,7 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
|
|
|
13305
13586
|
SubscriptionCancelledPayloadSchema,
|
|
13306
13587
|
SubscriptionFailedPayloadSchema,
|
|
13307
13588
|
SubscriptionExpiredPayloadSchema,
|
|
13589
|
+
SubscriptionUpdatedPayloadSchema,
|
|
13308
13590
|
LicenseKeyCreatedPayloadSchema
|
|
13309
13591
|
]);
|
|
13310
13592
|
|
|
@@ -13379,6 +13661,9 @@ async function handleWebhookPayload(payload, config, context) {
|
|
|
13379
13661
|
if (payload.type === "subscription.expired") {
|
|
13380
13662
|
await callHandler(config.onSubscriptionExpired, payload);
|
|
13381
13663
|
}
|
|
13664
|
+
if (payload.type === "subscription.updated") {
|
|
13665
|
+
await callHandler(config.onSubscriptionUpdated, payload);
|
|
13666
|
+
}
|
|
13382
13667
|
if (payload.type === "license_key.created") {
|
|
13383
13668
|
await callHandler(config.onLicenseKeyCreated, payload);
|
|
13384
13669
|
}
|