vercel 50.1.3 → 50.1.4
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 +491 -472
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -92352,6 +92352,318 @@ var init_local_path = __esm({
|
|
|
92352
92352
|
}
|
|
92353
92353
|
});
|
|
92354
92354
|
|
|
92355
|
+
// ../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js
|
|
92356
|
+
var require_main = __commonJS2({
|
|
92357
|
+
"../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
92358
|
+
"use strict";
|
|
92359
|
+
var fs15 = require("fs");
|
|
92360
|
+
function parse11(src) {
|
|
92361
|
+
var obj = {};
|
|
92362
|
+
src.toString().split("\n").forEach(function(line) {
|
|
92363
|
+
var keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);
|
|
92364
|
+
if (keyValueArr != null) {
|
|
92365
|
+
var key = keyValueArr[1];
|
|
92366
|
+
var value = keyValueArr[2] ? keyValueArr[2] : "";
|
|
92367
|
+
var len = value ? value.length : 0;
|
|
92368
|
+
if (len > 0 && value.charAt(0) === '"' && value.charAt(len - 1) === '"') {
|
|
92369
|
+
value = value.replace(/\\n/gm, "\n");
|
|
92370
|
+
}
|
|
92371
|
+
value = value.replace(/(^['"]|['"]$)/g, "").trim();
|
|
92372
|
+
obj[key] = value;
|
|
92373
|
+
}
|
|
92374
|
+
});
|
|
92375
|
+
return obj;
|
|
92376
|
+
}
|
|
92377
|
+
function config2(options) {
|
|
92378
|
+
var path11 = ".env";
|
|
92379
|
+
var encoding = "utf8";
|
|
92380
|
+
if (options) {
|
|
92381
|
+
if (options.path) {
|
|
92382
|
+
path11 = options.path;
|
|
92383
|
+
}
|
|
92384
|
+
if (options.encoding) {
|
|
92385
|
+
encoding = options.encoding;
|
|
92386
|
+
}
|
|
92387
|
+
}
|
|
92388
|
+
try {
|
|
92389
|
+
var parsedObj = parse11(fs15.readFileSync(path11, { encoding }));
|
|
92390
|
+
Object.keys(parsedObj).forEach(function(key) {
|
|
92391
|
+
process.env[key] = process.env[key] || parsedObj[key];
|
|
92392
|
+
});
|
|
92393
|
+
return { parsed: parsedObj };
|
|
92394
|
+
} catch (e2) {
|
|
92395
|
+
return { error: e2 };
|
|
92396
|
+
}
|
|
92397
|
+
}
|
|
92398
|
+
module2.exports.config = config2;
|
|
92399
|
+
module2.exports.load = config2;
|
|
92400
|
+
module2.exports.parse = parse11;
|
|
92401
|
+
}
|
|
92402
|
+
});
|
|
92403
|
+
|
|
92404
|
+
// src/util/compile-vercel-config.ts
|
|
92405
|
+
var compile_vercel_config_exports = {};
|
|
92406
|
+
__export3(compile_vercel_config_exports, {
|
|
92407
|
+
DEFAULT_VERCEL_CONFIG_FILENAME: () => DEFAULT_VERCEL_CONFIG_FILENAME,
|
|
92408
|
+
VERCEL_CONFIG_EXTENSIONS: () => VERCEL_CONFIG_EXTENSIONS,
|
|
92409
|
+
compileVercelConfig: () => compileVercelConfig,
|
|
92410
|
+
findSourceVercelConfigFile: () => findSourceVercelConfigFile,
|
|
92411
|
+
getVercelConfigPath: () => getVercelConfigPath
|
|
92412
|
+
});
|
|
92413
|
+
async function fileExists(filePath) {
|
|
92414
|
+
try {
|
|
92415
|
+
await (0, import_promises.access)(filePath);
|
|
92416
|
+
return true;
|
|
92417
|
+
} catch {
|
|
92418
|
+
return false;
|
|
92419
|
+
}
|
|
92420
|
+
}
|
|
92421
|
+
async function findAllVercelConfigFiles(workPath) {
|
|
92422
|
+
const foundFiles = [];
|
|
92423
|
+
for (const ext of VERCEL_CONFIG_EXTENSIONS) {
|
|
92424
|
+
const configPath = (0, import_path11.join)(workPath, `vercel.${ext}`);
|
|
92425
|
+
if (await fileExists(configPath)) {
|
|
92426
|
+
foundFiles.push(configPath);
|
|
92427
|
+
}
|
|
92428
|
+
}
|
|
92429
|
+
return foundFiles;
|
|
92430
|
+
}
|
|
92431
|
+
async function findSourceVercelConfigFile(workPath) {
|
|
92432
|
+
for (const ext of VERCEL_CONFIG_EXTENSIONS) {
|
|
92433
|
+
const configPath = (0, import_path11.join)(workPath, `vercel.${ext}`);
|
|
92434
|
+
if (await fileExists(configPath)) {
|
|
92435
|
+
return (0, import_path11.basename)(configPath);
|
|
92436
|
+
}
|
|
92437
|
+
}
|
|
92438
|
+
return null;
|
|
92439
|
+
}
|
|
92440
|
+
async function findVercelConfigFile(workPath) {
|
|
92441
|
+
const foundFiles = await findAllVercelConfigFiles(workPath);
|
|
92442
|
+
if (foundFiles.length > 1) {
|
|
92443
|
+
throw new ConflictingConfigFiles(
|
|
92444
|
+
foundFiles,
|
|
92445
|
+
"Multiple vercel config files found. Please use only one configuration file.",
|
|
92446
|
+
"https://vercel.com/docs/projects/project-configuration"
|
|
92447
|
+
);
|
|
92448
|
+
}
|
|
92449
|
+
return foundFiles[0] || null;
|
|
92450
|
+
}
|
|
92451
|
+
function parseConfigLoaderError(stderr) {
|
|
92452
|
+
if (!stderr.trim()) {
|
|
92453
|
+
return "";
|
|
92454
|
+
}
|
|
92455
|
+
const moduleNotFoundMatch = stderr.match(
|
|
92456
|
+
/Error \[ERR_MODULE_NOT_FOUND\]: Cannot find package '([^']+)'/
|
|
92457
|
+
);
|
|
92458
|
+
if (moduleNotFoundMatch) {
|
|
92459
|
+
const packageName2 = moduleNotFoundMatch[1];
|
|
92460
|
+
return `Cannot find package '${packageName2}'. Make sure it's installed in your project dependencies.`;
|
|
92461
|
+
}
|
|
92462
|
+
const syntaxErrorMatch = stderr.match(/SyntaxError: (.+?)(?:\n|$)/);
|
|
92463
|
+
if (syntaxErrorMatch) {
|
|
92464
|
+
return `Syntax error: ${syntaxErrorMatch[1]}`;
|
|
92465
|
+
}
|
|
92466
|
+
const errorMatch = stderr.match(
|
|
92467
|
+
/^(?:Error|TypeError|ReferenceError): (.+?)(?:\n|$)/m
|
|
92468
|
+
);
|
|
92469
|
+
if (errorMatch) {
|
|
92470
|
+
return errorMatch[1];
|
|
92471
|
+
}
|
|
92472
|
+
return stderr.trim();
|
|
92473
|
+
}
|
|
92474
|
+
async function compileVercelConfig(workPath) {
|
|
92475
|
+
const vercelJsonPath = (0, import_path11.join)(workPath, "vercel.json");
|
|
92476
|
+
const nowJsonPath = (0, import_path11.join)(workPath, "now.json");
|
|
92477
|
+
const hasVercelJson = await fileExists(vercelJsonPath);
|
|
92478
|
+
const hasNowJson = await fileExists(nowJsonPath);
|
|
92479
|
+
if (hasVercelJson && hasNowJson) {
|
|
92480
|
+
throw new ConflictingConfigFiles([vercelJsonPath, nowJsonPath]);
|
|
92481
|
+
}
|
|
92482
|
+
const vercelConfigPath = await findVercelConfigFile(workPath);
|
|
92483
|
+
const vercelDir = (0, import_path11.join)(workPath, VERCEL_DIR);
|
|
92484
|
+
const compiledConfigPath = (0, import_path11.join)(vercelDir, "vercel.json");
|
|
92485
|
+
if (vercelConfigPath && hasNowJson) {
|
|
92486
|
+
throw new ConflictingConfigFiles(
|
|
92487
|
+
[vercelConfigPath, nowJsonPath],
|
|
92488
|
+
`Both ${(0, import_path11.basename)(vercelConfigPath)} and now.json exist in your project. Please use only one configuration method.`,
|
|
92489
|
+
"https://vercel.com/docs/projects/project-configuration"
|
|
92490
|
+
);
|
|
92491
|
+
}
|
|
92492
|
+
if (vercelConfigPath && hasVercelJson) {
|
|
92493
|
+
throw new ConflictingConfigFiles(
|
|
92494
|
+
[vercelConfigPath, vercelJsonPath],
|
|
92495
|
+
`Both ${(0, import_path11.basename)(vercelConfigPath)} and vercel.json exist in your project. Please use only one configuration method.`,
|
|
92496
|
+
"https://vercel.com/docs/projects/project-configuration"
|
|
92497
|
+
);
|
|
92498
|
+
}
|
|
92499
|
+
if (!vercelConfigPath) {
|
|
92500
|
+
if (hasVercelJson) {
|
|
92501
|
+
return {
|
|
92502
|
+
configPath: vercelJsonPath,
|
|
92503
|
+
wasCompiled: false
|
|
92504
|
+
};
|
|
92505
|
+
}
|
|
92506
|
+
if (hasNowJson) {
|
|
92507
|
+
return {
|
|
92508
|
+
configPath: nowJsonPath,
|
|
92509
|
+
wasCompiled: false
|
|
92510
|
+
};
|
|
92511
|
+
}
|
|
92512
|
+
if (await fileExists(compiledConfigPath)) {
|
|
92513
|
+
return {
|
|
92514
|
+
configPath: compiledConfigPath,
|
|
92515
|
+
wasCompiled: true,
|
|
92516
|
+
sourceFile: await findSourceVercelConfigFile(workPath) ?? void 0
|
|
92517
|
+
};
|
|
92518
|
+
}
|
|
92519
|
+
return {
|
|
92520
|
+
configPath: null,
|
|
92521
|
+
wasCompiled: false
|
|
92522
|
+
};
|
|
92523
|
+
}
|
|
92524
|
+
(0, import_dotenv.config)({ path: (0, import_path11.join)(workPath, ".env") });
|
|
92525
|
+
(0, import_dotenv.config)({ path: (0, import_path11.join)(workPath, ".env.local") });
|
|
92526
|
+
const tempOutPath = (0, import_path11.join)(vercelDir, "vercel-temp.mjs");
|
|
92527
|
+
const loaderPath = (0, import_path11.join)(vercelDir, "vercel-loader.mjs");
|
|
92528
|
+
try {
|
|
92529
|
+
const { build: build2 } = await import("esbuild");
|
|
92530
|
+
await (0, import_promises.mkdir)(vercelDir, { recursive: true });
|
|
92531
|
+
await build2({
|
|
92532
|
+
entryPoints: [vercelConfigPath],
|
|
92533
|
+
bundle: true,
|
|
92534
|
+
platform: "node",
|
|
92535
|
+
format: "esm",
|
|
92536
|
+
outfile: tempOutPath,
|
|
92537
|
+
packages: "external",
|
|
92538
|
+
target: "node20",
|
|
92539
|
+
sourcemap: "inline"
|
|
92540
|
+
});
|
|
92541
|
+
const loaderScript = `
|
|
92542
|
+
import { pathToFileURL } from 'url';
|
|
92543
|
+
const configModule = await import(pathToFileURL(process.argv[2]).href);
|
|
92544
|
+
const config = ('default' in configModule) ? configModule.default : ('config' in configModule) ? configModule.config : configModule;
|
|
92545
|
+
process.send(config);
|
|
92546
|
+
`;
|
|
92547
|
+
await (0, import_promises.writeFile)(loaderPath, loaderScript, "utf-8");
|
|
92548
|
+
const config2 = await new Promise((resolve13, reject) => {
|
|
92549
|
+
const child = (0, import_child_process3.fork)(loaderPath, [tempOutPath], {
|
|
92550
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"]
|
|
92551
|
+
});
|
|
92552
|
+
let stderrOutput = "";
|
|
92553
|
+
let stdoutOutput = "";
|
|
92554
|
+
if (child.stderr) {
|
|
92555
|
+
child.stderr.on("data", (data) => {
|
|
92556
|
+
stderrOutput += data.toString();
|
|
92557
|
+
});
|
|
92558
|
+
}
|
|
92559
|
+
if (child.stdout) {
|
|
92560
|
+
child.stdout.on("data", (data) => {
|
|
92561
|
+
stdoutOutput += data.toString();
|
|
92562
|
+
});
|
|
92563
|
+
}
|
|
92564
|
+
const timeout = setTimeout(() => {
|
|
92565
|
+
child.kill();
|
|
92566
|
+
reject(new Error("Config loader timed out after 10 seconds"));
|
|
92567
|
+
}, 1e4);
|
|
92568
|
+
child.on("message", (message2) => {
|
|
92569
|
+
clearTimeout(timeout);
|
|
92570
|
+
child.kill();
|
|
92571
|
+
resolve13(message2);
|
|
92572
|
+
});
|
|
92573
|
+
child.on("error", (err) => {
|
|
92574
|
+
clearTimeout(timeout);
|
|
92575
|
+
reject(err);
|
|
92576
|
+
});
|
|
92577
|
+
child.on("exit", (code2) => {
|
|
92578
|
+
clearTimeout(timeout);
|
|
92579
|
+
if (code2 !== 0) {
|
|
92580
|
+
if (stderrOutput.trim()) {
|
|
92581
|
+
output_manager_default.log(stderrOutput);
|
|
92582
|
+
}
|
|
92583
|
+
if (stdoutOutput.trim()) {
|
|
92584
|
+
output_manager_default.log(stdoutOutput);
|
|
92585
|
+
}
|
|
92586
|
+
const parsedError = parseConfigLoaderError(stderrOutput);
|
|
92587
|
+
if (parsedError) {
|
|
92588
|
+
reject(new Error(parsedError));
|
|
92589
|
+
} else if (stdoutOutput.trim()) {
|
|
92590
|
+
reject(new Error(stdoutOutput.trim()));
|
|
92591
|
+
} else {
|
|
92592
|
+
reject(new Error(`Config loader exited with code ${code2}`));
|
|
92593
|
+
}
|
|
92594
|
+
}
|
|
92595
|
+
});
|
|
92596
|
+
});
|
|
92597
|
+
await (0, import_promises.writeFile)(
|
|
92598
|
+
compiledConfigPath,
|
|
92599
|
+
JSON.stringify(config2, null, 2),
|
|
92600
|
+
"utf-8"
|
|
92601
|
+
);
|
|
92602
|
+
output_manager_default.debug(`Compiled ${vercelConfigPath} -> ${compiledConfigPath}`);
|
|
92603
|
+
return {
|
|
92604
|
+
configPath: compiledConfigPath,
|
|
92605
|
+
wasCompiled: true,
|
|
92606
|
+
sourceFile: await findSourceVercelConfigFile(workPath) ?? void 0
|
|
92607
|
+
};
|
|
92608
|
+
} catch (error3) {
|
|
92609
|
+
throw new import_build_utils5.NowBuildError({
|
|
92610
|
+
code: "vercel_ts_compilation_failed",
|
|
92611
|
+
message: `Failed to compile ${vercelConfigPath}: ${error3.message}`,
|
|
92612
|
+
link: "https://vercel.com/docs/projects/project-configuration"
|
|
92613
|
+
});
|
|
92614
|
+
} finally {
|
|
92615
|
+
await Promise.all([
|
|
92616
|
+
(0, import_promises.unlink)(tempOutPath).catch((err) => {
|
|
92617
|
+
if (err.code !== "ENOENT") {
|
|
92618
|
+
output_manager_default.debug(`Failed to cleanup temp file: ${err}`);
|
|
92619
|
+
}
|
|
92620
|
+
}),
|
|
92621
|
+
(0, import_promises.unlink)(loaderPath).catch((err) => {
|
|
92622
|
+
if (err.code !== "ENOENT") {
|
|
92623
|
+
output_manager_default.debug(`Failed to cleanup loader file: ${err}`);
|
|
92624
|
+
}
|
|
92625
|
+
})
|
|
92626
|
+
]);
|
|
92627
|
+
}
|
|
92628
|
+
}
|
|
92629
|
+
async function getVercelConfigPath(workPath) {
|
|
92630
|
+
const vercelJsonPath = (0, import_path11.join)(workPath, "vercel.json");
|
|
92631
|
+
const nowJsonPath = (0, import_path11.join)(workPath, "now.json");
|
|
92632
|
+
const compiledConfigPath = (0, import_path11.join)(workPath, VERCEL_DIR, "vercel.json");
|
|
92633
|
+
if (await fileExists(vercelJsonPath)) {
|
|
92634
|
+
return vercelJsonPath;
|
|
92635
|
+
}
|
|
92636
|
+
if (await fileExists(nowJsonPath)) {
|
|
92637
|
+
return nowJsonPath;
|
|
92638
|
+
}
|
|
92639
|
+
if (await fileExists(compiledConfigPath)) {
|
|
92640
|
+
return compiledConfigPath;
|
|
92641
|
+
}
|
|
92642
|
+
return nowJsonPath;
|
|
92643
|
+
}
|
|
92644
|
+
var import_promises, import_path11, import_child_process3, import_dotenv, import_build_utils5, VERCEL_CONFIG_EXTENSIONS, DEFAULT_VERCEL_CONFIG_FILENAME;
|
|
92645
|
+
var init_compile_vercel_config = __esm({
|
|
92646
|
+
"src/util/compile-vercel-config.ts"() {
|
|
92647
|
+
"use strict";
|
|
92648
|
+
import_promises = require("fs/promises");
|
|
92649
|
+
import_path11 = require("path");
|
|
92650
|
+
import_child_process3 = require("child_process");
|
|
92651
|
+
import_dotenv = __toESM3(require_main());
|
|
92652
|
+
init_output_manager();
|
|
92653
|
+
import_build_utils5 = require("@vercel/build-utils");
|
|
92654
|
+
init_link2();
|
|
92655
|
+
init_errors_ts();
|
|
92656
|
+
VERCEL_CONFIG_EXTENSIONS = [
|
|
92657
|
+
"ts",
|
|
92658
|
+
"mts",
|
|
92659
|
+
"js",
|
|
92660
|
+
"mjs",
|
|
92661
|
+
"cjs"
|
|
92662
|
+
];
|
|
92663
|
+
DEFAULT_VERCEL_CONFIG_FILENAME = "Vercel config";
|
|
92664
|
+
}
|
|
92665
|
+
});
|
|
92666
|
+
|
|
92355
92667
|
// src/util/config/files.ts
|
|
92356
92668
|
function getConfigFilePath() {
|
|
92357
92669
|
return CONFIG_FILE_PATH;
|
|
@@ -92395,31 +92707,30 @@ function readLocalConfig(prefix = process.cwd()) {
|
|
|
92395
92707
|
if (!config2) {
|
|
92396
92708
|
return;
|
|
92397
92709
|
}
|
|
92398
|
-
const isCompiledConfig = (0,
|
|
92710
|
+
const isCompiledConfig = (0, import_path12.basename)(target) === "vercel.json" && (0, import_path12.basename)((0, import_path12.dirname)(target)) === VERCEL_DIR;
|
|
92399
92711
|
if (isCompiledConfig) {
|
|
92400
|
-
const workPath = (0,
|
|
92401
|
-
const VERCEL_CONFIG_EXTENSIONS2 = ["ts", "mts", "js", "mjs", "cjs"];
|
|
92712
|
+
const workPath = (0, import_path12.dirname)((0, import_path12.dirname)(target));
|
|
92402
92713
|
let sourceFile = null;
|
|
92403
|
-
for (const ext of
|
|
92404
|
-
const configPath = (0,
|
|
92714
|
+
for (const ext of VERCEL_CONFIG_EXTENSIONS) {
|
|
92715
|
+
const configPath = (0, import_path12.join)(workPath, `vercel.${ext}`);
|
|
92405
92716
|
try {
|
|
92406
92717
|
(0, import_fs5.accessSync)(configPath, import_fs5.constants.F_OK);
|
|
92407
|
-
sourceFile = (0,
|
|
92718
|
+
sourceFile = (0, import_path12.basename)(configPath);
|
|
92408
92719
|
break;
|
|
92409
92720
|
} catch {
|
|
92410
92721
|
}
|
|
92411
92722
|
}
|
|
92412
|
-
config2[import_client.fileNameSymbol] = sourceFile ||
|
|
92723
|
+
config2[import_client.fileNameSymbol] = sourceFile || DEFAULT_VERCEL_CONFIG_FILENAME;
|
|
92413
92724
|
} else {
|
|
92414
|
-
config2[import_client.fileNameSymbol] = (0,
|
|
92725
|
+
config2[import_client.fileNameSymbol] = (0, import_path12.basename)(target);
|
|
92415
92726
|
}
|
|
92416
92727
|
return config2;
|
|
92417
92728
|
}
|
|
92418
|
-
var
|
|
92729
|
+
var import_path12, import_load_json_file, import_write_json_file, import_fs5, import_client, import_error_utils6, VERCEL_DIR2, CONFIG_FILE_PATH, AUTH_CONFIG_FILE_PATH, readConfigFile, writeToConfigFile, readAuthConfigFile, writeToAuthConfigFile;
|
|
92419
92730
|
var init_files = __esm({
|
|
92420
92731
|
"src/util/config/files.ts"() {
|
|
92421
92732
|
"use strict";
|
|
92422
|
-
|
|
92733
|
+
import_path12 = require("path");
|
|
92423
92734
|
import_load_json_file = __toESM3(require_load_json_file());
|
|
92424
92735
|
import_write_json_file = __toESM3(require_write_json_file());
|
|
92425
92736
|
import_fs5 = require("fs");
|
|
@@ -92430,10 +92741,11 @@ var init_files = __esm({
|
|
|
92430
92741
|
init_highlight();
|
|
92431
92742
|
import_error_utils6 = __toESM3(require_dist2());
|
|
92432
92743
|
init_link2();
|
|
92744
|
+
init_compile_vercel_config();
|
|
92433
92745
|
init_output_manager();
|
|
92434
92746
|
VERCEL_DIR2 = global_path_default();
|
|
92435
|
-
CONFIG_FILE_PATH = (0,
|
|
92436
|
-
AUTH_CONFIG_FILE_PATH = (0,
|
|
92747
|
+
CONFIG_FILE_PATH = (0, import_path12.join)(VERCEL_DIR2, "config.json");
|
|
92748
|
+
AUTH_CONFIG_FILE_PATH = (0, import_path12.join)(VERCEL_DIR2, "auth.json");
|
|
92437
92749
|
readConfigFile = () => {
|
|
92438
92750
|
const config2 = import_load_json_file.default.sync(CONFIG_FILE_PATH);
|
|
92439
92751
|
return config2;
|
|
@@ -92848,7 +93160,7 @@ var init_read_json_file = __esm({
|
|
|
92848
93160
|
async function getConfigPrefix() {
|
|
92849
93161
|
const paths = [
|
|
92850
93162
|
process.env.npm_config_userconfig || process.env.NPM_CONFIG_USERCONFIG,
|
|
92851
|
-
(0,
|
|
93163
|
+
(0, import_path14.join)(process.env.HOME || "/", ".npmrc"),
|
|
92852
93164
|
process.env.npm_config_globalconfig || process.env.NPM_CONFIG_GLOBALCONFIG
|
|
92853
93165
|
].filter(Boolean);
|
|
92854
93166
|
for (const configPath of paths) {
|
|
@@ -92867,19 +93179,19 @@ async function getConfigPrefix() {
|
|
|
92867
93179
|
}
|
|
92868
93180
|
async function isGlobal() {
|
|
92869
93181
|
try {
|
|
92870
|
-
if ((0,
|
|
93182
|
+
if ((0, import_path14.dirname)(process.argv[0]) === (0, import_path14.dirname)(process.argv[1])) {
|
|
92871
93183
|
return true;
|
|
92872
93184
|
}
|
|
92873
93185
|
const isWindows = process.platform === "win32";
|
|
92874
93186
|
const defaultPath = isWindows ? process.env.APPDATA : "/usr/local/lib";
|
|
92875
|
-
const installPath = await (0, import_fs_extra9.realpath)((0,
|
|
92876
|
-
if (installPath.includes(["", "yarn", "global", "node_modules", ""].join(
|
|
93187
|
+
const installPath = await (0, import_fs_extra9.realpath)((0, import_path14.resolve)(__dirname));
|
|
93188
|
+
if (installPath.includes(["", "yarn", "global", "node_modules", ""].join(import_path14.sep))) {
|
|
92877
93189
|
return true;
|
|
92878
93190
|
}
|
|
92879
|
-
if (installPath.includes(["", "pnpm", "global", ""].join(
|
|
93191
|
+
if (installPath.includes(["", "pnpm", "global", ""].join(import_path14.sep))) {
|
|
92880
93192
|
return true;
|
|
92881
93193
|
}
|
|
92882
|
-
if (installPath.includes(["", "fnm", "node-versions", ""].join(
|
|
93194
|
+
if (installPath.includes(["", "fnm", "node-versions", ""].join(import_path14.sep))) {
|
|
92883
93195
|
return true;
|
|
92884
93196
|
}
|
|
92885
93197
|
const prefixPath = process.env.PREFIX || process.env.npm_config_prefix || process.env.NPM_CONFIG_PREFIX || await getConfigPrefix() || defaultPath;
|
|
@@ -92894,8 +93206,8 @@ async function isGlobal() {
|
|
|
92894
93206
|
async function getUpdateCommand() {
|
|
92895
93207
|
const pkgAndVersion = `${packageName}@latest`;
|
|
92896
93208
|
const entrypoint = await (0, import_fs_extra9.realpath)(process.argv[1]);
|
|
92897
|
-
let { cliType, lockfilePath } = await (0,
|
|
92898
|
-
(0,
|
|
93209
|
+
let { cliType, lockfilePath } = await (0, import_build_utils6.scanParentDirs)(
|
|
93210
|
+
(0, import_path14.dirname)((0, import_path14.dirname)(entrypoint))
|
|
92899
93211
|
);
|
|
92900
93212
|
if (!lockfilePath) {
|
|
92901
93213
|
cliType = "npm";
|
|
@@ -92911,13 +93223,13 @@ async function getUpdateCommand() {
|
|
|
92911
93223
|
}
|
|
92912
93224
|
return `${cliType} ${install2} ${pkgAndVersion}`;
|
|
92913
93225
|
}
|
|
92914
|
-
var import_fs_extra9,
|
|
93226
|
+
var import_fs_extra9, import_path14, import_build_utils6;
|
|
92915
93227
|
var init_get_update_command = __esm({
|
|
92916
93228
|
"src/util/get-update-command.ts"() {
|
|
92917
93229
|
"use strict";
|
|
92918
93230
|
import_fs_extra9 = __toESM3(require_lib());
|
|
92919
|
-
|
|
92920
|
-
|
|
93231
|
+
import_path14 = require("path");
|
|
93232
|
+
import_build_utils6 = require("@vercel/build-utils");
|
|
92921
93233
|
init_pkg_name();
|
|
92922
93234
|
}
|
|
92923
93235
|
});
|
|
@@ -112604,7 +112916,7 @@ var require_namedTypes = __commonJS2({
|
|
|
112604
112916
|
});
|
|
112605
112917
|
|
|
112606
112918
|
// ../../node_modules/.pnpm/ast-types@0.13.4/node_modules/ast-types/main.js
|
|
112607
|
-
var
|
|
112919
|
+
var require_main2 = __commonJS2({
|
|
112608
112920
|
"../../node_modules/.pnpm/ast-types@0.13.4/node_modules/ast-types/main.js"(exports2) {
|
|
112609
112921
|
"use strict";
|
|
112610
112922
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -112689,7 +113001,7 @@ var require_degenerator = __commonJS2({
|
|
|
112689
113001
|
var util_1 = require("util");
|
|
112690
113002
|
var escodegen_1 = require_escodegen();
|
|
112691
113003
|
var esprima_1 = require_esprima();
|
|
112692
|
-
var ast_types_1 =
|
|
113004
|
+
var ast_types_1 = require_main2();
|
|
112693
113005
|
function degenerator(code2, _names) {
|
|
112694
113006
|
if (!Array.isArray(_names)) {
|
|
112695
113007
|
throw new TypeError('an array of async function "names" is required');
|
|
@@ -123921,7 +124233,7 @@ var require_signals2 = __commonJS2({
|
|
|
123921
124233
|
});
|
|
123922
124234
|
|
|
123923
124235
|
// ../../node_modules/.pnpm/human-signals@1.1.1/node_modules/human-signals/build/src/main.js
|
|
123924
|
-
var
|
|
124236
|
+
var require_main3 = __commonJS2({
|
|
123925
124237
|
"../../node_modules/.pnpm/human-signals@1.1.1/node_modules/human-signals/build/src/main.js"(exports2) {
|
|
123926
124238
|
"use strict";
|
|
123927
124239
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -123981,7 +124293,7 @@ var require_main2 = __commonJS2({
|
|
|
123981
124293
|
var require_error3 = __commonJS2({
|
|
123982
124294
|
"../../node_modules/.pnpm/execa@3.2.0/node_modules/execa/lib/error.js"(exports2, module2) {
|
|
123983
124295
|
"use strict";
|
|
123984
|
-
var { signalsByName } =
|
|
124296
|
+
var { signalsByName } = require_main3();
|
|
123985
124297
|
var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode: exitCode2, isCanceled }) => {
|
|
123986
124298
|
if (timedOut) {
|
|
123987
124299
|
return `timed out after ${timeout} milliseconds`;
|
|
@@ -128110,7 +128422,7 @@ async function getDeploymentForAlias(client2, args2, localConfigPath, user, cont
|
|
|
128110
128422
|
output_manager_default.stopSpinner();
|
|
128111
128423
|
}
|
|
128112
128424
|
}
|
|
128113
|
-
const appName = localConfig?.name ||
|
|
128425
|
+
const appName = localConfig?.name || import_path16.default.basename(import_path16.default.resolve(process.cwd(), localConfigPath || ""));
|
|
128114
128426
|
if (!appName) {
|
|
128115
128427
|
return null;
|
|
128116
128428
|
}
|
|
@@ -128120,11 +128432,11 @@ async function getDeploymentForAlias(client2, args2, localConfigPath, user, cont
|
|
|
128120
128432
|
output_manager_default.stopSpinner();
|
|
128121
128433
|
}
|
|
128122
128434
|
}
|
|
128123
|
-
var
|
|
128435
|
+
var import_path16, import_chalk38;
|
|
128124
128436
|
var init_get_deployment_by_alias = __esm({
|
|
128125
128437
|
"src/util/alias/get-deployment-by-alias.ts"() {
|
|
128126
128438
|
"use strict";
|
|
128127
|
-
|
|
128439
|
+
import_path16 = __toESM3(require("path"));
|
|
128128
128440
|
import_chalk38 = __toESM3(require_source());
|
|
128129
128441
|
init_get_deployments_by_appname();
|
|
128130
128442
|
init_get_deployment();
|
|
@@ -129667,7 +129979,7 @@ async function bisect(client2) {
|
|
|
129667
129979
|
let run = parsedArgs.flags["--run"] || "";
|
|
129668
129980
|
const openEnabled = parsedArgs.flags["--open"] || false;
|
|
129669
129981
|
if (run) {
|
|
129670
|
-
run = (0,
|
|
129982
|
+
run = (0, import_path17.resolve)(run);
|
|
129671
129983
|
}
|
|
129672
129984
|
bad = normalizeURL(bad);
|
|
129673
129985
|
let parsed = (0, import_url8.parse)(bad);
|
|
@@ -129895,14 +130207,14 @@ function getCommit(deployment) {
|
|
|
129895
130207
|
const message2 = deployment.meta?.githubCommitMessage || deployment.meta?.gitlabCommitMessage || deployment.meta?.bitbucketCommitMessage;
|
|
129896
130208
|
return { sha, message: message2 };
|
|
129897
130209
|
}
|
|
129898
|
-
var import_open2, import_execa2, import_pluralize3,
|
|
130210
|
+
var import_open2, import_execa2, import_pluralize3, import_path17, import_chalk43, import_url8;
|
|
129899
130211
|
var init_bisect2 = __esm({
|
|
129900
130212
|
"src/commands/bisect/index.ts"() {
|
|
129901
130213
|
"use strict";
|
|
129902
130214
|
import_open2 = __toESM3(require_open());
|
|
129903
130215
|
import_execa2 = __toESM3(require_execa());
|
|
129904
130216
|
import_pluralize3 = __toESM3(require_pluralize());
|
|
129905
|
-
|
|
130217
|
+
import_path17 = require("path");
|
|
129906
130218
|
import_chalk43 = __toESM3(require_source());
|
|
129907
130219
|
import_url8 = require("url");
|
|
129908
130220
|
init_box();
|
|
@@ -130260,7 +130572,7 @@ async function put2(client2, argv, rwToken) {
|
|
|
130260
130572
|
const stats = (0, import_node_fs.statSync)(filePath);
|
|
130261
130573
|
const isFile2 = stats.isFile();
|
|
130262
130574
|
if (isFile2) {
|
|
130263
|
-
const file = await (0,
|
|
130575
|
+
const file = await (0, import_promises2.open)(filePath, "r");
|
|
130264
130576
|
putBody = file.createReadStream();
|
|
130265
130577
|
pathname = pathnameFlag ?? (0, import_node_path.basename)(filePath);
|
|
130266
130578
|
} else {
|
|
@@ -130308,7 +130620,7 @@ async function put2(client2, argv, rwToken) {
|
|
|
130308
130620
|
output_manager_default.success(result.url);
|
|
130309
130621
|
return 0;
|
|
130310
130622
|
}
|
|
130311
|
-
var blob2, import_node_fs,
|
|
130623
|
+
var blob2, import_node_fs, import_promises2, import_error_utils13, import_node_path, import_chalk45;
|
|
130312
130624
|
var init_put2 = __esm({
|
|
130313
130625
|
"src/commands/blob/put.ts"() {
|
|
130314
130626
|
"use strict";
|
|
@@ -130318,7 +130630,7 @@ var init_put2 = __esm({
|
|
|
130318
130630
|
init_get_flags_specification();
|
|
130319
130631
|
init_command40();
|
|
130320
130632
|
import_node_fs = require("fs");
|
|
130321
|
-
|
|
130633
|
+
import_promises2 = require("fs/promises");
|
|
130322
130634
|
import_error_utils13 = __toESM3(require_dist2());
|
|
130323
130635
|
import_node_path = require("path");
|
|
130324
130636
|
init_pkg_name();
|
|
@@ -133458,55 +133770,6 @@ var init_blob2 = __esm({
|
|
|
133458
133770
|
}
|
|
133459
133771
|
});
|
|
133460
133772
|
|
|
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
|
-
|
|
133510
133773
|
// ../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js
|
|
133511
133774
|
var require_dist21 = __commonJS2({
|
|
133512
133775
|
"../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js"(exports2) {
|
|
@@ -135948,7 +136211,7 @@ async function initCorepack({
|
|
|
135948
136211
|
return null;
|
|
135949
136212
|
}
|
|
135950
136213
|
const pkg = await readJSONFile(
|
|
135951
|
-
(0,
|
|
136214
|
+
(0, import_path18.join)(repoRootPath, "package.json")
|
|
135952
136215
|
);
|
|
135953
136216
|
if (pkg instanceof CantParseJSONFile) {
|
|
135954
136217
|
output_manager_default.warn(
|
|
@@ -135963,15 +136226,15 @@ async function initCorepack({
|
|
|
135963
136226
|
output_manager_default.log(
|
|
135964
136227
|
`Detected ENABLE_EXPERIMENTAL_COREPACK=1 and "${pkg.packageManager}" in package.json`
|
|
135965
136228
|
);
|
|
135966
|
-
const corepackRootDir = (0,
|
|
135967
|
-
const corepackHomeDir = (0,
|
|
135968
|
-
const corepackShimDir = (0,
|
|
136229
|
+
const corepackRootDir = (0, import_path18.join)(repoRootPath, VERCEL_DIR, "cache", "corepack");
|
|
136230
|
+
const corepackHomeDir = (0, import_path18.join)(corepackRootDir, "home");
|
|
136231
|
+
const corepackShimDir = (0, import_path18.join)(corepackRootDir, "shim");
|
|
135969
136232
|
await import_fs_extra10.default.mkdirp(corepackHomeDir);
|
|
135970
136233
|
await import_fs_extra10.default.mkdirp(corepackShimDir);
|
|
135971
136234
|
process.env.COREPACK_HOME = corepackHomeDir;
|
|
135972
|
-
process.env.PATH = `${corepackShimDir}${
|
|
136235
|
+
process.env.PATH = `${corepackShimDir}${import_path18.delimiter}${process.env.PATH}`;
|
|
135973
136236
|
const pkgManagerName = pkg.packageManager.split("@")[0];
|
|
135974
|
-
await (0,
|
|
136237
|
+
await (0, import_build_utils8.spawnAsync)(
|
|
135975
136238
|
"corepack",
|
|
135976
136239
|
["enable", pkgManagerName, "--install-directory", corepackShimDir],
|
|
135977
136240
|
{
|
|
@@ -135988,17 +136251,17 @@ function cleanupCorepack(corepackShimDir) {
|
|
|
135988
136251
|
}
|
|
135989
136252
|
if (process.env.PATH) {
|
|
135990
136253
|
process.env.PATH = process.env.PATH.replace(
|
|
135991
|
-
`${corepackShimDir}${
|
|
136254
|
+
`${corepackShimDir}${import_path18.delimiter}`,
|
|
135992
136255
|
""
|
|
135993
136256
|
);
|
|
135994
136257
|
}
|
|
135995
136258
|
}
|
|
135996
|
-
var
|
|
136259
|
+
var import_path18, import_build_utils8, import_fs_extra10;
|
|
135997
136260
|
var init_corepack = __esm({
|
|
135998
136261
|
"src/util/build/corepack.ts"() {
|
|
135999
136262
|
"use strict";
|
|
136000
|
-
|
|
136001
|
-
|
|
136263
|
+
import_path18 = require("path");
|
|
136264
|
+
import_build_utils8 = require("@vercel/build-utils");
|
|
136002
136265
|
import_fs_extra10 = __toESM3(require_lib());
|
|
136003
136266
|
init_errors_ts();
|
|
136004
136267
|
init_link2();
|
|
@@ -136874,12 +137137,12 @@ __export3(static_builder_exports, {
|
|
|
136874
137137
|
shouldServe: () => shouldServe,
|
|
136875
137138
|
version: () => version
|
|
136876
137139
|
});
|
|
136877
|
-
var import_minimatch,
|
|
137140
|
+
var import_minimatch, import_build_utils9, version, build, shouldServe;
|
|
136878
137141
|
var init_static_builder = __esm({
|
|
136879
137142
|
"src/util/build/static-builder.ts"() {
|
|
136880
137143
|
"use strict";
|
|
136881
137144
|
import_minimatch = __toESM3(require_minimatch2());
|
|
136882
|
-
|
|
137145
|
+
import_build_utils9 = require("@vercel/build-utils");
|
|
136883
137146
|
version = 2;
|
|
136884
137147
|
build = async ({ entrypoint, files, config: config2 }) => {
|
|
136885
137148
|
const output2 = {};
|
|
@@ -136910,14 +137173,14 @@ var init_static_builder = __esm({
|
|
|
136910
137173
|
opts.entrypoint = `${outputDirectory}/${opts.entrypoint}`;
|
|
136911
137174
|
opts.requestPath = `${outputDirectory}/${opts.requestPath}`;
|
|
136912
137175
|
}
|
|
136913
|
-
return (0,
|
|
137176
|
+
return (0, import_build_utils9.shouldServe)(opts);
|
|
136914
137177
|
};
|
|
136915
137178
|
}
|
|
136916
137179
|
});
|
|
136917
137180
|
|
|
136918
137181
|
// src/util/build/import-builders.ts
|
|
136919
137182
|
async function importBuilders(builderSpecs, cwd) {
|
|
136920
|
-
const buildersDir = (0,
|
|
137183
|
+
const buildersDir = (0, import_path19.join)(cwd, VERCEL_DIR, "builders");
|
|
136921
137184
|
let importResult = await resolveBuilders(buildersDir, builderSpecs);
|
|
136922
137185
|
if ("buildersToAdd" in importResult) {
|
|
136923
137186
|
const installResult = await installBuilders(
|
|
@@ -136959,7 +137222,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
136959
137222
|
let pkgPath;
|
|
136960
137223
|
let builderPkg;
|
|
136961
137224
|
try {
|
|
136962
|
-
pkgPath = (0,
|
|
137225
|
+
pkgPath = (0, import_path19.join)(buildersDir, "node_modules", name, "package.json");
|
|
136963
137226
|
builderPkg = await (0, import_fs_extra11.readJSON)(pkgPath);
|
|
136964
137227
|
} catch (error3) {
|
|
136965
137228
|
if (!(0, import_error_utils14.isErrnoException)(error3)) {
|
|
@@ -136995,7 +137258,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
136995
137258
|
buildersToAdd.add(spec);
|
|
136996
137259
|
continue;
|
|
136997
137260
|
}
|
|
136998
|
-
const path11 = (0,
|
|
137261
|
+
const path11 = (0, import_path19.join)((0, import_path19.dirname)(pkgPath), builderPkg.main || "index.js");
|
|
136999
137262
|
const builder = require_(path11);
|
|
137000
137263
|
builders.set(spec, {
|
|
137001
137264
|
builder,
|
|
@@ -137006,7 +137269,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
137006
137269
|
path: path11,
|
|
137007
137270
|
pkgPath
|
|
137008
137271
|
});
|
|
137009
|
-
output_manager_default.debug(`Imported Builder "${name}" from "${(0,
|
|
137272
|
+
output_manager_default.debug(`Imported Builder "${name}" from "${(0, import_path19.dirname)(pkgPath)}"`);
|
|
137010
137273
|
} catch (err) {
|
|
137011
137274
|
if (err.code === "MODULE_NOT_FOUND" && !resolvedSpecs) {
|
|
137012
137275
|
output_manager_default.debug(`Failed to import "${name}": ${err}`);
|
|
@@ -137024,7 +137287,7 @@ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
|
137024
137287
|
}
|
|
137025
137288
|
async function installBuilders(buildersDir, buildersToAdd) {
|
|
137026
137289
|
const resolvedSpecs = /* @__PURE__ */ new Map();
|
|
137027
|
-
const buildersPkgPath = (0,
|
|
137290
|
+
const buildersPkgPath = (0, import_path19.join)(buildersDir, "package.json");
|
|
137028
137291
|
try {
|
|
137029
137292
|
const emptyPkgJson = {
|
|
137030
137293
|
private: true,
|
|
@@ -137076,10 +137339,10 @@ async function installBuilders(buildersDir, buildersToAdd) {
|
|
|
137076
137339
|
}
|
|
137077
137340
|
throw err;
|
|
137078
137341
|
}
|
|
137079
|
-
const nowScopePath = (0,
|
|
137342
|
+
const nowScopePath = (0, import_path19.join)(buildersDir, "node_modules/@now");
|
|
137080
137343
|
await (0, import_fs_extra11.mkdirp)(nowScopePath);
|
|
137081
137344
|
try {
|
|
137082
|
-
await (0, import_fs_extra11.symlink)("../@vercel/build-utils", (0,
|
|
137345
|
+
await (0, import_fs_extra11.symlink)("../@vercel/build-utils", (0, import_path19.join)(nowScopePath, "build-utils"));
|
|
137083
137346
|
} catch (err) {
|
|
137084
137347
|
if (!(0, import_error_utils14.isErrnoException)(err) || err.code !== "EEXIST") {
|
|
137085
137348
|
throw err;
|
|
@@ -137112,7 +137375,7 @@ function getErrorMessage(err, execaMessage) {
|
|
|
137112
137375
|
}
|
|
137113
137376
|
return execaMessage;
|
|
137114
137377
|
}
|
|
137115
|
-
var import_url9, import_pluralize4, import_npm_package_arg, import_semver2,
|
|
137378
|
+
var import_url9, import_pluralize4, import_npm_package_arg, import_semver2, import_path19, import_module2, import_fs_extra11, import_fs_detectors2, import_execa3, import_error_utils14, require_;
|
|
137116
137379
|
var init_import_builders = __esm({
|
|
137117
137380
|
"src/util/build/import-builders.ts"() {
|
|
137118
137381
|
"use strict";
|
|
@@ -137120,7 +137383,7 @@ var init_import_builders = __esm({
|
|
|
137120
137383
|
import_pluralize4 = __toESM3(require_pluralize());
|
|
137121
137384
|
import_npm_package_arg = __toESM3(require_npa());
|
|
137122
137385
|
import_semver2 = __toESM3(require_semver());
|
|
137123
|
-
|
|
137386
|
+
import_path19 = require("path");
|
|
137124
137387
|
import_module2 = require("module");
|
|
137125
137388
|
import_fs_extra11 = __toESM3(require_lib());
|
|
137126
137389
|
import_fs_detectors2 = __toESM3(require_dist8());
|
|
@@ -137140,11 +137403,11 @@ var init_import_builders = __esm({
|
|
|
137140
137403
|
// src/util/build/monorepo.ts
|
|
137141
137404
|
async function setMonorepoDefaultSettings(cwd, workPath, projectSettings) {
|
|
137142
137405
|
const localFileSystem = new import_fs_detectors3.LocalFileSystemDetector(cwd);
|
|
137143
|
-
const projectName = (0,
|
|
137144
|
-
const relativeToRoot = (0,
|
|
137406
|
+
const projectName = (0, import_path20.basename)(workPath);
|
|
137407
|
+
const relativeToRoot = (0, import_path20.relative)(workPath, cwd);
|
|
137145
137408
|
const setCommand = (command, value) => {
|
|
137146
137409
|
if (projectSettings[command]) {
|
|
137147
|
-
(0,
|
|
137410
|
+
(0, import_build_utils10.debug)(
|
|
137148
137411
|
`Skipping auto-assignment of ${command} as it is already set via project settings or configuration overrides.`
|
|
137149
137412
|
);
|
|
137150
137413
|
} else {
|
|
@@ -137154,7 +137417,7 @@ async function setMonorepoDefaultSettings(cwd, workPath, projectSettings) {
|
|
|
137154
137417
|
try {
|
|
137155
137418
|
const result = await (0, import_fs_detectors3.getMonorepoDefaultSettings)(
|
|
137156
137419
|
projectName,
|
|
137157
|
-
(0,
|
|
137420
|
+
(0, import_path20.relative)(cwd, workPath),
|
|
137158
137421
|
relativeToRoot,
|
|
137159
137422
|
localFileSystem
|
|
137160
137423
|
);
|
|
@@ -137185,14 +137448,14 @@ async function setMonorepoDefaultSettings(cwd, workPath, projectSettings) {
|
|
|
137185
137448
|
throw error3;
|
|
137186
137449
|
}
|
|
137187
137450
|
}
|
|
137188
|
-
var
|
|
137451
|
+
var import_path20, import_fs_detectors3, import_title3, import_build_utils10;
|
|
137189
137452
|
var init_monorepo = __esm({
|
|
137190
137453
|
"src/util/build/monorepo.ts"() {
|
|
137191
137454
|
"use strict";
|
|
137192
|
-
|
|
137455
|
+
import_path20 = require("path");
|
|
137193
137456
|
import_fs_detectors3 = __toESM3(require_dist8());
|
|
137194
137457
|
import_title3 = __toESM3(require_lib4());
|
|
137195
|
-
|
|
137458
|
+
import_build_utils10 = require("@vercel/build-utils");
|
|
137196
137459
|
init_output_manager();
|
|
137197
137460
|
}
|
|
137198
137461
|
});
|
|
@@ -145252,7 +145515,7 @@ var require_promisepipe = __commonJS2({
|
|
|
145252
145515
|
async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
145253
145516
|
const root = sourceRoot || source;
|
|
145254
145517
|
if (ignoreFilter) {
|
|
145255
|
-
const relPath = (0,
|
|
145518
|
+
const relPath = (0, import_path21.relative)(root, source);
|
|
145256
145519
|
if (relPath && !ignoreFilter(relPath)) {
|
|
145257
145520
|
await (0, import_fs_extra12.remove)(source);
|
|
145258
145521
|
return;
|
|
@@ -145278,7 +145541,7 @@ async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
|
145278
145541
|
} else {
|
|
145279
145542
|
await Promise.all(
|
|
145280
145543
|
contents.map(
|
|
145281
|
-
(name) => merge((0,
|
|
145544
|
+
(name) => merge((0, import_path21.join)(source, name), (0, import_path21.join)(destination, name), ignoreFilter, root)
|
|
145282
145545
|
)
|
|
145283
145546
|
);
|
|
145284
145547
|
await (0, import_fs_extra12.rmdir)(source);
|
|
@@ -145288,11 +145551,11 @@ async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
|
145288
145551
|
await (0, import_fs_extra12.remove)(destination);
|
|
145289
145552
|
await (0, import_fs_extra12.move)(source, destination);
|
|
145290
145553
|
}
|
|
145291
|
-
var
|
|
145554
|
+
var import_path21, import_error_utils15, import_fs_extra12;
|
|
145292
145555
|
var init_merge = __esm({
|
|
145293
145556
|
"src/util/build/merge.ts"() {
|
|
145294
145557
|
"use strict";
|
|
145295
|
-
|
|
145558
|
+
import_path21 = require("path");
|
|
145296
145559
|
import_error_utils15 = __toESM3(require_dist2());
|
|
145297
145560
|
import_fs_extra12 = __toESM3(require_lib());
|
|
145298
145561
|
}
|
|
@@ -147195,11 +147458,11 @@ async function unzip(buffer, dir) {
|
|
|
147195
147458
|
if (entry.fileName.startsWith("__MACOSX/"))
|
|
147196
147459
|
continue;
|
|
147197
147460
|
try {
|
|
147198
|
-
const destDir =
|
|
147461
|
+
const destDir = import_path22.default.dirname(import_path22.default.join(dir, entry.fileName));
|
|
147199
147462
|
await fs6.mkdirp(destDir);
|
|
147200
147463
|
const canonicalDestDir = await fs6.realpath(destDir);
|
|
147201
|
-
const relativeDestDir =
|
|
147202
|
-
if (relativeDestDir.split(
|
|
147464
|
+
const relativeDestDir = import_path22.default.relative(dir, canonicalDestDir);
|
|
147465
|
+
if (relativeDestDir.split(import_path22.default.sep).includes("..")) {
|
|
147203
147466
|
throw new Error(
|
|
147204
147467
|
`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`
|
|
147205
147468
|
);
|
|
@@ -147212,7 +147475,7 @@ async function unzip(buffer, dir) {
|
|
|
147212
147475
|
}
|
|
147213
147476
|
}
|
|
147214
147477
|
async function extractEntry(zipFile, entry, dir) {
|
|
147215
|
-
const dest =
|
|
147478
|
+
const dest = import_path22.default.join(dir, entry.fileName);
|
|
147216
147479
|
const mode = entry.externalFileAttributes >> 16 & 65535;
|
|
147217
147480
|
const IFMT = 61440;
|
|
147218
147481
|
const IFDIR = 16384;
|
|
@@ -147226,7 +147489,7 @@ async function extractEntry(zipFile, entry, dir) {
|
|
|
147226
147489
|
if (!isDir)
|
|
147227
147490
|
isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
|
147228
147491
|
const procMode = getExtractedMode(mode, isDir) & 511;
|
|
147229
|
-
const destDir = isDir ? dest :
|
|
147492
|
+
const destDir = isDir ? dest : import_path22.default.dirname(dest);
|
|
147230
147493
|
const mkdirOptions = { recursive: true };
|
|
147231
147494
|
if (isDir) {
|
|
147232
147495
|
mkdirOptions.mode = procMode;
|
|
@@ -147236,7 +147499,7 @@ async function extractEntry(zipFile, entry, dir) {
|
|
|
147236
147499
|
return;
|
|
147237
147500
|
const readStream = await zipFile.openReadStream(entry);
|
|
147238
147501
|
if (symlink3) {
|
|
147239
|
-
const link4 = await (0,
|
|
147502
|
+
const link4 = await (0, import_build_utils11.streamToBuffer)(readStream);
|
|
147240
147503
|
await fs6.symlink(link4.toString("utf8"), dest);
|
|
147241
147504
|
} else {
|
|
147242
147505
|
await (0, import_promisepipe.default)(readStream, fs6.createWriteStream(dest, { mode: procMode }));
|
|
@@ -147253,14 +147516,14 @@ function getExtractedMode(entryMode, isDir) {
|
|
|
147253
147516
|
}
|
|
147254
147517
|
return mode;
|
|
147255
147518
|
}
|
|
147256
|
-
var
|
|
147519
|
+
var import_path22, import_promisepipe, fs6, import_build_utils11, import_yauzl_promise;
|
|
147257
147520
|
var init_unzip = __esm({
|
|
147258
147521
|
"src/util/build/unzip.ts"() {
|
|
147259
147522
|
"use strict";
|
|
147260
|
-
|
|
147523
|
+
import_path22 = __toESM3(require("path"));
|
|
147261
147524
|
import_promisepipe = __toESM3(require_promisepipe());
|
|
147262
147525
|
fs6 = __toESM3(require_lib());
|
|
147263
|
-
|
|
147526
|
+
import_build_utils11 = require("@vercel/build-utils");
|
|
147264
147527
|
import_yauzl_promise = __toESM3(require_lib14());
|
|
147265
147528
|
}
|
|
147266
147529
|
});
|
|
@@ -147278,10 +147541,7 @@ async function writeBuildResult(args2) {
|
|
|
147278
147541
|
standalone,
|
|
147279
147542
|
workPath
|
|
147280
147543
|
} = args2;
|
|
147281
|
-
|
|
147282
|
-
if ((0, import_build_utils11.isExperimentalBackendsEnabled)() && "output" in buildResult) {
|
|
147283
|
-
version2 = 2;
|
|
147284
|
-
}
|
|
147544
|
+
const version2 = builder.version;
|
|
147285
147545
|
if (typeof version2 !== "number" || version2 === 2) {
|
|
147286
147546
|
return writeBuildResultV2({
|
|
147287
147547
|
repoRootPath,
|
|
@@ -147377,7 +147637,7 @@ async function writeBuildResultV2(args2) {
|
|
|
147377
147637
|
if (fallback) {
|
|
147378
147638
|
const ext = getFileExtension(fallback);
|
|
147379
147639
|
const fallbackName = `${normalizedPath}.prerender-fallback${ext}`;
|
|
147380
|
-
const fallbackPath = (0,
|
|
147640
|
+
const fallbackPath = (0, import_path23.join)(outputDir, "functions", fallbackName);
|
|
147381
147641
|
let usedHardLink = false;
|
|
147382
147642
|
if ("fsPath" in fallback) {
|
|
147383
147643
|
try {
|
|
@@ -147393,12 +147653,12 @@ async function writeBuildResultV2(args2) {
|
|
|
147393
147653
|
import_fs_extra13.default.createWriteStream(fallbackPath, { mode: fallback.mode })
|
|
147394
147654
|
);
|
|
147395
147655
|
}
|
|
147396
|
-
fallback = new
|
|
147656
|
+
fallback = new import_build_utils12.FileFsRef({
|
|
147397
147657
|
...output2.fallback,
|
|
147398
|
-
fsPath: (0,
|
|
147658
|
+
fsPath: (0, import_path23.basename)(fallbackName)
|
|
147399
147659
|
});
|
|
147400
147660
|
}
|
|
147401
|
-
const prerenderConfigPath = (0,
|
|
147661
|
+
const prerenderConfigPath = (0, import_path23.join)(
|
|
147402
147662
|
outputDir,
|
|
147403
147663
|
"functions",
|
|
147404
147664
|
`${normalizedPath}.prerender-config.json`
|
|
@@ -147445,45 +147705,58 @@ async function writeBuildResultV3(args2) {
|
|
|
147445
147705
|
workPath
|
|
147446
147706
|
} = args2;
|
|
147447
147707
|
const { output: output2 } = buildResult;
|
|
147448
|
-
const routesJsonPath = (0,
|
|
147449
|
-
if ((
|
|
147450
|
-
|
|
147451
|
-
|
|
147452
|
-
|
|
147453
|
-
|
|
147454
|
-
|
|
147455
|
-
|
|
147456
|
-
|
|
147457
|
-
|
|
147458
|
-
|
|
147459
|
-
|
|
147460
|
-
|
|
147461
|
-
|
|
147708
|
+
const routesJsonPath = (0, import_path23.join)(workPath, ".vercel", "routes.json");
|
|
147709
|
+
if ((0, import_build_utils12.isBackendBuilder)(build2) || build2.use === "@vercel/python") {
|
|
147710
|
+
if ((0, import_fs_extra13.existsSync)(routesJsonPath)) {
|
|
147711
|
+
try {
|
|
147712
|
+
const newOutput = {
|
|
147713
|
+
index: output2
|
|
147714
|
+
};
|
|
147715
|
+
const routesJson = await import_fs_extra13.default.readJSON(routesJsonPath);
|
|
147716
|
+
if (routesJson && typeof routesJson === "object" && "routes" in routesJson && Array.isArray(routesJson.routes)) {
|
|
147717
|
+
for (const route of routesJson.routes) {
|
|
147718
|
+
if (route.source === "/") {
|
|
147719
|
+
continue;
|
|
147720
|
+
}
|
|
147721
|
+
if (route.source) {
|
|
147722
|
+
newOutput[route.source] = output2;
|
|
147723
|
+
}
|
|
147462
147724
|
}
|
|
147463
147725
|
}
|
|
147726
|
+
return writeBuildResultV2({
|
|
147727
|
+
repoRootPath,
|
|
147728
|
+
outputDir,
|
|
147729
|
+
buildResult: { output: newOutput, routes: buildResult.routes },
|
|
147730
|
+
build: build2,
|
|
147731
|
+
vercelConfig,
|
|
147732
|
+
standalone,
|
|
147733
|
+
workPath
|
|
147734
|
+
});
|
|
147735
|
+
} catch (error3) {
|
|
147736
|
+
output_manager_default.error(`Failed to read routes.json: ${error3}`);
|
|
147464
147737
|
}
|
|
147738
|
+
}
|
|
147739
|
+
if ((0, import_build_utils12.isBackendBuilder)(build2) && (0, import_build_utils12.isExperimentalBackendsEnabled)() && "routes" in buildResult) {
|
|
147465
147740
|
return writeBuildResultV2({
|
|
147466
147741
|
repoRootPath,
|
|
147467
147742
|
outputDir,
|
|
147468
|
-
buildResult
|
|
147743
|
+
buildResult,
|
|
147469
147744
|
build: build2,
|
|
147470
147745
|
vercelConfig,
|
|
147471
147746
|
standalone,
|
|
147472
147747
|
workPath
|
|
147473
147748
|
});
|
|
147474
|
-
} catch (error3) {
|
|
147475
|
-
output_manager_default.error(`Failed to read routes.json: ${error3}`);
|
|
147476
147749
|
}
|
|
147477
147750
|
}
|
|
147478
147751
|
const src = build2.src;
|
|
147479
147752
|
if (typeof src !== "string") {
|
|
147480
147753
|
throw new Error(`Expected "build.src" to be a string`);
|
|
147481
147754
|
}
|
|
147482
|
-
const functionConfiguration = vercelConfig ? await (0,
|
|
147755
|
+
const functionConfiguration = vercelConfig ? await (0, import_build_utils12.getLambdaOptionsFromFunction)({
|
|
147483
147756
|
sourceFile: src,
|
|
147484
147757
|
config: vercelConfig
|
|
147485
147758
|
}) : {};
|
|
147486
|
-
const ext = (0,
|
|
147759
|
+
const ext = (0, import_path23.extname)(src);
|
|
147487
147760
|
const path11 = stripDuplicateSlashes(
|
|
147488
147761
|
build2.config?.zeroConfig ? src.substring(0, src.length - ext.length) : src
|
|
147489
147762
|
);
|
|
@@ -147516,7 +147789,7 @@ async function writeStaticFile(outputDir, file, path11, overrides, cleanUrls = f
|
|
|
147516
147789
|
let fsPath = path11;
|
|
147517
147790
|
let override = null;
|
|
147518
147791
|
const ext = getFileExtension(file);
|
|
147519
|
-
if (ext && (0,
|
|
147792
|
+
if (ext && (0, import_path23.extname)(path11) !== ext) {
|
|
147520
147793
|
fsPath += ext;
|
|
147521
147794
|
if (!override)
|
|
147522
147795
|
override = {};
|
|
@@ -147535,29 +147808,29 @@ async function writeStaticFile(outputDir, file, path11, overrides, cleanUrls = f
|
|
|
147535
147808
|
if (override) {
|
|
147536
147809
|
overrides[fsPath] = override;
|
|
147537
147810
|
}
|
|
147538
|
-
const dest = (0,
|
|
147539
|
-
await import_fs_extra13.default.mkdirp((0,
|
|
147811
|
+
const dest = (0, import_path23.join)(outputDir, "static", fsPath);
|
|
147812
|
+
await import_fs_extra13.default.mkdirp((0, import_path23.dirname)(dest));
|
|
147540
147813
|
if ("fsPath" in file) {
|
|
147541
147814
|
try {
|
|
147542
147815
|
return await import_fs_extra13.default.link(file.fsPath, dest);
|
|
147543
147816
|
} catch (_) {
|
|
147544
147817
|
}
|
|
147545
147818
|
}
|
|
147546
|
-
await (0,
|
|
147819
|
+
await (0, import_build_utils12.downloadFile)(file, dest);
|
|
147547
147820
|
}
|
|
147548
147821
|
async function writeFunctionSymlink(outputDir, dest, fn2, existingFunctions) {
|
|
147549
147822
|
const existingPath = existingFunctions.get(fn2);
|
|
147550
147823
|
if (!existingPath)
|
|
147551
147824
|
return false;
|
|
147552
|
-
const destDir = (0,
|
|
147553
|
-
const targetDest = (0,
|
|
147554
|
-
const target = (0,
|
|
147825
|
+
const destDir = (0, import_path23.dirname)(dest);
|
|
147826
|
+
const targetDest = (0, import_path23.join)(outputDir, "functions", `${existingPath}.func`);
|
|
147827
|
+
const target = (0, import_path23.relative)(destDir, targetDest);
|
|
147555
147828
|
await import_fs_extra13.default.mkdirp(destDir);
|
|
147556
147829
|
await import_fs_extra13.default.symlink(target, dest);
|
|
147557
147830
|
return true;
|
|
147558
147831
|
}
|
|
147559
147832
|
async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path11, existingFunctions, standalone = false) {
|
|
147560
|
-
const dest = (0,
|
|
147833
|
+
const dest = (0, import_path23.join)(outputDir, "functions", `${path11}.func`);
|
|
147561
147834
|
if (existingFunctions) {
|
|
147562
147835
|
if (await writeFunctionSymlink(
|
|
147563
147836
|
outputDir,
|
|
@@ -147571,26 +147844,26 @@ async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path11,
|
|
|
147571
147844
|
}
|
|
147572
147845
|
await import_fs_extra13.default.mkdirp(dest);
|
|
147573
147846
|
const ops = [];
|
|
147574
|
-
const sharedDest = (0,
|
|
147847
|
+
const sharedDest = (0, import_path23.join)(outputDir, "shared");
|
|
147575
147848
|
const { files, filePathMap, shared } = filesWithoutFsRefs(
|
|
147576
147849
|
edgeFunction.files,
|
|
147577
147850
|
repoRootPath,
|
|
147578
147851
|
sharedDest,
|
|
147579
147852
|
standalone
|
|
147580
147853
|
);
|
|
147581
|
-
ops.push((0,
|
|
147854
|
+
ops.push((0, import_build_utils12.download)(files, dest));
|
|
147582
147855
|
if (shared) {
|
|
147583
|
-
ops.push((0,
|
|
147856
|
+
ops.push((0, import_build_utils12.download)(shared, sharedDest));
|
|
147584
147857
|
}
|
|
147585
147858
|
const config2 = {
|
|
147586
147859
|
runtime: "edge",
|
|
147587
147860
|
...edgeFunction,
|
|
147588
|
-
entrypoint: (0,
|
|
147861
|
+
entrypoint: (0, import_build_utils12.normalizePath)(edgeFunction.entrypoint),
|
|
147589
147862
|
filePathMap,
|
|
147590
147863
|
files: void 0,
|
|
147591
147864
|
type: void 0
|
|
147592
147865
|
};
|
|
147593
|
-
const configPath = (0,
|
|
147866
|
+
const configPath = (0, import_path23.join)(dest, ".vc-config.json");
|
|
147594
147867
|
ops.push(
|
|
147595
147868
|
import_fs_extra13.default.writeJSON(configPath, config2, {
|
|
147596
147869
|
spaces: 2
|
|
@@ -147599,7 +147872,7 @@ async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path11,
|
|
|
147599
147872
|
await Promise.all(ops);
|
|
147600
147873
|
}
|
|
147601
147874
|
async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConfiguration, existingFunctions, standalone = false) {
|
|
147602
|
-
const dest = (0,
|
|
147875
|
+
const dest = (0, import_path23.join)(outputDir, "functions", `${path11}.func`);
|
|
147603
147876
|
if (existingFunctions) {
|
|
147604
147877
|
if (await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)) {
|
|
147605
147878
|
return;
|
|
@@ -147610,7 +147883,7 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147610
147883
|
const ops = [];
|
|
147611
147884
|
let filePathMap;
|
|
147612
147885
|
if (lambda.files) {
|
|
147613
|
-
const sharedDest = (0,
|
|
147886
|
+
const sharedDest = (0, import_path23.join)(outputDir, "shared");
|
|
147614
147887
|
const f = filesWithoutFsRefs(
|
|
147615
147888
|
lambda.files,
|
|
147616
147889
|
repoRootPath,
|
|
@@ -147618,9 +147891,9 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147618
147891
|
standalone
|
|
147619
147892
|
);
|
|
147620
147893
|
filePathMap = f.filePathMap;
|
|
147621
|
-
ops.push((0,
|
|
147894
|
+
ops.push((0, import_build_utils12.download)(f.files, dest));
|
|
147622
147895
|
if (f.shared) {
|
|
147623
|
-
ops.push((0,
|
|
147896
|
+
ops.push((0, import_build_utils12.download)(f.shared, sharedDest));
|
|
147624
147897
|
}
|
|
147625
147898
|
} else if (lambda.zipBuffer) {
|
|
147626
147899
|
ops.push(unzip(lambda.zipBuffer, dest));
|
|
@@ -147634,7 +147907,7 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147634
147907
|
const supportsCancellation = functionConfiguration?.supportsCancellation ?? lambda.supportsCancellation;
|
|
147635
147908
|
const config2 = {
|
|
147636
147909
|
...lambda,
|
|
147637
|
-
handler: (0,
|
|
147910
|
+
handler: (0, import_build_utils12.normalizePath)(lambda.handler),
|
|
147638
147911
|
architecture,
|
|
147639
147912
|
memory,
|
|
147640
147913
|
maxDuration,
|
|
@@ -147645,7 +147918,7 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147645
147918
|
files: void 0,
|
|
147646
147919
|
zipBuffer: void 0
|
|
147647
147920
|
};
|
|
147648
|
-
const configPath = (0,
|
|
147921
|
+
const configPath = (0, import_path23.join)(dest, ".vc-config.json");
|
|
147649
147922
|
ops.push(
|
|
147650
147923
|
import_fs_extra13.default.writeJSON(configPath, config2, {
|
|
147651
147924
|
spaces: 2
|
|
@@ -147653,11 +147926,11 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147653
147926
|
);
|
|
147654
147927
|
await Promise.all(ops);
|
|
147655
147928
|
for await (const dir of findDirs(".vercel", dest)) {
|
|
147656
|
-
const absDir = (0,
|
|
147929
|
+
const absDir = (0, import_path23.join)(dest, dir);
|
|
147657
147930
|
const entries = await import_fs_extra13.default.readdir(absDir);
|
|
147658
147931
|
if (entries.includes("cache")) {
|
|
147659
147932
|
await Promise.all(
|
|
147660
|
-
entries.filter((e2) => e2 !== "cache").map((entry) => import_fs_extra13.default.remove((0,
|
|
147933
|
+
entries.filter((e2) => e2 !== "cache").map((entry) => import_fs_extra13.default.remove((0, import_path23.join)(absDir, entry)))
|
|
147661
147934
|
);
|
|
147662
147935
|
} else {
|
|
147663
147936
|
await import_fs_extra13.default.remove(absDir);
|
|
@@ -147665,11 +147938,11 @@ async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConf
|
|
|
147665
147938
|
}
|
|
147666
147939
|
}
|
|
147667
147940
|
async function mergeBuilderOutput(outputDir, buildResult, workPath) {
|
|
147668
|
-
const absOutputDir = (0,
|
|
147941
|
+
const absOutputDir = (0, import_path23.resolve)(outputDir);
|
|
147669
147942
|
const { ig } = await (0, import_client3.getVercelIgnore)(workPath);
|
|
147670
147943
|
const filter = ig.createFilter();
|
|
147671
147944
|
if (absOutputDir === buildResult.buildOutputPath) {
|
|
147672
|
-
const staticDir = (0,
|
|
147945
|
+
const staticDir = (0, import_path23.join)(outputDir, "static");
|
|
147673
147946
|
try {
|
|
147674
147947
|
await cleanIgnoredFiles(staticDir, staticDir, filter);
|
|
147675
147948
|
} catch (err) {
|
|
@@ -147691,9 +147964,9 @@ async function cleanIgnoredFiles(dir, staticRoot, filter) {
|
|
|
147691
147964
|
const entries = await import_fs_extra13.default.readdir(dir);
|
|
147692
147965
|
await Promise.all(
|
|
147693
147966
|
entries.map(async (entry) => {
|
|
147694
|
-
const entryPath = (0,
|
|
147967
|
+
const entryPath = (0, import_path23.join)(dir, entry);
|
|
147695
147968
|
const stat2 = await import_fs_extra13.default.stat(entryPath);
|
|
147696
|
-
const relativePath = (0,
|
|
147969
|
+
const relativePath = (0, import_path23.relative)(staticRoot, entryPath);
|
|
147697
147970
|
if (stat2.isDirectory()) {
|
|
147698
147971
|
await cleanIgnoredFiles(entryPath, staticRoot, filter);
|
|
147699
147972
|
const remaining = await import_fs_extra13.default.readdir(entryPath);
|
|
@@ -147710,7 +147983,7 @@ async function cleanIgnoredFiles(dir, staticRoot, filter) {
|
|
|
147710
147983
|
function getFileExtension(file) {
|
|
147711
147984
|
let ext = "";
|
|
147712
147985
|
if (file.type === "FileFsRef") {
|
|
147713
|
-
ext = (0,
|
|
147986
|
+
ext = (0, import_path23.extname)(file.fsPath);
|
|
147714
147987
|
}
|
|
147715
147988
|
if (!ext && file.contentType) {
|
|
147716
147989
|
const e2 = import_mime_types.default.extension(file.contentType);
|
|
@@ -147731,7 +148004,7 @@ async function* findDirs(name, dir, root = dir) {
|
|
|
147731
148004
|
paths = [];
|
|
147732
148005
|
}
|
|
147733
148006
|
for (const path11 of paths) {
|
|
147734
|
-
const abs = (0,
|
|
148007
|
+
const abs = (0, import_path23.join)(dir, path11);
|
|
147735
148008
|
let stat2;
|
|
147736
148009
|
try {
|
|
147737
148010
|
stat2 = await import_fs_extra13.default.lstat(abs);
|
|
@@ -147742,7 +148015,7 @@ async function* findDirs(name, dir, root = dir) {
|
|
|
147742
148015
|
}
|
|
147743
148016
|
if (stat2.isDirectory()) {
|
|
147744
148017
|
if (path11 === name) {
|
|
147745
|
-
yield (0,
|
|
148018
|
+
yield (0, import_path23.relative)(root, abs);
|
|
147746
148019
|
} else {
|
|
147747
148020
|
yield* findDirs(name, abs, root);
|
|
147748
148021
|
}
|
|
@@ -147759,12 +148032,12 @@ function filesWithoutFsRefs(files, repoRootPath, sharedDest, standalone) {
|
|
|
147759
148032
|
filePathMap = {};
|
|
147760
148033
|
if (standalone && sharedDest) {
|
|
147761
148034
|
shared[path11] = file;
|
|
147762
|
-
filePathMap[(0,
|
|
147763
|
-
(0,
|
|
148035
|
+
filePathMap[(0, import_build_utils12.normalizePath)(path11)] = (0, import_build_utils12.normalizePath)(
|
|
148036
|
+
(0, import_path23.relative)(repoRootPath, (0, import_path23.join)(sharedDest, path11))
|
|
147764
148037
|
);
|
|
147765
148038
|
} else {
|
|
147766
|
-
filePathMap[(0,
|
|
147767
|
-
(0,
|
|
148039
|
+
filePathMap[(0, import_build_utils12.normalizePath)(path11)] = (0, import_build_utils12.normalizePath)(
|
|
148040
|
+
(0, import_path23.relative)(repoRootPath, file.fsPath)
|
|
147768
148041
|
);
|
|
147769
148042
|
}
|
|
147770
148043
|
} else {
|
|
@@ -147773,22 +148046,22 @@ function filesWithoutFsRefs(files, repoRootPath, sharedDest, standalone) {
|
|
|
147773
148046
|
}
|
|
147774
148047
|
return { files: out, filePathMap, shared };
|
|
147775
148048
|
}
|
|
147776
|
-
var import_fs_extra13, import_mime_types,
|
|
148049
|
+
var import_fs_extra13, import_mime_types, import_path23, import_build_utils12, import_promisepipe2, import_client3, normalize2, OUTPUT_DIR;
|
|
147777
148050
|
var init_write_build_result = __esm({
|
|
147778
148051
|
"src/util/build/write-build-result.ts"() {
|
|
147779
148052
|
"use strict";
|
|
147780
148053
|
import_fs_extra13 = __toESM3(require_lib());
|
|
147781
148054
|
import_mime_types = __toESM3(require_mime_types());
|
|
147782
|
-
|
|
147783
|
-
|
|
148055
|
+
import_path23 = require("path");
|
|
148056
|
+
import_build_utils12 = require("@vercel/build-utils");
|
|
147784
148057
|
import_promisepipe2 = __toESM3(require_promisepipe());
|
|
147785
148058
|
init_merge();
|
|
147786
148059
|
init_unzip();
|
|
147787
148060
|
init_link2();
|
|
147788
148061
|
import_client3 = __toESM3(require_dist7());
|
|
147789
148062
|
init_output_manager();
|
|
147790
|
-
({ normalize: normalize2 } =
|
|
147791
|
-
OUTPUT_DIR = (0,
|
|
148063
|
+
({ normalize: normalize2 } = import_path23.posix);
|
|
148064
|
+
OUTPUT_DIR = (0, import_path23.join)(VERCEL_DIR, "output");
|
|
147792
148065
|
}
|
|
147793
148066
|
});
|
|
147794
148067
|
|
|
@@ -147825,7 +148098,7 @@ async function staticFiles(path11, { src }) {
|
|
|
147825
148098
|
const { debug: debug2, time } = output_manager_default;
|
|
147826
148099
|
let files = [];
|
|
147827
148100
|
const source = src || ".";
|
|
147828
|
-
const search = (0,
|
|
148101
|
+
const search = (0, import_path24.resolve)(path11, source);
|
|
147829
148102
|
const { ig } = await (0, import_client4.getVercelIgnore)(path11);
|
|
147830
148103
|
const filter = ig.createFilter();
|
|
147831
148104
|
const prefixLength = path11.length + 1;
|
|
@@ -147885,12 +148158,12 @@ async function explode(paths, { accepts }) {
|
|
|
147885
148158
|
function notNull(value) {
|
|
147886
148159
|
return value !== null;
|
|
147887
148160
|
}
|
|
147888
|
-
var import_fs_extra14,
|
|
148161
|
+
var import_fs_extra14, import_path24, import_client4, asAbsolute;
|
|
147889
148162
|
var init_get_files = __esm({
|
|
147890
148163
|
"src/util/get-files.ts"() {
|
|
147891
148164
|
"use strict";
|
|
147892
148165
|
import_fs_extra14 = __toESM3(require_lib());
|
|
147893
|
-
|
|
148166
|
+
import_path24 = require("path");
|
|
147894
148167
|
import_client4 = __toESM3(require_dist7());
|
|
147895
148168
|
init_unique_strings();
|
|
147896
148169
|
init_output_manager();
|
|
@@ -147898,7 +148171,7 @@ var init_get_files = __esm({
|
|
|
147898
148171
|
if (path11[0] === "/") {
|
|
147899
148172
|
return path11;
|
|
147900
148173
|
}
|
|
147901
|
-
return (0,
|
|
148174
|
+
return (0, import_path24.resolve)(parent, path11);
|
|
147902
148175
|
};
|
|
147903
148176
|
}
|
|
147904
148177
|
});
|
|
@@ -147926,7 +148199,7 @@ async function writeProjectSettings(cwd, project, org, isRepoLinked) {
|
|
|
147926
148199
|
analyticsId
|
|
147927
148200
|
}
|
|
147928
148201
|
};
|
|
147929
|
-
const path11 = (0,
|
|
148202
|
+
const path11 = (0, import_path25.join)(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
|
|
147930
148203
|
return await (0, import_fs_extra15.outputJSON)(path11, projectLinkAndSettings, {
|
|
147931
148204
|
spaces: 2
|
|
147932
148205
|
});
|
|
@@ -147934,7 +148207,7 @@ async function writeProjectSettings(cwd, project, org, isRepoLinked) {
|
|
|
147934
148207
|
async function readProjectSettings(vercelDir) {
|
|
147935
148208
|
try {
|
|
147936
148209
|
return JSON.parse(
|
|
147937
|
-
await (0, import_fs_extra15.readFile)((0,
|
|
148210
|
+
await (0, import_fs_extra15.readFile)((0, import_path25.join)(vercelDir, VERCEL_DIR_PROJECT), "utf8")
|
|
147938
148211
|
);
|
|
147939
148212
|
} catch (err) {
|
|
147940
148213
|
if ((0, import_error_utils16.isErrnoException)(err) && err.code && ["ENOENT", "ENOTDIR"].includes(err.code)) {
|
|
@@ -147966,11 +148239,11 @@ function pickOverrides(vercelConfig) {
|
|
|
147966
148239
|
}
|
|
147967
148240
|
return overrides;
|
|
147968
148241
|
}
|
|
147969
|
-
var
|
|
148242
|
+
var import_path25, import_fs_extra15, import_error_utils16;
|
|
147970
148243
|
var init_project_settings = __esm({
|
|
147971
148244
|
"src/util/projects/project-settings.ts"() {
|
|
147972
148245
|
"use strict";
|
|
147973
|
-
|
|
148246
|
+
import_path25 = require("path");
|
|
147974
148247
|
import_fs_extra15 = __toESM3(require_lib());
|
|
147975
148248
|
init_link2();
|
|
147976
148249
|
import_error_utils16 = __toESM3(require_dist2());
|
|
@@ -148025,13 +148298,13 @@ function validateConfig(config2) {
|
|
|
148025
148298
|
if (validate.errors && validate.errors[0]) {
|
|
148026
148299
|
const error3 = validate.errors[0];
|
|
148027
148300
|
const fileName = config2[import_client5.fileNameSymbol] || "vercel.json";
|
|
148028
|
-
const niceError = (0,
|
|
148301
|
+
const niceError = (0, import_build_utils13.getPrettyError)(error3);
|
|
148029
148302
|
niceError.message = `Invalid ${fileName} - ${niceError.message}`;
|
|
148030
148303
|
return niceError;
|
|
148031
148304
|
}
|
|
148032
148305
|
}
|
|
148033
148306
|
if (config2.functions && config2.builds) {
|
|
148034
|
-
return new
|
|
148307
|
+
return new import_build_utils13.NowBuildError({
|
|
148035
148308
|
code: "FUNCTIONS_AND_BUILDS",
|
|
148036
148309
|
message: "The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",
|
|
148037
148310
|
link: "https://vercel.link/functions-and-builds"
|
|
@@ -148039,13 +148312,13 @@ function validateConfig(config2) {
|
|
|
148039
148312
|
}
|
|
148040
148313
|
return null;
|
|
148041
148314
|
}
|
|
148042
|
-
var import_ajv2, import_routing_utils,
|
|
148315
|
+
var import_ajv2, import_routing_utils, import_build_utils13, import_client5, imagesSchema, cronsSchema, customErrorPageSchema, vercelConfigSchema, ajv, validate;
|
|
148043
148316
|
var init_validate_config = __esm({
|
|
148044
148317
|
"src/util/validate-config.ts"() {
|
|
148045
148318
|
"use strict";
|
|
148046
148319
|
import_ajv2 = __toESM3(require_ajv());
|
|
148047
148320
|
import_routing_utils = __toESM3(require_dist23());
|
|
148048
|
-
|
|
148321
|
+
import_build_utils13 = require("@vercel/build-utils");
|
|
148049
148322
|
import_client5 = __toESM3(require_dist7());
|
|
148050
148323
|
imagesSchema = {
|
|
148051
148324
|
type: "object",
|
|
@@ -148210,14 +148483,14 @@ var init_validate_config = __esm({
|
|
|
148210
148483
|
// doesn't need to know about `regions`, `public`, etc.
|
|
148211
148484
|
additionalProperties: true,
|
|
148212
148485
|
properties: {
|
|
148213
|
-
builds:
|
|
148486
|
+
builds: import_build_utils13.buildsSchema,
|
|
148214
148487
|
routes: import_routing_utils.routesSchema,
|
|
148215
148488
|
cleanUrls: import_routing_utils.cleanUrlsSchema,
|
|
148216
148489
|
headers: import_routing_utils.headersSchema,
|
|
148217
148490
|
redirects: import_routing_utils.redirectsSchema,
|
|
148218
148491
|
rewrites: import_routing_utils.rewritesSchema,
|
|
148219
148492
|
trailingSlash: import_routing_utils.trailingSlashSchema,
|
|
148220
|
-
functions:
|
|
148493
|
+
functions: import_build_utils13.functionsSchema,
|
|
148221
148494
|
images: imagesSchema,
|
|
148222
148495
|
crons: cronsSchema,
|
|
148223
148496
|
customErrorPage: customErrorPageSchema,
|
|
@@ -148229,260 +148502,6 @@ var init_validate_config = __esm({
|
|
|
148229
148502
|
}
|
|
148230
148503
|
});
|
|
148231
148504
|
|
|
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
148505
|
// src/util/input/input-project.ts
|
|
148487
148506
|
async function inputProject(client2, org, detectedProjectName, autoConfirm = false) {
|
|
148488
148507
|
const slugifiedName = (0, import_slugify2.default)(detectedProjectName);
|
|
@@ -149598,7 +149617,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
|
|
|
149598
149617
|
process.env.VERCEL_TRACING_DISABLE_AUTOMATIC_FETCH_INSTRUMENTATION = "1";
|
|
149599
149618
|
}
|
|
149600
149619
|
if (vercelConfig) {
|
|
149601
|
-
vercelConfig[import_client6.fileNameSymbol] = "vercel.json";
|
|
149620
|
+
vercelConfig[import_client6.fileNameSymbol] = compileResult.wasCompiled ? compileResult.sourceFile || DEFAULT_VERCEL_CONFIG_FILENAME : "vercel.json";
|
|
149602
149621
|
} else if (nowConfig) {
|
|
149603
149622
|
nowConfig[import_client6.fileNameSymbol] = "now.json";
|
|
149604
149623
|
}
|
|
@@ -150135,7 +150154,7 @@ var init_build2 = __esm({
|
|
|
150135
150154
|
"src/commands/build/index.ts"() {
|
|
150136
150155
|
"use strict";
|
|
150137
150156
|
import_chalk56 = __toESM3(require_source());
|
|
150138
|
-
import_dotenv2 = __toESM3(
|
|
150157
|
+
import_dotenv2 = __toESM3(require_main());
|
|
150139
150158
|
import_fs_extra18 = __toESM3(require_lib());
|
|
150140
150159
|
import_minimatch2 = __toESM3(require_minimatch2());
|
|
150141
150160
|
import_path28 = require("path");
|
|
@@ -172181,7 +172200,7 @@ var init_server = __esm({
|
|
|
172181
172200
|
import_crypto2 = require("crypto");
|
|
172182
172201
|
import_serve_handler = __toESM3(require_src4());
|
|
172183
172202
|
import_chokidar = require("chokidar");
|
|
172184
|
-
import_dotenv3 = __toESM3(
|
|
172203
|
+
import_dotenv3 = __toESM3(require_main());
|
|
172185
172204
|
import_path36 = __toESM3(require("path"));
|
|
172186
172205
|
import_once = __toESM3(require_dist24());
|
|
172187
172206
|
import_directory = __toESM3(require_directory());
|
|
@@ -173169,7 +173188,7 @@ Please ensure that ${cmd(err.path)} is properly installed`;
|
|
|
173169
173188
|
return defaults;
|
|
173170
173189
|
}
|
|
173171
173190
|
}
|
|
173172
|
-
if ((0, import_build_utils18.
|
|
173191
|
+
if ((0, import_build_utils18.shouldUseExperimentalBackends)(frameworkSlug)) {
|
|
173173
173192
|
return "npx @vercel/cervel dev";
|
|
173174
173193
|
}
|
|
173175
173194
|
}
|
|
@@ -190495,7 +190514,7 @@ function ignoreError(error3) {
|
|
|
190495
190514
|
}
|
|
190496
190515
|
|
|
190497
190516
|
// src/util/get-config.ts
|
|
190498
|
-
var
|
|
190517
|
+
var import_path13 = __toESM3(require("path"));
|
|
190499
190518
|
var import_client2 = __toESM3(require_dist7());
|
|
190500
190519
|
init_errors_ts();
|
|
190501
190520
|
init_humanize_path();
|
|
@@ -190517,7 +190536,7 @@ async function getConfig(configFile) {
|
|
|
190517
190536
|
throw err;
|
|
190518
190537
|
}
|
|
190519
190538
|
if (configFile) {
|
|
190520
|
-
const localFilePath =
|
|
190539
|
+
const localFilePath = import_path13.default.resolve(localPath, configFile);
|
|
190521
190540
|
output_manager_default.debug(
|
|
190522
190541
|
`Found config in provided --local-config path ${localFilePath}`
|
|
190523
190542
|
);
|
|
@@ -190532,8 +190551,8 @@ async function getConfig(configFile) {
|
|
|
190532
190551
|
config[import_client2.fileNameSymbol] = configFile;
|
|
190533
190552
|
return config;
|
|
190534
190553
|
}
|
|
190535
|
-
const vercelFilePath =
|
|
190536
|
-
const nowFilePath =
|
|
190554
|
+
const vercelFilePath = import_path13.default.resolve(localPath, "vercel.json");
|
|
190555
|
+
const nowFilePath = import_path13.default.resolve(localPath, "now.json");
|
|
190537
190556
|
const [vercelConfig, nowConfig] = await Promise.all([
|
|
190538
190557
|
readJSONFile(vercelFilePath),
|
|
190539
190558
|
readJSONFile(nowFilePath)
|
|
@@ -190593,9 +190612,9 @@ init_box();
|
|
|
190593
190612
|
// src/util/extension/exec.ts
|
|
190594
190613
|
var import_which = __toESM3(require_lib12());
|
|
190595
190614
|
var import_execa = __toESM3(require_execa());
|
|
190596
|
-
var
|
|
190615
|
+
var import_path15 = require("path");
|
|
190597
190616
|
var import_async_listen2 = __toESM3(require_dist6());
|
|
190598
|
-
var
|
|
190617
|
+
var import_build_utils7 = require("@vercel/build-utils");
|
|
190599
190618
|
|
|
190600
190619
|
// src/util/extension/proxy.ts
|
|
190601
190620
|
var import_http2 = require("http");
|
|
@@ -190637,12 +190656,12 @@ var import_error_utils11 = __toESM3(require_dist2());
|
|
|
190637
190656
|
async function execExtension(client2, name, args2, cwd) {
|
|
190638
190657
|
const { debug: debug2, error: error3 } = output_manager_default;
|
|
190639
190658
|
const extensionCommand = `vercel-${name}`;
|
|
190640
|
-
const { packageJsonPath, lockfilePath } = await (0,
|
|
190659
|
+
const { packageJsonPath, lockfilePath } = await (0, import_build_utils7.scanParentDirs)(cwd);
|
|
190641
190660
|
const baseFile = lockfilePath || packageJsonPath;
|
|
190642
190661
|
let extensionPath = null;
|
|
190643
190662
|
if (baseFile) {
|
|
190644
|
-
extensionPath = await (0,
|
|
190645
|
-
base: (0,
|
|
190663
|
+
extensionPath = await (0, import_build_utils7.walkParentDirs)({
|
|
190664
|
+
base: (0, import_path15.dirname)(baseFile),
|
|
190646
190665
|
start: cwd,
|
|
190647
190666
|
filename: `node_modules/.bin/${extensionCommand}`
|
|
190648
190667
|
});
|