vercel 59.5.0 → 59.7.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 (111) hide show
  1. package/dist/chunks/{add-Z5FM6TFI.js → add-7O4TM33A.js} +12 -12
  2. package/dist/chunks/{add-MH3WV6PV.js → add-UT6ZPA4F.js} +11 -11
  3. package/dist/chunks/{add-W3FFMTX4.js → add-UVMFKSSY.js} +11 -11
  4. package/dist/chunks/{build-VYYFBJL7.js → build-SKKT3DIB.js} +11 -11
  5. package/dist/chunks/{chunk-LLM3ZNXJ.js → chunk-2EH6SZRG.js} +2 -2
  6. package/dist/chunks/{chunk-UUVMIXT4.js → chunk-2T3IZZTJ.js} +4 -4
  7. package/dist/chunks/{chunk-RZ5NP6HN.js → chunk-2YRAWYGE.js} +1 -1
  8. package/dist/chunks/{chunk-TDXNNIZ6.js → chunk-3PA7LXYM.js} +2 -2
  9. package/dist/chunks/{chunk-KQRVZWJU.js → chunk-3T7WSWZH.js} +1 -1
  10. package/dist/chunks/{chunk-R6IGDGX3.js → chunk-5XECIWME.js} +1 -1
  11. package/dist/chunks/{chunk-PBHBX6UL.js → chunk-63OX2DER.js} +3 -3
  12. package/dist/chunks/{chunk-V4YLY44R.js → chunk-67IIZBBY.js} +2 -2
  13. package/dist/chunks/{chunk-AWSLWAOC.js → chunk-6JPVTPTU.js} +3 -3
  14. package/dist/chunks/{chunk-HT2XWSAJ.js → chunk-7AEEQOD4.js} +2 -29
  15. package/dist/chunks/{chunk-QG4PCM45.js → chunk-7HE63HCR.js} +102 -15
  16. package/dist/chunks/{chunk-FA3MO56Q.js → chunk-7IDPPWDN.js} +5 -5
  17. package/dist/chunks/{chunk-MRMNMFMD.js → chunk-7KSICC3A.js} +1 -1
  18. package/dist/chunks/{chunk-XBN2O34P.js → chunk-7ST552E3.js} +17 -4
  19. package/dist/chunks/{chunk-TAZ5ZAKG.js → chunk-AFKB6VMO.js} +2 -2
  20. package/dist/chunks/{chunk-CV4S27SS.js → chunk-ASBP32T6.js} +1 -1
  21. package/dist/chunks/{chunk-CQJRLNTX.js → chunk-AYLY3ZVL.js} +2 -2
  22. package/dist/chunks/{chunk-AWCID36T.js → chunk-BMKU5KEL.js} +1 -1
  23. package/dist/chunks/{chunk-E6LFKMI2.js → chunk-BQG777JE.js} +794 -124
  24. package/dist/chunks/{chunk-VWYNSJXI.js → chunk-CBHLLOGZ.js} +8 -8
  25. package/dist/chunks/{chunk-CSCSGSQG.js → chunk-CMRZ4KI4.js} +5 -5
  26. package/dist/chunks/{chunk-TIWAL2YU.js → chunk-DG6IMLCF.js} +6 -6
  27. package/dist/chunks/{chunk-YIHOS3ZF.js → chunk-FRAXI2WT.js} +1 -1
  28. package/dist/chunks/{chunk-7XX4ZEOV.js → chunk-FWKSJYDV.js} +1 -1
  29. package/dist/chunks/{chunk-OHER4DGX.js → chunk-FXD67VN5.js} +25 -9
  30. package/dist/chunks/{chunk-GUWPUX2Y.js → chunk-GK3RE3AC.js} +4 -4
  31. package/dist/chunks/{chunk-JNU3DTEV.js → chunk-IFNCPWH5.js} +9 -9
  32. package/dist/chunks/{chunk-PIMIKY4X.js → chunk-IJ4X426J.js} +1 -1
  33. package/dist/chunks/{chunk-NSU2BTRS.js → chunk-KD2N44NG.js} +4 -4
  34. package/dist/chunks/{chunk-TVXCXIRO.js → chunk-L3UXB2CW.js} +1 -1
  35. package/dist/chunks/{chunk-JJQP3PYM.js → chunk-MHCGKUI7.js} +5 -5
  36. package/dist/chunks/{chunk-47VQ6H2S.js → chunk-MUMITVZP.js} +2 -2
  37. package/dist/chunks/{chunk-L7CEMAJG.js → chunk-NGGLYKNU.js} +27 -5
  38. package/dist/chunks/{chunk-ZKUHCL6O.js → chunk-NJCM5JJN.js} +5 -5
  39. package/dist/chunks/{chunk-5LX2JDZP.js → chunk-O75LSD3C.js} +1 -1
  40. package/dist/chunks/{chunk-OX7KI3LF.js → chunk-QFAS4OVW.js} +18 -0
  41. package/dist/chunks/{chunk-4JTF6RD7.js → chunk-SSBYESJ5.js} +4 -4
  42. package/dist/chunks/{chunk-G75NFPIT.js → chunk-WNAKOXGK.js} +1 -1
  43. package/dist/chunks/{chunk-PPUWG2UB.js → chunk-WVPMR7XV.js} +58 -25
  44. package/dist/chunks/{chunk-CYNB6LL4.js → chunk-XNFHNTS2.js} +1 -1
  45. package/dist/chunks/{chunk-M3OSDZPY.js → chunk-XSYZDMUP.js} +16 -7
  46. package/dist/chunks/{chunk-VLPLCJZC.js → chunk-ZSFEACZU.js} +1 -1
  47. package/dist/chunks/{clear-TNGRDA7D.js → clear-X7M4WGBC.js} +11 -11
  48. package/dist/chunks/{compile-vercel-config-ERLXKKWW.js → compile-vercel-config-FBOZBWJC.js} +7 -7
  49. package/dist/chunks/{config-7EDKML5Q.js → config-KGW667XC.js} +9 -9
  50. package/dist/chunks/{config-H22EE765.js → config-RYPSCAR7.js} +11 -11
  51. package/dist/chunks/{delete-LORYIZHY.js → delete-OXYXXPHR.js} +8 -8
  52. package/dist/chunks/{delete-Q4S5F2AI.js → delete-VK6FTDBI.js} +9 -9
  53. package/dist/chunks/{disable-HKWCBDJC.js → disable-XRJTKNX4.js} +8 -8
  54. package/dist/chunks/{discard-UCCRF2JQ.js → discard-NAPSPR6Y.js} +8 -8
  55. package/dist/chunks/{edit-AWL35PYQ.js → edit-34GDLPQG.js} +10 -10
  56. package/dist/chunks/{edit-6IM6VRBR.js → edit-WLG4GLU3.js} +10 -10
  57. package/dist/chunks/{enable-GN3D3L3V.js → enable-IDKKVXKB.js} +8 -8
  58. package/dist/chunks/{exec-CNBOV577.js → exec-XH4K34JM.js} +3 -3
  59. package/dist/chunks/{export-HHRVFALV.js → export-MPMU3FYY.js} +8 -8
  60. package/dist/chunks/{image-4DCU4VPP.js → image-RZ2A4FWP.js} +6 -6
  61. package/dist/chunks/{import-builders-DVG3HOTF.js → import-builders-GZPE5N44.js} +9 -9
  62. package/dist/chunks/{inspect-B3OWUFLH.js → inspect-56S2DKPO.js} +11 -11
  63. package/dist/chunks/{inspect-VPME6UC7.js → inspect-EVDBNPP4.js} +11 -11
  64. package/dist/chunks/{inspect-TGOJDKIT.js → inspect-KGEMHV2T.js} +9 -9
  65. package/dist/chunks/{inspect-VLGKNHJW.js → inspect-OOV2ORKD.js} +11 -11
  66. package/dist/chunks/{inspect-TUW67CFZ.js → inspect-X2Y5FDKR.js} +10 -10
  67. package/dist/chunks/{list-K552ITMK.js → list-FWLSZYMO.js} +9 -9
  68. package/dist/chunks/{list-2DPKDHRV.js → list-H357CF7M.js} +10 -10
  69. package/dist/chunks/{list-TK2JO7BK.js → list-TWSOAQRB.js} +8 -8
  70. package/dist/chunks/{login-HRWEKW5P.js → login-54OPNB5E.js} +21 -12
  71. package/dist/chunks/{ls-JSV2WZVF.js → ls-6JHFSJBJ.js} +11 -11
  72. package/dist/chunks/{ls-O2WYF5UL.js → ls-DU3S2GBJ.js} +11 -11
  73. package/dist/chunks/{ls-IOXGXEY4.js → ls-VDFNIR5H.js} +10 -10
  74. package/dist/chunks/{ls-M5TYGFP5.js → ls-WFMTVJOO.js} +11 -11
  75. package/dist/chunks/{ls-YIF3KLF3.js → ls-WGIRTAVM.js} +11 -11
  76. package/dist/chunks/{ls-TM6NTZEB.js → ls-ZMR5RMU4.js} +9 -9
  77. package/dist/chunks/{open-FWAVEWGU.js → open-RCSCNKHF.js} +9 -9
  78. package/dist/chunks/{permissions-DPFYL47Z.js → permissions-XNN37R4N.js} +7 -7
  79. package/dist/chunks/{publish-63CGFKQR.js → publish-PLXEACYY.js} +8 -8
  80. package/dist/chunks/{push-T5ZTBW3P.js → push-EFYSB52Q.js} +11 -11
  81. package/dist/chunks/{query-B6O3EMEV.js → query-EKTXDOL7.js} +11 -11
  82. package/dist/chunks/{reorder-ANV4NMKH.js → reorder-OSA7D2RG.js} +8 -8
  83. package/dist/chunks/{reply-C73KGOCG.js → reply-6M2IYKLK.js} +10 -10
  84. package/dist/chunks/{resolve-IHSIVPEE.js → resolve-MCX5STKN.js} +9 -9
  85. package/dist/chunks/{restore-GSUNXP2O.js → restore-52OEP3NL.js} +8 -8
  86. package/dist/chunks/{rm-M7IJC2WZ.js → rm-2VAJFK25.js} +11 -11
  87. package/dist/chunks/{rm-RV5SQFQA.js → rm-4BJN2LJX.js} +11 -13
  88. package/dist/chunks/{rm-4O74PS4Q.js → rm-IYEDZOMN.js} +11 -11
  89. package/dist/chunks/{rm-PRINF4OU.js → rm-QW35WHSK.js} +11 -11
  90. package/dist/chunks/{rm-YDTK5ESZ.js → rm-TXV4GB4L.js} +10 -10
  91. package/dist/chunks/{routes-SZI2G4SE.js → routes-2OLIBRYX.js} +3 -3
  92. package/dist/chunks/{rule-inspect-ZZC53FLP.js → rule-inspect-WOBAN3Y2.js} +10 -10
  93. package/dist/chunks/{rules-SAOSSGFI.js → rules-CUJRAZYO.js} +10 -10
  94. package/dist/chunks/{schema-23ZFAKDU.js → schema-45SJNY5L.js} +4 -4
  95. package/dist/chunks/{schema-2Q3QRMRO.js → schema-VCGEJAOG.js} +9 -9
  96. package/dist/chunks/{set-L47ZCZBJ.js → set-2QSXMDVF.js} +9 -9
  97. package/dist/chunks/{tags-2TWLM77N.js → tags-NHX2VQ7E.js} +5 -5
  98. package/dist/chunks/{types-G3PEUIJH.js → types-JGANJ5EQ.js} +3 -3
  99. package/dist/chunks/{update-SZH2VBD6.js → update-EOHXTT4N.js} +12 -12
  100. package/dist/commands/build/builder-worker.cjs +281 -0
  101. package/dist/commands/build/index.js +798 -236
  102. package/dist/commands/deploy/index.js +103 -31
  103. package/dist/commands/dev/index.js +983 -176
  104. package/dist/commands/env/index.js +1167 -542
  105. package/dist/commands/link/index.js +10 -10
  106. package/dist/commands/list/index.js +10 -10
  107. package/dist/commands-bulk.js +2002 -962
  108. package/dist/index.js +16 -16
  109. package/dist/version.mjs +1 -1
  110. package/package.json +48 -48
  111. package/dist/chunks/chunk-HGRWPPYB.js +0 -18
