vercel 59.7.0 → 59.10.0
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/chunks/{add-7O4TM33A.js → add-IJZ2Q46B.js} +5 -5
- package/dist/chunks/{add-UVMFKSSY.js → add-KYLIIWQV.js} +2 -2
- package/dist/chunks/{add-UT6ZPA4F.js → add-SGSXZWCH.js} +2 -2
- package/dist/chunks/{build-SKKT3DIB.js → build-PKOCHFHL.js} +2 -2
- package/dist/chunks/{chunk-7HE63HCR.js → chunk-4KVJ2M4J.js} +148 -6
- package/dist/chunks/{chunk-2EH6SZRG.js → chunk-53J6IECW.js} +32 -19
- package/dist/chunks/{chunk-7IDPPWDN.js → chunk-5BZWQDNJ.js} +1 -1
- package/dist/chunks/{chunk-7KSICC3A.js → chunk-5JNGHAUT.js} +1 -1
- package/dist/chunks/{chunk-3PA7LXYM.js → chunk-7TYA36S5.js} +1 -1
- package/dist/chunks/{chunk-67IIZBBY.js → chunk-AXNMBJKD.js} +1 -1
- package/dist/chunks/{chunk-CBHLLOGZ.js → chunk-FNYNYZAZ.js} +3 -3
- package/dist/chunks/{chunk-63OX2DER.js → chunk-GRINZMFI.js} +1 -1
- package/dist/chunks/{chunk-2YRAWYGE.js → chunk-I526H4AS.js} +17 -0
- package/dist/chunks/{chunk-YJUO3EKH.js → chunk-KJBZ5ZST.js} +0 -1
- package/dist/chunks/{chunk-2T3IZZTJ.js → chunk-KTCVGTRQ.js} +1 -1
- package/dist/chunks/{chunk-WVPMR7XV.js → chunk-LCDVMLKI.js} +4 -4
- package/dist/chunks/{chunk-GK3RE3AC.js → chunk-MHO3EJAF.js} +2 -2
- package/dist/chunks/{chunk-MHCGKUI7.js → chunk-O6VHU65V.js} +19 -3
- package/dist/chunks/{chunk-IFNCPWH5.js → chunk-OBPBFJFP.js} +6 -7
- package/dist/chunks/{chunk-SSBYESJ5.js → chunk-QQ77K4QW.js} +1 -1
- package/dist/chunks/{chunk-NJCM5JJN.js → chunk-SRVP2UST.js} +1 -1
- package/dist/chunks/{chunk-XSYZDMUP.js → chunk-UTWU4DZF.js} +1 -1
- package/dist/chunks/{chunk-AFKB6VMO.js → chunk-VV5XULGR.js} +111 -8
- package/dist/chunks/{chunk-CMRZ4KI4.js → chunk-WC3XNI4B.js} +2 -2
- package/dist/chunks/{chunk-KD2N44NG.js → chunk-X6TBTUZZ.js} +1 -1
- package/dist/chunks/{chunk-DG6IMLCF.js → chunk-YLNIMGMQ.js} +3 -3
- package/dist/chunks/{chunk-MUMITVZP.js → chunk-Z2RKD7LL.js} +1 -1
- package/dist/chunks/{chunk-BQG777JE.js → chunk-Z44PATWW.js} +314 -195
- package/dist/chunks/{clear-X7M4WGBC.js → clear-J6TY2J3M.js} +2 -2
- package/dist/chunks/{compile-vercel-config-FBOZBWJC.js → compile-vercel-config-WVGNTJXO.js} +1 -1
- package/dist/chunks/{config-KGW667XC.js → config-3JDOCLH7.js} +5 -5
- package/dist/chunks/{config-RYPSCAR7.js → config-5T7XV4JE.js} +2 -2
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{delete-VK6FTDBI.js → delete-EPPNTNEW.js} +2 -2
- package/dist/chunks/{delete-OXYXXPHR.js → delete-XQOAWEZV.js} +2 -2
- package/dist/chunks/{disable-XRJTKNX4.js → disable-U5YAPWPA.js} +2 -2
- package/dist/chunks/{discard-NAPSPR6Y.js → discard-OCUCCXKO.js} +2 -2
- package/dist/chunks/{edit-WLG4GLU3.js → edit-CD7EXAO3.js} +2 -2
- package/dist/chunks/{edit-34GDLPQG.js → edit-PNRGHNGQ.js} +3 -3
- package/dist/chunks/{enable-IDKKVXKB.js → enable-25RH2LVW.js} +2 -2
- package/dist/chunks/{export-MPMU3FYY.js → export-YSGEUXJW.js} +2 -2
- package/dist/chunks/{image-RZ2A4FWP.js → image-4ZKCR4HL.js} +3 -3
- package/dist/chunks/{import-builders-GZPE5N44.js → import-builders-FQ2LOIWC.js} +2 -2
- package/dist/chunks/{inspect-X2Y5FDKR.js → inspect-3K2EDYL6.js} +3 -3
- package/dist/chunks/{inspect-56S2DKPO.js → inspect-F5DJM5DL.js} +2 -2
- package/dist/chunks/{inspect-OOV2ORKD.js → inspect-K2NJD2AI.js} +2 -2
- package/dist/chunks/{inspect-KGEMHV2T.js → inspect-WRBFJUSY.js} +2 -2
- package/dist/chunks/{inspect-EVDBNPP4.js → inspect-ZC4GRGTE.js} +2 -2
- package/dist/chunks/{list-TWSOAQRB.js → list-B7C56Z7B.js} +1 -1
- package/dist/chunks/{list-H357CF7M.js → list-PUFYWIOF.js} +3 -3
- package/dist/chunks/{list-FWLSZYMO.js → list-Z6VHQQBW.js} +2 -2
- package/dist/chunks/{login-54OPNB5E.js → login-ZYUF7JZQ.js} +2 -2
- package/dist/chunks/{ls-WGIRTAVM.js → ls-2OUQUKPT.js} +2 -2
- package/dist/chunks/{ls-WFMTVJOO.js → ls-ALX26ARH.js} +2 -2
- package/dist/chunks/{ls-ZMR5RMU4.js → ls-FNOL7XTY.js} +2 -2
- package/dist/chunks/{ls-VDFNIR5H.js → ls-PRY6OV4B.js} +3 -3
- package/dist/chunks/{ls-DU3S2GBJ.js → ls-SQRTT5RH.js} +2 -2
- package/dist/chunks/{ls-6JHFSJBJ.js → ls-TBBLZ766.js} +2 -2
- package/dist/chunks/{open-RCSCNKHF.js → open-673AJXYY.js} +2 -2
- package/dist/chunks/{permissions-XNN37R4N.js → permissions-B6SFNLN4.js} +4 -4
- package/dist/chunks/{publish-PLXEACYY.js → publish-TPJHZ2PJ.js} +2 -2
- package/dist/chunks/{push-EFYSB52Q.js → push-3WD5IPXP.js} +2 -2
- package/dist/chunks/{query-EKTXDOL7.js → query-ZXOJQZ7G.js} +1 -1
- package/dist/chunks/{reorder-OSA7D2RG.js → reorder-SUFOQGPC.js} +2 -2
- package/dist/chunks/{reply-6M2IYKLK.js → reply-YOVUA6ZF.js} +2 -2
- package/dist/chunks/{resolve-MCX5STKN.js → resolve-OQ7P74JY.js} +2 -2
- package/dist/chunks/{restore-52OEP3NL.js → restore-BD5XJOE7.js} +2 -2
- package/dist/chunks/{rm-2VAJFK25.js → rm-4KAI42EX.js} +2 -2
- package/dist/chunks/{rm-IYEDZOMN.js → rm-4UIILZLP.js} +2 -2
- package/dist/chunks/{rm-QW35WHSK.js → rm-5TY3QJUZ.js} +2 -2
- package/dist/chunks/{rm-TXV4GB4L.js → rm-EKVIZG2N.js} +3 -3
- package/dist/chunks/{rm-4BJN2LJX.js → rm-XAMQUW3J.js} +3 -3
- package/dist/chunks/{rule-inspect-WOBAN3Y2.js → rule-inspect-XZZE54SW.js} +3 -3
- package/dist/chunks/{rules-CUJRAZYO.js → rules-SF5FBWFF.js} +6 -6
- package/dist/chunks/{schema-VCGEJAOG.js → schema-3HRYA6AT.js} +1 -1
- package/dist/chunks/{set-2QSXMDVF.js → set-T4IYLXET.js} +3 -3
- package/dist/chunks/{tags-NHX2VQ7E.js → tags-EZKT46VN.js} +2 -2
- package/dist/chunks/{update-EOHXTT4N.js → update-OE7Y2J5I.js} +5 -5
- package/dist/commands/build/index.js +509 -66
- package/dist/commands/deploy/index.js +8 -8
- package/dist/commands/dev/index.js +20 -9
- package/dist/commands/env/index.js +4 -4
- package/dist/commands/link/index.js +3 -3
- package/dist/commands/list/index.js +3 -3
- package/dist/commands-bulk.js +2690 -1850
- package/dist/help.js +1 -1
- package/dist/index.js +9 -9
- package/dist/version.mjs +1 -1
- package/package.json +49 -49
|
@@ -11,21 +11,21 @@ import {
|
|
|
11
11
|
require_service_schedules,
|
|
12
12
|
require_write_build_result,
|
|
13
13
|
writeBuildResult
|
|
14
|
-
} from "../../chunks/chunk-
|
|
14
|
+
} from "../../chunks/chunk-VV5XULGR.js";
|
|
15
15
|
import {
|
|
16
16
|
importBuilders,
|
|
17
17
|
import_import_builders
|
|
18
|
-
} from "../../chunks/chunk-
|
|
18
|
+
} from "../../chunks/chunk-O6VHU65V.js";
|
|
19
19
|
import {
|
|
20
20
|
js_yaml_default,
|
|
21
21
|
pullCommandLogic
|
|
22
|
-
} from "../../chunks/chunk-
|
|
22
|
+
} from "../../chunks/chunk-FNYNYZAZ.js";
|
|
23
23
|
import {
|
|
24
24
|
require_semver
|
|
25
25
|
} from "../../chunks/chunk-IB5L4LKZ.js";
|
|
26
26
|
import {
|
|
27
27
|
readProjectSettings
|
|
28
|
-
} from "../../chunks/chunk-
|
|
28
|
+
} from "../../chunks/chunk-7TYA36S5.js";
|
|
29
29
|
import "../../chunks/chunk-7AEEQOD4.js";
|
|
30
30
|
import "../../chunks/chunk-5XECIWME.js";
|
|
31
31
|
import {
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from "../../chunks/chunk-FWKSJYDV.js";
|
|
38
38
|
import {
|
|
39
39
|
help
|
|
40
|
-
} from "../../chunks/chunk-
|
|
40
|
+
} from "../../chunks/chunk-I526H4AS.js";
|
|
41
41
|
import {
|
|
42
42
|
DEFAULT_VERCEL_CONFIG_FILENAME,
|
|
43
43
|
VERCEL_DIR,
|
|
@@ -60,10 +60,11 @@ import {
|
|
|
60
60
|
require_lib,
|
|
61
61
|
require_main,
|
|
62
62
|
require_minimatch,
|
|
63
|
+
require_runtime,
|
|
63
64
|
resolveProjectCwd,
|
|
64
65
|
ua_default,
|
|
65
66
|
validateConfig
|
|
66
|
-
} from "../../chunks/chunk-
|
|
67
|
+
} from "../../chunks/chunk-Z44PATWW.js";
|
|
67
68
|
import "../../chunks/chunk-FXD67VN5.js";
|
|
68
69
|
import {
|
|
69
70
|
TelemetryClient
|
|
@@ -274,6 +275,310 @@ var require_execute_builder = __commonJS({
|
|
|
274
275
|
}
|
|
275
276
|
});
|
|
276
277
|
|
|
278
|
+
// ../../internals/cli-builder-integration/dist/build-concurrency.js
|
|
279
|
+
var require_build_concurrency = __commonJS({
|
|
280
|
+
"../../internals/cli-builder-integration/dist/build-concurrency.js"(exports, module) {
|
|
281
|
+
"use strict";
|
|
282
|
+
var __create = Object.create;
|
|
283
|
+
var __defProp = Object.defineProperty;
|
|
284
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
285
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
286
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
287
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
288
|
+
var __export = (target, all) => {
|
|
289
|
+
for (var name in all)
|
|
290
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
291
|
+
};
|
|
292
|
+
var __copyProps = (to, from, except, desc) => {
|
|
293
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
294
|
+
for (let key of __getOwnPropNames(from))
|
|
295
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
296
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
297
|
+
}
|
|
298
|
+
return to;
|
|
299
|
+
};
|
|
300
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
301
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
302
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
303
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
304
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
305
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
306
|
+
mod
|
|
307
|
+
));
|
|
308
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
309
|
+
var build_concurrency_exports = {};
|
|
310
|
+
__export(build_concurrency_exports, {
|
|
311
|
+
getInstallScopeKey: () => getInstallScopeKey,
|
|
312
|
+
groupIntoScopeChains: () => groupIntoScopeChains,
|
|
313
|
+
resolveBuildConcurrency: () => resolveBuildConcurrency,
|
|
314
|
+
resolveInstallScopeRoot: () => resolveInstallScopeRoot,
|
|
315
|
+
runBuildsWithConcurrency: () => runBuildsWithConcurrency,
|
|
316
|
+
runWithConcurrency: () => runWithConcurrency
|
|
317
|
+
});
|
|
318
|
+
module.exports = __toCommonJS(build_concurrency_exports);
|
|
319
|
+
var import_node_os = __toESM2(__require("os"));
|
|
320
|
+
var import_node_fs3 = __require("fs");
|
|
321
|
+
var import_node_path3 = __require("path");
|
|
322
|
+
var MAX_AUTO_CONCURRENCY = 8;
|
|
323
|
+
function resolveBuildConcurrency(raw = process.env.VERCEL_EXPERIMENTAL_BUILD_CONCURRENCY) {
|
|
324
|
+
const value = raw?.trim();
|
|
325
|
+
if (!value)
|
|
326
|
+
return 1;
|
|
327
|
+
const parallelism = Math.max(
|
|
328
|
+
typeof import_node_os.default.availableParallelism === "function" ? import_node_os.default.availableParallelism() : import_node_os.default.cpus().length,
|
|
329
|
+
1
|
|
330
|
+
);
|
|
331
|
+
if (value.toLowerCase() === "auto") {
|
|
332
|
+
return Math.min(
|
|
333
|
+
Math.max(parallelism - 1, 2),
|
|
334
|
+
MAX_AUTO_CONCURRENCY,
|
|
335
|
+
parallelism
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
if (value.endsWith("%")) {
|
|
339
|
+
const pct = Number(value.slice(0, -1));
|
|
340
|
+
if (Number.isFinite(pct) && pct > 0) {
|
|
341
|
+
return Math.max(1, Math.floor(parallelism * pct / 100));
|
|
342
|
+
}
|
|
343
|
+
return 1;
|
|
344
|
+
}
|
|
345
|
+
const n = Number(value);
|
|
346
|
+
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 1;
|
|
347
|
+
}
|
|
348
|
+
async function runWithConcurrency(items, limit, fn, onSecondaryError) {
|
|
349
|
+
const queue = [...items];
|
|
350
|
+
const max = Math.max(limit, 1);
|
|
351
|
+
let active = 0;
|
|
352
|
+
let failed = false;
|
|
353
|
+
let firstError;
|
|
354
|
+
await new Promise((finish) => {
|
|
355
|
+
const enqueue = (item) => {
|
|
356
|
+
queue.push(item);
|
|
357
|
+
pump();
|
|
358
|
+
};
|
|
359
|
+
const pump = () => {
|
|
360
|
+
while (active < max && queue.length > 0 && !failed) {
|
|
361
|
+
const item = queue.shift();
|
|
362
|
+
active++;
|
|
363
|
+
fn(item, enqueue).then(
|
|
364
|
+
() => {
|
|
365
|
+
active--;
|
|
366
|
+
pump();
|
|
367
|
+
},
|
|
368
|
+
(err) => {
|
|
369
|
+
active--;
|
|
370
|
+
if (failed) {
|
|
371
|
+
onSecondaryError?.(err, item);
|
|
372
|
+
} else {
|
|
373
|
+
failed = true;
|
|
374
|
+
firstError = err;
|
|
375
|
+
}
|
|
376
|
+
pump();
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
if (active === 0)
|
|
381
|
+
finish();
|
|
382
|
+
};
|
|
383
|
+
pump();
|
|
384
|
+
});
|
|
385
|
+
if (failed)
|
|
386
|
+
throw firstError;
|
|
387
|
+
}
|
|
388
|
+
function getInstallScopeKey({
|
|
389
|
+
toolchain,
|
|
390
|
+
installDirectory,
|
|
391
|
+
installCommand
|
|
392
|
+
}) {
|
|
393
|
+
return JSON.stringify([
|
|
394
|
+
toolchain,
|
|
395
|
+
(0, import_node_path3.normalize)(installDirectory),
|
|
396
|
+
typeof installCommand === "string" ? ["cmd", installCommand.trim()] : "default"
|
|
397
|
+
]);
|
|
398
|
+
}
|
|
399
|
+
var NODE_LOCKFILES = [
|
|
400
|
+
"pnpm-lock.yaml",
|
|
401
|
+
"yarn.lock",
|
|
402
|
+
"package-lock.json",
|
|
403
|
+
"npm-shrinkwrap.json",
|
|
404
|
+
"bun.lock",
|
|
405
|
+
"bun.lockb"
|
|
406
|
+
];
|
|
407
|
+
async function fileExists(path) {
|
|
408
|
+
try {
|
|
409
|
+
await import_node_fs3.promises.stat(path);
|
|
410
|
+
return true;
|
|
411
|
+
} catch {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
var SERVICE_DIR_TOOLCHAINS = /* @__PURE__ */ new Set(["go", "ruby", "rust", "container"]);
|
|
416
|
+
async function resolveInstallScopeRoot({
|
|
417
|
+
toolchain,
|
|
418
|
+
serviceDir,
|
|
419
|
+
ceilingDir
|
|
420
|
+
}) {
|
|
421
|
+
if (toolchain !== "node" && toolchain !== "python") {
|
|
422
|
+
return SERVICE_DIR_TOOLCHAINS.has(toolchain) ? (0, import_node_path3.normalize)(serviceDir) : (0, import_node_path3.normalize)(ceilingDir);
|
|
423
|
+
}
|
|
424
|
+
const ceiling = (0, import_node_path3.normalize)(ceilingDir);
|
|
425
|
+
let dir = (0, import_node_path3.normalize)(serviceDir);
|
|
426
|
+
if (dir !== ceiling && !dir.startsWith(ceiling + import_node_path3.sep)) {
|
|
427
|
+
return dir;
|
|
428
|
+
}
|
|
429
|
+
let nearestLockfileDir;
|
|
430
|
+
let nearestPackageJsonDir;
|
|
431
|
+
let done = false;
|
|
432
|
+
while (!done) {
|
|
433
|
+
if (toolchain === "node") {
|
|
434
|
+
if (nearestLockfileDir === void 0) {
|
|
435
|
+
for (const lockfile of NODE_LOCKFILES) {
|
|
436
|
+
if (await fileExists((0, import_node_path3.join)(dir, lockfile))) {
|
|
437
|
+
nearestLockfileDir = dir;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (await fileExists((0, import_node_path3.join)(dir, "pnpm-workspace.yaml")))
|
|
443
|
+
return dir;
|
|
444
|
+
try {
|
|
445
|
+
const pkg = JSON.parse(
|
|
446
|
+
await import_node_fs3.promises.readFile((0, import_node_path3.join)(dir, "package.json"), "utf8")
|
|
447
|
+
);
|
|
448
|
+
if (pkg && typeof pkg === "object") {
|
|
449
|
+
if ("workspaces" in pkg)
|
|
450
|
+
return dir;
|
|
451
|
+
nearestPackageJsonDir ??= dir;
|
|
452
|
+
}
|
|
453
|
+
} catch {
|
|
454
|
+
}
|
|
455
|
+
} else {
|
|
456
|
+
try {
|
|
457
|
+
const pyproject = await import_node_fs3.promises.readFile(
|
|
458
|
+
(0, import_node_path3.join)(dir, "pyproject.toml"),
|
|
459
|
+
"utf8"
|
|
460
|
+
);
|
|
461
|
+
if (pyproject.includes("[tool.uv.workspace]"))
|
|
462
|
+
return dir;
|
|
463
|
+
} catch {
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
const parent = (0, import_node_path3.dirname)(dir);
|
|
467
|
+
done = dir === ceiling || parent === dir;
|
|
468
|
+
dir = parent;
|
|
469
|
+
}
|
|
470
|
+
return nearestLockfileDir ?? nearestPackageJsonDir ?? (0, import_node_path3.normalize)(serviceDir);
|
|
471
|
+
}
|
|
472
|
+
async function runBuildsWithConcurrency({
|
|
473
|
+
builds,
|
|
474
|
+
concurrency,
|
|
475
|
+
isEligible,
|
|
476
|
+
resolveScope,
|
|
477
|
+
forceSingleChain,
|
|
478
|
+
runBuild,
|
|
479
|
+
log,
|
|
480
|
+
reportSecondaryError
|
|
481
|
+
}) {
|
|
482
|
+
if (concurrency <= 1) {
|
|
483
|
+
for (const build of builds) {
|
|
484
|
+
await runBuild(build, false);
|
|
485
|
+
}
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const parallelBuilds = [];
|
|
489
|
+
const sequentialBuilds = [];
|
|
490
|
+
for (const build of builds) {
|
|
491
|
+
(isEligible(build) ? parallelBuilds : sequentialBuilds).push(build);
|
|
492
|
+
}
|
|
493
|
+
if (parallelBuilds.length > 0) {
|
|
494
|
+
let chains;
|
|
495
|
+
let siblingsOf;
|
|
496
|
+
if (forceSingleChain) {
|
|
497
|
+
chains = [parallelBuilds];
|
|
498
|
+
siblingsOf = /* @__PURE__ */ new Map();
|
|
499
|
+
} else {
|
|
500
|
+
const scopeByBuild = /* @__PURE__ */ new Map();
|
|
501
|
+
for (const build of parallelBuilds) {
|
|
502
|
+
scopeByBuild.set(build, await resolveScope(build));
|
|
503
|
+
}
|
|
504
|
+
({ chains, siblingsOf } = groupIntoScopeChains(
|
|
505
|
+
parallelBuilds,
|
|
506
|
+
(build) => scopeByBuild.get(build)
|
|
507
|
+
));
|
|
508
|
+
}
|
|
509
|
+
log(
|
|
510
|
+
`Running ${parallelBuilds.length} builds across ${chains.length} install scope${chains.length === 1 ? "" : "s"} (concurrency ${concurrency})`
|
|
511
|
+
);
|
|
512
|
+
let abortedRun = false;
|
|
513
|
+
const activeBuildOfChain = /* @__PURE__ */ new Map();
|
|
514
|
+
await runWithConcurrency(
|
|
515
|
+
chains,
|
|
516
|
+
concurrency,
|
|
517
|
+
async (chain, enqueue) => {
|
|
518
|
+
for (const build of chain) {
|
|
519
|
+
if (abortedRun)
|
|
520
|
+
return;
|
|
521
|
+
activeBuildOfChain.set(chain, build);
|
|
522
|
+
try {
|
|
523
|
+
await runBuild(build, true);
|
|
524
|
+
} catch (err) {
|
|
525
|
+
abortedRun = true;
|
|
526
|
+
throw err;
|
|
527
|
+
}
|
|
528
|
+
const siblings = siblingsOf.get(build);
|
|
529
|
+
if (siblings) {
|
|
530
|
+
for (const sibling of siblings)
|
|
531
|
+
enqueue([sibling]);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
(err, chain) => {
|
|
536
|
+
const build = activeBuildOfChain.get(chain);
|
|
537
|
+
if (build !== void 0)
|
|
538
|
+
reportSecondaryError(err, build);
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
for (const build of sequentialBuilds) {
|
|
543
|
+
await runBuild(build, false);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function groupIntoScopeChains(items, scopeOf) {
|
|
547
|
+
const chainByOuter = /* @__PURE__ */ new Map();
|
|
548
|
+
const leaderByInnerByOuter = /* @__PURE__ */ new Map();
|
|
549
|
+
const siblingsOf = /* @__PURE__ */ new Map();
|
|
550
|
+
for (const item of items) {
|
|
551
|
+
const scope = scopeOf(item);
|
|
552
|
+
let chain = chainByOuter.get(scope.outerKey);
|
|
553
|
+
if (!chain) {
|
|
554
|
+
chain = [];
|
|
555
|
+
chainByOuter.set(scope.outerKey, chain);
|
|
556
|
+
}
|
|
557
|
+
let leaderByInner = leaderByInnerByOuter.get(scope.outerKey);
|
|
558
|
+
if (!leaderByInner) {
|
|
559
|
+
leaderByInner = /* @__PURE__ */ new Map();
|
|
560
|
+
leaderByInnerByOuter.set(scope.outerKey, leaderByInner);
|
|
561
|
+
}
|
|
562
|
+
const leader = leaderByInner.get(scope.innerKey);
|
|
563
|
+
if (leader === void 0) {
|
|
564
|
+
leaderByInner.set(scope.innerKey, item);
|
|
565
|
+
chain.push(item);
|
|
566
|
+
} else if (scope.siblingsSkipInstall) {
|
|
567
|
+
let siblings = siblingsOf.get(leader);
|
|
568
|
+
if (!siblings) {
|
|
569
|
+
siblings = [];
|
|
570
|
+
siblingsOf.set(leader, siblings);
|
|
571
|
+
}
|
|
572
|
+
siblings.push(item);
|
|
573
|
+
} else {
|
|
574
|
+
chain.push(item);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return { chains: Array.from(chainByOuter.values()), siblingsOf };
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
|
|
277
582
|
// ../../internals/cli-builder-integration/dist/backend-rewrite-warning.js
|
|
278
583
|
var require_backend_rewrite_warning = __commonJS({
|
|
279
584
|
"../../internals/cli-builder-integration/dist/backend-rewrite-warning.js"(exports, module) {
|
|
@@ -1088,7 +1393,7 @@ var require_monorepo = __commonJS({
|
|
|
1088
1393
|
module.exports = __toCommonJS(monorepo_exports);
|
|
1089
1394
|
var import_path2 = __require("path");
|
|
1090
1395
|
var import_fs_detectors = require_dist2();
|
|
1091
|
-
var
|
|
1396
|
+
var import_runtime = require_runtime();
|
|
1092
1397
|
var import_title = __toESM2(require_lib2());
|
|
1093
1398
|
var import_fs_extra2 = __toESM2(require_lib());
|
|
1094
1399
|
var import_build_utils3 = __require("@vercel/build-utils");
|
|
@@ -1161,7 +1466,7 @@ var require_monorepo = __commonJS({
|
|
|
1161
1466
|
);
|
|
1162
1467
|
continue;
|
|
1163
1468
|
}
|
|
1164
|
-
const runtime = (0,
|
|
1469
|
+
const runtime = (0, import_runtime.inferRuntime)({
|
|
1165
1470
|
runtime: config.runtime,
|
|
1166
1471
|
framework: config.framework,
|
|
1167
1472
|
entrypoint: config.entrypoint
|
|
@@ -1279,7 +1584,8 @@ var require_corepack = __commonJS({
|
|
|
1279
1584
|
repoRootPath,
|
|
1280
1585
|
output,
|
|
1281
1586
|
readJSONFile: readJSONFile2,
|
|
1282
|
-
isCantParseJSONFile
|
|
1587
|
+
isCantParseJSONFile,
|
|
1588
|
+
warmPackageManager = false
|
|
1283
1589
|
}) {
|
|
1284
1590
|
if (process.env.ENABLE_EXPERIMENTAL_COREPACK !== "1") {
|
|
1285
1591
|
return null;
|
|
@@ -1315,6 +1621,18 @@ var require_corepack = __commonJS({
|
|
|
1315
1621
|
prettyCommand: `corepack enable ${pkgManagerName}`
|
|
1316
1622
|
}
|
|
1317
1623
|
);
|
|
1624
|
+
if (warmPackageManager) {
|
|
1625
|
+
try {
|
|
1626
|
+
await (0, import_build_utils3.spawnAsync)(pkgManagerName, ["--version"], {
|
|
1627
|
+
prettyCommand: `${pkgManagerName} --version`,
|
|
1628
|
+
stdio: "pipe"
|
|
1629
|
+
});
|
|
1630
|
+
} catch (err) {
|
|
1631
|
+
output.debug(
|
|
1632
|
+
`Failed to pre-download "${pkg.packageManager}" via corepack: ${err instanceof Error ? err.message : String(err)}`
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1318
1636
|
return corepackShimDir;
|
|
1319
1637
|
}
|
|
1320
1638
|
return null;
|
|
@@ -1383,6 +1701,7 @@ var require_do_build = __commonJS({
|
|
|
1383
1701
|
var import_write_build_result3 = require_write_build_result();
|
|
1384
1702
|
var import_build_runner2 = require_build_runner();
|
|
1385
1703
|
var import_execute_builder = require_execute_builder();
|
|
1704
|
+
var import_build_concurrency = require_build_concurrency();
|
|
1386
1705
|
var import_backend_rewrite_warning = require_backend_rewrite_warning();
|
|
1387
1706
|
var import_service_route_ownership = require_service_route_ownership();
|
|
1388
1707
|
var import_service_schedules = require_service_schedules();
|
|
@@ -1417,13 +1736,6 @@ var require_do_build = __commonJS({
|
|
|
1417
1736
|
function hasNonEmptyObject(value) {
|
|
1418
1737
|
return value != null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
1419
1738
|
}
|
|
1420
|
-
function unsetServiceBuildImmutableEnvVars(restoreEnv) {
|
|
1421
|
-
for (const key of SERVICE_BUILD_IMMUTABLE_ENV_VARS) {
|
|
1422
|
-
if (!restoreEnv.has(key))
|
|
1423
|
-
restoreEnv.set(key, process.env[key]);
|
|
1424
|
-
delete process.env[key];
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
1739
|
function getGeneratedServiceAlreadyBuiltWarning(service) {
|
|
1428
1740
|
const framework = service.framework ?? "unknown";
|
|
1429
1741
|
const entrypoint = service.entrypoint ?? service.builder.src ?? "unknown";
|
|
@@ -1444,6 +1756,7 @@ var require_do_build = __commonJS({
|
|
|
1444
1756
|
const {
|
|
1445
1757
|
output,
|
|
1446
1758
|
createBuildRunner: createBuildRunner2,
|
|
1759
|
+
canBuildInSubprocess: canBuildInSubprocess2,
|
|
1447
1760
|
importBuilders: importBuilders2,
|
|
1448
1761
|
formatResolvedBuilders: formatResolvedBuilders2,
|
|
1449
1762
|
writeBuildResult: writeBuildResult2,
|
|
@@ -1466,7 +1779,8 @@ var require_do_build = __commonJS({
|
|
|
1466
1779
|
repoRootPath,
|
|
1467
1780
|
output,
|
|
1468
1781
|
readJSONFile: readJSONFile2,
|
|
1469
|
-
isCantParseJSONFile
|
|
1782
|
+
isCantParseJSONFile,
|
|
1783
|
+
warmPackageManager: (0, import_build_concurrency.resolveBuildConcurrency)() > 1
|
|
1470
1784
|
});
|
|
1471
1785
|
const installDepsSpan = span.child("vc.installDeps");
|
|
1472
1786
|
let installRan = false;
|
|
@@ -1804,7 +2118,8 @@ var require_do_build = __commonJS({
|
|
|
1804
2118
|
repoRootPath,
|
|
1805
2119
|
output,
|
|
1806
2120
|
readJSONFile: readJSONFile2,
|
|
1807
|
-
isCantParseJSONFile
|
|
2121
|
+
isCantParseJSONFile,
|
|
2122
|
+
warmPackageManager: (0, import_build_concurrency.resolveBuildConcurrency)() > 1
|
|
1808
2123
|
});
|
|
1809
2124
|
}
|
|
1810
2125
|
const diagnostics = {};
|
|
@@ -1823,11 +2138,12 @@ var require_do_build = __commonJS({
|
|
|
1823
2138
|
}
|
|
1824
2139
|
const preDeployEntries = [];
|
|
1825
2140
|
const liveRunners = /* @__PURE__ */ new Set();
|
|
2141
|
+
const buildOrdinals = /* @__PURE__ */ new Map();
|
|
1826
2142
|
const runBuilders = async (buildsToRun) => {
|
|
1827
2143
|
await addBuildsToBuildJson(buildsToRun);
|
|
1828
|
-
|
|
2144
|
+
const buildOne = async (build, concurrent) => {
|
|
1829
2145
|
if (typeof build.src !== "string")
|
|
1830
|
-
|
|
2146
|
+
return;
|
|
1831
2147
|
const builderWithPkg = buildersWithPkgs.get(build.use);
|
|
1832
2148
|
if (!builderWithPkg) {
|
|
1833
2149
|
throw new Error(`Failed to load Builder "${build.use}"`);
|
|
@@ -1855,6 +2171,16 @@ var require_do_build = __commonJS({
|
|
|
1855
2171
|
`Service "${service.name}": workspace-rooted build at "${buildWorkPath}", entrypoint "${buildEntrypoint}" (original: "${build.src}")`
|
|
1856
2172
|
);
|
|
1857
2173
|
}
|
|
2174
|
+
const restoreEnv = /* @__PURE__ */ new Map();
|
|
2175
|
+
const perBuildEnv = concurrent ? { ...process.env } : process.env;
|
|
2176
|
+
const setBuildEnv = (key, value) => {
|
|
2177
|
+
if (!concurrent)
|
|
2178
|
+
restoreEnv.set(key, process.env[key]);
|
|
2179
|
+
if (value === void 0)
|
|
2180
|
+
delete perBuildEnv[key];
|
|
2181
|
+
else
|
|
2182
|
+
perBuildEnv[key] = value;
|
|
2183
|
+
};
|
|
1858
2184
|
const settingsForEnv = service ? {
|
|
1859
2185
|
buildCommand: service.buildCommand ?? void 0,
|
|
1860
2186
|
installCommand: service.installCommand ?? void 0,
|
|
@@ -1869,19 +2195,15 @@ var require_do_build = __commonJS({
|
|
|
1869
2195
|
]) {
|
|
1870
2196
|
const value = settingsForEnv[key];
|
|
1871
2197
|
const envKey = `VERCEL_PROJECT_SETTINGS_` + key.replace(/[A-Z]/g, (letter) => `_${letter}`).toUpperCase();
|
|
2198
|
+
setBuildEnv(envKey, typeof value === "string" ? value : void 0);
|
|
1872
2199
|
if (typeof value === "string") {
|
|
1873
|
-
process.env[envKey] = value;
|
|
1874
2200
|
output.debug(`Setting env ${envKey} to "${value}"`);
|
|
1875
|
-
} else {
|
|
1876
|
-
delete process.env[envKey];
|
|
1877
2201
|
}
|
|
1878
2202
|
}
|
|
1879
2203
|
const isFrontendBuilder = build.config && "framework" in build.config;
|
|
1880
2204
|
const builderFramework = build.config?.framework ?? projectSettings.framework;
|
|
1881
|
-
const
|
|
1882
|
-
|
|
1883
|
-
buildWorkPath
|
|
1884
|
-
) : void 0;
|
|
2205
|
+
const isApiDir = isZeroConfig && !service && !isFrontendBuilder;
|
|
2206
|
+
const apiDirFramework = isApiDir ? await apiDirFrameworkDetector.detect(build.use ?? "", buildWorkPath) : void 0;
|
|
1885
2207
|
let buildConfig;
|
|
1886
2208
|
if (isZeroConfig) {
|
|
1887
2209
|
if (service) {
|
|
@@ -1936,7 +2258,10 @@ var require_do_build = __commonJS({
|
|
|
1936
2258
|
const serviceRoutePrefix = build.config?.routePrefix;
|
|
1937
2259
|
const serviceConfigWorkspace = build.config?.workspace;
|
|
1938
2260
|
const preDeployCmd = legacyExperimentalService?.preDeployCommand?.trim();
|
|
1939
|
-
const preDeployEntry = preDeployCmd && service ? {
|
|
2261
|
+
const preDeployEntry = preDeployCmd && service ? {
|
|
2262
|
+
ordinal: buildOrdinals.get(build) ?? Number.MAX_SAFE_INTEGER,
|
|
2263
|
+
service: service.name
|
|
2264
|
+
} : void 0;
|
|
1940
2265
|
if (preDeployEntry) {
|
|
1941
2266
|
preDeployEntries.push(preDeployEntry);
|
|
1942
2267
|
}
|
|
@@ -1969,7 +2294,6 @@ var require_do_build = __commonJS({
|
|
|
1969
2294
|
output.debug(
|
|
1970
2295
|
`Building entrypoint "${build.src}" with "${builderPkg.name}"`
|
|
1971
2296
|
);
|
|
1972
|
-
const restoreEnv = /* @__PURE__ */ new Map();
|
|
1973
2297
|
if (detectedServices && legacyExperimentalService?.env) {
|
|
1974
2298
|
const perServiceEnv = (0, import_build_utils3.getServiceUrlEnvVars)({
|
|
1975
2299
|
requestedEnv: legacyExperimentalService.env,
|
|
@@ -1982,13 +2306,14 @@ var require_do_build = __commonJS({
|
|
|
1982
2306
|
for (const [key, value] of Object.entries(perServiceEnv)) {
|
|
1983
2307
|
if (key in process.env)
|
|
1984
2308
|
continue;
|
|
1985
|
-
|
|
1986
|
-
process.env[key] = value;
|
|
2309
|
+
setBuildEnv(key, value);
|
|
1987
2310
|
output.debug(`Injected service URL env var: ${key}=${value}`);
|
|
1988
2311
|
}
|
|
1989
2312
|
}
|
|
1990
2313
|
if (service) {
|
|
1991
|
-
|
|
2314
|
+
for (const key of SERVICE_BUILD_IMMUTABLE_ENV_VARS) {
|
|
2315
|
+
setBuildEnv(key, void 0);
|
|
2316
|
+
}
|
|
1992
2317
|
}
|
|
1993
2318
|
let buildResult;
|
|
1994
2319
|
let rawBuildResult;
|
|
@@ -1997,7 +2322,8 @@ var require_do_build = __commonJS({
|
|
|
1997
2322
|
buildOptions,
|
|
1998
2323
|
cwd: buildWorkPath,
|
|
1999
2324
|
expectsPreDeploy: Boolean(preDeployCmd),
|
|
2000
|
-
builderSpan
|
|
2325
|
+
builderSpan,
|
|
2326
|
+
env: perBuildEnv
|
|
2001
2327
|
};
|
|
2002
2328
|
const runner = createBuildRunner2?.({
|
|
2003
2329
|
ctx: runnerContext,
|
|
@@ -2006,6 +2332,11 @@ var require_do_build = __commonJS({
|
|
|
2006
2332
|
builderPath: builderWithPkg.path,
|
|
2007
2333
|
hasBuildCallback: Boolean(buildOptions.buildCallback)
|
|
2008
2334
|
}) ?? new import_build_runner2.InprocessBuildRunner(runnerContext, builder);
|
|
2335
|
+
if (concurrent && runner instanceof import_build_runner2.InprocessBuildRunner) {
|
|
2336
|
+
throw new Error(
|
|
2337
|
+
`Internal error: build for "${buildOptions.entrypoint}" was scheduled concurrently but cannot run in a subprocess`
|
|
2338
|
+
);
|
|
2339
|
+
}
|
|
2009
2340
|
liveRunners.add(runner);
|
|
2010
2341
|
try {
|
|
2011
2342
|
({ buildResult, rawBuildResult } = await (0, import_execute_builder.executeBuilder)({
|
|
@@ -2049,21 +2380,28 @@ var require_do_build = __commonJS({
|
|
|
2049
2380
|
);
|
|
2050
2381
|
} else {
|
|
2051
2382
|
const workspace = service && serviceWorkspace && serviceWorkspace !== "." ? serviceWorkspace : ".";
|
|
2052
|
-
const
|
|
2383
|
+
const buildType = packageManifest.buildType ?? (buildConfig.middleware === true ? "middleware" : isApiDir ? "api-dir" : "app");
|
|
2384
|
+
const entry = {
|
|
2385
|
+
ordinal: buildOrdinals.get(build) ?? Number.MAX_SAFE_INTEGER,
|
|
2386
|
+
workspace,
|
|
2387
|
+
key: fullKey,
|
|
2388
|
+
buildConfig,
|
|
2389
|
+
manifest: {
|
|
2390
|
+
...packageManifest,
|
|
2391
|
+
framework: packageManifest.framework ?? apiDirFramework,
|
|
2392
|
+
buildType
|
|
2393
|
+
},
|
|
2394
|
+
service,
|
|
2395
|
+
builderUse: builderPkg.name
|
|
2396
|
+
};
|
|
2397
|
+
const existingIndex = packageManifests.findIndex(
|
|
2053
2398
|
(m) => m.builderUse === builderPkg.name && m.workspace === workspace
|
|
2054
2399
|
);
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
manifest: {
|
|
2061
|
-
...packageManifest,
|
|
2062
|
-
framework: packageManifest.framework ?? apiDirFramework
|
|
2063
|
-
},
|
|
2064
|
-
service,
|
|
2065
|
-
builderUse: builderPkg.name
|
|
2066
|
-
});
|
|
2400
|
+
const existing = existingIndex === -1 ? void 0 : packageManifests[existingIndex];
|
|
2401
|
+
if (!existing) {
|
|
2402
|
+
packageManifests.push(entry);
|
|
2403
|
+
} else if (entry.ordinal < existing.ordinal) {
|
|
2404
|
+
packageManifests[existingIndex] = entry;
|
|
2067
2405
|
}
|
|
2068
2406
|
}
|
|
2069
2407
|
} catch (e) {
|
|
@@ -2155,12 +2493,15 @@ var require_do_build = __commonJS({
|
|
|
2155
2493
|
const cronEntrypoint = legacyExperimentalService.entrypoint || legacyExperimentalService.builder.src || "index";
|
|
2156
2494
|
for (const schedule of staticSchedules) {
|
|
2157
2495
|
synthesizedServiceCrons.push({
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2496
|
+
ordinal: buildOrdinals.get(build) ?? Number.MAX_SAFE_INTEGER,
|
|
2497
|
+
cron: {
|
|
2498
|
+
path: (0, import_build_utils3.getInternalServiceCronPath)(
|
|
2499
|
+
legacyExperimentalService.name,
|
|
2500
|
+
cronEntrypoint,
|
|
2501
|
+
legacyExperimentalService.handlerFunction || "cron"
|
|
2502
|
+
),
|
|
2503
|
+
schedule
|
|
2504
|
+
}
|
|
2164
2505
|
});
|
|
2165
2506
|
}
|
|
2166
2507
|
} else {
|
|
@@ -2256,8 +2597,12 @@ var require_do_build = __commonJS({
|
|
|
2256
2597
|
ops.push(
|
|
2257
2598
|
writeBuildResultPromise.then(
|
|
2258
2599
|
(override) => {
|
|
2259
|
-
if (override)
|
|
2260
|
-
overrides.push(
|
|
2600
|
+
if (override) {
|
|
2601
|
+
overrides.push({
|
|
2602
|
+
ordinal: buildOrdinals.get(build) ?? Number.MAX_SAFE_INTEGER,
|
|
2603
|
+
override
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2261
2606
|
},
|
|
2262
2607
|
(err) => err
|
|
2263
2608
|
)
|
|
@@ -2277,7 +2622,71 @@ var require_do_build = __commonJS({
|
|
|
2277
2622
|
)
|
|
2278
2623
|
);
|
|
2279
2624
|
}
|
|
2625
|
+
};
|
|
2626
|
+
const sortedBuilds = (0, import_execute_builder.sortBuildsForExecution)(buildsToRun);
|
|
2627
|
+
for (const build of sortedBuilds) {
|
|
2628
|
+
if (!buildOrdinals.has(build)) {
|
|
2629
|
+
buildOrdinals.set(build, buildOrdinals.size);
|
|
2630
|
+
}
|
|
2280
2631
|
}
|
|
2632
|
+
const concurrency = createBuildRunner2 && canBuildInSubprocess2 ? (0, import_build_concurrency.resolveBuildConcurrency)() : 1;
|
|
2633
|
+
await (0, import_build_concurrency.runBuildsWithConcurrency)({
|
|
2634
|
+
builds: sortedBuilds,
|
|
2635
|
+
concurrency,
|
|
2636
|
+
isEligible: (build) => {
|
|
2637
|
+
const bp = typeof build.src === "string" ? buildersWithPkgs.get(build.use) : void 0;
|
|
2638
|
+
return !!bp && !!canBuildInSubprocess2 && canBuildInSubprocess2({
|
|
2639
|
+
hasDetectedServices: getHasDetectedServices(),
|
|
2640
|
+
builderPath: bp.path
|
|
2641
|
+
});
|
|
2642
|
+
},
|
|
2643
|
+
// Generated services flow:
|
|
2644
|
+
// each build READS the shared `outputDir/config.json` to inherit
|
|
2645
|
+
// sibling-emitted services fields while siblings WRITE
|
|
2646
|
+
// it, so what a build inherits is execution-order-dependent.
|
|
2647
|
+
forceSingleChain: !hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig,
|
|
2648
|
+
resolveScope: async (build) => {
|
|
2649
|
+
const service = getHasDetectedServices() && typeof build.src === "string" ? serviceByBuilder.get(build) : void 0;
|
|
2650
|
+
if (!service) {
|
|
2651
|
+
const key = "no-service-context";
|
|
2652
|
+
return {
|
|
2653
|
+
outerKey: key,
|
|
2654
|
+
innerKey: `${key}:${build.use}:${String(build.src)}`,
|
|
2655
|
+
siblingsSkipInstall: false
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2658
|
+
const serviceWorkspace = (0, import_build_utils3.isExperimentalService)(service) ? service.workspace : service.root;
|
|
2659
|
+
const serviceDir = serviceWorkspace && serviceWorkspace !== "." ? (0, import_path2.join)(workPath, serviceWorkspace) : workPath;
|
|
2660
|
+
const toolchain = service.runtime ?? ["python", "go", "ruby", "rust", "container"].find(
|
|
2661
|
+
(t) => build.use.startsWith(`@vercel/${t}`)
|
|
2662
|
+
) ?? "node";
|
|
2663
|
+
const customInstall = Boolean(service.installCommand?.trim());
|
|
2664
|
+
const installRoot = await (0, import_build_concurrency.resolveInstallScopeRoot)({
|
|
2665
|
+
toolchain,
|
|
2666
|
+
serviceDir,
|
|
2667
|
+
ceilingDir: repoRootPath
|
|
2668
|
+
});
|
|
2669
|
+
return {
|
|
2670
|
+
outerKey: `${toolchain}:${installRoot}`,
|
|
2671
|
+
innerKey: (0, import_build_concurrency.getInstallScopeKey)({
|
|
2672
|
+
toolchain,
|
|
2673
|
+
installDirectory: serviceDir,
|
|
2674
|
+
installCommand: service.installCommand
|
|
2675
|
+
}),
|
|
2676
|
+
// Only Node default installs are deduped across workers via the
|
|
2677
|
+
// merged-back `meta.runNpmInstallSet`, custom commands and other
|
|
2678
|
+
// toolchains would re-run a real install.
|
|
2679
|
+
siblingsSkipInstall: toolchain === "node" && !customInstall
|
|
2680
|
+
};
|
|
2681
|
+
},
|
|
2682
|
+
runBuild: (build, concurrent) => buildOne(build, concurrent),
|
|
2683
|
+
log: (message) => output.log(message),
|
|
2684
|
+
reportSecondaryError: (err, build) => {
|
|
2685
|
+
output.error(
|
|
2686
|
+
`Build failed for "${build.src}": ${err instanceof Error ? err.message : String(err)}`
|
|
2687
|
+
);
|
|
2688
|
+
}
|
|
2689
|
+
});
|
|
2281
2690
|
};
|
|
2282
2691
|
const flushOps = async () => {
|
|
2283
2692
|
const errors = await Promise.all(ops.splice(0));
|
|
@@ -2324,9 +2733,19 @@ var require_do_build = __commonJS({
|
|
|
2324
2733
|
zeroConfigFallbackRoutes.push(...serviceRoutes.fallbacks);
|
|
2325
2734
|
}
|
|
2326
2735
|
};
|
|
2736
|
+
const sortBuildResultsByOrdinal = () => {
|
|
2737
|
+
const orderedResults = Array.from(buildResults.entries()).sort(
|
|
2738
|
+
([a], [b]) => (buildOrdinals.get(a) ?? Number.MAX_SAFE_INTEGER) - (buildOrdinals.get(b) ?? Number.MAX_SAFE_INTEGER)
|
|
2739
|
+
);
|
|
2740
|
+
buildResults.clear();
|
|
2741
|
+
for (const [build, result] of orderedResults) {
|
|
2742
|
+
buildResults.set(build, result);
|
|
2743
|
+
}
|
|
2744
|
+
};
|
|
2327
2745
|
try {
|
|
2328
2746
|
await runBuilders(builds);
|
|
2329
2747
|
await flushOps();
|
|
2748
|
+
sortBuildResultsByOrdinal();
|
|
2330
2749
|
if (!hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig) {
|
|
2331
2750
|
const generatedConfigPath = (0, import_path2.join)(outputDir, "config.json");
|
|
2332
2751
|
const generatedConfig = await readJSONFile2(generatedConfigPath);
|
|
@@ -2435,6 +2854,7 @@ var require_do_build = __commonJS({
|
|
|
2435
2854
|
}
|
|
2436
2855
|
}
|
|
2437
2856
|
}
|
|
2857
|
+
preDeployEntries.sort((a, b) => a.ordinal - b.ordinal);
|
|
2438
2858
|
for (const entry of preDeployEntries) {
|
|
2439
2859
|
if (entry.callback) {
|
|
2440
2860
|
await entry.callback();
|
|
@@ -2445,6 +2865,11 @@ var require_do_build = __commonJS({
|
|
|
2445
2865
|
}
|
|
2446
2866
|
}
|
|
2447
2867
|
} finally {
|
|
2868
|
+
const settled = await Promise.all(ops.splice(0));
|
|
2869
|
+
for (const err of settled) {
|
|
2870
|
+
if (err)
|
|
2871
|
+
ops.push(Promise.resolve(err));
|
|
2872
|
+
}
|
|
2448
2873
|
for (const runner of liveRunners) {
|
|
2449
2874
|
try {
|
|
2450
2875
|
runner.teardown();
|
|
@@ -2455,6 +2880,8 @@ var require_do_build = __commonJS({
|
|
|
2455
2880
|
}
|
|
2456
2881
|
}
|
|
2457
2882
|
}
|
|
2883
|
+
sortBuildResultsByOrdinal();
|
|
2884
|
+
packageManifests.sort((a, b) => a.ordinal - b.ordinal);
|
|
2458
2885
|
await (0, import_manifest.writeManifests)(packageManifests, diagnostics, ops, outputDir);
|
|
2459
2886
|
if (corepackShimDir) {
|
|
2460
2887
|
(0, import_corepack.cleanupCorepack)(corepackShimDir);
|
|
@@ -2507,7 +2934,10 @@ var require_do_build = __commonJS({
|
|
|
2507
2934
|
}
|
|
2508
2935
|
}
|
|
2509
2936
|
if (existingConfig.overrides && !nestExperimentalServicesV2Output) {
|
|
2510
|
-
overrides.push(
|
|
2937
|
+
overrides.push({
|
|
2938
|
+
ordinal: Number.MAX_SAFE_INTEGER,
|
|
2939
|
+
override: existingConfig.overrides
|
|
2940
|
+
});
|
|
2511
2941
|
}
|
|
2512
2942
|
}
|
|
2513
2943
|
const topLevelBuildResults = nestExperimentalServicesV2Output ? new Map(
|
|
@@ -2555,8 +2985,9 @@ var require_do_build = __commonJS({
|
|
|
2555
2985
|
localConfig.images,
|
|
2556
2986
|
topLevelBuildResults.values()
|
|
2557
2987
|
);
|
|
2988
|
+
const orderedServiceCrons = synthesizedServiceCrons.slice().sort((a, b) => a.ordinal - b.ordinal).map((entry) => entry.cron);
|
|
2558
2989
|
const mergedCrons = mergeCrons(
|
|
2559
|
-
[...localConfig.crons || [], ...
|
|
2990
|
+
[...localConfig.crons || [], ...orderedServiceCrons],
|
|
2560
2991
|
buildResults.values()
|
|
2561
2992
|
);
|
|
2562
2993
|
const mergedWildcard = mergeWildcard(topLevelBuildResults.values());
|
|
@@ -2584,7 +3015,8 @@ var require_do_build = __commonJS({
|
|
|
2584
3015
|
}
|
|
2585
3016
|
}
|
|
2586
3017
|
const topLevelBuildResultOverrides = Array.from(topLevelBuildResults.values()).map((result) => "overrides" in result ? result.overrides : void 0).filter((value) => Boolean(value));
|
|
2587
|
-
const
|
|
3018
|
+
const orderedOverrides = overrides.slice().sort((a, b) => a.ordinal - b.ordinal).map((entry) => entry.override);
|
|
3019
|
+
const mergedOverrides = overrides.length > 0 || topLevelBuildResultOverrides.length > 0 ? Object.assign({}, ...orderedOverrides, ...topLevelBuildResultOverrides) : void 0;
|
|
2588
3020
|
const framework = topLevelBuildResults.size > 0 ? await getFramework(workPath, topLevelBuildResults) : void 0;
|
|
2589
3021
|
const explicitRootRoutes = appendBuildOutputRouteTables(
|
|
2590
3022
|
routesResult.routes,
|
|
@@ -3118,12 +3550,24 @@ function toError(error) {
|
|
|
3118
3550
|
return error;
|
|
3119
3551
|
return Object.assign(new Error(), error);
|
|
3120
3552
|
}
|
|
3553
|
+
function mergeWorkerMeta(target, workerMeta) {
|
|
3554
|
+
for (const [key, value] of Object.entries(workerMeta)) {
|
|
3555
|
+
const existing = target[key];
|
|
3556
|
+
if (existing instanceof Set && value instanceof Set) {
|
|
3557
|
+
for (const entry of value) {
|
|
3558
|
+
existing.add(entry);
|
|
3559
|
+
}
|
|
3560
|
+
} else if (existing === true && typeof value !== "object") {
|
|
3561
|
+
} else {
|
|
3562
|
+
target[key] = value;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3121
3566
|
function canBuildInSubprocess({
|
|
3122
3567
|
hasDetectedServices,
|
|
3123
|
-
builderPath
|
|
3124
|
-
hasBuildCallback
|
|
3568
|
+
builderPath
|
|
3125
3569
|
}) {
|
|
3126
|
-
return hasDetectedServices && Boolean(builderPath)
|
|
3570
|
+
return hasDetectedServices && Boolean(builderPath);
|
|
3127
3571
|
}
|
|
3128
3572
|
function rehydrateFile(obj) {
|
|
3129
3573
|
if (obj.type === "FileBlob") {
|
|
@@ -3211,7 +3655,7 @@ var SubprocessBuildRunner = class extends import_build_runner.BuildRunner {
|
|
|
3211
3655
|
const child = fork(workerPath, [], {
|
|
3212
3656
|
cwd: this.ctx.cwd,
|
|
3213
3657
|
execArgv: [],
|
|
3214
|
-
env: process.env,
|
|
3658
|
+
env: this.ctx.env ?? process.env,
|
|
3215
3659
|
// V8 structured clone (not the default JSON) so the build result rides across with its
|
|
3216
3660
|
// Buffers, cycles (e.g. `@vercel/next`'s `childProcesses`), and shared object identity
|
|
3217
3661
|
// (one Lambda referenced by many outputs stays one instance) intact.
|
|
@@ -3253,7 +3697,7 @@ var SubprocessBuildRunner = class extends import_build_runner.BuildRunner {
|
|
|
3253
3697
|
const buildResult = message.result;
|
|
3254
3698
|
rehydrateResult(buildResult, message.outputVersion);
|
|
3255
3699
|
if (this.ctx.buildOptions.meta && message.meta) {
|
|
3256
|
-
|
|
3700
|
+
mergeWorkerMeta(this.ctx.buildOptions.meta, message.meta);
|
|
3257
3701
|
}
|
|
3258
3702
|
if (message.hasPreDeploy) {
|
|
3259
3703
|
child.on("close", (code, signal) => {
|
|
@@ -3586,13 +4030,11 @@ function normalizeRelative(p) {
|
|
|
3586
4030
|
function createBuildRunner({
|
|
3587
4031
|
ctx,
|
|
3588
4032
|
hasDetectedServices,
|
|
3589
|
-
builderPath
|
|
3590
|
-
hasBuildCallback
|
|
4033
|
+
builderPath
|
|
3591
4034
|
}) {
|
|
3592
4035
|
return canBuildInSubprocess({
|
|
3593
4036
|
hasDetectedServices,
|
|
3594
|
-
builderPath
|
|
3595
|
-
hasBuildCallback
|
|
4037
|
+
builderPath
|
|
3596
4038
|
}) ? new SubprocessBuildRunner(ctx) : void 0;
|
|
3597
4039
|
}
|
|
3598
4040
|
function buildCommandWithGlobalFlags(baseSubcommand, argv) {
|
|
@@ -3900,6 +4342,7 @@ async function main(client) {
|
|
|
3900
4342
|
{
|
|
3901
4343
|
output: output_manager_default,
|
|
3902
4344
|
createBuildRunner,
|
|
4345
|
+
canBuildInSubprocess,
|
|
3903
4346
|
importBuilders,
|
|
3904
4347
|
formatResolvedBuilders: import_import_builders.formatResolvedBuilders,
|
|
3905
4348
|
writeBuildResult,
|