@vercel/next 30.0.1 → 30.1.0-snapshot-f90d5a1ebf99
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 +35 -10
- package/dist/bin/proxy-linux-amd64 +0 -0
- package/dist/index.js +15 -3
- package/package.json +6 -6
package/dist/adapter/index.js
CHANGED
|
@@ -9862,8 +9862,12 @@ async function handleNodeOutputs(nodeOutputs, {
|
|
|
9862
9862
|
const envFileHashes = {};
|
|
9863
9863
|
let nextEnvLoaderPathRelativeToProjectDir;
|
|
9864
9864
|
for (const envFile of envFiles) {
|
|
9865
|
-
|
|
9866
|
-
|
|
9865
|
+
const envFileKey = import_node_path.default.posix.join(handlerRelativeDir, envFile);
|
|
9866
|
+
envFilePathMap[envFileKey] = import_node_path.default.posix.relative(
|
|
9867
|
+
repoRoot,
|
|
9868
|
+
import_node_path.default.join(projectDir, envFile)
|
|
9869
|
+
);
|
|
9870
|
+
envFileHashes[envFileKey] = sha256(
|
|
9867
9871
|
await import_promises.default.readFile(import_node_path.default.join(projectDir, envFile))
|
|
9868
9872
|
);
|
|
9869
9873
|
}
|
|
@@ -10274,6 +10278,7 @@ async function handleMiddleware(output, ctx) {
|
|
|
10274
10278
|
});
|
|
10275
10279
|
} else if (output.runtime === "edge") {
|
|
10276
10280
|
await handleEdgeOutputs([output], ctx);
|
|
10281
|
+
} else if (output.runtime === "go") {
|
|
10277
10282
|
} else {
|
|
10278
10283
|
throw new Error(`Invalid middleware output ${JSON.stringify(output)}`);
|
|
10279
10284
|
}
|
|
@@ -10393,9 +10398,9 @@ function assertPathname(value, description = "output pathname") {
|
|
|
10393
10398
|
}
|
|
10394
10399
|
}
|
|
10395
10400
|
function assertGoRouteOutput(value) {
|
|
10396
|
-
if (!isRecord(value) || value.type !== import_constants2.AdapterOutputType.APP_ROUTE || value.runtime !== "go") {
|
|
10401
|
+
if (!isRecord(value) || value.type !== import_constants2.AdapterOutputType.APP_ROUTE && value.type !== import_constants2.AdapterOutputType.MIDDLEWARE || value.runtime !== "go") {
|
|
10397
10402
|
throw new Error(
|
|
10398
|
-
"Go is supported only for App Router route.go
|
|
10403
|
+
"Go is supported only for App Router route.go handlers and proxy.go middleware outputs"
|
|
10399
10404
|
);
|
|
10400
10405
|
}
|
|
10401
10406
|
if (typeof value.id !== "string" || !value.id || typeof value.sourcePage !== "string") {
|
|
@@ -10403,7 +10408,13 @@ function assertGoRouteOutput(value) {
|
|
|
10403
10408
|
}
|
|
10404
10409
|
assertPathname(value.pathname);
|
|
10405
10410
|
assertPathname(value.sourcePage, "sourcePage");
|
|
10406
|
-
if (
|
|
10411
|
+
if (value.type === import_constants2.AdapterOutputType.MIDDLEWARE) {
|
|
10412
|
+
if (!["/proxy", "/src/proxy"].includes(value.sourcePage) || value.pathname !== "/_middleware" || !isRecord(value.config) || !Array.isArray(value.config.matchers)) {
|
|
10413
|
+
throw new Error(
|
|
10414
|
+
"Go middleware requires a root or src proxy.go source, /_middleware pathname, and matchers"
|
|
10415
|
+
);
|
|
10416
|
+
}
|
|
10417
|
+
} else if (!value.sourcePage.endsWith("/route")) {
|
|
10407
10418
|
throw new Error("Go sourcePage must identify an App Router route handler");
|
|
10408
10419
|
}
|
|
10409
10420
|
if (typeof value.filePath !== "string" || !import_node_path2.default.isAbsolute(value.filePath)) {
|
|
@@ -10475,11 +10486,21 @@ function collectGoRouteOutputs(outputs) {
|
|
|
10475
10486
|
`Unsupported Next.js adapter output runtime: ${String(output.runtime)}`
|
|
10476
10487
|
);
|
|
10477
10488
|
}
|
|
10478
|
-
if (kind !== "appRoutes") {
|
|
10489
|
+
if (kind !== "appRoutes" && kind !== "middleware") {
|
|
10479
10490
|
throw new Error(
|
|
10480
10491
|
`Go ${kind} outputs are unsupported; only App Router route.go handlers are supported`
|
|
10481
10492
|
);
|
|
10482
10493
|
}
|
|
10494
|
+
if (kind === "middleware" && output.type !== import_constants2.AdapterOutputType.MIDDLEWARE) {
|
|
10495
|
+
throw new Error(
|
|
10496
|
+
"Go middleware outputs are unsupported unless they use the MIDDLEWARE output type"
|
|
10497
|
+
);
|
|
10498
|
+
}
|
|
10499
|
+
if (kind === "appRoutes" && output.type !== import_constants2.AdapterOutputType.APP_ROUTE) {
|
|
10500
|
+
throw new Error(
|
|
10501
|
+
"Go App Router outputs require the APP_ROUTE output type"
|
|
10502
|
+
);
|
|
10503
|
+
}
|
|
10483
10504
|
assertGoRouteOutput(output);
|
|
10484
10505
|
goOutputs.push(output);
|
|
10485
10506
|
}
|
|
@@ -10615,7 +10636,7 @@ async function handleGoOutputs(outputs, {
|
|
|
10615
10636
|
const functionPaths = /* @__PURE__ */ new Map();
|
|
10616
10637
|
for (const output of outputs) {
|
|
10617
10638
|
assertGoRouteOutput(output);
|
|
10618
|
-
const pathname = normalizeIndexPathname(output.pathname, config);
|
|
10639
|
+
const pathname = output.type === import_constants2.AdapterOutputType.MIDDLEWARE ? output.pathname : normalizeIndexPathname(output.pathname, config);
|
|
10619
10640
|
const functionPath = `${pathname.slice(1)}.func`;
|
|
10620
10641
|
const caseInsensitivePath = functionPath.toLowerCase();
|
|
10621
10642
|
const previous = functionPaths.get(caseInsensitivePath);
|
|
@@ -10624,7 +10645,8 @@ async function handleGoOutputs(outputs, {
|
|
|
10624
10645
|
functionPaths.set(caseInsensitivePath, functionPath);
|
|
10625
10646
|
}
|
|
10626
10647
|
for (const output of outputs) {
|
|
10627
|
-
const
|
|
10648
|
+
const isMiddleware = output.type === import_constants2.AdapterOutputType.MIDDLEWARE;
|
|
10649
|
+
const sourceFile = isMiddleware ? `${output.sourcePage.slice(1)}.go` : (await getSourceFilePathFromPage({
|
|
10628
10650
|
workPath: projectDir,
|
|
10629
10651
|
page: output.sourcePage,
|
|
10630
10652
|
pageExtensions: ["go"],
|
|
@@ -10633,7 +10655,10 @@ async function handleGoOutputs(outputs, {
|
|
|
10633
10655
|
allowExtensionless: false,
|
|
10634
10656
|
allowDirectoryIndex: false
|
|
10635
10657
|
})).replace(/\\/g, "/");
|
|
10636
|
-
if (
|
|
10658
|
+
if (isMiddleware) {
|
|
10659
|
+
if (!(await import_promises2.default.stat(import_node_path2.default.join(projectDir, sourceFile))).isFile())
|
|
10660
|
+
throw new Error(`Could not resolve Go proxy source: ${sourceFile}`);
|
|
10661
|
+
} else if (!/^(src\/)?app\/(?:.*\/)?route\.go$/.test(sourceFile)) {
|
|
10637
10662
|
throw new Error(
|
|
10638
10663
|
`Could not resolve Go route.go source for ${output.sourcePage}`
|
|
10639
10664
|
);
|
|
@@ -10651,7 +10676,7 @@ async function handleGoOutputs(outputs, {
|
|
|
10651
10676
|
`Go target architecture conflicts with function configuration for ${sourceFile}`
|
|
10652
10677
|
);
|
|
10653
10678
|
}
|
|
10654
|
-
const pathname = normalizeIndexPathname(output.pathname, config);
|
|
10679
|
+
const pathname = output.type === import_constants2.AdapterOutputType.MIDDLEWARE ? output.pathname : normalizeIndexPathname(output.pathname, config);
|
|
10655
10680
|
const functionDir = import_node_path2.default.join(functionsDir, `${pathname.slice(1)}.func`);
|
|
10656
10681
|
await ensureFunctionParent(functionsDir, functionDir);
|
|
10657
10682
|
await existingGoFunction(functionDir);
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -26508,8 +26508,20 @@ async function findGoRoutes(entryPath) {
|
|
|
26508
26508
|
if (code !== "ENOENT" && code !== "ENOTDIR")
|
|
26509
26509
|
throw error;
|
|
26510
26510
|
}
|
|
26511
|
-
const routes =
|
|
26512
|
-
|
|
26511
|
+
const routes = Object.keys(
|
|
26512
|
+
await (0, import_build_utils7.glob)(`${appDirectory}/**/route.go`, entryPath)
|
|
26513
|
+
);
|
|
26514
|
+
for (const proxy of ["proxy.go", "src/proxy.go"]) {
|
|
26515
|
+
try {
|
|
26516
|
+
if ((await (0, import_fs_extra10.stat)((0, import_path13.join)(entryPath, proxy))).isFile())
|
|
26517
|
+
routes.push(proxy);
|
|
26518
|
+
} catch (error) {
|
|
26519
|
+
const { code } = error;
|
|
26520
|
+
if (code !== "ENOENT" && code !== "ENOTDIR")
|
|
26521
|
+
throw error;
|
|
26522
|
+
}
|
|
26523
|
+
}
|
|
26524
|
+
return routes.filter(
|
|
26513
26525
|
(route) => !route.split(/[\\/]/).slice(0, -1).some((part) => part.startsWith("_"))
|
|
26514
26526
|
);
|
|
26515
26527
|
}
|
|
@@ -26534,7 +26546,7 @@ async function prepareGoBuild({
|
|
|
26534
26546
|
);
|
|
26535
26547
|
if (!goMod) {
|
|
26536
26548
|
throw new Error(
|
|
26537
|
-
`Go
|
|
26549
|
+
`Go entrypoint ${route} requires a go.mod within the Next.js project.`
|
|
26538
26550
|
);
|
|
26539
26551
|
}
|
|
26540
26552
|
modules.add((0, import_path13.dirname)(goMod));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "30.0
|
|
3
|
+
"version": "30.1.0-snapshot-f90d5a1ebf99",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"@vercel/nft": "1.10.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@vercel/build-utils": "15.4.
|
|
19
|
+
"@vercel/build-utils": "15.4.2-snapshot-f90d5a1ebf99"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@next-community/adapter-vercel": "0.0
|
|
22
|
+
"@next-community/adapter-vercel": "0.1.0-beta.38",
|
|
23
23
|
"@types/aws-lambda": "8.10.19",
|
|
24
24
|
"@types/buffer-crc32": "0.2.0",
|
|
25
25
|
"@types/bytes": "3.1.1",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"vite": "6.4.3",
|
|
61
61
|
"vitest": "4.1.10",
|
|
62
62
|
"webpack-sources": "3.2.3",
|
|
63
|
-
"@vercel/build-utils": "15.4.
|
|
64
|
-
"@vercel/go": "29.0.1",
|
|
63
|
+
"@vercel/build-utils": "15.4.2-snapshot-f90d5a1ebf99",
|
|
65
64
|
"@vercel-internals/ipc-proxy": "1.1.4",
|
|
66
|
-
"@vercel/routing-utils": "6.6.1"
|
|
65
|
+
"@vercel/routing-utils": "6.6.1",
|
|
66
|
+
"@vercel/go": "29.0.2-snapshot-f90d5a1ebf99"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "node build.mjs",
|