vercel 54.14.2 → 54.15.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 (53) hide show
  1. package/dist/chunks/{add-PKT6ULVJ.js → add-6XHROCMP.js} +5 -5
  2. package/dist/chunks/{chunk-3BR246Y6.js → chunk-3RIVJWW5.js} +2 -11
  3. package/dist/chunks/{chunk-J7BMPRCU.js → chunk-574PHXNT.js} +9 -4
  4. package/dist/chunks/{chunk-FLW73SZ3.js → chunk-6A62YUBE.js} +3 -3
  5. package/dist/chunks/{chunk-G3NXHUFT.js → chunk-6SL223IW.js} +1 -1
  6. package/dist/chunks/{chunk-2ZSXQQXI.js → chunk-6TPH3ZBU.js} +10 -19
  7. package/dist/chunks/{chunk-2XEEOHHH.js → chunk-AG6TBL6C.js} +1 -1
  8. package/dist/chunks/chunk-BRQ6PX3U.js +593 -0
  9. package/dist/chunks/{chunk-O7RJHL34.js → chunk-CENOYXK3.js} +583 -11
  10. package/dist/chunks/{chunk-YLGMXYFG.js → chunk-DCN3SOR6.js} +2 -2
  11. package/dist/chunks/{chunk-OHIZ4SVU.js → chunk-EAEEBPMD.js} +15 -3
  12. package/dist/chunks/{chunk-2HN6DLIY.js → chunk-HSXUEJ4T.js} +1 -1
  13. package/dist/chunks/{chunk-SDZ5ICZL.js → chunk-LABX5FSJ.js} +1 -1
  14. package/dist/chunks/{chunk-JISJDGJF.js → chunk-LOPPFUV3.js} +2 -2
  15. package/dist/chunks/{chunk-O4V7CMVO.js → chunk-OEYKL4IY.js} +7 -5
  16. package/dist/chunks/{chunk-372SHB43.js → chunk-OQD4G5FW.js} +4 -4
  17. package/dist/chunks/{chunk-LJ5WXXG6.js → chunk-QH7WYDEP.js} +11 -0
  18. package/dist/chunks/{chunk-Z3X747P6.js → chunk-RHXSECUF.js} +206 -31
  19. package/dist/chunks/{chunk-LQR3CHMH.js → chunk-SFPJ3VR7.js} +421 -799
  20. package/dist/chunks/{chunk-FEYVO2US.js → chunk-TLVKY7WL.js} +90 -32
  21. package/dist/chunks/{chunk-4BFK3C7V.js → chunk-UZD3DM6V.js} +1 -1
  22. package/dist/chunks/{chunk-IPWWE7PB.js → chunk-WGH26RJV.js} +1 -1
  23. package/dist/chunks/{chunk-ILJH44MK.js → chunk-YE3C5CUX.js} +1 -1
  24. package/dist/chunks/{compile-vercel-config-3LV7J3IZ.js → compile-vercel-config-ATU3UBFK.js} +1 -1
  25. package/dist/chunks/{delete-GFW6Y6TZ.js → delete-WIN4UHQY.js} +3 -3
  26. package/dist/chunks/{disable-PGRAS2ZL.js → disable-24KUO3TS.js} +3 -3
  27. package/dist/chunks/{discard-S6N5Q4G5.js → discard-B6ATZCPD.js} +3 -3
  28. package/dist/chunks/{edit-TICKX4ZV.js → edit-DIYIVLFQ.js} +7 -7
  29. package/dist/chunks/{enable-L3BYWN6S.js → enable-BF7NKTV7.js} +3 -3
  30. package/dist/chunks/{export-NXS33U5T.js → export-HHONDN7V.js} +3 -3
  31. package/dist/chunks/{inspect-OOI5JN3Y.js → inspect-GSYKUMK5.js} +4 -4
  32. package/dist/chunks/{list-77WL6463.js → list-OSJGB5AE.js} +4 -4
  33. package/dist/chunks/{list-6EHRL2D4.js → list-PZ4DRWLO.js} +2 -2
  34. package/dist/chunks/{ls-PBSOEXFG.js → ls-QBCHGSIC.js} +5 -5
  35. package/dist/chunks/{publish-CU2THVYW.js → publish-QYPZQ66O.js} +3 -3
  36. package/dist/chunks/{query-HEATRYAK.js → query-BDMX4CF6.js} +3 -3
  37. package/dist/chunks/{reorder-IQVKSM3H.js → reorder-YDTGTTJB.js} +3 -3
  38. package/dist/chunks/{restore-RDEOBGAS.js → restore-LXO2ZBAF.js} +3 -3
  39. package/dist/chunks/{rm-MCSGTU4J.js → rm-3L7FVCDA.js} +5 -5
  40. package/dist/chunks/{rule-inspect-3YK2XSL3.js → rule-inspect-T57QBYJR.js} +5 -5
  41. package/dist/chunks/{rules-F4MRDDHM.js → rules-E5DTNMFG.js} +7 -7
  42. package/dist/chunks/{schema-65C5EBJ7.js → schema-VYVJ4GYP.js} +3 -3
  43. package/dist/chunks/{update-XB4WSRGY.js → update-LT3LZVEZ.js} +5 -5
  44. package/dist/commands/build/index.js +157 -101
  45. package/dist/commands/deploy/index.js +13 -12
  46. package/dist/commands/dev/index.js +70 -23
  47. package/dist/commands/env/index.js +8 -6
  48. package/dist/commands/link/index.js +9 -16
  49. package/dist/commands/list/index.js +3 -3
  50. package/dist/commands-bulk.js +5371 -1618
  51. package/dist/index.js +9 -9
  52. package/dist/version.mjs +1 -1
  53. package/package.json +21 -21
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-JISJDGJF.js";
13
- import "./chunk-FLW73SZ3.js";
12
+ } from "./chunk-LOPPFUV3.js";
13
+ import "./chunk-6A62YUBE.js";
14
14
  import "./chunk-D7MGZH35.js";
