@vercel/backends 0.0.3 → 0.0.5
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.js +39 -36
- package/dist/loaders/cjs.cjs +0 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -50556,7 +50556,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
50556
50556
|
}
|
|
50557
50557
|
var _custom;
|
|
50558
50558
|
try {
|
|
50559
|
-
|
|
50559
|
+
const utilInspect = eval("require('util').inspect");
|
|
50560
|
+
_custom = utilInspect.custom;
|
|
50560
50561
|
} catch (_) {}
|
|
50561
50562
|
var _inspect = _custom || "inspect";
|
|
50562
50563
|
var BoxedBigInt = class {
|
|
@@ -52854,13 +52855,13 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
52854
52855
|
getPrettyError: () => getPrettyError,
|
|
52855
52856
|
getProvidedRuntime: () => getProvidedRuntime,
|
|
52856
52857
|
getScriptName: () => getScriptName,
|
|
52857
|
-
getSpawnOptions: () => getSpawnOptions$1,
|
|
52858
52858
|
getSupportedBunVersion: () => getSupportedBunVersion,
|
|
52859
52859
|
getSupportedNodeVersion: () => getSupportedNodeVersion,
|
|
52860
52860
|
getWriteableDirectory: () => getWritableDirectory,
|
|
52861
52861
|
glob: () => glob,
|
|
52862
52862
|
hardLinkDir: () => hardLinkDir,
|
|
52863
52863
|
installDependencies: () => installDependencies,
|
|
52864
|
+
isBackendBuilder: () => isBackendBuilder,
|
|
52864
52865
|
isBackendFramework: () => isBackendFramework,
|
|
52865
52866
|
isBunVersion: () => isBunVersion,
|
|
52866
52867
|
isDirectory: () => isDirectory,
|
|
@@ -52924,8 +52925,9 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
52924
52925
|
var import_fs_extra = __toESM(require_lib());
|
|
52925
52926
|
var import_multistream = __toESM(require_multistream());
|
|
52926
52927
|
var import_path = __toESM(__require("path"));
|
|
52927
|
-
var
|
|
52928
|
-
var
|
|
52928
|
+
var import_async_sema = __toESM(require_async_sema());
|
|
52929
|
+
var semaToPreventEMFILE = new import_async_sema.default(20);
|
|
52930
|
+
var FileFsRef$1 = class _FileFsRef {
|
|
52929
52931
|
constructor({ mode = 33188, contentType, fsPath, size }) {
|
|
52930
52932
|
(0, import_assert2.default)(typeof mode === "number");
|
|
52931
52933
|
(0, import_assert2.default)(typeof fsPath === "string");
|
|
@@ -52989,11 +52991,13 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
52989
52991
|
});
|
|
52990
52992
|
}
|
|
52991
52993
|
};
|
|
52994
|
+
var file_fs_ref_default = FileFsRef$1;
|
|
52992
52995
|
var import_assert3 = __toESM(__require("assert"));
|
|
52993
52996
|
var import_node_fetch = __toESM(require_lib3());
|
|
52994
52997
|
var import_multistream2 = __toESM(require_multistream());
|
|
52995
52998
|
var import_async_retry = __toESM(require_lib4());
|
|
52996
|
-
var
|
|
52999
|
+
var import_async_sema2 = __toESM(require_async_sema());
|
|
53000
|
+
var semaToDownloadFromS3 = new import_async_sema2.default(5);
|
|
52997
53001
|
var BailableError = class extends Error {
|
|
52998
53002
|
constructor(...args) {
|
|
52999
53003
|
super(...args);
|
|
@@ -53687,6 +53691,11 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
53687
53691
|
runtime: "bun1.x"
|
|
53688
53692
|
})];
|
|
53689
53693
|
function getOptions() {
|
|
53694
|
+
if (process.env.VERCEL_ALLOW_NODEJS_24 === "1") return [new NodeVersion({
|
|
53695
|
+
major: 24,
|
|
53696
|
+
range: "24.x",
|
|
53697
|
+
runtime: "nodejs24.x"
|
|
53698
|
+
}), ...NODE_VERSIONS];
|
|
53690
53699
|
return NODE_VERSIONS;
|
|
53691
53700
|
}
|
|
53692
53701
|
function isNodeVersionAvailable(version$1) {
|
|
@@ -53899,23 +53908,6 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
53899
53908
|
});
|
|
53900
53909
|
return true;
|
|
53901
53910
|
}
|
|
53902
|
-
function getSpawnOptions$1(meta, nodeVersion) {
|
|
53903
|
-
const opts = { env: cloneEnv(process.env) };
|
|
53904
|
-
if (isBunVersion(nodeVersion)) return opts;
|
|
53905
|
-
if (!meta.isDev) {
|
|
53906
|
-
let found = false;
|
|
53907
|
-
const pathSegments = (opts.env.PATH || process.env.PATH || "").split(import_path5.default.delimiter).map((segment) => {
|
|
53908
|
-
if (/^\/node[0-9]+\/bin/.test(segment)) {
|
|
53909
|
-
found = true;
|
|
53910
|
-
return `/node${nodeVersion.major}/bin`;
|
|
53911
|
-
}
|
|
53912
|
-
return segment;
|
|
53913
|
-
});
|
|
53914
|
-
if (!found) pathSegments.unshift(`/node${nodeVersion.major}/bin`);
|
|
53915
|
-
opts.env.PATH = pathSegments.filter(Boolean).join(import_path5.default.delimiter);
|
|
53916
|
-
}
|
|
53917
|
-
return opts;
|
|
53918
|
-
}
|
|
53919
53911
|
async function getNodeVersion$1(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
|
|
53920
53912
|
if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
|
|
53921
53913
|
const latestVersion = getLatestNodeVersion(availableVersions);
|
|
@@ -54937,7 +54929,16 @@ ${entrypointsForMessage}`);
|
|
|
54937
54929
|
"hono",
|
|
54938
54930
|
"h3",
|
|
54939
54931
|
"nestjs",
|
|
54940
|
-
"fastify"
|
|
54932
|
+
"fastify",
|
|
54933
|
+
"elysia"
|
|
54934
|
+
];
|
|
54935
|
+
var BACKEND_BUILDERS = [
|
|
54936
|
+
"@vercel/express",
|
|
54937
|
+
"@vercel/hono",
|
|
54938
|
+
"@vercel/h3",
|
|
54939
|
+
"@vercel/nestjs",
|
|
54940
|
+
"@vercel/fastify",
|
|
54941
|
+
"@vercel/elysia"
|
|
54941
54942
|
];
|
|
54942
54943
|
function isBackendFramework(framework) {
|
|
54943
54944
|
if (!framework) return false;
|
|
@@ -54946,6 +54947,11 @@ ${entrypointsForMessage}`);
|
|
|
54946
54947
|
function isExperimentalBackendsEnabled() {
|
|
54947
54948
|
return process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
|
|
54948
54949
|
}
|
|
54950
|
+
function isBackendBuilder(builder) {
|
|
54951
|
+
if (!builder) return false;
|
|
54952
|
+
const use = builder.use;
|
|
54953
|
+
return BACKEND_BUILDERS.includes(use);
|
|
54954
|
+
}
|
|
54949
54955
|
function shouldUseExperimentalBackends(framework) {
|
|
54950
54956
|
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
|
|
54951
54957
|
}
|
|
@@ -54959,13 +54965,12 @@ async function downloadInstallAndBundle(args) {
|
|
|
54959
54965
|
await (0, import_dist$2.download)(files, workPath, meta);
|
|
54960
54966
|
const entrypointFsDirname = join(workPath, dirname(entrypoint));
|
|
54961
54967
|
const nodeVersion = await (0, import_dist$2.getNodeVersion)(entrypointFsDirname, void 0, config, meta);
|
|
54962
|
-
const spawnOpts = (0, import_dist$2.getSpawnOptions)(meta || {}, nodeVersion);
|
|
54963
54968
|
const { cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await (0, import_dist$2.scanParentDirs)(entrypointFsDirname, true, repoRootPath);
|
|
54964
|
-
|
|
54969
|
+
const spawnEnv = (0, import_dist$2.getEnvForPackageManager)({
|
|
54965
54970
|
cliType,
|
|
54966
54971
|
lockfileVersion,
|
|
54967
54972
|
packageJsonPackageManager,
|
|
54968
|
-
env:
|
|
54973
|
+
env: process.env,
|
|
54969
54974
|
turboSupportsCorepackHome,
|
|
54970
54975
|
projectCreatedAt: config.projectSettings?.createdAt
|
|
54971
54976
|
});
|
|
@@ -54973,15 +54978,15 @@ async function downloadInstallAndBundle(args) {
|
|
|
54973
54978
|
if (typeof installCommand === "string") if (installCommand.trim()) {
|
|
54974
54979
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
54975
54980
|
await (0, import_dist$2.execCommand)(installCommand, {
|
|
54976
|
-
|
|
54981
|
+
env: spawnEnv,
|
|
54977
54982
|
cwd: entrypointFsDirname
|
|
54978
54983
|
});
|
|
54979
54984
|
} else console.log(`Skipping "install" command...`);
|
|
54980
|
-
else await (0, import_dist$2.runNpmInstall)(entrypointFsDirname, [],
|
|
54985
|
+
else await (0, import_dist$2.runNpmInstall)(entrypointFsDirname, [], { env: spawnEnv }, meta, config.projectSettings?.createdAt);
|
|
54981
54986
|
return {
|
|
54982
54987
|
entrypointFsDirname,
|
|
54983
54988
|
nodeVersion,
|
|
54984
|
-
|
|
54989
|
+
spawnEnv
|
|
54985
54990
|
};
|
|
54986
54991
|
}
|
|
54987
54992
|
async function maybeExecBuildCommand(args, options) {
|
|
@@ -54991,17 +54996,15 @@ async function maybeExecBuildCommand(args, options) {
|
|
|
54991
54996
|
base: args.repoRootPath || args.workPath,
|
|
54992
54997
|
start: args.workPath
|
|
54993
54998
|
}).join(delimiter);
|
|
54994
|
-
const env = {
|
|
54995
|
-
...options.spawnOpts.env,
|
|
54996
|
-
PATH: `${nodeBinPath}${delimiter}${options.spawnOpts.env?.PATH || process.env.PATH}`
|
|
54997
|
-
};
|
|
54998
54999
|
return (0, import_dist$2.execCommand)(projectBuildCommand, {
|
|
54999
|
-
|
|
55000
|
-
|
|
55000
|
+
env: {
|
|
55001
|
+
...options.spawnEnv,
|
|
55002
|
+
PATH: `${nodeBinPath}${delimiter}${options.spawnEnv?.PATH || process.env.PATH}`
|
|
55003
|
+
},
|
|
55001
55004
|
cwd: args.workPath
|
|
55002
55005
|
});
|
|
55003
55006
|
}
|
|
55004
|
-
return (0, import_dist$2.runPackageJsonScript)(options.entrypointFsDirname, ["build"], options.
|
|
55007
|
+
return (0, import_dist$2.runPackageJsonScript)(options.entrypointFsDirname, ["build"], options.spawnEnv, args.config.projectSettings?.createdAt);
|
|
55005
55008
|
}
|
|
55006
55009
|
|
|
55007
55010
|
//#endregion
|
package/dist/loaders/cjs.cjs
CHANGED
|
@@ -24,7 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
let module$1 = require("module");
|
|
25
25
|
module$1 = __toESM(module$1);
|
|
26
26
|
let path_to_regexp = require("path-to-regexp");
|
|
27
|
-
path_to_regexp = __toESM(path_to_regexp);
|
|
28
27
|
|
|
29
28
|
//#region src/introspection/util.ts
|
|
30
29
|
const setupCloseHandlers = (cb) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/backends",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"path-to-regexp": "8.3.0",
|
|
42
42
|
"rolldown": "1.0.0-beta.35",
|
|
43
43
|
"ts-morph": "12.0.0",
|
|
44
|
-
"tsdown": "0.15.6",
|
|
45
44
|
"zod": "3.22.4",
|
|
46
|
-
"@vercel/cervel": "0.0.
|
|
45
|
+
"@vercel/cervel": "0.0.3"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@types/express": "5.0.3",
|
|
50
49
|
"@types/fs-extra": "11",
|
|
51
50
|
"@types/jest": "27.5.1",
|
|
52
51
|
"@types/node": "22",
|
|
53
|
-
"@vercel/build-utils": "
|
|
52
|
+
"@vercel/build-utils": "13.0.0",
|
|
54
53
|
"execa": "3.2.0",
|
|
55
54
|
"hono": "4.10.1",
|
|
56
55
|
"jest-junit": "16.0.0",
|
|
56
|
+
"tsdown": "0.15.6",
|
|
57
57
|
"vite": "^5.1.6",
|
|
58
58
|
"vitest": "^2.0.1"
|
|
59
59
|
},
|