@vercel/backends 0.0.4 → 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 +34 -36
- package/dist/loaders/cjs.cjs +0 -1
- package/package.json +2 -2
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);
|
|
@@ -53904,23 +53908,6 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
53904
53908
|
});
|
|
53905
53909
|
return true;
|
|
53906
53910
|
}
|
|
53907
|
-
function getSpawnOptions$1(meta, nodeVersion) {
|
|
53908
|
-
const opts = { env: cloneEnv(process.env) };
|
|
53909
|
-
if (isBunVersion(nodeVersion)) return opts;
|
|
53910
|
-
if (!meta.isDev) {
|
|
53911
|
-
let found = false;
|
|
53912
|
-
const pathSegments = (opts.env.PATH || process.env.PATH || "").split(import_path5.default.delimiter).map((segment) => {
|
|
53913
|
-
if (/^\/node[0-9]+\/bin/.test(segment)) {
|
|
53914
|
-
found = true;
|
|
53915
|
-
return `/node${nodeVersion.major}/bin`;
|
|
53916
|
-
}
|
|
53917
|
-
return segment;
|
|
53918
|
-
});
|
|
53919
|
-
if (!found) pathSegments.unshift(`/node${nodeVersion.major}/bin`);
|
|
53920
|
-
opts.env.PATH = pathSegments.filter(Boolean).join(import_path5.default.delimiter);
|
|
53921
|
-
}
|
|
53922
|
-
return opts;
|
|
53923
|
-
}
|
|
53924
53911
|
async function getNodeVersion$1(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
|
|
53925
53912
|
if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
|
|
53926
53913
|
const latestVersion = getLatestNodeVersion(availableVersions);
|
|
@@ -54942,7 +54929,16 @@ ${entrypointsForMessage}`);
|
|
|
54942
54929
|
"hono",
|
|
54943
54930
|
"h3",
|
|
54944
54931
|
"nestjs",
|
|
54945
|
-
"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"
|
|
54946
54942
|
];
|
|
54947
54943
|
function isBackendFramework(framework) {
|
|
54948
54944
|
if (!framework) return false;
|
|
@@ -54951,6 +54947,11 @@ ${entrypointsForMessage}`);
|
|
|
54951
54947
|
function isExperimentalBackendsEnabled() {
|
|
54952
54948
|
return process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
|
|
54953
54949
|
}
|
|
54950
|
+
function isBackendBuilder(builder) {
|
|
54951
|
+
if (!builder) return false;
|
|
54952
|
+
const use = builder.use;
|
|
54953
|
+
return BACKEND_BUILDERS.includes(use);
|
|
54954
|
+
}
|
|
54954
54955
|
function shouldUseExperimentalBackends(framework) {
|
|
54955
54956
|
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
|
|
54956
54957
|
}
|
|
@@ -54964,13 +54965,12 @@ async function downloadInstallAndBundle(args) {
|
|
|
54964
54965
|
await (0, import_dist$2.download)(files, workPath, meta);
|
|
54965
54966
|
const entrypointFsDirname = join(workPath, dirname(entrypoint));
|
|
54966
54967
|
const nodeVersion = await (0, import_dist$2.getNodeVersion)(entrypointFsDirname, void 0, config, meta);
|
|
54967
|
-
const spawnOpts = (0, import_dist$2.getSpawnOptions)(meta || {}, nodeVersion);
|
|
54968
54968
|
const { cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await (0, import_dist$2.scanParentDirs)(entrypointFsDirname, true, repoRootPath);
|
|
54969
|
-
|
|
54969
|
+
const spawnEnv = (0, import_dist$2.getEnvForPackageManager)({
|
|
54970
54970
|
cliType,
|
|
54971
54971
|
lockfileVersion,
|
|
54972
54972
|
packageJsonPackageManager,
|
|
54973
|
-
env:
|
|
54973
|
+
env: process.env,
|
|
54974
54974
|
turboSupportsCorepackHome,
|
|
54975
54975
|
projectCreatedAt: config.projectSettings?.createdAt
|
|
54976
54976
|
});
|
|
@@ -54978,15 +54978,15 @@ async function downloadInstallAndBundle(args) {
|
|
|
54978
54978
|
if (typeof installCommand === "string") if (installCommand.trim()) {
|
|
54979
54979
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
54980
54980
|
await (0, import_dist$2.execCommand)(installCommand, {
|
|
54981
|
-
|
|
54981
|
+
env: spawnEnv,
|
|
54982
54982
|
cwd: entrypointFsDirname
|
|
54983
54983
|
});
|
|
54984
54984
|
} else console.log(`Skipping "install" command...`);
|
|
54985
|
-
else await (0, import_dist$2.runNpmInstall)(entrypointFsDirname, [],
|
|
54985
|
+
else await (0, import_dist$2.runNpmInstall)(entrypointFsDirname, [], { env: spawnEnv }, meta, config.projectSettings?.createdAt);
|
|
54986
54986
|
return {
|
|
54987
54987
|
entrypointFsDirname,
|
|
54988
54988
|
nodeVersion,
|
|
54989
|
-
|
|
54989
|
+
spawnEnv
|
|
54990
54990
|
};
|
|
54991
54991
|
}
|
|
54992
54992
|
async function maybeExecBuildCommand(args, options) {
|
|
@@ -54996,17 +54996,15 @@ async function maybeExecBuildCommand(args, options) {
|
|
|
54996
54996
|
base: args.repoRootPath || args.workPath,
|
|
54997
54997
|
start: args.workPath
|
|
54998
54998
|
}).join(delimiter);
|
|
54999
|
-
const env = {
|
|
55000
|
-
...options.spawnOpts.env,
|
|
55001
|
-
PATH: `${nodeBinPath}${delimiter}${options.spawnOpts.env?.PATH || process.env.PATH}`
|
|
55002
|
-
};
|
|
55003
54999
|
return (0, import_dist$2.execCommand)(projectBuildCommand, {
|
|
55004
|
-
|
|
55005
|
-
|
|
55000
|
+
env: {
|
|
55001
|
+
...options.spawnEnv,
|
|
55002
|
+
PATH: `${nodeBinPath}${delimiter}${options.spawnEnv?.PATH || process.env.PATH}`
|
|
55003
|
+
},
|
|
55006
55004
|
cwd: args.workPath
|
|
55007
55005
|
});
|
|
55008
55006
|
}
|
|
55009
|
-
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);
|
|
55010
55008
|
}
|
|
55011
55009
|
|
|
55012
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/fs-extra": "11",
|
|
50
50
|
"@types/jest": "27.5.1",
|
|
51
51
|
"@types/node": "22",
|
|
52
|
-
"@vercel/build-utils": "
|
|
52
|
+
"@vercel/build-utils": "13.0.0",
|
|
53
53
|
"execa": "3.2.0",
|
|
54
54
|
"hono": "4.10.1",
|
|
55
55
|
"jest-junit": "16.0.0",
|