@@ -11,33 +11,33 @@ import {
11
11
  require_service_schedules,
12
12
  require_write_build_result,
13
13
  writeBuildResult
14
- } from "../../chunks/chunk-TAZ5ZAKG.js";
14
+ } from "../../chunks/chunk-AFKB6VMO.js";
15
15
  import {
16
16
  importBuilders,
17
17
  import_import_builders
18
- } from "../../chunks/chunk-JJQP3PYM.js";
18
+ } from "../../chunks/chunk-MHCGKUI7.js";
19
19
  import {
20
20
  js_yaml_default,
21
21
  pullCommandLogic
22
- } from "../../chunks/chunk-VWYNSJXI.js";
22
+ } from "../../chunks/chunk-CBHLLOGZ.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-TDXNNIZ6.js";
29
- import "../../chunks/chunk-R6IGDGX3.js";
30
- import "../../chunks/chunk-HT2XWSAJ.js";
28
+ } from "../../chunks/chunk-3PA7LXYM.js";
29
+ import "../../chunks/chunk-7AEEQOD4.js";
30
+ import "../../chunks/chunk-5XECIWME.js";
31
31
  import {
32
32
  stamp_default
33
33
  } from "../../chunks/chunk-64IF634X.js";
34
34
  import "../../chunks/chunk-VXYGCOKL.js";
35
35
  import {
36
36
  buildCommand
37
- } from "../../chunks/chunk-7XX4ZEOV.js";
37
+ } from "../../chunks/chunk-FWKSJYDV.js";
38
38
  import {
39
39
  help
40
- } from "../../chunks/chunk-RZ5NP6HN.js";
40
+ } from "../../chunks/chunk-2YRAWYGE.js";
41
41
  import {
42
42
  DEFAULT_VERCEL_CONFIG_FILENAME,
43
43
  VERCEL_DIR,
@@ -63,28 +63,28 @@ import {
63
63
  resolveProjectCwd,
64
64
  ua_default,
65
65
  validateConfig
66
- } from "../../chunks/chunk-E6LFKMI2.js";
67
- import "../../chunks/chunk-OHER4DGX.js";
66
+ } from "../../chunks/chunk-BQG777JE.js";
67
+ import "../../chunks/chunk-FXD67VN5.js";
68
68
  import {
69
69
  TelemetryClient
70
- } from "../../chunks/chunk-CYNB6LL4.js";
70
+ } from "../../chunks/chunk-XNFHNTS2.js";
71
71
  import {
72
72
  AGENT_REASON,
73
73
  AGENT_STATUS,
74
74
  outputAgentError
75
- } from "../../chunks/chunk-L7CEMAJG.js";
75
+ } from "../../chunks/chunk-NGGLYKNU.js";
76
76
  import "../../chunks/chunk-GGP5R3FU.js";
77
77
  import {
78
78
  printError,
79
79
  toEnumerableError
80
- } from "../../chunks/chunk-CQJRLNTX.js";
80
+ } from "../../chunks/chunk-AYLY3ZVL.js";
81
81
  import {
82
82
  parseArguments
83
83
  } from "../../chunks/chunk-57RHXXXG.js";
84
84
  import "../../chunks/chunk-RKDCNQ4S.js";
85
85
  import {
86
86
  CantParseJSONFile
87
- } from "../../chunks/chunk-AWCID36T.js";
87
+ } from "../../chunks/chunk-BMKU5KEL.js";
88
88
  import {
89
89
  cmd,
90
90
  getCommandName,
@@ -102,7 +102,7 @@ import {
102
102
  emoji,
103
103
  output_manager_default,
104
104
  prependEmoji
105
- } from "../../chunks/chunk-OX7KI3LF.js";
105
+ } from "../../chunks/chunk-QFAS4OVW.js";
106
106
  import {
107
107
  require_source
108
108
  } from "../../chunks/chunk-S7KYDPEM.js";
@@ -112,6 +112,57 @@ import {
112
112
  __toESM
113
113
  } from "../../chunks/chunk-TZ2YI2VH.js";
114
114
 
115
+ // ../../internals/cli-builder-integration/dist/build-runner.js
116
+ var require_build_runner = __commonJS({
117
+ "../../internals/cli-builder-integration/dist/build-runner.js"(exports, module) {
118
+ "use strict";
119
+ var __defProp = Object.defineProperty;
120
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
121
+ var __getOwnPropNames = Object.getOwnPropertyNames;
122
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
123
+ var __export = (target, all) => {
124
+ for (var name in all)
125
+ __defProp(target, name, { get: all[name], enumerable: true });
126
+ };
127
+ var __copyProps = (to, from, except, desc) => {
128
+ if (from && typeof from === "object" || typeof from === "function") {
129
+ for (let key of __getOwnPropNames(from))
130
+ if (!__hasOwnProp.call(to, key) && key !== except)
131
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
132
+ }
133
+ return to;
134
+ };
135
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
136
+ var build_runner_exports = {};
137
+ __export(build_runner_exports, {
138
+ BuildRunner: () => BuildRunner3,
139
+ InprocessBuildRunner: () => InprocessBuildRunner2
140
+ });
141
+ module.exports = __toCommonJS(build_runner_exports);
142
+ var BuildRunner3 = class {
143
+ constructor(ctx) {
144
+ this.ctx = ctx;
145
+ }
146
+ };
147
+ var InprocessBuildRunner2 = class extends BuildRunner3 {
148
+ constructor(ctx, builder) {
149
+ super(ctx);
150
+ this.builder = builder;
151
+ }
152
+ async build() {
153
+ return await this.builder.build(this.ctx.buildOptions);
154
+ }
155
+ async diagnostics() {
156
+ return await this.ctx.builderSpan.child("vc.builder.diagnostics").trace(
157
+ async () => await this.builder.diagnostics?.(this.ctx.buildOptions)
158
+ );
159
+ }
160
+ teardown() {
161
+ }
162
+ };
163
+ }
164
+ });
165
+
115
166
  // ../../internals/builder-orchestration/dist/sort-builders.js
