vercel 54.2.0 → 54.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/chunks/{add-FAIIANHS.js → add-6XIRI7GJ.js} +8 -8
  2. package/dist/chunks/{chunk-XVAEOG4L.js → chunk-3TDGMELF.js} +3 -5
  3. package/dist/chunks/{chunk-KSMF2UFR.js → chunk-4CIXZOP4.js} +15 -0
  4. package/dist/chunks/{chunk-QH5Q2B4F.js → chunk-4VFNBXZ2.js} +1 -1
  5. package/dist/chunks/{chunk-IYP3534A.js → chunk-4W26QRXA.js} +14 -10
  6. package/dist/chunks/{chunk-JFVGRFME.js → chunk-5EKBCYHA.js} +1 -1
  7. package/dist/chunks/{chunk-C5YP6KFI.js → chunk-AOJHEPS4.js} +6 -0
  8. package/dist/chunks/{chunk-O2NXGZCW.js → chunk-ASARRYQ2.js} +8 -8
  9. package/dist/chunks/{chunk-2OASKDFC.js → chunk-BTQ6HRS4.js} +7 -4
  10. package/dist/chunks/{chunk-ZAAKSLHC.js → chunk-C2V6DCWN.js} +4 -2
  11. package/dist/chunks/{chunk-QEYYWOB4.js → chunk-CPI4NTRV.js} +13 -3
  12. package/dist/chunks/{chunk-4PSOOFYO.js → chunk-DJA3IN2X.js} +1 -1
  13. package/dist/chunks/{chunk-YE6OHHJA.js → chunk-F23AADZM.js} +6 -6
  14. package/dist/chunks/{chunk-23UWSHRQ.js → chunk-FVMTH5YE.js} +133 -63
  15. package/dist/chunks/{chunk-4GQQJY5Y.js → chunk-H33IJ7OP.js} +9 -0
  16. package/dist/chunks/{chunk-TWVG3QHM.js → chunk-HE7FK57F.js} +1 -1
  17. package/dist/chunks/{chunk-E32QX22S.js → chunk-KW4SFTHO.js} +71 -8
  18. package/dist/chunks/{chunk-FKUVFVT2.js → chunk-L3JT6XDK.js} +305 -198
  19. package/dist/chunks/{chunk-E3NE4SKN.js → chunk-L6Q2EQPI.js} +1 -0
  20. package/dist/chunks/{chunk-J7RPHYNB.js → chunk-LHB57VQA.js} +1 -1
  21. package/dist/chunks/{chunk-DP5346AR.js → chunk-MZM2IMEM.js} +3 -3
  22. package/dist/chunks/{chunk-DKD6GTQT.js → chunk-OM5Z2KO5.js} +1 -1
  23. package/dist/chunks/{chunk-QAA3JVFJ.js → chunk-PHZ7DOO3.js} +2 -2
  24. package/dist/chunks/{chunk-ISJJTUJZ.js → chunk-QYUIKYIF.js} +1 -1
  25. package/dist/chunks/{chunk-ZA4ZUW7G.js → chunk-RIRQQSUQ.js} +2 -2
  26. package/dist/chunks/{chunk-JQ7RG6JF.js → chunk-SFCULGGZ.js} +1 -1
  27. package/dist/chunks/{chunk-2DFWEDF7.js → chunk-SRVNEJVN.js} +2 -2
  28. package/dist/chunks/{chunk-TZMIHH5D.js → chunk-TM2USC5N.js} +6 -11
  29. package/dist/chunks/{chunk-H7ZZXKJ2.js → chunk-TTOZFGDX.js} +3 -3
  30. package/dist/chunks/{chunk-YNHUUJTK.js → chunk-UDG7NUUQ.js} +5 -5
  31. package/dist/chunks/{chunk-VKQT3HCH.js → chunk-XPQUP4VC.js} +5 -5
  32. package/dist/chunks/{chunk-IFATV36R.js → chunk-YAOSNCGO.js} +5 -8
  33. package/dist/chunks/{chunk-CQANJIEC.js → chunk-YP423QYK.js} +4 -6
  34. package/dist/chunks/{chunk-ZFEECTPC.js → chunk-YQS3X3N5.js} +1 -1
  35. package/dist/chunks/{chunk-DIWRR5Y4.js → chunk-ZCMQ43RC.js} +1 -1
  36. package/dist/chunks/{compile-vercel-config-7TPMRTKM.js → compile-vercel-config-5WZ2LFBA.js} +3 -3
  37. package/dist/chunks/{delete-MVQKJDRS.js → delete-JB4S3TTR.js} +6 -6
  38. package/dist/chunks/{disable-YRONTYDS.js → disable-Y5MQYBZT.js} +6 -6
  39. package/dist/chunks/{discard-UM7Y2PMF.js → discard-DNGSXOP5.js} +6 -6
  40. package/dist/chunks/{edit-PHXJMLL2.js → edit-FHYSRIAM.js} +8 -8
  41. package/dist/chunks/{enable-D26FR2VL.js → enable-TI7IDW4D.js} +6 -6
  42. package/dist/chunks/{export-YLMQTP7Y.js → export-DGCLBJXG.js} +6 -6
  43. package/dist/chunks/{inspect-SJTJNJVL.js → inspect-YSEEB6K3.js} +10 -10
  44. package/dist/chunks/{list-6OV7HAO4.js → list-2IC4JQ7V.js} +5 -5
  45. package/dist/chunks/{list-XGSNQW5B.js → list-K2E7LRUZ.js} +9 -9
  46. package/dist/chunks/{ls-THDT5E4M.js → ls-LV3EOIGK.js} +8 -8
  47. package/dist/chunks/{publish-NPM5RPLV.js → publish-UCZDXEVP.js} +6 -6
  48. package/dist/chunks/{query-QP5JLBXI.js → query-YS24VBYT.js} +6 -6
  49. package/dist/chunks/{reorder-573FHW5Z.js → reorder-5PEIRI7B.js} +6 -6
  50. package/dist/chunks/{restore-H65BVJFL.js → restore-BNKCGWUN.js} +6 -6
  51. package/dist/chunks/{rm-MOVL4G2Y.js → rm-MMZJTUSV.js} +8 -8
  52. package/dist/chunks/{routes-I74KWX7Q.js → routes-IBID4NSZ.js} +2 -2
  53. package/dist/chunks/{rule-inspect-33M2FHDU.js → rule-inspect-45WAIMAY.js} +8 -8
  54. package/dist/chunks/{rules-KVSJYT5T.js → rules-F7NTLPKL.js} +7 -7
  55. package/dist/chunks/{schema-MXM7Z52O.js → schema-V33O6TZC.js} +7 -7
  56. package/dist/chunks/{types-QAT6PCGL.js → types-V6KTYGWP.js} +3 -3
  57. package/dist/chunks/{update-CSKHHR3E.js → update-LSMYRPF7.js} +8 -8
  58. package/dist/commands/build/index.js +83 -25
  59. package/dist/commands/deploy/index.js +32 -26
  60. package/dist/commands/dev/index.js +34 -21
  61. package/dist/commands/env/index.js +18 -22
  62. package/dist/commands/link/index.js +22 -29
  63. package/dist/commands/list/index.js +10 -10
  64. package/dist/commands-bulk.js +1356 -429
  65. package/dist/index.js +31 -21
  66. package/dist/version.mjs +1 -1
  67. package/package.json +21 -21
