@vercel/next 4.20.2 → 4.20.4
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 +21 -27
- package/dist/adapter/node-handler.js +3 -5
- package/dist/index.js +21 -3
- package/package.json +3 -3
package/dist/adapter/index.js
CHANGED
|
@@ -9665,7 +9665,7 @@ async function handleStaticOutputs(outputs, {
|
|
|
9665
9665
|
const srcExtension = import_node_path.default.extname(output.filePath);
|
|
9666
9666
|
const isHtml = srcExtension === ".html";
|
|
9667
9667
|
if (isHtml) {
|
|
9668
|
-
vercelConfig2.overrides[import_node_path.default.posix.join("./", output.pathname
|
|
9668
|
+
vercelConfig2.overrides[import_node_path.default.posix.join("./", `${output.pathname}.html`)] = {
|
|
9669
9669
|
contentType: "text/html; charset=utf-8",
|
|
9670
9670
|
path: import_node_path.default.posix.join("./", output.pathname)
|
|
9671
9671
|
};
|
|
@@ -9856,6 +9856,7 @@ async function handleNodeOutputs(nodeOutputs, {
|
|
|
9856
9856
|
nextEnvLoaderPath
|
|
9857
9857
|
);
|
|
9858
9858
|
}
|
|
9859
|
+
const usesSrcDir = await usesSrcDirectory(projectDir);
|
|
9859
9860
|
await Promise.all(
|
|
9860
9861
|
nodeOutputs.map(async (output) => {
|
|
9861
9862
|
await fsSema.acquire();
|
|
@@ -9914,11 +9915,12 @@ async function handleNodeOutputs(nodeOutputs, {
|
|
|
9914
9915
|
if (filesHashes) {
|
|
9915
9916
|
filesHashes["___next_launcher.cjs"] = sha256(handlerSource);
|
|
9916
9917
|
}
|
|
9917
|
-
const operationType = output.type === import_constants.AdapterOutputType.APP_PAGE || import_constants.AdapterOutputType.PAGES ? "PAGE" : "API";
|
|
9918
|
+
const operationType = output.type === import_constants.AdapterOutputType.APP_PAGE || output.type === import_constants.AdapterOutputType.PAGES ? "PAGE" : "API";
|
|
9918
9919
|
const sourceFile = await getSourceFilePathFromPage({
|
|
9919
9920
|
workPath: projectDir,
|
|
9920
9921
|
page: output.sourcePage,
|
|
9921
|
-
pageExtensions: config.pageExtensions || []
|
|
9922
|
+
pageExtensions: config.pageExtensions || [],
|
|
9923
|
+
usesSrcDir
|
|
9922
9924
|
});
|
|
9923
9925
|
const vercelConfigOpts = await (0, import_build_utils.getLambdaOptionsFromFunction)({
|
|
9924
9926
|
sourceFile,
|
|
@@ -10229,39 +10231,29 @@ async function handleMiddleware(output, ctx) {
|
|
|
10229
10231
|
}
|
|
10230
10232
|
return routes;
|
|
10231
10233
|
}
|
|
10232
|
-
var _usesSrcCache;
|
|
10233
10234
|
async function usesSrcDirectory(workPath) {
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
_usesSrcCache = true;
|
|
10239
|
-
}
|
|
10240
|
-
} catch (_err) {
|
|
10241
|
-
_usesSrcCache = false;
|
|
10242
|
-
}
|
|
10243
|
-
}
|
|
10244
|
-
if (!_usesSrcCache) {
|
|
10245
|
-
const sourceAppdir = import_node_path.default.join(workPath, "src", "app");
|
|
10235
|
+
for (const dir of [
|
|
10236
|
+
import_node_path.default.join(workPath, "src", "pages"),
|
|
10237
|
+
import_node_path.default.join(workPath, "src", "app")
|
|
10238
|
+
]) {
|
|
10246
10239
|
try {
|
|
10247
|
-
if ((await import_promises.default.stat(
|
|
10248
|
-
|
|
10240
|
+
if ((await import_promises.default.stat(dir)).isDirectory()) {
|
|
10241
|
+
return true;
|
|
10249
10242
|
}
|
|
10250
10243
|
} catch (_err) {
|
|
10251
|
-
_usesSrcCache = false;
|
|
10252
10244
|
}
|
|
10253
10245
|
}
|
|
10254
|
-
return
|
|
10246
|
+
return false;
|
|
10255
10247
|
}
|
|
10256
10248
|
function isDirectory(path3) {
|
|
10257
|
-
return import_fs_extra3.default.
|
|
10249
|
+
return import_fs_extra3.default.lstatSync(path3, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
10258
10250
|
}
|
|
10259
10251
|
async function getSourceFilePathFromPage({
|
|
10260
10252
|
workPath,
|
|
10261
10253
|
page,
|
|
10262
|
-
pageExtensions
|
|
10254
|
+
pageExtensions,
|
|
10255
|
+
usesSrcDir
|
|
10263
10256
|
}) {
|
|
10264
|
-
const usesSrcDir = await usesSrcDirectory(workPath);
|
|
10265
10257
|
const extensionsToTry = pageExtensions || ["js", "jsx", "ts", "tsx"];
|
|
10266
10258
|
for (const pageType of [
|
|
10267
10259
|
// middleware is not nested in pages/app
|
|
@@ -10376,10 +10368,10 @@ function modifyWithRewriteHeaders(rewrites, {
|
|
|
10376
10368
|
rewrite.headers = {
|
|
10377
10369
|
...rewrite.headers,
|
|
10378
10370
|
...pathname ? {
|
|
10379
|
-
|
|
10371
|
+
"x-nextjs-rewritten-path": pathname
|
|
10380
10372
|
} : {},
|
|
10381
10373
|
...query ? {
|
|
10382
|
-
|
|
10374
|
+
"x-nextjs-rewritten-query": query
|
|
10383
10375
|
} : {}
|
|
10384
10376
|
};
|
|
10385
10377
|
}
|
|
@@ -10624,8 +10616,10 @@ if(${cookieCheck}){
|
|
|
10624
10616
|
var myAdapter = {
|
|
10625
10617
|
name: "Vercel",
|
|
10626
10618
|
async modifyConfig(config, ctx) {
|
|
10627
|
-
if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD
|
|
10628
|
-
config.experimental.supportsImmutableAssets = true
|
|
10619
|
+
if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD) {
|
|
10620
|
+
config.experimental.supportsImmutableAssets = // Default to true, allow users to opt-out
|
|
10621
|
+
(config.experimental.supportsImmutableAssets ?? true) && // AND with infra support to allow disabling via feature flag if necessary.
|
|
10622
|
+
process.env.VERCEL_IMMUTABLE_STATIC_FILES_ENABLED === "1";
|
|
10629
10623
|
}
|
|
10630
10624
|
if (process.env.VERCEL_HASH_SALT != null) {
|
|
10631
10625
|
config.experimental.outputHashSalt = (config.experimental.outputHashSalt ?? "") + process.env.VERCEL_HASH_SALT;
|
|
@@ -43,7 +43,7 @@ const getHandlerSource = (ctx) => `
|
|
|
43
43
|
return fromSymbol[SYMBOL_FOR_REQ_CONTEXT]?.get?.() ?? {};
|
|
44
44
|
}
|
|
45
45
|
return async function handler(request) {
|
|
46
|
-
let middlewareHandler = await require(
|
|
46
|
+
let middlewareHandler = await require(`./${path.posix.join(relativeDistDir, "server", "middleware.js")}`);
|
|
47
47
|
middlewareHandler = middlewareHandler.handler || middlewareHandler;
|
|
48
48
|
const context = getRequestContext();
|
|
49
49
|
const response = await middlewareHandler(request, {
|
|
@@ -65,7 +65,7 @@ const getHandlerSource = (ctx) => `
|
|
|
65
65
|
dynamicRoutes: dynamicRoutesRaw,
|
|
66
66
|
staticRoutes: staticRoutesRaw,
|
|
67
67
|
i18n
|
|
68
|
-
} = require(
|
|
68
|
+
} = require(`./${path.posix.join(relativeDistDir, "routes-manifest.json")}`);
|
|
69
69
|
const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
|
|
70
70
|
function escapeStringRegexp(str) {
|
|
71
71
|
return str.replace(matchOperatorsRegex, "\\$&");
|
|
@@ -79,9 +79,7 @@ const getHandlerSource = (ctx) => `
|
|
|
79
79
|
const staticRoutes = staticRoutesRaw.map((route) => {
|
|
80
80
|
return {
|
|
81
81
|
...route,
|
|
82
|
-
namedRegex: new RegExp(
|
|
83
|
-
"^" + escapeStringRegexp(route.page) + "$"
|
|
84
|
-
)
|
|
82
|
+
namedRegex: new RegExp(`^${escapeStringRegexp(route.page)}$`)
|
|
85
83
|
};
|
|
86
84
|
});
|
|
87
85
|
let appPathRoutesManifest = {};
|
package/dist/index.js
CHANGED
|
@@ -13445,7 +13445,8 @@ async function getNodeMiddleware({
|
|
|
13445
13445
|
prerenderBypassToken,
|
|
13446
13446
|
isCorrectMiddlewareOrder,
|
|
13447
13447
|
functionsConfigManifest,
|
|
13448
|
-
requiredServerFilesManifest
|
|
13448
|
+
requiredServerFilesManifest,
|
|
13449
|
+
instrumentationHookBuildTrace
|
|
13449
13450
|
}) {
|
|
13450
13451
|
const middlewareFunctionConfig = functionsConfigManifest?.functions["/_middleware"];
|
|
13451
13452
|
if (!middlewareFunctionConfig || !middlewareFunctionConfig.matchers) {
|
|
@@ -13506,6 +13507,22 @@ async function getNodeMiddleware({
|
|
|
13506
13507
|
console.log("outside base dir", absolutePath);
|
|
13507
13508
|
}
|
|
13508
13509
|
});
|
|
13510
|
+
if (instrumentationHookBuildTrace) {
|
|
13511
|
+
instrumentationHookBuildTrace.files.map((file) => {
|
|
13512
|
+
fileList.push(
|
|
13513
|
+
import_path3.default.relative(
|
|
13514
|
+
baseDir,
|
|
13515
|
+
import_path3.default.join(entryPath, outputDirectory, "server", file)
|
|
13516
|
+
)
|
|
13517
|
+
);
|
|
13518
|
+
});
|
|
13519
|
+
fileList.push(
|
|
13520
|
+
import_path3.default.relative(
|
|
13521
|
+
baseDir,
|
|
13522
|
+
import_path3.default.join(entryPath, outputDirectory, "server", "instrumentation.js")
|
|
13523
|
+
)
|
|
13524
|
+
);
|
|
13525
|
+
}
|
|
13509
13526
|
const reasons = /* @__PURE__ */ new Map();
|
|
13510
13527
|
const tracedFiles = Object.fromEntries(
|
|
13511
13528
|
(await Promise.all(
|
|
@@ -14739,13 +14756,13 @@ async function serverBuild({
|
|
|
14739
14756
|
})
|
|
14740
14757
|
]);
|
|
14741
14758
|
const experimentalStreamingLambdaPaths = /* @__PURE__ */ new Map();
|
|
14759
|
+
let instrumentationHookBuildTrace;
|
|
14742
14760
|
if (hasLambdas) {
|
|
14743
14761
|
const initialTracingLabel = "Traced Next.js server files in";
|
|
14744
14762
|
console.time(initialTracingLabel);
|
|
14745
14763
|
let initialFileList;
|
|
14746
14764
|
let initialFileReasons;
|
|
14747
14765
|
let nextServerBuildTrace;
|
|
14748
|
-
let instrumentationHookBuildTrace;
|
|
14749
14766
|
const useBundledServer = import_semver4.default.gte(
|
|
14750
14767
|
nextVersion,
|
|
14751
14768
|
BUNDLED_SERVER_NEXT_VERSION
|
|
@@ -15522,7 +15539,8 @@ ${JSON.stringify(
|
|
|
15522
15539
|
prerenderBypassToken: prerenderManifest.bypassToken,
|
|
15523
15540
|
isCorrectMiddlewareOrder,
|
|
15524
15541
|
functionsConfigManifest,
|
|
15525
|
-
requiredServerFilesManifest
|
|
15542
|
+
requiredServerFilesManifest,
|
|
15543
|
+
instrumentationHookBuildTrace
|
|
15526
15544
|
});
|
|
15527
15545
|
const middleware = await getMiddlewareBundle({
|
|
15528
15546
|
config,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.4",
|
|
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.24",
|
|
20
20
|
"@types/aws-lambda": "8.10.19",
|
|
21
21
|
"@types/buffer-crc32": "0.2.0",
|
|
22
22
|
"@types/bytes": "3.1.1",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"vitest": "2.0.3",
|
|
55
55
|
"webpack-sources": "3.2.3",
|
|
56
56
|
"@vercel/routing-utils": "6.4.0",
|
|
57
|
-
"@vercel/build-utils": "13.32.
|
|
57
|
+
"@vercel/build-utils": "13.32.3"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "node build.mjs",
|