15
15
  import {
16
16
  validateJsonOutput
@@ -20,9 +20,9 @@ import {
20
20
  } from "./chunk-SGPBULVT.js";
21
21
  import {
22
22
  AGENT_REASON
23
- } from "./chunk-LJ5WXXG6.js";
24
- import "./chunk-G3NXHUFT.js";
25
- import "./chunk-LQR3CHMH.js";
23
+ } from "./chunk-QH7WYDEP.js";
24
+ import "./chunk-6SL223IW.js";
25
+ import "./chunk-SFPJ3VR7.js";
26
26
  import "./chunk-HIYWSGI7.js";
27
27
  import {
28
28
  buildCommandWithGlobalFlags,
@@ -9,38 +9,38 @@ import {
9
9
  getStaticServiceSchedules,
10
10
  importBuilders,
11
11
  isLambda,
12
- relocateRootBuildOutputToService,
13
12
  staticFiles,
14
13
  writeBuildResult
15
- } from "../../chunks/chunk-3BR246Y6.js";
14
+ } from "../../chunks/chunk-3RIVJWW5.js";
15
+ import {
16
+ pullCommandLogic
17
+ } from "../../chunks/chunk-OEYKL4IY.js";
16
18
  import {
17
19
  require_semver
18
20
  } from "../../chunks/chunk-IB5L4LKZ.js";
19
- import {
20
- pullCommandLogic
21
- } from "../../chunks/chunk-O4V7CMVO.js";
22
21
  import {
23
22
  pickOverrides,
24
23
  readProjectSettings
25
- } from "../../chunks/chunk-2XEEOHHH.js";
24
+ } from "../../chunks/chunk-AG6TBL6C.js";
26
25
  import "../../chunks/chunk-YI3JV6GM.js";
26
+ import "../../chunks/chunk-BRQ6PX3U.js";
27
27
  import {
28
28
  stamp_default
29
29
  } from "../../chunks/chunk-64IF634X.js";
30
30
  import "../../chunks/chunk-VXYGCOKL.js";
31
- import "../../chunks/chunk-YLGMXYFG.js";
31
+ import "../../chunks/chunk-DCN3SOR6.js";
32
32
  import {
33
33
  printProjectNotFoundError
34
- } from "../../chunks/chunk-372SHB43.js";
34
+ } from "../../chunks/chunk-OQD4G5FW.js";
35
35
  import {
36
36
  AGENT_REASON,
37
37
  AGENT_STATUS
38
- } from "../../chunks/chunk-LJ5WXXG6.js";
39
- import "../../chunks/chunk-4BFK3C7V.js";
38
+ } from "../../chunks/chunk-QH7WYDEP.js";
39
+ import "../../chunks/chunk-UZD3DM6V.js";
40
40
  import {
41
41
  buildCommand
42
- } from "../../chunks/chunk-SDZ5ICZL.js";
43
- import "../../chunks/chunk-G3NXHUFT.js";
42
+ } from "../../chunks/chunk-LABX5FSJ.js";
43
+ import "../../chunks/chunk-6SL223IW.js";
44
44
  import {
45
45
  help
46
46
  } from "../../chunks/chunk-AWD3IGXU.js";
@@ -65,7 +65,7 @@ import {
65
65
  resolveProjectCwd,
66
66
  ua_default,
67
67
  validateConfig
68
- } from "../../chunks/chunk-LQR3CHMH.js";
68
+ } from "../../chunks/chunk-SFPJ3VR7.js";
69
69
  import {
70
70
  TelemetryClient
71
71
  } from "../../chunks/chunk-HIYWSGI7.js";
@@ -115,11 +115,10 @@ var import_client = __toESM(require_dist(), 1);
115
115
  var import_frameworks2 = __toESM(require_frameworks(), 1);
116
116
  var import_fs_detectors2 = __toESM(require_dist3(), 1);
117
117
  var import_routing_utils2 = __toESM(require_dist2(), 1);
118
- import { dirname, join as join2, normalize, relative as relative2, resolve, sep } from "path";
118
+ import { dirname, join as join3, normalize, relative as relative2, resolve, sep } from "path";
119
119
  import { readdirSync, statSync } from "fs";