116
167
  var require_sort_builders = __commonJS({
117
168
  "../../internals/builder-orchestration/dist/sort-builders.js"(exports, module) {
@@ -183,16 +234,28 @@ var require_execute_builder = __commonJS({
183
234
  });
184
235
  module.exports = __toCommonJS(execute_builder_exports);
185
236
  var import_sort_builders = require_sort_builders();
237
+ var import_build_runner2 = require_build_runner();
186
238
  async function executeBuilder2({
187
239
  builder,
188
240
  buildOptions,
189
241
  span,
190
242
  isFrontendBuilder,
191
243
  hasDetectedServices,
192
- framework
244
+ framework,
245
+ runner
193
246
  }) {
194
- const rawBuildResult = await span.trace(() => builder.build(buildOptions));
195
- const buildResult = builder.version === -1 ? rawBuildResult.result : rawBuildResult;
247
+ const buildRunner = runner ?? new import_build_runner2.InprocessBuildRunner(
248
+ {
249
+ requirePath: "",
250
+ buildOptions,
251
+ cwd: buildOptions.workPath,
252
+ expectsPreDeploy: false,
253
+ builderSpan: span
254
+ },
255
+ builder
256
+ );
257
+ const rawBuildResult = await span.trace(() => buildRunner.build());
258
+ const buildResult = builder.version === -1 && "resultVersion" in rawBuildResult ? rawBuildResult.result : rawBuildResult;
196
259
  if (!hasDetectedServices && buildOptions.config.zeroConfig && isFrontendBuilder && "output" in buildResult && !buildResult.routes && framework) {
197
260
  buildResult.routes = await getFrameworkRoutes(
198
261
  framework,
@@ -238,7 +301,7 @@ var require_backend_rewrite_warning = __commonJS({
238
301
  hasBackendRewriteBehaviorChange: () => hasBackendRewriteBehaviorChange
239
302
  });
240
303
  module.exports = __toCommonJS(backend_rewrite_warning_exports);
241
- var import_build_utils2 = __require("@vercel/build-utils");
304
+ var import_build_utils3 = __require("@vercel/build-utils");
242
305
  var BACKEND_REWRITE_BEHAVIOR_WARNING = "Internal rewrites in backend framework projects now route requests using the rewritten destination path. This behavior was previously unsupported and may change which application route handles a request. Review your rewrite configuration to ensure this behavior is expected.";
243
306
  function hasInternalPathRewrite(rewrites) {
244
307
  return rewrites?.some(
@@ -246,7 +309,7 @@ var require_backend_rewrite_warning = __commonJS({
246
309
  ) ?? false;
247
310
  }
248
311
  function isAffectedFramework(framework) {
249
- return framework === "go" || framework === "container" || (0, import_build_utils2.isPythonFramework)(framework);
312
+ return framework === "go" || framework === "container" || (0, import_build_utils3.isPythonFramework)(framework) || (0, import_build_utils3.isNodeBackendFramework)(framework);
250
313
  }
251
314
  function hasBackendRewriteBehaviorChange({
252
315
  projectRewrites,
@@ -350,13 +413,13 @@ var require_validate_cron_secret = __commonJS({
350
413
  validateCronSecret: () => validateCronSecret
351
414
  });
352
415
  module.exports = __toCommonJS(validate_cron_secret_exports);
353
- var import_build_utils2 = __require("@vercel/build-utils");
416
+ var import_build_utils3 = __require("@vercel/build-utils");
354
417
  function validateCronSecret(cronSecret) {
355
418
  if (!cronSecret) {
356
419
  return null;
357
420
  }
358
421
  if (cronSecret !== cronSecret.trim()) {
359
- return new import_build_utils2.NowBuildError({
422
+ return new import_build_utils3.NowBuildError({
360
423
  code: "INVALID_CRON_SECRET",
361
424
  message: "The `CRON_SECRET` environment variable contains leading or trailing whitespace, which is not allowed in HTTP header values.",
362
425
  link: "https://vercel.link/securing-cron-jobs",
@@ -388,7 +451,7 @@ var require_validate_cron_secret = __commonJS({
388
451
  });
389
452
  const moreCount = invalidChars.length - 3;
390
453
  const moreText = moreCount > 0 ? `, and ${moreCount} more` : "";
391
- return new import_build_utils2.NowBuildError({
454
+ return new import_build_utils3.NowBuildError({
392
455
  code: "INVALID_CRON_SECRET",
393
456
  message: `The \`CRON_SECRET\` environment variable contains characters that are not valid in HTTP headers: ${descriptions.join(", ")}${moreText}. Only visible ASCII characters (letters, digits, symbols), spaces, and tabs are allowed.`,
394
457
  link: "https://vercel.link/securing-cron-jobs",
@@ -437,9 +500,9 @@ var require_validate_package_manifest = __commonJS({
437
500
  });
438
501
  module.exports = __toCommonJS(validate_package_manifest_exports);
439
502
  var import_ajv = __toESM2(require_ajv());
440
- var import_build_utils2 = __require("@vercel/build-utils");
503
+ var import_build_utils3 = __require("@vercel/build-utils");
441
504
  var ajv = new import_ajv.default();
442
- var validate = ajv.compile(import_build_utils2.packageManifestSchema);
505
+ var validate = ajv.compile(import_build_utils3.packageManifestSchema);
443
506
  function validatePackageManifest(data) {
444
507
  if (validate(data)) {
445
508
  return null;
@@ -477,7 +540,7 @@ var require_manifest = __commonJS({
477
540
  });
478
541
  module.exports = __toCommonJS(manifest_exports);
479
542
  var import_path2 = __require("path");
480
- var import_build_utils2 = __require("@vercel/build-utils");
543
+ var import_build_utils3 = __require("@vercel/build-utils");
481
544
  async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
482
545
  if (packageManifests.length === 0)
483
546
  return;
@@ -499,8 +562,8 @@ var require_manifest = __commonJS({
499
562
  builder: builderUse,
500
563
  framework,
501
564
  serviceName: service?.name,
502
- serviceType: service && (0, import_build_utils2.isExperimentalService)(service) ? service.type : void 0,
503
- routePrefix: service && (0, import_build_utils2.isExperimentalService)(service) ? service.routePrefix : void 0
565
+ serviceType: service && (0, import_build_utils3.isExperimentalService)(service) ? service.type : void 0,
566
+ routePrefix: service && (0, import_build_utils3.isExperimentalService)(service) ? service.routePrefix : void 0
504
567
  };
505
568
  const { version: _version, ...manifestWithoutVersion } = manifest;
506
569
  deployManifestBuilds[key] = {
@@ -516,19 +579,19 @@ var require_manifest = __commonJS({
516
579
  } else {
517
580
  deployManifestServices[service.name] = {
518
581
  builds: [key],
519
- bindings: (0, import_build_utils2.isExperimentalServiceV2)(service) ? service.bindings : void 0
582
+ bindings: (0, import_build_utils3.isExperimentalServiceV2)(service) ? service.bindings : void 0
520
583
  };
521
584
  }
522
585
  }
523
586
  }
524
587
  if (Object.keys(projectManifest).length === 0)
525
588
  return;
526
- const projectManifestBlob = new import_build_utils2.FileBlob({
589
+ const projectManifestBlob = new import_build_utils3.FileBlob({
527
590
  data: JSON.stringify(projectManifest)
528
591
  });
529
592
  diagnostics["project-manifest.json"] = projectManifestBlob;
530
593
  ops.push(
531
- (0, import_build_utils2.downloadFile)(
594
+ (0, import_build_utils3.downloadFile)(
532
595
  projectManifestBlob,
533
596
  (0, import_path2.join)(outputDir, "diagnostics", "project-manifest.json")
534
597
  ).then(
@@ -536,7 +599,7 @@ var require_manifest = __commonJS({
536
599
  (err) => err
537
600
  )
538
601
  );
539
- const deployManifestBlob = new import_build_utils2.FileBlob({
602
+ const deployManifestBlob = new import_build_utils3.FileBlob({
540
603
  data: JSON.stringify({
541
604
  manifestVersion: "2.0",
542
605
  builds: deployManifestBuilds,
@@ -545,7 +608,7 @@ var require_manifest = __commonJS({
545
608
  });
546
609
  diagnostics["deploy-manifest.json"] = deployManifestBlob;
547
610
  ops.push(
548
- (0, import_build_utils2.downloadFile)(
611
+ (0, import_build_utils3.downloadFile)(
549
612
  deployManifestBlob,
550
613
  (0, import_path2.join)(outputDir, "diagnostics", "deploy-manifest.json")
551
614
  ).then(
@@ -583,7 +646,7 @@ var require_build_embedding = __commonJS({
583
646
  shouldEmbedFlagsDefinitions: () => shouldEmbedFlagsDefinitions
584
647
  });
585
648
  module.exports = __toCommonJS(build_embedding_exports);
586
- var import_build_utils2 = __require("@vercel/build-utils");
649
+ var import_build_utils3 = __require("@vercel/build-utils");
587
650
  function isFlagsEmbedOption(input) {
588
651
  return input === "force-on" || input === "force-off";
589
652
  }
@@ -605,8 +668,8 @@ var require_build_embedding = __commonJS({
605
668
  if (envHasSdkKey()) {
606
669
  return true;
607
670
  }
608
- const hasVercelFlags = await (0, import_build_utils2.isPackageInstalled)("@flags-sdk/vercel", cwd);
609
- const hasFlagsCore = await (0, import_build_utils2.isPackageInstalled)("@vercel/flags-core", cwd);
671
+ const hasVercelFlags = await (0, import_build_utils3.isPackageInstalled)("@flags-sdk/vercel", cwd);
672
+ const hasFlagsCore = await (0, import_build_utils3.isPackageInstalled)("@vercel/flags-core", cwd);
610
673
  if (hasVercelFlags || hasFlagsCore) {
611
674
  return true;
612
675
  }
@@ -654,49 +717,86 @@ var require_validate_build_output = __commonJS({
654
717
  module.exports = __toCommonJS(validate_build_output_exports);
655
718
  var import_fs_extra2 = __toESM2(require_lib());
656
719
  var import_path2 = __require("path");
657
- var import_build_utils2 = __require("@vercel/build-utils");
720
+ var import_build_utils3 = __require("@vercel/build-utils");
658
721
  function logDebug(message, output) {
659
722
  output?.debug(message);
660
- (0, import_build_utils2.debug)(message);
723
+ (0, import_build_utils3.debug)(message);
724
+ }
725
+ async function validateOutputConfig(configPath, label, problems) {
726
+ const configExists = await import_fs_extra2.default.pathExists(configPath);
727
+ if (!configExists) {
728
+ problems.push({
729
+ severity: "error",
730
+ message: `${label} is missing config.json.`
731
+ });
732
+ return;
733
+ }
734
+ let config;
735
+ try {
736
+ config = await import_fs_extra2.default.readJSON(configPath);
737
+ } catch (err) {
738
+ problems.push({
739
+ severity: "error",
740
+ message: `${label} config.json is not valid JSON: ${err instanceof Error ? err.message : String(err)}.`
741
+ });
742
+ return;
743
+ }
744
+ if (config && config.version !== 3) {
745
+ problems.push({
746
+ severity: "warning",
747
+ message: `${label} config.json has unexpected version "${config.version}" (expected 3).`
748
+ });
749
+ }
661
750
  }
662
751
  async function validateBuildOutput(outputDir, output) {
663
752
  const problems = [];
664
753
  logDebug(`Validating build output at "${outputDir}"`, output);
665
754
  try {
666
- const configPath = (0, import_path2.join)(outputDir, "config.json");
667
- const configExists = await import_fs_extra2.default.pathExists(configPath);
668
- if (!configExists) {
669
- problems.push({
670
- severity: "error",
671
- message: "Build output is missing config.json."
672
- });
673
- } else {
674
- let config;
675
- try {
676
- config = await import_fs_extra2.default.readJSON(configPath);
677
- } catch (err) {
678
- problems.push({
679
- severity: "error",
680
- message: `Build output config.json is not valid JSON: ${err instanceof Error ? err.message : String(err)}.`
681
- });
682
- }
683
- if (config && config.version !== 3) {
684
- problems.push({
685
- severity: "warning",
686
- message: `Build output config.json has unexpected version "${config.version}" (expected 3).`
687
- });
755
+ await validateOutputConfig(
756
+ (0, import_path2.join)(outputDir, "config.json"),
757
+ "Build output",
758
+ problems
759
+ );
760
+ const servicesDir = (0, import_path2.join)(outputDir, "services");
761
+ let serviceNames = [];
762
+ try {
763
+ const entries = await import_fs_extra2.default.readdir(servicesDir, { withFileTypes: true });
764
+ serviceNames = entries.filter((e) => e.isDirectory()).map((e) => e.name);
765
+ } catch (err) {
766
+ if (err?.code !== "ENOENT") {
767
+ throw err;
688
768
  }
689
769
  }
690
770
  const [hasFunctions, hasStatic] = await Promise.all([
691
771
  import_fs_extra2.default.pathExists((0, import_path2.join)(outputDir, "functions")),
692
772
  import_fs_extra2.default.pathExists((0, import_path2.join)(outputDir, "static"))
693
773
  ]);
694
- if (!hasFunctions && !hasStatic) {
774
+ const hasServices = serviceNames.length > 0;
775
+ if (!hasFunctions && !hasStatic && !hasServices) {
695
776
  problems.push({
696
777
  severity: "warning",
697
- message: 'Build output contains no "functions" or "static" directory; the build may not have produced any deployable output.'
778
+ message: 'Build output contains no "functions", "static", or "services" directory; the build may not have produced any deployable output.'
698
779
  });
699
780
  }
781
+ for (const name of serviceNames) {
782
+ const serviceDir = (0, import_path2.join)(servicesDir, name);
783
+ const label = `Build output service "${name}"`;
784
+ await validateOutputConfig(
785
+ (0, import_path2.join)(serviceDir, "config.json"),
786
+ label,
787
+ problems
788
+ );
789
+ const [svcHasFunctions, svcHasStatic] = await Promise.all([
790
+ import_fs_extra2.default.pathExists((0, import_path2.join)(serviceDir, "functions")),
791
+ import_fs_extra2.default.pathExists((0, import_path2.join)(serviceDir, "static"))
792
+ ]);
793
+ if (!svcHasFunctions && !svcHasStatic) {
794
+ problems.push({
795
+ severity: "warning",
796
+ message: `${label} contains no "functions" or "static" directory; the service may not have produced any deployable output.`
797
+ });
798
+ }
799
+ }
700
800
  logDebug(
701
801
  `Build output validation found ${problems.length} problem(s)` + (problems.length ? `: ${problems.map((p) => `${p.severity}: ${p.message}`).join("; ")}` : ""),
702
802
  output
@@ -755,10 +855,10 @@ var require_framework_detection = __commonJS({
755
855
  module.exports = __toCommonJS(framework_detection_exports);
756
856
  var import_fs_detectors = require_dist2();
757
857
  var import_frameworks = require_frameworks();
758
- var import_build_utils2 = __require("@vercel/build-utils");
858
+ var import_build_utils3 = __require("@vercel/build-utils");
759
859
  function logDebug(message, output) {
760
860
  output?.debug(message);
761
- (0, import_build_utils2.debug)(message);
861
+ (0, import_build_utils3.debug)(message);
762
862
  }
763
863
  function isFrameworkDetectionEnabled(output) {
764
864
  const raw = process.env.VERCEL_FRAMEWORK_DETECTION;
@@ -779,7 +879,7 @@ var require_framework_detection = __commonJS({
779
879
  return result;
780
880
  }
781
881
  async function detectFirstDeploymentFramework(options) {
782
- const { workPath, projectSettings, output } = options;
882
+ const { workPath, projectSettings, frameworkExplicitlyConfigured, output } = options;
783
883
  logDebug(
784
884
  `First deployment: evaluating framework detection (workPath="${workPath}", configuredFramework=${projectSettings.framework ? `"${projectSettings.framework}"` : "<none>"})`,
785
885
  output
@@ -791,7 +891,7 @@ var require_framework_detection = __commonJS({
791
891
  );
792
892
  return { status: "skipped" };
793
893
  }
794
- if (projectSettings.framework) {
894
+ if (frameworkExplicitlyConfigured || projectSettings.framework) {
795
895
  logDebug(
796
896
  `First deployment: skipping framework detection because a framework is already configured ("${projectSettings.framework}")`,
797
897
  output
@@ -982,20 +1082,23 @@ var require_monorepo = __commonJS({
982
1082
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
983
1083
  var monorepo_exports = {};
984
1084
  __export(monorepo_exports, {
1085
+ applyServicesMonorepoDefaults: () => applyServicesMonorepoDefaults,
985
1086
  setMonorepoDefaultSettings: () => setMonorepoDefaultSettings
986
1087
  });
987
1088
  module.exports = __toCommonJS(monorepo_exports);
988
1089
  var import_path2 = __require("path");
989
1090
  var import_fs_detectors = require_dist2();
1091
+ var import_service_topology = require_dist4();
990
1092
  var import_title = __toESM2(require_lib2());
991
- var import_build_utils2 = __require("@vercel/build-utils");
1093
+ var import_fs_extra2 = __toESM2(require_lib());
1094
+ var import_build_utils3 = __require("@vercel/build-utils");
992
1095
  async function setMonorepoDefaultSettings(cwd, workPath, projectSettings, output) {
993
1096
  const localFileSystem = new import_fs_detectors.LocalFileSystemDetector(cwd);
994
1097
  const projectName = (0, import_path2.basename)(workPath);
995
1098
  const relativeToRoot = (0, import_path2.relative)(workPath, cwd);
996
1099
  const setCommand = (command, value) => {
997
1100
  if (projectSettings[command]) {
998
- (0, import_build_utils2.debug)(
1101
+ (0, import_build_utils3.debug)(
999
1102
  `Skipping auto-assignment of ${command} as it is already set via project settings or configuration overrides.`
1000
1103
  );
1001
1104
  } else {
@@ -1037,6 +1140,98 @@ var require_monorepo = __commonJS({
1037
1140
  throw error;
1038
1141
  }
1039
1142
  }
1143
+ async function hasVercelBuildScript(serviceRoot) {
1144
+ try {
1145
+ const pkg = await import_fs_extra2.default.readJSON(
1146
+ (0, import_path2.join)(serviceRoot, "package.json")
1147
+ );
1148
+ return pkg?.scripts?.["vercel-build"] !== void 0;
1149
+ } catch {
1150
+ return false;
1151
+ }
1152
+ }
1153
+ async function applyServicesMonorepoDefaults(cwd, workPath, services, projectSettings, output) {
1154
+ const localFileSystem = new import_fs_detectors.LocalFileSystemDetector(cwd);
1155
+ let result;
1156
+ let announced = false;
1157
+ for (const [name, config] of Object.entries(services)) {
1158
+ if (config.buildCommand) {
1159
+ (0, import_build_utils3.debug)(
1160
+ `Skipping auto-assignment of buildCommand for service "${name}" as it is already set in the services configuration.`
1161
+ );
1162
+ continue;
1163
+ }
1164
+ const runtime = (0, import_service_topology.inferServiceRuntime)({
1165
+ runtime: config.runtime,
1166
+ framework: config.framework,
1167
+ entrypoint: config.entrypoint
1168
+ });
1169
+ if (runtime !== void 0 && runtime !== "node") {
1170
+ (0, import_build_utils3.debug)(
1171
+ `Skipping monorepo defaults for service "${name}": runtime "${runtime}" does not build via the monorepo task graph.`
1172
+ );
1173
+ continue;
1174
+ }
1175
+ const serviceRoot = (0, import_path2.resolve)(workPath, config.root ?? ".");
1176
+ const projectPath = (0, import_path2.relative)(cwd, serviceRoot);
1177
+ if ((0, import_path2.isAbsolute)(projectPath) || projectPath === ".." || projectPath.startsWith(`..${import_path2.sep}`)) {
1178
+ (0, import_build_utils3.debug)(
1179
+ `Skipping monorepo defaults for service "${name}": root "${config.root}" is outside "${cwd}".`
1180
+ );
1181
+ continue;
1182
+ }
1183
+ if (await hasVercelBuildScript(serviceRoot)) {
1184
+ (0, import_build_utils3.debug)(
1185
+ `Skipping monorepo defaults for service "${name}": a \`vercel-build\` script is defined in its root package.json.`
1186
+ );
1187
+ continue;
1188
+ }
1189
+ const posixProjectPath = (0, import_build_utils3.normalizePath)(projectPath);
1190
+ const posixRelativeToRoot = (0, import_build_utils3.normalizePath)((0, import_path2.relative)(serviceRoot, cwd));
1191
+ let settings;
1192
+ try {
1193
+ settings = await (0, import_fs_detectors.getMonorepoDefaultSettings)(
1194
+ (0, import_path2.basename)(serviceRoot),
1195
+ // `getMonorepoDefaultSettings()` expects `/` (not `''`) to mean "the
1196
+ // monorepo root", which is a valid service root.
1197
+ posixProjectPath || "/",
1198
+ posixRelativeToRoot,
1199
+ localFileSystem
1200
+ );
1201
+ } catch (error) {
1202
+ if (error instanceof import_fs_detectors.MissingBuildPipeline) {
1203
+ output.warn(`${error.message} Skipping automatic setting assignment.`);
1204
+ break;
1205
+ }
1206
+ if (error instanceof import_fs_detectors.MissingBuildTarget) {
1207
+ output.warn(
1208
+ `Service "${name}": ${error.message} Skipping automatic setting assignment.`
1209
+ );
1210
+ continue;
1211
+ }
1212
+ throw error;
1213
+ }
1214
+ if (settings === null) {
1215
+ break;
1216
+ }
1217
+ projectSettings.monorepoManager = settings.monorepoManager;
1218
+ if (!settings.buildCommand) {
1219
+ continue;
1220
+ }
1221
+ if (!announced) {
1222
+ output.log(
1223
+ `Detected ${(0, import_title.default)(settings.monorepoManager)}. Adjusting default settings...`
1224
+ );
1225
+ announced = true;
1226
+ }
1227
+ (0, import_build_utils3.debug)(
1228
+ `Assigning buildCommand "${settings.buildCommand}" to service "${name}".`
1229
+ );
1230
+ result ??= { ...services };
1231
+ result[name] = { ...config, buildCommand: settings.buildCommand };
1232
+ }
1233
+ return result ?? services;
1234
+ }
1040
1235
  }
1041
1236
  });
1042
1237
 
@@ -1078,7 +1273,7 @@ var require_corepack = __commonJS({
1078
1273
  });
1079
1274
  module.exports = __toCommonJS(corepack_exports);
1080
1275
  var import_path2 = __require("path");
1081
- var import_build_utils2 = __require("@vercel/build-utils");
1276
+ var import_build_utils3 = __require("@vercel/build-utils");
1082
1277
  var import_fs_extra2 = __toESM2(require_lib());
1083
1278
  async function initCorepack({
1084
1279
  repoRootPath,
@@ -1113,7 +1308,7 @@ var require_corepack = __commonJS({
1113
1308
  process.env.COREPACK_HOME = corepackHomeDir;
1114
1309
  process.env.PATH = `${corepackShimDir}${import_path2.delimiter}${process.env.PATH}`;
1115
1310
  const pkgManagerName = pkg.packageManager.split("@")[0];
1116
- await (0, import_build_utils2.spawnAsync)(
1311
+ await (0, import_build_utils3.spawnAsync)(
1117
1312
  "corepack",
1118
1313
  ["enable", pkgManagerName, "--install-directory", corepackShimDir],
1119
1314
  {
@@ -1178,7 +1373,7 @@ var require_do_build = __commonJS({
1178
1373
  var import_minimatch2 = __toESM2(require_minimatch());
1179
1374
  var import_path2 = __require("path");
1180
1375
  var import_semver = __toESM2(require_semver());
1181
- var import_build_utils2 = __require("@vercel/build-utils");
1376
+ var import_build_utils3 = __require("@vercel/build-utils");
1182
1377
  var import_client = require_dist();
1183
1378
  var import_frameworks = require_frameworks();
1184
1379
  var import_fs_detectors = require_dist2();
@@ -1186,6 +1381,7 @@ var require_do_build = __commonJS({
1186
1381
  var import_detect_builders_with_services = require_detect_builders_with_services();
1187
1382
  var import_routing_utils = require_dist3();
1188
1383
  var import_write_build_result3 = require_write_build_result();
1384
+ var import_build_runner2 = require_build_runner();
1189
1385
  var import_execute_builder = require_execute_builder();
1190
1386
  var import_backend_rewrite_warning = require_backend_rewrite_warning();
1191
1387
  var import_service_route_ownership = require_service_route_ownership();
@@ -1247,6 +1443,7 @@ var require_do_build = __commonJS({
1247
1443
  } = request;
1248
1444
  const {
1249
1445
  output,
1446
+ createBuildRunner: createBuildRunner2,
1250
1447
  importBuilders: importBuilders2,
1251
1448
  formatResolvedBuilders: formatResolvedBuilders2,
1252
1449
  writeBuildResult: writeBuildResult2,
@@ -1278,7 +1475,7 @@ var require_do_build = __commonJS({
1278
1475
  if (typeof installCommand === "string") {
1279
1476
  if (installCommand.trim()) {
1280
1477
  output.log(`Running install command before config compilation...`);
1281
- installRan = await (0, import_build_utils2.runCustomInstallCommand)({
1478
+ installRan = await (0, import_build_utils3.runCustomInstallCommand)({
1282
1479
  destPath: workPath,
1283
1480
  installCommand,
1284
1481
  spawnOpts: { env: process.env },
@@ -1289,7 +1486,7 @@ var require_do_build = __commonJS({
1289
1486
  }
1290
1487
  } else {
1291
1488
  output.log(`Installing dependencies before config compilation...`);
1292
- installRan = await (0, import_build_utils2.runNpmInstall)(
1489
+ installRan = await (0, import_build_utils3.runNpmInstall)(
1293
1490
  workPath,
1294
1491
  [],
1295
1492
  { env: process.env },
@@ -1301,7 +1498,7 @@ var require_do_build = __commonJS({
1301
1498
  installDepsSpan.stop();
1302
1499
  }
1303
1500
  if (installRan) {
1304
- const { packageJsonPath } = await (0, import_build_utils2.scanParentDirs)(workPath, false);
1501
+ const { packageJsonPath } = await (0, import_build_utils3.scanParentDirs)(workPath, false);
1305
1502
  if (packageJsonPath) {
1306
1503
  process.env.VERCEL_INSTALL_COMPLETED_PATH = packageJsonPath;
1307
1504
  }
@@ -1352,6 +1549,10 @@ var require_do_build = __commonJS({
1352
1549
  const result = await (0, import_framework_detection.detectFirstDeploymentFramework)({
1353
1550
  workPath,
1354
1551
  projectSettings,
1552
+ frameworkExplicitlyConfigured: Object.prototype.hasOwnProperty.call(
1553
+ localConfig,
1554
+ "framework"
1555
+ ),
1355
1556
  output
1356
1557
  });
1357
1558
  s.setAttributes({
@@ -1382,7 +1583,7 @@ var require_do_build = __commonJS({
1382
1583
  });
1383
1584
  const files = await span.child("vc.getFiles").trace(async (s) => {
1384
1585
  const result = (await (0, import_get_files.staticFiles)(workPath, {}, output)).map(
1385
- (f) => (0, import_build_utils2.normalizePath)((0, import_path2.relative)(workPath, f))
1586
+ (f) => (0, import_build_utils3.normalizePath)((0, import_path2.relative)(workPath, f))
1386
1587
  );
1387
1588
  s.setAttributes({ fileCount: String(result.length) });
1388
1589
  return result;
@@ -1413,7 +1614,7 @@ var require_do_build = __commonJS({
1413
1614
  throw routesResult.error;
1414
1615
  }
1415
1616
  if (localConfig.builds && localConfig.functions) {
1416
- throw new import_build_utils2.NowBuildError({
1617
+ throw new import_build_utils3.NowBuildError({
1417
1618
  code: "bad_request",
1418
1619
  message: "The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",
1419
1620
  link: "https://vercel.link/functions-and-builds"
@@ -1444,11 +1645,23 @@ var require_do_build = __commonJS({
1444
1645
  builds = builds.flatMap((b) => expandBuild(files, b));
1445
1646
  } else {
1446
1647
  isZeroConfig = true;
1648
+ let servicesForDetection = configuredExperimentalServicesV2;
1649
+ if (process.env.VERCEL_BUILD_MONOREPO_SUPPORT === "1" && configuredExperimentalServicesV2) {
1650
+ servicesForDetection = await span.child("vc.applyServicesMonorepoDefaults").trace(
1651
+ () => (0, import_monorepo.applyServicesMonorepoDefaults)(
1652
+ cwd,
1653
+ workPath,
1654
+ configuredExperimentalServicesV2,
1655
+ projectSettings,
1656
+ output
1657
+ )
1658
+ );
1659
+ }
1447
1660
  const detectedBuilders = await span.child("vc.detectBuilders").trace(
1448
1661
  () => (0, import_detect_builders_with_services.detectBuildersWithServices)(files, pkg, {
1449
1662
  ...localConfig,
1450
1663
  services: void 0,
1451
- experimentalServicesV2: configuredExperimentalServicesV2,
1664
+ experimentalServicesV2: servicesForDetection,
1452
1665
  projectSettings,
1453
1666
  ignoreBuildScript: true,
1454
1667
  featHandleMiss: true,
@@ -1468,14 +1681,14 @@ var require_do_build = __commonJS({
1468
1681
  }
1469
1682
  detectedResolvedServices = detectedBuilders.services;
1470
1683
  servicesToRecord = detectedResolvedServices;
1471
- detectedServices = detectedBuilders.services?.filter(import_build_utils2.isExperimentalService);
1684
+ detectedServices = detectedBuilders.services?.filter(import_build_utils3.isExperimentalService);
1472
1685
  const autoDetectedV2Config = detectedBuilders.experimentalServicesV2;
1473
1686
  if (!hasExperimentalServicesV2ConfiguredInVercelConfig && autoDetectedV2Config) {
1474
1687
  nestExperimentalServicesV2Output = true;
1475
1688
  detectedExperimentalServicesV2Config = autoDetectedV2Config;
1476
1689
  }
1477
1690
  if (detectedBuilders.useImplicitEnvInjection && detectedServices && detectedServices.length > 0) {
1478
- const serviceUrlEnvVars = (0, import_build_utils2.getExperimentalServiceUrlEnvVars)({
1691
+ const serviceUrlEnvVars = (0, import_build_utils3.getExperimentalServiceUrlEnvVars)({
1479
1692
  services: detectedServices,
1480
1693
  frameworkList: import_frameworks.frameworkList,
1481
1694
  currentEnv: process.env,
@@ -1533,7 +1746,7 @@ var require_do_build = __commonJS({
1533
1746
  for (const path of files) {
1534
1747
  const fsPath = (0, import_path2.join)(workPath, path);
1535
1748
  const { mode } = await import_fs_extra2.default.stat(fsPath);
1536
- map[path] = new import_build_utils2.FileFsRef({ mode, fsPath });
1749
+ map[path] = new import_build_utils3.FileFsRef({ mode, fsPath });
1537
1750
  }
1538
1751
  s.setAttributes({ fileCount: String(files.length) });
1539
1752
  return map;
@@ -1580,7 +1793,8 @@ var require_do_build = __commonJS({
1580
1793
  };
1581
1794
  const meta = {
1582
1795
  skipDownload: true,
1583
- cliVersion
1796
+ cliVersion,
1797
+ runNpmInstallSet: /* @__PURE__ */ new Set()
1584
1798
  };
1585
1799
  const executedBuilds = [];
1586
1800
  const buildResults = /* @__PURE__ */ new Map();
@@ -1608,6 +1822,7 @@ var require_do_build = __commonJS({
1608
1822
  }
1609
1823
  }
1610
1824
  const preDeployEntries = [];
1825
+ const liveRunners = /* @__PURE__ */ new Set();
1611
1826
  const runBuilders = async (buildsToRun) => {
1612
1827
  await addBuildsToBuildJson(buildsToRun);
1613
1828
  for (const build of (0, import_execute_builder.sortBuildsForExecution)(buildsToRun)) {
@@ -1620,8 +1835,8 @@ var require_do_build = __commonJS({
1620
1835
  try {
1621
1836
  const { builder, pkg: builderPkg } = builderWithPkg;
1622
1837
  const service = getHasDetectedServices() ? serviceByBuilder.get(build) : void 0;
1623
- const legacyExperimentalService = service && (0, import_build_utils2.isExperimentalService)(service) ? service : void 0;
1624
- const serviceWorkspace = service ? (0, import_build_utils2.isExperimentalService)(service) ? service.workspace : service.root : void 0;
1838
+ const legacyExperimentalService = service && (0, import_build_utils3.isExperimentalService)(service) ? service : void 0;
1839
+ const serviceWorkspace = service ? (0, import_build_utils3.isExperimentalService)(service) ? service.workspace : service.root : void 0;
1625
1840
  const stripServiceRoutePrefix = !!legacyExperimentalService?.routePrefix && legacyExperimentalService.routePrefix !== "/";
1626
1841
  let buildWorkPath = workPath;
1627
1842
  let buildEntrypoint = build.src;
@@ -1675,7 +1890,7 @@ var require_do_build = __commonJS({
1675
1890
  // `service.functions` isn't on `build.config`, so builders that
1676
1891
  // read `config.functions` (e.g. Next.js) would otherwise miss it;
1677
1892
  // `serviceName` scopes the derived v2beta consumer.
1678
- ...(0, import_build_utils2.isExperimentalServiceV2)(service) && service.functions ? { functions: service.functions, serviceName: service.name } : void 0,
1893
+ ...(0, import_build_utils3.isExperimentalServiceV2)(service) && service.functions ? { functions: service.functions, serviceName: service.name } : void 0,
1679
1894
  // Override project-level settings with service-specific ones.
1680
1895
  // The project-level framework is "services" which must NOT be
1681
1896
  // propagated to individual builders.
@@ -1756,7 +1971,7 @@ var require_do_build = __commonJS({
1756
1971
  );
1757
1972
  const restoreEnv = /* @__PURE__ */ new Map();
1758
1973
  if (detectedServices && legacyExperimentalService?.env) {
1759
- const perServiceEnv = (0, import_build_utils2.getServiceUrlEnvVars)({
1974
+ const perServiceEnv = (0, import_build_utils3.getServiceUrlEnvVars)({
1760
1975
  requestedEnv: legacyExperimentalService.env,
1761
1976
  consumerService: legacyExperimentalService,
1762
1977
  services: detectedServices,
@@ -1777,6 +1992,21 @@ var require_do_build = __commonJS({
1777
1992
  }
1778
1993
  let buildResult;
1779
1994
  let rawBuildResult;
1995
+ const runnerContext = {
1996
+ requirePath: builderWithPkg.path,
1997
+ buildOptions,
1998
+ cwd: buildWorkPath,
1999
+ expectsPreDeploy: Boolean(preDeployCmd),
2000
+ builderSpan
2001
+ };
2002
+ const runner = createBuildRunner2?.({
2003
+ ctx: runnerContext,
2004
+ builder,
2005
+ hasDetectedServices: getHasDetectedServices(),
2006
+ builderPath: builderWithPkg.path,
2007
+ hasBuildCallback: Boolean(buildOptions.buildCallback)
2008
+ }) ?? new import_build_runner2.InprocessBuildRunner(runnerContext, builder);
2009
+ liveRunners.add(runner);
1780
2010
  try {
1781
2011
  ({ buildResult, rawBuildResult } = await (0, import_execute_builder.executeBuilder)({
1782
2012
  builder,
@@ -1786,7 +2016,8 @@ var require_do_build = __commonJS({
1786
2016
  hasDetectedServices: getHasDetectedServices(),
1787
2017
  framework: import_frameworks.frameworkList.find(
1788
2018
  (framework2) => framework2.slug === buildConfig.framework
1789
- )
2019
+ ),
2020
+ runner
1790
2021
  }));
1791
2022
  } finally {
1792
2023
  for (const [key, prior] of restoreEnv) {
@@ -1797,9 +2028,7 @@ var require_do_build = __commonJS({
1797
2028
  }
1798
2029
  }
1799
2030
  try {
1800
- const builderDiagnostics = await builderSpan.child("vc.builder.diagnostics").trace(async () => {
1801
- return await builder.diagnostics?.(buildOptions);
1802
- });
2031
+ const builderDiagnostics = await runner.diagnostics();
1803
2032
  if (builderDiagnostics) {
1804
2033
  const prefix = service && serviceWorkspace && serviceWorkspace !== "." ? serviceWorkspace + "/" + builderPkg.name + "/" : "";
1805
2034
  for (const [key, value] of Object.entries(builderDiagnostics)) {
@@ -1854,15 +2083,15 @@ var require_do_build = __commonJS({
1854
2083
  }
1855
2084
  if (buildResult && "output" in buildResult && "runtime" in buildResult.output && "type" in buildResult.output && buildResult.output.type === "Lambda") {
1856
2085
  const lambdaRuntime = buildResult.output.runtime;
1857
- if ((0, import_build_utils2.getDiscontinuedNodeVersions)().some((o) => o.runtime === lambdaRuntime)) {
1858
- throw new import_build_utils2.NowBuildError({
2086
+ if ((0, import_build_utils3.getDiscontinuedNodeVersions)().some((o) => o.runtime === lambdaRuntime)) {
2087
+ throw new import_build_utils3.NowBuildError({
1859
2088
  code: "NODEJS_DISCONTINUED_VERSION",
1860
2089
  message: `The Runtime "${build.use}" is using "${lambdaRuntime}", which is discontinued. Please upgrade your Runtime to a more recent version or consult the author for more details.`,
1861
2090
  link: "https://vercel.link/function-runtimes"
1862
2091
  });
1863
2092
  }
1864
2093
  }
1865
- if ("output" in buildResult && buildResult.output && ((0, import_build_utils2.isBackendBuilder)(build) || build.use === "@vercel/python")) {
2094
+ if ("output" in buildResult && buildResult.output && ((0, import_build_utils3.isBackendBuilder)(build) || build.use === "@vercel/python")) {
1866
2095
  const routesJsonPath = (0, import_path2.join)(buildWorkPath, ".vercel", "routes.json");
1867
2096
  if ((0, import_fs_extra2.existsSync)(routesJsonPath)) {
1868
2097
  try {
@@ -1912,13 +2141,13 @@ var require_do_build = __commonJS({
1912
2141
  allServices: detectedServices
1913
2142
  });
1914
2143
  }
1915
- if (legacyExperimentalService && (0, import_build_utils2.isQueueBackedService)(legacyExperimentalService) && "output" in buildResult) {
2144
+ if (legacyExperimentalService && (0, import_build_utils3.isQueueBackedService)(legacyExperimentalService) && "output" in buildResult) {
1916
2145
  attachQueueServiceTrigger(
1917
2146
  buildResult.output,
1918
2147
  legacyExperimentalService
1919
2148
  );
1920
2149
  }
1921
- if (legacyExperimentalService && (0, import_build_utils2.isScheduleTriggeredService)(legacyExperimentalService) && !("crons" in buildResult && buildResult.crons?.length)) {
2150
+ if (legacyExperimentalService && (0, import_build_utils3.isScheduleTriggeredService)(legacyExperimentalService) && !("crons" in buildResult && buildResult.crons?.length)) {
1922
2151
  const staticSchedules = (0, import_service_schedules.getStaticServiceSchedules)(
1923
2152
  legacyExperimentalService.schedule
1924
2153
  );
@@ -1926,7 +2155,7 @@ var require_do_build = __commonJS({
1926
2155
  const cronEntrypoint = legacyExperimentalService.entrypoint || legacyExperimentalService.builder.src || "index";
1927
2156
  for (const schedule of staticSchedules) {
1928
2157
  synthesizedServiceCrons.push({
1929
- path: (0, import_build_utils2.getInternalServiceCronPath)(
2158
+ path: (0, import_build_utils3.getInternalServiceCronPath)(
1930
2159
  legacyExperimentalService.name,
1931
2160
  cronEntrypoint,
1932
2161
  legacyExperimentalService.handlerFunction || "cron"
@@ -1935,7 +2164,7 @@ var require_do_build = __commonJS({
1935
2164
  });
1936
2165
  }
1937
2166
  } else {
1938
- throw new import_build_utils2.NowBuildError({
2167
+ throw new import_build_utils3.NowBuildError({
1939
2168
  code: "CRON_SERVICE_NO_CRONS",
1940
2169
  message: `Scheduled service "${legacyExperimentalService.name}" did not produce any cron entries. The builder "${builderPkg.name}" may not support scheduled services.`
1941
2170
  });
@@ -2042,7 +2271,7 @@ var require_do_build = __commonJS({
2042
2271
  throw err;
2043
2272
  } finally {
2044
2273
  ops.push(
2045
- (0, import_build_utils2.download)(diagnostics, (0, import_path2.join)(outputDir, "diagnostics")).then(
2274
+ (0, import_build_utils3.download)(diagnostics, (0, import_path2.join)(outputDir, "diagnostics")).then(
2046
2275
  () => void 0,
2047
2276
  (err) => err
2048
2277
  )
@@ -2058,7 +2287,7 @@ var require_do_build = __commonJS({
2058
2287
  }
2059
2288
  }
2060
2289
  };
2061
- const normalizeBuilderSrc = (src) => typeof src === "string" ? (0, import_build_utils2.normalizePath)(src).replace(/^\.\//, "") : void 0;
2290
+ const normalizeBuilderSrc = (src) => typeof src === "string" ? (0, import_build_utils3.normalizePath)(src).replace(/^\.\//, "") : void 0;
2062
2291
  const getBuilderIdentity = (build) => {
2063
2292
  const normalizedSrc = normalizeBuilderSrc(build.src);
2064
2293
  return normalizedSrc ? `${build.use}:${normalizedSrc}` : void 0;
@@ -2095,123 +2324,135 @@ var require_do_build = __commonJS({
2095
2324
  zeroConfigFallbackRoutes.push(...serviceRoutes.fallbacks);
2096
2325
  }
2097
2326
  };
2098
- await runBuilders(builds);
2099
- await flushOps();
2100
- if (!hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig) {
2101
- const generatedConfigPath = (0, import_path2.join)(outputDir, "config.json");
2102
- const generatedConfig = await readJSONFile2(generatedConfigPath);
2103
- if (isCantParseJSONFile(generatedConfig)) {
2104
- throw generatedConfig;
2105
- }
2106
- const defaultGeneratedOutputDir = (0, import_path2.join)(workPath, import_write_build_result3.OUTPUT_DIR);
2107
- const generatedConfigs = [generatedConfig];
2108
- if ((0, import_path2.resolve)(outputDir) !== (0, import_path2.resolve)(defaultGeneratedOutputDir)) {
2109
- const defaultGeneratedConfig = await readJSONFile2(
2110
- (0, import_path2.join)(defaultGeneratedOutputDir, "config.json")
2111
- );
2112
- if (isCantParseJSONFile(defaultGeneratedConfig)) {
2113
- throw defaultGeneratedConfig;
2114
- }
2115
- generatedConfigs.push(defaultGeneratedConfig);
2116
- }
2117
- const generatedServicesConfig = getGeneratedServicesConfig([
2118
- ...generatedConfigs,
2119
- ...buildResults.values()
2120
- ]);
2121
- const generatedExperimentalServicesV1Config = getGeneratedExperimentalServicesV1Config([
2122
- ...generatedConfigs,
2123
- ...buildResults.values()
2124
- ]);
2125
- if (generatedServicesConfig || generatedExperimentalServicesV1Config) {
2126
- if (generatedServicesConfig) {
2127
- nestExperimentalServicesV2Output = true;
2128
- }
2129
- detectedExperimentalServicesV1Config = generatedExperimentalServicesV1Config;
2130
- detectedExperimentalServicesV2Config = generatedServicesConfig;
2131
- detectedExperimentalServicesV2RootRoutes = generatedServicesConfig ? generatedConfigs.find(
2132
- (config2) => (hasGeneratedServicesConfig(config2) || hasNonEmptyObject(config2?.experimentalServicesV2)) && Array.isArray(config2?.routes)
2133
- )?.routes : void 0;
2134
- const generatedBuilders = await span.child("vc.detectGeneratedServices").trace(
2135
- () => (0, import_detect_builders_with_services.detectBuildersWithServices)(files, pkg, {
2136
- ...localConfig,
2137
- ...generatedServicesConfig ? {
2138
- services: generatedServicesConfig,
2139
- experimentalServicesV2: void 0
2140
- } : {
2141
- experimentalServicesV2: void 0,
2142
- experimentalServices: generatedExperimentalServicesV1Config
2143
- },
2144
- projectSettings,
2145
- ignoreBuildScript: true,
2146
- featHandleMiss: true,
2147
- workPath
2148
- })
2149
- );
2150
- if (generatedBuilders.errors && generatedBuilders.errors.length > 0) {
2151
- throw generatedBuilders.errors[0];
2152
- }
2153
- for (const w of generatedBuilders.warnings) {
2154
- output.warn(w.message, null, w.link, w.action || "Learn More");
2327
+ try {
2328
+ await runBuilders(builds);
2329
+ await flushOps();
2330
+ if (!hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig) {
2331
+ const generatedConfigPath = (0, import_path2.join)(outputDir, "config.json");
2332
+ const generatedConfig = await readJSONFile2(generatedConfigPath);
2333
+ if (isCantParseJSONFile(generatedConfig)) {
2334
+ throw generatedConfig;
2155
2335
  }
2156
- detectedResolvedServices = generatedBuilders.services;
2157
- if (!detectedResolvedServices || detectedResolvedServices.length === 0) {
2158
- detectedResolvedServices = void 0;
2159
- detectedServices = void 0;
2160
- } else {
2161
- detectedServices = detectedResolvedServices.filter(
2162
- import_build_utils2.isExperimentalService
2336
+ const defaultGeneratedOutputDir = (0, import_path2.join)(workPath, import_write_build_result3.OUTPUT_DIR);
2337
+ const generatedConfigs = [generatedConfig];
2338
+ if ((0, import_path2.resolve)(outputDir) !== (0, import_path2.resolve)(defaultGeneratedOutputDir)) {
2339
+ const defaultGeneratedConfig = await readJSONFile2(
2340
+ (0, import_path2.join)(defaultGeneratedOutputDir, "config.json")
2163
2341
  );
2164
- if (detectedServices.length > 0) {
2165
- appendExperimentalServicesV1Routes(detectedServices);
2342
+ if (isCantParseJSONFile(defaultGeneratedConfig)) {
2343
+ throw defaultGeneratedConfig;
2166
2344
  }
2345
+ generatedConfigs.push(defaultGeneratedConfig);
2167
2346
  }
2168
- if (detectedServices && detectedServices.length > 0 && generatedBuilders.useImplicitEnvInjection) {
2169
- const serviceUrlEnvVars = (0, import_build_utils2.getExperimentalServiceUrlEnvVars)({
2170
- services: detectedServices,
2171
- frameworkList: import_frameworks.frameworkList,
2172
- currentEnv: process.env,
2173
- deploymentUrl: process.env.VERCEL_URL
2174
- });
2175
- for (const [key, value] of Object.entries(serviceUrlEnvVars)) {
2176
- process.env[key] = value;
2177
- output.debug(`Injected service URL env var: ${key}=${value}`);
2347
+ const generatedServicesConfig = getGeneratedServicesConfig([
2348
+ ...generatedConfigs,
2349
+ ...buildResults.values()
2350
+ ]);
2351
+ const generatedExperimentalServicesV1Config = getGeneratedExperimentalServicesV1Config([
2352
+ ...generatedConfigs,
2353
+ ...buildResults.values()
2354
+ ]);
2355
+ if (generatedServicesConfig || generatedExperimentalServicesV1Config) {
2356
+ if (generatedServicesConfig) {
2357
+ nestExperimentalServicesV2Output = true;
2178
2358
  }
2179
- }
2180
- const buildsToRun = [];
2181
- const seenBuildsToRun = /* @__PURE__ */ new Set();
2182
- const recordedServices = [];
2183
- for (const service of detectedResolvedServices || []) {
2184
- const alreadyExecutedBuild = getAlreadyExecutedBuild(service.builder);
2185
- if (alreadyExecutedBuild) {
2186
- if (generatedServicesConfig) {
2187
- output.warn(getGeneratedServiceAlreadyBuiltWarning(service));
2359
+ detectedExperimentalServicesV1Config = generatedExperimentalServicesV1Config;
2360
+ detectedExperimentalServicesV2Config = generatedServicesConfig;
2361
+ detectedExperimentalServicesV2RootRoutes = generatedServicesConfig ? generatedConfigs.find(
2362
+ (config2) => (hasGeneratedServicesConfig(config2) || hasNonEmptyObject(config2?.experimentalServicesV2)) && Array.isArray(config2?.routes)
2363
+ )?.routes : void 0;
2364
+ const generatedBuilders = await span.child("vc.detectGeneratedServices").trace(
2365
+ () => (0, import_detect_builders_with_services.detectBuildersWithServices)(files, pkg, {
2366
+ ...localConfig,
2367
+ ...generatedServicesConfig ? {
2368
+ services: generatedServicesConfig,
2369
+ experimentalServicesV2: void 0
2370
+ } : {
2371
+ experimentalServicesV2: void 0,
2372
+ experimentalServices: generatedExperimentalServicesV1Config
2373
+ },
2374
+ projectSettings,
2375
+ ignoreBuildScript: true,
2376
+ featHandleMiss: true,
2377
+ workPath
2378
+ })
2379
+ );
2380
+ if (generatedBuilders.errors && generatedBuilders.errors.length > 0) {
2381
+ throw generatedBuilders.errors[0];
2382
+ }
2383
+ for (const w of generatedBuilders.warnings) {
2384
+ output.warn(w.message, null, w.link, w.action || "Learn More");
2385
+ }
2386
+ detectedResolvedServices = generatedBuilders.services;
2387
+ if (!detectedResolvedServices || detectedResolvedServices.length === 0) {
2388
+ detectedResolvedServices = void 0;
2389
+ detectedServices = void 0;
2390
+ } else {
2391
+ detectedServices = detectedResolvedServices.filter(
2392
+ import_build_utils3.isExperimentalService
2393
+ );
2394
+ if (detectedServices.length > 0) {
2395
+ appendExperimentalServicesV1Routes(detectedServices);
2396
+ }
2397
+ }
2398
+ if (detectedServices && detectedServices.length > 0 && generatedBuilders.useImplicitEnvInjection) {
2399
+ const serviceUrlEnvVars = (0, import_build_utils3.getExperimentalServiceUrlEnvVars)({
2400
+ services: detectedServices,
2401
+ frameworkList: import_frameworks.frameworkList,
2402
+ currentEnv: process.env,
2403
+ deploymentUrl: process.env.VERCEL_URL
2404
+ });
2405
+ for (const [key, value] of Object.entries(serviceUrlEnvVars)) {
2406
+ process.env[key] = value;
2407
+ output.debug(`Injected service URL env var: ${key}=${value}`);
2408
+ }
2409
+ }
2410
+ const buildsToRun = [];
2411
+ const seenBuildsToRun = /* @__PURE__ */ new Set();
2412
+ const recordedServices = [];
2413
+ for (const service of detectedResolvedServices || []) {
2414
+ const alreadyExecutedBuild = getAlreadyExecutedBuild(service.builder);
2415
+ if (alreadyExecutedBuild) {
2416
+ if (generatedServicesConfig) {
2417
+ output.warn(getGeneratedServiceAlreadyBuiltWarning(service));
2418
+ continue;
2419
+ }
2420
+ serviceByBuilder.set(alreadyExecutedBuild, service);
2421
+ recordedServices.push(service);
2188
2422
  continue;
2189
2423
  }
2190
- serviceByBuilder.set(alreadyExecutedBuild, service);
2424
+ const serviceBuilderIdentity = getBuilderIdentity(service.builder);
2425
+ if (serviceBuilderIdentity && !seenBuildsToRun.has(serviceBuilderIdentity)) {
2426
+ serviceByBuilder.set(service.builder, service);
2427
+ seenBuildsToRun.add(serviceBuilderIdentity);
2428
+ buildsToRun.push(service.builder);
2429
+ }
2191
2430
  recordedServices.push(service);
2192
- continue;
2193
2431
  }
2194
- const serviceBuilderIdentity = getBuilderIdentity(service.builder);
2195
- if (serviceBuilderIdentity && !seenBuildsToRun.has(serviceBuilderIdentity)) {
2196
- serviceByBuilder.set(service.builder, service);
2197
- seenBuildsToRun.add(serviceBuilderIdentity);
2198
- buildsToRun.push(service.builder);
2432
+ servicesToRecord = recordedServices.length > 0 ? recordedServices : void 0;
2433
+ if (buildsToRun.length > 0) {
2434
+ await runBuilders(buildsToRun);
2199
2435
  }
2200
- recordedServices.push(service);
2201
2436
  }
2202
- servicesToRecord = recordedServices.length > 0 ? recordedServices : void 0;
2203
- if (buildsToRun.length > 0) {
2204
- await runBuilders(buildsToRun);
2437
+ }
2438
+ for (const entry of preDeployEntries) {
2439
+ if (entry.callback) {
2440
+ await entry.callback();
2441
+ } else {
2442
+ output.warn(
2443
+ `Service "${entry.service}" has a preDeployCommand but its builder does not support it. The command was not executed.`
2444
+ );
2205
2445
  }
2206
2446
  }
2207
- }
2208
- for (const entry of preDeployEntries) {
2209
- if (entry.callback) {
2210
- await entry.callback();
2211
- } else {
2212
- output.warn(
2213
- `Service "${entry.service}" has a preDeployCommand but its builder does not support it. The command was not executed.`
2214
- );
2447
+ } finally {
2448
+ for (const runner of liveRunners) {
2449
+ try {
2450
+ runner.teardown();
2451
+ } catch (err) {
2452
+ output.debug(
2453
+ `Runner teardown failed: ${err instanceof Error ? err.message : String(err)}`
2454
+ );
2455
+ }
2215
2456
  }
2216
2457
  }
2217
2458
  await (0, import_manifest.writeManifests)(packageManifests, diagnostics, ops, outputDir);
@@ -2221,7 +2462,7 @@ var require_do_build = __commonJS({
2221
2462
  const collectSpan = span.child("vc.finalizeBuildOutput");
2222
2463
  await flushOps();
2223
2464
  let needBuildsJsonOverride = false;
2224
- const speedInsightsVersion = await (0, import_build_utils2.getInstalledPackageVersion)(
2465
+ const speedInsightsVersion = await (0, import_build_utils3.getInstalledPackageVersion)(
2225
2466
  "@vercel/speed-insights"
2226
2467
  );
2227
2468
  if (speedInsightsVersion) {
@@ -2231,7 +2472,7 @@ var require_do_build = __commonJS({
2231
2472
  };
2232
2473
  needBuildsJsonOverride = true;
2233
2474
  }
2234
- const webAnalyticsVersion = await (0, import_build_utils2.getInstalledPackageVersion)("@vercel/analytics");
2475
+ const webAnalyticsVersion = await (0, import_build_utils3.getInstalledPackageVersion)("@vercel/analytics");
2235
2476
  if (webAnalyticsVersion) {
2236
2477
  buildsJson.features = {
2237
2478
  ...buildsJson.features ?? {},
@@ -2251,14 +2492,14 @@ var require_do_build = __commonJS({
2251
2492
  if ("deploymentId" in existingConfig && typeof existingConfig.deploymentId === "string") {
2252
2493
  const deploymentId = existingConfig.deploymentId;
2253
2494
  if (deploymentId.length > 32) {
2254
- throw new import_build_utils2.NowBuildError({
2495
+ throw new import_build_utils3.NowBuildError({
2255
2496
  code: "INVALID_DEPLOYMENT_ID",
2256
2497
  message: `The deploymentId "${deploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
2257
2498
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
2258
2499
  });
2259
2500
  }
2260
2501
  if (!VALID_DEPLOYMENT_ID_PATTERN.test(deploymentId)) {
2261
- throw new import_build_utils2.NowBuildError({
2502
+ throw new import_build_utils3.NowBuildError({
2262
2503
  code: "INVALID_DEPLOYMENT_ID",
2263
2504
  message: `The deploymentId "${deploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
2264
2505
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
@@ -2282,7 +2523,7 @@ var require_do_build = __commonJS({
2282
2523
  let entrypoint = build.src;
2283
2524
  if (getHasDetectedServices() && typeof build.src === "string") {
2284
2525
  const service = serviceByBuilder.get(build);
2285
- if (service && (0, import_build_utils2.isExperimentalService)(service) && service.type === "web" && typeof service.routePrefix === "string") {
2526
+ if (service && (0, import_build_utils3.isExperimentalService)(service) && service.type === "web" && typeof service.routePrefix === "string") {
2286
2527
  entrypoint = getServicesMergeEntrypoint(service, build.src);
2287
2528
  }
2288
2529
  }
@@ -2328,14 +2569,14 @@ var require_do_build = __commonJS({
2328
2569
  );
2329
2570
  if (mergedDeploymentId) {
2330
2571
  if (mergedDeploymentId.length > 32) {
2331
- throw new import_build_utils2.NowBuildError({
2572
+ throw new import_build_utils3.NowBuildError({
2332
2573
  code: "INVALID_DEPLOYMENT_ID",
2333
2574
  message: `The deploymentId "${mergedDeploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
2334
2575
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
2335
2576
  });
2336
2577
  }
2337
2578
  if (!VALID_DEPLOYMENT_ID_PATTERN.test(mergedDeploymentId)) {
2338
- throw new import_build_utils2.NowBuildError({
2579
+ throw new import_build_utils3.NowBuildError({
2339
2580
  code: "INVALID_DEPLOYMENT_ID",
2340
2581
  message: `The deploymentId "${mergedDeploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
2341
2582
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
@@ -2452,7 +2693,7 @@ var require_do_build = __commonJS({
2452
2693
  }
2453
2694
  function expandBuild(files, build) {
2454
2695
  if (!build.use) {
2455
- throw new import_build_utils2.NowBuildError({
2696
+ throw new import_build_utils3.NowBuildError({
2456
2697
  code: `invalid_build_specification`,
2457
2698
  message: "Field `use` is missing in build specification",
2458
2699
  link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
@@ -2461,7 +2702,7 @@ var require_do_build = __commonJS({
2461
2702
  }
2462
2703
  let src = (0, import_path2.normalize)(build.src || "**").split(import_path2.sep).join("/");
2463
2704
  if (src === "." || src === "./") {
2464
- throw new import_build_utils2.NowBuildError({
2705
+ throw new import_build_utils3.NowBuildError({
2465
2706
  code: `invalid_build_specification`,
2466
2707
  message: "A build `src` path resolves to an empty string",
2467
2708
  link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
@@ -2751,9 +2992,9 @@ var require_do_build = __commonJS({
2751
2992
  return `svc:${sortKey}:${normalized}:${service.name}:${buildSrc}`;
2752
2993
  }
2753
2994
  function attachQueueServiceTrigger(buildOutput, service) {
2754
- const topics = (0, import_build_utils2.getServiceQueueTopicConfigs)(service);
2755
- const consumer = (0, import_build_utils2.sanitizeConsumerName)(
2756
- (0, import_build_utils2.getInternalServiceFunctionPath)(service.name)
2995
+ const topics = (0, import_build_utils3.getServiceQueueTopicConfigs)(service);
2996
+ const consumer = (0, import_build_utils3.sanitizeConsumerName)(
2997
+ (0, import_build_utils3.getInternalServiceFunctionPath)(service.name)
2757
2998
  );
2758
2999
  if (service.builder.use !== "@vercel/python" && topics.length > 1) {
2759
3000
  throw new Error(
@@ -2832,11 +3073,14 @@ var require_dist5 = __commonJS({
2832
3073
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2833
3074
  var src_exports = {};
2834
3075
  __export(src_exports, {
3076
+ BuildRunner: () => import_build_runner2.BuildRunner,
3077
+ InprocessBuildRunner: () => import_build_runner2.InprocessBuildRunner,
2835
3078
  doBuild: () => import_do_build.doBuild,
2836
3079
  executeBuilder: () => import_execute_builder.executeBuilder,
2837
3080
  sortBuildsForExecution: () => import_execute_builder.sortBuildsForExecution
2838
3081
  });
2839
3082
  module.exports = __toCommonJS(src_exports);
3083
+ var import_build_runner2 = require_build_runner();
2840
3084
  var import_execute_builder = require_execute_builder();
2841
3085
  var import_do_build = require_do_build();
2842
3086
  }
@@ -2846,7 +3090,7 @@ var require_dist5 = __commonJS({
2846
3090
  var import_chalk = __toESM(require_source(), 1);
2847
3091
  var import_dotenv = __toESM(require_main(), 1);
2848
3092
  var import_fs_extra = __toESM(require_lib(), 1);
2849
- import { dirname as dirname2, join as join2, relative as relative2, resolve } from "path";
3093
+ import { dirname as dirname2, join as join3, relative as relative2, resolve } from "path";
2850
3094
  import { readdirSync, statSync } from "fs";
2851
3095
  import {
2852
3096
  normalizePath,
@@ -2858,6 +3102,311 @@ import {
2858
3102
  } from "@vercel/build-utils";
2859
3103
  var import_cli_builder_integration = __toESM(require_dist5(), 1);
2860
3104
 
3105
+ // src/util/build/builder-process.ts
3106
+ var import_build_runner = __toESM(require_build_runner(), 1);
3107
+ import { fork } from "child_process";
3108
+ import { readFileSync, unlinkSync } from "fs";
3109
+ import { join } from "path";
3110
+ import {
3111
+ Lambda,
3112
+ FileBlob,
3113
+ FileFsRef,
3114
+ FileRef
3115
+ } from "@vercel/build-utils";
3116
+ function toError(error) {
3117
+ if (error instanceof Error)
3118
+ return error;
3119
+ return Object.assign(new Error(), error);
3120
+ }
3121
+ function canBuildInSubprocess({
3122
+ hasDetectedServices,
3123
+ builderPath,
3124
+ hasBuildCallback
3125
+ }) {
3126
+ return hasDetectedServices && Boolean(builderPath) && !hasBuildCallback;
3127
+ }
3128
+ function rehydrateFile(obj) {
3129
+ if (obj.type === "FileBlob") {
3130
+ const blob = Object.assign(
3131
+ Object.create(FileBlob.prototype),
3132
+ obj
3133
+ );
3134
+ if (obj.dataPath) {
3135
+ blob.data = readFileSync(obj.dataPath);
3136
+ try {
3137
+ unlinkSync(obj.dataPath);
3138
+ } catch {
3139
+ }
3140
+ delete blob.dataPath;
3141
+ }
3142
+ return blob;
3143
+ }
3144
+ if (obj.type === "FileRef") {
3145
+ return Object.assign(Object.create(FileRef.prototype), obj);
3146
+ }
3147
+ return Object.assign(Object.create(FileFsRef.prototype), obj);
3148
+ }
3149
+ function rehydrateFiles(files) {
3150
+ if (!files)
3151
+ return;
3152
+ for (const name of Object.keys(files)) {
3153
+ files[name] = rehydrateFile(files[name]);
3154
+ }
3155
+ }
3156
+ function rehydrateDiagnostics(diagnostics) {
3157
+ const result = {};
3158
+ for (const [name, file] of Object.entries(diagnostics)) {
3159
+ result[name] = rehydrateFile(file);
3160
+ }
3161
+ return result;
3162
+ }
3163
+ function rehydrateOutput(output, seen) {
3164
+ if (!output || typeof output !== "object" || seen.has(output))
3165
+ return;
3166
+ seen.add(output);
3167
+ const obj = output;
3168
+ if (obj.type === "Lambda") {
3169
+ rehydrateFiles(obj.files);
3170
+ Object.setPrototypeOf(obj, Lambda.prototype);
3171
+ } else if (obj.type === "EdgeFunction") {
3172
+ rehydrateFiles(obj.files);
3173
+ } else if (obj.type === "Prerender") {
3174
+ if (obj.lambda)
3175
+ rehydrateOutput(obj.lambda, seen);
3176
+ if (obj.fallback)
3177
+ rehydrateOutput(obj.fallback, seen);
3178
+ } else if (obj.type === "FileFsRef" || obj.type === "FileBlob" || obj.type === "FileRef") {
3179
+ const rehydrated = rehydrateFile(obj);
3180
+ Object.assign(obj, rehydrated);
3181
+ Object.setPrototypeOf(obj, Object.getPrototypeOf(rehydrated));
3182
+ }
3183
+ }
3184
+ function rehydrateResult(result, outputVersion) {
3185
+ const unwrapped = result && "resultVersion" in result ? result.result : result;
3186
+ const output = unwrapped.output;
3187
+ if (!output)
3188
+ return;
3189
+ const seen = /* @__PURE__ */ new Set();
3190
+ if (outputVersion === 3) {
3191
+ rehydrateOutput(output, seen);
3192
+ } else {
3193
+ for (const value of Object.values(output)) {
3194
+ rehydrateOutput(value, seen);
3195
+ }
3196
+ }
3197
+ }
3198
+ var SubprocessBuildRunner = class extends import_build_runner.BuildRunner {
3199
+ /**
3200
+ * Fork a worker, run one build, and return the deserialized result. `buildOptions.span` is
3201
+ * dropped (a class instance that can't be serialized); the caller keeps its own tracing.
3202
+ *
3203
+ * The child inherits stdout/stderr so its build output reaches the terminal directly, matching
3204
+ * the previous in-process behavior. When the build registers a pre-deploy command, the worker
3205
+ * is kept alive: its `registerPreDeploy` callback runs the command in the worker later, when the
3206
+ * command invokes the deferred callback. Teardown is owned by the caller (via `teardown()`), so
3207
+ * a kept-alive worker is released even if that deferred callback is never reached.
3208
+ */
3209
+ async build() {
3210
+ const workerPath = join(__dirname, "builder-worker.cjs");
3211
+ const child = fork(workerPath, [], {
3212
+ cwd: this.ctx.cwd,
3213
+ execArgv: [],
3214
+ env: process.env,
3215
+ // V8 structured clone (not the default JSON) so the build result rides across with its
3216
+ // Buffers, cycles (e.g. `@vercel/next`'s `childProcesses`), and shared object identity
3217
+ // (one Lambda referenced by many outputs stays one instance) intact.
3218
+ serialization: "advanced"
3219
+ });
3220
+ this.child = child;
3221
+ await new Promise((resolve2, reject) => {
3222
+ function onMessage(data) {
3223
+ cleanup();
3224
+ if (data !== null && typeof data === "object" && data.type !== "ready") {
3225
+ reject(new Error('Did not get "ready" event from builder'));
3226
+ } else {
3227
+ resolve2();
3228
+ }
3229
+ }
3230
+ function onError(err) {
3231
+ cleanup();
3232
+ reject(err);
3233
+ }
3234
+ function onExit(code, signal) {
3235
+ cleanup();
3236
+ reject(
3237
+ new Error(
3238
+ `Builder exited with ${signal || code} before sending ready event`
3239
+ )
3240
+ );
3241
+ }
3242
+ function cleanup() {
3243
+ child.removeListener("message", onMessage);
3244
+ child.removeListener("error", onError);
3245
+ child.removeListener("close", onExit);
3246
+ }
3247
+ child.on("message", onMessage);
3248
+ child.on("error", onError);
3249
+ child.on("close", onExit);
3250
+ });
3251
+ try {
3252
+ const message = await this._runBuild();
3253
+ const buildResult = message.result;
3254
+ rehydrateResult(buildResult, message.outputVersion);
3255
+ if (this.ctx.buildOptions.meta && message.meta) {
3256
+ Object.assign(this.ctx.buildOptions.meta, message.meta);
3257
+ }
3258
+ if (message.hasPreDeploy) {
3259
+ child.on("close", (code, signal) => {
3260
+ this.childExit ??= { code, signal };
3261
+ });
3262
+ child.on("error", () => {
3263
+ this.childExit ??= { code: null, signal: null };
3264
+ });
3265
+ this.ctx.buildOptions.registerPreDeploy?.(
3266
+ () => this._runPreDeploy().finally(() => this.teardown())
3267
+ );
3268
+ } else {
3269
+ this.teardown();
3270
+ }
3271
+ return buildResult;
3272
+ } catch (err) {
3273
+ this.teardown();
3274
+ throw err;
3275
+ }
3276
+ }
3277
+ _runBuild() {
3278
+ const child = this.child;
3279
+ if (!child) {
3280
+ throw new Error("subprocess not initialised before build");
3281
+ }
3282
+ const {
3283
+ span: _span,
3284
+ registerPreDeploy: _registerPreDeploy,
3285
+ ...serializableBuildOptions
3286
+ } = this.ctx.buildOptions;
3287
+ const builderSpan = this.ctx.builderSpan;
3288
+ const captureDiagnostics = (msg) => {
3289
+ if (msg.diagnostics) {
3290
+ this.diagnosticsResult = rehydrateDiagnostics(msg.diagnostics);
3291
+ }
3292
+ };
3293
+ child.send({
3294
+ type: "build",
3295
+ requirePath: this.ctx.requirePath,
3296
+ buildOptions: serializableBuildOptions,
3297
+ expectsPreDeploy: Boolean(this.ctx.expectsPreDeploy)
3298
+ });
3299
+ return new Promise((resolve2, reject) => {
3300
+ function onMessage(msg) {
3301
+ cleanup();
3302
+ if (msg.type === "buildResult") {
3303
+ if (msg.traceEvents) {
3304
+ builderSpan?.reportChildEvents(msg.traceEvents);
3305
+ }
3306
+ captureDiagnostics(msg);
3307
+ if (msg.result) {
3308
+ resolve2(
3309
+ msg
3310
+ );
3311
+ } else {
3312
+ reject(toError(msg.error));
3313
+ }
3314
+ } else {
3315
+ reject(new Error(`Got unexpected message type: ${msg.type}`));
3316
+ }
3317
+ }
3318
+ function onExit(code, signal) {
3319
+ cleanup();
3320
+ reject(
3321
+ new Error(
3322
+ `Builder exited with ${signal || code} before sending build result`
3323
+ )
3324
+ );
3325
+ }
3326
+ function cleanup() {
3327
+ child.removeListener("close", onExit);
3328
+ child.removeListener("message", onMessage);
3329
+ }
3330
+ child.once("close", onExit);
3331
+ child.once("message", onMessage);
3332
+ });
3333
+ }
3334
+ _runPreDeploy() {
3335
+ const child = this.child;
3336
+ if (!child) {
3337
+ throw new Error("subprocess not initialised before predeploy");
3338
+ }
3339
+ if (this.childExit || !child.connected) {
3340
+ const { code = null, signal = null } = this.childExit ?? {};
3341
+ return Promise.reject(
3342
+ new Error(
3343
+ `Builder exited with ${signal || code} before running pre-deploy`
3344
+ )
3345
+ );
3346
+ }
3347
+ const builderSpan = this.ctx.builderSpan;
3348
+ return new Promise((resolve2, reject) => {
3349
+ function onMessage(msg) {
3350
+ if (msg.type !== "preDeployResult")
3351
+ return;
3352
+ cleanup();
3353
+ if (msg.traceEvents) {
3354
+ builderSpan?.reportChildEvents(msg.traceEvents);
3355
+ }
3356
+ if (msg.error) {
3357
+ reject(toError(msg.error));
3358
+ } else
3359
+ resolve2();
3360
+ }
3361
+ function onExit(code, signal) {
3362
+ cleanup();
3363
+ reject(
3364
+ new Error(
3365
+ `Builder exited with ${signal || code} before running pre-deploy`
3366
+ )
3367
+ );
3368
+ }
3369
+ function onError(err) {
3370
+ cleanup();
3371
+ reject(err);
3372
+ }
3373
+ function cleanup() {
3374
+ child.removeListener("close", onExit);
3375
+ child.removeListener("message", onMessage);
3376
+ child.removeListener("error", onError);
3377
+ }
3378
+ child.on("close", onExit);
3379
+ child.on("message", onMessage);
3380
+ child.on("error", onError);
3381
+ try {
3382
+ child.send({ type: "runPreDeploy" }, (err) => {
3383
+ if (err)
3384
+ onError(err);
3385
+ });
3386
+ } catch (err) {
3387
+ onError(err);
3388
+ }
3389
+ });
3390
+ }
3391
+ async diagnostics() {
3392
+ return this.diagnosticsResult;
3393
+ }
3394
+ teardown() {
3395
+ const { child } = this;
3396
+ if (!child)
3397
+ return;
3398
+ if (child.connected)
3399
+ child.disconnect();
3400
+ if (child.exitCode === null && child.signalCode === null) {
3401
+ child.kill();
3402
+ }
3403
+ output_manager_default.debug(
3404
+ `Build subprocess for "${this.ctx.buildOptions.entrypoint}" finished`
3405
+ );
3406
+ this.child = void 0;
3407
+ }
3408
+ };
3409
+
2861
3410
  // src/util/build/scrub-argv.ts
2862
3411
  function scrubArgv(argv) {
2863
3412
  const clonedArgv = [...argv];
@@ -2917,8 +3466,8 @@ var BuildTelemetryClient = class extends TelemetryClient {
2917
3466
  };
2918
3467
 
2919
3468
  // src/util/build/repo-root.ts
2920
- import { existsSync, readFileSync } from "fs";
2921
- import { dirname, join, parse, relative } from "path";
3469
+ import { existsSync, readFileSync as readFileSync2 } from "fs";
3470
+ import { dirname, join as join2, parse, relative } from "path";
2922
3471
  var import_minimatch = __toESM(require_minimatch(), 1);
2923
3472
  function findWorkspaceRootCandidates(startDir) {
2924
3473
  const { root } = parse(startDir);
@@ -2939,13 +3488,13 @@ function findWorkspaceRootCandidates(startDir) {
2939
3488
  return candidates;
2940
3489
  }
2941
3490
  function workspaceTypeOf(dir) {
2942
- if (existsSync(join(dir, "pnpm-workspace.yaml"))) {
3491
+ if (existsSync(join2(dir, "pnpm-workspace.yaml"))) {
2943
3492
  return "pnpm";
2944
3493
  }
2945
- const pkgPath = join(dir, "package.json");
3494
+ const pkgPath = join2(dir, "package.json");
2946
3495
  if (existsSync(pkgPath)) {
2947
3496
  try {
2948
- const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
3497
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf8"));
2949
3498
  const { workspaces } = pkg;
2950
3499
  if (Array.isArray(workspaces) && workspaces.length > 0 || workspaces && typeof workspaces === "object" && Array.isArray(workspaces.packages) && workspaces.packages.length > 0) {
2951
3500
  return "npm";
@@ -2959,13 +3508,13 @@ function readWorkspacePatterns(candidate) {
2959
3508
  try {
2960
3509
  if (candidate.type === "pnpm") {
2961
3510
  const doc = js_yaml_default.load(
2962
- readFileSync(join(candidate.dir, "pnpm-workspace.yaml"), "utf8")
3511
+ readFileSync2(join2(candidate.dir, "pnpm-workspace.yaml"), "utf8")
2963
3512
  );
2964
3513
  const packages2 = doc?.packages;
2965
3514
  return Array.isArray(packages2) ? packages2.filter((p) => typeof p === "string") : null;
2966
3515
  }
2967
3516
  const pkg = JSON.parse(
2968
- readFileSync(join(candidate.dir, "package.json"), "utf8")
3517
+ readFileSync2(join2(candidate.dir, "package.json"), "utf8")
2969
3518
  );
2970
3519
  const { workspaces } = pkg;
2971
3520
  const packages = Array.isArray(workspaces) ? workspaces : workspaces?.packages;
@@ -2996,7 +3545,7 @@ function workspaceClaims(candidate, memberDir) {
2996
3545
  if (!positives.some(matches) || negatives.some(matches)) {
2997
3546
  return false;
2998
3547
  }
2999
- return existsSync(join(memberDir, "package.json"));
3548
+ return existsSync(join2(memberDir, "package.json"));
3000
3549
  }
3001
3550
  function resolvePerDirectoryLinkRoot(anchorDir, rootDirectorySetting) {
3002
3551
  let repoRoot = anchorDir;
@@ -3014,18 +3563,18 @@ function resolvePerDirectoryLinkRoot(anchorDir, rootDirectorySetting) {
3014
3563
  if (setting === "") {
3015
3564
  return { repoRoot, resolvedRootDirectory: linkLocation };
3016
3565
  }
3017
- if (existsSync(join(anchorDir, setting))) {
3566
+ if (existsSync(join2(anchorDir, setting))) {
3018
3567
  return {
3019
3568
  repoRoot,
3020
3569
  resolvedRootDirectory: normalizeRelative(
3021
- relative(repoRoot, join(anchorDir, setting))
3570
+ relative(repoRoot, join2(anchorDir, setting))
3022
3571
  )
3023
3572
  };
3024
3573
  }
3025
3574
  return {
3026
3575
  repoRoot,
3027
3576
  resolvedRootDirectory: linkLocation,
3028
- advisory: `Ignoring "rootDirectory" setting "${setting}" for the project linked in "${anchorDir}": "${join(anchorDir, setting)}" does not exist, so the build will use the linked directory "${linkLocation}" instead. Remove the "rootDirectory" setting, or configure it at the repository root.`
3577
+ advisory: `Ignoring "rootDirectory" setting "${setting}" for the project linked in "${anchorDir}": "${join2(anchorDir, setting)}" does not exist, so the build will use the linked directory "${linkLocation}" instead. Remove the "rootDirectory" setting, or configure it at the repository root.`
3029
3578
  };
3030
3579
  }
3031
3580
  function normalizeRelative(p) {
@@ -3034,6 +3583,18 @@ function normalizeRelative(p) {
3034
3583
  }
3035
3584
 
3036
3585
  // src/commands/build/index.ts
3586
+ function createBuildRunner({
3587
+ ctx,
3588
+ hasDetectedServices,
3589
+ builderPath,
3590
+ hasBuildCallback
3591
+ }) {
3592
+ return canBuildInSubprocess({
3593
+ hasDetectedServices,
3594
+ builderPath,
3595
+ hasBuildCallback
3596
+ }) ? new SubprocessBuildRunner(ctx) : void 0;
3597
+ }
3037
3598
  function buildCommandWithGlobalFlags(baseSubcommand, argv) {
3038
3599
  const globalFlags = getGlobalFlagsFromArgs(argv.slice(2));
3039
3600
  const full = globalFlags.length ? `${baseSubcommand} ${globalFlags.join(" ")}` : baseSubcommand;
@@ -3138,7 +3699,7 @@ async function main(client) {
3138
3699
  if (link?.repoRoot) {
3139
3700
  cwd = client.cwd = link.repoRoot;
3140
3701
  }
3141
- const vercelDir = join2(cwd, projectRootDirectory, VERCEL_DIR);
3702
+ const vercelDir = join3(cwd, projectRootDirectory, VERCEL_DIR);
3142
3703
  let project = await rootSpan.child("vc.readProjectSettings").trace(() => readProjectSettings(vercelDir));
3143
3704
  const isTTY = process.stdin.isTTY;
3144
3705
  while (!project?.settings) {
@@ -3205,7 +3766,7 @@ async function main(client) {
3205
3766
  return 0;
3206
3767
  }
3207
3768
  const { argv: originalArgv } = client;
3208
- client.cwd = join2(cwd, projectRootDirectory);
3769
+ client.cwd = join3(cwd, projectRootDirectory);
3209
3770
  client.setArgv([
3210
3771
  ...originalArgv.slice(0, 2),
3211
3772
  "pull",
@@ -3244,9 +3805,9 @@ async function main(client) {
3244
3805
  cwd = client.cwd = resolved.repoRoot;
3245
3806
  }
3246
3807
  }
3247
- const defaultOutputDir = join2(cwd, projectRootDirectory, import_write_build_result.OUTPUT_DIR);
3808
+ const defaultOutputDir = join3(cwd, projectRootDirectory, import_write_build_result.OUTPUT_DIR);
3248
3809
  const outputDir = parsedArgs.flags["--output"] ? resolve(parsedArgs.flags["--output"]) : defaultOutputDir;
3249
- client.traceDiagnosticsPath = join2(
3810
+ client.traceDiagnosticsPath = join3(
3250
3811
  outputDir,
3251
3812
  "diagnostics",
3252
3813
  "cli_traces.json"
@@ -3291,7 +3852,7 @@ async function main(client) {
3291
3852
  `Loaded ${Object.keys(buildEnv).length} environment variables from deployment ${deploymentId}`
3292
3853
  );
3293
3854
  } else {
3294
- const envPath = join2(
3855
+ const envPath = join3(
3295
3856
  cwd,
3296
3857
  projectRootDirectory,
3297
3858
  VERCEL_DIR,
@@ -3338,6 +3899,7 @@ async function main(client) {
3338
3899
  },
3339
3900
  {
3340
3901
  output: output_manager_default,
3902
+ createBuildRunner,
3341
3903
  importBuilders,
3342
3904
  formatResolvedBuilders: import_import_builders.formatResolvedBuilders,
3343
3905
  writeBuildResult,
@@ -3424,8 +3986,8 @@ async function main(client) {
3424
3986
  }
3425
3987
  output_manager_default.prettyError(err);
3426
3988
  buildsJson.error = toEnumerableError(err);
3427
- const buildsJsonPath = join2(outputDir, "builds.json");
3428
- const configJsonPath = join2(outputDir, "config.json");
3989
+ const buildsJsonPath = join3(outputDir, "builds.json");
3990
+ const configJsonPath = join3(outputDir, "config.json");
3429
3991
  await import_fs_extra.default.outputJSON(buildsJsonPath, buildsJson, {
3430
3992
  spaces: 2
3431
3993
  });
@@ -3470,7 +4032,7 @@ async function analyzeVcConfigFiles(cwd, outputDir) {
3470
4032
  const filesObject = await glob("**/.vc-config.json", {
3471
4033
  cwd: outputDir
3472
4034
  });
3473
- const vcConfigFiles = Object.keys(filesObject).filter((relativePath) => !relativePath.includes(".rsc.func")).map((relativePath) => join2(outputDir, relativePath));
4035
+ const vcConfigFiles = Object.keys(filesObject).filter((relativePath) => !relativePath.includes(".rsc.func")).map((relativePath) => join3(outputDir, relativePath));
3474
4036
  if (vcConfigFiles.length === 0) {
3475
4037
  output_manager_default.print("No functions to analyze.\n");
3476
4038
  return;
@@ -3538,7 +4100,7 @@ async function analyzeSingleFunction(file, cwd, outputDir) {
3538
4100
  (entry) => typeof entry[1] === "string"
3539
4101
  ).map(([bundlePath, sourcePath]) => ({
3540
4102
  bundlePath,
3541
- sourcePath: join2(cwd, sourcePath)
4103
+ sourcePath: join3(cwd, sourcePath)
3542
4104
  })) : [];
3543
4105
  const fsRefStats = getTotalFileSizeInMB(filePathMap);
3544
4106
  const totalSize = funcDirStats.size + fsRefStats.size;
@@ -3577,7 +4139,7 @@ function getDirectorySizeInMB(dir) {
3577
4139
  const entries = readdirSync(dir, { recursive: true });
3578
4140
  for (const entry of entries) {
3579
4141
  const entryPath = typeof entry === "string" ? entry : entry.toString();
3580
- const fullPath = join2(dir, entryPath);
4142
+ const fullPath = join3(dir, entryPath);
3581
4143
  try {
3582
4144
  const stats = statSync(fullPath);
3583
4145
  if (stats.isFile()) {