vercel 51.5.1 → 51.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/chunks/{add-CSYGALLC.js → add-HLIPDOM3.js} +5 -5
  2. package/dist/chunks/{chunk-7V43C2HB.js → chunk-5QNVUXGF.js} +5 -5
  3. package/dist/chunks/{chunk-TY6AGA4P.js → chunk-6GTUL6VG.js} +3 -3
  4. package/dist/chunks/{chunk-GZF6VMKA.js → chunk-BO7LOGQA.js} +4 -4
  5. package/dist/chunks/{chunk-TX6K3Z5E.js → chunk-BXSWMI6W.js} +1 -1
  6. package/dist/chunks/{chunk-LR5Y63NG.js → chunk-HYAMHBSF.js} +1 -1
  7. package/dist/chunks/{chunk-T7LHO6SF.js → chunk-IDDYXD6T.js} +2 -2
  8. package/dist/chunks/{chunk-JHVQUIP6.js → chunk-IS75MWZN.js} +57 -29
  9. package/dist/chunks/{chunk-5I2ESU2C.js → chunk-L7AFYPER.js} +1 -1
  10. package/dist/chunks/{chunk-K3HUUZM5.js → chunk-LGSOFQRC.js} +1 -1
  11. package/dist/chunks/{chunk-QO2ED7OU.js → chunk-LKIVGPRE.js} +5 -2
  12. package/dist/chunks/{chunk-P445TBWL.js → chunk-LOUKPRIS.js} +316 -152
  13. package/dist/chunks/{chunk-7IM2OOGY.js → chunk-QLO5NXAS.js} +1 -1
  14. package/dist/chunks/{chunk-3VIDEX7A.js → chunk-QO6J4DC7.js} +1 -1
  15. package/dist/chunks/{chunk-NJ7GOUCE.js → chunk-QZ3UQIL3.js} +108 -60
  16. package/dist/chunks/{chunk-KAKD6QXJ.js → chunk-T74PTRRA.js} +4 -4
  17. package/dist/chunks/{chunk-EQIXUYBY.js → chunk-V766LKN6.js} +1 -1
  18. package/dist/chunks/chunk-VNDSVCGB.js +2321 -0
  19. package/dist/chunks/{chunk-CXTJ4RY4.js → chunk-WKRF7JKF.js} +1 -1
  20. package/dist/chunks/{chunk-CGTXAXZ4.js → chunk-XKHLPA6V.js} +3 -1
  21. package/dist/chunks/{chunk-KNZNWP2U.js → chunk-YDCXNOCS.js} +3 -3
  22. package/dist/chunks/{chunk-SVYO7LZ5.js → chunk-YKYISUXV.js} +2 -2
  23. package/dist/chunks/{compile-vercel-config-OLTGIW27.js → compile-vercel-config-U4OJGTLE.js} +2 -2
  24. package/dist/chunks/{delete-XAYXXDEB.js → delete-H2OF5N72.js} +3 -3
  25. package/dist/chunks/{disable-PNN5ZWF4.js → disable-Z4ENND33.js} +3 -3
  26. package/dist/chunks/{discard-QUK6T2AQ.js → discard-UQGHXIL4.js} +3 -3
  27. package/dist/chunks/{edit-D2OHUFQ6.js → edit-UFYK3Z3T.js} +4 -4
  28. package/dist/chunks/{enable-SJV7HD2Y.js → enable-2MEB4O5O.js} +3 -3
  29. package/dist/chunks/{export-SN3F75NH.js → export-T5VEXLYZ.js} +3 -3
  30. package/dist/chunks/{inspect-C2ZW7BZA.js → inspect-7CDEJF2U.js} +4 -4
  31. package/dist/chunks/{list-2DKITLDE.js → list-LTDGGY5C.js} +3 -3
  32. package/dist/chunks/{list-EUXU6BVD.js → list-MKMRMDWW.js} +4 -4
  33. package/dist/chunks/{ls-7R3DRCUY.js → ls-GRDKWPVP.js} +5 -5
  34. package/dist/chunks/{publish-HNGKZNDH.js → publish-SMAXMKKV.js} +3 -3
  35. package/dist/chunks/{query-G4SY7VMM.js → query-WGX6PLTN.js} +3 -3
  36. package/dist/chunks/{reorder-Q2LYGVZK.js → reorder-SQ52RGDY.js} +3 -3
  37. package/dist/chunks/{restore-YJUUQLZG.js → restore-P6RHBBEG.js} +3 -3
  38. package/dist/chunks/{rm-XEV4FF6H.js → rm-EDOGYDVM.js} +5 -5
  39. package/dist/chunks/{rule-inspect-JNZMBVJF.js → rule-inspect-GW54LGXF.js} +5 -5
  40. package/dist/chunks/{rules-5PJVEET5.js → rules-MCUCN322.js} +7 -7
  41. package/dist/chunks/{schema-OU7FKPQZ.js → schema-CZ7B2GTS.js} +3 -3
  42. package/dist/chunks/{update-6LXBPVBH.js → update-QHI4MJ6N.js} +5 -5
  43. package/dist/commands/build/index.js +62 -30
  44. package/dist/commands/deploy/index.js +11 -11
  45. package/dist/commands/dev/index.js +75 -44
  46. package/dist/commands/env/index.js +6 -6
  47. package/dist/commands/link/index.js +7 -7
  48. package/dist/commands/list/index.js +4 -4
  49. package/dist/commands-bulk.js +1786 -2567
  50. package/dist/index.js +31 -11
  51. package/dist/version.mjs +1 -1
  52. package/package.json +18 -18
  53. package/dist/chunks/chunk-4T7RWBT7.js +0 -310
