vercel 50.1.2 → 50.1.3
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 +468 -505
- package/package.json +16 -16
package/dist/index.js
CHANGED
|
@@ -50100,7 +50100,7 @@ var require_package = __commonJS2({
|
|
|
50100
50100
|
"../client/package.json"(exports2, module2) {
|
|
50101
50101
|
module2.exports = {
|
|
50102
50102
|
name: "@vercel/client",
|
|
50103
|
-
version: "17.2.
|
|
50103
|
+
version: "17.2.18",
|
|
50104
50104
|
main: "dist/index.js",
|
|
50105
50105
|
typings: "dist/index.d.ts",
|
|
50106
50106
|
homepage: "https://vercel.com",
|
|
@@ -82995,6 +82995,7 @@ var require_detect_builders = __commonJS2({
|
|
|
82995
82995
|
var import_path43 = require("path");
|
|
82996
82996
|
var import_frameworks8 = __toESM4(require_frameworks());
|
|
82997
82997
|
var import_is_official_runtime = require_is_official_runtime();
|
|
82998
|
+
var import_build_utils19 = require("@vercel/build-utils");
|
|
82998
82999
|
var REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
|
|
82999
83000
|
var REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
|
|
83000
83001
|
var REGEX_NON_VERCEL_PLATFORM_FILES2 = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
|
|
@@ -83079,7 +83080,7 @@ var require_detect_builders = __commonJS2({
|
|
|
83079
83080
|
const apiRoutes = [];
|
|
83080
83081
|
const dynamicRoutes = [];
|
|
83081
83082
|
for (const fileName of sortedFiles) {
|
|
83082
|
-
const apiBuilder = maybeGetApiBuilder(fileName, apiMatches, options);
|
|
83083
|
+
const apiBuilder = await maybeGetApiBuilder(fileName, apiMatches, options);
|
|
83083
83084
|
if (apiBuilder) {
|
|
83084
83085
|
const { routeError, apiRoute, isDynamic } = getApiRoute(
|
|
83085
83086
|
fileName,
|
|
@@ -83226,7 +83227,7 @@ var require_detect_builders = __commonJS2({
|
|
|
83226
83227
|
errorRoutes: routesResult.errorRoutes
|
|
83227
83228
|
};
|
|
83228
83229
|
}
|
|
83229
|
-
function maybeGetApiBuilder(fileName, apiMatches, options) {
|
|
83230
|
+
async function maybeGetApiBuilder(fileName, apiMatches, options) {
|
|
83230
83231
|
const middleware = fileName === "middleware.js" || fileName === "middleware.ts";
|
|
83231
83232
|
if (middleware && options.projectSettings?.framework === "nextjs") {
|
|
83232
83233
|
return null;
|
|
@@ -83246,6 +83247,13 @@ var require_detect_builders = __commonJS2({
|
|
|
83246
83247
|
if (fileName.endsWith(".d.ts")) {
|
|
83247
83248
|
return null;
|
|
83248
83249
|
}
|
|
83250
|
+
if (fileName.endsWith(".py") && options.workPath) {
|
|
83251
|
+
const fsPath = (0, import_path43.join)(options.workPath, fileName);
|
|
83252
|
+
const isEntrypoint = await (0, import_build_utils19.isPythonEntrypoint)({ fsPath });
|
|
83253
|
+
if (!isEntrypoint) {
|
|
83254
|
+
return null;
|
|
83255
|
+
}
|
|
83256
|
+
}
|
|
83249
83257
|
const match = apiMatches.find(({ src = "**" }) => {
|
|
83250
83258
|
return src === fileName || (0, import_minimatch5.default)(fileName, src);
|
|
83251
83259
|
});
|
|
@@ -92321,12 +92329,10 @@ function getLocalPathConfig(prefix) {
|
|
|
92321
92329
|
if (nowConfigExists && vercelConfigExists) {
|
|
92322
92330
|
throw new ConflictingConfigFiles([vercelConfigPath, nowConfigPath]);
|
|
92323
92331
|
}
|
|
92324
|
-
|
|
92325
|
-
|
|
92326
|
-
|
|
92327
|
-
|
|
92328
|
-
return compiledConfigPath;
|
|
92329
|
-
}
|
|
92332
|
+
const compiledConfigPath = import_path10.default.join(prefix, VERCEL_DIR, "vercel.json");
|
|
92333
|
+
const compiledConfigExists = (0, import_fs4.existsSync)(compiledConfigPath);
|
|
92334
|
+
if (compiledConfigExists) {
|
|
92335
|
+
return compiledConfigPath;
|
|
92330
92336
|
}
|
|
92331
92337
|
if (nowConfigExists) {
|
|
92332
92338
|
return nowConfigPath;
|
|
@@ -92389,7 +92395,7 @@ function readLocalConfig(prefix = process.cwd()) {
|
|
|
92389
92395
|
if (!config2) {
|
|
92390
92396
|
return;
|
|
92391
92397
|
}
|
|
92392
|
-
const isCompiledConfig =
|
|
92398
|
+
const isCompiledConfig = (0, import_path11.basename)(target) === "vercel.json" && (0, import_path11.basename)((0, import_path11.dirname)(target)) === VERCEL_DIR;
|
|
92393
92399
|
if (isCompiledConfig) {
|
|
92394
92400
|
const workPath = (0, import_path11.dirname)((0, import_path11.dirname)(target));
|
|
92395
92401
|
const VERCEL_CONFIG_EXTENSIONS2 = ["ts", "mts", "js", "mjs", "cjs"];
|
|
@@ -92838,320 +92844,11 @@ var init_read_json_file = __esm({
|
|
|
92838
92844
|
}
|
|
92839
92845
|
});
|
|
92840
92846
|
|
|
92841
|
-
// ../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js
|
|
92842
|
-
var require_main = __commonJS2({
|
|
92843
|
-
"../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
92844
|
-
"use strict";
|
|
92845
|
-
var fs15 = require("fs");
|
|
92846
|
-
function parse11(src) {
|
|
92847
|
-
var obj = {};
|
|
92848
|
-
src.toString().split("\n").forEach(function(line) {
|
|
92849
|
-
var keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);
|
|
92850
|
-
if (keyValueArr != null) {
|
|
92851
|
-
var key = keyValueArr[1];
|
|
92852
|
-
var value = keyValueArr[2] ? keyValueArr[2] : "";
|
|
92853
|
-
var len = value ? value.length : 0;
|
|
92854
|
-
if (len > 0 && value.charAt(0) === '"' && value.charAt(len - 1) === '"') {
|
|
92855
|
-
value = value.replace(/\\n/gm, "\n");
|
|
92856
|
-
}
|
|
92857
|
-
value = value.replace(/(^['"]|['"]$)/g, "").trim();
|
|
92858
|
-
obj[key] = value;
|
|
92859
|
-
}
|
|
92860
|
-
});
|
|
92861
|
-
return obj;
|
|
92862
|
-
}
|
|
92863
|
-
function config2(options) {
|
|
92864
|
-
var path11 = ".env";
|
|
92865
|
-
var encoding = "utf8";
|
|
92866
|
-
if (options) {
|
|
92867
|
-
if (options.path) {
|
|
92868
|
-
path11 = options.path;
|
|
92869
|
-
}
|
|
92870
|
-
if (options.encoding) {
|
|
92871
|
-
encoding = options.encoding;
|
|
92872
|
-
}
|
|
92873
|
-
}
|
|
92874
|
-
try {
|
|
92875
|
-
var parsedObj = parse11(fs15.readFileSync(path11, { encoding }));
|
|
92876
|
-
Object.keys(parsedObj).forEach(function(key) {
|
|
92877
|
-
process.env[key] = process.env[key] || parsedObj[key];
|
|
92878
|
-
});
|
|
92879
|
-
return { parsed: parsedObj };
|
|
92880
|
-
} catch (e2) {
|
|
92881
|
-
return { error: e2 };
|
|
92882
|
-
}
|
|
92883
|
-
}
|
|
92884
|
-
module2.exports.config = config2;
|
|
92885
|
-
module2.exports.load = config2;
|
|
92886
|
-
module2.exports.parse = parse11;
|
|
92887
|
-
}
|
|
92888
|
-
});
|
|
92889
|
-
|
|
92890
|
-
// src/util/compile-vercel-config.ts
|
|
92891
|
-
var compile_vercel_config_exports = {};
|
|
92892
|
-
__export3(compile_vercel_config_exports, {
|
|
92893
|
-
compileVercelConfig: () => compileVercelConfig,
|
|
92894
|
-
findSourceVercelConfigFile: () => findSourceVercelConfigFile,
|
|
92895
|
-
getVercelConfigPath: () => getVercelConfigPath
|
|
92896
|
-
});
|
|
92897
|
-
async function fileExists(filePath) {
|
|
92898
|
-
try {
|
|
92899
|
-
await (0, import_promises.access)(filePath);
|
|
92900
|
-
return true;
|
|
92901
|
-
} catch {
|
|
92902
|
-
return false;
|
|
92903
|
-
}
|
|
92904
|
-
}
|
|
92905
|
-
async function findAllVercelConfigFiles(workPath) {
|
|
92906
|
-
const foundFiles = [];
|
|
92907
|
-
for (const ext of VERCEL_CONFIG_EXTENSIONS) {
|
|
92908
|
-
const configPath = (0, import_path12.join)(workPath, `vercel.${ext}`);
|
|
92909
|
-
if (await fileExists(configPath)) {
|
|
92910
|
-
foundFiles.push(configPath);
|
|
92911
|
-
}
|
|
92912
|
-
}
|
|
92913
|
-
return foundFiles;
|
|
92914
|
-
}
|
|
92915
|
-
async function findSourceVercelConfigFile(workPath) {
|
|
92916
|
-
for (const ext of VERCEL_CONFIG_EXTENSIONS) {
|
|
92917
|
-
const configPath = (0, import_path12.join)(workPath, `vercel.${ext}`);
|
|
92918
|
-
if (await fileExists(configPath)) {
|
|
92919
|
-
return (0, import_path12.basename)(configPath);
|
|
92920
|
-
}
|
|
92921
|
-
}
|
|
92922
|
-
return null;
|
|
92923
|
-
}
|
|
92924
|
-
async function findVercelConfigFile(workPath) {
|
|
92925
|
-
const foundFiles = await findAllVercelConfigFiles(workPath);
|
|
92926
|
-
if (foundFiles.length > 1) {
|
|
92927
|
-
throw new ConflictingConfigFiles(
|
|
92928
|
-
foundFiles,
|
|
92929
|
-
"Multiple vercel config files found. Please use only one configuration file.",
|
|
92930
|
-
"https://vercel.com/docs/projects/project-configuration"
|
|
92931
|
-
);
|
|
92932
|
-
}
|
|
92933
|
-
return foundFiles[0] || null;
|
|
92934
|
-
}
|
|
92935
|
-
function parseConfigLoaderError(stderr) {
|
|
92936
|
-
if (!stderr.trim()) {
|
|
92937
|
-
return "";
|
|
92938
|
-
}
|
|
92939
|
-
const moduleNotFoundMatch = stderr.match(
|
|
92940
|
-
/Error \[ERR_MODULE_NOT_FOUND\]: Cannot find package '([^']+)'/
|
|
92941
|
-
);
|
|
92942
|
-
if (moduleNotFoundMatch) {
|
|
92943
|
-
const packageName2 = moduleNotFoundMatch[1];
|
|
92944
|
-
return `Cannot find package '${packageName2}'. Make sure it's installed in your project dependencies.`;
|
|
92945
|
-
}
|
|
92946
|
-
const syntaxErrorMatch = stderr.match(/SyntaxError: (.+?)(?:\n|$)/);
|
|
92947
|
-
if (syntaxErrorMatch) {
|
|
92948
|
-
return `Syntax error: ${syntaxErrorMatch[1]}`;
|
|
92949
|
-
}
|
|
92950
|
-
const errorMatch = stderr.match(
|
|
92951
|
-
/^(?:Error|TypeError|ReferenceError): (.+?)(?:\n|$)/m
|
|
92952
|
-
);
|
|
92953
|
-
if (errorMatch) {
|
|
92954
|
-
return errorMatch[1];
|
|
92955
|
-
}
|
|
92956
|
-
return stderr.trim();
|
|
92957
|
-
}
|
|
92958
|
-
async function compileVercelConfig(workPath) {
|
|
92959
|
-
const vercelJsonPath = (0, import_path12.join)(workPath, "vercel.json");
|
|
92960
|
-
const nowJsonPath = (0, import_path12.join)(workPath, "now.json");
|
|
92961
|
-
const hasVercelJson = await fileExists(vercelJsonPath);
|
|
92962
|
-
const hasNowJson = await fileExists(nowJsonPath);
|
|
92963
|
-
if (hasVercelJson && hasNowJson) {
|
|
92964
|
-
throw new ConflictingConfigFiles([vercelJsonPath, nowJsonPath]);
|
|
92965
|
-
}
|
|
92966
|
-
if (!process.env.VERCEL_TS_CONFIG_ENABLED) {
|
|
92967
|
-
return {
|
|
92968
|
-
configPath: hasVercelJson ? vercelJsonPath : hasNowJson ? nowJsonPath : null,
|
|
92969
|
-
wasCompiled: false
|
|
92970
|
-
};
|
|
92971
|
-
}
|
|
92972
|
-
const vercelConfigPath = await findVercelConfigFile(workPath);
|
|
92973
|
-
const vercelDir = (0, import_path12.join)(workPath, VERCEL_DIR);
|
|
92974
|
-
const compiledConfigPath = (0, import_path12.join)(vercelDir, "vercel.json");
|
|
92975
|
-
if (vercelConfigPath && hasNowJson) {
|
|
92976
|
-
throw new ConflictingConfigFiles(
|
|
92977
|
-
[vercelConfigPath, nowJsonPath],
|
|
92978
|
-
`Both ${(0, import_path12.basename)(vercelConfigPath)} and now.json exist in your project. Please use only one configuration method.`,
|
|
92979
|
-
"https://vercel.com/docs/projects/project-configuration"
|
|
92980
|
-
);
|
|
92981
|
-
}
|
|
92982
|
-
if (vercelConfigPath && hasVercelJson) {
|
|
92983
|
-
throw new ConflictingConfigFiles(
|
|
92984
|
-
[vercelConfigPath, vercelJsonPath],
|
|
92985
|
-
`Both ${(0, import_path12.basename)(vercelConfigPath)} and vercel.json exist in your project. Please use only one configuration method.`,
|
|
92986
|
-
"https://vercel.com/docs/projects/project-configuration"
|
|
92987
|
-
);
|
|
92988
|
-
}
|
|
92989
|
-
if (!vercelConfigPath) {
|
|
92990
|
-
if (hasVercelJson) {
|
|
92991
|
-
return {
|
|
92992
|
-
configPath: vercelJsonPath,
|
|
92993
|
-
wasCompiled: false
|
|
92994
|
-
};
|
|
92995
|
-
}
|
|
92996
|
-
if (hasNowJson) {
|
|
92997
|
-
return {
|
|
92998
|
-
configPath: nowJsonPath,
|
|
92999
|
-
wasCompiled: false
|
|
93000
|
-
};
|
|
93001
|
-
}
|
|
93002
|
-
if (await fileExists(compiledConfigPath)) {
|
|
93003
|
-
return {
|
|
93004
|
-
configPath: compiledConfigPath,
|
|
93005
|
-
wasCompiled: true,
|
|
93006
|
-
sourceFile: await findSourceVercelConfigFile(workPath) ?? void 0
|
|
93007
|
-
};
|
|
93008
|
-
}
|
|
93009
|
-
return {
|
|
93010
|
-
configPath: null,
|
|
93011
|
-
wasCompiled: false
|
|
93012
|
-
};
|
|
93013
|
-
}
|
|
93014
|
-
(0, import_dotenv.config)({ path: (0, import_path12.join)(workPath, ".env") });
|
|
93015
|
-
(0, import_dotenv.config)({ path: (0, import_path12.join)(workPath, ".env.local") });
|
|
93016
|
-
const tempOutPath = (0, import_path12.join)(vercelDir, "vercel-temp.mjs");
|
|
93017
|
-
const loaderPath = (0, import_path12.join)(vercelDir, "vercel-loader.mjs");
|
|
93018
|
-
try {
|
|
93019
|
-
const { build: build2 } = await import("esbuild");
|
|
93020
|
-
await (0, import_promises.mkdir)(vercelDir, { recursive: true });
|
|
93021
|
-
await build2({
|
|
93022
|
-
entryPoints: [vercelConfigPath],
|
|
93023
|
-
bundle: true,
|
|
93024
|
-
platform: "node",
|
|
93025
|
-
format: "esm",
|
|
93026
|
-
outfile: tempOutPath,
|
|
93027
|
-
packages: "external",
|
|
93028
|
-
target: "node20",
|
|
93029
|
-
sourcemap: "inline"
|
|
93030
|
-
});
|
|
93031
|
-
const loaderScript = `
|
|
93032
|
-
import { pathToFileURL } from 'url';
|
|
93033
|
-
const configModule = await import(pathToFileURL(process.argv[2]).href);
|
|
93034
|
-
const config = ('default' in configModule) ? configModule.default : ('config' in configModule) ? configModule.config : configModule;
|
|
93035
|
-
process.send(config);
|
|
93036
|
-
`;
|
|
93037
|
-
await (0, import_promises.writeFile)(loaderPath, loaderScript, "utf-8");
|
|
93038
|
-
const config2 = await new Promise((resolve13, reject) => {
|
|
93039
|
-
const child = (0, import_child_process3.fork)(loaderPath, [tempOutPath], {
|
|
93040
|
-
stdio: ["pipe", "pipe", "pipe", "ipc"]
|
|
93041
|
-
});
|
|
93042
|
-
let stderrOutput = "";
|
|
93043
|
-
let stdoutOutput = "";
|
|
93044
|
-
if (child.stderr) {
|
|
93045
|
-
child.stderr.on("data", (data) => {
|
|
93046
|
-
stderrOutput += data.toString();
|
|
93047
|
-
});
|
|
93048
|
-
}
|
|
93049
|
-
if (child.stdout) {
|
|
93050
|
-
child.stdout.on("data", (data) => {
|
|
93051
|
-
stdoutOutput += data.toString();
|
|
93052
|
-
});
|
|
93053
|
-
}
|
|
93054
|
-
const timeout = setTimeout(() => {
|
|
93055
|
-
child.kill();
|
|
93056
|
-
reject(new Error("Config loader timed out after 10 seconds"));
|
|
93057
|
-
}, 1e4);
|
|
93058
|
-
child.on("message", (message2) => {
|
|
93059
|
-
clearTimeout(timeout);
|
|
93060
|
-
child.kill();
|
|
93061
|
-
resolve13(message2);
|
|
93062
|
-
});
|
|
93063
|
-
child.on("error", (err) => {
|
|
93064
|
-
clearTimeout(timeout);
|
|
93065
|
-
reject(err);
|
|
93066
|
-
});
|
|
93067
|
-
child.on("exit", (code2) => {
|
|
93068
|
-
clearTimeout(timeout);
|
|
93069
|
-
if (code2 !== 0) {
|
|
93070
|
-
if (stderrOutput.trim()) {
|
|
93071
|
-
output_manager_default.log(stderrOutput);
|
|
93072
|
-
}
|
|
93073
|
-
if (stdoutOutput.trim()) {
|
|
93074
|
-
output_manager_default.log(stdoutOutput);
|
|
93075
|
-
}
|
|
93076
|
-
const parsedError = parseConfigLoaderError(stderrOutput);
|
|
93077
|
-
if (parsedError) {
|
|
93078
|
-
reject(new Error(parsedError));
|
|
93079
|
-
} else if (stdoutOutput.trim()) {
|
|
93080
|
-
reject(new Error(stdoutOutput.trim()));
|
|
93081
|
-
} else {
|
|
93082
|
-
reject(new Error(`Config loader exited with code ${code2}`));
|
|
93083
|
-
}
|
|
93084
|
-
}
|
|
93085
|
-
});
|
|
93086
|
-
});
|
|
93087
|
-
await (0, import_promises.writeFile)(
|
|
93088
|
-
compiledConfigPath,
|
|
93089
|
-
JSON.stringify(config2, null, 2),
|
|
93090
|
-
"utf-8"
|
|
93091
|
-
);
|
|
93092
|
-
output_manager_default.debug(`Compiled ${vercelConfigPath} -> ${compiledConfigPath}`);
|
|
93093
|
-
return {
|
|
93094
|
-
configPath: compiledConfigPath,
|
|
93095
|
-
wasCompiled: true,
|
|
93096
|
-
sourceFile: await findSourceVercelConfigFile(workPath) ?? void 0
|
|
93097
|
-
};
|
|
93098
|
-
} catch (error3) {
|
|
93099
|
-
throw new import_build_utils5.NowBuildError({
|
|
93100
|
-
code: "vercel_ts_compilation_failed",
|
|
93101
|
-
message: `Failed to compile ${vercelConfigPath}: ${error3.message}`,
|
|
93102
|
-
link: "https://vercel.com/docs/projects/project-configuration"
|
|
93103
|
-
});
|
|
93104
|
-
} finally {
|
|
93105
|
-
await Promise.all([
|
|
93106
|
-
(0, import_promises.unlink)(tempOutPath).catch((err) => {
|
|
93107
|
-
if (err.code !== "ENOENT") {
|
|
93108
|
-
output_manager_default.debug(`Failed to cleanup temp file: ${err}`);
|
|
93109
|
-
}
|
|
93110
|
-
}),
|
|
93111
|
-
(0, import_promises.unlink)(loaderPath).catch((err) => {
|
|
93112
|
-
if (err.code !== "ENOENT") {
|
|
93113
|
-
output_manager_default.debug(`Failed to cleanup loader file: ${err}`);
|
|
93114
|
-
}
|
|
93115
|
-
})
|
|
93116
|
-
]);
|
|
93117
|
-
}
|
|
93118
|
-
}
|
|
93119
|
-
async function getVercelConfigPath(workPath) {
|
|
93120
|
-
const vercelJsonPath = (0, import_path12.join)(workPath, "vercel.json");
|
|
93121
|
-
const nowJsonPath = (0, import_path12.join)(workPath, "now.json");
|
|
93122
|
-
const compiledConfigPath = (0, import_path12.join)(workPath, VERCEL_DIR, "vercel.json");
|
|
93123
|
-
if (await fileExists(vercelJsonPath)) {
|
|
93124
|
-
return vercelJsonPath;
|
|
93125
|
-
}
|
|
93126
|
-
if (await fileExists(nowJsonPath)) {
|
|
93127
|
-
return nowJsonPath;
|
|
93128
|
-
}
|
|
93129
|
-
if (await fileExists(compiledConfigPath)) {
|
|
93130
|
-
return compiledConfigPath;
|
|
93131
|
-
}
|
|
93132
|
-
return nowJsonPath;
|
|
93133
|
-
}
|
|
93134
|
-
var import_promises, import_path12, import_child_process3, import_dotenv, import_build_utils5, VERCEL_CONFIG_EXTENSIONS;
|
|
93135
|
-
var init_compile_vercel_config = __esm({
|
|
93136
|
-
"src/util/compile-vercel-config.ts"() {
|
|
93137
|
-
"use strict";
|
|
93138
|
-
import_promises = require("fs/promises");
|
|
93139
|
-
import_path12 = require("path");
|
|
93140
|
-
import_child_process3 = require("child_process");
|
|
93141
|
-
import_dotenv = __toESM3(require_main());
|
|
93142
|
-
init_output_manager();
|
|
93143
|
-
import_build_utils5 = require("@vercel/build-utils");
|
|
93144
|
-
init_link2();
|
|
93145
|
-
init_errors_ts();
|
|
93146
|
-
VERCEL_CONFIG_EXTENSIONS = ["ts", "mts", "js", "mjs", "cjs"];
|
|
93147
|
-
}
|
|
93148
|
-
});
|
|
93149
|
-
|
|
93150
92847
|
// src/util/get-update-command.ts
|
|
93151
92848
|
async function getConfigPrefix() {
|
|
93152
92849
|
const paths = [
|
|
93153
92850
|
process.env.npm_config_userconfig || process.env.NPM_CONFIG_USERCONFIG,
|
|
93154
|
-
(0,
|
|
92851
|
+
(0, import_path13.join)(process.env.HOME || "/", ".npmrc"),
|
|
93155
92852
|
process.env.npm_config_globalconfig || process.env.NPM_CONFIG_GLOBALCONFIG
|
|
93156
92853
|
].filter(Boolean);
|
|
93157
92854
|
for (const configPath of paths) {
|
|
@@ -93170,19 +92867,19 @@ async function getConfigPrefix() {
|
|
|
93170
92867
|
}
|
|
93171
92868
|
async function isGlobal() {
|
|
93172
92869
|
try {
|
|
93173
|
-
if ((0,
|
|
92870
|
+
if ((0, import_path13.dirname)(process.argv[0]) === (0, import_path13.dirname)(process.argv[1])) {
|
|
93174
92871
|
return true;
|
|
93175
92872
|
}
|
|
93176
92873
|
const isWindows = process.platform === "win32";
|
|
93177
92874
|
const defaultPath = isWindows ? process.env.APPDATA : "/usr/local/lib";
|
|
93178
|
-
const installPath = await (0, import_fs_extra9.realpath)((0,
|
|
93179
|
-
if (installPath.includes(["", "yarn", "global", "node_modules", ""].join(
|
|
92875
|
+
const installPath = await (0, import_fs_extra9.realpath)((0, import_path13.resolve)(__dirname));
|
|
92876
|
+
if (installPath.includes(["", "yarn", "global", "node_modules", ""].join(import_path13.sep))) {
|
|
93180
92877
|
return true;
|
|
93181
92878
|
}
|
|
93182
|
-
if (installPath.includes(["", "pnpm", "global", ""].join(
|
|
92879
|
+
if (installPath.includes(["", "pnpm", "global", ""].join(import_path13.sep))) {
|
|
93183
92880
|
return true;
|
|
93184
92881
|
}
|
|
93185
|
-
if (installPath.includes(["", "fnm", "node-versions", ""].join(
|
|
92882
|
+
if (installPath.includes(["", "fnm", "node-versions", ""].join(import_path13.sep))) {
|
|
93186
92883
|
return true;
|
|
93187
92884
|
}
|
|
93188
92885
|
const prefixPath = process.env.PREFIX || process.env.npm_config_prefix || process.env.NPM_CONFIG_PREFIX || await getConfigPrefix() || defaultPath;
|
|
@@ -93197,8 +92894,8 @@ async function isGlobal() {
|
|
|
93197
92894
|
async function getUpdateCommand() {
|
|
93198
92895
|
const pkgAndVersion = `${packageName}@latest`;
|
|
93199
92896
|
const entrypoint = await (0, import_fs_extra9.realpath)(process.argv[1]);
|
|
93200
|
-
let { cliType, lockfilePath } = await (0,
|
|
93201
|
-
(0,
|
|
92897
|
+
let { cliType, lockfilePath } = await (0, import_build_utils5.scanParentDirs)(
|
|
92898
|
+
(0, import_path13.dirname)((0, import_path13.dirname)(entrypoint))
|
|
93202
92899
|
);
|
|
93203
92900
|
if (!lockfilePath) {
|
|
93204
92901
|
cliType = "npm";
|
|
@@ -93214,13 +92911,13 @@ async function getUpdateCommand() {
|
|
|
93214
92911
|
}
|
|
93215
92912
|
return `${cliType} ${install2} ${pkgAndVersion}`;
|
|
93216
92913
|
}
|
|
93217
|
-
var import_fs_extra9,
|
|
92914
|
+
var import_fs_extra9, import_path13, import_build_utils5;
|
|
93218
92915
|
var init_get_update_command = __esm({
|
|
93219
92916
|
"src/util/get-update-command.ts"() {
|
|
93220
92917
|
"use strict";
|
|
93221
92918
|
import_fs_extra9 = __toESM3(require_lib());
|
|
93222
|
-
|
|
93223
|
-
|
|
92919
|
+
import_path13 = require("path");
|
|
92920
|
+
import_build_utils5 = require("@vercel/build-utils");
|
|
93224
92921
|
init_pkg_name();
|
|
93225
92922
|
}
|
|
93226
92923
|
});
|
|
@@ -112907,7 +112604,7 @@ var require_namedTypes = __commonJS2({
|
|
|
112907
112604
|
});
|
|
112908
112605
|
|
|
112909
112606
|
// ../../node_modules/.pnpm/ast-types@0.13.4/node_modules/ast-types/main.js
|
|
112910
|
-
var
|
|
112607
|
+
var require_main = __commonJS2({
|
|
112911
112608
|
"../../node_modules/.pnpm/ast-types@0.13.4/node_modules/ast-types/main.js"(exports2) {
|
|
112912
112609
|
"use strict";
|
|
112913
112610
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -112992,7 +112689,7 @@ var require_degenerator = __commonJS2({
|
|
|
112992
112689
|
var util_1 = require("util");
|
|
112993
112690
|
var escodegen_1 = require_escodegen();
|
|
112994
112691
|
var esprima_1 = require_esprima();
|
|
112995
|
-
var ast_types_1 =
|
|
112692
|
+
var ast_types_1 = require_main();
|
|
112996
112693
|
function degenerator(code2, _names) {
|
|
112997
112694
|
if (!Array.isArray(_names)) {
|
|
112998
112695
|
throw new TypeError('an array of async function "names" is required');
|
|
@@ -124224,7 +123921,7 @@ var require_signals2 = __commonJS2({
|
|
|
124224
123921
|
});
|
|
124225
123922
|
|
|
124226
123923
|
// ../../node_modules/.pnpm/human-signals@1.1.1/node_modules/human-signals/build/src/main.js
|
|
124227
|
-
var
|
|
123924
|
+
var require_main2 = __commonJS2({
|
|
124228
123925
|
"../../node_modules/.pnpm/human-signals@1.1.1/node_modules/human-signals/build/src/main.js"(exports2) {
|
|
124229
123926
|
"use strict";
|
|
124230
123927
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -124284,7 +123981,7 @@ var require_main3 = __commonJS2({
|
|
|
124284
123981
|
var require_error3 = __commonJS2({
|
|
124285
123982
|
"../../node_modules/.pnpm/execa@3.2.0/node_modules/execa/lib/error.js"(exports2, module2) {
|
|
124286
123983
|
"use strict";
|
|
124287
|
-
var { signalsByName } =
|
|
123984
|
+
var { signalsByName } = require_main2();
|
|
124288
123985
|
var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode: exitCode2, isCanceled }) => {
|
|
124289
123986
|
if (timedOut) {
|
|
124290
123987
|
return `timed out after ${timeout} milliseconds`;
|
|
@@ -128413,7 +128110,7 @@ async function getDeploymentForAlias(client2, args2, localConfigPath, user, cont
|
|
|
128413
128110
|
output_manager_default.stopSpinner();
|
|
128414
128111
|
}
|
|
128415
128112
|
}
|
|
128416
|
-
const appName = localConfig?.name ||
|
|
128113
|
+
const appName = localConfig?.name || import_path15.default.basename(import_path15.default.resolve(process.cwd(), localConfigPath || ""));
|
|
128417
128114
|
if (!appName) {
|
|
128418
128115
|
return null;
|
|
128419
128116
|
}
|
|
@@ -128423,11 +128120,11 @@ async function getDeploymentForAlias(client2, args2, localConfigPath, user, cont
|
|
|
128423
128120
|
output_manager_default.stopSpinner();
|
|
128424
128121
|
}
|
|
128425
128122
|
}
|
|
128426
|
-
var
|
|
128123
|
+
var import_path15, import_chalk38;
|
|
128427
128124
|
var init_get_deployment_by_alias = __esm({
|
|
128428
128125
|
"src/util/alias/get-deployment-by-alias.ts"() {
|
|
128429
128126
|
"use strict";
|
|
128430
|
-
|
|
128127
|
+
import_path15 = __toESM3(require("path"));
|
|
128431
128128
|
import_chalk38 = __toESM3(require_source());
|
|
128432
128129
|
init_get_deployments_by_appname();
|
|
128433
128130
|
init_get_deployment();
|
|
@@ -129970,7 +129667,7 @@ async function bisect(client2) {
|
|
|
129970
129667
|
let run = parsedArgs.flags["--run"] || "";
|
|
129971
129668
|
const openEnabled = parsedArgs.flags["--open"] || false;
|
|
129972
129669
|
if (run) {
|
|
129973
|
-
run = (0,
|
|
129670
|
+
run = (0, import_path16.resolve)(run);
|
|
129974
129671
|
}
|
|
129975
129672
|
bad = normalizeURL(bad);
|
|
129976
129673
|
let parsed = (0, import_url8.parse)(bad);
|
|
@@ -130198,14 +129895,14 @@ function getCommit(deployment) {
|
|
|
130198
129895
|
const message2 = deployment.meta?.githubCommitMessage || deployment.meta?.gitlabCommitMessage || deployment.meta?.bitbucketCommitMessage;
|
|
130199
129896
|
return { sha, message: message2 };
|
|
130200
129897
|
}
|
|
130201
|
-
var import_open2, import_execa2, import_pluralize3,
|
|
129898
|
+
var import_open2, import_execa2, import_pluralize3, import_path16, import_chalk43, import_url8;
|
|
130202
129899
|
var init_bisect2 = __esm({
|
|
130203
129900
|
"src/commands/bisect/index.ts"() {
|
|
130204
129901
|
"use strict";
|
|
130205
129902
|
import_open2 = __toESM3(require_open());
|
|
130206
129903
|
import_execa2 = __toESM3(require_execa());
|
|
130207
129904
|
import_pluralize3 = __toESM3(require_pluralize());
|
|
130208
|
-
|
|
129905
|
+
import_path16 = require("path");
|
|
130209
129906
|
import_chalk43 = __toESM3(require_source());
|
|
130210
129907
|
import_url8 = require("url");
|
|
130211
129908
|
init_box();
|
|
@@ -130563,7 +130260,7 @@ async function put2(client2, argv, rwToken) {
|
|
|
130563
130260
|
const stats = (0, import_node_fs.statSync)(filePath);
|
|
130564
130261
|
const isFile2 = stats.isFile();
|
|
130565
130262
|
if (isFile2) {
|
|
130566
|
-
const file = await (0,
|
|
130263
|
+
const file = await (0, import_promises.open)(filePath, "r");
|
|
130567
130264
|
putBody = file.createReadStream();
|
|
130568
130265
|
pathname = pathnameFlag ?? (0, import_node_path.basename)(filePath);
|
|
130569
130266
|
} else {
|
|
@@ -130611,7 +130308,7 @@ async function put2(client2, argv, rwToken) {
|
|
|
130611
130308
|
output_manager_default.success(result.url);
|
|
130612
130309
|
return 0;
|
|
130613
130310
|
}
|
|
130614
|
-
var blob2, import_node_fs,
|
|
130311
|
+
var blob2, import_node_fs, import_promises, import_error_utils13, import_node_path, import_chalk45;
|
|
130615
130312
|
var init_put2 = __esm({
|
|
130616
130313
|
"src/commands/blob/put.ts"() {
|
|
130617
130314
|
"use strict";
|
|
@@ -130621,7 +130318,7 @@ var init_put2 = __esm({
|
|
|
130621
130318
|
init_get_flags_specification();
|
|
130622
130319
|
init_command40();
|
|
130623
130320
|
import_node_fs = require("fs");
|
|
130624
|
-
|
|
130321
|
+
import_promises = require("fs/promises");
|
|
130625
130322
|
import_error_utils13 = __toESM3(require_dist2());
|
|
130626
130323
|
import_node_path = require("path");
|
|
130627
130324
|
init_pkg_name();
|
|
@@ -133761,6 +133458,55 @@ var init_blob2 = __esm({
|
|
|
133761
133458
|
}
|
|
133762
133459
|
});
|
|
133763
133460
|
|
|
133461
|
+
// ../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js
|
|
133462
|
+
var require_main3 = __commonJS2({
|
|
133463
|
+
"../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
133464
|
+
"use strict";
|
|
133465
|
+
var fs15 = require("fs");
|
|
133466
|
+
function parse11(src) {
|
|
133467
|
+
var obj = {};
|
|
133468
|
+
src.toString().split("\n").forEach(function(line) {
|
|
133469
|
+
var keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);
|
|
133470
|
+
if (keyValueArr != null) {
|
|
133471
|
+
var key = keyValueArr[1];
|
|
133472
|
+
var value = keyValueArr[2] ? keyValueArr[2] : "";
|
|
133473
|
+
var len = value ? value.length : 0;
|
|
133474
|
+
if (len > 0 && value.charAt(0) === '"' && value.charAt(len - 1) === '"') {
|
|
133475
|
+
value = value.replace(/\\n/gm, "\n");
|
|
133476
|
+
}
|
|
133477
|
+
value = value.replace(/(^['"]|['"]$)/g, "").trim();
|
|
133478
|
+
obj[key] = value;
|
|
133479
|
+
}
|
|
133480
|
+
});
|
|
133481
|
+
return obj;
|
|
133482
|
+
}
|
|
133483
|
+
function config2(options) {
|
|
133484
|
+
var path11 = ".env";
|
|
133485
|
+
var encoding = "utf8";
|
|
133486
|
+
if (options) {
|
|
133487
|
+
if (options.path) {
|
|
133488
|
+
path11 = options.path;
|
|
133489
|
+
}
|
|
133490
|
+
if (options.encoding) {
|
|
133491
|
+
encoding = options.encoding;
|
|
133492
|
+
}
|
|
133493
|
+
}
|
|
133494
|
+
try {
|
|
133495
|
+
var parsedObj = parse11(fs15.readFileSync(path11, { encoding }));
|
|
133496
|
+
Object.keys(parsedObj).forEach(function(key) {
|
|
133497
|
+
process.env[key] = process.env[key] || parsedObj[key];
|
|
133498
|
+
});
|
|
133499
|
+
return { parsed: parsedObj };
|
|
133500
|
+
} catch (e2) {
|
|
133501
|
+
return { error: e2 };
|
|
133502
|
+
}
|
|
133503
|
+
}
|
|
133504
|
+
module2.exports.config = config2;
|
|
133505
|
+
module2.exports.load = config2;
|
|
133506
|
+
module2.exports.parse = parse11;
|
|
133507
|
+
}
|
|
133508
|
+
});
|
|
133509
|
+
|
|
133764
133510
|
// ../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js
|
|
133765
133511
|
var require_dist21 = __commonJS2({
|
|
133766
133512
|
"../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js"(exports2) {
|
|
@@ -136202,7 +135948,7 @@ async function initCorepack({
|
|
|
136202
135948
|
return null;
|
|
136203
135949
|
}
|
|
136204
135950
|
const pkg = await readJSONFile(
|
|
136205
|
-
(0,
|
|
135951
|
+
(0, import_path17.join)(repoRootPath, "package.json")
|
|
136206
135952
|
);
|
|
136207
135953
|
if (pkg instanceof CantParseJSONFile) {
|
|
136208
135954
|
output_manager_default.warn(
|
|
@@ -136217,15 +135963,15 @@ async function initCorepack({
|
|
|
136217
135963
|
output_manager_default.log(
|
|
136218
135964
|
`Detected ENABLE_EXPERIMENTAL_COREPACK=1 and "${pkg.packageManager}" in package.json`
|
|
136219
135965
|
);
|
|
136220
|
-
const corepackRootDir = (0,
|
|
136221
|
-
const corepackHomeDir = (0,
|
|
136222
|
-
const corepackShimDir = (0,
|
|
135966
|
+
const corepackRootDir = (0, import_path17.join)(repoRootPath, VERCEL_DIR, "cache", "corepack");
|
|
135967
|
+
const corepackHomeDir = (0, import_path17.join)(corepackRootDir, "home");
|
|
135968
|
+
const corepackShimDir = (0, import_path17.join)(corepackRootDir, "shim");
|
|
136223
135969
|
await import_fs_extra10.default.mkdirp(corepackHomeDir);
|
|
136224
135970
|
await import_fs_extra10.default.mkdirp(corepackShimDir);
|
|
136225
135971
|
process.env.COREPACK_HOME = corepackHomeDir;
|
|
136226
|
-
process.env.PATH = `${corepackShimDir}${
|
|
135972
|
+
process.env.PATH = `${corepackShimDir}${import_path17.delimiter}${process.env.PATH}`;
|
|
136227
135973
|
const pkgManagerName = pkg.packageManager.split("@")[0];
|
|
136228
|
-
await (0,
|
|
135974
|
+
await (0, import_build_utils7.spawnAsync)(
|
|
136229
135975
|
"corepack",
|
|
136230
135976
|
["enable", pkgManagerName, "--install-directory", corepackShimDir],
|
|
136231
135977
|
{
|
|
@@ -136242,17 +135988,17 @@ function cleanupCorepack(corepackShimDir) {
|
|
|
136242
135988
|
}
|
|
136243
135989
|
if (process.env.PATH) {
|
|
136244
135990
|
process.env.PATH = process.env.PATH.replace(
|
|
136245
|
-
`${corepackShimDir}${
|
|
135991
|
+
`${corepackShimDir}${import_path17.delimiter}`,
|
|
136246
135992
|
""
|
|
136247
135993
|
);
|
|
136248
135994
|
}
|
|
136249
135995
|
}
|
|
136250
|
-
var
|
|
135996
|
+
var import_path17, import_build_utils7, import_fs_extra10;
|
|
136251
135997
|
var init_corepack = __esm({
|
|
136252
135998
|
"src/util/build/corepack.ts"() {
|
|
136253
135999
|
"use strict";
|
|
136254
|
-
|
|
136255
|
-
|
|
136000
|
+
import_path17 = require("path");
|
|
136001
|
+
import_build_utils7 = require("@vercel/build-utils");
|
|
136256
136002
|
import_fs_extra10 = __toESM3(require_lib());
|
|
136257
136003
|
init_errors_ts();
|
|
136258
136004
|
init_link2();
|
|
@@ -137128,12 +136874,12 @@ __export3(static_builder_exports, {
|
|
|
137128
136874
|
shouldServe: () => shouldServe,
|
|
137129
136875
|
version: () => version
|
|
137130
136876
|
});
|
|
137131
|
-
var import_minimatch,
|
|
136877
|
+
var import_minimatch, import_build_utils8, version, build, shouldServe;
|
|
137132
136878
|
var init_static_builder = __esm({
|
|
137133
136879
|
"src/util/build/static-builder.ts"() {
|
|
137134
136880
|
"use strict";
|
|
137135
136881
|
import_minimatch = __toESM3(require_minimatch2());
|
|
137136
|
-
|
|
136882
|
+
import_build_utils8 = require("@vercel/build-utils");
|
|
137137
136883
|
version = 2;
|
|
137138
136884
|
build = async ({ entrypoint, files, config: config2 }) => {
|
|
137139
136885
|
const output2 = {};
|
|
@@ -137164,14 +136910,14 @@ var init_static_builder = __esm({
|
|
|
137164
136910
|
opts.entrypoint = `${outputDirectory}/${opts.entrypoint}`;
|
|
137165
136911
|
opts.requestPath = `${outputDirectory}/${opts.requestPath}`;
|
|
137166
136912
|
}
|
|
137167
|
-
return (0,
|
|
136913
|
+
return (0, import_build_utils8.shouldServe)(opts);
|
|
137168
136914
|
};
|
|
137169
136915
|
}
|
|
137170
136916
|
});
|
|
137171
136917
|
|
|
137172
136918
|
// src/util/build/import-builders.ts
|
|
137173
136919
|
async function importBuilders(builderSpecs, cwd) {
|
|
137174
|
-
const buildersDir = (0,
|
|
136920
|
+
const buildersDir = (0, import_path18.join)(cwd, VERCEL_DIR, "builders");
|
|
137175
136921
|
let importResult = await resolveBuilders(buildersDir, builderSpecs);
|
|
137176
136922
|
if ("buildersToAdd" in importResult) {
|
|
137177
136923
|
const installResult = await installBuilders(
|
|
@@ -137213,7 +136959,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
137213
136959
|
let pkgPath;
|
|
137214
136960
|
let builderPkg;
|
|
137215
136961
|
try {
|
|
137216
|
-
pkgPath = (0,
|
|
136962
|
+
pkgPath = (0, import_path18.join)(buildersDir, "node_modules", name, "package.json");
|
|
137217
136963
|
builderPkg = await (0, import_fs_extra11.readJSON)(pkgPath);
|
|
137218
136964
|
} catch (error3) {
|
|
137219
136965
|
if (!(0, import_error_utils14.isErrnoException)(error3)) {
|
|
@@ -137249,7 +136995,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
137249
136995
|
buildersToAdd.add(spec);
|
|
137250
136996
|
continue;
|
|
137251
136997
|
}
|
|
137252
|
-
const path11 = (0,
|
|
136998
|
+
const path11 = (0, import_path18.join)((0, import_path18.dirname)(pkgPath), builderPkg.main || "index.js");
|
|
137253
136999
|
const builder = require_(path11);
|
|
137254
137000
|
builders.set(spec, {
|
|
137255
137001
|
builder,
|
|
@@ -137260,7 +137006,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
137260
137006
|
path: path11,
|
|
137261
137007
|
pkgPath
|
|
137262
137008
|
});
|
|
137263
|
-
output_manager_default.debug(`Imported Builder "${name}" from "${(0,
|
|
137009
|
+
output_manager_default.debug(`Imported Builder "${name}" from "${(0, import_path18.dirname)(pkgPath)}"`);
|
|
137264
137010
|
} catch (err) {
|
|
137265
137011
|
if (err.code === "MODULE_NOT_FOUND" && !resolvedSpecs) {
|
|
137266
137012
|
output_manager_default.debug(`Failed to import "${name}": ${err}`);
|
|
@@ -137278,7 +137024,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
137278
137024
|
}
|
|
137279
137025
|
async function installBuilders(buildersDir, buildersToAdd) {
|
|
137280
137026
|
const resolvedSpecs = /* @__PURE__ */ new Map();
|
|
137281
|
-
const buildersPkgPath = (0,
|
|
137027
|
+
const buildersPkgPath = (0, import_path18.join)(buildersDir, "package.json");
|
|
137282
137028
|
try {
|
|
137283
137029
|
const emptyPkgJson = {
|
|
137284
137030
|
private: true,
|
|
@@ -137330,10 +137076,10 @@ async function installBuilders(buildersDir, buildersToAdd) {
|
|
|
137330
137076
|
}
|
|
137331
137077
|
throw err;
|
|
137332
137078
|
}
|
|
137333
|
-
const nowScopePath = (0,
|
|
137079
|
+
const nowScopePath = (0, import_path18.join)(buildersDir, "node_modules/@now");
|
|
137334
137080
|
await (0, import_fs_extra11.mkdirp)(nowScopePath);
|
|
137335
137081
|
try {
|
|
137336
|
-
await (0, import_fs_extra11.symlink)("../@vercel/build-utils", (0,
|
|
137082
|
+
await (0, import_fs_extra11.symlink)("../@vercel/build-utils", (0, import_path18.join)(nowScopePath, "build-utils"));
|
|
137337
137083
|
} catch (err) {
|
|
137338
137084
|
if (!(0, import_error_utils14.isErrnoException)(err) || err.code !== "EEXIST") {
|
|
137339
137085
|
throw err;
|
|
@@ -137366,7 +137112,7 @@ function getErrorMessage(err, execaMessage) {
|
|
|
137366
137112
|
}
|
|
137367
137113
|
return execaMessage;
|
|
137368
137114
|
}
|
|
137369
|
-
var import_url9, import_pluralize4, import_npm_package_arg, import_semver2,
|
|
137115
|
+
var import_url9, import_pluralize4, import_npm_package_arg, import_semver2, import_path18, import_module2, import_fs_extra11, import_fs_detectors2, import_execa3, import_error_utils14, require_;
|
|
137370
137116
|
var init_import_builders = __esm({
|
|
137371
137117
|
"src/util/build/import-builders.ts"() {
|
|
137372
137118
|
"use strict";
|
|
@@ -137374,7 +137120,7 @@ var init_import_builders = __esm({
|
|
|
137374
137120
|
import_pluralize4 = __toESM3(require_pluralize());
|
|
137375
137121
|
import_npm_package_arg = __toESM3(require_npa());
|
|
137376
137122
|
import_semver2 = __toESM3(require_semver());
|
|
137377
|
-
|
|
137123
|
+
import_path18 = require("path");
|
|
137378
137124
|
import_module2 = require("module");
|
|
137379
137125
|
import_fs_extra11 = __toESM3(require_lib());
|
|
137380
137126
|
import_fs_detectors2 = __toESM3(require_dist8());
|
|
@@ -137394,11 +137140,11 @@ var init_import_builders = __esm({
|
|
|
137394
137140
|
// src/util/build/monorepo.ts
|
|
137395
137141
|
async function setMonorepoDefaultSettings(cwd, workPath, projectSettings) {
|
|
137396
137142
|
const localFileSystem = new import_fs_detectors3.LocalFileSystemDetector(cwd);
|
|
137397
|
-
const projectName = (0,
|
|
137398
|
-
const relativeToRoot = (0,
|
|
137143
|
+
const projectName = (0, import_path19.basename)(workPath);
|
|
137144
|
+
const relativeToRoot = (0, import_path19.relative)(workPath, cwd);
|
|
137399
137145
|
const setCommand = (command, value) => {
|
|
137400
137146
|
if (projectSettings[command]) {
|
|
137401
|
-
(0,
|
|
137147
|
+
(0, import_build_utils9.debug)(
|
|
137402
137148
|
`Skipping auto-assignment of ${command} as it is already set via project settings or configuration overrides.`
|
|
137403
137149
|
);
|
|
137404
137150
|
} else {
|
|
@@ -137408,7 +137154,7 @@ async function setMonorepoDefaultSettings(cwd, workPath, projectSettings) {
|
|
|
137408
137154
|
try {
|
|
137409
137155
|
const result = await (0, import_fs_detectors3.getMonorepoDefaultSettings)(
|
|
137410
137156
|
projectName,
|
|
137411
|
-
(0,
|
|
137157
|
+
(0, import_path19.relative)(cwd, workPath),
|
|
137412
137158
|
relativeToRoot,
|
|
137413
137159
|
localFileSystem
|
|
137414
137160
|
);
|
|
@@ -137439,14 +137185,14 @@ async function setMonorepoDefaultSettings(cwd, workPath, projectSettings) {
|
|
|
137439
137185
|
throw error3;
|
|
137440
137186
|
}
|
|
137441
137187
|
}
|
|
137442
|
-
var
|
|
137188
|
+
var import_path19, import_fs_detectors3, import_title3, import_build_utils9;
|
|
137443
137189
|
var init_monorepo = __esm({
|
|
137444
137190
|
"src/util/build/monorepo.ts"() {
|
|
137445
137191
|
"use strict";
|
|
137446
|
-
|
|
137192
|
+
import_path19 = require("path");
|
|
137447
137193
|
import_fs_detectors3 = __toESM3(require_dist8());
|
|
137448
137194
|
import_title3 = __toESM3(require_lib4());
|
|
137449
|
-
|
|
137195
|
+
import_build_utils9 = require("@vercel/build-utils");
|
|
137450
137196
|
init_output_manager();
|
|
137451
137197
|
}
|
|
137452
137198
|
});
|
|
@@ -145506,7 +145252,7 @@ var require_promisepipe = __commonJS2({
|
|
|
145506
145252
|
async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
145507
145253
|
const root = sourceRoot || source;
|
|
145508
145254
|
if (ignoreFilter) {
|
|
145509
|
-
const relPath = (0,
|
|
145255
|
+
const relPath = (0, import_path20.relative)(root, source);
|
|
145510
145256
|
if (relPath && !ignoreFilter(relPath)) {
|
|
145511
145257
|
await (0, import_fs_extra12.remove)(source);
|
|
145512
145258
|
return;
|
|
@@ -145532,7 +145278,7 @@ async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
|
145532
145278
|
} else {
|
|
145533
145279
|
await Promise.all(
|
|
145534
145280
|
contents.map(
|
|
145535
|
-
(name) => merge((0,
|
|
145281
|
+
(name) => merge((0, import_path20.join)(source, name), (0, import_path20.join)(destination, name), ignoreFilter, root)
|
|
145536
145282
|
)
|
|
145537
145283
|
);
|
|
145538
145284
|
await (0, import_fs_extra12.rmdir)(source);
|
|
@@ -145542,11 +145288,11 @@ async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
|
145542
145288
|
await (0, import_fs_extra12.remove)(destination);
|
|
145543
145289
|
await (0, import_fs_extra12.move)(source, destination);
|
|
145544
145290
|
}
|
|
145545
|
-
var
|
|
145291
|
+
var import_path20, import_error_utils15, import_fs_extra12;
|
|
145546
145292
|
var init_merge = __esm({
|
|
145547
145293
|
"src/util/build/merge.ts"() {
|
|
145548
145294
|
"use strict";
|
|
145549
|
-
|
|
145295
|
+
import_path20 = require("path");
|
|
145550
145296
|
import_error_utils15 = __toESM3(require_dist2());
|
|
145551
145297
|
import_fs_extra12 = __toESM3(require_lib());
|
|
145552
145298
|
}
|
|
@@ -147449,11 +147195,11 @@ async function unzip(buffer, dir) {
|
|
|
147449
147195
|
if (entry.fileName.startsWith("__MACOSX/"))
|
|
147450
147196
|
continue;
|
|
147451
147197
|
try {
|
|
147452
|
-
const destDir =
|
|
147198
|
+
const destDir = import_path21.default.dirname(import_path21.default.join(dir, entry.fileName));
|
|
147453
147199
|
await fs6.mkdirp(destDir);
|
|
147454
147200
|
const canonicalDestDir = await fs6.realpath(destDir);
|
|
147455
|
-
const relativeDestDir =
|
|
147456
|
-
if (relativeDestDir.split(
|
|
147201
|
+
const relativeDestDir = import_path21.default.relative(dir, canonicalDestDir);
|
|
147202
|
+
if (relativeDestDir.split(import_path21.default.sep).includes("..")) {
|
|
147457
147203
|
throw new Error(
|
|
147458
147204
|
`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`
|
|
147459
147205
|
);
|
|
@@ -147466,7 +147212,7 @@ async function unzip(buffer, dir) {
|
|
|
147466
147212
|
}
|
|
147467
147213
|
}
|
|
147468
147214
|
async function extractEntry(zipFile, entry, dir) {
|
|
147469
|
-
const dest =
|
|
147215
|
+
const dest = import_path21.default.join(dir, entry.fileName);
|
|
147470
147216
|
const mode = entry.externalFileAttributes >> 16 & 65535;
|
|
147471
147217
|
const IFMT = 61440;
|
|
147472
147218
|
const IFDIR = 16384;
|
|
@@ -147480,7 +147226,7 @@ async function extractEntry(zipFile, entry, dir) {
|
|
|
147480
147226
|
if (!isDir)
|
|
147481
147227
|
isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
|
147482
147228
|
const procMode = getExtractedMode(mode, isDir) & 511;
|
|
147483
|
-
const destDir = isDir ? dest :
|
|
147229
|
+
const destDir = isDir ? dest : import_path21.default.dirname(dest);
|
|
147484
147230
|
const mkdirOptions = { recursive: true };
|
|
147485
147231
|
if (isDir) {
|
|
147486
147232
|
mkdirOptions.mode = procMode;
|
|
@@ -147490,7 +147236,7 @@ async function extractEntry(zipFile, entry, dir) {
|
|
|
147490
147236
|
return;
|
|
147491
147237
|
const readStream = await zipFile.openReadStream(entry);
|
|
147492
147238
|
if (symlink3) {
|
|
147493
|
-
const link4 = await (0,
|
|
147239
|
+
const link4 = await (0, import_build_utils10.streamToBuffer)(readStream);
|
|
147494
147240
|
await fs6.symlink(link4.toString("utf8"), dest);
|
|
147495
147241
|
} else {
|
|
147496
147242
|
await (0, import_promisepipe.default)(readStream, fs6.createWriteStream(dest, { mode: procMode }));
|
|
@@ -147507,14 +147253,14 @@ function getExtractedMode(entryMode, isDir) {
|
|
|
147507
147253
|
}
|
|
147508
147254
|
return mode;
|
|
147509
147255
|
}
|
|
147510
|
-
var
|
|
147256
|
+
var import_path21, import_promisepipe, fs6, import_build_utils10, import_yauzl_promise;
|
|
147511
147257
|
var init_unzip = __esm({
|
|
147512
147258
|
"src/util/build/unzip.ts"() {
|
|
147513
147259
|
"use strict";
|
|
147514
|
-
|
|
147260
|
+
import_path21 = __toESM3(require("path"));
|
|
147515
147261
|
import_promisepipe = __toESM3(require_promisepipe());
|
|
147516
147262
|
fs6 = __toESM3(require_lib());
|
|
147517
|
-
|
|
147263
|
+
import_build_utils10 = require("@vercel/build-utils");
|
|
147518
147264
|
import_yauzl_promise = __toESM3(require_lib14());
|
|
147519
147265
|
}
|
|
147520
147266
|
});
|
|
@@ -147533,7 +147279,7 @@ async function writeBuildResult(args2) {
|
|
|
147533
147279
|
workPath
|
|
147534
147280
|
} = args2;
|
|
147535
147281
|
let version2 = builder.version;
|
|
147536
|
-
if ((0,
|
|
147282
|
+
if ((0, import_build_utils11.isExperimentalBackendsEnabled)() && "output" in buildResult) {
|
|
147537
147283
|
version2 = 2;
|
|
147538
147284
|
}
|
|
147539
147285
|
if (typeof version2 !== "number" || version2 === 2) {
|
|
@@ -147631,7 +147377,7 @@ async function writeBuildResultV2(args2) {
|
|
|
147631
147377
|
if (fallback) {
|
|
147632
147378
|
const ext = getFileExtension(fallback);
|
|
147633
147379
|
const fallbackName = `${normalizedPath}.prerender-fallback${ext}`;
|
|
147634
|
-
const fallbackPath = (0,
|
|
147380
|
+
const fallbackPath = (0, import_path22.join)(outputDir, "functions", fallbackName);
|
|
147635
147381
|
let usedHardLink = false;
|
|
147636
147382
|
if ("fsPath" in fallback) {
|
|
147637
147383
|
try {
|
|
@@ -147647,12 +147393,12 @@ async function writeBuildResultV2(args2) {
|
|
|
147647
147393
|
import_fs_extra13.default.createWriteStream(fallbackPath, { mode: fallback.mode })
|
|
147648
147394
|
);
|
|
147649
147395
|
}
|
|
147650
|
-
fallback = new
|
|
147396
|
+
fallback = new import_build_utils11.FileFsRef({
|
|
147651
147397
|
...output2.fallback,
|
|
147652
|
-
fsPath: (0,
|
|
147398
|
+
fsPath: (0, import_path22.basename)(fallbackName)
|
|
147653
147399
|
});
|
|
147654
147400
|
}
|
|
147655
|
-
const prerenderConfigPath = (0,
|
|
147401
|
+
const prerenderConfigPath = (0, import_path22.join)(
|
|
147656
147402
|
outputDir,
|
|
147657
147403
|
"functions",
|
|
147658
147404
|
`${normalizedPath}.prerender-config.json`
|
|
@@ -147699,8 +147445,8 @@ async function writeBuildResultV3(args2) {
|
|
|
147699
147445
|
workPath
|
|
147700
147446
|
} = args2;
|
|
147701
147447
|
const { output: output2 } = buildResult;
|
|
147702
|
-
const routesJsonPath = (0,
|
|
147703
|
-
if (((0,
|
|
147448
|
+
const routesJsonPath = (0, import_path22.join)(workPath, ".vercel", "routes.json");
|
|
147449
|
+
if (((0, import_build_utils11.isBackendBuilder)(build2) || build2.use === "@vercel/python") && (0, import_fs_extra13.existsSync)(routesJsonPath)) {
|
|
147704
147450
|
try {
|
|
147705
147451
|
const newOutput = {
|
|
147706
147452
|
index: output2
|
|
@@ -147733,11 +147479,11 @@ async function writeBuildResultV3(args2) {
|
|
|
147733
147479
|
if (typeof src !== "string") {
|
|
147734
147480
|
throw new Error(`Expected "build.src" to be a string`);
|
|
147735
147481
|
}
|
|
147736
|
-
const functionConfiguration = vercelConfig ? await (0,
|
|
147482
|
+
const functionConfiguration = vercelConfig ? await (0, import_build_utils11.getLambdaOptionsFromFunction)({
|
|
147737
147483
|
sourceFile: src,
|
|
147738
147484
|
config: vercelConfig
|
|
147739
147485
|
}) : {};
|
|
147740
|
-
const ext = (0,
|
|
147486
|
+
const ext = (0, import_path22.extname)(src);
|
|
147741
147487
|
const path11 = stripDuplicateSlashes(
|
|
147742
147488
|
build2.config?.zeroConfig ? src.substring(0, src.length - ext.length) : src
|
|
147743
147489
|
);
|
|
@@ -147770,7 +147516,7 @@ async function writeStaticFile(outputDir, file, path11, overrides, cleanUrls = f
|
|
|
147770
147516
|
let fsPath = path11;
|
|
147771
147517
|
let override = null;
|
|
147772
147518
|
const ext = getFileExtension(file);
|
|
147773
|
-
if (ext && (0,
|
|
147519
|
+
if (ext && (0, import_path22.extname)(path11) !== ext) {
|
|
147774
147520
|
fsPath += ext;
|
|
147775
147521
|
if (!override)
|
|
147776
147522
|
override = {};
|
|
@@ -147789,29 +147535,29 @@ async function writeStaticFile(outputDir, file, path11, overrides, cleanUrls = f
|
|
|
147789
147535
|
if (override) {
|
|
147790
147536
|
overrides[fsPath] = override;
|
|
147791
147537
|
}
|
|
147792
|
-
const dest = (0,
|
|
147793
|
-
await import_fs_extra13.default.mkdirp((0,
|
|
147538
|
+
const dest = (0, import_path22.join)(outputDir, "static", fsPath);
|
|
147539
|
+
await import_fs_extra13.default.mkdirp((0, import_path22.dirname)(dest));
|
|
147794
147540
|
if ("fsPath" in file) {
|
|
147795
147541
|
try {
|
|
147796
147542
|
return await import_fs_extra13.default.link(file.fsPath, dest);
|
|
147797
147543
|
} catch (_) {
|
|
147798
147544
|
}
|
|
147799
147545
|
}
|
|
147800
|
-
await (0,
|
|
147546
|
+
await (0, import_build_utils11.downloadFile)(file, dest);
|
|
147801
147547
|
}
|
|
147802
147548
|
async function writeFunctionSymlink(outputDir, dest, fn2, existingFunctions) {
|
|
147803
147549
|
const existingPath = existingFunctions.get(fn2);
|
|
147804
147550
|
if (!existingPath)
|
|
147805
147551
|
return false;
|
|
147806
|
-
const destDir = (0,
|
|
147807
|
-
const targetDest = (0,
|
|
147808
|
-
const target = (0,
|
|
147552
|
+
const destDir = (0, import_path22.dirname)(dest);
|
|
147553
|
+
const targetDest = (0, import_path22.join)(outputDir, "functions", `${existingPath}.func`);
|
|
147554
|
+
const target = (0, import_path22.relative)(destDir, targetDest);
|
|
147809
147555
|
await import_fs_extra13.default.mkdirp(destDir);
|
|
147810
147556
|
await import_fs_extra13.default.symlink(target, dest);
|
|
147811
147557
|
return true;
|
|
147812
147558
|
}
|
|
147813
147559
|
async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path11, existingFunctions, standalone = false) {
|
|
147814
|
-
const dest = (0,
|
|
147560
|
+
const dest = (0, import_path22.join)(outputDir, "functions", `${path11}.func`);
|
|
147815
147561
|
if (existingFunctions) {
|
|
147816
147562
|
if (await writeFunctionSymlink(
|
|
147817
147563
|
outputDir,
|
|
@@ -147825,26 +147571,26 @@ async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path11,
|
|
|
147825
147571
|
}
|
|
147826
147572
|
await import_fs_extra13.default.mkdirp(dest);
|
|
147827
147573
|
const ops = [];
|
|
147828
|
-
const sharedDest = (0,
|
|
147574
|
+
const sharedDest = (0, import_path22.join)(outputDir, "shared");
|
|
147829
147575
|
const { files, filePathMap, shared } = filesWithoutFsRefs(
|
|
147830
147576
|
edgeFunction.files,
|
|
147831
147577
|
repoRootPath,
|
|
147832
147578
|
sharedDest,
|
|
147833
147579
|
standalone
|
|
147834
147580
|
);
|
|
147835
|
-
ops.push((0,
|
|
147581
|
+
ops.push((0, import_build_utils11.download)(files, dest));
|
|
147836
147582
|
if (shared) {
|
|
147837
|
-
ops.push((0,
|
|
147583
|
+
ops.push((0, import_build_utils11.download)(shared, sharedDest));
|
|
147838
147584
|
}
|
|
147839
147585
|
const config2 = {
|
|
147840
147586
|
runtime: "edge",
|
|
147841
147587
|
...edgeFunction,
|
|
147842
|
-
entrypoint: (0,
|
|
147588
|
+
entrypoint: (0, import_build_utils11.normalizePath)(edgeFunction.entrypoint),
|
|
147843
147589
|
filePathMap,
|
|
147844
147590
|
files: void 0,
|
|
147845
147591
|
type: void 0
|
|
147846
147592
|
};
|
|
147847
|
-
const configPath = (0,
|
|
147593
|
+
const configPath = (0, import_path22.join)(dest, ".vc-config.json");
|
|
147848
147594
|
ops.push(
|
|
147849
147595
|
import_fs_extra13.default.writeJSON(configPath, config2, {
|
|
147850
147596
|
spaces: 2
|
|
@@ -147853,7 +147599,7 @@ async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path11,
|
|
|
147853
147599
|
await Promise.all(ops);
|
|
147854
147600
|
}
|
|
147855
147601
|
async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConfiguration, existingFunctions, standalone = false) {
|
|
147856
|
-
const dest = (0,
|
|
147602
|
+
const dest = (0, import_path22.join)(outputDir, "functions", `${path11}.func`);
|
|
147857
147603
|
if (existingFunctions) {
|
|
147858
147604
|
if (await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)) {
|
|
147859
147605
|
return;
|
|
@@ -147864,7 +147610,7 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147864
147610
|
const ops = [];
|
|
147865
147611
|
let filePathMap;
|
|
147866
147612
|
if (lambda.files) {
|
|
147867
|
-
const sharedDest = (0,
|
|
147613
|
+
const sharedDest = (0, import_path22.join)(outputDir, "shared");
|
|
147868
147614
|
const f = filesWithoutFsRefs(
|
|
147869
147615
|
lambda.files,
|
|
147870
147616
|
repoRootPath,
|
|
@@ -147872,9 +147618,9 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147872
147618
|
standalone
|
|
147873
147619
|
);
|
|
147874
147620
|
filePathMap = f.filePathMap;
|
|
147875
|
-
ops.push((0,
|
|
147621
|
+
ops.push((0, import_build_utils11.download)(f.files, dest));
|
|
147876
147622
|
if (f.shared) {
|
|
147877
|
-
ops.push((0,
|
|
147623
|
+
ops.push((0, import_build_utils11.download)(f.shared, sharedDest));
|
|
147878
147624
|
}
|
|
147879
147625
|
} else if (lambda.zipBuffer) {
|
|
147880
147626
|
ops.push(unzip(lambda.zipBuffer, dest));
|
|
@@ -147888,7 +147634,7 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147888
147634
|
const supportsCancellation = functionConfiguration?.supportsCancellation ?? lambda.supportsCancellation;
|
|
147889
147635
|
const config2 = {
|
|
147890
147636
|
...lambda,
|
|
147891
|
-
handler: (0,
|
|
147637
|
+
handler: (0, import_build_utils11.normalizePath)(lambda.handler),
|
|
147892
147638
|
architecture,
|
|
147893
147639
|
memory,
|
|
147894
147640
|
maxDuration,
|
|
@@ -147899,7 +147645,7 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147899
147645
|
files: void 0,
|
|
147900
147646
|
zipBuffer: void 0
|
|
147901
147647
|
};
|
|
147902
|
-
const configPath = (0,
|
|
147648
|
+
const configPath = (0, import_path22.join)(dest, ".vc-config.json");
|
|
147903
147649
|
ops.push(
|
|
147904
147650
|
import_fs_extra13.default.writeJSON(configPath, config2, {
|
|
147905
147651
|
spaces: 2
|
|
@@ -147907,11 +147653,11 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147907
147653
|
);
|
|
147908
147654
|
await Promise.all(ops);
|
|
147909
147655
|
for await (const dir of findDirs(".vercel", dest)) {
|
|
147910
|
-
const absDir = (0,
|
|
147656
|
+
const absDir = (0, import_path22.join)(dest, dir);
|
|
147911
147657
|
const entries = await import_fs_extra13.default.readdir(absDir);
|
|
147912
147658
|
if (entries.includes("cache")) {
|
|
147913
147659
|
await Promise.all(
|
|
147914
|
-
entries.filter((e2) => e2 !== "cache").map((entry) => import_fs_extra13.default.remove((0,
|
|
147660
|
+
entries.filter((e2) => e2 !== "cache").map((entry) => import_fs_extra13.default.remove((0, import_path22.join)(absDir, entry)))
|
|
147915
147661
|
);
|
|
147916
147662
|
} else {
|
|
147917
147663
|
await import_fs_extra13.default.remove(absDir);
|
|
@@ -147919,11 +147665,11 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147919
147665
|
}
|
|
147920
147666
|
}
|
|
147921
147667
|
async function mergeBuilderOutput(outputDir, buildResult, workPath) {
|
|
147922
|
-
const absOutputDir = (0,
|
|
147668
|
+
const absOutputDir = (0, import_path22.resolve)(outputDir);
|
|
147923
147669
|
const { ig } = await (0, import_client3.getVercelIgnore)(workPath);
|
|
147924
147670
|
const filter = ig.createFilter();
|
|
147925
147671
|
if (absOutputDir === buildResult.buildOutputPath) {
|
|
147926
|
-
const staticDir = (0,
|
|
147672
|
+
const staticDir = (0, import_path22.join)(outputDir, "static");
|
|
147927
147673
|
try {
|
|
147928
147674
|
await cleanIgnoredFiles(staticDir, staticDir, filter);
|
|
147929
147675
|
} catch (err) {
|
|
@@ -147945,9 +147691,9 @@ async function cleanIgnoredFiles(dir, staticRoot, filter) {
|
|
|
147945
147691
|
const entries = await import_fs_extra13.default.readdir(dir);
|
|
147946
147692
|
await Promise.all(
|
|
147947
147693
|
entries.map(async (entry) => {
|
|
147948
|
-
const entryPath = (0,
|
|
147694
|
+
const entryPath = (0, import_path22.join)(dir, entry);
|
|
147949
147695
|
const stat2 = await import_fs_extra13.default.stat(entryPath);
|
|
147950
|
-
const relativePath = (0,
|
|
147696
|
+
const relativePath = (0, import_path22.relative)(staticRoot, entryPath);
|
|
147951
147697
|
if (stat2.isDirectory()) {
|
|
147952
147698
|
await cleanIgnoredFiles(entryPath, staticRoot, filter);
|
|
147953
147699
|
const remaining = await import_fs_extra13.default.readdir(entryPath);
|
|
@@ -147964,7 +147710,7 @@ async function cleanIgnoredFiles(dir, staticRoot, filter) {
|
|
|
147964
147710
|
function getFileExtension(file) {
|
|
147965
147711
|
let ext = "";
|
|
147966
147712
|
if (file.type === "FileFsRef") {
|
|
147967
|
-
ext = (0,
|
|
147713
|
+
ext = (0, import_path22.extname)(file.fsPath);
|
|
147968
147714
|
}
|
|
147969
147715
|
if (!ext && file.contentType) {
|
|
147970
147716
|
const e2 = import_mime_types.default.extension(file.contentType);
|
|
@@ -147985,7 +147731,7 @@ async function* findDirs(name, dir, root = dir) {
|
|
|
147985
147731
|
paths = [];
|
|
147986
147732
|
}
|
|
147987
147733
|
for (const path11 of paths) {
|
|
147988
|
-
const abs = (0,
|
|
147734
|
+
const abs = (0, import_path22.join)(dir, path11);
|
|
147989
147735
|
let stat2;
|
|
147990
147736
|
try {
|
|
147991
147737
|
stat2 = await import_fs_extra13.default.lstat(abs);
|
|
@@ -147996,7 +147742,7 @@ async function* findDirs(name, dir, root = dir) {
|
|
|
147996
147742
|
}
|
|
147997
147743
|
if (stat2.isDirectory()) {
|
|
147998
147744
|
if (path11 === name) {
|
|
147999
|
-
yield (0,
|
|
147745
|
+
yield (0, import_path22.relative)(root, abs);
|
|
148000
147746
|
} else {
|
|
148001
147747
|
yield* findDirs(name, abs, root);
|
|
148002
147748
|
}
|
|
@@ -148013,12 +147759,12 @@ function filesWithoutFsRefs(files, repoRootPath, sharedDest, standalone) {
|
|
|
148013
147759
|
filePathMap = {};
|
|
148014
147760
|
if (standalone && sharedDest) {
|
|
148015
147761
|
shared[path11] = file;
|
|
148016
|
-
filePathMap[(0,
|
|
148017
|
-
(0,
|
|
147762
|
+
filePathMap[(0, import_build_utils11.normalizePath)(path11)] = (0, import_build_utils11.normalizePath)(
|
|
147763
|
+
(0, import_path22.relative)(repoRootPath, (0, import_path22.join)(sharedDest, path11))
|
|
148018
147764
|
);
|
|
148019
147765
|
} else {
|
|
148020
|
-
filePathMap[(0,
|
|
148021
|
-
(0,
|
|
147766
|
+
filePathMap[(0, import_build_utils11.normalizePath)(path11)] = (0, import_build_utils11.normalizePath)(
|
|
147767
|
+
(0, import_path22.relative)(repoRootPath, file.fsPath)
|
|
148022
147768
|
);
|
|
148023
147769
|
}
|
|
148024
147770
|
} else {
|
|
@@ -148027,22 +147773,22 @@ function filesWithoutFsRefs(files, repoRootPath, sharedDest, standalone) {
|
|
|
148027
147773
|
}
|
|
148028
147774
|
return { files: out, filePathMap, shared };
|
|
148029
147775
|
}
|
|
148030
|
-
var import_fs_extra13, import_mime_types,
|
|
147776
|
+
var import_fs_extra13, import_mime_types, import_path22, import_build_utils11, import_promisepipe2, import_client3, normalize2, OUTPUT_DIR;
|
|
148031
147777
|
var init_write_build_result = __esm({
|
|
148032
147778
|
"src/util/build/write-build-result.ts"() {
|
|
148033
147779
|
"use strict";
|
|
148034
147780
|
import_fs_extra13 = __toESM3(require_lib());
|
|
148035
147781
|
import_mime_types = __toESM3(require_mime_types());
|
|
148036
|
-
|
|
148037
|
-
|
|
147782
|
+
import_path22 = require("path");
|
|
147783
|
+
import_build_utils11 = require("@vercel/build-utils");
|
|
148038
147784
|
import_promisepipe2 = __toESM3(require_promisepipe());
|
|
148039
147785
|
init_merge();
|
|
148040
147786
|
init_unzip();
|
|
148041
147787
|
init_link2();
|
|
148042
147788
|
import_client3 = __toESM3(require_dist7());
|
|
148043
147789
|
init_output_manager();
|
|
148044
|
-
({ normalize: normalize2 } =
|
|
148045
|
-
OUTPUT_DIR = (0,
|
|
147790
|
+
({ normalize: normalize2 } = import_path22.posix);
|
|
147791
|
+
OUTPUT_DIR = (0, import_path22.join)(VERCEL_DIR, "output");
|
|
148046
147792
|
}
|
|
148047
147793
|
});
|
|
148048
147794
|
|
|
@@ -148079,7 +147825,7 @@ async function staticFiles(path11, { src }) {
|
|
|
148079
147825
|
const { debug: debug2, time } = output_manager_default;
|
|
148080
147826
|
let files = [];
|
|
148081
147827
|
const source = src || ".";
|
|
148082
|
-
const search = (0,
|
|
147828
|
+
const search = (0, import_path23.resolve)(path11, source);
|
|
148083
147829
|
const { ig } = await (0, import_client4.getVercelIgnore)(path11);
|
|
148084
147830
|
const filter = ig.createFilter();
|
|
148085
147831
|
const prefixLength = path11.length + 1;
|
|
@@ -148139,12 +147885,12 @@ async function explode(paths, { accepts }) {
|
|
|
148139
147885
|
function notNull(value) {
|
|
148140
147886
|
return value !== null;
|
|
148141
147887
|
}
|
|
148142
|
-
var import_fs_extra14,
|
|
147888
|
+
var import_fs_extra14, import_path23, import_client4, asAbsolute;
|
|
148143
147889
|
var init_get_files = __esm({
|
|
148144
147890
|
"src/util/get-files.ts"() {
|
|
148145
147891
|
"use strict";
|
|
148146
147892
|
import_fs_extra14 = __toESM3(require_lib());
|
|
148147
|
-
|
|
147893
|
+
import_path23 = require("path");
|
|
148148
147894
|
import_client4 = __toESM3(require_dist7());
|
|
148149
147895
|
init_unique_strings();
|
|
148150
147896
|
init_output_manager();
|
|
@@ -148152,7 +147898,7 @@ var init_get_files = __esm({
|
|
|
148152
147898
|
if (path11[0] === "/") {
|
|
148153
147899
|
return path11;
|
|
148154
147900
|
}
|
|
148155
|
-
return (0,
|
|
147901
|
+
return (0, import_path23.resolve)(parent, path11);
|
|
148156
147902
|
};
|
|
148157
147903
|
}
|
|
148158
147904
|
});
|
|
@@ -148180,7 +147926,7 @@ async function writeProjectSettings(cwd, project, org, isRepoLinked) {
|
|
|
148180
147926
|
analyticsId
|
|
148181
147927
|
}
|
|
148182
147928
|
};
|
|
148183
|
-
const path11 = (0,
|
|
147929
|
+
const path11 = (0, import_path24.join)(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
|
|
148184
147930
|
return await (0, import_fs_extra15.outputJSON)(path11, projectLinkAndSettings, {
|
|
148185
147931
|
spaces: 2
|
|
148186
147932
|
});
|
|
@@ -148188,7 +147934,7 @@ async function writeProjectSettings(cwd, project, org, isRepoLinked) {
|
|
|
148188
147934
|
async function readProjectSettings(vercelDir) {
|
|
148189
147935
|
try {
|
|
148190
147936
|
return JSON.parse(
|
|
148191
|
-
await (0, import_fs_extra15.readFile)((0,
|
|
147937
|
+
await (0, import_fs_extra15.readFile)((0, import_path24.join)(vercelDir, VERCEL_DIR_PROJECT), "utf8")
|
|
148192
147938
|
);
|
|
148193
147939
|
} catch (err) {
|
|
148194
147940
|
if ((0, import_error_utils16.isErrnoException)(err) && err.code && ["ENOENT", "ENOTDIR"].includes(err.code)) {
|
|
@@ -148220,11 +147966,11 @@ function pickOverrides(vercelConfig) {
|
|
|
148220
147966
|
}
|
|
148221
147967
|
return overrides;
|
|
148222
147968
|
}
|
|
148223
|
-
var
|
|
147969
|
+
var import_path24, import_fs_extra15, import_error_utils16;
|
|
148224
147970
|
var init_project_settings = __esm({
|
|
148225
147971
|
"src/util/projects/project-settings.ts"() {
|
|
148226
147972
|
"use strict";
|
|
148227
|
-
|
|
147973
|
+
import_path24 = require("path");
|
|
148228
147974
|
import_fs_extra15 = __toESM3(require_lib());
|
|
148229
147975
|
init_link2();
|
|
148230
147976
|
import_error_utils16 = __toESM3(require_dist2());
|
|
@@ -148279,13 +148025,13 @@ function validateConfig(config2) {
|
|
|
148279
148025
|
if (validate.errors && validate.errors[0]) {
|
|
148280
148026
|
const error3 = validate.errors[0];
|
|
148281
148027
|
const fileName = config2[import_client5.fileNameSymbol] || "vercel.json";
|
|
148282
|
-
const niceError = (0,
|
|
148028
|
+
const niceError = (0, import_build_utils12.getPrettyError)(error3);
|
|
148283
148029
|
niceError.message = `Invalid ${fileName} - ${niceError.message}`;
|
|
148284
148030
|
return niceError;
|
|
148285
148031
|
}
|
|
148286
148032
|
}
|
|
148287
148033
|
if (config2.functions && config2.builds) {
|
|
148288
|
-
return new
|
|
148034
|
+
return new import_build_utils12.NowBuildError({
|
|
148289
148035
|
code: "FUNCTIONS_AND_BUILDS",
|
|
148290
148036
|
message: "The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",
|
|
148291
148037
|
link: "https://vercel.link/functions-and-builds"
|
|
@@ -148293,13 +148039,13 @@ function validateConfig(config2) {
|
|
|
148293
148039
|
}
|
|
148294
148040
|
return null;
|
|
148295
148041
|
}
|
|
148296
|
-
var import_ajv2, import_routing_utils,
|
|
148042
|
+
var import_ajv2, import_routing_utils, import_build_utils12, import_client5, imagesSchema, cronsSchema, customErrorPageSchema, vercelConfigSchema, ajv, validate;
|
|
148297
148043
|
var init_validate_config = __esm({
|
|
148298
148044
|
"src/util/validate-config.ts"() {
|
|
148299
148045
|
"use strict";
|
|
148300
148046
|
import_ajv2 = __toESM3(require_ajv());
|
|
148301
148047
|
import_routing_utils = __toESM3(require_dist23());
|
|
148302
|
-
|
|
148048
|
+
import_build_utils12 = require("@vercel/build-utils");
|
|
148303
148049
|
import_client5 = __toESM3(require_dist7());
|
|
148304
148050
|
imagesSchema = {
|
|
148305
148051
|
type: "object",
|
|
@@ -148464,14 +148210,14 @@ var init_validate_config = __esm({
|
|
|
148464
148210
|
// doesn't need to know about `regions`, `public`, etc.
|
|
148465
148211
|
additionalProperties: true,
|
|
148466
148212
|
properties: {
|
|
148467
|
-
builds:
|
|
148213
|
+
builds: import_build_utils12.buildsSchema,
|
|
148468
148214
|
routes: import_routing_utils.routesSchema,
|
|
148469
148215
|
cleanUrls: import_routing_utils.cleanUrlsSchema,
|
|
148470
148216
|
headers: import_routing_utils.headersSchema,
|
|
148471
148217
|
redirects: import_routing_utils.redirectsSchema,
|
|
148472
148218
|
rewrites: import_routing_utils.rewritesSchema,
|
|
148473
148219
|
trailingSlash: import_routing_utils.trailingSlashSchema,
|
|
148474
|
-
functions:
|
|
148220
|
+
functions: import_build_utils12.functionsSchema,
|
|
148475
148221
|
images: imagesSchema,
|
|
148476
148222
|
crons: cronsSchema,
|
|
148477
148223
|
customErrorPage: customErrorPageSchema,
|
|
@@ -148483,6 +148229,260 @@ var init_validate_config = __esm({
|
|
|
148483
148229
|
}
|
|
148484
148230
|
});
|
|
148485
148231
|
|
|
148232
|
+
// src/util/compile-vercel-config.ts
|
|
148233
|
+
var compile_vercel_config_exports = {};
|
|
148234
|
+
__export3(compile_vercel_config_exports, {
|
|
148235
|
+
compileVercelConfig: () => compileVercelConfig,
|
|
148236
|
+
findSourceVercelConfigFile: () => findSourceVercelConfigFile,
|
|
148237
|
+
getVercelConfigPath: () => getVercelConfigPath
|
|
148238
|
+
});
|
|
148239
|
+
async function fileExists(filePath) {
|
|
148240
|
+
try {
|
|
148241
|
+
await (0, import_promises2.access)(filePath);
|
|
148242
|
+
return true;
|
|
148243
|
+
} catch {
|
|
148244
|
+
return false;
|
|
148245
|
+
}
|
|
148246
|
+
}
|
|
148247
|
+
async function findAllVercelConfigFiles(workPath) {
|
|
148248
|
+
const foundFiles = [];
|
|
148249
|
+
for (const ext of VERCEL_CONFIG_EXTENSIONS) {
|
|
148250
|
+
const configPath = (0, import_path25.join)(workPath, `vercel.${ext}`);
|
|
148251
|
+
if (await fileExists(configPath)) {
|
|
148252
|
+
foundFiles.push(configPath);
|
|
148253
|
+
}
|
|
148254
|
+
}
|
|
148255
|
+
return foundFiles;
|
|
148256
|
+
}
|
|
148257
|
+
async function findSourceVercelConfigFile(workPath) {
|
|
148258
|
+
for (const ext of VERCEL_CONFIG_EXTENSIONS) {
|
|
148259
|
+
const configPath = (0, import_path25.join)(workPath, `vercel.${ext}`);
|
|
148260
|
+
if (await fileExists(configPath)) {
|
|
148261
|
+
return (0, import_path25.basename)(configPath);
|
|
148262
|
+
}
|
|
148263
|
+
}
|
|
148264
|
+
return null;
|
|
148265
|
+
}
|
|
148266
|
+
async function findVercelConfigFile(workPath) {
|
|
148267
|
+
const foundFiles = await findAllVercelConfigFiles(workPath);
|
|
148268
|
+
if (foundFiles.length > 1) {
|
|
148269
|
+
throw new ConflictingConfigFiles(
|
|
148270
|
+
foundFiles,
|
|
148271
|
+
"Multiple vercel config files found. Please use only one configuration file.",
|
|
148272
|
+
"https://vercel.com/docs/projects/project-configuration"
|
|
148273
|
+
);
|
|
148274
|
+
}
|
|
148275
|
+
return foundFiles[0] || null;
|
|
148276
|
+
}
|
|
148277
|
+
function parseConfigLoaderError(stderr) {
|
|
148278
|
+
if (!stderr.trim()) {
|
|
148279
|
+
return "";
|
|
148280
|
+
}
|
|
148281
|
+
const moduleNotFoundMatch = stderr.match(
|
|
148282
|
+
/Error \[ERR_MODULE_NOT_FOUND\]: Cannot find package '([^']+)'/
|
|
148283
|
+
);
|
|
148284
|
+
if (moduleNotFoundMatch) {
|
|
148285
|
+
const packageName2 = moduleNotFoundMatch[1];
|
|
148286
|
+
return `Cannot find package '${packageName2}'. Make sure it's installed in your project dependencies.`;
|
|
148287
|
+
}
|
|
148288
|
+
const syntaxErrorMatch = stderr.match(/SyntaxError: (.+?)(?:\n|$)/);
|
|
148289
|
+
if (syntaxErrorMatch) {
|
|
148290
|
+
return `Syntax error: ${syntaxErrorMatch[1]}`;
|
|
148291
|
+
}
|
|
148292
|
+
const errorMatch = stderr.match(
|
|
148293
|
+
/^(?:Error|TypeError|ReferenceError): (.+?)(?:\n|$)/m
|
|
148294
|
+
);
|
|
148295
|
+
if (errorMatch) {
|
|
148296
|
+
return errorMatch[1];
|
|
148297
|
+
}
|
|
148298
|
+
return stderr.trim();
|
|
148299
|
+
}
|
|
148300
|
+
async function compileVercelConfig(workPath) {
|
|
148301
|
+
const vercelJsonPath = (0, import_path25.join)(workPath, "vercel.json");
|
|
148302
|
+
const nowJsonPath = (0, import_path25.join)(workPath, "now.json");
|
|
148303
|
+
const hasVercelJson = await fileExists(vercelJsonPath);
|
|
148304
|
+
const hasNowJson = await fileExists(nowJsonPath);
|
|
148305
|
+
if (hasVercelJson && hasNowJson) {
|
|
148306
|
+
throw new ConflictingConfigFiles([vercelJsonPath, nowJsonPath]);
|
|
148307
|
+
}
|
|
148308
|
+
const vercelConfigPath = await findVercelConfigFile(workPath);
|
|
148309
|
+
const vercelDir = (0, import_path25.join)(workPath, VERCEL_DIR);
|
|
148310
|
+
const compiledConfigPath = (0, import_path25.join)(vercelDir, "vercel.json");
|
|
148311
|
+
if (vercelConfigPath && hasNowJson) {
|
|
148312
|
+
throw new ConflictingConfigFiles(
|
|
148313
|
+
[vercelConfigPath, nowJsonPath],
|
|
148314
|
+
`Both ${(0, import_path25.basename)(vercelConfigPath)} and now.json exist in your project. Please use only one configuration method.`,
|
|
148315
|
+
"https://vercel.com/docs/projects/project-configuration"
|
|
148316
|
+
);
|
|
148317
|
+
}
|
|
148318
|
+
if (vercelConfigPath && hasVercelJson) {
|
|
148319
|
+
throw new ConflictingConfigFiles(
|
|
148320
|
+
[vercelConfigPath, vercelJsonPath],
|
|
148321
|
+
`Both ${(0, import_path25.basename)(vercelConfigPath)} and vercel.json exist in your project. Please use only one configuration method.`,
|
|
148322
|
+
"https://vercel.com/docs/projects/project-configuration"
|
|
148323
|
+
);
|
|
148324
|
+
}
|
|
148325
|
+
if (!vercelConfigPath) {
|
|
148326
|
+
if (hasVercelJson) {
|
|
148327
|
+
return {
|
|
148328
|
+
configPath: vercelJsonPath,
|
|
148329
|
+
wasCompiled: false
|
|
148330
|
+
};
|
|
148331
|
+
}
|
|
148332
|
+
if (hasNowJson) {
|
|
148333
|
+
return {
|
|
148334
|
+
configPath: nowJsonPath,
|
|
148335
|
+
wasCompiled: false
|
|
148336
|
+
};
|
|
148337
|
+
}
|
|
148338
|
+
if (await fileExists(compiledConfigPath)) {
|
|
148339
|
+
return {
|
|
148340
|
+
configPath: compiledConfigPath,
|
|
148341
|
+
wasCompiled: true,
|
|
148342
|
+
sourceFile: await findSourceVercelConfigFile(workPath) ?? void 0
|
|
148343
|
+
};
|
|
148344
|
+
}
|
|
148345
|
+
return {
|
|
148346
|
+
configPath: null,
|
|
148347
|
+
wasCompiled: false
|
|
148348
|
+
};
|
|
148349
|
+
}
|
|
148350
|
+
(0, import_dotenv.config)({ path: (0, import_path25.join)(workPath, ".env") });
|
|
148351
|
+
(0, import_dotenv.config)({ path: (0, import_path25.join)(workPath, ".env.local") });
|
|
148352
|
+
const tempOutPath = (0, import_path25.join)(vercelDir, "vercel-temp.mjs");
|
|
148353
|
+
const loaderPath = (0, import_path25.join)(vercelDir, "vercel-loader.mjs");
|
|
148354
|
+
try {
|
|
148355
|
+
const { build: build2 } = await import("esbuild");
|
|
148356
|
+
await (0, import_promises2.mkdir)(vercelDir, { recursive: true });
|
|
148357
|
+
await build2({
|
|
148358
|
+
entryPoints: [vercelConfigPath],
|
|
148359
|
+
bundle: true,
|
|
148360
|
+
platform: "node",
|
|
148361
|
+
format: "esm",
|
|
148362
|
+
outfile: tempOutPath,
|
|
148363
|
+
packages: "external",
|
|
148364
|
+
target: "node20",
|
|
148365
|
+
sourcemap: "inline"
|
|
148366
|
+
});
|
|
148367
|
+
const loaderScript = `
|
|
148368
|
+
import { pathToFileURL } from 'url';
|
|
148369
|
+
const configModule = await import(pathToFileURL(process.argv[2]).href);
|
|
148370
|
+
const config = ('default' in configModule) ? configModule.default : ('config' in configModule) ? configModule.config : configModule;
|
|
148371
|
+
process.send(config);
|
|
148372
|
+
`;
|
|
148373
|
+
await (0, import_promises2.writeFile)(loaderPath, loaderScript, "utf-8");
|
|
148374
|
+
const config2 = await new Promise((resolve13, reject) => {
|
|
148375
|
+
const child = (0, import_child_process3.fork)(loaderPath, [tempOutPath], {
|
|
148376
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"]
|
|
148377
|
+
});
|
|
148378
|
+
let stderrOutput = "";
|
|
148379
|
+
let stdoutOutput = "";
|
|
148380
|
+
if (child.stderr) {
|
|
148381
|
+
child.stderr.on("data", (data) => {
|
|
148382
|
+
stderrOutput += data.toString();
|
|
148383
|
+
});
|
|
148384
|
+
}
|
|
148385
|
+
if (child.stdout) {
|
|
148386
|
+
child.stdout.on("data", (data) => {
|
|
148387
|
+
stdoutOutput += data.toString();
|
|
148388
|
+
});
|
|
148389
|
+
}
|
|
148390
|
+
const timeout = setTimeout(() => {
|
|
148391
|
+
child.kill();
|
|
148392
|
+
reject(new Error("Config loader timed out after 10 seconds"));
|
|
148393
|
+
}, 1e4);
|
|
148394
|
+
child.on("message", (message2) => {
|
|
148395
|
+
clearTimeout(timeout);
|
|
148396
|
+
child.kill();
|
|
148397
|
+
resolve13(message2);
|
|
148398
|
+
});
|
|
148399
|
+
child.on("error", (err) => {
|
|
148400
|
+
clearTimeout(timeout);
|
|
148401
|
+
reject(err);
|
|
148402
|
+
});
|
|
148403
|
+
child.on("exit", (code2) => {
|
|
148404
|
+
clearTimeout(timeout);
|
|
148405
|
+
if (code2 !== 0) {
|
|
148406
|
+
if (stderrOutput.trim()) {
|
|
148407
|
+
output_manager_default.log(stderrOutput);
|
|
148408
|
+
}
|
|
148409
|
+
if (stdoutOutput.trim()) {
|
|
148410
|
+
output_manager_default.log(stdoutOutput);
|
|
148411
|
+
}
|
|
148412
|
+
const parsedError = parseConfigLoaderError(stderrOutput);
|
|
148413
|
+
if (parsedError) {
|
|
148414
|
+
reject(new Error(parsedError));
|
|
148415
|
+
} else if (stdoutOutput.trim()) {
|
|
148416
|
+
reject(new Error(stdoutOutput.trim()));
|
|
148417
|
+
} else {
|
|
148418
|
+
reject(new Error(`Config loader exited with code ${code2}`));
|
|
148419
|
+
}
|
|
148420
|
+
}
|
|
148421
|
+
});
|
|
148422
|
+
});
|
|
148423
|
+
await (0, import_promises2.writeFile)(
|
|
148424
|
+
compiledConfigPath,
|
|
148425
|
+
JSON.stringify(config2, null, 2),
|
|
148426
|
+
"utf-8"
|
|
148427
|
+
);
|
|
148428
|
+
output_manager_default.debug(`Compiled ${vercelConfigPath} -> ${compiledConfigPath}`);
|
|
148429
|
+
return {
|
|
148430
|
+
configPath: compiledConfigPath,
|
|
148431
|
+
wasCompiled: true,
|
|
148432
|
+
sourceFile: await findSourceVercelConfigFile(workPath) ?? void 0
|
|
148433
|
+
};
|
|
148434
|
+
} catch (error3) {
|
|
148435
|
+
throw new import_build_utils13.NowBuildError({
|
|
148436
|
+
code: "vercel_ts_compilation_failed",
|
|
148437
|
+
message: `Failed to compile ${vercelConfigPath}: ${error3.message}`,
|
|
148438
|
+
link: "https://vercel.com/docs/projects/project-configuration"
|
|
148439
|
+
});
|
|
148440
|
+
} finally {
|
|
148441
|
+
await Promise.all([
|
|
148442
|
+
(0, import_promises2.unlink)(tempOutPath).catch((err) => {
|
|
148443
|
+
if (err.code !== "ENOENT") {
|
|
148444
|
+
output_manager_default.debug(`Failed to cleanup temp file: ${err}`);
|
|
148445
|
+
}
|
|
148446
|
+
}),
|
|
148447
|
+
(0, import_promises2.unlink)(loaderPath).catch((err) => {
|
|
148448
|
+
if (err.code !== "ENOENT") {
|
|
148449
|
+
output_manager_default.debug(`Failed to cleanup loader file: ${err}`);
|
|
148450
|
+
}
|
|
148451
|
+
})
|
|
148452
|
+
]);
|
|
148453
|
+
}
|
|
148454
|
+
}
|
|
148455
|
+
async function getVercelConfigPath(workPath) {
|
|
148456
|
+
const vercelJsonPath = (0, import_path25.join)(workPath, "vercel.json");
|
|
148457
|
+
const nowJsonPath = (0, import_path25.join)(workPath, "now.json");
|
|
148458
|
+
const compiledConfigPath = (0, import_path25.join)(workPath, VERCEL_DIR, "vercel.json");
|
|
148459
|
+
if (await fileExists(vercelJsonPath)) {
|
|
148460
|
+
return vercelJsonPath;
|
|
148461
|
+
}
|
|
148462
|
+
if (await fileExists(nowJsonPath)) {
|
|
148463
|
+
return nowJsonPath;
|
|
148464
|
+
}
|
|
148465
|
+
if (await fileExists(compiledConfigPath)) {
|
|
148466
|
+
return compiledConfigPath;
|
|
148467
|
+
}
|
|
148468
|
+
return nowJsonPath;
|
|
148469
|
+
}
|
|
148470
|
+
var import_promises2, import_path25, import_child_process3, import_dotenv, import_build_utils13, VERCEL_CONFIG_EXTENSIONS;
|
|
148471
|
+
var init_compile_vercel_config = __esm({
|
|
148472
|
+
"src/util/compile-vercel-config.ts"() {
|
|
148473
|
+
"use strict";
|
|
148474
|
+
import_promises2 = require("fs/promises");
|
|
148475
|
+
import_path25 = require("path");
|
|
148476
|
+
import_child_process3 = require("child_process");
|
|
148477
|
+
import_dotenv = __toESM3(require_main3());
|
|
148478
|
+
init_output_manager();
|
|
148479
|
+
import_build_utils13 = require("@vercel/build-utils");
|
|
148480
|
+
init_link2();
|
|
148481
|
+
init_errors_ts();
|
|
148482
|
+
VERCEL_CONFIG_EXTENSIONS = ["ts", "mts", "js", "mjs", "cjs"];
|
|
148483
|
+
}
|
|
148484
|
+
});
|
|
148485
|
+
|
|
148486
148486
|
// src/util/input/input-project.ts
|
|
148487
148487
|
async function inputProject(client2, org, detectedProjectName, autoConfirm = false) {
|
|
148488
148488
|
const slugifiedName = (0, import_slugify2.default)(detectedProjectName);
|
|
@@ -148835,25 +148835,14 @@ var init_edit_project_settings = __esm({
|
|
|
148835
148835
|
// src/util/config/read-config.ts
|
|
148836
148836
|
async function readConfig(dir) {
|
|
148837
148837
|
let pkgFilePath;
|
|
148838
|
-
|
|
148839
|
-
|
|
148840
|
-
|
|
148841
|
-
|
|
148842
|
-
|
|
148843
|
-
|
|
148844
|
-
return err;
|
|
148845
|
-
}
|
|
148846
|
-
throw err;
|
|
148847
|
-
}
|
|
148848
|
-
} else {
|
|
148849
|
-
try {
|
|
148850
|
-
pkgFilePath = getLocalPathConfig(dir);
|
|
148851
|
-
} catch (err) {
|
|
148852
|
-
if (err instanceof Error) {
|
|
148853
|
-
return err;
|
|
148854
|
-
}
|
|
148855
|
-
throw err;
|
|
148838
|
+
try {
|
|
148839
|
+
const compileResult = await compileVercelConfig(dir);
|
|
148840
|
+
pkgFilePath = compileResult.configPath || getLocalPathConfig(dir);
|
|
148841
|
+
} catch (err) {
|
|
148842
|
+
if (err instanceof Error) {
|
|
148843
|
+
return err;
|
|
148856
148844
|
}
|
|
148845
|
+
throw err;
|
|
148857
148846
|
}
|
|
148858
148847
|
const result = await readJSONFile(pkgFilePath);
|
|
148859
148848
|
if (result instanceof CantParseJSONFile) {
|
|
@@ -149562,7 +149551,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
|
|
|
149562
149551
|
const workPath = (0, import_path28.join)(cwd, project.settings.rootDirectory || ".");
|
|
149563
149552
|
const sourceConfigFile = await findSourceVercelConfigFile(workPath);
|
|
149564
149553
|
let corepackShimDir;
|
|
149565
|
-
if (sourceConfigFile
|
|
149554
|
+
if (sourceConfigFile) {
|
|
149566
149555
|
corepackShimDir = await initCorepack({ repoRootPath: cwd });
|
|
149567
149556
|
const installCommand2 = project.settings.installCommand;
|
|
149568
149557
|
if (typeof installCommand2 === "string") {
|
|
@@ -149668,7 +149657,8 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
|
|
|
149668
149657
|
...localConfig,
|
|
149669
149658
|
projectSettings,
|
|
149670
149659
|
ignoreBuildScript: true,
|
|
149671
|
-
featHandleMiss: true
|
|
149660
|
+
featHandleMiss: true,
|
|
149661
|
+
workPath
|
|
149672
149662
|
});
|
|
149673
149663
|
if (detectedBuilders.errors && detectedBuilders.errors.length > 0) {
|
|
149674
149664
|
throw detectedBuilders.errors[0];
|
|
@@ -150145,7 +150135,7 @@ var init_build2 = __esm({
|
|
|
150145
150135
|
"src/commands/build/index.ts"() {
|
|
150146
150136
|
"use strict";
|
|
150147
150137
|
import_chalk56 = __toESM3(require_source());
|
|
150148
|
-
import_dotenv2 = __toESM3(
|
|
150138
|
+
import_dotenv2 = __toESM3(require_main3());
|
|
150149
150139
|
import_fs_extra18 = __toESM3(require_lib());
|
|
150150
150140
|
import_minimatch2 = __toESM3(require_minimatch2());
|
|
150151
150141
|
import_path28 = require("path");
|
|
@@ -172191,7 +172181,7 @@ var init_server = __esm({
|
|
|
172191
172181
|
import_crypto2 = require("crypto");
|
|
172192
172182
|
import_serve_handler = __toESM3(require_src4());
|
|
172193
172183
|
import_chokidar = require("chokidar");
|
|
172194
|
-
import_dotenv3 = __toESM3(
|
|
172184
|
+
import_dotenv3 = __toESM3(require_main3());
|
|
172195
172185
|
import_path36 = __toESM3(require("path"));
|
|
172196
172186
|
import_once = __toESM3(require_dist24());
|
|
172197
172187
|
import_directory = __toESM3(require_directory());
|
|
@@ -173245,7 +173235,8 @@ Please ensure that ${cmd(err.path)} is properly installed`;
|
|
|
173245
173235
|
projectSettings: projectSettings || this.projectSettings,
|
|
173246
173236
|
featHandleMiss,
|
|
173247
173237
|
cleanUrls,
|
|
173248
|
-
trailingSlash
|
|
173238
|
+
trailingSlash,
|
|
173239
|
+
workPath: this.cwd
|
|
173249
173240
|
});
|
|
173250
173241
|
if (errors) {
|
|
173251
173242
|
output_manager_default.error(errors[0].message);
|
|
@@ -190504,14 +190495,13 @@ function ignoreError(error3) {
|
|
|
190504
190495
|
}
|
|
190505
190496
|
|
|
190506
190497
|
// src/util/get-config.ts
|
|
190507
|
-
var
|
|
190498
|
+
var import_path12 = __toESM3(require("path"));
|
|
190508
190499
|
var import_client2 = __toESM3(require_dist7());
|
|
190509
190500
|
init_errors_ts();
|
|
190510
190501
|
init_humanize_path();
|
|
190511
190502
|
init_read_json_file();
|
|
190512
190503
|
var import_error_utils10 = __toESM3(require_dist2());
|
|
190513
190504
|
init_output_manager();
|
|
190514
|
-
init_compile_vercel_config();
|
|
190515
190505
|
var config;
|
|
190516
190506
|
async function getConfig(configFile) {
|
|
190517
190507
|
if (config) {
|
|
@@ -190527,7 +190517,7 @@ async function getConfig(configFile) {
|
|
|
190527
190517
|
throw err;
|
|
190528
190518
|
}
|
|
190529
190519
|
if (configFile) {
|
|
190530
|
-
const localFilePath =
|
|
190520
|
+
const localFilePath = import_path12.default.resolve(localPath, configFile);
|
|
190531
190521
|
output_manager_default.debug(
|
|
190532
190522
|
`Found config in provided --local-config path ${localFilePath}`
|
|
190533
190523
|
);
|
|
@@ -190542,35 +190532,8 @@ async function getConfig(configFile) {
|
|
|
190542
190532
|
config[import_client2.fileNameSymbol] = configFile;
|
|
190543
190533
|
return config;
|
|
190544
190534
|
}
|
|
190545
|
-
const vercelFilePath =
|
|
190546
|
-
const nowFilePath =
|
|
190547
|
-
if (process.env.VERCEL_TS_CONFIG_ENABLED) {
|
|
190548
|
-
let compileResult;
|
|
190549
|
-
try {
|
|
190550
|
-
compileResult = await compileVercelConfig(localPath);
|
|
190551
|
-
} catch (err) {
|
|
190552
|
-
if (err instanceof Error) {
|
|
190553
|
-
return err;
|
|
190554
|
-
}
|
|
190555
|
-
throw err;
|
|
190556
|
-
}
|
|
190557
|
-
if (compileResult.configPath) {
|
|
190558
|
-
const localConfig = await readJSONFile(
|
|
190559
|
-
compileResult.configPath
|
|
190560
|
-
);
|
|
190561
|
-
if (localConfig instanceof CantParseJSONFile) {
|
|
190562
|
-
return localConfig;
|
|
190563
|
-
}
|
|
190564
|
-
if (localConfig !== null) {
|
|
190565
|
-
const fileName = import_path13.default.basename(compileResult.configPath);
|
|
190566
|
-
output_manager_default.debug(`Found config in file "${compileResult.configPath}"`);
|
|
190567
|
-
config = localConfig;
|
|
190568
|
-
config[import_client2.fileNameSymbol] = compileResult.wasCompiled ? compileResult.sourceFile || "vercel.ts" : fileName;
|
|
190569
|
-
return config;
|
|
190570
|
-
}
|
|
190571
|
-
}
|
|
190572
|
-
return new CantFindConfig([vercelFilePath, nowFilePath].map(humanizePath));
|
|
190573
|
-
}
|
|
190535
|
+
const vercelFilePath = import_path12.default.resolve(localPath, "vercel.json");
|
|
190536
|
+
const nowFilePath = import_path12.default.resolve(localPath, "now.json");
|
|
190574
190537
|
const [vercelConfig, nowConfig] = await Promise.all([
|
|
190575
190538
|
readJSONFile(vercelFilePath),
|
|
190576
190539
|
readJSONFile(nowFilePath)
|
|
@@ -190630,9 +190593,9 @@ init_box();
|
|
|
190630
190593
|
// src/util/extension/exec.ts
|
|
190631
190594
|
var import_which = __toESM3(require_lib12());
|
|
190632
190595
|
var import_execa = __toESM3(require_execa());
|
|
190633
|
-
var
|
|
190596
|
+
var import_path14 = require("path");
|
|
190634
190597
|
var import_async_listen2 = __toESM3(require_dist6());
|
|
190635
|
-
var
|
|
190598
|
+
var import_build_utils6 = require("@vercel/build-utils");
|
|
190636
190599
|
|
|
190637
190600
|
// src/util/extension/proxy.ts
|
|
190638
190601
|
var import_http2 = require("http");
|
|
@@ -190674,12 +190637,12 @@ var import_error_utils11 = __toESM3(require_dist2());
|
|
|
190674
190637
|
async function execExtension(client2, name, args2, cwd) {
|
|
190675
190638
|
const { debug: debug2, error: error3 } = output_manager_default;
|
|
190676
190639
|
const extensionCommand = `vercel-${name}`;
|
|
190677
|
-
const { packageJsonPath, lockfilePath } = await (0,
|
|
190640
|
+
const { packageJsonPath, lockfilePath } = await (0, import_build_utils6.scanParentDirs)(cwd);
|
|
190678
190641
|
const baseFile = lockfilePath || packageJsonPath;
|
|
190679
190642
|
let extensionPath = null;
|
|
190680
190643
|
if (baseFile) {
|
|
190681
|
-
extensionPath = await (0,
|
|
190682
|
-
base: (0,
|
|
190644
|
+
extensionPath = await (0, import_build_utils6.walkParentDirs)({
|
|
190645
|
+
base: (0, import_path14.dirname)(baseFile),
|
|
190683
190646
|
start: cwd,
|
|
190684
190647
|
filename: `node_modules/.bin/${extensionCommand}`
|
|
190685
190648
|
});
|