@@ -8,7 +8,7 @@ import {
8
8
  TelemetryClient,
9
9
  require_dist as require_dist2,
10
10
  require_graceful_fs
11
- } from "./chunk-KSMF2UFR.js";
11
+ } from "./chunk-4CIXZOP4.js";
12
12
  import {
13
13
  buildCommandWithYes,
14
14
  getPreservedArgsForEnvPull,
@@ -34,7 +34,7 @@ import {
34
34
  require_string_width,
35
35
  require_strip_ansi,
36
36
  yesOption
37
- } from "./chunk-4GQQJY5Y.js";
37
+ } from "./chunk-H33IJ7OP.js";
38
38
  import {
39
39
  APIError,
40
40
  CantParseJSONFile,
@@ -13816,7 +13816,7 @@ var require_frameworks = __commonJS({
13816
13816
  frameworks: () => frameworks
13817
13817
  });
13818
13818
  module.exports = __toCommonJS2(frameworks_exports);
13819
- var import_path11 = __require("path");
13819
+ var import_path12 = __require("path");
13820
13820
  var import_fs4 = __require("fs");
13821
13821
  var import_read_config_file = require_read_config_file();
13822
13822
  __reExport(frameworks_exports, require_types(), module.exports);
@@ -13943,7 +13943,7 @@ var require_frameworks = __commonJS({
13943
13943
  getOutputDirName: async () => "public",
13944
13944
  defaultRoutes: async (dirPrefix) => {
13945
13945
  try {
13946
- const nowRoutesPath = (0, import_path11.join)(
13946
+ const nowRoutesPath = (0, import_path12.join)(
13947
13947
  dirPrefix,
13948
13948
  "public",
13949
13949
  "__now_routes_g4t5bY.json"
@@ -14231,10 +14231,10 @@ var require_frameworks = __commonJS({
14231
14231
  getOutputDirName: async (dirPrefix) => {
14232
14232
  const base = "build";
14233
14233
  try {
14234
- const location = (0, import_path11.join)(dirPrefix, base);
14234
+ const location = (0, import_path12.join)(dirPrefix, base);
14235
14235
  const content = await readdir(location, { withFileTypes: true });
14236
14236
  if (content.length === 1 && content[0].isDirectory()) {
14237
- return (0, import_path11.join)(base, content[0].name);
14237
+ return (0, import_path12.join)(base, content[0].name);
14238
14238
  }
14239
14239
  } catch (error) {
14240
14240
  console.error(`Error detecting output directory: `, error);
@@ -14312,10 +14312,10 @@ var require_frameworks = __commonJS({
14312
14312
  getOutputDirName: async (dirPrefix) => {
14313
14313
  const base = "build";
14314
14314
  try {
14315
- const location = (0, import_path11.join)(dirPrefix, base);
14315
+ const location = (0, import_path12.join)(dirPrefix, base);
14316
14316
  const content = await readdir(location, { withFileTypes: true });
14317
14317
  if (content.length === 1 && content[0].isDirectory()) {
14318
- return (0, import_path11.join)(base, content[0].name);
14318
+ return (0, import_path12.join)(base, content[0].name);
14319
14319
  }
14320
14320
  } catch (error) {
14321
14321
  console.error(`Error detecting output directory: `, error);
@@ -14476,7 +14476,7 @@ var require_frameworks = __commonJS({
14476
14476
  }
14477
14477
  },
14478
14478
  dependency: "@dojo/cli",
14479
- getOutputDirName: async () => (0, import_path11.join)("output", "dist"),
14479
+ getOutputDirName: async () => (0, import_path12.join)("output", "dist"),
14480
14480
  defaultRoutes: [
14481
14481
  {
14482
14482
  handle: "filesystem"
@@ -14711,11 +14711,11 @@ var require_frameworks = __commonJS({
14711
14711
  getOutputDirName: async (dirPrefix) => {
14712
14712
  const base = "dist";
14713
14713
  try {
14714
- const location = (0, import_path11.join)(dirPrefix, base);
14714
+ const location = (0, import_path12.join)(dirPrefix, base);
14715
14715
  const content = await readdir(location, { withFileTypes: true });
14716
14716
  if (content.length === 1 && content[0].isDirectory()) {
14717
- const potentialOutDir = (0, import_path11.join)(base, content[0].name);
14718
- const potentialOutDirWithBrowser = (0, import_path11.join)(potentialOutDir, "browser");
14717
+ const potentialOutDir = (0, import_path12.join)(base, content[0].name);
14718
+ const potentialOutDirWithBrowser = (0, import_path12.join)(potentialOutDir, "browser");
14719
14719
  return (0, import_fs4.existsSync)(potentialOutDirWithBrowser) ? potentialOutDirWithBrowser : potentialOutDir;
14720
14720
  }
14721
14721
  } catch (error) {
@@ -14768,10 +14768,10 @@ var require_frameworks = __commonJS({
14768
14768
  getOutputDirName: async (dirPrefix) => {
14769
14769
  const base = "build";
14770
14770
  try {
14771
- const location = (0, import_path11.join)(dirPrefix, base);
14771
+ const location = (0, import_path12.join)(dirPrefix, base);
14772
14772
  const content = await readdir(location);
14773
14773
  const paths = content.filter((item) => !item.includes("."));
14774
- return (0, import_path11.join)(base, paths[0]);
14774
+ return (0, import_path12.join)(base, paths[0]);
14775
14775
  } catch (error) {
14776
14776
  console.error(`Error detecting output directory: `, error);
14777
14777
  }
@@ -15389,7 +15389,7 @@ var require_frameworks = __commonJS({
15389
15389
  getOutputDirName: async (dirPrefix) => {
15390
15390
  const config = await (0, import_read_config_file.readConfigFile)(
15391
15391
  ["config.json", "config.yaml", "config.toml"].map((fileName) => {
15392
- return (0, import_path11.join)(dirPrefix, fileName);
15392
+ return (0, import_path12.join)(dirPrefix, fileName);
15393
15393
  })
15394
15394
  );
15395
15395
  return config && config.publishDir || "public";
@@ -15430,7 +15430,7 @@ var require_frameworks = __commonJS({
15430
15430
  },
15431
15431
  getOutputDirName: async (dirPrefix) => {
15432
15432
  const config = await (0, import_read_config_file.readConfigFile)(
15433
- (0, import_path11.join)(dirPrefix, "_config.yml")
15433
+ (0, import_path12.join)(dirPrefix, "_config.yml")
15434
15434
  );
15435
15435
  return config && config.destination || "_site";
15436
15436
  },
@@ -22670,14 +22670,14 @@ var require_utils3 = __commonJS({
22670
22670
  __export2(utils_exports, {
22671
22671
  DETECTION_FRAMEWORKS: () => DETECTION_FRAMEWORKS,
22672
22672
  INTERNAL_QUEUES_PREFIX: () => INTERNAL_QUEUES_PREFIX,
22673
- INTERNAL_SERVICE_PREFIX: () => import_build_utils5.INTERNAL_SERVICE_PREFIX,
22673
+ INTERNAL_SERVICE_PREFIX: () => import_build_utils6.INTERNAL_SERVICE_PREFIX,
22674
22674
  assignRoutePrefixes: () => assignRoutePrefixes,
22675
22675
  combineBuildCommand: () => combineBuildCommand,
22676
22676
  filterFrameworksByRuntime: () => filterFrameworksByRuntime,
22677
22677
  getBuilderForRuntime: () => getBuilderForRuntime,
22678
- getInternalServiceCronPath: () => import_build_utils5.getInternalServiceCronPath,
22679
- getInternalServiceCronPathPrefix: () => import_build_utils5.getInternalServiceCronPathPrefix,
22680
- getInternalServiceFunctionPath: () => import_build_utils5.getInternalServiceFunctionPath,
22678
+ getInternalServiceCronPath: () => import_build_utils6.getInternalServiceCronPath,
22679
+ getInternalServiceCronPathPrefix: () => import_build_utils6.getInternalServiceCronPathPrefix,
22680
+ getInternalServiceFunctionPath: () => import_build_utils6.getInternalServiceFunctionPath,
22681
22681
  getInternalServiceWorkerPath: () => getInternalServiceWorkerPath2,
22682
22682
  getInternalServiceWorkerPathPrefix: () => getInternalServiceWorkerPathPrefix2,
22683
22683
  hasFile: () => hasFile,
@@ -22692,7 +22692,7 @@ var require_utils3 = __commonJS({
22692
22692
  });
22693
22693
  module.exports = __toCommonJS2(utils_exports);
22694
22694
  var import_framework_helpers = __require("@vercel/build-utils/dist/framework-helpers");
22695
- var import_build_utils5 = __require("@vercel/build-utils");
22695
+ var import_build_utils6 = __require("@vercel/build-utils");
22696
22696
  var import_frameworks2 = require_frameworks();
22697
22697
  var import_types = require_types3();
22698
22698
  var DETECTION_FRAMEWORKS = import_frameworks2.frameworkList.filter(
@@ -22723,7 +22723,7 @@ var require_utils3 = __commonJS({
22723
22723
  return normalized || "index";
22724
22724
  }
22725
22725
  function getInternalServiceWorkerPathPrefix2(serviceName) {
22726
- return `${import_build_utils5.INTERNAL_SERVICE_PREFIX}/${serviceName}/workers`;
22726
+ return `${import_build_utils6.INTERNAL_SERVICE_PREFIX}/${serviceName}/workers`;
22727
22727
  }
22728
22728
  function getInternalServiceWorkerPath2(serviceName, entrypoint, handler = "worker") {
22729
22729
  const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
@@ -23158,8 +23158,8 @@ var require_resolve2 = __commonJS({
23158
23158
  validateServiceEntrypoint: () => validateServiceEntrypoint
23159
23159
  });
23160
23160
  module.exports = __toCommonJS2(resolve_exports);
23161
- var import_path11 = __require("path");
23162
- var import_build_utils5 = __require("@vercel/build-utils");
23161
+ var import_path12 = __require("path");
23162
+ var import_build_utils6 = __require("@vercel/build-utils");
23163
23163
  var import_types = require_types3();
23164
23164
  var import_utils4 = require_utils3();
23165
23165
  var import_frameworks2 = require_frameworks();
@@ -23189,7 +23189,7 @@ var require_resolve2 = __commonJS({
23189
23189
  if (!root) {
23190
23190
  return { fs: fs5 };
23191
23191
  }
23192
- const normalizedRoot = import_path11.posix.normalize(root);
23192
+ const normalizedRoot = import_path12.posix.normalize(root);
23193
23193
  if (!await fs5.hasPath(normalizedRoot)) {
23194
23194
  return {
23195
23195
  fs: fs5,
@@ -23213,7 +23213,7 @@ var require_resolve2 = __commonJS({
23213
23213
  return { fs: fs5.chdir(normalizedRoot) };
23214
23214
  }
23215
23215
  function normalizeServiceEntrypoint(entrypoint) {
23216
- const normalized = import_path11.posix.normalize(entrypoint);
23216
+ const normalized = import_path12.posix.normalize(entrypoint);
23217
23217
  return normalized === "" ? "." : normalized;
23218
23218
  }
23219
23219
  function getEffectiveServiceTrigger(config) {
@@ -23271,7 +23271,7 @@ var require_resolve2 = __commonJS({
23271
23271
  };
23272
23272
  }
23273
23273
  function toWorkspaceRelativeEntrypoint(entrypoint, workspace) {
23274
- const normalizedEntrypoint = import_path11.posix.normalize(entrypoint);
23274
+ const normalizedEntrypoint = import_path12.posix.normalize(entrypoint);
23275
23275
  if (workspace === ".") {
23276
23276
  return normalizedEntrypoint;
23277
23277
  }
@@ -23279,7 +23279,7 @@ var require_resolve2 = __commonJS({
23279
23279
  if (normalizedEntrypoint.startsWith(workspacePrefix)) {
23280
23280
  return normalizedEntrypoint.slice(workspacePrefix.length);
23281
23281
  }
23282
- const relativeEntrypoint = import_path11.posix.relative(
23282
+ const relativeEntrypoint = import_path12.posix.relative(
23283
23283
  workspace,
23284
23284
  normalizedEntrypoint
23285
23285
  );
@@ -23300,14 +23300,14 @@ var require_resolve2 = __commonJS({
23300
23300
  if (!manifests || manifests.length === 0) {
23301
23301
  return void 0;
23302
23302
  }
23303
- let dir = import_path11.posix.dirname(import_path11.posix.normalize(entrypoint)) || ".";
23303
+ let dir = import_path12.posix.dirname(import_path12.posix.normalize(entrypoint)) || ".";
23304
23304
  if (dir === "") {
23305
23305
  dir = ".";
23306
23306
  }
23307
23307
  let reachedRoot = false;
23308
23308
  while (!reachedRoot) {
23309
23309
  for (const manifest of manifests) {
23310
- const manifestPath = dir === "." ? manifest : import_path11.posix.join(dir, manifest);
23310
+ const manifestPath = dir === "." ? manifest : import_path12.posix.join(dir, manifest);
23311
23311
  if (await (0, import_utils4.hasFile)(fs5, manifestPath)) {
23312
23312
  return dir;
23313
23313
  }
@@ -23315,7 +23315,7 @@ var require_resolve2 = __commonJS({
23315
23315
  if (dir === "." || dir === "/") {
23316
23316
  reachedRoot = true;
23317
23317
  } else {
23318
- const parent = import_path11.posix.dirname(dir);
23318
+ const parent = import_path12.posix.dirname(dir);
23319
23319
  if (!parent || parent === dir) {
23320
23320
  reachedRoot = true;
23321
23321
  } else {
@@ -23458,8 +23458,8 @@ var require_resolve2 = __commonJS({
23458
23458
  trigger: effectiveTrigger
23459
23459
  };
23460
23460
  const isJobService = serviceType === "job" || serviceType === "cron";
23461
- const isScheduleJobService = (0, import_build_utils5.isScheduleTriggeredService)(effectiveService);
23462
- const isQueueJobService = serviceType === "job" && (0, import_build_utils5.isQueueTriggeredService)(effectiveService);
23461
+ const isScheduleJobService = (0, import_build_utils6.isScheduleTriggeredService)(effectiveService);
23462
+ const isQueueJobService = serviceType === "job" && (0, import_build_utils6.isQueueTriggeredService)(effectiveService);
23463
23463
  const isWorkflowService = serviceType === "job" && effectiveTrigger === "workflow";
23464
23464
  const isNonWebService = serviceType === "worker" || isJobService;
23465
23465
  const serviceTypeLabel = isJobService ? "Job" : serviceType === "worker" ? "Worker" : "Web";
@@ -23513,10 +23513,10 @@ var require_resolve2 = __commonJS({
23513
23513
  serviceName: name
23514
23514
  };
23515
23515
  }
23516
- if (serviceType === "job" && effectiveTrigger && !import_build_utils5.JOB_TRIGGERS.includes(effectiveTrigger)) {
23516
+ if (serviceType === "job" && effectiveTrigger && !import_build_utils6.JOB_TRIGGERS.includes(effectiveTrigger)) {
23517
23517
  return {
23518
23518
  code: "INVALID_JOB_TRIGGER",
23519
- message: `Job service "${name}" has invalid trigger "${effectiveTrigger}". Expected ${import_build_utils5.JOB_TRIGGERS.map((t) => `"${t}"`).join(", ")}.`,
23519
+ message: `Job service "${name}" has invalid trigger "${effectiveTrigger}". Expected ${import_build_utils6.JOB_TRIGGERS.map((t) => `"${t}"`).join(", ")}.`,
23520
23520
  serviceName: name
23521
23521
  };
23522
23522
  }
@@ -23542,7 +23542,7 @@ var require_resolve2 = __commonJS({
23542
23542
  };
23543
23543
  }
23544
23544
  if (config.root !== void 0) {
23545
- const normalizedRoot = import_path11.posix.normalize(config.root);
23545
+ const normalizedRoot = import_path12.posix.normalize(config.root);
23546
23546
  if (normalizedRoot.startsWith("/")) {
23547
23547
  return {
23548
23548
  code: "INVALID_ROOT",
@@ -23730,12 +23730,12 @@ var require_resolve2 = __commonJS({
23730
23730
  }
23731
23731
  }
23732
23732
  if (root) {
23733
- const normalizedRoot = import_path11.posix.normalize(root);
23733
+ const normalizedRoot = import_path12.posix.normalize(root);
23734
23734
  if (normalizedRoot !== ".") {
23735
- workspace = workspace === "." ? normalizedRoot : import_path11.posix.join(normalizedRoot, workspace);
23735
+ workspace = workspace === "." ? normalizedRoot : import_path12.posix.join(normalizedRoot, workspace);
23736
23736
  }
23737
23737
  }
23738
- const topics = type === "worker" ? (0, import_build_utils5.getServiceQueueTopics)({ type, topics: config.topics }) : trigger === "queue" ? config.topics : void 0;
23738
+ const topics = type === "worker" ? (0, import_build_utils6.getServiceQueueTopics)({ type, topics: config.topics }) : trigger === "queue" ? config.topics : trigger === "workflow" ? ["__wkf_*"] : void 0;
23739
23739
  let builderUse;
23740
23740
  let builderSrc;
23741
23741
  const frameworkDefinition = config.framework ? frameworksBySlug.get(config.framework) : void 0;
@@ -23743,7 +23743,7 @@ var require_resolve2 = __commonJS({
23743
23743
  builderUse = config.builder;
23744
23744
  builderSrc = resolvedEntrypointFile || frameworkDefinition?.useRuntime?.src || "package.json";
23745
23745
  } else if (config.framework) {
23746
- const isCronService = (0, import_build_utils5.isScheduleTriggeredService)({ type, trigger });
23746
+ const isCronService = (0, import_build_utils6.isScheduleTriggeredService)({ type, trigger });
23747
23747
  if ((0, import_build_utils22.isNodeBackendFramework)(config.framework) && (type === "web" || isCronService)) {
23748
23748
  builderUse = "@vercel/backends";
23749
23749
  } else {
@@ -23757,7 +23757,7 @@ var require_resolve2 = __commonJS({
23757
23757
  );
23758
23758
  }
23759
23759
  if (inferredRuntime === "node") {
23760
- const isCronService = (0, import_build_utils5.isScheduleTriggeredService)({ type, trigger });
23760
+ const isCronService = (0, import_build_utils6.isScheduleTriggeredService)({ type, trigger });
23761
23761
  builderUse = type === "web" || isCronService ? "@vercel/backends" : "@vercel/node";
23762
23762
  } else {
23763
23763
  builderUse = (0, import_utils4.getBuilderForRuntime)(inferredRuntime);
@@ -23770,7 +23770,7 @@ var require_resolve2 = __commonJS({
23770
23770
  const resolvedRoutePrefixSource = type === "web" && typeof routePrefix === "string" ? routePrefixWasConfigured ? routePrefixSource : "generated" : void 0;
23771
23771
  const isRoot = workspace === ".";
23772
23772
  if (!isRoot) {
23773
- builderSrc = import_path11.posix.join(workspace, builderSrc);
23773
+ builderSrc = import_path12.posix.join(workspace, builderSrc);
23774
23774
  }
23775
23775
  const builderConfig = { zeroConfig: true };
23776
23776
  if (builderUse === "@vercel/backends") {
@@ -23919,7 +23919,7 @@ var require_resolve2 = __commonJS({
23919
23919
  entrypoint: resolvedEntrypoint.normalized,
23920
23920
  runtime: inferredRuntime
23921
23921
  });
23922
- const workspace = inferredWorkspace ?? import_path11.posix.dirname(resolvedEntrypoint.normalized);
23922
+ const workspace = inferredWorkspace ?? import_path12.posix.dirname(resolvedEntrypoint.normalized);
23923
23923
  const detection = await detectFrameworkFromWorkspace({
23924
23924
  fs: serviceFs,
23925
23925
  workspace,
@@ -24051,7 +24051,7 @@ var require_auto_detect = __commonJS({
24051
24051
  var SERVICES_DIR = "services";
24052
24052
  var FRONTEND_LOCATIONS = [FRONTEND_DIR, APPS_WEB_DIR];
24053
24053
  async function autoDetectServices2(options) {
24054
- const { fs: fs5 } = options;
24054
+ const { fs: fs5, detectEntrypoint } = options;
24055
24055
  const rootFrameworks = await (0, import_detect_framework.detectFrameworks)({
24056
24056
  fs: fs5,
24057
24057
  frameworkList: import_frameworks2.frameworkList
@@ -24070,7 +24070,7 @@ var require_auto_detect = __commonJS({
24070
24070
  };
24071
24071
  }
24072
24072
  if (rootFrameworks.length === 1) {
24073
- return detectServicesAtRoot(fs5, rootFrameworks[0]);
24073
+ return detectServicesAtRoot(fs5, rootFrameworks[0], detectEntrypoint);
24074
24074
  }
24075
24075
  for (const frontendLocation of FRONTEND_LOCATIONS) {
24076
24076
  const hasFrontendDir = await fs5.hasPath(frontendLocation);
@@ -24099,7 +24099,8 @@ var require_auto_detect = __commonJS({
24099
24099
  return detectServicesFrontendSubdir(
24100
24100
  fs5,
24101
24101
  frontendFrameworks[0],
24102
- frontendLocation
24102
+ frontendLocation,
24103
+ detectEntrypoint
24103
24104
  );
24104
24105
  }
24105
24106
  }
@@ -24114,13 +24115,13 @@ var require_auto_detect = __commonJS({
24114
24115
  ]
24115
24116
  };
24116
24117
  }
24117
- async function detectServicesAtRoot(fs5, rootFramework) {
24118
+ async function detectServicesAtRoot(fs5, rootFramework, detectEntrypoint) {
24118
24119
  const services = {};
24119
24120
  services.frontend = {
24120
24121
  framework: rootFramework.slug ?? void 0,
24121
24122
  routePrefix: "/"
24122
24123
  };
24123
- const backendResult = await detectBackendServices(fs5);
24124
+ const backendResult = await detectBackendServices(fs5, detectEntrypoint);
24124
24125
  if (backendResult.error) {
24125
24126
  return {
24126
24127
  services: null,
@@ -24142,15 +24143,15 @@ var require_auto_detect = __commonJS({
24142
24143
  errors: []
24143
24144
  };
24144
24145
  }
24145
- async function detectServicesFrontendSubdir(fs5, frontendFramework, frontendLocation) {
24146
+ async function detectServicesFrontendSubdir(fs5, frontendFramework, frontendLocation, detectEntrypoint) {
24146
24147
  const services = {};
24147
24148
  const serviceName = frontendLocation.split("/").pop() || "frontend";
24148
24149
  services[serviceName] = {
24149
24150
  framework: frontendFramework.slug ?? void 0,
24150
- entrypoint: frontendLocation,
24151
+ root: frontendLocation,
24151
24152
  routePrefix: "/"
24152
24153
  };
24153
- const backendResult = await detectBackendServices(fs5);
24154
+ const backendResult = await detectBackendServices(fs5, detectEntrypoint);
24154
24155
  if (backendResult.error) {
24155
24156
  return {
24156
24157
  services: null,
@@ -24177,16 +24178,24 @@ var require_auto_detect = __commonJS({
24177
24178
  errors: []
24178
24179
  };
24179
24180
  }
24180
- async function detectBackendServices(fs5) {
24181
+ async function detectBackendServices(fs5, detectEntrypoint) {
24181
24182
  const services = {};
24182
- const backendResult = await detectServiceInDir(fs5, BACKEND_DIR, "backend");
24183
+ const backendResult = await detectServiceInDir(
24184
+ fs5,
24185
+ BACKEND_DIR,
24186
+ "backend",
24187
+ detectEntrypoint
24188
+ );
24183
24189
  if (backendResult.error) {
24184
24190
  return { services: {}, error: backendResult.error };
24185
24191
  }
24186
24192
  if (backendResult.service) {
24187
24193
  services.backend = backendResult.service;
24188
24194
  }
24189
- const multiServicesResult = await detectServicesDirectory(fs5);
24195
+ const multiServicesResult = await detectServicesDirectory(
24196
+ fs5,
24197
+ detectEntrypoint
24198
+ );
24190
24199
  if (multiServicesResult.error) {
24191
24200
  return { services: {}, error: multiServicesResult.error };
24192
24201
  }
@@ -24205,7 +24214,7 @@ var require_auto_detect = __commonJS({
24205
24214
  Object.assign(services, multiServicesResult.services);
24206
24215
  return { services };
24207
24216
  }
24208
- async function detectServicesDirectory(fs5) {
24217
+ async function detectServicesDirectory(fs5, detectEntrypoint) {
24209
24218
  const services = {};
24210
24219
  const hasServicesDir = await fs5.hasPath(SERVICES_DIR);
24211
24220
  if (!hasServicesDir) {
@@ -24219,7 +24228,12 @@ var require_auto_detect = __commonJS({
24219
24228
  }
24220
24229
  const serviceName = entry.name;
24221
24230
  const serviceDir = `${SERVICES_DIR}/${serviceName}`;
24222
- const result = await detectServiceInDir(fs5, serviceDir, serviceName);
24231
+ const result = await detectServiceInDir(
24232
+ fs5,
24233
+ serviceDir,
24234
+ serviceName,
24235
+ detectEntrypoint
24236
+ );
24223
24237
  if (result.error) {
24224
24238
  return { services: {}, error: result.error };
24225
24239
  }
@@ -24229,7 +24243,7 @@ var require_auto_detect = __commonJS({
24229
24243
  }
24230
24244
  return { services };
24231
24245
  }
24232
- async function detectServiceInDir(fs5, dirPath, serviceName) {
24246
+ async function detectServiceInDir(fs5, dirPath, serviceName, detectEntrypoint) {
24233
24247
  const hasDirPath = await fs5.hasPath(dirPath);
24234
24248
  if (!hasDirPath) {
24235
24249
  return {};
@@ -24250,17 +24264,21 @@ var require_auto_detect = __commonJS({
24250
24264
  }
24251
24265
  };
24252
24266
  }
24253
- if (frameworks.length === 1) {
24254
- const framework = frameworks[0];
24255
- return {
24256
- service: {
24257
- framework: framework.slug ?? void 0,
24258
- entrypoint: dirPath,
24259
- routePrefix: `/_/${serviceName}`
24260
- }
24261
- };
24267
+ if (frameworks.length !== 1) {
24268
+ return {};
24262
24269
  }
24263
- return {};
24270
+ const framework = frameworks[0];
24271
+ const slug = framework.slug ?? void 0;
24272
+ const routePrefix = `/_/${serviceName}`;
24273
+ const detected = detectEntrypoint && !(0, import_utils4.isFrontendFramework)(slug) ? await detectEntrypoint({ workPath: dirPath, framework: slug }) : null;
24274
+ return {
24275
+ service: {
24276
+ framework: slug,
24277
+ root: dirPath,
24278
+ ...detected ? { entrypoint: detected.entrypoint } : {},
24279
+ routePrefix
24280
+ }
24281
+ };
24264
24282
  }
24265
24283
  }
24266
24284
  });
@@ -24301,7 +24319,7 @@ var require_detect_railway = __commonJS({
24301
24319
  detectRailwayServices: () => detectRailwayServices
24302
24320
  });
24303
24321
  module.exports = __toCommonJS2(detect_railway_exports);
24304
- var import_path11 = __require("path");
24322
+ var import_path12 = __require("path");
24305
24323
  var import_smol_toml3 = __toESM2(__require("smol-toml"));
24306
24324
  var import_detect_framework = require_detect_framework();
24307
24325
  var import_utils4 = require_utils3();
@@ -24326,7 +24344,7 @@ var require_detect_railway = __commonJS({
24326
24344
  "CVS"
24327
24345
  ]);
24328
24346
  async function detectRailwayServices(options) {
24329
- const { fs: fs5 } = options;
24347
+ const { fs: fs5, detectEntrypoint } = options;
24330
24348
  const { configs, warnings } = await findRailwayConfigs(fs5);
24331
24349
  if (configs.length === 0) {
24332
24350
  return { services: null, errors: [], warnings };
@@ -24389,10 +24407,20 @@ var require_detect_railway = __commonJS({
24389
24407
  continue;
24390
24408
  }
24391
24409
  const framework = frameworks[0];
24410
+ const slug = framework.slug ?? void 0;
24392
24411
  let serviceConfig = {};
24393
- serviceConfig.framework = framework.slug ?? void 0;
24412
+ serviceConfig.framework = slug;
24394
24413
  if (cf.dirPath !== ".") {
24395
- serviceConfig.entrypoint = cf.dirPath;
24414
+ serviceConfig.root = cf.dirPath;
24415
+ if (detectEntrypoint && !(0, import_utils4.isFrontendFramework)(slug)) {
24416
+ const detected = await detectEntrypoint({
24417
+ workPath: cf.dirPath,
24418
+ framework: slug
24419
+ });
24420
+ if (detected) {
24421
+ serviceConfig.entrypoint = detected.entrypoint;
24422
+ }
24423
+ }
24396
24424
  }
24397
24425
  if (cf.config.build?.buildCommand) {
24398
24426
  serviceConfig.buildCommand = cf.config.build.buildCommand;
@@ -24439,7 +24467,7 @@ var require_detect_railway = __commonJS({
24439
24467
  if (entry.type !== "dir" || SKIP_DIRS.has(entry.name)) {
24440
24468
  continue;
24441
24469
  }
24442
- const childPath = dirPath === "." ? entry.name : import_path11.posix.join(dirPath, entry.name);
24470
+ const childPath = dirPath === "." ? entry.name : import_path12.posix.join(dirPath, entry.name);
24443
24471
  const child = await findRailwayConfigs(fs5, childPath, depth + 1);
24444
24472
  configs.push(...child.configs);
24445
24473
  warnings.push(...child.warnings);
@@ -24449,7 +24477,7 @@ var require_detect_railway = __commonJS({
24449
24477
  async function readRailwayConfigRaw(fs5, dirPath) {
24450
24478
  const warnings = [];
24451
24479
  for (const filename of [RAILWAY_JSON, RAILWAY_TOML]) {
24452
- const filePath = dirPath === "." ? filename : import_path11.posix.join(dirPath, filename);
24480
+ const filePath = dirPath === "." ? filename : import_path12.posix.join(dirPath, filename);
24453
24481
  try {
24454
24482
  const exists = await fs5.isFile(filePath);
24455
24483
  if (!exists)
@@ -27411,7 +27439,7 @@ var require_detect_render = __commonJS({
27411
27439
  static: "web"
27412
27440
  };
27413
27441
  async function detectRenderServices(options) {
27414
- const { fs: fs5 } = options;
27442
+ const { fs: fs5, detectEntrypoint } = options;
27415
27443
  const raw = await readRenderYaml(fs5);
27416
27444
  if (raw.warning) {
27417
27445
  return { services: null, errors: [], warnings: [raw.warning] };
@@ -27535,7 +27563,16 @@ var require_detect_render = __commonJS({
27535
27563
  serviceConfig.type = vercelType;
27536
27564
  serviceConfig.framework = framework.slug ?? void 0;
27537
27565
  if (rootDir !== ".") {
27538
- serviceConfig.entrypoint = rootDir;
27566
+ serviceConfig.root = rootDir;
27567
+ if (detectEntrypoint && !(0, import_utils4.isFrontendFramework)(serviceConfig.framework)) {
27568
+ const detected = await detectEntrypoint({
27569
+ workPath: rootDir,
27570
+ framework: serviceConfig.framework
27571
+ });
27572
+ if (detected) {
27573
+ serviceConfig.entrypoint = detected.entrypoint;
27574
+ }
27575
+ }
27539
27576
  }
27540
27577
  const buildCommand = (0, import_utils4.combineBuildCommand)(
27541
27578
  rs.buildCommand,
@@ -27866,7 +27903,7 @@ var require_detect_services = __commonJS({
27866
27903
  generateServicesRoutes: () => generateServicesRoutes2
27867
27904
  });
27868
27905
  module.exports = __toCommonJS2(detect_services_exports);
27869
- var import_build_utils5 = __require("@vercel/build-utils");
27906
+ var import_build_utils6 = __require("@vercel/build-utils");
27870
27907
  var import_routing_utils2 = require_dist5();
27871
27908
  var import_utils4 = require_utils3();
27872
27909
  var import_resolve = require_resolve2();
@@ -27913,6 +27950,9 @@ var require_detect_services = __commonJS({
27913
27950
  if (service.type) {
27914
27951
  serviceConfig.type = service.type;
27915
27952
  }
27953
+ if (typeof service.root === "string") {
27954
+ serviceConfig.root = service.root;
27955
+ }
27916
27956
  if (typeof service.entrypoint === "string") {
27917
27957
  serviceConfig.entrypoint = service.entrypoint;
27918
27958
  }
@@ -27933,7 +27973,7 @@ var require_detect_services = __commonJS({
27933
27973
  return inferredConfig;
27934
27974
  }
27935
27975
  async function detectServices3(options) {
27936
- const { fs: fs5, workPath } = options;
27976
+ const { fs: fs5, workPath, detectEntrypoint } = options;
27937
27977
  const scopedFs = workPath ? fs5.chdir(workPath) : fs5;
27938
27978
  const { config: vercelConfig, error: configError } = await (0, import_utils4.readVercelConfig)(scopedFs);
27939
27979
  if (configError) {
@@ -27957,7 +27997,7 @@ var require_detect_services = __commonJS({
27957
27997
  { detect: import_auto_detect.autoDetectServices, source: "layout" }
27958
27998
  ];
27959
27999
  for (const { detect, source } of detectors) {
27960
- const detectResult = await detect({ fs: scopedFs });
28000
+ const detectResult = await detect({ fs: scopedFs, detectEntrypoint });
27961
28001
  const match = await tryResolveInferred(detectResult, source, scopedFs);
27962
28002
  if (match)
27963
28003
  return match;
@@ -28133,7 +28173,7 @@ var require_detect_services = __commonJS({
28133
28173
  }
28134
28174
  }
28135
28175
  }
28136
- const cronServices = services.filter(import_build_utils5.isScheduleTriggeredService);
28176
+ const cronServices = services.filter(import_build_utils6.isScheduleTriggeredService);
28137
28177
  for (const service of cronServices) {
28138
28178
  const cronPrefix = (0, import_utils4.getInternalServiceCronPathPrefix)(service.name);
28139
28179
  const functionPath = (0, import_utils4.getInternalServiceFunctionPath)(service.name);
@@ -28206,7 +28246,7 @@ var require_filesystem = __commonJS({
28206
28246
  DetectorFilesystem: () => DetectorFilesystem2
28207
28247
  });
28208
28248
  module.exports = __toCommonJS2(filesystem_exports);
28209
- var import_path11 = __require("path");
28249
+ var import_path12 = __require("path");
28210
28250
  var DetectorFilesystem2 = class {
28211
28251
  constructor() {
28212
28252
  this.hasPath = async (path) => {
@@ -28250,13 +28290,13 @@ var require_filesystem = __commonJS({
28250
28290
  }
28251
28291
  if (options?.potentialFiles) {
28252
28292
  const filesInReaddirDir = options.potentialFiles.filter(
28253
- (path) => (0, import_path11.basename)(path) === path
28293
+ (path) => (0, import_path12.basename)(path) === path
28254
28294
  );
28255
28295
  const filesThatDoNotExist = filesInReaddirDir.filter(
28256
28296
  (path) => !directoryFiles.has(path)
28257
28297
  );
28258
28298
  for (const filePath of filesThatDoNotExist) {
28259
- const fullFilePath = dirPath === "/" ? filePath : import_path11.posix.join(dirPath, filePath);
28299
+ const fullFilePath = dirPath === "/" ? filePath : import_path12.posix.join(dirPath, filePath);
28260
28300
  this.fileCache.set(fullFilePath, Promise.resolve(false));
28261
28301
  this.pathCache.set(fullFilePath, Promise.resolve(false));
28262
28302
  }
@@ -28317,7 +28357,7 @@ var require_local_file_system_detector = __commonJS({
28317
28357
  });
28318
28358
  module.exports = __toCommonJS2(local_file_system_detector_exports);
28319
28359
  var import_promises4 = __toESM2(__require("fs/promises"));
28320
- var import_path11 = __require("path");
28360
+ var import_path12 = __require("path");
28321
28361
  var import_filesystem = require_filesystem();
28322
28362
  var import_error_utils5 = require_dist();
28323
28363
  var LocalFileSystemDetector4 = class _LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
@@ -28358,7 +28398,7 @@ var require_local_file_system_detector = __commonJS({
28358
28398
  }
28359
28399
  result.push({
28360
28400
  name: entry.name,
28361
- path: (0, import_path11.join)(this.getRelativeFilePath(dir), entry.name),
28401
+ path: (0, import_path12.join)(this.getRelativeFilePath(dir), entry.name),
28362
28402
  type
28363
28403
  });
28364
28404
  }
@@ -28368,10 +28408,10 @@ var require_local_file_system_detector = __commonJS({
28368
28408
  return new _LocalFileSystemDetector(this.getFilePath(name));
28369
28409
  }
28370
28410
  getRelativeFilePath(name) {
28371
- return name.startsWith(this.rootPath) ? (0, import_path11.relative)(this.rootPath, name) : name;
28411
+ return name.startsWith(this.rootPath) ? (0, import_path12.relative)(this.rootPath, name) : name;
28372
28412
  }
28373
28413
  getFilePath(name) {
28374
- return (0, import_path11.join)(this.rootPath, this.getRelativeFilePath(name));
28414
+ return (0, import_path12.join)(this.rootPath, this.getRelativeFilePath(name));
28375
28415
  }
28376
28416
  };
28377
28417
  }
@@ -28555,10 +28595,10 @@ var require_detect_builders = __commonJS({
28555
28595
  module.exports = __toCommonJS2(detect_builders_exports);
28556
28596
  var import_minimatch = __toESM2(require_minimatch());
28557
28597
  var import_semver = require_semver();
28558
- var import_path11 = __require("path");
28598
+ var import_path12 = __require("path");
28559
28599
  var import_frameworks2 = require_frameworks();
28560
28600
  var import_is_official_runtime = require_is_official_runtime();
28561
- var import_build_utils5 = __require("@vercel/build-utils");
28601
+ var import_build_utils6 = __require("@vercel/build-utils");
28562
28602
  var import_get_services_builders = require_get_services_builders();
28563
28603
  var REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
28564
28604
  var REGEX_VERCEL_PLATFORM_FILES = [
@@ -28585,7 +28625,7 @@ var require_detect_builders = __commonJS({
28585
28625
  return new Set(
28586
28626
  builders.filter(
28587
28627
  (b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith("api/"))
28588
- ).map((b) => (0, import_path11.extname)(b.src)).filter(Boolean)
28628
+ ).map((b) => (0, import_path12.extname)(b.src)).filter(Boolean)
28589
28629
  );
28590
28630
  }
28591
28631
  function detectApiDirectory2(builders) {
@@ -28834,16 +28874,16 @@ var require_detect_builders = __commonJS({
28834
28874
  return null;
28835
28875
  }
28836
28876
  if (fileName.endsWith(".py") && options.workPath) {
28837
- const fsPath = (0, import_path11.join)(options.workPath, fileName);
28838
- const isEntrypoint = await (0, import_build_utils5.isPythonEntrypoint)({ fsPath });
28877
+ const fsPath = (0, import_path12.join)(options.workPath, fileName);
28878
+ const isEntrypoint = await (0, import_build_utils6.isPythonEntrypoint)({ fsPath });
28839
28879
  if (!isEntrypoint) {
28840
28880
  return null;
28841
28881
  }
28842
28882
  }
28843
28883
  const nodeExtensions = [".js", ".mjs", ".ts", ".tsx"];
28844
28884
  if (fileName.startsWith("api/") && process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
28845
- const fsPath = (0, import_path11.join)(options.workPath, fileName);
28846
- const isEntrypoint = await (0, import_build_utils5.isNodeEntrypoint)({ fsPath });
28885
+ const fsPath = (0, import_path12.join)(options.workPath, fileName);
28886
+ const isEntrypoint = await (0, import_build_utils6.isNodeEntrypoint)({ fsPath });
28847
28887
  if (!isEntrypoint) {
28848
28888
  return null;
28849
28889
  }
@@ -28953,8 +28993,8 @@ var require_detect_builders = __commonJS({
28953
28993
  const f = slugToFramework.get(framework || "");
28954
28994
  if (f && f.useRuntime) {
28955
28995
  const { src, use } = f.useRuntime;
28956
- const shouldUseUnifiedBackend = (0, import_build_utils5.isExperimentalBackendsEnabled)() && import_build_utils5.BACKEND_BUILDERS.includes(use);
28957
- const finalUse = shouldUseUnifiedBackend ? import_build_utils5.UNIFIED_BACKEND_BUILDER : use;
28996
+ const shouldUseUnifiedBackend = (0, import_build_utils6.isExperimentalBackendsEnabled)() && import_build_utils6.BACKEND_BUILDERS.includes(use);
28997
+ const finalUse = shouldUseUnifiedBackend ? import_build_utils6.UNIFIED_BACKEND_BUILDER : use;
28958
28998
  return { src, use: `${finalUse}${withTag}`, config };
28959
28999
  }
28960
29000
  const entrypoints = /* @__PURE__ */ new Set([
@@ -29131,14 +29171,14 @@ var require_detect_builders = __commonJS({
29131
29171
  return null;
29132
29172
  }
29133
29173
  function getSegmentName(segment) {
29134
- const { name } = (0, import_path11.parse)(segment);
29174
+ const { name } = (0, import_path12.parse)(segment);
29135
29175
  if (name.startsWith("[") && name.endsWith("]")) {
29136
29176
  return name.slice(1, -1);
29137
29177
  }
29138
29178
  return null;
29139
29179
  }
29140
29180
  function getAbsolutePath(unresolvedPath) {
29141
- const { dir, name } = (0, import_path11.parse)(unresolvedPath);
29181
+ const { dir, name } = (0, import_path12.parse)(unresolvedPath);
29142
29182
  const parts = joinPath(dir, name).split("/");
29143
29183
  return parts.map((part) => part.replace(/\[.*\]/, "1")).join("/");
29144
29184
  }
@@ -29217,7 +29257,7 @@ var require_detect_builders = __commonJS({
29217
29257
  isDynamic = true;
29218
29258
  return `([^/]+)`;
29219
29259
  } else if (isLast) {
29220
- const { name: fileName2, ext: ext2 } = (0, import_path11.parse)(segment);
29260
+ const { name: fileName2, ext: ext2 } = (0, import_path12.parse)(segment);
29221
29261
  const isIndex2 = fileName2 === "index";
29222
29262
  const prefix = isIndex2 ? "/" : "";
29223
29263
  const names = [
@@ -29229,7 +29269,7 @@ var require_detect_builders = __commonJS({
29229
29269
  }
29230
29270
  return segment;
29231
29271
  });
29232
- const { name: fileName, ext } = (0, import_path11.parse)(filePath);
29272
+ const { name: fileName, ext } = (0, import_path12.parse)(filePath);
29233
29273
  const isIndex = fileName === "index";
29234
29274
  const queryString = `${query.length ? "?" : ""}${query.join("&")}`;
29235
29275
  const src = isIndex ? `^/${srcParts.slice(0, -1).join("/")}${srcParts.slice(-1)[0]}$` : `^/${srcParts.join("/")}$`;
@@ -29757,11 +29797,11 @@ var require_get_workspaces = __commonJS({
29757
29797
  getWorkspaces: () => getWorkspaces3
29758
29798
  });
29759
29799
  module.exports = __toCommonJS2(get_workspaces_exports);
29760
- var import_path11 = __toESM2(__require("path"));
29800
+ var import_path12 = __toESM2(__require("path"));
29761
29801
  var import_workspace_managers = require_workspace_managers();
29762
29802
  var import_detect_framework = require_detect_framework();
29763
29803
  var MAX_DEPTH_TRAVERSE = 3;
29764
- var posixPath = import_path11.default.posix;
29804
+ var posixPath = import_path12.default.posix;
29765
29805
  async function getWorkspaces3({
29766
29806
  fs: fs5,
29767
29807
  depth = MAX_DEPTH_TRAVERSE,
@@ -33212,12 +33252,12 @@ var require_get_workspace_package_paths = __commonJS({
33212
33252
  getWorkspacePackagePaths: () => getWorkspacePackagePaths3
33213
33253
  });
33214
33254
  module.exports = __toCommonJS2(get_workspace_package_paths_exports);
33215
- var import_path11 = __toESM2(__require("path"));
33255
+ var import_path12 = __toESM2(__require("path"));
33216
33256
  var import_js_yaml = __toESM2(require_js_yaml3());
33217
33257
  var import_glob = __toESM2(require_glob());
33218
33258
  var import_json5 = __toESM2(require_lib5());
33219
33259
  var import_get_glob_fs = require_get_glob_fs();
33220
- var posixPath = import_path11.default.posix;
33260
+ var posixPath = import_path12.default.posix;
33221
33261
  async function getWorkspacePackagePaths3({
33222
33262
  fs: fs5,
33223
33263
  workspace
@@ -33247,13 +33287,13 @@ var require_get_workspace_package_paths = __commonJS({
33247
33287
  });
33248
33288
  }
33249
33289
  var isWin = process.platform === "win32";
33250
- var normalizePath2 = (p) => isWin ? p.replace(/\\/g, "/") : p;
33290
+ var normalizePath3 = (p) => isWin ? p.replace(/\\/g, "/") : p;
33251
33291
  async function getPackagePaths(packages, fs5) {
33252
33292
  return (await Promise.all(
33253
33293
  packages.map(
33254
33294
  (packageGlob) => new Promise((resolve4, reject) => {
33255
33295
  (0, import_glob.default)(
33256
- normalizePath2(posixPath.join(packageGlob, "package.json")),
33296
+ normalizePath3(posixPath.join(packageGlob, "package.json")),
33257
33297
  {
33258
33298
  cwd: "/",
33259
33299
  fs: (0, import_get_glob_fs.getGlobFs)(fs5)
@@ -33584,7 +33624,7 @@ var require_get_monorepo_default_settings = __commonJS({
33584
33624
  getMonorepoDefaultSettings: () => getMonorepoDefaultSettings
33585
33625
  });
33586
33626
  module.exports = __toCommonJS2(get_monorepo_default_settings_exports);
33587
- var import_path11 = __require("path");
33627
+ var import_path12 = __require("path");
33588
33628
  var import_monorepo_managers = require_monorepo_managers();
33589
33629
  var import_package_managers = require_package_managers();
33590
33630
  var import_detect_framework = require_detect_framework();
@@ -33688,8 +33728,8 @@ var require_get_monorepo_default_settings = __commonJS({
33688
33728
  const nxJSON = import_json5.default.parse(nxJSONBuf.toString("utf-8"));
33689
33729
  if (!nxJSON?.targetDefaults?.build) {
33690
33730
  const [projectJSONBuf, packageJSONBuf] = await Promise.all([
33691
- detectorFilesystem.readFile((0, import_path11.join)(projectPath, "project.json")).catch(() => null),
33692
- detectorFilesystem.readFile((0, import_path11.join)(projectPath, "package.json")).catch(() => null)
33731
+ detectorFilesystem.readFile((0, import_path12.join)(projectPath, "project.json")).catch(() => null),
33732
+ detectorFilesystem.readFile((0, import_path12.join)(projectPath, "package.json")).catch(() => null)
33693
33733
  ]);
33694
33734
  let hasBuildTarget = false;
33695
33735
  if (projectJSONBuf) {
@@ -36591,7 +36631,7 @@ var require_package = __commonJS({
36591
36631
  "../client/package.json"(exports, module) {
36592
36632
  module.exports = {
36593
36633
  name: "@vercel/client",
36594
- version: "17.5.2",
36634
+ version: "17.5.3",
36595
36635
  main: "dist/index.js",
36596
36636
  typings: "dist/index.d.ts",
36597
36637
  homepage: "https://vercel.com",
@@ -36714,7 +36754,7 @@ var require_readdir_recursive = __commonJS({
36714
36754
  });
36715
36755
  module.exports = __toCommonJS2(readdir_recursive_exports);
36716
36756
  var import_fs4 = __toESM2(__require("fs"));
36717
- var import_path11 = __toESM2(__require("path"));
36757
+ var import_path12 = __toESM2(__require("path"));
36718
36758
  var import_minimatch = __toESM2(require_minimatch2());
36719
36759
  function patternMatcher(pattern) {
36720
36760
  return function(path, stats) {
@@ -36742,7 +36782,7 @@ var require_readdir_recursive = __commonJS({
36742
36782
  return resolve4(list2);
36743
36783
  }
36744
36784
  files.forEach(function(file) {
36745
- const filePath = import_path11.default.join(path, file);
36785
+ const filePath = import_path12.default.join(path, file);
36746
36786
  import_fs4.default.lstat(filePath, function(_err, stats) {
36747
36787
  if (_err) {
36748
36788
  return reject(_err);
@@ -44252,11 +44292,11 @@ var require_utils9 = __commonJS({
44252
44292
  });
44253
44293
  module.exports = __toCommonJS2(utils_exports);
44254
44294
  var import_node_fetch = __toESM2(require_lib2());
44255
- var import_path11 = __require("path");
44295
+ var import_path12 = __require("path");
44256
44296
  var import_url4 = __require("url");
44257
44297
  var import_ignore = __toESM2(require_ignore());
44258
44298
  var import_pkg = require_pkg();
44259
- var import_build_utils5 = __require("@vercel/build-utils");
44299
+ var import_build_utils6 = __require("@vercel/build-utils");
44260
44300
  var import_async_sema = require_lib7();
44261
44301
  var import_fs_extra9 = require_lib6();
44262
44302
  var import_readdir_recursive = __toESM2(require_readdir_recursive());
@@ -44328,7 +44368,7 @@ var require_utils9 = __commonJS({
44328
44368
  debug("Building file tree...");
44329
44369
  if (isDirectory2 && !Array.isArray(path)) {
44330
44370
  const ignores2 = (absPath) => {
44331
- const rel = (0, import_path11.relative)(path, absPath);
44371
+ const rel = (0, import_path12.relative)(path, absPath);
44332
44372
  const ignored = ig.ignores(rel);
44333
44373
  if (ignored) {
44334
44374
  ignoreList.push(rel);
@@ -44339,7 +44379,7 @@ var require_utils9 = __commonJS({
44339
44379
  const refs = /* @__PURE__ */ new Set();
44340
44380
  if (prebuilt) {
44341
44381
  const vcConfigFilePaths = fileList.filter(
44342
- (file) => (0, import_path11.basename)(file) === ".vc-config.json"
44382
+ (file) => (0, import_path12.basename)(file) === ".vc-config.json"
44343
44383
  );
44344
44384
  await Promise.all(
44345
44385
  vcConfigFilePaths.map(async (p) => {
@@ -44348,13 +44388,13 @@ var require_utils9 = __commonJS({
44348
44388
  if (!config.filePathMap)
44349
44389
  return;
44350
44390
  for (const v of Object.values(config.filePathMap)) {
44351
- refs.add((0, import_path11.join)(path, v));
44391
+ refs.add((0, import_path12.join)(path, v));
44352
44392
  }
44353
44393
  })
44354
44394
  );
44355
44395
  try {
44356
44396
  let microfrontendConfigPath = (0, import_utils4.findConfig)({
44357
- dir: (0, import_path11.join)(path, rootDirectory || "")
44397
+ dir: (0, import_path12.join)(path, rootDirectory || "")
44358
44398
  });
44359
44399
  if (!microfrontendConfigPath && !rootDirectory && projectName) {
44360
44400
  microfrontendConfigPath = (0, import_utils4.findConfig)({
@@ -44372,7 +44412,7 @@ var require_utils9 = __commonJS({
44372
44412
  }
44373
44413
  }
44374
44414
  try {
44375
- const routesJsonPath = (0, import_path11.join)(path, ".vercel", "routes.json");
44415
+ const routesJsonPath = (0, import_path12.join)(path, ".vercel", "routes.json");
44376
44416
  const routesJsonContent = await maybeRead(routesJsonPath, null);
44377
44417
  if (routesJsonContent !== null) {
44378
44418
  refs.add(routesJsonPath);
@@ -44384,12 +44424,12 @@ var require_utils9 = __commonJS({
44384
44424
  if (prebuilt && bulkRedirectsPath) {
44385
44425
  try {
44386
44426
  const projectRoot = path;
44387
- const bulkRedirectsFullPath = (0, import_path11.join)(
44427
+ const bulkRedirectsFullPath = (0, import_path12.join)(
44388
44428
  projectRoot,
44389
44429
  rootDirectory || "",
44390
44430
  bulkRedirectsPath
44391
44431
  );
44392
- const relativeFromRoot = (0, import_path11.relative)(projectRoot, bulkRedirectsFullPath);
44432
+ const relativeFromRoot = (0, import_path12.relative)(projectRoot, bulkRedirectsFullPath);
44393
44433
  if (relativeFromRoot.startsWith("..")) {
44394
44434
  debug(
44395
44435
  `Skipping bulk redirects path "${bulkRedirectsPath}" - path traversal detected (resolves outside project root)`
@@ -44444,9 +44484,9 @@ var require_utils9 = __commonJS({
44444
44484
  if (typeof cwd !== "string") {
44445
44485
  throw new Error(`\`cwd\` must be a "string"`);
44446
44486
  }
44447
- const relOutputDir = (0, import_path11.relative)(cwd, vercelOutputDir);
44487
+ const relOutputDir = (0, import_path12.relative)(cwd, vercelOutputDir);
44448
44488
  ignores = ["*"];
44449
- const parts = relOutputDir.split(import_path11.sep);
44489
+ const parts = relOutputDir.split(import_path12.sep);
44450
44490
  parts.forEach((_, i) => {
44451
44491
  const level = parts.slice(0, i + 1).join("/");
44452
44492
  ignores.push(`!${level}`);
@@ -44486,11 +44526,11 @@ var require_utils9 = __commonJS({
44486
44526
  const files = await Promise.all(
44487
44527
  cwds.map(async (cwd2) => {
44488
44528
  const [vercelignore, nowignore] = await Promise.all([
44489
- maybeRead((0, import_path11.join)(cwd2, ".vercelignore"), ""),
44490
- maybeRead((0, import_path11.join)(cwd2, ".nowignore"), "")
44529
+ maybeRead((0, import_path12.join)(cwd2, ".vercelignore"), ""),
44530
+ maybeRead((0, import_path12.join)(cwd2, ".nowignore"), "")
44491
44531
  ]);
44492
44532
  if (vercelignore && nowignore) {
44493
- throw new import_build_utils5.NowBuildError({
44533
+ throw new import_build_utils6.NowBuildError({
44494
44534
  code: "CONFLICTING_IGNORE_FILES",
44495
44535
  message: "Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.",
44496
44536
  link: "https://vercel.link/combining-old-and-new-config"
@@ -44546,9 +44586,9 @@ ${clearRelative(ignoreFile)}`);
44546
44586
  for (const name of file.names) {
44547
44587
  let fileName;
44548
44588
  if (clientOptions.isDirectory) {
44549
- fileName = typeof clientOptions.path === "string" ? (0, import_path11.relative)(clientOptions.path, name) : name;
44589
+ fileName = typeof clientOptions.path === "string" ? (0, import_path12.relative)(clientOptions.path, name) : name;
44550
44590
  } else {
44551
- const segments = name.split(import_path11.sep);
44591
+ const segments = name.split(import_path12.sep);
44552
44592
  fileName = segments[segments.length - 1];
44553
44593
  }
44554
44594
  preparedFiles.push({
@@ -45933,7 +45973,7 @@ var require_BufferList = __commonJS({
45933
45973
  this.head = this.tail = null;
45934
45974
  this.length = 0;
45935
45975
  };
45936
- BufferList.prototype.join = function join10(s) {
45976
+ BufferList.prototype.join = function join11(s) {
45937
45977
  if (this.length === 0)
45938
45978
  return "";
45939
45979
  var p = this.head;
@@ -49525,7 +49565,7 @@ var require_archive = __commonJS({
49525
49565
  module.exports = __toCommonJS2(archive_exports);
49526
49566
  var import_node_path2 = __require("path");
49527
49567
  var import_node_zlib = __require("zlib");
49528
- var import_build_utils5 = __require("@vercel/build-utils");
49568
+ var import_build_utils6 = __require("@vercel/build-utils");
49529
49569
  var import_tar_fs = __toESM2(require_tar_fs());
49530
49570
  var import_hashes = require_hashes();
49531
49571
  async function createTgzFiles(workPath, fileList, debug, exclude) {
@@ -49534,7 +49574,7 @@ var require_archive = __commonJS({
49534
49574
  const tarStream = import_tar_fs.default.pack(workPath, {
49535
49575
  entries: filesToArchive.map((file) => (0, import_node_path2.relative)(workPath, file))
49536
49576
  }).pipe((0, import_node_zlib.createGzip)());
49537
- const chunkedTarBuffers = await (0, import_build_utils5.streamToBufferChunks)(tarStream);
49577
+ const chunkedTarBuffers = await (0, import_build_utils6.streamToBufferChunks)(tarStream);
49538
49578
  debug?.(`Packed tarball into ${chunkedTarBuffers.length} chunks`);
49539
49579
  return new Map(
49540
49580
  chunkedTarBuffers.map((chunk, index) => [
@@ -49577,7 +49617,7 @@ var require_create_deployment = __commonJS({
49577
49617
  });
49578
49618
  module.exports = __toCommonJS2(create_deployment_exports);
49579
49619
  var import_fs_extra9 = require_lib6();
49580
- var import_path11 = __require("path");
49620
+ var import_path12 = __require("path");
49581
49621
  var import_hashes = require_hashes();
49582
49622
  var import_deploy = require_deploy();
49583
49623
  var import_upload = require_upload();
@@ -49627,14 +49667,14 @@ var require_create_deployment = __commonJS({
49627
49667
  clientOptions.isDirectory = !Array.isArray(path) && (0, import_fs_extra9.lstatSync)(path).isDirectory();
49628
49668
  if (Array.isArray(path)) {
49629
49669
  for (const filePath of path) {
49630
- if (!(0, import_path11.isAbsolute)(filePath)) {
49670
+ if (!(0, import_path12.isAbsolute)(filePath)) {
49631
49671
  throw new import_errors3.DeploymentError({
49632
49672
  code: "invalid_path",
49633
49673
  message: `Provided path ${filePath} is not absolute`
49634
49674
  });
49635
49675
  }
49636
49676
  }
49637
- } else if (!(0, import_path11.isAbsolute)(path)) {
49677
+ } else if (!(0, import_path12.isAbsolute)(path)) {
49638
49678
  throw new import_errors3.DeploymentError({
49639
49679
  code: "invalid_path",
49640
49680
  message: `Provided path ${path} is not absolute`
@@ -49665,9 +49705,9 @@ var require_create_deployment = __commonJS({
49665
49705
  }
49666
49706
  } catch (err) {
49667
49707
  if (clientOptions.prebuilt && (0, import_error_utils5.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
49668
- const errPath = (0, import_path11.relative)(workPath, err.path);
49669
- err.message = `File does not exist: "${(0, import_path11.relative)(workPath, errPath)}"`;
49670
- if (errPath.split(import_path11.sep).includes("node_modules")) {
49708
+ const errPath = (0, import_path12.relative)(workPath, err.path);
49709
+ err.message = `File does not exist: "${(0, import_path12.relative)(workPath, errPath)}"`;
49710
+ if (errPath.split(import_path12.sep).includes("node_modules")) {
49671
49711
  err.message = `Please ensure project dependencies have been installed:
49672
49712
  ${err.message}`;
49673
49713
  }
@@ -49730,7 +49770,7 @@ var require_continue = __commonJS({
49730
49770
  continueDeployment: () => continueDeployment2
49731
49771
  });
49732
49772
  module.exports = __toCommonJS2(continue_exports);
49733
- var import_path11 = __require("path");
49773
+ var import_path12 = __require("path");
49734
49774
  var import_fs_extra9 = __toESM2(require_lib6());
49735
49775
  var import_check_deployment_status = require_check_deployment_status();
49736
49776
  var import_utils4 = require_utils9();
@@ -49742,7 +49782,7 @@ var require_continue = __commonJS({
49742
49782
  async function* continueDeployment2(options) {
49743
49783
  const debug = (0, import_utils4.createDebug)(options.debug);
49744
49784
  debug(`Continuing deployment: ${options.deploymentId}`);
49745
- const outputDir = options.vercelOutputDir || (0, import_path11.join)(options.path, ".vercel", "output");
49785
+ const outputDir = options.vercelOutputDir || (0, import_path12.join)(options.path, ".vercel", "output");
49746
49786
  if (!await import_fs_extra9.default.pathExists(outputDir)) {
49747
49787
  return yield {
49748
49788
  type: "error",
@@ -49757,7 +49797,7 @@ var require_continue = __commonJS({
49757
49797
  { isDirectory: true, prebuilt: true, vercelOutputDir: outputDir },
49758
49798
  debug
49759
49799
  );
49760
- const provisionJsonPath = (0, import_path11.join)(outputDir, "provision.json");
49800
+ const provisionJsonPath = (0, import_path12.join)(outputDir, "provision.json");
49761
49801
  const unbundledFiles = fileList.filter((f) => f === provisionJsonPath);
49762
49802
  let files;
49763
49803
  if (options.archive === "tgz") {
@@ -50008,7 +50048,7 @@ var require_dist7 = __commonJS({
50008
50048
  // src/util/compile-vercel-config.ts
50009
50049
  var import_dotenv = __toESM(require_main(), 1);
50010
50050
  import { mkdir, readFile as readFile5, writeFile as writeFile4, unlink, access } from "fs/promises";
50011
- import { join as join9, basename as basename3 } from "path";
50051
+ import { join as join10, basename as basename3 } from "path";
50012
50052
  import { fork } from "child_process";
50013
50053
  import { parse as tomlParse2 } from "smol-toml";
50014
50054
 
@@ -50016,7 +50056,7 @@ import { parse as tomlParse2 } from "smol-toml";
50016
50056
  var import_ajv2 = __toESM(require_ajv(), 1);
50017
50057
  var import_fs_extra8 = __toESM(require_lib3(), 1);
50018
50058
  import fs4 from "fs";
50019
- import { join as join8, relative } from "path";
50059
+ import { join as join9, relative } from "path";
50020
50060
  import { promisify } from "util";
50021
50061
 
50022
50062
  // src/util/projects/get-project-by-id-or-name.ts
@@ -50082,6 +50122,27 @@ async function getTeamById(client, teamId) {
50082
50122
  return team;
50083
50123
  }
50084
50124
 
50125
+ // src/util/projects/get-org-by-id.ts
50126
+ async function getOrgById(client, orgId) {
50127
+ if (orgId.startsWith("team_")) {
50128
+ try {
50129
+ const team = await getTeamById(client, orgId);
50130
+ if (!team)
50131
+ return null;
50132
+ return { type: "team", id: team.id, slug: team.slug };
50133
+ } catch (err) {
50134
+ if (isAPIError(err) && (err.status === 404 || err.code === "not_found" || err.code === "mock_unimplemented")) {
50135
+ return null;
50136
+ }
50137
+ throw err;
50138
+ }
50139
+ }
50140
+ const user = await getUser(client);
50141
+ if (user.id !== orgId)
50142
+ return null;
50143
+ return { type: "user", id: orgId, slug: user.username };
50144
+ }
50145
+
50085
50146
  // src/util/fs.ts
50086
50147
  import fs from "fs";
50087
50148
  function isDirectory(targetPath) {
@@ -53358,7 +53419,7 @@ async function envPullCommandLogic(client, filename, skipConfirmation, environme
53358
53419
  let isGitIgnoreUpdated = false;
53359
53420
  if (filename === ".env.local") {
53360
53421
  const rootPath = link.repoRoot ?? cwd;
53361
- isGitIgnoreUpdated = await addToGitIgnore(rootPath, ".env*.local");
53422
+ isGitIgnoreUpdated = await addToGitIgnore(rootPath, ".env*");
53362
53423
  }
53363
53424
  output_manager_default.print(
53364
53425
  `${prependEmoji(
@@ -53376,12 +53437,12 @@ function escapeValue(value) {
53376
53437
  var import_chalk12 = __toESM(require_source(), 1);
53377
53438
  var import_fs_extra7 = __toESM(require_lib3(), 1);
53378
53439
  import { stat } from "fs/promises";
53379
- import { join as join7, dirname } from "path";
53440
+ import { join as join8, dirname } from "path";
53380
53441
 
53381
53442
  // src/util/projects/detect-services.ts
53382
53443
  var import_fs_detectors2 = __toESM(require_dist6(), 1);
53383
53444
  import { readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
53384
- import { basename as basename2, join as join6 } from "path";
53445
+ import { basename as basename2, join as join7 } from "path";
53385
53446
  import { parse as tomlParse, stringify as tomlStringify } from "smol-toml";
53386
53447
 
53387
53448
  // src/util/is-vercel-toml-enabled.ts
@@ -54085,6 +54146,39 @@ function validateConfig(config) {
54085
54146
  return null;
54086
54147
  }
54087
54148
 
54149
+ // src/util/projects/detect-entrypoint.ts
54150
+ import { join as join6 } from "path";
54151
+ import {
54152
+ isPythonFramework,
54153
+ isNodeBackendFramework,
54154
+ normalizePath as normalizePath2
54155
+ } from "@vercel/build-utils";
54156
+ function createDetectEntrypoint(projectRoot) {
54157
+ return async ({ workPath, framework }) => {
54158
+ const absWorkPath = normalizePath2(join6(projectRoot, workPath));
54159
+ if (isPythonFramework(framework)) {
54160
+ const { detectEntrypoint } = await import("@vercel/python");
54161
+ return detectEntrypoint({
54162
+ workPath: absWorkPath,
54163
+ framework
54164
+ });
54165
+ }
54166
+ if (isNodeBackendFramework(framework)) {
54167
+ const { detectEntrypoint } = await import("@vercel/backends");
54168
+ return detectEntrypoint({
54169
+ workPath: absWorkPath
54170
+ });
54171
+ }
54172
+ if (framework === "go") {
54173
+ const { detectEntrypoint } = await import("@vercel/go");
54174
+ return detectEntrypoint({
54175
+ workPath: absWorkPath
54176
+ });
54177
+ }
54178
+ return null;
54179
+ };
54180
+ }
54181
+
54088
54182
  // src/util/projects/detect-services.ts
54089
54183
  async function isExperimentalServicesEnabled(cwd) {
54090
54184
  return process.env.VERCEL_USE_EXPERIMENTAL_SERVICES === "1" || process.env.VERCEL_USE_EXPERIMENTAL_SERVICES?.toLowerCase() === "true" || await hasExperimentalServicesConfig(cwd);
@@ -54110,7 +54204,10 @@ async function tryDetectServices(cwd) {
54110
54204
  return null;
54111
54205
  }
54112
54206
  const fs5 = new import_fs_detectors2.LocalFileSystemDetector(cwd);
54113
- const result = await (0, import_fs_detectors2.detectServices)({ fs: fs5 });
54207
+ const result = await (0, import_fs_detectors2.detectServices)({
54208
+ fs: fs5,
54209
+ detectEntrypoint: createDetectEntrypoint(cwd)
54210
+ });
54114
54211
  const hasNoServicesError = result.errors.some(
54115
54212
  (e) => e.code === "NO_SERVICES_CONFIGURED"
54116
54213
  );
@@ -54139,9 +54236,9 @@ function toProjectServicesConfigPatch(config) {
54139
54236
  }
54140
54237
  async function prepareServicesConfigWrite(cwd, config) {
54141
54238
  const compileResult = await compileVercelConfig(cwd);
54142
- const configPath = join6(cwd, "vercel.json");
54239
+ const configPath = join7(cwd, "vercel.json");
54143
54240
  if (isVercelTomlEnabled() && compileResult.sourceFile === "vercel.toml") {
54144
- return prepareTomlServicesConfigWrite(join6(cwd, "vercel.toml"), config);
54241
+ return prepareTomlServicesConfigWrite(join7(cwd, "vercel.toml"), config);
54145
54242
  }
54146
54243
  if (compileResult.wasCompiled) {
54147
54244
  throw new Error(
@@ -54221,10 +54318,10 @@ async function findProjectRoot(startDir) {
54221
54318
  } catch {
54222
54319
  return null;
54223
54320
  }
54224
- const hasVercelDir = await (0, import_fs_extra7.pathExists)(join7(dir, ".vercel"));
54225
- const hasVercelJson = await (0, import_fs_extra7.pathExists)(join7(dir, "vercel.json"));
54226
- const hasVercelToml = isVercelTomlEnabled() && await (0, import_fs_extra7.pathExists)(join7(dir, "vercel.toml"));
54227
- const hasGit = await (0, import_fs_extra7.pathExists)(join7(dir, ".git"));
54321
+ const hasVercelDir = await (0, import_fs_extra7.pathExists)(join8(dir, ".vercel"));
54322
+ const hasVercelJson = await (0, import_fs_extra7.pathExists)(join8(dir, "vercel.json"));
54323
+ const hasVercelToml = isVercelTomlEnabled() && await (0, import_fs_extra7.pathExists)(join8(dir, "vercel.toml"));
54324
+ const hasGit = await (0, import_fs_extra7.pathExists)(join8(dir, ".git"));
54228
54325
  if (hasVercelDir || hasVercelJson || hasVercelToml || hasGit) {
54229
54326
  return dir;
54230
54327
  }
@@ -54275,7 +54372,7 @@ var linkSchema = {
54275
54372
  }
54276
54373
  };
54277
54374
  function getVercelDirectory(cwd) {
54278
- const possibleDirs = [join8(cwd, VERCEL_DIR), join8(cwd, VERCEL_DIR_FALLBACK)];
54375
+ const possibleDirs = [join9(cwd, VERCEL_DIR), join9(cwd, VERCEL_DIR_FALLBACK)];
54279
54376
  const existingDirs = possibleDirs.filter((d) => isDirectory(d));
54280
54377
  if (existingDirs.length > 1) {
54281
54378
  throw new NowBuildError2({
@@ -54286,14 +54383,24 @@ function getVercelDirectory(cwd) {
54286
54383
  }
54287
54384
  return existingDirs[0] || possibleDirs[0];
54288
54385
  }
54289
- async function getProjectLink(client, path, projectName) {
54386
+ async function getProjectLink(client, path, projectName, projectNameIsExplicit) {
54290
54387
  const dirLink = await getLinkFromDir(getVercelDirectory(path));
54291
54388
  if (dirLink) {
54292
- return dirLink;
54389
+ if (!projectNameIsExplicit || !projectName) {
54390
+ return dirLink;
54391
+ }
54392
+ if (dirLink.projectId === projectName || dirLink.projectName === projectName) {
54393
+ return dirLink;
54394
+ }
54293
54395
  }
54294
- return await getProjectLinkFromRepoLink(client, path, projectName);
54396
+ return await getProjectLinkFromRepoLink(
54397
+ client,
54398
+ path,
54399
+ projectName,
54400
+ projectNameIsExplicit
54401
+ );
54295
54402
  }
54296
- async function getProjectLinkFromRepoLink(client, path, projectName) {
54403
+ async function getProjectLinkFromRepoLink(client, path, projectName, projectNameIsExplicit) {
54297
54404
  const repoLink = await getRepoLink(client, path);
54298
54405
  if (!repoLink?.repoConfig) {
54299
54406
  return null;
@@ -54303,12 +54410,18 @@ async function getProjectLinkFromRepoLink(client, path, projectName) {
54303
54410
  relative(repoLink.rootPath, path)
54304
54411
  );
54305
54412
  let project;
54306
- if (projects.length === 1) {
54413
+ if (projectName && projectNameIsExplicit) {
54414
+ project = repoLink.repoConfig.projects.find(
54415
+ (p) => p.id === projectName || p.name === projectName
54416
+ );
54417
+ } else if (projects.length === 1) {
54307
54418
  project = projects[0];
54308
54419
  } else {
54309
54420
  const selectableProjects = projects.length > 0 ? projects : repoLink.repoConfig.projects;
54310
54421
  if (projectName) {
54311
- project = selectableProjects.find((p) => p.name === projectName);
54422
+ project = selectableProjects.find(
54423
+ (p) => p.id === projectName || p.name === projectName
54424
+ );
54312
54425
  }
54313
54426
  if (!project) {
54314
54427
  if (client.nonInteractive) {
@@ -54351,7 +54464,7 @@ async function getProjectLinkFromRepoLink(client, path, projectName) {
54351
54464
  }
54352
54465
  async function getLinkFromDir(dir) {
54353
54466
  try {
54354
- const json = await readFile4(join8(dir, VERCEL_DIR_PROJECT), "utf8");
54467
+ const json = await readFile4(join9(dir, VERCEL_DIR_PROJECT), "utf8");
54355
54468
  const ajv2 = new import_ajv2.default();
54356
54469
  const link = JSON.parse(json);
54357
54470
  if (!ajv2.validate(linkSchema, link)) {
@@ -54379,25 +54492,6 @@ async function getLinkFromDir(dir) {
54379
54492
  throw err;
54380
54493
  }
54381
54494
  }
54382
- async function getOrgById(client, orgId) {
54383
- if (orgId.startsWith("team_")) {
54384
- try {
54385
- const team = await getTeamById(client, orgId);
54386
- if (!team)
54387
- return null;
54388
- return { type: "team", id: team.id, slug: team.slug };
54389
- } catch (err) {
54390
- if (isAPIError(err) && (err.status === 404 || err.code === "not_found" || err.code === "mock_unimplemented")) {
54391
- return null;
54392
- }
54393
- throw err;
54394
- }
54395
- }
54396
- const user = await getUser(client);
54397
- if (user.id !== orgId)
54398
- return null;
54399
- return { type: "user", id: orgId, slug: user.username };
54400
- }
54401
54495
  async function hasProjectLink(client, projectLink, path) {
54402
54496
  const VERCEL_ORG_ID = getPlatformEnv("ORG_ID");
54403
54497
  const VERCEL_PROJECT_ID = getPlatformEnv("PROJECT_ID");
@@ -54427,7 +54521,7 @@ async function hasProjectLink(client, projectLink, path) {
54427
54521
  }
54428
54522
  return false;
54429
54523
  }
54430
- async function getLinkedProject(client, path = client.cwd, projectName) {
54524
+ async function getLinkedProject(client, path = client.cwd, projectName, apiFallback) {
54431
54525
  path = await resolveProjectCwd(path);
54432
54526
  const VERCEL_ORG_ID = getPlatformEnv("ORG_ID");
54433
54527
  const VERCEL_PROJECT_ID = getPlatformEnv("PROJECT_ID");
@@ -54439,7 +54533,19 @@ async function getLinkedProject(client, path = client.cwd, projectName) {
54439
54533
  );
54440
54534
  return { status: "error", exitCode: 1 };
54441
54535
  }
54442
- const link = VERCEL_ORG_ID && VERCEL_PROJECT_ID ? { orgId: VERCEL_ORG_ID, projectId: VERCEL_PROJECT_ID } : await getProjectLink(client, path, projectName);
54536
+ let link = VERCEL_ORG_ID && VERCEL_PROJECT_ID ? { orgId: VERCEL_ORG_ID, projectId: VERCEL_PROJECT_ID } : await getProjectLink(client, path, projectName, apiFallback);
54537
+ if (!link && projectName && apiFallback) {
54538
+ try {
54539
+ const apiProject = await getProjectByNameOrId(client, projectName);
54540
+ if (!(apiProject instanceof ProjectNotFound)) {
54541
+ link = {
54542
+ projectId: apiProject.id,
54543
+ orgId: apiProject.accountId
54544
+ };
54545
+ }
54546
+ } catch {
54547
+ }
54548
+ }
54443
54549
  if (!link) {
54444
54550
  return { status: "not_linked", org: null, project: null };
54445
54551
  }
@@ -54519,7 +54625,7 @@ Upon creation, it will be automatically added to your ".gitignore" file.
54519
54625
  `;
54520
54626
  async function writeReadme(path) {
54521
54627
  await writeFile3(
54522
- join8(path, VERCEL_DIR, VERCEL_DIR_README),
54628
+ join9(path, VERCEL_DIR, VERCEL_DIR_README),
54523
54629
  VERCEL_DIR_README_CONTENT
54524
54630
  );
54525
54631
  }
@@ -54528,7 +54634,7 @@ async function linkFolderToProject(client, path, projectLink, projectName, orgSl
54528
54634
  return;
54529
54635
  }
54530
54636
  try {
54531
- await (0, import_fs_extra8.ensureDir)(join8(path, VERCEL_DIR));
54637
+ await (0, import_fs_extra8.ensureDir)(join9(path, VERCEL_DIR));
54532
54638
  } catch (err) {
54533
54639
  if ((0, import_error_utils4.isErrnoException)(err) && err.code === "ENOTDIR") {
54534
54640
  return;
@@ -54536,7 +54642,7 @@ async function linkFolderToProject(client, path, projectLink, projectName, orgSl
54536
54642
  throw err;
54537
54643
  }
54538
54644
  await writeFile3(
54539
- join8(path, VERCEL_DIR, VERCEL_DIR_PROJECT),
54645
+ join9(path, VERCEL_DIR, VERCEL_DIR_PROJECT),
54540
54646
  JSON.stringify({
54541
54647
  ...projectLink,
54542
54648
  projectName
@@ -54659,7 +54765,7 @@ async function fileExists(filePath) {
54659
54765
  async function findAllVercelConfigFiles(workPath) {
54660
54766
  const foundFiles = [];
54661
54767
  for (const ext of VERCEL_CONFIG_EXTENSIONS) {
54662
- const configPath = join9(workPath, `vercel.${ext}`);
54768
+ const configPath = join10(workPath, `vercel.${ext}`);
54663
54769
  if (await fileExists(configPath)) {
54664
54770
  foundFiles.push(configPath);
54665
54771
  }
@@ -54668,13 +54774,13 @@ async function findAllVercelConfigFiles(workPath) {
54668
54774
  }
54669
54775
  async function findSourceVercelConfigFile(workPath) {
54670
54776
  for (const ext of VERCEL_CONFIG_EXTENSIONS) {
54671
- const configPath = join9(workPath, `vercel.${ext}`);
54777
+ const configPath = join10(workPath, `vercel.${ext}`);
54672
54778
  if (await fileExists(configPath)) {
54673
54779
  return basename3(configPath);
54674
54780
  }
54675
54781
  }
54676
54782
  if (isVercelTomlEnabled()) {
54677
- const tomlPath = join9(workPath, "vercel.toml");
54783
+ const tomlPath = join10(workPath, "vercel.toml");
54678
54784
  if (await fileExists(tomlPath)) {
54679
54785
  return "vercel.toml";
54680
54786
  }
@@ -54716,15 +54822,15 @@ function parseConfigLoaderError(stderr) {
54716
54822
  return stderr.trim();
54717
54823
  }
54718
54824
  async function compileVercelConfig(workPath) {
54719
- const vercelJsonPath = join9(workPath, "vercel.json");
54720
- const nowJsonPath = join9(workPath, "now.json");
54721
- const vercelTomlPath = join9(workPath, "vercel.toml");
54825
+ const vercelJsonPath = join10(workPath, "vercel.json");
54826
+ const nowJsonPath = join10(workPath, "now.json");
54827
+ const vercelTomlPath = join10(workPath, "vercel.toml");
54722
54828
  const hasVercelJson = await fileExists(vercelJsonPath);
54723
54829
  const hasNowJson = await fileExists(nowJsonPath);
54724
54830
  const hasVercelToml = isVercelTomlEnabled() && await fileExists(vercelTomlPath);
54725
54831
  const vercelConfigPath = await findVercelConfigFile(workPath);
54726
- const vercelDir = join9(workPath, VERCEL_DIR);
54727
- const compiledConfigPath = join9(vercelDir, "vercel.json");
54832
+ const vercelDir = join10(workPath, VERCEL_DIR);
54833
+ const compiledConfigPath = join10(vercelDir, "vercel.json");
54728
54834
  if (hasNowJson) {
54729
54835
  throw new DeprecatedNowJson(nowJsonPath);
54730
54836
  }
@@ -54787,10 +54893,10 @@ async function compileVercelConfig(workPath) {
54787
54893
  }
54788
54894
  }
54789
54895
  const sourceConfigPath = vercelConfigPath;
54790
- (0, import_dotenv.config)({ path: join9(workPath, ".env") });
54791
- (0, import_dotenv.config)({ path: join9(workPath, ".env.local") });
54792
- const tempOutPath = join9(vercelDir, "vercel-temp.mjs");
54793
- const loaderPath = join9(vercelDir, "vercel-loader.mjs");
54896
+ (0, import_dotenv.config)({ path: join10(workPath, ".env") });
54897
+ (0, import_dotenv.config)({ path: join10(workPath, ".env.local") });
54898
+ const tempOutPath = join10(vercelDir, "vercel-temp.mjs");
54899
+ const loaderPath = join10(vercelDir, "vercel-loader.mjs");
54794
54900
  try {
54795
54901
  const { build } = await import("esbuild");
54796
54902
  await mkdir(vercelDir, { recursive: true });
@@ -54894,9 +55000,9 @@ async function compileVercelConfig(workPath) {
54894
55000
  }
54895
55001
  }
54896
55002
  async function getVercelConfigPath(workPath) {
54897
- const vercelJsonPath = join9(workPath, "vercel.json");
54898
- const vercelTomlPath = join9(workPath, "vercel.toml");
54899
- const compiledConfigPath = join9(workPath, VERCEL_DIR, "vercel.json");
55003
+ const vercelJsonPath = join10(workPath, "vercel.json");
55004
+ const vercelTomlPath = join10(workPath, "vercel.toml");
55005
+ const compiledConfigPath = join10(workPath, VERCEL_DIR, "vercel.json");
54900
55006
  if (await fileExists(vercelJsonPath)) {
54901
55007
  return vercelJsonPath;
54902
55008
  }
@@ -54996,6 +55102,7 @@ export {
54996
55102
  getVercelConfigPath,
54997
55103
  readJSONFile,
54998
55104
  validateConfig,
55105
+ createDetectEntrypoint,
54999
55106
  tryDetectServices,
55000
55107
  writeServicesConfig,
55001
55108
  getServicesConfigWriteBlocker,