@vercel/backends 0.8.20 → 0.8.22
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.mjs +17 -2
- package/package.json +4 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from "node:module";
|
|
2
2
|
import { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { delimiter as delimiter$1, dirname as dirname$1, join as join$1 } from "path";
|
|
4
|
-
import { FileBlob, FileFsRef, NodejsLambda, Span, cloneEnv, createDiagnostics, debug, defaultCachePathGlob, download, execCommand, generateProjectManifest, getEnvForPackageManager, getInternalServiceCronPath, getLambdaOptionsFromFunction, getNodeBinPaths, getNodeVersion, getReportedServiceType, glob, isBackendFramework, isBunVersion, isExperimentalBackendsWithoutIntrospectionEnabled, isScheduleTriggeredService, runNpmInstall, runPackageJsonScript, scanParentDirs } from "@vercel/build-utils";
|
|
4
|
+
import { FileBlob, FileFsRef, NodejsLambda, NowBuildError, Span, cloneEnv, createDiagnostics, debug, defaultCachePathGlob, download, execCommand, generateProjectManifest, getEnvForPackageManager, getInternalServiceCronPath, getLambdaOptionsFromFunction, getNodeBinPaths, getNodeVersion, getReportedServiceType, glob, isBackendFramework, isBunVersion, isExperimentalBackendsWithoutIntrospectionEnabled, isScheduleTriggeredService, runNpmInstall, runPackageJsonScript, scanParentDirs } from "@vercel/build-utils";
|
|
5
|
+
import { getConfig } from "@vercel/static-config";
|
|
6
|
+
import { Project } from "ts-morph";
|
|
5
7
|
import { createWriteStream, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
8
|
import { lstat, readFile, readlink, rm, stat } from "node:fs/promises";
|
|
7
9
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -2103,6 +2105,12 @@ const startDevServer = async (opts) => {
|
|
|
2103
2105
|
//#endregion
|
|
2104
2106
|
//#region src/index.ts
|
|
2105
2107
|
const version = 2;
|
|
2108
|
+
/**
|
|
2109
|
+
* Edge Runtime is not supported in services. Mirrors the `EdgeRuntimes` enum in
|
|
2110
|
+
* `@vercel/node` (`'edge' | 'experimental-edge'`) — the values a function can
|
|
2111
|
+
* set via `export const config = { runtime: ... }`.
|
|
2112
|
+
*/
|
|
2113
|
+
const EDGE_RUNTIMES = new Set(["edge", "experimental-edge"]);
|
|
2106
2114
|
/** Non-empty Build Command from project settings / vercel.json (not the default `build` script). */
|
|
2107
2115
|
function hasExplicitBuildCommand(config) {
|
|
2108
2116
|
const cmd = config.buildCommand ?? config.projectSettings?.buildCommand;
|
|
@@ -2121,6 +2129,14 @@ const build = async (args) => {
|
|
|
2121
2129
|
const entrypoint = await findEntrypointWithHintOrThrow(args.workPath, args.entrypoint);
|
|
2122
2130
|
debug("Entrypoint", entrypoint);
|
|
2123
2131
|
args.entrypoint = entrypoint;
|
|
2132
|
+
const serviceName = typeof args.config?.serviceName === "string" && args.config.serviceName !== "" ? args.config.serviceName : void 0;
|
|
2133
|
+
if (serviceName) {
|
|
2134
|
+
const configuredRuntime = getConfig(new Project(), join(args.workPath, entrypoint))?.runtime;
|
|
2135
|
+
if (typeof configuredRuntime === "string" && EDGE_RUNTIMES.has(configuredRuntime)) throw new NowBuildError({
|
|
2136
|
+
code: "EDGE_RUNTIME_UNSUPPORTED_IN_SERVICES",
|
|
2137
|
+
message: `Edge Runtime is not supported in services. Service "${serviceName}" entrypoint "${entrypoint}" sets \`config.runtime = '${configuredRuntime}'\`. Remove the Edge runtime configuration from this service or deploy it outside of services.`
|
|
2138
|
+
});
|
|
2139
|
+
}
|
|
2124
2140
|
const cronEntries = await getServiceCrons({
|
|
2125
2141
|
service: args.service,
|
|
2126
2142
|
entrypoint
|
|
@@ -2250,7 +2266,6 @@ const build = async (args) => {
|
|
|
2250
2266
|
VERCEL_SERVICE_ROUTE_PREFIX: serviceRoutePrefix,
|
|
2251
2267
|
VERCEL_SERVICE_ROUTE_PREFIX_STRIP: "1"
|
|
2252
2268
|
};
|
|
2253
|
-
const serviceName = typeof args.config?.serviceName === "string" && args.config.serviceName !== "" ? args.config.serviceName : void 0;
|
|
2254
2269
|
const serviceFunctionPath = !!args.service?.name && !args.service.type ? "/index" : typeof serviceName === "string" && serviceName !== "" ? `/_svc/${serviceName}/index` : void 0;
|
|
2255
2270
|
const serviceOutputPath = serviceFunctionPath?.slice(1);
|
|
2256
2271
|
const remapRouteDestination = (route) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/backends",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.22",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
"resolve.exports": "2.0.3",
|
|
35
35
|
"rolldown": "1.0.0-rc.1",
|
|
36
36
|
"srvx": "0.11.16",
|
|
37
|
+
"ts-morph": "12.0.0",
|
|
37
38
|
"tsx": "4.21.0",
|
|
38
39
|
"zod": "3.22.4",
|
|
39
|
-
"@vercel/build-utils": "13.32.
|
|
40
|
+
"@vercel/build-utils": "13.32.3",
|
|
41
|
+
"@vercel/static-config": "3.4.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@types/express": "5.0.3",
|