@vercel/next 4.21.1 → 4.21.3
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/adapter/index.js +12 -4
- package/dist/adapter/node-handler.js +14 -4
- package/dist/index.js +14 -2
- package/dist/server-launcher.js +3 -0
- package/package.json +11 -13
package/dist/adapter/index.js
CHANGED
|
@@ -10308,6 +10308,10 @@ async function getSourceFilePathFromPage({
|
|
|
10308
10308
|
}
|
|
10309
10309
|
|
|
10310
10310
|
// src/routing.ts
|
|
10311
|
+
var API_PATH_PREFIX_PATTERN = "api(?:/.*|$)";
|
|
10312
|
+
function getI18nPathPrefixExclusion(locales) {
|
|
10313
|
+
return `(?!(?:_next/.*|api|${locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))`;
|
|
10314
|
+
}
|
|
10311
10315
|
function modifyWithRewriteHeaders(rewrites, {
|
|
10312
10316
|
isAfterFilesRewrite = false,
|
|
10313
10317
|
shouldHandleSegmentPrefetches
|
|
@@ -10624,6 +10628,9 @@ var myAdapter = {
|
|
|
10624
10628
|
if (process.env.VERCEL_HASH_SALT != null) {
|
|
10625
10629
|
config.experimental.outputHashSalt = (config.experimental.outputHashSalt ?? "") + process.env.VERCEL_HASH_SALT;
|
|
10626
10630
|
}
|
|
10631
|
+
if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD && process.env.VERCEL_SKEW_PROTECTION_ENABLED === "1" && process.env.VERCEL_DEPLOYMENT_ID && !process.env.NEXT_DEPLOYMENT_ID && config.deploymentId == null) {
|
|
10632
|
+
config.deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
10633
|
+
}
|
|
10627
10634
|
if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD && process.env.VERCEL_PREVIEW_COMMENTS_ENABLED === "1" && // Only available in newer Next.js versions
|
|
10628
10635
|
typeof ctx.projectDir !== "undefined") {
|
|
10629
10636
|
const dir = import_node_path2.default.join(ctx.projectDir, ".vercel/");
|
|
@@ -10664,6 +10671,7 @@ var myAdapter = {
|
|
|
10664
10671
|
const hasPagesDir = outputs.pages.length > 0 || outputs.pagesApi.length > 0;
|
|
10665
10672
|
const shouldHandleMiddlewareDataResolving = routing.shouldNormalizeNextData;
|
|
10666
10673
|
const i18nConfig = config.i18n;
|
|
10674
|
+
const i18nPathPrefixExclusion = i18nConfig ? getI18nPathPrefixExclusion(i18nConfig.locales) : "";
|
|
10667
10675
|
const vercelConfig2 = {
|
|
10668
10676
|
version: 3,
|
|
10669
10677
|
overrides: {},
|
|
@@ -10862,7 +10870,7 @@ var myAdapter = {
|
|
|
10862
10870
|
"/",
|
|
10863
10871
|
config.basePath,
|
|
10864
10872
|
"/"
|
|
10865
|
-
)}
|
|
10873
|
+
)}${i18nPathPrefixExclusion}(.*)$`,
|
|
10866
10874
|
// we aren't able to ensure trailing slash mode here
|
|
10867
10875
|
// so ensure this comes after the trailing slash redirect
|
|
10868
10876
|
dest: `${config.basePath && config.basePath !== "/" ? import_node_path2.default.posix.join("/", config.basePath) : ""}$wildcard/$1`,
|
|
@@ -10936,7 +10944,7 @@ var myAdapter = {
|
|
|
10936
10944
|
"/",
|
|
10937
10945
|
config.basePath,
|
|
10938
10946
|
"/"
|
|
10939
|
-
)}
|
|
10947
|
+
)}${i18nPathPrefixExclusion}(.*)$`,
|
|
10940
10948
|
dest: `${import_node_path2.default.posix.join(
|
|
10941
10949
|
"/",
|
|
10942
10950
|
config.basePath,
|
|
@@ -11201,7 +11209,7 @@ var myAdapter = {
|
|
|
11201
11209
|
"/",
|
|
11202
11210
|
config.basePath,
|
|
11203
11211
|
"/"
|
|
11204
|
-
)}
|
|
11212
|
+
)}${i18nPathPrefixExclusion}(.*)$`,
|
|
11205
11213
|
dest: `${import_node_path2.default.posix.join(
|
|
11206
11214
|
"/",
|
|
11207
11215
|
config.basePath,
|
|
@@ -11223,7 +11231,7 @@ var myAdapter = {
|
|
|
11223
11231
|
src: `^${import_node_path2.default.posix.join(
|
|
11224
11232
|
"/",
|
|
11225
11233
|
config.basePath
|
|
11226
|
-
)}/?(?:${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})/(.*)`,
|
|
11234
|
+
)}/?(?:${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})/(?!${API_PATH_PREFIX_PATTERN})(.*)`,
|
|
11227
11235
|
dest: `${import_node_path2.default.posix.join("/", config.basePath, "/")}$1`,
|
|
11228
11236
|
check: true
|
|
11229
11237
|
}
|
|
@@ -33,7 +33,17 @@ const getHandlerSource = (ctx) => `
|
|
|
33
33
|
);
|
|
34
34
|
loadEnvConfig('.', process.env.NODE_ENV === 'development');
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
// Default NEXT_DEPLOYMENT_ID for Skew Protection when the platform did not
|
|
38
|
+
// inject it (e.g. services deployments).
|
|
39
|
+
if (
|
|
40
|
+
process.env.VERCEL_SKEW_PROTECTION_ENABLED === '1' &&
|
|
41
|
+
process.env.VERCEL_DEPLOYMENT_ID &&
|
|
42
|
+
!process.env.NEXT_DEPLOYMENT_ID
|
|
43
|
+
) {
|
|
44
|
+
process.env.NEXT_DEPLOYMENT_ID = process.env.VERCEL_DEPLOYMENT_ID;
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
const _n_handler = (${ctx.isMiddleware ? () => {
|
|
38
48
|
const path = require("path");
|
|
39
49
|
const relativeDistDir = process.env.__PRIVATE_RELATIVE_DIST_DIR;
|
|
@@ -276,15 +286,15 @@ const getHandlerSource = (ctx) => `
|
|
|
276
286
|
}
|
|
277
287
|
};
|
|
278
288
|
}).toString()})()
|
|
279
|
-
|
|
289
|
+
|
|
280
290
|
module.exports = _n_handler
|
|
281
|
-
|
|
291
|
+
|
|
282
292
|
${ctx.isMiddleware ? "" : `
|
|
283
293
|
module.exports.getRequestHandlerWithMetadata = (metadata) => {
|
|
284
294
|
return (req, res) => _n_handler(req, res, metadata)
|
|
285
295
|
}
|
|
286
296
|
`}
|
|
287
|
-
|
|
297
|
+
|
|
288
298
|
`.replaceAll(
|
|
289
299
|
"process.env.__PRIVATE_RELATIVE_DIST_DIR",
|
|
290
300
|
`"${ctx.projectRelativeDistDir}"`
|
package/dist/index.js
CHANGED
|
@@ -11340,6 +11340,12 @@ function isLargeFunctionsEnabled() {
|
|
|
11340
11340
|
function getGroupMaxUncompressedLambdaSize(runtime, isLargeFunctions) {
|
|
11341
11341
|
return isLargeFunctions ? DEFAULT_MAX_UNCOMPRESSED_LARGE_LAMBDA_SIZE : getMaxUncompressedLambdaSize(runtime);
|
|
11342
11342
|
}
|
|
11343
|
+
function getDefaultNextDeploymentId(env) {
|
|
11344
|
+
if (env.VERCEL_SKEW_PROTECTION_ENABLED === "1" && env.VERCEL_DEPLOYMENT_ID && !env.NEXT_DEPLOYMENT_ID) {
|
|
11345
|
+
return env.VERCEL_DEPLOYMENT_ID;
|
|
11346
|
+
}
|
|
11347
|
+
return void 0;
|
|
11348
|
+
}
|
|
11343
11349
|
var skipDefaultLocaleRewrite = Boolean(
|
|
11344
11350
|
process.env.NEXT_EXPERIMENTAL_DEFER_DEFAULT_LOCALE_REWRITE
|
|
11345
11351
|
);
|
|
@@ -16960,12 +16966,18 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
16960
16966
|
if (isServerMode) {
|
|
16961
16967
|
env.NODE_ENV = "production";
|
|
16962
16968
|
}
|
|
16963
|
-
|
|
16969
|
+
const isAdapterEnabled = (
|
|
16964
16970
|
// integration tests expect outputs object
|
|
16965
16971
|
!process.env.NEXT_BUILDER_INTEGRATION && process.env.NEXT_ENABLE_ADAPTER === "1" && import_semver5.default.gte(nextVersion, MINIMUM_NEXT_ADAPTER_VERSION)
|
|
16966
|
-
)
|
|
16972
|
+
);
|
|
16973
|
+
if (isAdapterEnabled) {
|
|
16967
16974
|
env.NEXT_ADAPTER_PATH = import_path6.default.join(__dirname, "adapter/index.js");
|
|
16968
16975
|
env.NEXT_ADAPTER_VERCEL_CONFIG = JSON.stringify(config);
|
|
16976
|
+
} else {
|
|
16977
|
+
const defaultNextDeploymentId = getDefaultNextDeploymentId(env);
|
|
16978
|
+
if (defaultNextDeploymentId) {
|
|
16979
|
+
env.NEXT_DEPLOYMENT_ID = defaultNextDeploymentId;
|
|
16980
|
+
}
|
|
16969
16981
|
}
|
|
16970
16982
|
const shouldRunCompileStep = Boolean(buildCommand) || Boolean(buildScriptName);
|
|
16971
16983
|
builderSpan.setAttributes({
|
package/dist/server-launcher.js
CHANGED
|
@@ -42,6 +42,9 @@ if (process.env.NODE_ENV !== "production" && region !== "dev1") {
|
|
|
42
42
|
);
|
|
43
43
|
process.env.NODE_ENV = "production";
|
|
44
44
|
}
|
|
45
|
+
if (process.env.VERCEL_SKEW_PROTECTION_ENABLED === "1" && process.env.VERCEL_DEPLOYMENT_ID && !process.env.NEXT_DEPLOYMENT_ID) {
|
|
46
|
+
process.env.NEXT_DEPLOYMENT_ID = process.env.VERCEL_DEPLOYMENT_ID;
|
|
47
|
+
}
|
|
45
48
|
// @preserve pre-next-server-target
|
|
46
49
|
var NextServer = require("__NEXT_SERVER_PATH__").default;
|
|
47
50
|
// @preserve next-server-preload-target
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.21.
|
|
3
|
+
"version": "4.21.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@vercel/nft": "1.10.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@next-community/adapter-vercel": "0.0.1-beta.
|
|
19
|
+
"@next-community/adapter-vercel": "0.0.1-beta.25",
|
|
20
20
|
"@types/aws-lambda": "8.10.19",
|
|
21
21
|
"@types/buffer-crc32": "0.2.0",
|
|
22
22
|
"@types/bytes": "3.1.1",
|
|
@@ -51,22 +51,20 @@
|
|
|
51
51
|
"source-map": "0.7.4",
|
|
52
52
|
"test-listen": "1.1.0",
|
|
53
53
|
"text-table": "0.2.0",
|
|
54
|
-
"
|
|
54
|
+
"vite": "6.4.3",
|
|
55
|
+
"vitest": "4.1.10",
|
|
55
56
|
"webpack-sources": "3.2.3",
|
|
56
|
-
"@vercel/build-utils": "14.0.
|
|
57
|
+
"@vercel/build-utils": "14.0.4",
|
|
57
58
|
"@vercel/routing-utils": "6.4.1"
|
|
58
59
|
},
|
|
59
60
|
"scripts": {
|
|
60
61
|
"build": "node build.mjs",
|
|
61
62
|
"test": "vitest run --config ../../vitest.config.mts",
|
|
62
|
-
"test-unit": "
|
|
63
|
-
"test-next-local": "
|
|
64
|
-
"test-next-local-legacy": "
|
|
65
|
-
"test-next-local:middleware": "
|
|
66
|
-
"test-e2e": "rm -f test/builder-info.json;
|
|
67
|
-
"type-check": "tsc --noEmit"
|
|
68
|
-
"vitest-run": "vitest -c ../../vitest.config.mts",
|
|
69
|
-
"vitest-unit": "glob --absolute 'test/unit/'",
|
|
70
|
-
"vitest-e2e": "glob --absolute 'test/fixtures/**/*.test.js'"
|
|
63
|
+
"test-unit": "vitest run --config ../../vitest.config.mts test/unit/",
|
|
64
|
+
"test-next-local": "vitest run --config ../../vitest.config.mts test/integration/*.test.js test/integration/*.test.ts",
|
|
65
|
+
"test-next-local-legacy": "vitest run --config ../../vitest.config.mts test/integration/legacy/*.test.js",
|
|
66
|
+
"test-next-local:middleware": "vitest run --config ../../vitest.config.mts test/integration/middleware.test.ts",
|
|
67
|
+
"test-e2e": "rm -f test/builder-info.json; vitest run --config ../../vitest.config.mts test/fixtures/ --exclude test/fixtures/00-bun-runtime/index.test.ts",
|
|
68
|
+
"type-check": "tsc --noEmit"
|
|
71
69
|
}
|
|
72
70
|
}
|