vercel 53.3.1 → 53.4.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.
Files changed (51) hide show
  1. package/dist/chunks/{add-PGPQCMJK.js → add-FYITUY65.js} +4 -4
  2. package/dist/chunks/{chunk-7EJTBI6M.js → chunk-44EL4BJL.js} +5 -5
  3. package/dist/chunks/{chunk-TR6DYQV6.js → chunk-54T7XV3H.js} +1 -1
  4. package/dist/chunks/{chunk-3GJFG6GX.js → chunk-5HTDIHTQ.js} +2 -2
  5. package/dist/chunks/{chunk-RYUPBGRO.js → chunk-6447C5WV.js} +1 -1
  6. package/dist/chunks/{chunk-QV34LTI7.js → chunk-6EI6XOUG.js} +2 -2
  7. package/dist/chunks/{chunk-PR72OE3G.js → chunk-73EVSBLA.js} +1 -1
  8. package/dist/chunks/{chunk-XYYGNWMQ.js → chunk-7TCOOSFP.js} +1 -1
  9. package/dist/chunks/{chunk-H57DZL5B.js → chunk-CMAHZSFA.js} +12 -2
  10. package/dist/chunks/{chunk-7Z5XFBB4.js → chunk-IVC36JQ5.js} +3 -3
  11. package/dist/chunks/{chunk-AORK3I3E.js → chunk-KHDOCVQF.js} +1 -1
  12. package/dist/chunks/{chunk-RI23R2QO.js → chunk-KM7WTYJ4.js} +2 -2
  13. package/dist/chunks/{chunk-4L73BR7G.js → chunk-KTULXE6M.js} +1 -1
  14. package/dist/chunks/{chunk-JJ36CB7A.js → chunk-LBP7YFBV.js} +336 -51
  15. package/dist/chunks/{chunk-2TNGZL25.js → chunk-MW7BI4C2.js} +1 -1
  16. package/dist/chunks/{chunk-25WI74GM.js → chunk-PU7YKGJI.js} +4 -4
  17. package/dist/chunks/{chunk-HJVSVCAZ.js → chunk-SLWOG5CX.js} +60 -2
  18. package/dist/chunks/{chunk-SOSCFYOT.js → chunk-WZO6BNJ7.js} +1 -1
  19. package/dist/chunks/{chunk-AAPG3P4D.js → chunk-YWCYZANP.js} +3 -3
  20. package/dist/chunks/{chunk-3YDXZRSZ.js → chunk-Z2ES2XHU.js} +1 -1
  21. package/dist/chunks/{chunk-4VJ3GTBX.js → chunk-ZY4YCCXG.js} +1 -1
  22. package/dist/chunks/{compile-vercel-config-H4BUE5BZ.js → compile-vercel-config-ED6WXKEL.js} +1 -1
  23. package/dist/chunks/{delete-HVWVDBQF.js → delete-FYRG67YL.js} +2 -2
  24. package/dist/chunks/{disable-CMBQPZ7L.js → disable-T6JFY4LL.js} +2 -2
  25. package/dist/chunks/{discard-ZDNWUYLY.js → discard-OLVACEPN.js} +2 -2
  26. package/dist/chunks/{edit-YJYM3EKS.js → edit-JI2VCMGG.js} +3 -3
  27. package/dist/chunks/{enable-ITE7U5C4.js → enable-2W35HGRM.js} +2 -2
  28. package/dist/chunks/{export-VVN33IBK.js → export-FFMFMPGE.js} +2 -2
  29. package/dist/chunks/{inspect-I7ILS3E2.js → inspect-RDRV6BUD.js} +3 -3
  30. package/dist/chunks/{list-6PZO3UIZ.js → list-5WGQ7F6P.js} +2 -2
  31. package/dist/chunks/{list-BWIEHOTA.js → list-F2GP6UZ7.js} +3 -3
  32. package/dist/chunks/{ls-LZZFID76.js → ls-ZLHJPSZZ.js} +4 -4
  33. package/dist/chunks/{publish-NULVZ7RB.js → publish-S2PGRBDP.js} +2 -2
  34. package/dist/chunks/{query-BGI3AVJA.js → query-G5K7DLLJ.js} +5 -5
  35. package/dist/chunks/{reorder-G66QSKTR.js → reorder-K5VXZ7F5.js} +2 -2
  36. package/dist/chunks/{restore-LHDVXFOH.js → restore-QJYBYUIZ.js} +2 -2
  37. package/dist/chunks/{rm-DTAOTWXD.js → rm-WCHM3XXB.js} +4 -4
  38. package/dist/chunks/{rule-inspect-AOITFBTB.js → rule-inspect-VMWUI4WH.js} +4 -4
  39. package/dist/chunks/{rules-IW3XGCNA.js → rules-SOQXK4AE.js} +6 -6
  40. package/dist/chunks/{schema-2VCQ2MAA.js → schema-2H2WLFJN.js} +2 -2
  41. package/dist/chunks/{update-L3DZ5STE.js → update-W6DZOFHV.js} +4 -4
  42. package/dist/commands/build/index.js +52 -45
  43. package/dist/commands/deploy/index.js +10 -10
  44. package/dist/commands/dev/index.js +209 -32
  45. package/dist/commands/env/index.js +5 -5
  46. package/dist/commands/link/index.js +7 -7
  47. package/dist/commands/list/index.js +3 -3
  48. package/dist/commands-bulk.js +1756 -1257
  49. package/dist/index.js +9 -9
  50. package/dist/version.mjs +1 -1
  51. package/package.json +23 -23
