vercel 59.9.1 → 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-QZ5FW7LT.js → add-IJZ2Q46B.js} +5 -5
- package/dist/chunks/{add-DGK2A56E.js → add-KYLIIWQV.js} +2 -2
- package/dist/chunks/{add-6YKY5LGR.js → add-SGSXZWCH.js} +2 -2
- package/dist/chunks/{build-YFUXHSMU.js → build-PKOCHFHL.js} +2 -2
- package/dist/chunks/{chunk-LDZFKXIR.js → chunk-4KVJ2M4J.js} +143 -5
- package/dist/chunks/{chunk-HK2IYHVR.js → chunk-53J6IECW.js} +32 -19
- package/dist/chunks/{chunk-62XYUSRS.js → chunk-5BZWQDNJ.js} +1 -1
- package/dist/chunks/{chunk-3E62ATUY.js → chunk-5JNGHAUT.js} +1 -1
- package/dist/chunks/{chunk-I7ZVTKXM.js → chunk-7TYA36S5.js} +1 -1
- package/dist/chunks/{chunk-QWOCOZMS.js → chunk-AXNMBJKD.js} +1 -1
- package/dist/chunks/{chunk-PGTGT7AU.js → chunk-FNYNYZAZ.js} +2 -2
- package/dist/chunks/{chunk-O26N2UPI.js → chunk-GGPE5377.js} +1 -1
- package/dist/chunks/{chunk-FEQJSISH.js → chunk-GRINZMFI.js} +1 -1
- package/dist/chunks/{chunk-XN75ARAD.js → chunk-KTCVGTRQ.js} +1 -1
- package/dist/chunks/{chunk-H43VTKRO.js → chunk-LCDVMLKI.js} +4 -4
- package/dist/chunks/{chunk-FME4CIZL.js → chunk-MHO3EJAF.js} +2 -2
- package/dist/chunks/{chunk-2TXLG52H.js → chunk-O6VHU65V.js} +1 -1
- package/dist/chunks/{chunk-LD3Q3MUI.js → chunk-OBPBFJFP.js} +5 -6
- package/dist/chunks/{chunk-52P3DIMH.js → chunk-QQ77K4QW.js} +1 -1
- package/dist/chunks/{chunk-7PMXNOZH.js → chunk-SRVP2UST.js} +1 -1
- package/dist/chunks/{chunk-T3MRP74K.js → chunk-UTWU4DZF.js} +1 -1
- package/dist/chunks/{chunk-IWNFDR3C.js → chunk-VV5XULGR.js} +107 -8
- package/dist/chunks/{chunk-PIFTX5CY.js → chunk-WC3XNI4B.js} +2 -2
- package/dist/chunks/{chunk-ZCAFRSCD.js → chunk-X6TBTUZZ.js} +1 -1
- package/dist/chunks/{chunk-22GK226I.js → chunk-YLNIMGMQ.js} +2 -2
- package/dist/chunks/{chunk-DSBOE2OV.js → chunk-Z2RKD7LL.js} +1 -1
- package/dist/chunks/{chunk-OHQJEOP7.js → chunk-Z44PATWW.js} +4 -4
- package/dist/chunks/{clear-LHNLYPZB.js → clear-J6TY2J3M.js} +2 -2
- package/dist/chunks/{compile-vercel-config-6KPIBWNU.js → compile-vercel-config-WVGNTJXO.js} +1 -1
- package/dist/chunks/{config-CNP7P3VD.js → config-3JDOCLH7.js} +4 -4
- package/dist/chunks/{config-UETLVP5G.js → config-5T7XV4JE.js} +2 -2
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{constants-WEQVJSYS.js → constants-YMCRE6IG.js} +1 -1
- package/dist/chunks/{delete-MB7H2LWR.js → delete-EPPNTNEW.js} +2 -2
- package/dist/chunks/{delete-BYCZJBHH.js → delete-XQOAWEZV.js} +2 -2
- package/dist/chunks/{disable-OCDW6U2Q.js → disable-U5YAPWPA.js} +2 -2
- package/dist/chunks/{discard-DWPG5UX5.js → discard-OCUCCXKO.js} +2 -2
- package/dist/chunks/{edit-ATX4K4OL.js → edit-CD7EXAO3.js} +2 -2
- package/dist/chunks/{edit-NOZXPAV3.js → edit-PNRGHNGQ.js} +3 -3
- package/dist/chunks/{enable-BO5DALIP.js → enable-25RH2LVW.js} +2 -2
- package/dist/chunks/{export-RS6X5DZW.js → export-YSGEUXJW.js} +2 -2
- package/dist/chunks/{image-QCNVSQFC.js → image-4ZKCR4HL.js} +3 -3
- package/dist/chunks/{import-builders-H4VASUQQ.js → import-builders-FQ2LOIWC.js} +2 -2
- package/dist/chunks/{inspect-BOLFZZBM.js → inspect-3K2EDYL6.js} +3 -3
- package/dist/chunks/{inspect-LZUSSUNE.js → inspect-F5DJM5DL.js} +2 -2
- package/dist/chunks/{inspect-HHXFMDN2.js → inspect-K2NJD2AI.js} +2 -2
- package/dist/chunks/{inspect-XXHIV73A.js → inspect-WRBFJUSY.js} +2 -2
- package/dist/chunks/{inspect-GPLZZEW2.js → inspect-ZC4GRGTE.js} +2 -2
- package/dist/chunks/{list-H7ED7LCU.js → list-B7C56Z7B.js} +1 -1
- package/dist/chunks/{list-XDRILJOZ.js → list-PUFYWIOF.js} +3 -3
- package/dist/chunks/{list-THFMP23I.js → list-Z6VHQQBW.js} +2 -2
- package/dist/chunks/{login-6KR5DCYM.js → login-ZYUF7JZQ.js} +2 -2
- package/dist/chunks/{ls-5QFIXKF3.js → ls-2OUQUKPT.js} +2 -2
- package/dist/chunks/{ls-LXVF34KZ.js → ls-ALX26ARH.js} +2 -2
- package/dist/chunks/{ls-GRY6G2OR.js → ls-FNOL7XTY.js} +2 -2
- package/dist/chunks/{ls-5RGCKNYB.js → ls-PRY6OV4B.js} +3 -3
- package/dist/chunks/{ls-PKN53PLB.js → ls-SQRTT5RH.js} +2 -2
- package/dist/chunks/{ls-CBFHIORN.js → ls-TBBLZ766.js} +2 -2
- package/dist/chunks/{open-Q7GEQR5J.js → open-673AJXYY.js} +2 -2
- package/dist/chunks/{permissions-6SA56V2A.js → permissions-B6SFNLN4.js} +4 -4
- package/dist/chunks/{publish-TYGP2WTZ.js → publish-TPJHZ2PJ.js} +2 -2
- package/dist/chunks/{push-5KTXEM2H.js → push-3WD5IPXP.js} +2 -2
- package/dist/chunks/{query-DSYDUL7N.js → query-ZXOJQZ7G.js} +1 -1
- package/dist/chunks/{reorder-BEQAMXC3.js → reorder-SUFOQGPC.js} +2 -2
- package/dist/chunks/{reply-GSQ5PVE4.js → reply-YOVUA6ZF.js} +2 -2
- package/dist/chunks/{resolve-AG4SS62T.js → resolve-OQ7P74JY.js} +2 -2
- package/dist/chunks/{restore-LARYR55K.js → restore-BD5XJOE7.js} +2 -2
- package/dist/chunks/{rm-F5SIKHU2.js → rm-4KAI42EX.js} +2 -2
- package/dist/chunks/{rm-FPAFEN2E.js → rm-4UIILZLP.js} +2 -2
- package/dist/chunks/{rm-FG63ON57.js → rm-5TY3QJUZ.js} +2 -2
- package/dist/chunks/{rm-GPHZ3GID.js → rm-EKVIZG2N.js} +3 -3
- package/dist/chunks/{rm-ZKG56ZEW.js → rm-XAMQUW3J.js} +2 -2
- package/dist/chunks/{rule-inspect-JS4BK6GZ.js → rule-inspect-XZZE54SW.js} +3 -3
- package/dist/chunks/{rules-SMIGLNUR.js → rules-SF5FBWFF.js} +6 -6
- package/dist/chunks/{schema-FRSEAOYM.js → schema-3HRYA6AT.js} +1 -1
- package/dist/chunks/{set-E46SNNNI.js → set-T4IYLXET.js} +2 -2
- package/dist/chunks/{tags-CMBXR3FL.js → tags-EZKT46VN.js} +2 -2
- package/dist/chunks/{update-M5WXFGQ4.js → update-OE7Y2J5I.js} +5 -5
- package/dist/commands/build/index.js +505 -63
- package/dist/commands/deploy/index.js +7 -7
- package/dist/commands/dev/index.js +6 -6
- package/dist/commands/env/index.js +3 -3
- package/dist/commands/link/index.js +2 -2
- package/dist/commands/list/index.js +2 -2
- package/dist/commands-bulk.js +2669 -1841
- package/dist/index.js +9 -9
- package/dist/version.mjs +1 -1
- package/package.json +50 -50
|
@@ -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 {
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
resolveProjectCwd,
|
|
65
65
|
ua_default,
|
|
66
66
|
validateConfig
|
|
67
|
-
} from "../../chunks/chunk-
|
|
67
|
+
} from "../../chunks/chunk-Z44PATWW.js";
|
|
68
68
|
import "../../chunks/chunk-FXD67VN5.js";
|
|
69
69
|
import {
|
|
70
70
|
TelemetryClient
|
|
@@ -275,6 +275,310 @@ var require_execute_builder = __commonJS({
|
|
|
275
275
|
}
|
|
276
276
|
});
|
|
277
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
|
+
|
|
278
582
|
// ../../internals/cli-builder-integration/dist/backend-rewrite-warning.js
|
|
279
583
|
var require_backend_rewrite_warning = __commonJS({
|
|
280
584
|
"../../internals/cli-builder-integration/dist/backend-rewrite-warning.js"(exports, module) {
|
|
@@ -1280,7 +1584,8 @@ var require_corepack = __commonJS({
|
|
|
1280
1584
|
repoRootPath,
|
|
1281
1585
|
output,
|
|
1282
1586
|
readJSONFile: readJSONFile2,
|
|
1283
|
-
isCantParseJSONFile
|
|
1587
|
+
isCantParseJSONFile,
|
|
1588
|
+
warmPackageManager = false
|
|
1284
1589
|
}) {
|
|
1285
1590
|
if (process.env.ENABLE_EXPERIMENTAL_COREPACK !== "1") {
|
|
1286
1591
|
return null;
|
|
@@ -1316,6 +1621,18 @@ var require_corepack = __commonJS({
|
|
|
1316
1621
|
prettyCommand: `corepack enable ${pkgManagerName}`
|
|
1317
1622
|
}
|
|
1318
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
|
+
}
|
|
1319
1636
|
return corepackShimDir;
|
|
1320
1637
|
}
|
|
1321
1638
|
return null;
|
|
@@ -1384,6 +1701,7 @@ var require_do_build = __commonJS({
|
|
|
1384
1701
|
var import_write_build_result3 = require_write_build_result();
|
|
1385
1702
|
var import_build_runner2 = require_build_runner();
|
|
1386
1703
|
var import_execute_builder = require_execute_builder();
|
|
1704
|
+
var import_build_concurrency = require_build_concurrency();
|
|
1387
1705
|
var import_backend_rewrite_warning = require_backend_rewrite_warning();
|
|
1388
1706
|
var import_service_route_ownership = require_service_route_ownership();
|
|
1389
1707
|
var import_service_schedules = require_service_schedules();
|
|
@@ -1418,13 +1736,6 @@ var require_do_build = __commonJS({
|
|
|
1418
1736
|
function hasNonEmptyObject(value) {
|
|
1419
1737
|
return value != null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
1420
1738
|
}
|
|
1421
|
-
function unsetServiceBuildImmutableEnvVars(restoreEnv) {
|
|
1422
|
-
for (const key of SERVICE_BUILD_IMMUTABLE_ENV_VARS) {
|
|
1423
|
-
if (!restoreEnv.has(key))
|
|
1424
|
-
restoreEnv.set(key, process.env[key]);
|
|
1425
|
-
delete process.env[key];
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
1739
|
function getGeneratedServiceAlreadyBuiltWarning(service) {
|
|
1429
1740
|
const framework = service.framework ?? "unknown";
|
|
1430
1741
|
const entrypoint = service.entrypoint ?? service.builder.src ?? "unknown";
|
|
@@ -1445,6 +1756,7 @@ var require_do_build = __commonJS({
|
|
|
1445
1756
|
const {
|
|
1446
1757
|
output,
|
|
1447
1758
|
createBuildRunner: createBuildRunner2,
|
|
1759
|
+
canBuildInSubprocess: canBuildInSubprocess2,
|
|
1448
1760
|
importBuilders: importBuilders2,
|
|
1449
1761
|
formatResolvedBuilders: formatResolvedBuilders2,
|
|
1450
1762
|
writeBuildResult: writeBuildResult2,
|
|
@@ -1467,7 +1779,8 @@ var require_do_build = __commonJS({
|
|
|
1467
1779
|
repoRootPath,
|
|
1468
1780
|
output,
|
|
1469
1781
|
readJSONFile: readJSONFile2,
|
|
1470
|
-
isCantParseJSONFile
|
|
1782
|
+
isCantParseJSONFile,
|
|
1783
|
+
warmPackageManager: (0, import_build_concurrency.resolveBuildConcurrency)() > 1
|
|
1471
1784
|
});
|
|
1472
1785
|
const installDepsSpan = span.child("vc.installDeps");
|
|
1473
1786
|
let installRan = false;
|
|
@@ -1805,7 +2118,8 @@ var require_do_build = __commonJS({
|
|
|
1805
2118
|
repoRootPath,
|
|
1806
2119
|
output,
|
|
1807
2120
|
readJSONFile: readJSONFile2,
|
|
1808
|
-
isCantParseJSONFile
|
|
2121
|
+
isCantParseJSONFile,
|
|
2122
|
+
warmPackageManager: (0, import_build_concurrency.resolveBuildConcurrency)() > 1
|
|
1809
2123
|
});
|
|
1810
2124
|
}
|
|
1811
2125
|
const diagnostics = {};
|
|
@@ -1824,11 +2138,12 @@ var require_do_build = __commonJS({
|
|
|
1824
2138
|
}
|
|
1825
2139
|
const preDeployEntries = [];
|
|
1826
2140
|
const liveRunners = /* @__PURE__ */ new Set();
|
|
2141
|
+
const buildOrdinals = /* @__PURE__ */ new Map();
|
|
1827
2142
|
const runBuilders = async (buildsToRun) => {
|
|
1828
2143
|
await addBuildsToBuildJson(buildsToRun);
|
|
1829
|
-
|
|
2144
|
+
const buildOne = async (build, concurrent) => {
|
|
1830
2145
|
if (typeof build.src !== "string")
|
|
1831
|
-
|
|
2146
|
+
return;
|
|
1832
2147
|
const builderWithPkg = buildersWithPkgs.get(build.use);
|
|
1833
2148
|
if (!builderWithPkg) {
|
|
1834
2149
|
throw new Error(`Failed to load Builder "${build.use}"`);
|
|
@@ -1856,6 +2171,16 @@ var require_do_build = __commonJS({
|
|
|
1856
2171
|
`Service "${service.name}": workspace-rooted build at "${buildWorkPath}", entrypoint "${buildEntrypoint}" (original: "${build.src}")`
|
|
1857
2172
|
);
|
|
1858
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
|
+
};
|
|
1859
2184
|
const settingsForEnv = service ? {
|
|
1860
2185
|
buildCommand: service.buildCommand ?? void 0,
|
|
1861
2186
|
installCommand: service.installCommand ?? void 0,
|
|
@@ -1870,19 +2195,15 @@ var require_do_build = __commonJS({
|
|
|
1870
2195
|
]) {
|
|
1871
2196
|
const value = settingsForEnv[key];
|
|
1872
2197
|
const envKey = `VERCEL_PROJECT_SETTINGS_` + key.replace(/[A-Z]/g, (letter) => `_${letter}`).toUpperCase();
|
|
2198
|
+
setBuildEnv(envKey, typeof value === "string" ? value : void 0);
|
|
1873
2199
|
if (typeof value === "string") {
|
|
1874
|
-
process.env[envKey] = value;
|
|
1875
2200
|
output.debug(`Setting env ${envKey} to "${value}"`);
|
|
1876
|
-
} else {
|
|
1877
|
-
delete process.env[envKey];
|
|
1878
2201
|
}
|
|
1879
2202
|
}
|
|
1880
2203
|
const isFrontendBuilder = build.config && "framework" in build.config;
|
|
1881
2204
|
const builderFramework = build.config?.framework ?? projectSettings.framework;
|
|
1882
|
-
const
|
|
1883
|
-
|
|
1884
|
-
buildWorkPath
|
|
1885
|
-
) : void 0;
|
|
2205
|
+
const isApiDir = isZeroConfig && !service && !isFrontendBuilder;
|
|
2206
|
+
const apiDirFramework = isApiDir ? await apiDirFrameworkDetector.detect(build.use ?? "", buildWorkPath) : void 0;
|
|
1886
2207
|
let buildConfig;
|
|
1887
2208
|
if (isZeroConfig) {
|
|
1888
2209
|
if (service) {
|
|
@@ -1937,7 +2258,10 @@ var require_do_build = __commonJS({
|
|
|
1937
2258
|
const serviceRoutePrefix = build.config?.routePrefix;
|
|
1938
2259
|
const serviceConfigWorkspace = build.config?.workspace;
|
|
1939
2260
|
const preDeployCmd = legacyExperimentalService?.preDeployCommand?.trim();
|
|
1940
|
-
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;
|
|
1941
2265
|
if (preDeployEntry) {
|
|
1942
2266
|
preDeployEntries.push(preDeployEntry);
|
|
1943
2267
|
}
|
|
@@ -1970,7 +2294,6 @@ var require_do_build = __commonJS({
|
|
|
1970
2294
|
output.debug(
|
|
1971
2295
|
`Building entrypoint "${build.src}" with "${builderPkg.name}"`
|
|
1972
2296
|
);
|
|
1973
|
-
const restoreEnv = /* @__PURE__ */ new Map();
|
|
1974
2297
|
if (detectedServices && legacyExperimentalService?.env) {
|
|
1975
2298
|
const perServiceEnv = (0, import_build_utils3.getServiceUrlEnvVars)({
|
|
1976
2299
|
requestedEnv: legacyExperimentalService.env,
|
|
@@ -1983,13 +2306,14 @@ var require_do_build = __commonJS({
|
|
|
1983
2306
|
for (const [key, value] of Object.entries(perServiceEnv)) {
|
|
1984
2307
|
if (key in process.env)
|
|
1985
2308
|
continue;
|
|
1986
|
-
|
|
1987
|
-
process.env[key] = value;
|
|
2309
|
+
setBuildEnv(key, value);
|
|
1988
2310
|
output.debug(`Injected service URL env var: ${key}=${value}`);
|
|
1989
2311
|
}
|
|
1990
2312
|
}
|
|
1991
2313
|
if (service) {
|
|
1992
|
-
|
|
2314
|
+
for (const key of SERVICE_BUILD_IMMUTABLE_ENV_VARS) {
|
|
2315
|
+
setBuildEnv(key, void 0);
|
|
2316
|
+
}
|
|
1993
2317
|
}
|
|
1994
2318
|
let buildResult;
|
|
1995
2319
|
let rawBuildResult;
|
|
@@ -1998,7 +2322,8 @@ var require_do_build = __commonJS({
|
|
|
1998
2322
|
buildOptions,
|
|
1999
2323
|
cwd: buildWorkPath,
|
|
2000
2324
|
expectsPreDeploy: Boolean(preDeployCmd),
|
|
2001
|
-
builderSpan
|
|
2325
|
+
builderSpan,
|
|
2326
|
+
env: perBuildEnv
|
|
2002
2327
|
};
|
|
2003
2328
|
const runner = createBuildRunner2?.({
|
|
2004
2329
|
ctx: runnerContext,
|
|
@@ -2007,6 +2332,11 @@ var require_do_build = __commonJS({
|
|
|
2007
2332
|
builderPath: builderWithPkg.path,
|
|
2008
2333
|
hasBuildCallback: Boolean(buildOptions.buildCallback)
|
|
2009
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
|
+
}
|
|
2010
2340
|
liveRunners.add(runner);
|
|
2011
2341
|
try {
|
|
2012
2342
|
({ buildResult, rawBuildResult } = await (0, import_execute_builder.executeBuilder)({
|
|
@@ -2050,21 +2380,28 @@ var require_do_build = __commonJS({
|
|
|
2050
2380
|
);
|
|
2051
2381
|
} else {
|
|
2052
2382
|
const workspace = service && serviceWorkspace && serviceWorkspace !== "." ? serviceWorkspace : ".";
|
|
2053
|
-
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(
|
|
2054
2398
|
(m) => m.builderUse === builderPkg.name && m.workspace === workspace
|
|
2055
2399
|
);
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
manifest: {
|
|
2062
|
-
...packageManifest,
|
|
2063
|
-
framework: packageManifest.framework ?? apiDirFramework
|
|
2064
|
-
},
|
|
2065
|
-
service,
|
|
2066
|
-
builderUse: builderPkg.name
|
|
2067
|
-
});
|
|
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;
|
|
2068
2405
|
}
|
|
2069
2406
|
}
|
|
2070
2407
|
} catch (e) {
|
|
@@ -2156,12 +2493,15 @@ var require_do_build = __commonJS({
|
|
|
2156
2493
|
const cronEntrypoint = legacyExperimentalService.entrypoint || legacyExperimentalService.builder.src || "index";
|
|
2157
2494
|
for (const schedule of staticSchedules) {
|
|
2158
2495
|
synthesizedServiceCrons.push({
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
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
|
+
}
|
|
2165
2505
|
});
|
|
2166
2506
|
}
|
|
2167
2507
|
} else {
|
|
@@ -2257,8 +2597,12 @@ var require_do_build = __commonJS({
|
|
|
2257
2597
|
ops.push(
|
|
2258
2598
|
writeBuildResultPromise.then(
|
|
2259
2599
|
(override) => {
|
|
2260
|
-
if (override)
|
|
2261
|
-
overrides.push(
|
|
2600
|
+
if (override) {
|
|
2601
|
+
overrides.push({
|
|
2602
|
+
ordinal: buildOrdinals.get(build) ?? Number.MAX_SAFE_INTEGER,
|
|
2603
|
+
override
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2262
2606
|
},
|
|
2263
2607
|
(err) => err
|
|
2264
2608
|
)
|
|
@@ -2278,7 +2622,71 @@ var require_do_build = __commonJS({
|
|
|
2278
2622
|
)
|
|
2279
2623
|
);
|
|
2280
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
|
+
}
|
|
2281
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
|
+
});
|
|
2282
2690
|
};
|
|
2283
2691
|
const flushOps = async () => {
|
|
2284
2692
|
const errors = await Promise.all(ops.splice(0));
|
|
@@ -2325,9 +2733,19 @@ var require_do_build = __commonJS({
|
|
|
2325
2733
|
zeroConfigFallbackRoutes.push(...serviceRoutes.fallbacks);
|
|
2326
2734
|
}
|
|
2327
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
|
+
};
|
|
2328
2745
|
try {
|
|
2329
2746
|
await runBuilders(builds);
|
|
2330
2747
|
await flushOps();
|
|
2748
|
+
sortBuildResultsByOrdinal();
|
|
2331
2749
|
if (!hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig) {
|
|
2332
2750
|
const generatedConfigPath = (0, import_path2.join)(outputDir, "config.json");
|
|
2333
2751
|
const generatedConfig = await readJSONFile2(generatedConfigPath);
|
|
@@ -2436,6 +2854,7 @@ var require_do_build = __commonJS({
|
|
|
2436
2854
|
}
|
|
2437
2855
|
}
|
|
2438
2856
|
}
|
|
2857
|
+
preDeployEntries.sort((a, b) => a.ordinal - b.ordinal);
|
|
2439
2858
|
for (const entry of preDeployEntries) {
|
|
2440
2859
|
if (entry.callback) {
|
|
2441
2860
|
await entry.callback();
|
|
@@ -2446,6 +2865,11 @@ var require_do_build = __commonJS({
|
|
|
2446
2865
|
}
|
|
2447
2866
|
}
|
|
2448
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
|
+
}
|
|
2449
2873
|
for (const runner of liveRunners) {
|
|
2450
2874
|
try {
|
|
2451
2875
|
runner.teardown();
|
|
@@ -2456,6 +2880,8 @@ var require_do_build = __commonJS({
|
|
|
2456
2880
|
}
|
|
2457
2881
|
}
|
|
2458
2882
|
}
|
|
2883
|
+
sortBuildResultsByOrdinal();
|
|
2884
|
+
packageManifests.sort((a, b) => a.ordinal - b.ordinal);
|
|
2459
2885
|
await (0, import_manifest.writeManifests)(packageManifests, diagnostics, ops, outputDir);
|
|
2460
2886
|
if (corepackShimDir) {
|
|
2461
2887
|
(0, import_corepack.cleanupCorepack)(corepackShimDir);
|
|
@@ -2508,7 +2934,10 @@ var require_do_build = __commonJS({
|
|
|
2508
2934
|
}
|
|
2509
2935
|
}
|
|
2510
2936
|
if (existingConfig.overrides && !nestExperimentalServicesV2Output) {
|
|
2511
|
-
overrides.push(
|
|
2937
|
+
overrides.push({
|
|
2938
|
+
ordinal: Number.MAX_SAFE_INTEGER,
|
|
2939
|
+
override: existingConfig.overrides
|
|
2940
|
+
});
|
|
2512
2941
|
}
|
|
2513
2942
|
}
|
|
2514
2943
|
const topLevelBuildResults = nestExperimentalServicesV2Output ? new Map(
|
|
@@ -2556,8 +2985,9 @@ var require_do_build = __commonJS({
|
|
|
2556
2985
|
localConfig.images,
|
|
2557
2986
|
topLevelBuildResults.values()
|
|
2558
2987
|
);
|
|
2988
|
+
const orderedServiceCrons = synthesizedServiceCrons.slice().sort((a, b) => a.ordinal - b.ordinal).map((entry) => entry.cron);
|
|
2559
2989
|
const mergedCrons = mergeCrons(
|
|
2560
|
-
[...localConfig.crons || [], ...
|
|
2990
|
+
[...localConfig.crons || [], ...orderedServiceCrons],
|
|
2561
2991
|
buildResults.values()
|
|
2562
2992
|
);
|
|
2563
2993
|
const mergedWildcard = mergeWildcard(topLevelBuildResults.values());
|
|
@@ -2585,7 +3015,8 @@ var require_do_build = __commonJS({
|
|
|
2585
3015
|
}
|
|
2586
3016
|
}
|
|
2587
3017
|
const topLevelBuildResultOverrides = Array.from(topLevelBuildResults.values()).map((result) => "overrides" in result ? result.overrides : void 0).filter((value) => Boolean(value));
|
|
2588
|
-
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;
|
|
2589
3020
|
const framework = topLevelBuildResults.size > 0 ? await getFramework(workPath, topLevelBuildResults) : void 0;
|
|
2590
3021
|
const explicitRootRoutes = appendBuildOutputRouteTables(
|
|
2591
3022
|
routesResult.routes,
|
|
@@ -3119,12 +3550,24 @@ function toError(error) {
|
|
|
3119
3550
|
return error;
|
|
3120
3551
|
return Object.assign(new Error(), error);
|
|
3121
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
|
+
}
|
|
3122
3566
|
function canBuildInSubprocess({
|
|
3123
3567
|
hasDetectedServices,
|
|
3124
|
-
builderPath
|
|
3125
|
-
hasBuildCallback
|
|
3568
|
+
builderPath
|
|
3126
3569
|
}) {
|
|
3127
|
-
return hasDetectedServices && Boolean(builderPath)
|
|
3570
|
+
return hasDetectedServices && Boolean(builderPath);
|
|
3128
3571
|
}
|
|
3129
3572
|
function rehydrateFile(obj) {
|
|
3130
3573
|
if (obj.type === "FileBlob") {
|
|
@@ -3212,7 +3655,7 @@ var SubprocessBuildRunner = class extends import_build_runner.BuildRunner {
|
|
|
3212
3655
|
const child = fork(workerPath, [], {
|
|
3213
3656
|
cwd: this.ctx.cwd,
|
|
3214
3657
|
execArgv: [],
|
|
3215
|
-
env: process.env,
|
|
3658
|
+
env: this.ctx.env ?? process.env,
|
|
3216
3659
|
// V8 structured clone (not the default JSON) so the build result rides across with its
|
|
3217
3660
|
// Buffers, cycles (e.g. `@vercel/next`'s `childProcesses`), and shared object identity
|
|
3218
3661
|
// (one Lambda referenced by many outputs stays one instance) intact.
|
|
@@ -3254,7 +3697,7 @@ var SubprocessBuildRunner = class extends import_build_runner.BuildRunner {
|
|
|
3254
3697
|
const buildResult = message.result;
|
|
3255
3698
|
rehydrateResult(buildResult, message.outputVersion);
|
|
3256
3699
|
if (this.ctx.buildOptions.meta && message.meta) {
|
|
3257
|
-
|
|
3700
|
+
mergeWorkerMeta(this.ctx.buildOptions.meta, message.meta);
|
|
3258
3701
|
}
|
|
3259
3702
|
if (message.hasPreDeploy) {
|
|
3260
3703
|
child.on("close", (code, signal) => {
|
|
@@ -3587,13 +4030,11 @@ function normalizeRelative(p) {
|
|
|
3587
4030
|
function createBuildRunner({
|
|
3588
4031
|
ctx,
|
|
3589
4032
|
hasDetectedServices,
|
|
3590
|
-
builderPath
|
|
3591
|
-
hasBuildCallback
|
|
4033
|
+
builderPath
|
|
3592
4034
|
}) {
|
|
3593
4035
|
return canBuildInSubprocess({
|
|
3594
4036
|
hasDetectedServices,
|
|
3595
|
-
builderPath
|
|
3596
|
-
hasBuildCallback
|
|
4037
|
+
builderPath
|
|
3597
4038
|
}) ? new SubprocessBuildRunner(ctx) : void 0;
|
|
3598
4039
|
}
|
|
3599
4040
|
function buildCommandWithGlobalFlags(baseSubcommand, argv) {
|
|
@@ -3901,6 +4342,7 @@ async function main(client) {
|
|
|
3901
4342
|
{
|
|
3902
4343
|
output: output_manager_default,
|
|
3903
4344
|
createBuildRunner,
|
|
4345
|
+
canBuildInSubprocess,
|
|
3904
4346
|
importBuilders,
|
|
3905
4347
|
formatResolvedBuilders: import_import_builders.formatResolvedBuilders,
|
|
3906
4348
|
writeBuildResult,
|