120
120
  import {
121
121
  download,
122
- FileBlob,
123
122
  FileFsRef,
124
123
  getDiscontinuedNodeVersions,
125
124
  getInstalledPackageVersion,
@@ -133,15 +132,14 @@ import {
133
132
  Span,
134
133
  validateNpmrc,
135
134
  glob,
136
- isExperimentalService,
135
+ isExperimentalService as isExperimentalService2,
137
136
  getInternalServiceCronPath,
138
137
  getInternalServiceFunctionPath,
139
138
  getServiceQueueTopicConfigs,
140
139
  isBackendBuilder,
141
140
  isQueueBackedService,
142
141
  isScheduleTriggeredService,
143
- sanitizeConsumerName,
144
- downloadFile
142
+ sanitizeConsumerName
145
143
  } from "@vercel/build-utils";
146
144
 
147
145
  // src/util/build/corepack.ts
@@ -459,15 +457,99 @@ async function shouldEmbedFlagsDefinitions(cwd) {
459
457
  return false;
460
458
  }
461
459
 
460
+ // src/commands/build/manifest.ts
461
+ import { join as join2 } from "path";
462
+ import {
463
+ FileBlob,
464
+ downloadFile,
465
+ isExperimentalService
466
+ } from "@vercel/build-utils";
467
+ async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
468
+ if (packageManifests.length === 0)
469
+ return;
470
+ const projectManifest = {};
471
+ const deployManifestBuilds = {};
472
+ for (const {
473
+ workspace,
474
+ buildConfig,
475
+ manifest,
476
+ service,
477
+ builderUse
478
+ } of packageManifests) {
479
+ const key = `${builderUse}:${workspace}`;
480
+ projectManifest[key] = {
481
+ ...manifest,
482
+ workspace,
483
+ builder: builderUse,
484
+ framework: service?.framework ?? buildConfig.framework,
485
+ serviceName: service?.name,
486
+ serviceType: service && isExperimentalService(service) ? service.type : void 0,
487
+ routePrefix: service && isExperimentalService(service) ? service.routePrefix : void 0
488
+ };
489
+ deployManifestBuilds[key] = {
490
+ ...manifest,
491
+ root: workspace,
492
+ builder: builderUse
493
+ };
494
+ }
495
+ if (Object.keys(projectManifest).length === 0)
496
+ return;
497
+ const projectManifestBlob = new FileBlob({
498
+ data: JSON.stringify(projectManifest)
499
+ });
500
+ diagnostics["project-manifest.json"] = projectManifestBlob;
501
+ ops.push(
502
+ downloadFile(
503
+ projectManifestBlob,
504
+ join2(outputDir, "diagnostics", "project-manifest.json")
505
+ ).then(
506
+ () => void 0,
507
+ (err) => err
508
+ )
509
+ );
510
+ const deployManifestBlob = new FileBlob({
511
+ data: JSON.stringify({
512
+ manifestVersion: "2.0",
513
+ builds: deployManifestBuilds
514
+ })
515
+ });
516
+ diagnostics["deploy-manifest.json"] = deployManifestBlob;
517
+ ops.push(
518
+ downloadFile(
519
+ deployManifestBlob,
520
+ join2(outputDir, "diagnostics", "deploy-manifest.json")
521
+ ).then(
522
+ () => void 0,
523
+ (err) => err
524
+ )
525
+ );
526
+ }
527
+
462
528
  // src/commands/build/index.ts
463
529
  function buildCommandWithGlobalFlags(baseSubcommand, argv) {
464
530
  const globalFlags = getGlobalFlagsOnlyFromArgs(argv.slice(2));
465
531
  const full = globalFlags.length ? `${baseSubcommand} ${globalFlags.join(" ")}` : baseSubcommand;
466
532
  return getCommandNamePlain(full);
467
533
  }
534
+ var SERVICE_BUILD_IMMUTABLE_ENV_VARS = [
535
+ "VERCEL_IMMUTABLE_STATIC_FILES_ENABLED"
536
+ ];
468
537
  function hasNonEmptyObject(value) {
469
538
  return value != null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0;
470
539
  }