@@ -6,21 +6,22 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  OUTPUT_DIR,
9
+ getStaticServiceSchedules,
9
10
  importBuilders,
10
11
  isLambda,
11
12
  staticFiles,
12
13
  writeBuildResult
13
- } from "../../chunks/chunk-H57DZL5B.js";
14
+ } from "../../chunks/chunk-CMAHZSFA.js";
14
15
  import {
15
16
  require_semver
16
17
  } from "../../chunks/chunk-IB5L4LKZ.js";
17
18
  import {
18
19
  pullCommandLogic
19
- } from "../../chunks/chunk-25WI74GM.js";
20
+ } from "../../chunks/chunk-PU7YKGJI.js";
20
21
  import {
21
22
  pickOverrides,
22
23
  readProjectSettings
23
- } from "../../chunks/chunk-TR6DYQV6.js";
24
+ } from "../../chunks/chunk-54T7XV3H.js";
24
25
  import {
25
26
  AGENT_REASON,
26
27
  AGENT_STATUS
@@ -28,13 +29,13 @@ import {
28
29
  import {
29
30
  ua_default
30
31
  } from "../../chunks/chunk-WOWCXMTU.js";
31
- import "../../chunks/chunk-4VJ3GTBX.js";
32
- import "../../chunks/chunk-3GJFG6GX.js";
33
- import "../../chunks/chunk-QV34LTI7.js";
34
- import "../../chunks/chunk-4L73BR7G.js";
32
+ import "../../chunks/chunk-ZY4YCCXG.js";
33
+ import "../../chunks/chunk-5HTDIHTQ.js";
34
+ import "../../chunks/chunk-6EI6XOUG.js";
35
+ import "../../chunks/chunk-KTULXE6M.js";
35
36
  import {
36
37
  buildCommand
37
- } from "../../chunks/chunk-RYUPBGRO.js";
38
+ } from "../../chunks/chunk-6447C5WV.js";
38
39
  import {
39
40
  help
40
41
  } from "../../chunks/chunk-IS56OO2J.js";
@@ -58,7 +59,7 @@ import {
58
59
  require_minimatch,
59
60
  resolveProjectCwd,
60
61
  validateConfig
61
- } from "../../chunks/chunk-JJ36CB7A.js";
62
+ } from "../../chunks/chunk-LBP7YFBV.js";
62
63
  import {
63
64
  TelemetryClient
64
65
  } from "../../chunks/chunk-4OEA5ILS.js";
@@ -1200,16 +1201,19 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1200
1201
  attachQueueServiceTrigger(buildResult.output, service);
1201
1202
  }
