@skspwork/config-doc 2.3.0 → 2.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/package.json +2 -2
- package/packages/web/.next/standalone/.next/build-manifest.json +4 -4
- package/packages/web/.next/standalone/.next/prerender-manifest.json +3 -3
- package/packages/web/.next/standalone/.next/required-server-files.json +197 -40
- package/packages/web/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +4 -4
- package/packages/web/.next/standalone/.next/server/app/_global-error/page.js +2 -2
- package/packages/web/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/packages/web/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/packages/web/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/packages/web/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/packages/web/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/packages/web/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +4 -4
- package/packages/web/.next/standalone/.next/server/app/_not-found/page.js +2 -2
- package/packages/web/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/packages/web/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/packages/web/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/packages/web/.next/standalone/.next/server/app/_not-found.rsc +7 -7
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +7 -7
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +3 -3
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/index.html +1 -1
- package/packages/web/.next/standalone/.next/server/app/index.rsc +7 -7
- package/packages/web/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +7 -7
- package/packages/web/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +3 -3
- package/packages/web/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/page/build-manifest.json +4 -4
- package/packages/web/.next/standalone/.next/server/app/page.js +2 -2
- package/packages/web/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/packages/web/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__159cda08._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__40e87302._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__444da89e._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__7243756e._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__93da9fce._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__c9655ac8._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__d3d080e2._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__e19366f6._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__e5fda42c._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__f408c708._.js +6 -6
- package/packages/web/.next/standalone/.next/server/chunks/[turbopack]_runtime.js +70 -70
- package/packages/web/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_d09de205.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1690ee0d._.js +3 -3
- package/packages/web/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1fc1847a._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__a5e1fc06._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__ca05f4a0._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/ssr/[turbopack]_runtime.js +70 -70
- package/packages/web/.next/standalone/.next/server/chunks/ssr/_83f196ec._.js +2 -2
- package/packages/web/.next/standalone/.next/server/chunks/ssr/node_modules_d3586d0c._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_08570d7f._.js +2 -2
- package/packages/web/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_65e60196._.js +3 -0
- package/packages/web/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_c0d4d2bf.js +2 -2
- package/packages/web/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_f9713a08._.js +3 -0
- package/packages/web/.next/standalone/.next/server/middleware-build-manifest.js +4 -4
- package/packages/web/.next/standalone/.next/server/pages/404.html +1 -1
- package/packages/web/.next/standalone/.next/server/pages/500.html +2 -2
- package/packages/web/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/packages/web/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/packages/web/.next/standalone/.next/static/chunks/2f236954d6a65e12.js +1 -0
- package/packages/web/.next/standalone/.next/static/chunks/4b9eae0c8dc7e975.js +1 -0
- package/packages/web/.next/standalone/.next/static/chunks/a90b6d11afe742e2.js +5 -0
- package/packages/web/.next/standalone/.next/static/chunks/f2f58a7e93290fbb.js +1 -0
- package/packages/web/.next/standalone/.next/static/chunks/turbopack-1e9ff4ec3e6618de.js +4 -0
- package/packages/web/.next/standalone/node_modules/@next/env/package.json +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/build/index.js +10 -4
- package/packages/web/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/build/templates/app-page.js +3 -1
- package/packages/web/.next/standalone/node_modules/next/dist/build/templates/edge-ssr-app.js +3 -1
- package/packages/web/.next/standalone/node_modules/next/dist/build/webpack-config.js +3 -3
- package/packages/web/.next/standalone/node_modules/next/dist/client/components/segment-cache/lru.js +2 -0
- package/packages/web/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +12 -12
- package/packages/web/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +12 -12
- package/packages/web/.next/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +2 -2
- package/packages/web/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +10 -10
- package/packages/web/.next/standalone/node_modules/next/dist/server/app-render/app-render.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/app-render/postponed-state.js +2 -2
- package/packages/web/.next/standalone/node_modules/next/dist/server/base-server.js +21 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/config-schema.js +2 -0
- package/packages/web/.next/standalone/node_modules/next/dist/server/config-shared.js +15 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/config.js +9 -3
- package/packages/web/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/image-optimizer.js +26 -3
- package/packages/web/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/lib/lru-cache.js +7 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/next-server.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/server/response-cache/index.js +117 -17
- package/packages/web/.next/standalone/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +21 -2
- package/packages/web/.next/standalone/node_modules/next/dist/server/route-modules/route-module.js +3 -0
- package/packages/web/.next/standalone/node_modules/next/dist/server/web/adapter.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/shared/lib/image-config.js +1 -0
- package/packages/web/.next/standalone/node_modules/next/dist/shared/lib/size-limit.js +35 -0
- package/packages/web/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/packages/web/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/packages/web/.next/standalone/node_modules/next/package.json +15 -15
- package/packages/web/.next/standalone/package.json +1 -1
- package/packages/web/.next/standalone/playwright-report/index.html +1 -1
- package/packages/web/.next/standalone/server.js +1 -1
- package/packages/web/.next/static/chunks/2f236954d6a65e12.js +1 -0
- package/packages/web/.next/static/chunks/4b9eae0c8dc7e975.js +1 -0
- package/packages/web/.next/static/chunks/a90b6d11afe742e2.js +5 -0
- package/packages/web/.next/static/chunks/f2f58a7e93290fbb.js +1 -0
- package/packages/web/.next/static/chunks/turbopack-1e9ff4ec3e6618de.js +4 -0
- package/packages/web/package.json +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_77ec7569._.js +0 -3
- package/packages/web/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_9266b807._.js +0 -3
- package/packages/web/.next/standalone/.next/static/chunks/30420d12e4f82b67.js +0 -5
- package/packages/web/.next/standalone/.next/static/chunks/4fd93823156e59e8.js +0 -1
- package/packages/web/.next/standalone/.next/static/chunks/5f8f53e7772f4262.js +0 -1
- package/packages/web/.next/standalone/.next/static/chunks/cc759f7c2413b7ff.js +0 -1
- package/packages/web/.next/standalone/.next/static/chunks/turbopack-5b6cb51ab4268fba.js +0 -4
- package/packages/web/.next/static/chunks/30420d12e4f82b67.js +0 -5
- package/packages/web/.next/static/chunks/4fd93823156e59e8.js +0 -1
- package/packages/web/.next/static/chunks/5f8f53e7772f4262.js +0 -1
- package/packages/web/.next/static/chunks/cc759f7c2413b7ff.js +0 -1
- package/packages/web/.next/static/chunks/turbopack-5b6cb51ab4268fba.js +0 -4
package/packages/web/.next/standalone/node_modules/next/dist/server/app-render/app-render.js
CHANGED
|
@@ -1393,7 +1393,7 @@ const renderToHTMLOrFlight = (req, res, pagePath, query, fallbackRouteParams, re
|
|
|
1393
1393
|
});
|
|
1394
1394
|
}
|
|
1395
1395
|
interpolatedParams = (0, _getdynamicparam.interpolateParallelRouteParams)(renderOpts.ComponentMod.routeModule.userland.loaderTree, renderOpts.params ?? {}, pagePath, fallbackRouteParams);
|
|
1396
|
-
postponedState = (0, _postponedstate.parsePostponedState)(renderOpts.postponed, interpolatedParams);
|
|
1396
|
+
postponedState = (0, _postponedstate.parsePostponedState)(renderOpts.postponed, interpolatedParams, renderOpts.experimental.maxPostponedStateSizeBytes);
|
|
1397
1397
|
} else {
|
|
1398
1398
|
interpolatedParams = (0, _getdynamicparam.interpolateParallelRouteParams)(renderOpts.ComponentMod.routeModule.userland.loaderTree, renderOpts.params ?? {}, pagePath, fallbackRouteParams);
|
|
1399
1399
|
}
|
package/packages/web/.next/standalone/node_modules/next/dist/server/app-render/postponed-state.js
CHANGED
|
@@ -74,7 +74,7 @@ async function getDynamicHTMLPostponedState(postponed, preludeState, fallbackRou
|
|
|
74
74
|
async function getDynamicDataPostponedState(resumeDataCache, isCacheComponentsEnabled) {
|
|
75
75
|
return `4:null${await (0, _resumedatacache.stringifyResumeDataCache)((0, _resumedatacache.createRenderResumeDataCache)(resumeDataCache), isCacheComponentsEnabled)}`;
|
|
76
76
|
}
|
|
77
|
-
function parsePostponedState(state, interpolatedParams) {
|
|
77
|
+
function parsePostponedState(state, interpolatedParams, maxPostponedStateSizeBytes) {
|
|
78
78
|
try {
|
|
79
79
|
var _state_match;
|
|
80
80
|
const postponedStringLengthMatch = (_state_match = state.match(/^([0-9]*):/)) == null ? void 0 : _state_match[1];
|
|
@@ -89,7 +89,7 @@ function parsePostponedState(state, interpolatedParams) {
|
|
|
89
89
|
// We add a `:` to the end of the length as the first character of the
|
|
90
90
|
// postponed string is the length of the replacement entries.
|
|
91
91
|
const postponedString = state.slice(postponedStringLengthMatch.length + 1, postponedStringLengthMatch.length + postponedStringLength + 1);
|
|
92
|
-
const renderResumeDataCache = (0, _resumedatacache.createRenderResumeDataCache)(state.slice(postponedStringLengthMatch.length + postponedStringLength + 1));
|
|
92
|
+
const renderResumeDataCache = (0, _resumedatacache.createRenderResumeDataCache)(state.slice(postponedStringLengthMatch.length + postponedStringLength + 1), maxPostponedStateSizeBytes);
|
|
93
93
|
try {
|
|
94
94
|
if (postponedString === 'null') {
|
|
95
95
|
return {
|
|
@@ -20,6 +20,7 @@ _export(exports, {
|
|
|
20
20
|
return Server;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
+
const _configshared = require("./config-shared");
|
|
23
24
|
const _utils = require("../shared/lib/utils");
|
|
24
25
|
const _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
|
|
25
26
|
const _url = require("url");
|
|
@@ -387,7 +388,8 @@ class Server {
|
|
|
387
388
|
clientParamParsingOrigins: this.nextConfig.experimental.clientParamParsingOrigins,
|
|
388
389
|
dynamicOnHover: this.nextConfig.experimental.dynamicOnHover ?? false,
|
|
389
390
|
inlineCss: this.nextConfig.experimental.inlineCss ?? false,
|
|
390
|
-
authInterrupts: !!this.nextConfig.experimental.authInterrupts
|
|
391
|
+
authInterrupts: !!this.nextConfig.experimental.authInterrupts,
|
|
392
|
+
maxPostponedStateSizeBytes: (0, _configshared.parseMaxPostponedStateSize)(this.nextConfig.experimental.maxPostponedStateSize)
|
|
391
393
|
},
|
|
392
394
|
onInstrumentationRequestError: this.instrumentationOnRequestError.bind(this),
|
|
393
395
|
reactMaxHeadersLength: this.nextConfig.reactMaxHeadersLength
|
|
@@ -595,11 +597,29 @@ class Server {
|
|
|
595
597
|
// It's important to execute the following block even it the request
|
|
596
598
|
// matches a pages data route from above.
|
|
597
599
|
if (this.isAppPPREnabled && this.minimalMode && req.headers[_constants2.NEXT_RESUME_HEADER] === '1' && req.method === 'POST') {
|
|
600
|
+
// Get the configured max postponed state size.
|
|
601
|
+
const maxPostponedStateSize = this.nextConfig.experimental.maxPostponedStateSize ?? _configshared.DEFAULT_MAX_POSTPONED_STATE_SIZE;
|
|
602
|
+
const maxPostponedStateSizeBytes = (0, _configshared.parseMaxPostponedStateSize)(this.nextConfig.experimental.maxPostponedStateSize);
|
|
603
|
+
if (maxPostponedStateSizeBytes === undefined) {
|
|
604
|
+
throw Object.defineProperty(new Error('maxPostponedStateSize must be a valid number (bytes) or filesize format string (e.g., "5mb")'), "__NEXT_ERROR_CODE", {
|
|
605
|
+
value: "E977",
|
|
606
|
+
enumerable: false,
|
|
607
|
+
configurable: true
|
|
608
|
+
});
|
|
609
|
+
}
|
|
598
610
|
// Decode the postponed state from the request body, it will come as
|
|
599
611
|
// an array of buffers, so collect them and then concat them to form
|
|
600
612
|
// the string.
|
|
601
613
|
const body = [];
|
|
614
|
+
let size = 0;
|
|
602
615
|
for await (const chunk of req.body){
|
|
616
|
+
size += Buffer.byteLength(chunk);
|
|
617
|
+
if (size > maxPostponedStateSizeBytes) {
|
|
618
|
+
res.statusCode = 413;
|
|
619
|
+
const errorMessage = `Postponed state exceeded ${maxPostponedStateSize} limit. ` + `To configure the limit, see: https://nextjs.org/docs/app/api-reference/config/next-config-js/max-postponed-state-size`;
|
|
620
|
+
res.body(errorMessage).send();
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
603
623
|
body.push(chunk);
|
|
604
624
|
}
|
|
605
625
|
const postponed = Buffer.concat(body).toString('utf8');
|
|
@@ -194,6 +194,7 @@ const experimentalSchema = {
|
|
|
194
194
|
bodySizeLimit: zSizeLimit.optional(),
|
|
195
195
|
allowedOrigins: _zod.z.array(_zod.z.string()).optional()
|
|
196
196
|
}).optional(),
|
|
197
|
+
maxPostponedStateSize: zSizeLimit.optional(),
|
|
197
198
|
// The original type was Record<string, any>
|
|
198
199
|
extensionAlias: _zod.z.record(_zod.z.string(), _zod.z.any()).optional(),
|
|
199
200
|
externalDir: _zod.z.boolean().optional(),
|
|
@@ -532,6 +533,7 @@ const configSchema = _zod.z.lazy(()=>_zod.z.strictObject({
|
|
|
532
533
|
loader: _zod.z.enum(_imageconfig.VALID_LOADERS).optional(),
|
|
533
534
|
loaderFile: _zod.z.string().optional(),
|
|
534
535
|
maximumRedirects: _zod.z.number().int().min(0).max(20).optional(),
|
|
536
|
+
maximumResponseBody: _zod.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
|
|
535
537
|
minimumCacheTTL: _zod.z.number().int().gte(0).optional(),
|
|
536
538
|
path: _zod.z.string().optional(),
|
|
537
539
|
qualities: _zod.z.array(_zod.z.number().int().gte(1).lte(100)).min(1).max(20).optional()
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
0 && (module.exports = {
|
|
6
|
+
DEFAULT_MAX_POSTPONED_STATE_SIZE: null,
|
|
6
7
|
defaultConfig: null,
|
|
7
8
|
getNextConfigRuntime: null,
|
|
8
|
-
normalizeConfig: null
|
|
9
|
+
normalizeConfig: null,
|
|
10
|
+
parseMaxPostponedStateSize: null
|
|
9
11
|
});
|
|
10
12
|
function _export(target, all) {
|
|
11
13
|
for(var name in all)Object.defineProperty(target, name, {
|
|
@@ -14,6 +16,9 @@ function _export(target, all) {
|
|
|
14
16
|
});
|
|
15
17
|
}
|
|
16
18
|
_export(exports, {
|
|
19
|
+
DEFAULT_MAX_POSTPONED_STATE_SIZE: function() {
|
|
20
|
+
return _sizelimit.DEFAULT_MAX_POSTPONED_STATE_SIZE;
|
|
21
|
+
},
|
|
17
22
|
defaultConfig: function() {
|
|
18
23
|
return defaultConfig;
|
|
19
24
|
},
|
|
@@ -22,12 +27,16 @@ _export(exports, {
|
|
|
22
27
|
},
|
|
23
28
|
normalizeConfig: function() {
|
|
24
29
|
return normalizeConfig;
|
|
30
|
+
},
|
|
31
|
+
parseMaxPostponedStateSize: function() {
|
|
32
|
+
return _sizelimit.parseMaxPostponedStateSize;
|
|
25
33
|
}
|
|
26
34
|
});
|
|
27
35
|
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
28
36
|
const _imageconfig = require("../shared/lib/image-config");
|
|
29
37
|
const _constants = require("../lib/constants");
|
|
30
38
|
const _canaryonlyconfigerror = require("../shared/lib/errors/canary-only-config-error");
|
|
39
|
+
const _sizelimit = require("../shared/lib/size-limit");
|
|
31
40
|
function _interop_require_default(obj) {
|
|
32
41
|
return obj && obj.__esModule ? obj : {
|
|
33
42
|
default: obj
|
|
@@ -228,6 +237,10 @@ async function normalizeConfig(phase, config) {
|
|
|
228
237
|
return await config;
|
|
229
238
|
}
|
|
230
239
|
function getNextConfigRuntime(config) {
|
|
240
|
+
// This config filter is a breaking change, so only do it if experimental.runtimeServerDeploymentId is enabled
|
|
241
|
+
if (!config.experimental.runtimeServerDeploymentId) {
|
|
242
|
+
return config;
|
|
243
|
+
}
|
|
231
244
|
let ex = config.experimental;
|
|
232
245
|
let experimental = ex ? {
|
|
233
246
|
ppr: ex.ppr,
|
|
@@ -264,6 +277,7 @@ function getNextConfigRuntime(config) {
|
|
|
264
277
|
proxyTimeout: ex.proxyTimeout,
|
|
265
278
|
testProxy: ex.testProxy,
|
|
266
279
|
runtimeServerDeploymentId: ex.runtimeServerDeploymentId,
|
|
280
|
+
maxPostponedStateSize: ex.maxPostponedStateSize,
|
|
267
281
|
trustHostHeader: ex.trustHostHeader,
|
|
268
282
|
isExperimentalCompile: ex.isExperimentalCompile
|
|
269
283
|
} : {};
|
|
@@ -554,9 +554,15 @@ function warnCustomizedOption(config, key, defaultValue, customMessage, configFi
|
|
|
554
554
|
result.output = 'standalone';
|
|
555
555
|
}
|
|
556
556
|
if (typeof ((_result_experimental1 = result.experimental) == null ? void 0 : (_result_experimental_serverActions = _result_experimental1.serverActions) == null ? void 0 : _result_experimental_serverActions.bodySizeLimit) !== 'undefined') {
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
|
|
557
|
+
const bytes = require('next/dist/compiled/bytes');
|
|
558
|
+
const bodySizeLimit = result.experimental.serverActions.bodySizeLimit;
|
|
559
|
+
let value;
|
|
560
|
+
if (typeof bodySizeLimit === 'number') {
|
|
561
|
+
value = bodySizeLimit;
|
|
562
|
+
} else {
|
|
563
|
+
value = bytes.parse(bodySizeLimit);
|
|
564
|
+
}
|
|
565
|
+
if (value === null || isNaN(value) || value < 1) {
|
|
560
566
|
throw Object.defineProperty(new Error('Server Actions Size Limit must be a valid number or filesize format larger than 1MB: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit'), "__NEXT_ERROR_CODE", {
|
|
561
567
|
value: "E100",
|
|
562
568
|
enumerable: false,
|
package/packages/web/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js
CHANGED
|
@@ -153,7 +153,7 @@ async function createHotReloaderTurbopack(opts, serverFields, distDir, resetFetc
|
|
|
153
153
|
}
|
|
154
154
|
const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
|
|
155
155
|
const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
|
|
156
|
-
version: "16.1.
|
|
156
|
+
version: "16.1.6"
|
|
157
157
|
});
|
|
158
158
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
159
159
|
// of the current `next dev` invocation.
|
package/packages/web/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js
CHANGED
|
@@ -233,7 +233,7 @@ class HotReloaderWebpack {
|
|
|
233
233
|
this.previewProps = previewProps;
|
|
234
234
|
this.rewrites = rewrites;
|
|
235
235
|
this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
|
|
236
|
-
version: "16.1.
|
|
236
|
+
version: "16.1.6"
|
|
237
237
|
});
|
|
238
238
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
239
239
|
// of the current `next dev` invocation.
|
|
@@ -788,7 +788,7 @@ function isRedirect(statusCode) {
|
|
|
788
788
|
308
|
|
789
789
|
].includes(statusCode);
|
|
790
790
|
}
|
|
791
|
-
async function fetchExternalImage(href, dangerouslyAllowLocalIP, count = 3) {
|
|
791
|
+
async function fetchExternalImage(href, dangerouslyAllowLocalIP, maximumResponseBody, count = 3) {
|
|
792
792
|
if (!dangerouslyAllowLocalIP) {
|
|
793
793
|
const { hostname } = new URL(href);
|
|
794
794
|
let ips = [
|
|
@@ -843,7 +843,7 @@ async function fetchExternalImage(href, dangerouslyAllowLocalIP, count = 3) {
|
|
|
843
843
|
});
|
|
844
844
|
}
|
|
845
845
|
const redirect = new URL(locationHeader, href).href;
|
|
846
|
-
return fetchExternalImage(redirect, dangerouslyAllowLocalIP, count - 1);
|
|
846
|
+
return fetchExternalImage(redirect, dangerouslyAllowLocalIP, maximumResponseBody, count - 1);
|
|
847
847
|
}
|
|
848
848
|
if (!res.ok) {
|
|
849
849
|
_log.error('upstream image response failed for', href, res.status);
|
|
@@ -853,7 +853,30 @@ async function fetchExternalImage(href, dangerouslyAllowLocalIP, count = 3) {
|
|
|
853
853
|
configurable: true
|
|
854
854
|
});
|
|
855
855
|
}
|
|
856
|
-
|
|
856
|
+
if (!res.body) {
|
|
857
|
+
_log.error('upstream image response is empty for', href);
|
|
858
|
+
throw Object.defineProperty(new ImageError(400, '"url" parameter is valid but upstream response is invalid'), "__NEXT_ERROR_CODE", {
|
|
859
|
+
value: "E394",
|
|
860
|
+
enumerable: false,
|
|
861
|
+
configurable: true
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
const chunks = [];
|
|
865
|
+
let totalSize = 0;
|
|
866
|
+
for await (const c of res.body){
|
|
867
|
+
const chunk = Buffer.from(c);
|
|
868
|
+
totalSize += chunk.byteLength;
|
|
869
|
+
if (totalSize > maximumResponseBody) {
|
|
870
|
+
_log.error('upstream image response exceeded maximum size for', href, totalSize);
|
|
871
|
+
throw Object.defineProperty(new ImageError(413, '"url" parameter is valid but upstream response is invalid'), "__NEXT_ERROR_CODE", {
|
|
872
|
+
value: "E394",
|
|
873
|
+
enumerable: false,
|
|
874
|
+
configurable: true
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
chunks.push(chunk);
|
|
878
|
+
}
|
|
879
|
+
const buffer = Buffer.concat(chunks);
|
|
857
880
|
const contentType = res.headers.get('Content-Type');
|
|
858
881
|
const cacheControl = res.headers.get('Cache-Control');
|
|
859
882
|
const etag = extractEtag(res.headers.get('ETag'), buffer);
|
|
@@ -91,7 +91,7 @@ function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, logBu
|
|
|
91
91
|
if (parts.length > 0) {
|
|
92
92
|
versionSuffix = ` (${parts.join(', ')})`;
|
|
93
93
|
}
|
|
94
|
-
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"16.1.
|
|
94
|
+
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"16.1.6"}`))}${versionSuffix}`);
|
|
95
95
|
if (appUrl) {
|
|
96
96
|
_log.bootstrap(`- Local: ${appUrl}`);
|
|
97
97
|
}
|
|
@@ -30,11 +30,12 @@ class LRUNode {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
class LRUCache {
|
|
33
|
-
constructor(maxSize, calculateSize){
|
|
33
|
+
constructor(maxSize, calculateSize, onEvict){
|
|
34
34
|
this.cache = new Map();
|
|
35
35
|
this.totalSize = 0;
|
|
36
36
|
this.maxSize = maxSize;
|
|
37
37
|
this.calculateSize = calculateSize;
|
|
38
|
+
this.onEvict = onEvict;
|
|
38
39
|
// Create sentinel nodes to simplify doubly-linked list operations
|
|
39
40
|
// HEAD <-> TAIL (empty list)
|
|
40
41
|
this.head = new SentinelNode();
|
|
@@ -112,6 +113,7 @@ class LRUCache {
|
|
|
112
113
|
const tail = this.removeTail();
|
|
113
114
|
this.cache.delete(tail.key);
|
|
114
115
|
this.totalSize -= tail.size;
|
|
116
|
+
this.onEvict == null ? void 0 : this.onEvict.call(this, tail.key, tail.data);
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
/**
|
|
@@ -153,6 +155,10 @@ class LRUCache {
|
|
|
153
155
|
* Removes a specific key from the cache.
|
|
154
156
|
* Updates both the hash map and doubly-linked list.
|
|
155
157
|
*
|
|
158
|
+
* Note: This is an explicit removal and does NOT trigger the `onEvict`
|
|
159
|
+
* callback. Use this for intentional deletions where eviction tracking
|
|
160
|
+
* is not needed.
|
|
161
|
+
*
|
|
156
162
|
* Time Complexity: O(1)
|
|
157
163
|
*/ remove(key) {
|
|
158
164
|
const node = this.cache.get(key);
|
|
@@ -179,7 +179,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
|
|
|
179
179
|
async function startServer(serverOptions) {
|
|
180
180
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
|
181
181
|
let { port } = serverOptions;
|
|
182
|
-
process.title = `next-server (v${"16.1.
|
|
182
|
+
process.title = `next-server (v${"16.1.6"})`;
|
|
183
183
|
let handlersReady = ()=>{};
|
|
184
184
|
let handlersError = ()=>{};
|
|
185
185
|
let handlersPromise = new Promise((resolve, reject)=>{
|
|
@@ -814,7 +814,7 @@ class NextNodeServer extends _baseserver.default {
|
|
|
814
814
|
return;
|
|
815
815
|
};
|
|
816
816
|
const { isAbsolute, href } = paramsResult;
|
|
817
|
-
const imageUpstream = isAbsolute ? await fetchExternalImage(href, this.nextConfig.images.dangerouslyAllowLocalIP, this.nextConfig.images.maximumRedirects) : await fetchInternalImage(href, req.originalRequest, res.originalResponse, handleInternalReq);
|
|
817
|
+
const imageUpstream = isAbsolute ? await fetchExternalImage(href, this.nextConfig.images.dangerouslyAllowLocalIP, this.nextConfig.images.maximumResponseBody, this.nextConfig.images.maximumRedirects) : await fetchInternalImage(href, req.originalRequest, res.originalResponse, handleInternalReq);
|
|
818
818
|
return imageOptimizer(imageUpstream, paramsResult, this.nextConfig, {
|
|
819
819
|
isDev: this.renderOpts.dev,
|
|
820
820
|
previousCacheEntry
|
|
@@ -10,6 +10,8 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
0 && __export(require("./types"));
|
|
12
12
|
const _batcher = require("../../lib/batcher");
|
|
13
|
+
const _lrucache = require("../lib/lru-cache");
|
|
14
|
+
const _log = require("../../build/output/log");
|
|
13
15
|
const _scheduler = require("../../lib/scheduler");
|
|
14
16
|
const _utils = require("./utils");
|
|
15
17
|
_export_star(require("./types"), exports);
|
|
@@ -26,8 +28,53 @@ function _export_star(from, to) {
|
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Parses an environment variable as a positive integer, returning the fallback
|
|
33
|
+
* if the value is missing, not a number, or not positive.
|
|
34
|
+
*/ function parsePositiveInt(envValue, fallback) {
|
|
35
|
+
if (!envValue) return fallback;
|
|
36
|
+
const parsed = parseInt(envValue, 10);
|
|
37
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Default TTL (in milliseconds) for minimal mode response cache entries.
|
|
41
|
+
* Used for cache hit validation as a fallback for providers that don't
|
|
42
|
+
* send the x-invocation-id header yet.
|
|
43
|
+
*
|
|
44
|
+
* 10 seconds chosen because:
|
|
45
|
+
* - Long enough to dedupe rapid successive requests (e.g., page + data)
|
|
46
|
+
* - Short enough to not serve stale data across unrelated requests
|
|
47
|
+
*
|
|
48
|
+
* Can be configured via `NEXT_PRIVATE_RESPONSE_CACHE_TTL` environment variable.
|
|
49
|
+
*/ const DEFAULT_TTL_MS = parsePositiveInt(process.env.NEXT_PRIVATE_RESPONSE_CACHE_TTL, 10000);
|
|
50
|
+
/**
|
|
51
|
+
* Default maximum number of entries in the response cache.
|
|
52
|
+
* Can be configured via `NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE` environment variable.
|
|
53
|
+
*/ const DEFAULT_MAX_SIZE = parsePositiveInt(process.env.NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE, 150);
|
|
54
|
+
/**
|
|
55
|
+
* Separator used in compound cache keys to join pathname and invocationID.
|
|
56
|
+
* Using null byte (\0) since it cannot appear in valid URL paths or UUIDs.
|
|
57
|
+
*/ const KEY_SEPARATOR = '\0';
|
|
58
|
+
/**
|
|
59
|
+
* Sentinel value used for TTL-based cache entries (when invocationID is undefined).
|
|
60
|
+
* Chosen to be a clearly reserved marker for internal cache keys.
|
|
61
|
+
*/ const TTL_SENTINEL = '__ttl_sentinel__';
|
|
62
|
+
/**
|
|
63
|
+
* Creates a compound cache key from pathname and invocationID.
|
|
64
|
+
*/ function createCacheKey(pathname, invocationID) {
|
|
65
|
+
return `${pathname}${KEY_SEPARATOR}${invocationID ?? TTL_SENTINEL}`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Extracts the invocationID from a compound cache key.
|
|
69
|
+
* Returns undefined if the key used TTL_SENTINEL.
|
|
70
|
+
*/ function extractInvocationID(compoundKey) {
|
|
71
|
+
const separatorIndex = compoundKey.lastIndexOf(KEY_SEPARATOR);
|
|
72
|
+
if (separatorIndex === -1) return undefined;
|
|
73
|
+
const invocationID = compoundKey.slice(separatorIndex + 1);
|
|
74
|
+
return invocationID === TTL_SENTINEL ? undefined : invocationID;
|
|
75
|
+
}
|
|
29
76
|
class ResponseCache {
|
|
30
|
-
constructor(minimal_mode){
|
|
77
|
+
constructor(minimal_mode, maxSize = DEFAULT_MAX_SIZE, ttl = DEFAULT_TTL_MS){
|
|
31
78
|
this.getBatcher = _batcher.Batcher.create({
|
|
32
79
|
// Ensure on-demand revalidate doesn't block normal requests, it should be
|
|
33
80
|
// safe to run an on-demand revalidate for the same key as a normal request.
|
|
@@ -43,7 +90,33 @@ class ResponseCache {
|
|
|
43
90
|
// same promise until we've fully finished our work.
|
|
44
91
|
schedulerFn: _scheduler.scheduleOnNextTick
|
|
45
92
|
});
|
|
93
|
+
/**
|
|
94
|
+
* Set of invocation IDs that have had cache entries evicted.
|
|
95
|
+
* Used to detect when the cache size may be too small.
|
|
96
|
+
* Bounded to prevent memory growth.
|
|
97
|
+
*/ this.evictedInvocationIDs = new Set();
|
|
46
98
|
this.minimal_mode = minimal_mode;
|
|
99
|
+
this.maxSize = maxSize;
|
|
100
|
+
this.ttl = ttl;
|
|
101
|
+
// Create the LRU cache with eviction tracking
|
|
102
|
+
this.cache = new _lrucache.LRUCache(maxSize, undefined, (compoundKey)=>{
|
|
103
|
+
const invocationID = extractInvocationID(compoundKey);
|
|
104
|
+
if (invocationID) {
|
|
105
|
+
// Bound to 100 entries to prevent unbounded memory growth.
|
|
106
|
+
// FIFO eviction is acceptable here because:
|
|
107
|
+
// 1. Invocations are short-lived (single request lifecycle), so older
|
|
108
|
+
// invocations are unlikely to still be active after 100 newer ones
|
|
109
|
+
// 2. This warning mechanism is best-effort for developer guidance—
|
|
110
|
+
// missing occasional eviction warnings doesn't affect correctness
|
|
111
|
+
// 3. If a long-running invocation is somehow evicted and then has
|
|
112
|
+
// another cache entry evicted, it will simply be re-added
|
|
113
|
+
if (this.evictedInvocationIDs.size >= 100) {
|
|
114
|
+
const first = this.evictedInvocationIDs.values().next().value;
|
|
115
|
+
if (first) this.evictedInvocationIDs.delete(first);
|
|
116
|
+
}
|
|
117
|
+
this.evictedInvocationIDs.add(invocationID);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
47
120
|
}
|
|
48
121
|
/**
|
|
49
122
|
* Gets the response cache entry for the given key.
|
|
@@ -53,7 +126,6 @@ class ResponseCache {
|
|
|
53
126
|
* @param context - The context for the get request.
|
|
54
127
|
* @returns The response cache entry.
|
|
55
128
|
*/ async get(key, responseGenerator, context) {
|
|
56
|
-
var _this_previousCacheItem;
|
|
57
129
|
// If there is no key for the cache, we can't possibly look this up in the
|
|
58
130
|
// cache so just return the result of the response generator.
|
|
59
131
|
if (!key) {
|
|
@@ -62,11 +134,30 @@ class ResponseCache {
|
|
|
62
134
|
previousCacheEntry: null
|
|
63
135
|
});
|
|
64
136
|
}
|
|
65
|
-
// Check minimal mode cache before doing any other work
|
|
66
|
-
if (this.minimal_mode
|
|
67
|
-
|
|
137
|
+
// Check minimal mode cache before doing any other work.
|
|
138
|
+
if (this.minimal_mode) {
|
|
139
|
+
const cacheKey = createCacheKey(key, context.invocationID);
|
|
140
|
+
const cachedItem = this.cache.get(cacheKey);
|
|
141
|
+
if (cachedItem) {
|
|
142
|
+
// With invocationID: exact match found - always a hit
|
|
143
|
+
// With TTL mode: must check expiration
|
|
144
|
+
if (context.invocationID !== undefined) {
|
|
145
|
+
return (0, _utils.toResponseCacheEntry)(cachedItem.entry);
|
|
146
|
+
}
|
|
147
|
+
// TTL mode: check expiration
|
|
148
|
+
const now = Date.now();
|
|
149
|
+
if (cachedItem.expiresAt > now) {
|
|
150
|
+
return (0, _utils.toResponseCacheEntry)(cachedItem.entry);
|
|
151
|
+
}
|
|
152
|
+
// TTL expired - clean up
|
|
153
|
+
this.cache.remove(cacheKey);
|
|
154
|
+
}
|
|
155
|
+
// Warn if this invocation had entries evicted - indicates cache may be too small.
|
|
156
|
+
if (context.invocationID && this.evictedInvocationIDs.has(context.invocationID)) {
|
|
157
|
+
(0, _log.warnOnce)(`Response cache entry was evicted for invocation ${context.invocationID}. ` + `Consider increasing NEXT_PRIVATE_RESPONSE_CACHE_MAX_SIZE (current: ${this.maxSize}).`);
|
|
158
|
+
}
|
|
68
159
|
}
|
|
69
|
-
const { incrementalCache, isOnDemandRevalidate = false, isFallback = false, isRoutePPREnabled = false, isPrefetch = false, waitUntil, routeKind } = context;
|
|
160
|
+
const { incrementalCache, isOnDemandRevalidate = false, isFallback = false, isRoutePPREnabled = false, isPrefetch = false, waitUntil, routeKind, invocationID } = context;
|
|
70
161
|
const response = await this.getBatcher.batch({
|
|
71
162
|
key,
|
|
72
163
|
isOnDemandRevalidate
|
|
@@ -77,7 +168,8 @@ class ResponseCache {
|
|
|
77
168
|
isFallback,
|
|
78
169
|
isRoutePPREnabled,
|
|
79
170
|
isPrefetch,
|
|
80
|
-
routeKind
|
|
171
|
+
routeKind,
|
|
172
|
+
invocationID
|
|
81
173
|
}, resolve);
|
|
82
174
|
// We need to ensure background revalidates are passed to waitUntil.
|
|
83
175
|
if (waitUntil) waitUntil(promise);
|
|
@@ -112,11 +204,14 @@ class ResponseCache {
|
|
|
112
204
|
}
|
|
113
205
|
}
|
|
114
206
|
// Revalidate the cache entry
|
|
115
|
-
const incrementalResponseCacheEntry = await this.revalidate(key, context.incrementalCache, context.isRoutePPREnabled, context.isFallback, responseGenerator, previousIncrementalCacheEntry, previousIncrementalCacheEntry !== null && !context.isOnDemandRevalidate);
|
|
207
|
+
const incrementalResponseCacheEntry = await this.revalidate(key, context.incrementalCache, context.isRoutePPREnabled, context.isFallback, responseGenerator, previousIncrementalCacheEntry, previousIncrementalCacheEntry !== null && !context.isOnDemandRevalidate, undefined, context.invocationID);
|
|
116
208
|
// Handle null response
|
|
117
209
|
if (!incrementalResponseCacheEntry) {
|
|
118
|
-
//
|
|
119
|
-
if (this.minimal_mode)
|
|
210
|
+
// Remove the cache item if it was set so we don't use it again.
|
|
211
|
+
if (this.minimal_mode) {
|
|
212
|
+
const cacheKey = createCacheKey(key, context.invocationID);
|
|
213
|
+
this.cache.remove(cacheKey);
|
|
214
|
+
}
|
|
120
215
|
return null;
|
|
121
216
|
}
|
|
122
217
|
// Resolve for on-demand revalidation or if not already resolved
|
|
@@ -144,16 +239,18 @@ class ResponseCache {
|
|
|
144
239
|
* @param responseGenerator - The response generator to use to generate the response cache entry.
|
|
145
240
|
* @param previousIncrementalCacheEntry - The previous cache entry to use to revalidate the cache entry.
|
|
146
241
|
* @param hasResolved - Whether the response has been resolved.
|
|
242
|
+
* @param waitUntil - Optional function to register background work.
|
|
243
|
+
* @param invocationID - The invocation ID for cache key scoping.
|
|
147
244
|
* @returns The revalidated cache entry.
|
|
148
|
-
*/ async revalidate(key, incrementalCache, isRoutePPREnabled, isFallback, responseGenerator, previousIncrementalCacheEntry, hasResolved, waitUntil) {
|
|
245
|
+
*/ async revalidate(key, incrementalCache, isRoutePPREnabled, isFallback, responseGenerator, previousIncrementalCacheEntry, hasResolved, waitUntil, invocationID) {
|
|
149
246
|
return this.revalidateBatcher.batch(key, ()=>{
|
|
150
|
-
const promise = this.handleRevalidate(key, incrementalCache, isRoutePPREnabled, isFallback, responseGenerator, previousIncrementalCacheEntry, hasResolved);
|
|
247
|
+
const promise = this.handleRevalidate(key, incrementalCache, isRoutePPREnabled, isFallback, responseGenerator, previousIncrementalCacheEntry, hasResolved, invocationID);
|
|
151
248
|
// We need to ensure background revalidates are passed to waitUntil.
|
|
152
249
|
if (waitUntil) waitUntil(promise);
|
|
153
250
|
return promise;
|
|
154
251
|
});
|
|
155
252
|
}
|
|
156
|
-
async handleRevalidate(key, incrementalCache, isRoutePPREnabled, isFallback, responseGenerator, previousIncrementalCacheEntry, hasResolved) {
|
|
253
|
+
async handleRevalidate(key, incrementalCache, isRoutePPREnabled, isFallback, responseGenerator, previousIncrementalCacheEntry, hasResolved, invocationID) {
|
|
157
254
|
try {
|
|
158
255
|
// Generate the response cache entry using the response generator.
|
|
159
256
|
const responseCacheEntry = await responseGenerator({
|
|
@@ -173,11 +270,14 @@ class ResponseCache {
|
|
|
173
270
|
// defined.
|
|
174
271
|
if (incrementalResponseCacheEntry.cacheControl) {
|
|
175
272
|
if (this.minimal_mode) {
|
|
176
|
-
|
|
177
|
-
|
|
273
|
+
// Set TTL expiration for cache hit validation. Entries are validated
|
|
274
|
+
// by invocationID when available, with TTL as a fallback for providers
|
|
275
|
+
// that don't send x-invocation-id. Memory is managed by LRU eviction.
|
|
276
|
+
const cacheKey = createCacheKey(key, invocationID);
|
|
277
|
+
this.cache.set(cacheKey, {
|
|
178
278
|
entry: incrementalResponseCacheEntry,
|
|
179
|
-
expiresAt: Date.now() +
|
|
180
|
-
};
|
|
279
|
+
expiresAt: Date.now() + this.ttl
|
|
280
|
+
});
|
|
181
281
|
} else {
|
|
182
282
|
await incrementalCache.set(key, incrementalResponseCacheEntry.value, {
|
|
183
283
|
cacheControl: incrementalResponseCacheEntry.cacheControl,
|
|
@@ -58,7 +58,7 @@ function createPrerenderResumeDataCache() {
|
|
|
58
58
|
decryptedBoundArgs: new Map()
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
function createRenderResumeDataCache(resumeDataCacheOrPersistedCache) {
|
|
61
|
+
function createRenderResumeDataCache(resumeDataCacheOrPersistedCache, maxPostponedStateSizeBytes) {
|
|
62
62
|
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
63
63
|
throw Object.defineProperty(new _invarianterror.InvariantError('`createRenderResumeDataCache` should not be called in edge runtime.'), "__NEXT_ERROR_CODE", {
|
|
64
64
|
value: "E556",
|
|
@@ -83,7 +83,26 @@ function createRenderResumeDataCache(resumeDataCacheOrPersistedCache) {
|
|
|
83
83
|
// As the data we already want to decompress is in memory, we use the
|
|
84
84
|
// synchronous inflateSync function.
|
|
85
85
|
const { inflateSync } = require('node:zlib');
|
|
86
|
-
|
|
86
|
+
// Limit decompressed size to prevent zipbomb attacks. This is 5x the
|
|
87
|
+
// configured maxPostponedStateSize, allowing reasonable compression
|
|
88
|
+
// ratios while preventing extreme decompression bombs.
|
|
89
|
+
// Default is 500MB (5x the default 100MB compressed limit).
|
|
90
|
+
const maxDecompressedSize = maxPostponedStateSizeBytes ? maxPostponedStateSizeBytes * 5 : 500 * 1024 * 1024;
|
|
91
|
+
let json;
|
|
92
|
+
try {
|
|
93
|
+
json = JSON.parse(inflateSync(Buffer.from(resumeDataCacheOrPersistedCache, 'base64'), {
|
|
94
|
+
maxOutputLength: maxDecompressedSize
|
|
95
|
+
}).toString('utf-8'));
|
|
96
|
+
} catch (err) {
|
|
97
|
+
if (err instanceof RangeError && err.code === 'ERR_BUFFER_TOO_LARGE') {
|
|
98
|
+
throw Object.defineProperty(new Error(`Decompressed resume data cache exceeded ${maxDecompressedSize} byte limit`), "__NEXT_ERROR_CODE", {
|
|
99
|
+
value: "E976",
|
|
100
|
+
enumerable: false,
|
|
101
|
+
configurable: true
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
throw err;
|
|
105
|
+
}
|
|
87
106
|
return {
|
|
88
107
|
cache: (0, _cachestore.parseUseCacheCacheStore)(Object.entries(json.store.cache)),
|
|
89
108
|
fetch: new Map(Object.entries(json.store.fetch)),
|
package/packages/web/.next/standalone/node_modules/next/dist/server/route-modules/route-module.js
CHANGED
|
@@ -569,6 +569,9 @@ class RouteModule {
|
|
|
569
569
|
isRoutePPREnabled,
|
|
570
570
|
isOnDemandRevalidate,
|
|
571
571
|
isPrefetch: req.headers.purpose === 'prefetch',
|
|
572
|
+
// Use x-invocation-id header to scope the in-memory cache to a single
|
|
573
|
+
// revalidation request in minimal mode.
|
|
574
|
+
invocationID: req.headers['x-invocation-id'],
|
|
572
575
|
incrementalCache: await this.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode),
|
|
573
576
|
waitUntil
|
|
574
577
|
});
|
|
@@ -353,7 +353,7 @@ async function adapter(params) {
|
|
|
353
353
|
if (!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) {
|
|
354
354
|
if (redirectURL.host === requestURL.host) {
|
|
355
355
|
redirectURL.buildId = buildId || redirectURL.buildId;
|
|
356
|
-
response.headers.set('Location',
|
|
356
|
+
response.headers.set('Location', (0, _relativizeurl.getRelativeURL)(redirectURL, requestURL));
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
@@ -21,7 +21,7 @@ _export(exports, {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
function isStableBuild() {
|
|
24
|
-
return !"16.1.
|
|
24
|
+
return !"16.1.6"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
|
25
25
|
}
|
|
26
26
|
class CanaryOnlyConfigError extends Error {
|
|
27
27
|
constructor(arg){
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
DEFAULT_MAX_POSTPONED_STATE_SIZE: null,
|
|
7
|
+
parseMaxPostponedStateSize: null
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
DEFAULT_MAX_POSTPONED_STATE_SIZE: function() {
|
|
17
|
+
return DEFAULT_MAX_POSTPONED_STATE_SIZE;
|
|
18
|
+
},
|
|
19
|
+
parseMaxPostponedStateSize: function() {
|
|
20
|
+
return parseMaxPostponedStateSize;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const DEFAULT_MAX_POSTPONED_STATE_SIZE = '100 MB';
|
|
24
|
+
function parseSizeLimit(size) {
|
|
25
|
+
const bytes = require('next/dist/compiled/bytes').parse(size);
|
|
26
|
+
if (bytes === null || isNaN(bytes) || bytes < 1) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return bytes;
|
|
30
|
+
}
|
|
31
|
+
function parseMaxPostponedStateSize(size) {
|
|
32
|
+
return parseSizeLimit(size ?? DEFAULT_MAX_POSTPONED_STATE_SIZE);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=size-limit.js.map
|