540
+ function unsetServiceBuildImmutableEnvVars(restoreEnv) {
541
+ for (const key of SERVICE_BUILD_IMMUTABLE_ENV_VARS) {
542
+ if (!restoreEnv.has(key)) {
543
+ restoreEnv.set(key, process.env[key]);
544
+ }
545
+ delete process.env[key];
546
+ }
547
+ }
548
+ function getGeneratedServiceAlreadyBuiltWarning(service) {
549
+ const framework = service.framework ?? "unknown";
550
+ const entrypoint = service.entrypoint ?? service.builder.src ?? "unknown";
551
+ return `Detected already-built service "${service.name}" from lazily generated \`.vercel/output/config.json\` (framework: ${framework}, entrypoint: ${entrypoint}). It will not be treated as a service because its build output already exists at the top level. Configure it in \`vercel.json\` as an \`experimentalServicesV2\` entry to remove this warning.`;
552
+ }
471
553
  async function main(client) {
472
554
  const telemetryClient = new BuildTelemetryClient({
473
555
  opts: {
@@ -558,7 +640,7 @@ async function main(client) {
558
640
  if (link?.repoRoot) {
559
641
  cwd = client.cwd = link.repoRoot;
560
642
  }
561
- const vercelDir = join2(cwd, projectRootDirectory, VERCEL_DIR);
643
+ const vercelDir = join3(cwd, projectRootDirectory, VERCEL_DIR);
562
644
  let project = await rootSpan.child("vc.readProjectSettings").trace(() => readProjectSettings(vercelDir));
563
645
  const isTTY = process.stdin.isTTY;
564
646
  while (!project?.settings) {
@@ -614,7 +696,7 @@ async function main(client) {
614
696
  return 0;
615
697
  }
616
698
  const { argv: originalArgv } = client;
617
- client.cwd = join2(cwd, projectRootDirectory);
699
+ client.cwd = join3(cwd, projectRootDirectory);
618
700
  client.setArgv([
619
701
  ...originalArgv.slice(0, 2),
620
702
  "pull",
@@ -636,9 +718,9 @@ async function main(client) {
636
718
  client.setArgv(originalArgv);
637
719
  project = await readProjectSettings(vercelDir);
638
720
  }
639
- const defaultOutputDir = join2(cwd, projectRootDirectory, OUTPUT_DIR);
721
+ const defaultOutputDir = join3(cwd, projectRootDirectory, OUTPUT_DIR);
640
722
  const outputDir = parsedArgs.flags["--output"] ? resolve(parsedArgs.flags["--output"]) : defaultOutputDir;
641
- client.traceDiagnosticsPath = join2(
723
+ client.traceDiagnosticsPath = join3(
642
724
  outputDir,
643
725
  "diagnostics",
644
726
  "cli_traces.json"
@@ -683,7 +765,7 @@ async function main(client) {
683
765
  `Loaded ${Object.keys(buildEnv).length} environment variables from deployment ${deploymentId}`
684
766
  );
685
767
  } else {
686
- const envPath = join2(
768
+ const envPath = join3(
687
769
  cwd,
688
770
  projectRootDirectory,
689
771
  VERCEL_DIR,
@@ -774,8 +856,8 @@ async function main(client) {
774
856
  }
775
857
  output_manager_default.prettyError(err);
776
858
  buildsJson.error = toEnumerableError(err);
777
- const buildsJsonPath = join2(outputDir, "builds.json");
778
- const configJsonPath = join2(outputDir, "config.json");
859
+ const buildsJsonPath = join3(outputDir, "builds.json");
860
+ const configJsonPath = join3(outputDir, "config.json");
779
861
  await import_fs_extra2.default.outputJSON(buildsJsonPath, buildsJson, {
780
862
  spaces: 2
781
863
  });
@@ -792,7 +874,7 @@ async function main(client) {
792
874
  async function doBuild(client, project, buildsJson, cwd, outputDir, span, standalone = false) {
793
875
  const { localConfigPath } = client;
794
876
  const VALID_DEPLOYMENT_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
795
- const workPath = join2(cwd, project.settings.rootDirectory || ".");
877
+ const workPath = join3(cwd, project.settings.rootDirectory || ".");
796
878
  const sourceConfigFile = await findSourceVercelConfigFile(workPath);
797
879
  let corepackShimDir;
798
880
  if (sourceConfigFile) {
@@ -828,9 +910,9 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
828
910
  process.env.VERCEL_INSTALL_COMPLETED = "1";
829
911
  }
830
912
  const compileResult = await span.child("vc.compileVercelConfig").trace(() => compileVercelConfig(workPath));
831
- const vercelConfigPath = localConfigPath || compileResult.configPath || join2(workPath, "vercel.json");
913
+ const vercelConfigPath = localConfigPath || compileResult.configPath || join3(workPath, "vercel.json");
832
914
  const [pkg, vercelConfig, hasInstrumentation] = await Promise.all([
833
- readJSONFile(join2(workPath, "package.json")),
915
+ readJSONFile(join3(workPath, "package.json")),
834
916
  readJSONFile(vercelConfigPath),
835
917
  (0, import_fs_detectors2.detectInstrumentation)(new import_fs_detectors2.LocalFileSystemDetector(workPath))
836
918
  ]);
@@ -937,7 +1019,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
937
1019
  builds = [{ src: "**", use: "@vercel/static" }];
938
1020
  }
939
1021
  detectedResolvedServices = detectedBuilders.services;
940
- detectedServices = detectedBuilders.services?.filter(isExperimentalService);
1022
+ detectedServices = detectedBuilders.services?.filter(isExperimentalService2);
941
1023
  if (detectedBuilders.useImplicitEnvInjection && detectedServices && detectedServices.length > 0) {
942
1024
  const serviceUrlEnvVars = getExperimentalServiceUrlEnvVars({
943
1025
  services: detectedServices,
@@ -979,7 +1061,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
979
1061
  let buildersWithPkgs = await span.child("vc.importBuilders").trace(() => importBuilders(builderSpecs, cwd, span));
980
1062
  const filesMap = {};
981
1063
  for (const path of files) {
982
- const fsPath = join2(workPath, path);
1064
+ const fsPath = join3(workPath, path);
983
1065
  const { mode } = await import_fs_extra2.default.stat(fsPath);
984
1066
  filesMap[path] = new FileFsRef({ mode, fsPath });
985
1067
  }
@@ -1036,7 +1118,6 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1036
1118
  const getHasQueueServices = () => detectedServices?.some(isQueueBackedService);
1037
1119
  const synthesizedServiceCrons = [];
1038
1120
  const serviceByBuilder = /* @__PURE__ */ new Map();
1039
- const workPathByBuilder = /* @__PURE__ */ new Map();
1040
1121
  const serviceFileOverrides = /* @__PURE__ */ new Map();
1041
1122
  if (getHasDetectedServices()) {
1042
1123
  for (const service of detectedResolvedServices) {
@@ -1056,15 +1137,15 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1056
1137
  try {
1057
1138
  const { builder, pkg: builderPkg } = builderWithPkg;
1058
1139
  const service = getHasDetectedServices() ? serviceByBuilder.get(build) : void 0;
1059
- const legacyExperimentalService = service && isExperimentalService(service) ? service : void 0;
1060
- const serviceWorkspace = service ? isExperimentalService(service) ? service.workspace : service.root : void 0;
1140
+ const legacyExperimentalService = service && isExperimentalService2(service) ? service : void 0;
1141
+ const serviceWorkspace = service ? isExperimentalService2(service) ? service.workspace : service.root : void 0;
1061
1142
  const stripServiceRoutePrefix = !!legacyExperimentalService?.routePrefix && legacyExperimentalService.routePrefix !== "/";
1062
1143
  let buildWorkPath = workPath;
1063
1144
  let buildEntrypoint = build.src;
1064
1145
  let buildFiles = filesMap;
1065
1146
  if (service && serviceWorkspace && serviceWorkspace !== ".") {
1066
1147
  const wsPrefix = serviceWorkspace + "/";
1067
- buildWorkPath = join2(workPath, serviceWorkspace);
1148
+ buildWorkPath = join3(workPath, serviceWorkspace);
1068
1149
  buildEntrypoint = build.src.startsWith(wsPrefix) ? build.src.slice(wsPrefix.length) : build.src;
1069
1150
  buildFiles = {};
1070
1151
  for (const [filePath, file] of Object.entries(filesMap)) {
@@ -1076,7 +1157,6 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1076
1157
  `Service "${service.name}": workspace-rooted build at "${buildWorkPath}", entrypoint "${buildEntrypoint}" (original: "${build.src}")`
1077
1158
  );
1078
1159
  }
1079
- workPathByBuilder.set(build, buildWorkPath);
1080
1160
  const settingsForEnv = service ? {
1081
1161
  buildCommand: service.buildCommand ?? void 0,
1082
1162
  installCommand: service.installCommand ?? void 0,
@@ -1202,6 +1282,9 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1202
1282
  output_manager_default.debug(`Injected service URL env var: ${key}=${value}`);
1203
1283
  }
1204
1284
  }
1285
+ if (service) {
1286
+ unsetServiceBuildImmutableEnvVars(restoreEnv);
1287
+ }
1205
1288
  let buildResult;
1206
1289
  let rawBuildResult;
1207
1290
  try {
@@ -1291,7 +1374,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1291
1374
  }
1292
1375
  }
1293
1376
  if ("output" in buildResult && buildResult.output && (isBackendBuilder(build) || build.use === "@vercel/python")) {
1294
- const routesJsonPath = join2(buildWorkPath, ".vercel", "routes.json");
1377
+ const routesJsonPath = join3(buildWorkPath, ".vercel", "routes.json");
1295
1378
  if ((0, import_fs_extra2.existsSync)(routesJsonPath)) {
1296
1379
  try {
1297
1380
  const routesJson = await readJSONFile(routesJsonPath);
@@ -1371,7 +1454,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1371
1454
  }
1372
1455
  let mergedBuildResult = buildResult;
1373
1456
  if ("buildOutputPath" in buildResult) {
1374
- const buildOutputConfigPath = join2(
1457
+ const buildOutputConfigPath = join3(
1375
1458
  buildResult.buildOutputPath,
1376
1459
  "config.json"
1377
1460
  );
@@ -1383,7 +1466,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1383
1466
  }
1384
1467
  if (buildOutputConfig) {
1385
1468
  if (!hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig) {
1386
- const outputConfigPath = join2(outputDir, "config.json");
1469
+ const outputConfigPath = join3(outputDir, "config.json");
1387
1470
  const outputConfig = await readJSONFile(outputConfigPath);
1388
1471
  if (outputConfig instanceof CantParseJSONFile) {
1389
1472
  throw outputConfig;
@@ -1457,7 +1540,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1457
1540
  throw err;
1458
1541
  } finally {
1459
1542
  ops.push(
1460
- download(diagnostics, join2(outputDir, "diagnostics")).then(
1543
+ download(diagnostics, join3(outputDir, "diagnostics")).then(
1461
1544
  () => void 0,
1462
1545
  (err) => err
1463
1546
  )
@@ -1513,17 +1596,28 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1513
1596
  await runBuilders(builds);
1514
1597
  await flushOps();
1515
1598
  if (!hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig) {
1516
- const generatedConfigPath = join2(outputDir, "config.json");
1599
+ const generatedConfigPath = join3(outputDir, "config.json");
1517
1600
  const generatedConfig = await readJSONFile(generatedConfigPath);
1518
1601
  if (generatedConfig instanceof CantParseJSONFile) {
1519
1602
  throw generatedConfig;
1520
1603
  }
1604
+ const defaultGeneratedOutputDir = join3(workPath, OUTPUT_DIR);
1605
+ const generatedConfigs = [generatedConfig];
1606
+ if (resolve(outputDir) !== resolve(defaultGeneratedOutputDir)) {
1607
+ const defaultGeneratedConfig = await readJSONFile(
1608
+ join3(defaultGeneratedOutputDir, "config.json")
1609
+ );
1610
+ if (defaultGeneratedConfig instanceof CantParseJSONFile) {
1611
+ throw defaultGeneratedConfig;
1612
+ }
1613
+ generatedConfigs.push(defaultGeneratedConfig);
1614
+ }
1521
1615
  const generatedExperimentalServicesV2Config = getGeneratedExperimentalServicesV2Config([
1522
- generatedConfig,
1616
+ ...generatedConfigs,
1523
1617
  ...buildResults.values()
1524
1618
  ]);
1525
1619
  const generatedExperimentalServicesV1Config = getGeneratedExperimentalServicesV1Config([
1526
- generatedConfig,
1620
+ ...generatedConfigs,
1527
1621
  ...buildResults.values()
1528
1622
  ]);
1529
1623
  if (generatedExperimentalServicesV2Config || generatedExperimentalServicesV1Config) {
@@ -1532,7 +1626,9 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1532
1626
  }
1533
1627
  detectedExperimentalServicesV1Config = generatedExperimentalServicesV1Config;
1534
1628
  detectedExperimentalServicesV2Config = generatedExperimentalServicesV2Config;
1535
- detectedExperimentalServicesV2RootRoutes = generatedExperimentalServicesV2Config && Array.isArray(generatedConfig?.routes) ? generatedConfig.routes : void 0;
1629
+ detectedExperimentalServicesV2RootRoutes = generatedExperimentalServicesV2Config ? generatedConfigs.find(
1630
+ (config2) => hasNonEmptyObject(config2?.experimentalServicesV2) && Array.isArray(config2?.routes)
1631
+ )?.routes : void 0;
1536
1632
  const generatedBuilders = await span.child("vc.detectGeneratedServices").trace(
1537
1633
  () => (0, import_fs_detectors2.detectBuilders)(files, pkg, {
1538
1634
  ...localConfig,
@@ -1559,7 +1655,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1559
1655
  detectedServices = void 0;
1560
1656
  } else {
1561
1657
  detectedServices = detectedResolvedServices.filter(
1562
- isExperimentalService
1658
+ isExperimentalService2
1563
1659
  );
1564
1660
  if (detectedServices.length > 0) {
1565
1661
  appendExperimentalServicesV1Routes(detectedServices);
@@ -1579,24 +1675,19 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1579
1675
  }
1580
1676
  const buildsToRun = [];
1581
1677
  const seenBuildsToRun = /* @__PURE__ */ new Set();
1582
- const relocatedGeneratedServiceBuilds = /* @__PURE__ */ new Set();
1583
1678
  for (const service of detectedResolvedServices || []) {
1584
- serviceByBuilder.set(service.builder, service);
1585
1679
  const alreadyExecutedBuild = getAlreadyExecutedBuild(service.builder);
1586
1680
  if (alreadyExecutedBuild) {
1587
- serviceByBuilder.set(alreadyExecutedBuild, service);
1588
- if (generatedExperimentalServicesV2Config && nestExperimentalServicesV2Output && !relocatedGeneratedServiceBuilds.has(alreadyExecutedBuild)) {
1589
- await relocateRootBuildOutputToService({
1590
- outputDir,
1591
- service,
1592
- workPath: workPathByBuilder.get(alreadyExecutedBuild) ?? workPath
1593
- });
1594
- relocatedGeneratedServiceBuilds.add(alreadyExecutedBuild);
1681
+ if (generatedExperimentalServicesV2Config) {
1682
+ output_manager_default.warn(getGeneratedServiceAlreadyBuiltWarning(service));
1683
+ } else {
1684
+ serviceByBuilder.set(alreadyExecutedBuild, service);
1595
1685
  }
1596
1686
  continue;
1597
1687
  }
1598
1688
  const serviceBuilderIdentity = getBuilderIdentity(service.builder);
1599
1689
  if (serviceBuilderIdentity && !seenBuildsToRun.has(serviceBuilderIdentity)) {
1690
+ serviceByBuilder.set(service.builder, service);
1600
1691
  seenBuildsToRun.add(serviceBuilderIdentity);
1601
1692
  buildsToRun.push(service.builder);
1602
1693
  }
@@ -1615,41 +1706,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1615
1706
  );
1616
1707
  }
1617
1708
  }
1618
- if (packageManifests.length > 0) {
1619
- const projectManifest = {};
1620
- for (const {
1621
- workspace,
1622
- buildConfig,
1623
- manifest,
1624
- service,
1625
- builderUse
1626
- } of packageManifests) {
1627
- projectManifest[`${builderUse}:${workspace}`] = {
1628
- ...manifest,
1629
- workspace,
1630
- builder: builderUse,
1631
- framework: service?.framework ?? buildConfig.framework,
1632
- serviceName: service?.name,
1633
- serviceType: service && isExperimentalService(service) ? service.type : void 0,
1634
- routePrefix: service && isExperimentalService(service) ? service.routePrefix : void 0
1635
- };
1636
- }
1637
- if (Object.keys(projectManifest).length > 0) {
1638
- const projectManifestBlob = new FileBlob({
1639
- data: JSON.stringify(projectManifest)
1640
- });
1641
- diagnostics["project-manifest.json"] = projectManifestBlob;
1642
- ops.push(
1643
- downloadFile(
1644
- projectManifestBlob,
1645
- join2(outputDir, "diagnostics", "project-manifest.json")
1646
- ).then(
1647
- () => void 0,
1648
- (err) => err
1649
- )
1650
- );
1651
- }
1652
- }
1709
+ await writeManifests(packageManifests, diagnostics, ops, outputDir);
1653
1710
  if (corepackShimDir) {
1654
1711
  cleanupCorepack(corepackShimDir);
1655
1712
  }
@@ -1677,7 +1734,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1677
1734
  if (needBuildsJsonOverride) {
1678
1735
  await writeBuildJson(buildsJson, outputDir);
1679
1736
  }
1680
- const configPath = join2(outputDir, "config.json");
1737
+ const configPath = join3(outputDir, "config.json");
1681
1738
  const existingConfig = await readJSONFile(configPath);
1682
1739
  if (existingConfig instanceof CantParseJSONFile) {
1683
1740
  throw existingConfig;
@@ -1717,7 +1774,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1717
1774
  let entrypoint = build.src;
1718
1775
  if (getHasDetectedServices() && typeof build.src === "string") {
1719
1776
  const service = serviceByBuilder.get(build);
1720
- if (service && isExperimentalService(service) && service.type === "web" && typeof service.routePrefix === "string") {
1777
+ if (service && isExperimentalService2(service) && service.type === "web" && typeof service.routePrefix === "string") {
1721
1778
  entrypoint = getServicesMergeEntrypoint(service, build.src);
1722
1779
  }
1723
1780
  }
@@ -1780,8 +1837,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1780
1837
  const framework = topLevelBuildResults.size > 0 ? await getFramework(workPath, topLevelBuildResults) : void 0;
1781
1838
  const explicitRootRoutes = appendBuildOutputRouteTables(
1782
1839
  routesResult.routes,
1783
- detectedExperimentalServicesV2RootRoutes,
1784
- existingConfig?.routes
1840
+ detectedExperimentalServicesV2RootRoutes ?? existingConfig?.routes
1785
1841
  );
1786
1842
  const config = {
1787
1843
  version: 3,
@@ -1800,7 +1856,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
1800
1856
  ...!detectedExperimentalServicesV1Config && detectedServices && detectedServices.length > 0 && { services: detectedServices },
1801
1857
  ...mergedDeploymentId && { deploymentId: mergedDeploymentId }
1802
1858
  };
1803
- await import_fs_extra2.default.writeJSON(join2(outputDir, "config.json"), config, { spaces: 2 });
1859
+ await import_fs_extra2.default.writeJSON(join3(outputDir, "config.json"), config, { spaces: 2 });
1804
1860
  if (nestExperimentalServicesV2Output) {
1805
1861
  await writeServiceConfigs(
1806
1862
  outputDir,
@@ -1858,7 +1914,7 @@ async function analyzeVcConfigFiles(cwd, outputDir) {
1858
1914
  const filesObject = await glob("**/.vc-config.json", {
1859
1915
  cwd: outputDir
1860
1916
  });
1861
- const vcConfigFiles = Object.keys(filesObject).filter((relativePath) => !relativePath.includes(".rsc.func")).map((relativePath) => join2(outputDir, relativePath));
1917
+ const vcConfigFiles = Object.keys(filesObject).filter((relativePath) => !relativePath.includes(".rsc.func")).map((relativePath) => join3(outputDir, relativePath));
1862
1918
  if (vcConfigFiles.length === 0) {
1863
1919
  output_manager_default.print("No functions to analyze.\n");
1864
1920
  return;
@@ -1926,7 +1982,7 @@ async function analyzeSingleFunction(file, cwd, outputDir) {
1926
1982
  (entry) => typeof entry[1] === "string"
1927
1983
  ).map(([bundlePath, sourcePath]) => ({
1928
1984
  bundlePath,
1929
- sourcePath: join2(cwd, sourcePath)
1985
+ sourcePath: join3(cwd, sourcePath)
1930
1986
  })) : [];
1931
1987
  const fsRefStats = getTotalFileSizeInMB(filePathMap);
1932
1988
  const totalSize = funcDirStats.size + fsRefStats.size;
@@ -1965,7 +2021,7 @@ function getDirectorySizeInMB(dir) {
1965
2021
  const entries = readdirSync(dir, { recursive: true });
1966
2022
  for (const entry of entries) {
1967
2023
  const entryPath = typeof entry === "string" ? entry : entry.toString();
1968
- const fullPath = join2(dir, entryPath);
2024
+ const fullPath = join3(dir, entryPath);
1969
2025
  try {
1970
2026
  const stats = statSync(fullPath);
1971
2027
  if (stats.isFile()) {
@@ -2120,7 +2176,7 @@ async function writeServiceConfigs(outputDir, buildResults, serviceByBuilder, se
2120
2176
  }
2121
2177
  await Promise.all(
2122
2178
  Array.from(serviceResults.entries()).map(async ([serviceName, results]) => {
2123
- const configPath = join2(
2179
+ const configPath = join3(
2124
2180
  outputDir,
2125
2181
  "services",
2126
2182
  serviceName,
@@ -2205,7 +2261,7 @@ async function mergeDeploymentId(existingDeploymentId, buildResults, workPath) {
2205
2261
  }
2206
2262
  }
2207
2263
  try {
2208
- const routesManifestPath = join2(workPath, ".next", "routes-manifest.json");
2264
+ const routesManifestPath = join3(workPath, ".next", "routes-manifest.json");
2209
2265
  if (await import_fs_extra2.default.pathExists(routesManifestPath)) {
2210
2266
  const routesManifest = await readJSONFile(
2211
2267
  routesManifestPath
@@ -2221,7 +2277,7 @@ async function mergeDeploymentId(existingDeploymentId, buildResults, workPath) {
2221
2277
  return void 0;
2222
2278
  }
2223
2279
  async function writeFlagsJSON(buildResults, outputDir) {
2224
- const flagsFilePath = join2(outputDir, "flags.json");
2280
+ const flagsFilePath = join3(outputDir, "flags.json");
2225
2281
  let hasFlags = true;
2226
2282
  const flags = await import_fs_extra2.default.readJSON(flagsFilePath).catch((error) => {
2227
2283
  if (error.code === "ENOENT") {
@@ -2249,7 +2305,7 @@ async function writeFlagsJSON(buildResults, outputDir) {
2249
2305
  }
2250
2306
  }
2251
2307
  async function writeBuildJson(buildsJson, outputDir) {
2252
- await import_fs_extra2.default.writeJSON(join2(outputDir, "builds.json"), buildsJson, { spaces: 2 });
2308
+ await import_fs_extra2.default.writeJSON(join3(outputDir, "builds.json"), buildsJson, { spaces: 2 });
2253
2309
  }
2254
2310
  async function getFrameworkRoutes(framework, dirPrefix) {
2255
2311
  let routes = [];
@@ -13,10 +13,10 @@ import {
13
13
  purchaseDomainIfAvailable,
14
14
  require_cjs,
15
15
  setupDomain
16
- } from "../../chunks/chunk-2ZSXQQXI.js";
16
+ } from "../../chunks/chunk-6TPH3ZBU.js";
17
17
  import {
18
18
  readLocalConfig
19
- } from "../../chunks/chunk-OHIZ4SVU.js";
19
+ } from "../../chunks/chunk-EAEEBPMD.js";
20
20
  import {
21
21
  highlight
22
22
  } from "../../chunks/chunk-V5P25P7F.js";
@@ -40,8 +40,8 @@ import {
40
40
  deprecatedArchiveSplitTgz,
41
41
  getCommandAliases,
42
42
  initSubcommand
43
- } from "../../chunks/chunk-O7RJHL34.js";
44
- import "../../chunks/chunk-ILJH44MK.js";
43
+ } from "../../chunks/chunk-CENOYXK3.js";
44
+ import "../../chunks/chunk-YE3C5CUX.js";
45
45
  import "../../chunks/chunk-IB56QKCM.js";
46
46
  import "../../chunks/chunk-DPS62LHL.js";
47
47
  import "../../chunks/chunk-SGPBULVT.js";
@@ -50,24 +50,25 @@ import "../../chunks/chunk-56AJHIQC.js";
50
50
  import "../../chunks/chunk-IJJOI63T.js";
51
51
  import {
52
52
  pickOverrides
53
- } from "../../chunks/chunk-2XEEOHHH.js";
53
+ } from "../../chunks/chunk-AG6TBL6C.js";
54
+ import "../../chunks/chunk-BRQ6PX3U.js";
54
55
  import {
55
56
  stamp_default
56
57
  } from "../../chunks/chunk-64IF634X.js";
57
58
  import "../../chunks/chunk-VXYGCOKL.js";
58
59
  import {
59
60
  ensureLink
60
- } from "../../chunks/chunk-YLGMXYFG.js";
61
+ } from "../../chunks/chunk-DCN3SOR6.js";
61
62
  import {
62
63
  validatePaths,
63
64
  validateRootDirectory
64
- } from "../../chunks/chunk-372SHB43.js";
65
+ } from "../../chunks/chunk-OQD4G5FW.js";
65
66
  import {
66
67
  AGENT_STATUS
67
- } from "../../chunks/chunk-LJ5WXXG6.js";
68
- import "../../chunks/chunk-4BFK3C7V.js";
69
- import "../../chunks/chunk-SDZ5ICZL.js";
70
- import "../../chunks/chunk-G3NXHUFT.js";
68
+ } from "../../chunks/chunk-QH7WYDEP.js";
69
+ import "../../chunks/chunk-UZD3DM6V.js";
70
+ import "../../chunks/chunk-LABX5FSJ.js";
71
+ import "../../chunks/chunk-6SL223IW.js";
71
72
  import {
72
73
  help
73
74
  } from "../../chunks/chunk-AWD3IGXU.js";
@@ -80,7 +81,7 @@ import {
80
81
  printAlignedLabel,
81
82
  require_dist as require_dist2,
82
83
  require_lib
83
- } from "../../chunks/chunk-LQR3CHMH.js";
84
+ } from "../../chunks/chunk-SFPJ3VR7.js";
84
85
  import {
85
86
  TelemetryClient
86
87
  } from "../../chunks/chunk-HIYWSGI7.js";