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