@@ -14,7 +14,7 @@ import {
14
14
  getPreservedArgsForEnvPull,
15
15
  outputActionRequired,
16
16
  outputAgentError
17
- } from "./chunk-CGTXAXZ4.js";
17
+ } from "./chunk-XKHLPA6V.js";
18
18
  import {
19
19
  require_ms,
20
20
  stamp_default
@@ -7995,7 +7995,7 @@ var require_jsonfile = __commonJS({
7995
7995
  }
7996
7996
  return obj;
7997
7997
  }
7998
- var readFile5 = universalify.fromPromise(_readFile);
7998
+ var readFile6 = universalify.fromPromise(_readFile);
7999
7999
  function readFileSync(file, options = {}) {
8000
8000
  if (typeof options === "string") {
8001
8001
  options = { encoding: options };
@@ -8027,7 +8027,7 @@ var require_jsonfile = __commonJS({
8027
8027
  return fs5.writeFileSync(file, str, options);
8028
8028
  }
8029
8029
  var jsonfile = {
8030
- readFile: readFile5,
8030
+ readFile: readFile6,
8031
8031
  readFileSync,
8032
8032
  writeFile: writeFile5,
8033
8033
  writeFileSync
@@ -13987,13 +13987,13 @@ var require_read_config_file = __commonJS({
13987
13987
  });
13988
13988
  module.exports = __toCommonJS2(read_config_file_exports);
13989
13989
  var import_js_yaml = __toESM2(require_js_yaml2());
13990
- var import_smol_toml2 = __require("smol-toml");
13990
+ var import_smol_toml3 = __require("smol-toml");
13991
13991
  var import_fs4 = __require("fs");
13992
13992
  var import_error_utils5 = require_dist();
13993
- var { readFile: readFile5 } = import_fs4.promises;
13993
+ var { readFile: readFile6 } = import_fs4.promises;
13994
13994
  async function readFileOrNull(file) {
13995
13995
  try {
13996
- const data = await readFile5(file);
13996
+ const data = await readFile6(file);
13997
13997
  return data;
13998
13998
  } catch (error) {
13999
13999
  if (!(0, import_error_utils5.isErrnoException)(error)) {
@@ -14014,7 +14014,7 @@ var require_read_config_file = __commonJS({
14014
14014
  if (name.endsWith(".json")) {
14015
14015
  return JSON.parse(str);
14016
14016
  } else if (name.endsWith(".toml")) {
14017
- return (0, import_smol_toml2.parse)(str);
14017
+ return (0, import_smol_toml3.parse)(str);
14018
14018
  } else if (name.endsWith(".yaml") || name.endsWith(".yml")) {
14019
14019
  return import_js_yaml.default.safeLoad(str, { filename: name });
14020
14020
  }
@@ -14080,7 +14080,7 @@ var require_frameworks = __commonJS({
14080
14080
  var import_fs4 = __require("fs");
14081
14081
  var import_read_config_file = require_read_config_file();
14082
14082
  __reExport(frameworks_exports, require_types(), module.exports);
14083
- var { readdir, readFile: readFile5, unlink: unlink2 } = import_fs4.promises;
14083
+ var { readdir, readFile: readFile6, unlink: unlink2 } = import_fs4.promises;
14084
14084
  var frameworks = [
14085
14085
  {
14086
14086
  name: "Blitz.js (Legacy)",
@@ -14208,7 +14208,7 @@ var require_frameworks = __commonJS({
14208
14208
  "public",
14209
14209
  "__now_routes_g4t5bY.json"
14210
14210
  );
14211
- const content = await readFile5(nowRoutesPath, "utf8");
14211
+ const content = await readFile6(nowRoutesPath, "utf8");
14212
14212
  const nowRoutes = JSON.parse(content);
14213
14213
  try {
14214
14214
  await unlink2(nowRoutesPath);
@@ -23019,9 +23019,9 @@ var require_utils3 = __commonJS({
23019
23019
  const hasVercelToml = process.env.VERCEL_TOML_CONFIG_ENABLED === "1" && await fs5.hasPath("vercel.toml");
23020
23020
  if (hasVercelToml) {
23021
23021
  try {
23022
- const { parse: tomlParse2 } = await import("smol-toml");
23022
+ const { parse: tomlParse3 } = await import("smol-toml");
23023
23023
  const content = await fs5.readFile("vercel.toml");
23024
- const config = tomlParse2(content.toString());
23024
+ const config = tomlParse3(content.toString());
23025
23025
  return { config, error: null };
23026
23026
  } catch {
23027
23027
  return {
@@ -23576,6 +23576,12 @@ var require_resolve2 = __commonJS({
23576
23576
  };
23577
23577
  }
23578
23578
  const serviceType = config.type || "web";
23579
+ const isJobService = serviceType === "job" || serviceType === "cron";
23580
+ const isScheduleJobService = serviceType === "cron" || serviceType === "job" && config.trigger === "schedule";
23581
+ const isQueueJobService = serviceType === "job" && config.trigger === "queue";
23582
+ const isWorkflowService = serviceType === "job" && config.trigger === "workflow";
23583
+ const isNonWebService = serviceType === "worker" || isJobService;
23584
+ const serviceTypeLabel = isJobService ? "Job" : serviceType === "worker" ? "Worker" : "Web";
23579
23585
  const routingResult = resolveServiceRoutingConfig(name, config);
23580
23586
  if (routingResult.error) {
23581
23587
  return routingResult.error;
@@ -23605,24 +23611,52 @@ var require_resolve2 = __commonJS({
23605
23611
  serviceName: name
23606
23612
  };
23607
23613
  }
23608
- if ((serviceType === "worker" || serviceType === "cron") && configuredRoutePrefix) {
23614
+ if (isNonWebService && configuredRoutePrefix) {
23609
23615
  return {
23610
23616
  code: "INVALID_ROUTE_PREFIX",
23611
- message: `${serviceType === "worker" ? "Worker" : "Cron"} service "${name}" cannot have "routePrefix" or "mount". Only web services should specify path-based routing.`,
23617
+ message: `${serviceTypeLabel} service "${name}" cannot have "routePrefix" or "mount". Only web services should specify path-based routing.`,
23612
23618
  serviceName: name
23613
23619
  };
23614
23620
  }
23615
- if ((serviceType === "worker" || serviceType === "cron") && hasSubdomain) {
23621
+ if (isNonWebService && hasSubdomain) {
23616
23622
  return {
23617
23623
  code: "INVALID_HOST_ROUTING_CONFIG",
23618
- message: `${serviceType === "worker" ? "Worker" : "Cron"} service "${name}" cannot have "subdomain" or "mount.subdomain". Only web services should specify subdomain routing.`,
23624
+ message: `${serviceTypeLabel} service "${name}" cannot have "subdomain" or "mount.subdomain". Only web services should specify subdomain routing.`,
23619
23625
  serviceName: name
23620
23626
  };
23621
23627
  }
23622
- if (serviceType === "cron" && !config.schedule) {
23628
+ if (serviceType === "job" && config.trigger === void 0) {
23623
23629
  return {
23624
- code: "MISSING_CRON_SCHEDULE",
23625
- message: `Cron service "${name}" is missing required "schedule" field.`,
23630
+ code: "MISSING_JOB_TRIGGER",
23631
+ message: `Job service "${name}" is missing required "trigger" field.`,
23632
+ serviceName: name
23633
+ };
23634
+ }
23635
+ if (serviceType === "job" && config.trigger && !import_build_utils5.JOB_TRIGGERS.includes(config.trigger)) {
23636
+ return {
23637
+ code: "INVALID_JOB_TRIGGER",
23638
+ message: `Job service "${name}" has invalid trigger "${config.trigger}". Expected ${import_build_utils5.JOB_TRIGGERS.map((t) => `"${t}"`).join(", ")}.`,
23639
+ serviceName: name
23640
+ };
23641
+ }
23642
+ if (isScheduleJobService && !config.schedule) {
23643
+ return {
23644
+ code: serviceType === "cron" ? "MISSING_CRON_SCHEDULE" : "MISSING_JOB_SCHEDULE",
23645
+ message: `${serviceTypeLabel} service "${name}" is missing required "schedule" field.`,
23646
+ serviceName: name
23647
+ };
23648
+ }
23649
+ if (isQueueJobService && (!Array.isArray(config.topics) || config.topics.length === 0)) {
23650
+ return {
23651
+ code: "MISSING_QUEUE_TOPICS",
23652
+ message: `${serviceTypeLabel} service "${name}" is missing required "topics" field.`,
23653
+ serviceName: name
23654
+ };
23655
+ }
23656
+ if (isWorkflowService && typeof config.entrypoint !== "string") {
23657
+ return {
23658
+ code: "MISSING_ENTRYPOINT",
23659
+ message: `Job service "${name}" with "workflow" trigger must specify "entrypoint".`,
23626
23660
  serviceName: name
23627
23661
  };
23628
23662
  }
@@ -23723,6 +23757,7 @@ var require_resolve2 = __commonJS({
23723
23757
  routePrefixSource = "configured"
23724
23758
  } = options;
23725
23759
  const type = config.type || "web";
23760
+ const trigger = type === "cron" ? "schedule" : type === "job" ? config.trigger : void 0;
23726
23761
  const rawEntrypoint = config.entrypoint;
23727
23762
  const moduleAttrParsed = typeof rawEntrypoint === "string" ? parsePyModuleAttrEntrypoint(rawEntrypoint) : null;
23728
23763
  const routingResult = resolveServiceRoutingConfig(name, config);
@@ -23779,8 +23814,7 @@ var require_resolve2 = __commonJS({
23779
23814
  workspace = workspace === "." ? normalizedRoot : import_path12.posix.join(normalizedRoot, workspace);
23780
23815
  }
23781
23816
  }
23782
- const topics = type === "worker" ? (0, import_build_utils5.getWorkerTopics)(config) : config.topics;
23783
- const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
23817
+ const topics = type === "worker" ? (0, import_build_utils5.getServiceQueueTopics)({ type, topics: config.topics }) : trigger === "queue" ? config.topics : void 0;
23784
23818
  let builderUse;
23785
23819
  let builderSrc;
23786
23820
  const frameworkDefinition = config.framework ? frameworksBySlug.get(config.framework) : void 0;
@@ -23845,6 +23879,7 @@ var require_resolve2 = __commonJS({
23845
23879
  return {
23846
23880
  name,
23847
23881
  type,
23882
+ trigger,
23848
23883
  group,
23849
23884
  workspace,
23850
23885
  entrypoint: resolvedEntrypointFile,
@@ -23863,7 +23898,6 @@ var require_resolve2 = __commonJS({
23863
23898
  schedule: config.schedule,
23864
23899
  handlerFunction: moduleAttrParsed?.attrName,
23865
23900
  topics,
23866
- consumer,
23867
23901
  envPrefix: config.envPrefix
23868
23902
  };
23869
23903
  }
@@ -24276,7 +24310,7 @@ var require_detect_railway = __commonJS({
24276
24310
  });
24277
24311
  module.exports = __toCommonJS2(detect_railway_exports);
24278
24312
  var import_path12 = __require("path");
24279
- var import_smol_toml2 = __toESM2(__require("smol-toml"));
24313
+ var import_smol_toml3 = __toESM2(__require("smol-toml"));
24280
24314
  var import_frameworks2 = require_frameworks();
24281
24315
  var import_detect_framework = require_detect_framework();
24282
24316
  var import_utils4 = require_utils3();
@@ -24324,7 +24358,8 @@ var require_detect_railway = __commonJS({
24324
24358
  const schedule = cf.config.deploy.cronSchedule;
24325
24359
  const runtime = frameworks.length === 1 ? (0, import_utils4.inferRuntimeFromFramework)(frameworks[0].slug) : void 0;
24326
24360
  const hint = {
24327
- type: "cron",
24361
+ type: "job",
24362
+ trigger: "schedule",
24328
24363
  schedule,
24329
24364
  entrypoint: "<path-to-handler>"
24330
24365
  };
@@ -24333,7 +24368,7 @@ var require_detect_railway = __commonJS({
24333
24368
  }
24334
24369
  warnings.push({
24335
24370
  code: "RAILWAY_CRON_HINT",
24336
- message: `Found Railway cron in ${dirLabel}/ (schedule: "${schedule}"). Vercel crons work with a file entrypoint. You can add the following to define this cron service:
24371
+ message: `Found Railway cron in ${dirLabel}/ (schedule: "${schedule}"). Vercel crons work with a file entrypoint. You can add the following to define this scheduled job service:
24337
24372
  "${deriveServiceName(cf.dirPath)}": ${JSON.stringify(hint, null, 2)}`
24338
24373
  });
24339
24374
  continue;
@@ -24454,7 +24489,7 @@ var require_detect_railway = __commonJS({
24454
24489
  return { config: null };
24455
24490
  }
24456
24491
  try {
24457
- const config = raw.path.endsWith(".toml") ? import_smol_toml2.default.parse(raw.content) : JSON.parse(raw.content);
24492
+ const config = raw.path.endsWith(".toml") ? import_smol_toml3.default.parse(raw.content) : JSON.parse(raw.content);
24458
24493
  return { config };
24459
24494
  } catch (err) {
24460
24495
  return {
@@ -24538,6 +24573,7 @@ var require_detect_services = __commonJS({
24538
24573
  generateServicesRoutes: () => generateServicesRoutes2
24539
24574
  });
24540
24575
  module.exports = __toCommonJS2(detect_services_exports);
24576
+ var import_build_utils5 = __require("@vercel/build-utils");
24541
24577
  var import_routing_utils2 = require_dist5();
24542
24578
  var import_utils4 = require_utils3();
24543
24579
  var import_resolve = require_resolve2();
@@ -24771,21 +24807,7 @@ var require_detect_services = __commonJS({
24771
24807
  }
24772
24808
  }
24773
24809
  }
24774
- const workerServices = services.filter((s) => s.type === "worker");
24775
- for (const service of workerServices) {
24776
- const workerEntrypoint = service.entrypoint || service.builder.src || "index";
24777
- const workerPath = (0, import_utils4.getInternalServiceWorkerPath)(
24778
- service.name,
24779
- workerEntrypoint
24780
- );
24781
- const functionPath = (0, import_utils4.getInternalServiceFunctionPath)(service.name);
24782
- workers.push({
24783
- src: `^${escapeRegex(workerPath)}$`,
24784
- dest: functionPath,
24785
- check: true
24786
- });
24787
- }
24788
- const cronServices = services.filter((s) => s.type === "cron");
24810
+ const cronServices = services.filter(import_build_utils5.isScheduleTriggeredService);
24789
24811
  for (const service of cronServices) {
24790
24812
  const cronPrefix = (0, import_utils4.getInternalServiceCronPathPrefix)(service.name);
24791
24813
  const functionPath = (0, import_utils4.getInternalServiceFunctionPath)(service.name);
@@ -35073,7 +35095,7 @@ var require_jsonfile3 = __commonJS({
35073
35095
  } catch (_) {
35074
35096
  _fs = __require("fs");
35075
35097
  }
35076
- function readFile5(file, options, callback) {
35098
+ function readFile6(file, options, callback) {
35077
35099
  if (callback == null) {
35078
35100
  callback = options;
35079
35101
  options = {};
@@ -35172,7 +35194,7 @@ var require_jsonfile3 = __commonJS({
35172
35194
  return content;
35173
35195
  }
35174
35196
  var jsonfile = {
35175
- readFile: readFile5,
35197
+ readFile: readFile6,
35176
35198
  readFileSync,
35177
35199
  writeFile: writeFile5,
35178
35200
  writeFileSync
@@ -39115,7 +39137,7 @@ var require_package = __commonJS({
39115
39137
  "../client/package.json"(exports, module) {
39116
39138
  module.exports = {
39117
39139
  name: "@vercel/client",
39118
- version: "17.3.5",
39140
+ version: "17.3.8",
39119
39141
  main: "dist/index.js",
39120
39142
  typings: "dist/index.d.ts",
39121
39143
  homepage: "https://vercel.com",
@@ -52622,10 +52644,10 @@ var require_dist7 = __commonJS({
52622
52644
 
52623
52645
  // src/util/compile-vercel-config.ts
52624
52646
  var import_dotenv = __toESM(require_main(), 1);
52625
- import { mkdir, readFile as readFile4, writeFile as writeFile4, unlink, access } from "fs/promises";
52647
+ import { mkdir, readFile as readFile5, writeFile as writeFile4, unlink, access } from "fs/promises";
52626
52648
  import { join as join9, basename as basename3 } from "path";
52627
52649
  import { fork } from "child_process";
52628
- import { parse as tomlParse } from "smol-toml";
52650
+ import { parse as tomlParse2 } from "smol-toml";
52629
52651
 
52630
52652
  // src/util/projects/link.ts
52631
52653
  var import_ajv2 = __toESM(require_ajv(), 1);
@@ -55935,8 +55957,14 @@ import { join as join7, dirname } from "path";
55935
55957
 
55936
55958
  // src/util/projects/detect-services.ts
55937
55959
  var import_fs_detectors2 = __toESM(require_dist6(), 1);
55938
- import { writeFile as writeFile2 } from "fs/promises";
55960
+ import { readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
55939
55961
  import { basename as basename2, join as join6 } from "path";
55962
+ import { parse as tomlParse, stringify as tomlStringify } from "smol-toml";
55963
+
55964
+ // src/util/is-vercel-toml-enabled.ts
55965
+ function isVercelTomlEnabled() {
55966
+ return process.env.VERCEL_TOML_CONFIG_ENABLED === "1";
55967
+ }
55940
55968
 
55941
55969
  // src/util/read-json-file.ts
55942
55970
  var import_fs_extra6 = __toESM(require_lib2(), 1);
@@ -56135,110 +56163,230 @@ var serviceMountSchema = {
56135
56163
  }
56136
56164
  ]
56137
56165
  };
56138
- var serviceConfigSchema = {
56166
+ var serviceScheduleSchema = {
56167
+ type: "string",
56168
+ minLength: 9,
56169
+ maxLength: 256
56170
+ };
56171
+ var serviceQueueTopicSchema = {
56139
56172
  type: "object",
56140
56173
  additionalProperties: false,
56174
+ required: ["topic"],
56141
56175
  properties: {
56142
- type: {
56143
- enum: ["web", "cron", "worker"]
56144
- },
56145
- root: {
56146
- type: "string",
56147
- minLength: 1,
56148
- maxLength: 512
56149
- },
56150
- entrypoint: {
56151
- type: "string",
56152
- minLength: 1,
56153
- maxLength: 512
56154
- },
56155
- mount: serviceMountSchema,
56156
- routePrefix: {
56157
- type: "string",
56158
- minLength: 1,
56159
- maxLength: 512
56160
- },
56161
- subdomain: {
56162
- type: "string",
56163
- minLength: 1,
56164
- maxLength: 63
56165
- },
56166
- framework: {
56167
- type: "string",
56168
- minLength: 1,
56169
- maxLength: 256
56170
- },
56171
- builder: {
56176
+ topic: {
56172
56177
  type: "string",
56173
56178
  minLength: 1,
56174
56179
  maxLength: 256
56175
56180
  },
56176
- runtime: {
56177
- type: "string",
56178
- minLength: 1,
56179
- maxLength: 256
56181
+ retryAfterSeconds: {
56182
+ type: "integer",
56183
+ minimum: 1,
56184
+ maximum: 86400
56180
56185
  },
56181
- buildCommand: {
56182
- type: "string",
56183
- minLength: 1,
56184
- maxLength: 2048
56186
+ initialDelaySeconds: {
56187
+ type: "integer",
56188
+ minimum: 0,
56189
+ maximum: 86400
56190
+ }
56191
+ }
56192
+ };
56193
+ var serviceTopicsSchema = {
56194
+ oneOf: [
56195
+ {
56196
+ type: "array",
56197
+ minItems: 1,
56198
+ items: {
56199
+ type: "string",
56200
+ minLength: 1,
56201
+ maxLength: 256
56202
+ }
56185
56203
  },
56186
- installCommand: {
56187
- type: "string",
56188
- minLength: 1,
56189
- maxLength: 2048
56204
+ {
56205
+ type: "array",
56206
+ minItems: 1,
56207
+ items: serviceQueueTopicSchema
56208
+ }
56209
+ ]
56210
+ };
56211
+ var serviceCommonProperties = {
56212
+ root: {
56213
+ type: "string",
56214
+ minLength: 1,
56215
+ maxLength: 512
56216
+ },
56217
+ entrypoint: {
56218
+ type: "string",
56219
+ minLength: 1,
56220
+ maxLength: 512
56221
+ },
56222
+ framework: {
56223
+ type: "string",
56224
+ minLength: 1,
56225
+ maxLength: 256
56226
+ },
56227
+ builder: {
56228
+ type: "string",
56229
+ minLength: 1,
56230
+ maxLength: 256
56231
+ },
56232
+ runtime: {
56233
+ type: "string",
56234
+ minLength: 1,
56235
+ maxLength: 256
56236
+ },
56237
+ buildCommand: {
56238
+ type: "string",
56239
+ minLength: 1,
56240
+ maxLength: 2048
56241
+ },
56242
+ installCommand: {
56243
+ type: "string",
56244
+ minLength: 1,
56245
+ maxLength: 2048
56246
+ },
56247
+ memory: {
56248
+ type: "integer",
56249
+ minimum: 128,
56250
+ maximum: 10240
56251
+ },
56252
+ maxDuration: {
56253
+ oneOf: [
56254
+ { type: "integer", minimum: 1, maximum: 900 },
56255
+ { type: "string", enum: ["max"] }
56256
+ ]
56257
+ },
56258
+ includeFiles: {
56259
+ oneOf: [
56260
+ { type: "string", minLength: 1 },
56261
+ {
56262
+ type: "array",
56263
+ items: { type: "string", minLength: 1 }
56264
+ }
56265
+ ]
56266
+ },
56267
+ excludeFiles: {
56268
+ oneOf: [
56269
+ { type: "string", minLength: 1 },
56270
+ {
56271
+ type: "array",
56272
+ items: { type: "string", minLength: 1 }
56273
+ }
56274
+ ]
56275
+ }
56276
+ };
56277
+ var serviceRoutableProperties = {
56278
+ mount: serviceMountSchema,
56279
+ routePrefix: {
56280
+ type: "string",
56281
+ minLength: 1,
56282
+ maxLength: 512
56283
+ },
56284
+ subdomain: {
56285
+ type: "string",
56286
+ minLength: 1,
56287
+ maxLength: 63
56288
+ }
56289
+ };
56290
+ var serviceConfigSchema = {
56291
+ oneOf: [
56292
+ {
56293
+ type: "object",
56294
+ additionalProperties: false,
56295
+ properties: {
56296
+ ...serviceCommonProperties,
56297
+ ...serviceRoutableProperties,
56298
+ type: {
56299
+ enum: ["web"]
56300
+ }
56301
+ }
56190
56302
  },
56191
- memory: {
56192
- type: "integer",
56193
- minimum: 128,
56194
- maximum: 10240
56303
+ {
56304
+ type: "object",
56305
+ additionalProperties: false,
56306
+ required: ["type", "trigger", "schedule"],
56307
+ properties: {
56308
+ ...serviceCommonProperties,
56309
+ type: {
56310
+ const: "job"
56311
+ },
56312
+ trigger: {
56313
+ const: "schedule"
56314
+ },
56315
+ schedule: serviceScheduleSchema
56316
+ }
56195
56317
  },
56196
- maxDuration: {
56197
- oneOf: [
56198
- { type: "integer", minimum: 1, maximum: 900 },
56199
- { type: "string", enum: ["max"] }
56200
- ]
56318
+ {
56319
+ type: "object",
56320
+ additionalProperties: false,
56321
+ required: ["type", "trigger", "topics"],
56322
+ properties: {
56323
+ ...serviceCommonProperties,
56324
+ type: {
56325
+ const: "job"
56326
+ },
56327
+ trigger: {
56328
+ const: "queue"
56329
+ },
56330
+ topics: serviceTopicsSchema,
56331
+ consumer: {
56332
+ type: "string",
56333
+ minLength: 1,
56334
+ maxLength: 256
56335
+ }
56336
+ }
56201
56337
  },
56202
- includeFiles: {
56203
- oneOf: [
56204
- { type: "string", minLength: 1 },
56205
- {
56206
- type: "array",
56207
- items: { type: "string", minLength: 1 }
56338
+ {
56339
+ type: "object",
56340
+ additionalProperties: false,
56341
+ required: ["type", "trigger", "entrypoint"],
56342
+ properties: {
56343
+ ...serviceCommonProperties,
56344
+ type: {
56345
+ const: "job"
56346
+ },
56347
+ trigger: {
56348
+ const: "workflow"
56208
56349
  }
56209
- ]
56350
+ }
56210
56351
  },
56211
- excludeFiles: {
56212
- oneOf: [
56213
- { type: "string", minLength: 1 },
56214
- {
56352
+ {
56353
+ type: "object",
56354
+ additionalProperties: false,
56355
+ required: ["type"],
56356
+ properties: {
56357
+ ...serviceCommonProperties,
56358
+ type: {
56359
+ const: "worker"
56360
+ },
56361
+ topics: {
56215
56362
  type: "array",
56216
- items: { type: "string", minLength: 1 }
56363
+ items: {
56364
+ type: "string",
56365
+ minLength: 1,
56366
+ maxLength: 256
56367
+ },
56368
+ minItems: 1
56369
+ },
56370
+ consumer: {
56371
+ type: "string",
56372
+ minLength: 1,
56373
+ maxLength: 256
56217
56374
  }
56218
- ]
56219
- },
56220
- // Cron-specific
56221
- schedule: {
56222
- type: "string",
56223
- minLength: 9,
56224
- maxLength: 256
56225
- },
56226
- // Worker-specific
56227
- topics: {
56228
- type: "array",
56229
- items: {
56230
- type: "string",
56231
- minLength: 1,
56232
- maxLength: 256
56233
- },
56234
- minItems: 1
56375
+ }
56235
56376
  },
56236
- consumer: {
56237
- type: "string",
56238
- minLength: 1,
56239
- maxLength: 256
56377
+ {
56378
+ type: "object",
56379
+ additionalProperties: false,
56380
+ required: ["type", "schedule"],
56381
+ properties: {
56382
+ ...serviceCommonProperties,
56383
+ type: {
56384
+ const: "cron"
56385
+ },
56386
+ schedule: serviceScheduleSchema
56387
+ }
56240
56388
  }
56241
- }
56389
+ ]
56242
56390
  };
56243
56391
  var experimentalServicesSchema = {
56244
56392
  type: "object",
@@ -56324,11 +56472,6 @@ function validateConfig(config) {
56324
56472
  return null;
56325
56473
  }
56326
56474
 
56327
- // src/util/is-vercel-toml-enabled.ts
56328
- function isVercelTomlEnabled() {
56329
- return process.env.VERCEL_TOML_CONFIG_ENABLED === "1";
56330
- }
56331
-
56332
56475
  // src/util/projects/detect-services.ts
56333
56476
  async function isExperimentalServicesEnabled(cwd) {
56334
56477
  return process.env.VERCEL_USE_EXPERIMENTAL_SERVICES === "1" || process.env.VERCEL_USE_EXPERIMENTAL_SERVICES?.toLowerCase() === "true" || await hasExperimentalServicesConfig(cwd);
@@ -56365,11 +56508,8 @@ async function tryDetectServices(cwd) {
56365
56508
  }
56366
56509
  async function writeServicesConfig(cwd, config) {
56367
56510
  const prepared = await prepareServicesConfigWrite(cwd, config);
56368
- await writeFile2(
56369
- prepared.configPath,
56370
- JSON.stringify(prepared.config, null, 2) + "\n",
56371
- "utf8"
56372
- );
56511
+ await writeFile2(prepared.configPath, prepared.content, "utf8");
56512
+ return { configFileName: basename2(prepared.configPath) };
56373
56513
  }
56374
56514
  async function getServicesConfigWriteBlocker(cwd, config) {
56375
56515
  try {
@@ -56387,6 +56527,9 @@ function toProjectServicesConfigPatch(config) {
56387
56527
  async function prepareServicesConfigWrite(cwd, config) {
56388
56528
  const compileResult = await compileVercelConfig(cwd);
56389
56529
  const configPath = join6(cwd, "vercel.json");
56530
+ if (isVercelTomlEnabled() && compileResult.sourceFile === "vercel.toml") {
56531
+ return prepareTomlServicesConfigWrite(join6(cwd, "vercel.toml"), config);
56532
+ }
56390
56533
  if (compileResult.wasCompiled) {
56391
56534
  throw new Error(
56392
56535
  `Cannot automatically update ${compileResult.sourceFile ?? "the current Vercel config"}.`
@@ -56395,9 +56538,6 @@ async function prepareServicesConfigWrite(cwd, config) {
56395
56538
  if (compileResult.configPath && basename2(compileResult.configPath) === "now.json") {
56396
56539
  throw new Error("Cannot automatically update now.json.");
56397
56540
  }
56398
- if (isVercelTomlEnabled() && compileResult.configPath && basename2(compileResult.configPath) === "vercel.toml") {
56399
- throw new Error("Cannot automatically update vercel.toml.");
56400
- }
56401
56541
  let existingConfig = {};
56402
56542
  if (compileResult.configPath && basename2(compileResult.configPath) === "vercel.json") {
56403
56543
  const result = await readJSONFile(configPath);
@@ -56416,9 +56556,33 @@ async function prepareServicesConfigWrite(cwd, config) {
56416
56556
  }
56417
56557
  return {
56418
56558
  configPath,
56419
- config: nextConfig
56559
+ content: JSON.stringify(nextConfig, null, 2) + "\n"
56420
56560
  };
56421
56561
  }
56562
+ async function prepareTomlServicesConfigWrite(configPath, config) {
56563
+ const patch = toProjectServicesConfigPatch(config);
56564
+ const patchKeys = Object.keys(patch);
56565
+ let existingContent;
56566
+ try {
56567
+ existingContent = await readFile3(configPath, "utf8");
56568
+ } catch {
56569
+ existingContent = "";
56570
+ }
56571
+ if (existingContent.trim()) {
56572
+ const existingParsed = tomlParse(existingContent);
56573
+ const overlapping = patchKeys.filter((key) => key in existingParsed);
56574
+ if (overlapping.length > 0) {
56575
+ const plural = overlapping.length > 1;
56576
+ const keyList = overlapping.map((k) => `"${k}"`).join(", ");
56577
+ throw new Error(
56578
+ `Cannot automatically update vercel.toml: key${plural ? "s" : ""} ${keyList} already exist${plural ? "" : "s"}.`
56579
+ );
56580
+ }
56581
+ }
56582
+ const patchToml = tomlStringify(patch);
56583
+ const content = existingContent.trim() ? existingContent.trimEnd() + "\n\n" + patchToml + "\n" : patchToml + "\n";
56584
+ return { configPath, content };
56585
+ }
56422
56586
  function getServicesConfigWriteBlockerFromError(error) {
56423
56587
  switch (error?.code) {
56424
56588
  case "SERVICES_AND_BUILDS":
@@ -56475,7 +56639,7 @@ async function resolveProjectCwd(cwd) {
56475
56639
  }
56476
56640
 
56477
56641
  // src/util/projects/link.ts
56478
- var readFile3 = promisify(fs4.readFile);
56642
+ var readFile4 = promisify(fs4.readFile);
56479
56643
  var writeFile3 = promisify(fs4.writeFile);
56480
56644
  var VERCEL_DIR = ".vercel";
56481
56645
  var VERCEL_DIR_FALLBACK = ".now";
@@ -56577,7 +56741,7 @@ async function getProjectLinkFromRepoLink(client, path2, projectName) {
56577
56741
  }
56578
56742
  async function getLinkFromDir(dir) {
56579
56743
  try {
56580
- const json = await readFile3(join8(dir, VERCEL_DIR_PROJECT), "utf8");
56744
+ const json = await readFile4(join8(dir, VERCEL_DIR_PROJECT), "utf8");
56581
56745
  const ajv2 = new import_ajv2.default();
56582
56746
  const link = JSON.parse(json);
56583
56747
  if (!ajv2.validate(linkSchema, link)) {
@@ -57001,8 +57165,8 @@ async function compileVercelConfig(workPath) {
57001
57165
  }
57002
57166
  if (hasVercelToml) {
57003
57167
  try {
57004
- const tomlContent = await readFile4(vercelTomlPath, "utf8");
57005
- const config = tomlParse(tomlContent);
57168
+ const tomlContent = await readFile5(vercelTomlPath, "utf8");
57169
+ const config = tomlParse2(tomlContent);
57006
57170
  const normalizedConfig = normalizeConfig(config);
57007
57171
  await mkdir(vercelDir, { recursive: true });
57008
57172
  await writeFile4(
@@ -57165,6 +57329,8 @@ export {
57165
57329
  updateSubcommand,
57166
57330
  envCommand,
57167
57331
  param,
57332
+ isDirectory,
57333
+ global_path_default,
57168
57334
  getUser,
57169
57335
  getTeams,
57170
57336
  isBackspaceKey,
@@ -57183,8 +57349,6 @@ export {
57183
57349
  esm_default2,
57184
57350
  esm_default3,
57185
57351
  require_lib10 as require_lib3,
57186
- isDirectory,
57187
- global_path_default,
57188
57352
  require_inherits,
57189
57353
  require_once,
57190
57354
  require_end_of_stream,