1202
1203
  if (service && isScheduleTriggeredService(service) && !("crons" in buildResult && buildResult.crons?.length)) {
1203
- if (typeof service.runtime === "string" && typeof service.schedule === "string" && service.schedule !== "<dynamic>") {
1204
+ const staticSchedules = getStaticServiceSchedules(service.schedule);
1205
+ if (typeof service.runtime === "string" && staticSchedules.length > 0) {
1204
1206
  const cronEntrypoint = service.entrypoint || service.builder.src || "index";
1205
- synthesizedServiceCrons.push({
1206
- path: getInternalServiceCronPath(
1207
- service.name,
1208
- cronEntrypoint,
1209
- service.handlerFunction || "cron"
1210
- ),
1211
- schedule: service.schedule
1212
- });
1207
+ for (const schedule of staticSchedules) {
1208
+ synthesizedServiceCrons.push({
1209
+ path: getInternalServiceCronPath(
1210
+ service.name,
1211
+ cronEntrypoint,
1212
+ service.handlerFunction || "cron"
1213
+ ),
1214
+ schedule
1215
+ });
1216
+ }
1213
1217
  } else {
1214
1218
  throw new NowBuildError2({
1215
1219
  code: "CRON_SERVICE_NO_CRONS",
@@ -1481,6 +1485,7 @@ function getFunctionUrlPath(vcConfigPath, outputDir) {
1481
1485
  return "/" + funcPath.split("/").filter((part) => part && part !== "index").join("/");
1482
1486
  }
1483
1487
  var LAMBDA_SIZE_LIMIT_MB = 250;
1488
+ var CLOSE_TO_LIMIT_MB = LAMBDA_SIZE_LIMIT_MB - 5;
1484
1489
  function printFileSizeBreakdown(files) {
1485
1490
  const dependencies = /* @__PURE__ */ new Map();
1486
1491
  for (const [bundlePath, sizeMB] of files.entries()) {
@@ -1489,7 +1494,7 @@ function printFileSizeBreakdown(files) {
1489
1494
  }
1490
1495
  const sortedDeps = Array.from(dependencies.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10);
1491
1496
  if (sortedDeps.length > 0) {
1492
- output_manager_default.print(import_chalk.default.yellow(" Large dependencies:\n"));
1497
+ output_manager_default.print(import_chalk.default.yellow("Large dependencies:\n"));
1493
1498
  for (const [dep, size] of sortedDeps) {
1494
1499
  if (size >= 0.5) {
1495
1500
  output_manager_default.print(
@@ -1522,40 +1527,42 @@ Analyzing ${vcConfigFiles.length} function${vcConfigFiles.length === 1 ? "" : "s
1522
1527
  (r) => r !== null
1523
1528
  );
1524
1529
  const sortedResults = validResults.sort((a, b) => b.size - a.size);
1525
- const exceededFunctions = sortedResults.filter(
1526
- (r) => r.size > LAMBDA_SIZE_LIMIT_MB
1527
- );
1528
- const normalFunctions = sortedResults.filter(
1529
- (r) => r.size <= LAMBDA_SIZE_LIMIT_MB
1530
- );
1531
- if (exceededFunctions.length > 0) {
1532
- output_manager_default.print(
1533
- `${import_chalk.default.red.bold(`\u26A0\uFE0F Max serverless function size of ${LAMBDA_SIZE_LIMIT_MB} MB uncompressed reached`)}
1534
-
1530
+ output_manager_default.print(import_chalk.default.bold(`
1531
+ Serverless function size info:
1532
+ `));
1533
+ let numExceeded = 0;
1534
+ for (const result of sortedResults) {
1535
+ const exceeded = result.size >= LAMBDA_SIZE_LIMIT_MB;
1536
+ const close = result.size >= CLOSE_TO_LIMIT_MB && !exceeded;
1537
+ if (exceeded) {
1538
+ numExceeded++;
1539
+ output_manager_default.print(
1540
+ import_chalk.default.yellow(
1541
+ `
1542
+ \u26A0\uFE0F Max serverless function size of ${LAMBDA_SIZE_LIMIT_MB} MB uncompressed reached
1535
1543
  `
1536
- );
1537
- for (const result of exceededFunctions) {
1544
+ )
1545
+ );
1546
+ } else if (close) {
1538
1547
  output_manager_default.print(
1539
- `${import_chalk.default.red("Function :")} ${import_chalk.default.red.bold(result.path)}
1540
- ${import_chalk.default.red("Size :")} ${import_chalk.default.red.bold(result.size.toFixed(2))} MB
1548
+ import_chalk.default.yellow(
1549
+ `
1550
+ \u26A0\uFE0F Max serverless function size of ${LAMBDA_SIZE_LIMIT_MB} MB uncompressed almost reached
1541
1551
  `
1552
+ )
1542
1553
  );
1543
- printFileSizeBreakdown(result.files);
1544
- output_manager_default.print("\n");
1545
1554
  }
1546
- if (normalFunctions.length > 0) {
1547
- output_manager_default.print(import_chalk.default.cyan(`Other functions:
1548
- `));
1549
- for (const result of normalFunctions) {
1550
- output_manager_default.print(
1551
- `${import_chalk.default.cyan(result.path)}: ${import_chalk.default.bold(result.size.toFixed(2))} MB
1555
+ output_manager_default.print(
1556
+ `${import_chalk.default.cyan("Function :")} ${import_chalk.default.cyan.bold(result.path)}
1557
+ ${import_chalk.default.cyan("Size :")} ${import_chalk.default.cyan.bold(result.size.toFixed(2))} MB
1552
1558
  `
1553
- );
1554
- }
1555
- }
1559
+ );
1560
+ printFileSizeBreakdown(result.files);
1561
+ }
1562
+ if (numExceeded > 0) {
1556
1563
  throw new NowBuildError2({
1557
1564
  code: "NOW_SANDBOX_WORKER_MAX_LAMBDA_SIZE",
1558
- message: `${exceededFunctions.length} function${exceededFunctions.length === 1 ? "" : "s"} exceeded the uncompressed maximum size of ${LAMBDA_SIZE_LIMIT_MB} MB.`,
1565
+ message: `${numExceeded} function${numExceeded === 1 ? "" : "s"} exceeded the uncompressed maximum size of ${LAMBDA_SIZE_LIMIT_MB} MB.`,
1559
1566
  link: "https://vercel.link/serverless-function-size",
1560
1567
  action: "Learn More"
1561
1568
  });
@@ -14,10 +14,10 @@ import {
14
14
  purchaseDomainIfAvailable,
15
15
  require_cjs,
16
16
  setupDomain
17
- } from "../../chunks/chunk-7EJTBI6M.js";
17
+ } from "../../chunks/chunk-44EL4BJL.js";
18
18
  import {
19
19
  readLocalConfig
20
- } from "../../chunks/chunk-7Z5XFBB4.js";
20
+ } from "../../chunks/chunk-IVC36JQ5.js";
21
21
  import {
22
22
  highlight
23
23
  } from "../../chunks/chunk-V5P25P7F.js";
@@ -41,31 +41,31 @@ import {
41
41
  deprecatedArchiveSplitTgz,
42
42
  getCommandAliases,
43
43
  initSubcommand
44
- } from "../../chunks/chunk-HJVSVCAZ.js";
44
+ } from "../../chunks/chunk-SLWOG5CX.js";
45
45
  import "../../chunks/chunk-4LDQIDKG.js";
46
46
  import "../../chunks/chunk-NIOGCTVR.js";
47
47
  import "../../chunks/chunk-HAJ2XRTQ.js";
48
48
  import "../../chunks/chunk-GCKUEAUE.js";
49
49
  import "../../chunks/chunk-3NSIZGHP.js";
50
50
  import "../../chunks/chunk-JZLADLMF.js";
51
- import "../../chunks/chunk-PR72OE3G.js";
51
+ import "../../chunks/chunk-73EVSBLA.js";
52
52
  import "../../chunks/chunk-ONYQGA2O.js";
53
53
  import {
54
54
  pickOverrides
55
- } from "../../chunks/chunk-TR6DYQV6.js";
55
+ } from "../../chunks/chunk-54T7XV3H.js";
56
56
  import {
57
57
  AGENT_STATUS
58
58
  } from "../../chunks/chunk-E3NE4SKN.js";
59
59
  import "../../chunks/chunk-WOWCXMTU.js";
60
60
  import {
61
61
  ensureLink
62
- } from "../../chunks/chunk-3GJFG6GX.js";
62
+ } from "../../chunks/chunk-5HTDIHTQ.js";
63
63
  import {
64
64
  validatePaths,
65
65
  validateRootDirectory
66
- } from "../../chunks/chunk-QV34LTI7.js";
67
- import "../../chunks/chunk-4L73BR7G.js";
68
- import "../../chunks/chunk-RYUPBGRO.js";
66
+ } from "../../chunks/chunk-6EI6XOUG.js";
67
+ import "../../chunks/chunk-KTULXE6M.js";
68
+ import "../../chunks/chunk-6447C5WV.js";
69
69
  import {
70
70
  help
71
71
  } from "../../chunks/chunk-IS56OO2J.js";
@@ -78,7 +78,7 @@ import {
78
78
  parseTarget,
79
79
  require_dist as require_dist2,
80
80
  require_lib
81
- } from "../../chunks/chunk-JJ36CB7A.js";
81
+ } from "../../chunks/chunk-LBP7YFBV.js";
82
82
  import {
83
83
  TelemetryClient
84
84
  } from "../../chunks/chunk-4OEA5ILS.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "../../chunks/chunk-2HSQ7YUK.js";
10
10
  import {
11
11
  getUpdateCommand
12
- } from "../../chunks/chunk-3YDXZRSZ.js";
12
+ } from "../../chunks/chunk-Z2ES2XHU.js";
13
13
  import {
14
14
  highlight
15
15
  } from "../../chunks/chunk-V5P25P7F.js";
@@ -21,30 +21,32 @@ import {
21
21
  } from "../../chunks/chunk-HAJ2XRTQ.js";
22
22
  import {
23
23
  OUTPUT_DIR,
24
+ getStaticServiceSchedules,
24
25
  importBuilders,
25
26
  require_mime_types,
26
27
  require_npa,
27
28
  staticFiles
28
- } from "../../chunks/chunk-H57DZL5B.js";
29
+ } from "../../chunks/chunk-CMAHZSFA.js";
29
30
  import "../../chunks/chunk-IB5L4LKZ.js";
30
31
  import {
31
32
  pickOverrides
32
- } from "../../chunks/chunk-TR6DYQV6.js";
33
- import "../../chunks/chunk-4VJ3GTBX.js";
33
+ } from "../../chunks/chunk-54T7XV3H.js";
34
+ import "../../chunks/chunk-ZY4YCCXG.js";
34
35
  import {
35
36
  displayDetectedServices,
36
37
  readConfig,
37
38
  setupAndLink
38
- } from "../../chunks/chunk-QV34LTI7.js";
39
+ } from "../../chunks/chunk-6EI6XOUG.js";
39
40
  import {
40
41
  getLocalPathConfig
41
- } from "../../chunks/chunk-4L73BR7G.js";
42
+ } from "../../chunks/chunk-KTULXE6M.js";
42
43
  import {
43
44
  help
44
45
  } from "../../chunks/chunk-IS56OO2J.js";
45
46
  import "../../chunks/chunk-KSIISCB2.js";
46
47
  import {
47
48
  VERCEL_DIR,
49
+ findRepoRoot,
48
50
  getLinkedProject,
49
51
  getVercelDirectory,
50
52
  param,
@@ -66,7 +68,7 @@ import {
66
68
  resolveProjectCwd,
67
69
  tryDetectServices,
68
70
  validateConfig
69
- } from "../../chunks/chunk-JJ36CB7A.js";
71
+ } from "../../chunks/chunk-LBP7YFBV.js";
70
72
  import {
71
73
  TelemetryClient
72
74
  } from "../../chunks/chunk-4OEA5ILS.js";
@@ -15756,7 +15758,7 @@ var require_error = __commonJS({
15756
15758
  // ../../node_modules/.pnpm/serve-handler@6.1.1/node_modules/serve-handler/src/index.js
15757
15759
  var require_src2 = __commonJS({
15758
15760
  "../../node_modules/.pnpm/serve-handler@6.1.1/node_modules/serve-handler/src/index.js"(exports2, module2) {
15759
- var { promisify: promisify2 } = __require("util");
15761
+ var { promisify } = __require("util");
15760
15762
  var path5 = __require("path");
15761
15763
  var { createHash } = __require("crypto");
15762
15764
  var { realpath, lstat, createReadStream, readdir } = __require("fs");
@@ -16151,10 +16153,10 @@ var require_src2 = __commonJS({
16151
16153
  return sendError(...args2);
16152
16154
  };
16153
16155
  var getHandlers = (methods) => Object.assign({
16154
- lstat: promisify2(lstat),
16155
- realpath: promisify2(realpath),
16156
+ lstat: promisify(lstat),
16157
+ realpath: promisify(realpath),
16156
16158
  createReadStream,
16157
- readdir: promisify2(readdir),
16159
+ readdir: promisify(readdir),
16158
16160
  sendError
16159
16161
  }, methods);
16160
16162
  module2.exports = async (request, response, config = {}, methods = {}) => {
@@ -17059,8 +17061,16 @@ import {
17059
17061
 
17060
17062
  // src/util/tree-kill.ts
17061
17063
  var import_tree_kill = __toESM(require_tree_kill(), 1);
17062
- import { promisify } from "util";
17063
- var treeKill = promisify(import_tree_kill.default);
17064
+ function treeKill(pid, signal = "SIGTERM") {
17065
+ return new Promise((resolve2, reject) => {
17066
+ (0, import_tree_kill.default)(pid, signal, (err) => {
17067
+ if (err)
17068
+ reject(err);
17069
+ else
17070
+ resolve2();
17071
+ });
17072
+ });
17073
+ }
17064
17074
 
17065
17075
  // src/util/dev/builder.ts
17066
17076
  var import_routing_utils2 = __toESM(require_dist3(), 1);
@@ -17784,6 +17794,56 @@ function getServiceRoutePrefixes(service) {
17784
17794
  }
17785
17795
  return [];
17786
17796
  }
17797
+ var FORCE_KILL_GRACE_MS = 2e3;
17798
+ var STOP_ALL_TIMEOUT_MS = 8e3;
17799
+ function killGroup(pid, signal) {
17800
+ try {
17801
+ process.kill(-pid, signal);
17802
+ return true;
17803
+ } catch (err) {
17804
+ const code = err.code;
17805
+ if (code === "ESRCH" || code === "EPERM")
17806
+ return false;
17807
+ throw err;
17808
+ }
17809
+ }
17810
+ function isProcessAlive(pid) {
17811
+ try {
17812
+ process.kill(pid, 0);
17813
+ return true;
17814
+ } catch (err) {
17815
+ return err.code === "EPERM";
17816
+ }
17817
+ }
17818
+ function waitForExit(pid, proc, timeoutMs) {
17819
+ if (proc && (proc.exitCode !== null || proc.signalCode !== null)) {
17820
+ return Promise.resolve(true);
17821
+ }
17822
+ if (!isProcessAlive(pid)) {
17823
+ return Promise.resolve(true);
17824
+ }
17825
+ return new Promise((resolve2) => {
17826
+ let settled = false;
17827
+ const finish = (died) => {
17828
+ if (settled)
17829
+ return;
17830
+ settled = true;
17831
+ clearInterval(poll);
17832
+ clearTimeout(deadline);
17833
+ if (proc)
17834
+ proc.removeListener("exit", onExit);
17835
+ resolve2(died);
17836
+ };
17837
+ const onExit = () => finish(true);
17838
+ if (proc)
17839
+ proc.once("exit", onExit);
17840
+ const poll = setInterval(() => {
17841
+ if (!isProcessAlive(pid))
17842
+ finish(true);
17843
+ }, 100);
17844
+ const deadline = setTimeout(() => finish(false), timeoutMs);
17845
+ });
17846
+ }
17787
17847
  var ServicesOrchestrator = class {
17788
17848
  constructor(options) {
17789
17849
  this.managedServices = /* @__PURE__ */ new Map();
@@ -17801,8 +17861,42 @@ var ServicesOrchestrator = class {
17801
17861
  ).length;
17802
17862
  this.hasQueueServices = options.services.some(isQueueTriggeredService);
17803
17863
  }
17864
+ // Synchronously SIGKILL every tracked process group. Used from
17865
+ // `process.on('exit' | 'uncaughtException')` so that orphans are reaped even
17866
+ // when normal async cleanup never runs (crash, uncaught exception, plain
17867
+ // `process.exit`). Must stay synchronous — the 'exit' event allows no I/O.
17868
+ // Each kill is isolated so one failure (EPERM, unexpected error) cannot
17869
+ // abort the loop and leave siblings orphaned.
17870
+ forceKillAllSync() {
17871
+ const killOne = (pid) => {
17872
+ if (!pid)
17873
+ return;
17874
+ try {
17875
+ killGroup(pid, "SIGKILL");
17876
+ } catch {
17877
+ }
17878
+ };
17879
+ for (const [, proc] of this.managedProcesses)
17880
+ killOne(proc.pid);
17881
+ for (const [, service] of this.managedServices)
17882
+ killOne(service.pid);
17883
+ }
17884
+ registerExitBackstop() {
17885
+ if (this.exitBackstop)
17886
+ return;
17887
+ const backstop = () => this.forceKillAllSync();
17888
+ this.exitBackstop = backstop;
17889
+ process.on("exit", backstop);
17890
+ }
17891
+ unregisterExitBackstop() {
17892
+ if (this.exitBackstop) {
17893
+ process.removeListener("exit", this.exitBackstop);
17894
+ this.exitBackstop = void 0;
17895
+ }
17896
+ }
17804
17897
  async startAll() {
17805
17898
  output_manager_default.debug(`Starting ${this.services.length} services`);
17899
+ this.registerExitBackstop();
17806
17900
  const startPromises = this.services.map(
17807
17901
  (service, index) => this.startService(service, index).then((result) => {
17808
17902
  this.managedServices.set(result.name, result);
@@ -17838,7 +17932,11 @@ var ServicesOrchestrator = class {
17838
17932
  });
17839
17933
  }
17840
17934
  if (service.pid) {
17841
- await treeKill(service.pid).catch((err) => {
17935
+ await this.terminateProcessGroup(
17936
+ name,
17937
+ service.pid,
17938
+ service.process
17939
+ ).catch((err) => {
17842
17940
  output_manager_default.debug(`Failed to kill service "${name}": ${err}`);
17843
17941
  });
17844
17942
  }
@@ -17850,7 +17948,7 @@ var ServicesOrchestrator = class {
17850
17948
  if (proc.pid && !this.managedServices.has(name)) {
17851
17949
  output_manager_default.debug(`Stopping process "${name}" (PID: ${proc.pid})`);
17852
17950
  stopPromises.push(
17853
- treeKill(proc.pid).catch((err) => {
17951
+ this.terminateProcessGroup(name, proc.pid, proc).catch((err) => {
17854
17952
  output_manager_default.debug(`Failed to stop process "${name}": ${err}`);
17855
17953
  })
17856
17954
  );
@@ -17860,10 +17958,58 @@ var ServicesOrchestrator = class {
17860
17958
  clearTimeout(timer);
17861
17959
  }
17862
17960
  this.cronTimers = [];
17863
- await Promise.all(stopPromises);
17864
- this.managedServices.clear();
17865
- this.managedProcesses.clear();
17866
- output_manager_default.debug("All services stopped");
17961
+ let timedOut = false;
17962
+ let timeoutHandle;
17963
+ const timeout = new Promise((resolve2) => {
17964
+ timeoutHandle = setTimeout(() => {
17965
+ timedOut = true;
17966
+ output_manager_default.debug(
17967
+ `stopAll timed out after ${STOP_ALL_TIMEOUT_MS}ms; remaining processes will be SIGKILLed on exit`
17968
+ );
17969
+ resolve2();
17970
+ }, STOP_ALL_TIMEOUT_MS);
17971
+ });
17972
+ try {
17973
+ await Promise.race([Promise.all(stopPromises), timeout]);
17974
+ } finally {
17975
+ if (timeoutHandle)
17976
+ clearTimeout(timeoutHandle);
17977
+ }
17978
+ if (!timedOut) {
17979
+ this.managedServices.clear();
17980
+ this.managedProcesses.clear();
17981
+ this.unregisterExitBackstop();
17982
+ output_manager_default.debug("All services stopped");
17983
+ }
17984
+ }
17985
+ // Graceful → forceful termination of a single service's process group.
17986
+ // Sends SIGTERM to the entire pgid (services run with `detached: true`, so
17987
+ // pgid === pid), waits *up to* a grace window — polling so well-behaved
17988
+ // services exit immediately — and escalates to SIGKILL only if still alive.
17989
+ // `tree-kill` runs in parallel to mop up descendants that switched process
17990
+ // groups via `setsid` and so escape `kill(-pgid)`. Every step is wrapped:
17991
+ // no error from a single service can prevent the rest of `stopAll` from
17992
+ // completing.
17993
+ async terminateProcessGroup(name, pid, proc) {
17994
+ try {
17995
+ killGroup(pid, "SIGTERM");
17996
+ } catch (err) {
17997
+ output_manager_default.debug(`SIGTERM group kill for "${name}" failed: ${err}`);
17998
+ }
17999
+ await treeKill(pid, "SIGTERM").catch((err) => {
18000
+ output_manager_default.debug(`tree-kill (SIGTERM) for "${name}" failed: ${err}`);
18001
+ });
18002
+ const died = await waitForExit(pid, proc, FORCE_KILL_GRACE_MS);
18003
+ if (died)
18004
+ return;
18005
+ output_manager_default.debug(`Escalating to SIGKILL for "${name}" (PID: ${pid})`);
18006
+ try {
18007
+ killGroup(pid, "SIGKILL");
18008
+ } catch (err) {
18009
+ output_manager_default.debug(`SIGKILL group kill for "${name}" failed: ${err}`);
18010
+ }
18011
+ await treeKill(pid, "SIGKILL").catch(() => {
18012
+ });
17867
18013
  }
17868
18014
  getServiceForRoute(pathname) {
17869
18015
  let bestMatch = null;
@@ -18201,16 +18347,14 @@ var ServicesOrchestrator = class {
18201
18347
  startCronSchedulers() {
18202
18348
  for (const [name, managed] of this.managedServices) {
18203
18349
  const service = this.services.find((candidate) => candidate.name === name);
18204
- const crons = managed.crons && managed.crons.length > 0 ? managed.crons : service && isScheduleTriggeredService(service) && service.schedule && service.schedule !== "<dynamic>" ? [
18205
- {
18206
- path: (0, import_fs_detectors2.getInternalServiceCronPath)(
18207
- name,
18208
- service.entrypoint || service.builder.src || "index",
18209
- service.handlerFunction || "cron"
18210
- ),
18211
- schedule: service.schedule
18212
- }
18213
- ] : [];
18350
+ const crons = managed.crons && managed.crons.length > 0 ? managed.crons : service && isScheduleTriggeredService(service) && service.schedule ? getStaticServiceSchedules(service.schedule).map((schedule) => ({
18351
+ path: (0, import_fs_detectors2.getInternalServiceCronPath)(
18352
+ name,
18353
+ service.entrypoint || service.builder.src || "index",
18354
+ service.handlerFunction || "cron"
18355
+ ),
18356
+ schedule
18357
+ })) : [];
18214
18358
  if (crons.length === 0)
18215
18359
  continue;
18216
18360
  for (const cron of crons) {
@@ -19549,6 +19693,8 @@ Please ensure that ${cmd(err.path)} is properly installed`;
19549
19693
  this.repoRoot = options.repoRoot ?? cwd;
19550
19694
  this.envConfigs = { buildEnv: {}, runEnv: {}, allEnv: {} };
19551
19695
  this.envValues = options.envValues || {};
19696
+ this.projectId = options.projectId;
19697
+ this.orgId = options.orgId;
19552
19698
  this.files = {};
19553
19699
  this.originalProjectSettings = options.projectSettings;
19554
19700
  this.projectSettings = options.projectSettings;
@@ -19857,7 +20003,7 @@ Please ensure that ${cmd(err.path)} is properly installed`;
19857
20003
  return void 0;
19858
20004
  }
19859
20005
  async _getVercelConfig() {
19860
- const { compileVercelConfig } = await import("../../chunks/compile-vercel-config-H4BUE5BZ.js");
20006
+ const { compileVercelConfig } = await import("../../chunks/compile-vercel-config-ED6WXKEL.js");
19861
20007
  await compileVercelConfig(this.cwd);
19862
20008
  const configPath = getLocalPathConfig(this.cwd);
19863
20009
  const [
@@ -19880,7 +20026,7 @@ Please ensure that ${cmd(err.path)} is properly installed`;
19880
20026
  await this.exit();
19881
20027
  }
19882
20028
  vercelConfig.routes = maybeRoutes || [];
19883
- if (!vercelConfig.experimentalServices && (!vercelConfig.builds || vercelConfig.builds.length === 0)) {
20029
+ if (!vercelConfig.services && !vercelConfig.experimentalServices && (!vercelConfig.builds || vercelConfig.builds.length === 0)) {
19884
20030
  const featHandleMiss = true;
19885
20031
  const { projectSettings, cleanUrls, trailingSlash } = vercelConfig;
19886
20032
  const files = (await staticFiles(this.cwd, {})).map(
@@ -19985,6 +20131,22 @@ Please ensure that ${cmd(err.path)} is properly installed`;
19985
20131
  allEnv["NOW_REGION"] = "dev1";
19986
20132
  allEnv["VERCEL_ENV"] = "development";
19987
20133
  allEnv["VERCEL"] = "1";
20134
+ if (this.projectId && !process.env.VERCEL_PROJECT_ID) {
20135
+ if (!("VERCEL_PROJECT_ID" in allEnv)) {
20136
+ allEnv["VERCEL_PROJECT_ID"] = this.projectId;
20137
+ }
20138
+ if (!("VERCEL_PROJECT_ID" in runEnv)) {
20139
+ runEnv["VERCEL_PROJECT_ID"] = this.projectId;
20140
+ }
20141
+ }
20142
+ if (this.orgId && !process.env.VERCEL_ORG_ID) {
20143
+ if (!("VERCEL_ORG_ID" in allEnv)) {
20144
+ allEnv["VERCEL_ORG_ID"] = this.orgId;
20145
+ }
20146
+ if (!("VERCEL_ORG_ID" in runEnv)) {
20147
+ runEnv["VERCEL_ORG_ID"] = this.orgId;
20148
+ }
20149
+ }
19988
20150
  if (this.projectSettings?.autoExposeSystemEnvs) {
19989
20151
  runEnv["VERCEL_REGION"] = "dev1";
19990
20152
  }
@@ -21086,13 +21248,22 @@ To link your project, run ${getCommandName("dev")} without \`-L\` or \`--local\`
21086
21248
  let projectSettings;
21087
21249
  let envValues = {};
21088
21250
  let repoRoot;
21251
+ let projectId;
21252
+ let orgId;
21089
21253
  if (link.status === "linked") {
21090
21254
  const { project, org } = link;
21091
21255
  if (link.repoRoot) {
21092
21256
  repoRoot = cwd = link.repoRoot;
21257
+ } else if (project.rootDirectory) {
21258
+ const monorepoRoot = await findRepoRoot(cwd);
21259
+ if (monorepoRoot) {
21260
+ repoRoot = cwd = monorepoRoot;
21261
+ }
21093
21262
  }
21094
21263
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
21095
21264
  projectSettings = project;
21265
+ projectId = project.id;
21266
+ orgId = org.id;
21096
21267
  if (project.rootDirectory) {
21097
21268
  cwd = join4(cwd, project.rootDirectory);
21098
21269
  }
@@ -21136,7 +21307,9 @@ To link your project, run ${getCommandName("dev")} without \`-L\` or \`--local\`
21136
21307
  projectSettings,
21137
21308
  envValues,
21138
21309
  repoRoot,
21139
- services
21310
+ services,
21311
+ projectId,
21312
+ orgId
21140
21313
  });
21141
21314
  const controller = new AbortController();
21142
21315
  const timeout = setTimeout(async () => {
@@ -21183,11 +21356,15 @@ To link your project, run ${getCommandName("dev")} without \`-L\` or \`--local\`
21183
21356
  case "SIGTERM":
21184
21357
  exitCode = 143;
21185
21358
  break;
21359
+ case "SIGHUP":
21360
+ exitCode = 129;
21361
+ break;
21186
21362
  }
21187
21363
  process.exit(exitCode);
21188
21364
  };
21189
21365
  process.on("SIGTERM", async () => await cleanup("SIGTERM"));
21190
21366
  process.on("SIGINT", async () => await cleanup("SIGINT"));
21367
+ process.on("SIGHUP", async () => await cleanup("SIGHUP"));
21191
21368
  if (!devServer.devCommand) {
21192
21369
  const outputDir = join4(cwd, OUTPUT_DIR);
21193
21370
  if (await import_fs_extra2.default.pathExists(outputDir)) {
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  formatEnvironment,
21
21
  validateLsArgs
22
- } from "../../chunks/chunk-SOSCFYOT.js";
22
+ } from "../../chunks/chunk-WZO6BNJ7.js";
23
23
  import {
24
24
  validateJsonOutput
25
25
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -28,7 +28,7 @@ import {
28
28
  } from "../../chunks/chunk-YPQSDAEW.js";
29
29
  import {
30
30
  getCommandAliases
31
- } from "../../chunks/chunk-HJVSVCAZ.js";
31
+ } from "../../chunks/chunk-SLWOG5CX.js";
32
32
  import "../../chunks/chunk-4LDQIDKG.js";
33
33
  import "../../chunks/chunk-NIOGCTVR.js";
34
34
  import "../../chunks/chunk-HAJ2XRTQ.js";
@@ -38,10 +38,10 @@ import "../../chunks/chunk-JZLADLMF.js";
38
38
  import "../../chunks/chunk-ONYQGA2O.js";
39
39
  import {
40
40
  require_execa
41
- } from "../../chunks/chunk-4VJ3GTBX.js";
41
+ } from "../../chunks/chunk-ZY4YCCXG.js";
42
42
  import {
43
43
  autoInstallVercelPlugin
44
- } from "../../chunks/chunk-RYUPBGRO.js";
44
+ } from "../../chunks/chunk-6447C5WV.js";
45
45
  import {
46
46
  help
47
47
  } from "../../chunks/chunk-IS56OO2J.js";
@@ -66,7 +66,7 @@ import {
66
66
  require_frameworks,
67
67
  runSubcommand,
68
68
  updateSubcommand
69
- } from "../../chunks/chunk-JJ36CB7A.js";
69
+ } from "../../chunks/chunk-LBP7YFBV.js";
70
70
  import {
71
71
  TelemetryClient,
72
72
  require_dist as require_dist2