vercel 51.2.1 → 51.3.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 (69) hide show
  1. package/dist/chunks/add-3MIOUOZC.js +180 -0
  2. package/dist/chunks/{chunk-W6FW7CCT.js → chunk-2JQVASXJ.js} +13 -8
  3. package/dist/chunks/{chunk-Q6BEDVOU.js → chunk-4PQA6H63.js} +1 -1
  4. package/dist/chunks/{chunk-IS2HEMF4.js → chunk-4RBF6ZDU.js} +4 -2
  5. package/dist/chunks/{chunk-7S7GE4BN.js → chunk-4VP55L4V.js} +208 -500
  6. package/dist/chunks/{chunk-5YQCJTZI.js → chunk-4WRHMYCG.js} +6 -6
  7. package/dist/chunks/chunk-4ZWTYJSP.js +139 -0
  8. package/dist/chunks/{chunk-3FMFPD7F.js → chunk-APGVHLAW.js} +2 -2
  9. package/dist/chunks/{chunk-5WHDQH2U.js → chunk-BAUYQ7AR.js} +1 -1
  10. package/dist/chunks/{chunk-BUBUVE23.js → chunk-BJQTGP42.js} +4 -2
  11. package/dist/chunks/{chunk-G6MVEB4W.js → chunk-BU3JMDDH.js} +3 -3
  12. package/dist/chunks/chunk-CGTXAXZ4.js +484 -0
  13. package/dist/chunks/{chunk-BQUQ5F7R.js → chunk-CRZM5WM2.js} +4 -2
  14. package/dist/chunks/{chunk-XRR5HDB3.js → chunk-CZXW3DJH.js} +2 -2
  15. package/dist/chunks/chunk-DVQ4SIWF.js +183 -0
  16. package/dist/chunks/{chunk-A4NVECX5.js → chunk-ECRBC4HL.js} +4 -581
  17. package/dist/chunks/{chunk-RK4TKB3D.js → chunk-FNFZO3WQ.js} +7 -5
  18. package/dist/chunks/{chunk-L2BKVTHL.js → chunk-G6RXZLQ2.js} +2 -2
  19. package/dist/chunks/{chunk-4YZKA4FN.js → chunk-GE6G37P4.js} +1 -1
  20. package/dist/chunks/{chunk-NELCIT4M.js → chunk-GLDQ23LD.js} +1 -1
  21. package/dist/chunks/{chunk-5DLMAFQU.js → chunk-GYBFQLYR.js} +6 -4
  22. package/dist/chunks/{chunk-XAVGWINL.js → chunk-JEON5XEH.js} +44 -13
  23. package/dist/chunks/{chunk-Y5YCSB6X.js → chunk-LDXYSGPZ.js} +2 -2
  24. package/dist/chunks/{chunk-U5J73OA3.js → chunk-N45K6NXC.js} +1 -1
  25. package/dist/chunks/{chunk-SSOWPEZT.js → chunk-NCQBQGI6.js} +2 -2
  26. package/dist/chunks/chunk-NE34PEHL.js +167 -0
  27. package/dist/chunks/{chunk-QQTF2FEY.js → chunk-OFUQPP26.js} +9 -5
  28. package/dist/chunks/{chunk-FSOFFJDV.js → chunk-R2BVH5SQ.js} +1 -1
  29. package/dist/chunks/chunk-RFMC2QXQ.js +602 -0
  30. package/dist/chunks/{chunk-VTQNSCUG.js → chunk-RHXEHBO3.js} +8 -6
  31. package/dist/chunks/{chunk-K5XJCQQO.js → chunk-RRYVGOVK.js} +1 -1
  32. package/dist/chunks/{chunk-EHZKWVK2.js → chunk-T7CL42FK.js} +5 -5
  33. package/dist/chunks/{chunk-WXNT7WJO.js → chunk-TAOVG4PS.js} +49 -4
  34. package/dist/chunks/{chunk-57RLFBKC.js → chunk-UB325PS7.js} +1 -1
  35. package/dist/chunks/{chunk-2IAZZEVQ.js → chunk-UWKTUK3W.js} +4 -2
  36. package/dist/chunks/{chunk-VE7MY76H.js → chunk-VGWGLBUC.js} +4 -2
  37. package/dist/chunks/{chunk-4EGCWWSR.js → chunk-VMTOBGCO.js} +50 -16
  38. package/dist/chunks/{chunk-W5K4YCTI.js → chunk-ZS5VKEZL.js} +5 -3
  39. package/dist/chunks/{compile-vercel-config-2GV46IDP.js → compile-vercel-config-A2SLMCWK.js} +4 -2
  40. package/dist/chunks/{delete-PXMYSQGR.js → delete-SEQBCYWT.js} +7 -5
  41. package/dist/chunks/{disable-2ZQ4OG4A.js → disable-GRM5DJGU.js} +7 -5
  42. package/dist/chunks/{discard-FQZTZ5HK.js → discard-IVQWWSPI.js} +7 -5
  43. package/dist/chunks/{edit-F3J7Q5SZ.js → edit-YTMZBT4Y.js} +8 -6
  44. package/dist/chunks/{enable-ZW4W33H5.js → enable-SSU3MG6J.js} +7 -5
  45. package/dist/chunks/{export-ZZV6ESIW.js → export-INCDZTYW.js} +7 -5
  46. package/dist/chunks/inspect-QMY2ZE6J.js +353 -0
  47. package/dist/chunks/{list-VFPV4TUW.js → list-FF4VGSZ2.js} +115 -85
  48. package/dist/chunks/{list-SSIMVNNN.js → list-MMIBPSB3.js} +10 -7
  49. package/dist/chunks/ls-TYEDISJD.js +114 -0
  50. package/dist/chunks/{publish-3K76MNS3.js → publish-OJQCVDL5.js} +7 -5
  51. package/dist/chunks/{query-CY7JJSSX.js → query-LACPOOBL.js} +15 -12
  52. package/dist/chunks/{reorder-6L7MENN5.js → reorder-TBFWHFQZ.js} +7 -5
  53. package/dist/chunks/{restore-XUYXOJQ2.js → restore-5LUZRUME.js} +7 -5
  54. package/dist/chunks/rm-LDXY2G45.js +164 -0
  55. package/dist/chunks/rule-inspect-THIN6POX.js +142 -0
  56. package/dist/chunks/rules-4ZH7VTGC.js +83 -0
  57. package/dist/chunks/{schema-G5FSLZVA.js → schema-OK4OOI2N.js} +9 -7
  58. package/dist/chunks/{types-A4EAQ6F6.js → types-QNN5CDCB.js} +6 -4
  59. package/dist/chunks/update-EXPUPEH6.js +196 -0
  60. package/dist/commands/build/index.js +27 -23
  61. package/dist/commands/deploy/index.js +171 -32
  62. package/dist/commands/dev/index.js +21 -17
  63. package/dist/commands/env/index.js +32 -27
  64. package/dist/commands/link/index.js +21 -17
  65. package/dist/commands/list/index.js +14 -11
  66. package/dist/commands-bulk.js +322 -128
  67. package/dist/index.js +28 -24
  68. package/dist/version.mjs +1 -1
  69. package/package.json +19 -19
@@ -9,34 +9,41 @@ import {
9
9
  require_dist as require_dist2,
10
10
  require_graceful_fs
11
11
  } from "./chunk-U3WLEFHU.js";
12
+ import {
13
+ buildCommandWithYes,
14
+ getPreservedArgsForEnvPull,
15
+ outputActionRequired,
16
+ outputAgentError
17
+ } from "./chunk-CGTXAXZ4.js";
12
18
  import {
13
19
  require_ms,
14
20
  stamp_default
15
21
  } from "./chunk-CO5D46AG.js";
22
+ import {
23
+ forceOption,
24
+ formatOption,
25
+ getArgs,
26
+ getFlagsSpecification,
27
+ parseArguments,
28
+ printError,
29
+ require_string_width,
30
+ require_strip_ansi,
31
+ yesOption
32
+ } from "./chunk-RFMC2QXQ.js";
16
33
  import {
17
34
  APIError,
18
35
  CantParseJSONFile,
19
36
  ConflictingConfigFiles,
20
37
  InvalidToken,
21
- LinkRequiredError,
22
38
  MissingUser,
23
39
  ProjectNotFound,
24
40
  code,
25
- forceOption,
26
- formatOption,
27
- getArgs,
28
41
  getCommandName,
29
42
  getCommandNamePlain,
30
- getFlagsSpecification,
31
43
  isAPIError,
32
44
  packageName,
33
- parseArguments,
34
- printError,
35
- require_lib,
36
- require_string_width,
37
- require_strip_ansi,
38
- yesOption
39
- } from "./chunk-A4NVECX5.js";
45
+ require_lib
46
+ } from "./chunk-ECRBC4HL.js";
40
47
  import {
41
48
  emoji,
42
49
  eraseLines,
@@ -13982,14 +13989,14 @@ var require_read_config_file = __commonJS({
13982
13989
  var import_js_yaml = __toESM2(require_js_yaml2());
13983
13990
  var import_smol_toml2 = __require("smol-toml");
13984
13991
  var import_fs4 = __require("fs");
13985
- var import_error_utils6 = require_dist();
13992
+ var import_error_utils5 = require_dist();
13986
13993
  var { readFile: readFile5 } = import_fs4.promises;
13987
13994
  async function readFileOrNull(file) {
13988
13995
  try {
13989
13996
  const data = await readFile5(file);
13990
13997
  return data;
13991
13998
  } catch (error) {
13992
- if (!(0, import_error_utils6.isErrnoException)(error)) {
13999
+ if (!(0, import_error_utils5.isErrnoException)(error)) {
13993
14000
  throw error;
13994
14001
  }
13995
14002
  if (error.code !== "ENOENT") {
@@ -17940,6 +17947,105 @@ var require_frameworks = __commonJS({
17940
17947
  }
17941
17948
  ]
17942
17949
  },
17950
+ {
17951
+ name: "Axum",
17952
+ slug: "axum",
17953
+ experimental: true,
17954
+ supersedes: ["rust"],
17955
+ logo: "https://api-frameworks.vercel.sh/framework-logos/axum.svg",
17956
+ tagline: "Ergonomic and modular web framework built with Tokio, Tower, and Hyper.",
17957
+ description: "An Axum application deployed as a serverless function.",
17958
+ website: "https://github.com/tokio-rs/axum",
17959
+ useRuntime: { src: "src/main.rs", use: "@vercel/rust" },
17960
+ ignoreRuntimes: ["@vercel/rust"],
17961
+ detectors: {
17962
+ every: [
17963
+ {
17964
+ path: "Cargo.toml",
17965
+ matchContent: "axum\\s*="
17966
+ },
17967
+ {
17968
+ path: "src/main.rs"
17969
+ }
17970
+ ]
17971
+ },
17972
+ settings: {
17973
+ installCommand: {
17974
+ placeholder: "None"
17975
+ },
17976
+ buildCommand: {
17977
+ placeholder: "None",
17978
+ value: null
17979
+ },
17980
+ devCommand: {
17981
+ placeholder: "`cargo run`",
17982
+ value: null
17983
+ },
17984
+ outputDirectory: {
17985
+ value: "N/A"
17986
+ }
17987
+ },
17988
+ getOutputDirName: async () => "public",
17989
+ defaultRoutes: [
17990
+ {
17991
+ handle: "filesystem"
17992
+ },
17993
+ {
17994
+ src: "/(.*)",
17995
+ dest: "/src/main"
17996
+ }
17997
+ ]
17998
+ },
17999
+ {
18000
+ name: "Actix Web",
18001
+ slug: "actix-web",
18002
+ experimental: true,
18003
+ runtimeFramework: true,
18004
+ supersedes: ["rust"],
18005
+ logo: "https://api-frameworks.vercel.sh/framework-logos/actix-web.svg",
18006
+ tagline: "A powerful, pragmatic, and extremely fast web framework for Rust.",
18007
+ description: "An Actix Web application deployed as a serverless function.",
18008
+ website: "https://actix.rs",
18009
+ useRuntime: { src: "src/main.rs", use: "@vercel/rust" },
18010
+ ignoreRuntimes: ["@vercel/rust"],
18011
+ detectors: {
18012
+ every: [
18013
+ {
18014
+ path: "Cargo.toml",
18015
+ matchContent: "actix-web\\s*="
18016
+ },
18017
+ {
18018
+ path: "src/main.rs"
18019
+ }
18020
+ ]
18021
+ },
18022
+ settings: {
18023
+ installCommand: {
18024
+ placeholder: "None"
18025
+ },
18026
+ buildCommand: {
18027
+ placeholder: "None",
18028
+ value: null
18029
+ },
18030
+ devCommand: {
18031
+ placeholder: "`cargo run`",
18032
+ value: null
18033
+ },
18034
+ outputDirectory: {
18035
+ value: "N/A"
18036
+ }
18037
+ },
18038
+ getOutputDirName: async () => "public",
18039
+ defaultRoutes: [
18040
+ {
18041
+ handle: "filesystem"
18042
+ },
18043
+ {
18044
+ src: "/(.*)",
18045
+ dest: "/src/main"
18046
+ }
18047
+ ]
18048
+ },
17943
18049
  {
17944
18050
  name: "Node",
17945
18051
  slug: "node",
@@ -23245,6 +23351,33 @@ var require_resolve2 = __commonJS({
23245
23351
  var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
23246
23352
  var DNS_LABEL_RE = /^(?!-)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
23247
23353
  var ENV_PREFIX_RE = /^[A-Z][A-Z0-9_]*_$/;
23354
+ async function getServiceFs(fs5, serviceName, root) {
23355
+ if (!root) {
23356
+ return { fs: fs5 };
23357
+ }
23358
+ const normalizedRoot = import_path12.posix.normalize(root);
23359
+ if (!await fs5.hasPath(normalizedRoot)) {
23360
+ return {
23361
+ fs: fs5,
23362
+ error: {
23363
+ code: "ROOT_NOT_FOUND",
23364
+ message: `Service "${serviceName}" has root "${root}" but that directory does not exist.`,
23365
+ serviceName
23366
+ }
23367
+ };
23368
+ }
23369
+ if (await fs5.isFile(normalizedRoot)) {
23370
+ return {
23371
+ fs: fs5,
23372
+ error: {
23373
+ code: "ROOT_NOT_DIRECTORY",
23374
+ message: `Service "${serviceName}" has root "${root}" but that path is a file, not a directory.`,
23375
+ serviceName
23376
+ }
23377
+ };
23378
+ }
23379
+ return { fs: fs5.chdir(normalizedRoot) };
23380
+ }
23248
23381
  function normalizeServiceEntrypoint(entrypoint) {
23249
23382
  const normalized = import_path12.posix.normalize(entrypoint);
23250
23383
  return normalized === "" ? "." : normalized;
@@ -23503,6 +23636,23 @@ var require_resolve2 = __commonJS({
23503
23636
  serviceName: name
23504
23637
  };
23505
23638
  }
23639
+ if (config.root !== void 0) {
23640
+ const normalizedRoot = import_path12.posix.normalize(config.root);
23641
+ if (normalizedRoot.startsWith("/")) {
23642
+ return {
23643
+ code: "INVALID_ROOT",
23644
+ message: `Service "${name}" has invalid "root" "${config.root}". Must be a relative path.`,
23645
+ serviceName: name
23646
+ };
23647
+ }
23648
+ if (normalizedRoot === ".." || normalizedRoot.startsWith("../")) {
23649
+ return {
23650
+ code: "INVALID_ROOT",
23651
+ message: `Service "${name}" has invalid "root" "${config.root}". Must not escape the project root.`,
23652
+ serviceName: name
23653
+ };
23654
+ }
23655
+ }
23506
23656
  if (config.envPrefix !== void 0) {
23507
23657
  if (!ENV_PREFIX_RE.test(config.envPrefix)) {
23508
23658
  return {
@@ -23576,7 +23726,8 @@ var require_resolve2 = __commonJS({
23576
23726
  const {
23577
23727
  name,
23578
23728
  config,
23579
- fs: fs5,
23729
+ serviceFs,
23730
+ root,
23580
23731
  group,
23581
23732
  resolvedEntrypoint,
23582
23733
  routePrefixSource = "configured"
@@ -23595,7 +23746,7 @@ var require_resolve2 = __commonJS({
23595
23746
  if (!resolvedEntrypointPath && typeof rawEntrypoint === "string") {
23596
23747
  const entrypointToResolve = moduleAttrParsed ? moduleAttrParsed.filePath : rawEntrypoint;
23597
23748
  const resolved = await resolveEntrypointPath({
23598
- fs: fs5,
23749
+ fs: serviceFs,
23599
23750
  serviceName: name,
23600
23751
  entrypoint: entrypointToResolve
23601
23752
  });
@@ -23618,7 +23769,7 @@ var require_resolve2 = __commonJS({
23618
23769
  workspace = normalizedEntrypoint;
23619
23770
  } else {
23620
23771
  const inferredWorkspace = await inferWorkspaceFromNearestManifest({
23621
- fs: fs5,
23772
+ fs: serviceFs,
23622
23773
  entrypoint: resolvedEntrypointFile,
23623
23774
  runtime: inferredRuntime
23624
23775
  });
@@ -23632,6 +23783,12 @@ var require_resolve2 = __commonJS({
23632
23783
  }
23633
23784
  }
23634
23785
  }
23786
+ if (root) {
23787
+ const normalizedRoot = import_path12.posix.normalize(root);
23788
+ if (normalizedRoot !== ".") {
23789
+ workspace = workspace === "." ? normalizedRoot : import_path12.posix.join(normalizedRoot, workspace);
23790
+ }
23791
+ }
23635
23792
  const topics = type === "worker" ? (0, import_build_utils5.getWorkerTopics)(config) : config.topics;
23636
23793
  const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
23637
23794
  let builderUse;
@@ -23731,12 +23888,19 @@ var require_resolve2 = __commonJS({
23731
23888
  errors.push(validationError);
23732
23889
  continue;
23733
23890
  }
23891
+ const root = serviceConfig.root;
23892
+ const serviceFsResult = await getServiceFs(fs5, name, root);
23893
+ if (serviceFsResult.error) {
23894
+ errors.push(serviceFsResult.error);
23895
+ continue;
23896
+ }
23897
+ const serviceFs = serviceFsResult.fs;
23734
23898
  let resolvedEntrypoint;
23735
23899
  if (typeof serviceConfig.entrypoint === "string") {
23736
23900
  const moduleAttr = parsePyModuleAttrEntrypoint(serviceConfig.entrypoint);
23737
23901
  const entrypointToResolve = moduleAttr?.filePath ?? serviceConfig.entrypoint;
23738
23902
  const resolvedPath = await resolveEntrypointPath({
23739
- fs: fs5,
23903
+ fs: serviceFs,
23740
23904
  serviceName: name,
23741
23905
  entrypoint: entrypointToResolve
23742
23906
  });
@@ -23765,7 +23929,7 @@ var require_resolve2 = __commonJS({
23765
23929
  });
23766
23930
  const workspace = resolvedEntrypoint.normalized;
23767
23931
  const { framework, error } = await detectFrameworkFromWorkspace({
23768
- fs: fs5,
23932
+ fs: serviceFs,
23769
23933
  workspace,
23770
23934
  runtime: inferredRuntime,
23771
23935
  serviceName: name
@@ -23793,13 +23957,13 @@ var require_resolve2 = __commonJS({
23793
23957
  });
23794
23958
  if (inferredRuntime) {
23795
23959
  const inferredWorkspace = await inferWorkspaceFromNearestManifest({
23796
- fs: fs5,
23960
+ fs: serviceFs,
23797
23961
  entrypoint: resolvedEntrypoint.normalized,
23798
23962
  runtime: inferredRuntime
23799
23963
  });
23800
23964
  const workspace = inferredWorkspace ?? import_path12.posix.dirname(resolvedEntrypoint.normalized);
23801
23965
  const detection = await detectFrameworkFromWorkspace({
23802
- fs: fs5,
23966
+ fs: serviceFs,
23803
23967
  workspace,
23804
23968
  serviceName: name,
23805
23969
  runtime: inferredRuntime
@@ -23816,7 +23980,8 @@ var require_resolve2 = __commonJS({
23816
23980
  const service = await resolveConfiguredService({
23817
23981
  name,
23818
23982
  config: resolvedConfig,
23819
- fs: fs5,
23983
+ serviceFs,
23984
+ root,
23820
23985
  resolvedEntrypoint,
23821
23986
  routePrefixSource
23822
23987
  });
@@ -24821,7 +24986,7 @@ var require_local_file_system_detector = __commonJS({
24821
24986
  var import_promises4 = __toESM2(__require("fs/promises"));
24822
24987
  var import_path12 = __require("path");
24823
24988
  var import_filesystem = require_filesystem();
24824
- var import_error_utils6 = require_dist();
24989
+ var import_error_utils5 = require_dist();
24825
24990
  var LocalFileSystemDetector4 = class _LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
24826
24991
  constructor(rootPath) {
24827
24992
  super();
@@ -24832,7 +24997,7 @@ var require_local_file_system_detector = __commonJS({
24832
24997
  await import_promises4.default.stat(this.getFilePath(name));
24833
24998
  return true;
24834
24999
  } catch (err) {
24835
- if ((0, import_error_utils6.isErrnoException)(err) && err.code === "ENOENT") {
25000
+ if ((0, import_error_utils5.isErrnoException)(err) && err.code === "ENOENT") {
24836
25001
  return false;
24837
25002
  }
24838
25003
  throw err;
@@ -25300,7 +25465,7 @@ var require_detect_builders = __commonJS({
25300
25465
  }
25301
25466
  }
25302
25467
  const nodeExtensions = [".js", ".mjs", ".ts", ".tsx"];
25303
- if (process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
25468
+ if (fileName.startsWith("api/") && process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
25304
25469
  const fsPath = (0, import_path12.join)(options.workPath, fileName);
25305
25470
  const isEntrypoint = await (0, import_build_utils5.isNodeEntrypoint)({ fsPath });
25306
25471
  if (!isEntrypoint) {
@@ -38965,7 +39130,7 @@ var require_package = __commonJS({
38965
39130
  "../client/package.json"(exports, module) {
38966
39131
  module.exports = {
38967
39132
  name: "@vercel/client",
38968
- version: "17.3.2",
39133
+ version: "17.3.3",
38969
39134
  main: "dist/index.js",
38970
39135
  typings: "dist/index.d.ts",
38971
39136
  homepage: "https://vercel.com",
@@ -48238,10 +48403,10 @@ var require_util4 = __commonJS({
48238
48403
  return objectToString(d) === "[object Date]";
48239
48404
  }
48240
48405
  exports.isDate = isDate;
48241
- function isError3(e) {
48406
+ function isError2(e) {
48242
48407
  return objectToString(e) === "[object Error]" || e instanceof Error;
48243
48408
  }
48244
- exports.isError = isError3;
48409
+ exports.isError = isError2;
48245
48410
  function isFunction(arg) {
48246
48411
  return typeof arg === "function";
48247
48412
  }
@@ -52048,7 +52213,7 @@ var require_create_deployment = __commonJS({
52048
52213
  var import_upload = require_upload();
52049
52214
  var import_utils4 = require_utils10();
52050
52215
  var import_errors3 = require_errors();
52051
- var import_error_utils6 = require_dist();
52216
+ var import_error_utils5 = require_dist();
52052
52217
  var import_archive = require_archive();
52053
52218
  function buildCreateDeployment() {
52054
52219
  return async function* createDeployment(clientOptions, deploymentOptions = {}) {
@@ -52129,7 +52294,7 @@ var require_create_deployment = __commonJS({
52129
52294
  files = await (0, import_hashes.hashes)(fileList);
52130
52295
  }
52131
52296
  } catch (err) {
52132
- if (clientOptions.prebuilt && (0, import_error_utils6.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
52297
+ if (clientOptions.prebuilt && (0, import_error_utils5.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
52133
52298
  const errPath = (0, import_path12.relative)(workPath, err.path);
52134
52299
  err.message = `File does not exist: "${(0, import_path12.relative)(workPath, errPath)}"`;
52135
52300
  if (errPath.split(import_path12.sep).includes("node_modules")) {
@@ -52578,7 +52743,7 @@ var global_path_default = getGlobalPathConfig;
52578
52743
 
52579
52744
  // src/util/projects/link.ts
52580
52745
  import { NowBuildError as NowBuildError2, getPlatformEnv } from "@vercel/build-utils";
52581
- var import_error_utils5 = __toESM(require_dist(), 1);
52746
+ var import_error_utils4 = __toESM(require_dist(), 1);
52582
52747
 
52583
52748
  // src/util/link/repo.ts
52584
52749
  var import_chalk6 = __toESM(require_source(), 1);
@@ -53981,452 +54146,6 @@ async function getTeams(client, opts = {}) {
53981
54146
  }
53982
54147
  }
53983
54148
 
53984
- // src/util/agent-output.ts
53985
- var import_error_utils2 = __toESM(require_dist(), 1);
53986
- function buildCommandWithYes(argv, pkgName = packageName) {
53987
- const args = argv.slice(2);
53988
- const hasYes = args.some((a) => a === "--yes" || a === "-y");
53989
- const out = hasYes ? [...args] : [...args, "--yes"];
53990
- return `${pkgName} ${out.join(" ")}`;
53991
- }
53992
- var GLOBAL_FLAG_NAMES = /* @__PURE__ */ new Set([
53993
- "--cwd",
53994
- "--config",
53995
- "--yes",
53996
- "-y",
53997
- "--non-interactive",
53998
- "--scope",
53999
- "--team",
54000
- "-S",
54001
- "-T",
54002
- "--token"
54003
- ]);
54004
- var BOOLEAN_GLOBAL_FLAG_NAMES = /* @__PURE__ */ new Set(["--yes", "-y", "--non-interactive"]);
54005
- function getGlobalFlagsFromArgv(argv) {
54006
- const args = argv.slice(2);
54007
- const out = [];
54008
- for (let i = 0; i < args.length; i++) {
54009
- const arg = args[i];
54010
- const name = arg.startsWith("--") ? arg.split("=")[0] : arg;
54011
- if (GLOBAL_FLAG_NAMES.has(name)) {
54012
- out.push(arg);
54013
- const takesSeparateValue = !BOOLEAN_GLOBAL_FLAG_NAMES.has(name) && !arg.includes("=") && i + 1 < args.length && !args[i + 1].startsWith("-");
54014
- if (takesSeparateValue) {
54015
- out.push(args[i + 1]);
54016
- i++;
54017
- }
54018
- }
54019
- }
54020
- return out;
54021
- }
54022
- function omitGlobalFlagsFromArgs(args) {
54023
- const out = [];
54024
- for (let i = 0; i < args.length; i++) {
54025
- const arg = args[i];
54026
- const name = arg.startsWith("--") ? arg.split("=")[0] : arg;
54027
- if (GLOBAL_FLAG_NAMES.has(name)) {
54028
- const skipSeparateValue = !BOOLEAN_GLOBAL_FLAG_NAMES.has(name) && !arg.includes("=") && i + 1 < args.length && !args[i + 1].startsWith("-");
54029
- if (skipSeparateValue) {
54030
- i++;
54031
- }
54032
- continue;
54033
- }
54034
- out.push(arg);
54035
- }
54036
- return out;
54037
- }
54038
- function buildIntegrationCommandTailFromArgv(argv) {
54039
- const args = argv.slice(2);
54040
- const idx = args.indexOf("integration");
54041
- if (idx === -1) {
54042
- return "integration";
54043
- }
54044
- return omitGlobalFlagsFromArgs(args.slice(idx)).join(" ");
54045
- }
54046
- function buildCommandWithGlobalFlags(argv, commandTemplate, pkgName = packageName, options) {
54047
- let preserved = getGlobalFlagsFromArgv(argv);
54048
- if (options?.excludeFlags?.length) {
54049
- const exclude = new Set(options.excludeFlags);
54050
- const out = [];
54051
- for (let i = 0; i < preserved.length; i++) {
54052
- const arg = preserved[i];
54053
- const name = arg.startsWith("--") ? arg.split("=")[0] : arg;
54054
- if (exclude.has(name)) {
54055
- if (!arg.includes("=") && i + 1 < preserved.length && !preserved[i + 1].startsWith("-")) {
54056
- i++;
54057
- }
54058
- continue;
54059
- }
54060
- out.push(arg);
54061
- }
54062
- preserved = out;
54063
- }
54064
- const base = `${pkgName} ${commandTemplate}`;
54065
- if (preserved.length === 0) {
54066
- return base;
54067
- }
54068
- if (options?.prependGlobalFlags) {
54069
- return `${pkgName} ${preserved.join(" ")} ${commandTemplate}`;
54070
- }
54071
- return `${base} ${preserved.join(" ")}`;
54072
- }
54073
- function getPreservedArgsForEnvAdd(argv) {
54074
- const args = argv.slice(2);
54075
- const addIdx = args.indexOf("add");
54076
- if (addIdx === -1 || args[addIdx - 1] !== "env")
54077
- return args;
54078
- let i = addIdx + 1;
54079
- let positionals = 0;
54080
- while (i < args.length && positionals < 3 && !args[i].startsWith("-")) {
54081
- positionals++;
54082
- i++;
54083
- }
54084
- return args.slice(i);
54085
- }
54086
- function buildEnvAddCommandWithPreservedArgs(argv, commandTemplate, pkgName = packageName) {
54087
- let preserved = getPreservedArgsForEnvAdd(argv);
54088
- if (commandTemplate.includes("--yes")) {
54089
- preserved = preserved.filter((a) => a !== "--yes" && a !== "-y");
54090
- }
54091
- if (commandTemplate.includes("--value")) {
54092
- const out = [];
54093
- for (let j = 0; j < preserved.length; j++) {
54094
- if (preserved[j] === "--value" && j + 1 < preserved.length) {
54095
- j++;
54096
- continue;
54097
- }
54098
- if (preserved[j].startsWith("--value="))
54099
- continue;
54100
- out.push(preserved[j]);
54101
- }
54102
- preserved = out;
54103
- }
54104
- const base = `${pkgName} ${commandTemplate}`;
54105
- if (preserved.length === 0)
54106
- return base;
54107
- return `${base} ${preserved.join(" ")}`;
54108
- }
54109
- function getPreservedArgsForEnvPull(argv) {
54110
- const args = argv.slice(2);
54111
- const pullIdx = args.indexOf("pull");
54112
- if (pullIdx === -1 || args[pullIdx - 1] !== "env")
54113
- return args;
54114
- let i = pullIdx + 1;
54115
- if (i < args.length && !args[i].startsWith("-"))
54116
- i++;
54117
- return args.slice(i);
54118
- }
54119
- function getPreservedArgsForEnvRm(argv) {
54120
- const args = argv.slice(2);
54121
- const rmIdx = args.indexOf("rm");
54122
- if (rmIdx === -1 || args[rmIdx - 1] !== "env")
54123
- return args;
54124
- let i = rmIdx + 1;
54125
- let positionals = 0;
54126
- while (i < args.length && positionals < 3 && !args[i].startsWith("-")) {
54127
- positionals++;
54128
- i++;
54129
- }
54130
- return args.slice(i);
54131
- }
54132
- function buildEnvRmCommandWithPreservedArgs(argv, commandTemplate, pkgName = packageName) {
54133
- let preserved = getPreservedArgsForEnvRm(argv);
54134
- if (commandTemplate.includes("--yes")) {
54135
- preserved = preserved.filter((a) => a !== "--yes" && a !== "-y");
54136
- }
54137
- const base = `${pkgName} ${commandTemplate}`;
54138
- if (preserved.length === 0)
54139
- return base;
54140
- return `${base} ${preserved.join(" ")}`;
54141
- }
54142
- function getPreservedArgsForEnvUpdate(argv) {
54143
- const args = argv.slice(2);
54144
- const updateIdx = args.indexOf("update");
54145
- if (updateIdx === -1 || args[updateIdx - 1] !== "env")
54146
- return args;
54147
- let i = updateIdx + 1;
54148
- let positionals = 0;
54149
- while (i < args.length && positionals < 3 && !args[i].startsWith("-")) {
54150
- positionals++;
54151
- i++;
54152
- }
54153
- return args.slice(i);
54154
- }
54155
- function buildEnvUpdateCommandWithPreservedArgs(argv, commandTemplate, pkgName = packageName) {
54156
- let preserved = getPreservedArgsForEnvUpdate(argv);
54157
- if (commandTemplate.includes("--yes")) {
54158
- preserved = preserved.filter((a) => a !== "--yes" && a !== "-y");
54159
- }
54160
- if (commandTemplate.includes("--value")) {
54161
- const out = [];
54162
- for (let i = 0; i < preserved.length; i++) {
54163
- if (preserved[i] === "--value" && i + 1 < preserved.length) {
54164
- i++;
54165
- continue;
54166
- }
54167
- if (preserved[i].startsWith("--value="))
54168
- continue;
54169
- out.push(preserved[i]);
54170
- }
54171
- preserved = out;
54172
- }
54173
- const base = `${pkgName} ${commandTemplate}`;
54174
- if (preserved.length === 0)
54175
- return base;
54176
- return `${base} ${preserved.join(" ")}`;
54177
- }
54178
- function buildCommandWithScope(argv, scopeSlug, pkgName = packageName) {
54179
- const args = argv.slice(2);
54180
- const out = [];
54181
- for (let i = 0; i < args.length; i++) {
54182
- if (args[i] === "--scope" || args[i] === "--team" || args[i] === "-S" || args[i] === "-T") {
54183
- i++;
54184
- continue;
54185
- }
54186
- if (args[i].startsWith("--scope=") || args[i].startsWith("--team=")) {
54187
- continue;
54188
- }
54189
- out.push(args[i]);
54190
- }
54191
- out.push("--scope", scopeSlug);
54192
- return `${pkgName} ${out.join(" ")}`;
54193
- }
54194
- function enrichActionRequiredWithInvokingCommand(payload, argv) {
54195
- if (!payload.choices?.length) {
54196
- return payload;
54197
- }
54198
- const next = [];
54199
- const linkArgv = [...argv.slice(0, 2), "link", ...argv.slice(3)];
54200
- for (const choice of payload.choices) {
54201
- const slug = choice.name;
54202
- next.push({
54203
- command: buildCommandWithScope(linkArgv, slug),
54204
- when: "Link first (then run any command without --scope)"
54205
- });
54206
- next.push({
54207
- command: buildCommandWithScope(argv, slug),
54208
- when: "Run this command with scope (no link)"
54209
- });
54210
- }
54211
- return { ...payload, next };
54212
- }
54213
- function outputActionRequired(client, payload, exitCode = 1) {
54214
- if (!shouldEmitNonInteractiveCommandError(client)) {
54215
- return;
54216
- }
54217
- const enriched = enrichActionRequiredWithInvokingCommand(
54218
- payload,
54219
- client.argv
54220
- );
54221
- if (!enriched.hint && enriched.next?.length) {
54222
- enriched.hint = "Run one of the commands in next[] to complete without prompting.";
54223
- }
54224
- client.stdout.write(`${JSON.stringify(enriched, null, 2)}
54225
- `);
54226
- process.exit(exitCode);
54227
- }
54228
- function argvHasNonInteractive(argv) {
54229
- if (!argv?.length) {
54230
- return false;
54231
- }
54232
- for (let i = 0; i < argv.length; i++) {
54233
- const a = argv[i];
54234
- if (a === "--non-interactive") {
54235
- return argv[i + 1] !== "false";
54236
- }
54237
- if (a.startsWith("--non-interactive=")) {
54238
- return a.slice("--non-interactive=".length) !== "false";
54239
- }
54240
- }
54241
- return false;
54242
- }
54243
- function shouldEmitNonInteractiveCommandError(client) {
54244
- return client.nonInteractive || argvHasNonInteractive(client.argv ?? []);
54245
- }
54246
- function outputAgentError(client, payload, exitCode = 1) {
54247
- if (!shouldEmitNonInteractiveCommandError(client)) {
54248
- return;
54249
- }
54250
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
54251
- `);
54252
- process.exit(exitCode);
54253
- }
54254
- function buildNextStepsForEdgeConfig(client) {
54255
- return [
54256
- {
54257
- command: buildCommandWithGlobalFlags(client.argv, "edge-config list"),
54258
- when: "List Edge Config stores in the current team scope"
54259
- },
54260
- {
54261
- command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
54262
- when: "Switch to the team that owns the Edge Config"
54263
- },
54264
- {
54265
- command: buildCommandWithGlobalFlags(client.argv, "whoami"),
54266
- when: "Verify the current team or user scope"
54267
- }
54268
- ];
54269
- }
54270
- var EDGE_CONFIG_NON_INTERACTIVE_HINT = "Edge Config commands use your current team scope. Pass --scope or run `vercel teams switch` if the store is missing.";
54271
- function buildNextStepsForProjectSubcommands(client, variant) {
54272
- const byName = variant === "access-groups" ? {
54273
- template: "project access-groups <name>",
54274
- when: "List access groups by project name (replace <name>)"
54275
- } : variant === "access-summary" ? {
54276
- template: "project access-summary <name>",
54277
- when: "Show role counts by project name (replace <name>)"
54278
- } : variant === "protection" ? {
54279
- template: "project protection <name>",
54280
- when: "Show deployment protection by project name (replace <name>)"
54281
- } : variant === "speed-insights" ? {
54282
- template: "project speed-insights <name>",
54283
- when: "Enable Speed Insights by project name (replace <name>)"
54284
- } : variant === "web-analytics" ? {
54285
- template: "project web-analytics <name>",
54286
- when: "Enable Web Analytics by project name (replace <name>)"
54287
- } : variant === "checks" ? {
54288
- template: "project checks add <name>",
54289
- when: "Create a deployment check by project name (replace <name>)"
54290
- } : {
54291
- template: "project members <name>",
54292
- when: "List members by project name (replace <name>)"
54293
- };
54294
- return [
54295
- {
54296
- command: buildCommandWithGlobalFlags(client.argv, "link"),
54297
- when: "Re-link this directory to the correct Vercel project"
54298
- },
54299
- {
54300
- command: buildCommandWithGlobalFlags(client.argv, byName.template),
54301
- when: byName.when
54302
- },
54303
- {
54304
- command: buildCommandWithGlobalFlags(client.argv, "project ls"),
54305
- when: "List projects in the current team to pick a name"
54306
- }
54307
- ];
54308
- }
54309
- var PROJECT_SUBCOMMAND_ERROR_HINT = "If you use --cwd, ensure that folder is linked to the right project, or pass an explicit project name. Use --scope when the project belongs to another team.";
54310
- function resolveNonInteractiveDefaults(client, variant) {
54311
- if (variant === "edge-config") {
54312
- return {
54313
- next: buildNextStepsForEdgeConfig(client),
54314
- hint: EDGE_CONFIG_NON_INTERACTIVE_HINT
54315
- };
54316
- }
54317
- return {
54318
- next: buildNextStepsForProjectSubcommands(client, variant),
54319
- hint: PROJECT_SUBCOMMAND_ERROR_HINT
54320
- };
54321
- }
54322
- function writeAgentErrorPayloadAndExit(client, payload, exitCode, variant) {
54323
- const defaults = resolveNonInteractiveDefaults(client, variant);
54324
- const out = {
54325
- ...payload,
54326
- next: payload.next ?? defaults.next,
54327
- hint: payload.hint ?? defaults.hint
54328
- };
54329
- client.stdout.write(`${JSON.stringify(out, null, 2)}
54330
- `);
54331
- process.exit(exitCode);
54332
- }
54333
- function isProjectNotFoundLike(err) {
54334
- if (err instanceof ProjectNotFound) {
54335
- return true;
54336
- }
54337
- if ((0, import_error_utils2.isError)(err) && "code" in err && err.code === "PROJECT_NOT_FOUND") {
54338
- return true;
54339
- }
54340
- return false;
54341
- }
54342
- function isLinkRequiredLike(err) {
54343
- return err instanceof LinkRequiredError;
54344
- }
54345
- function normalizeApiErrorText(message) {
54346
- return message.replace(/\s*\(\d{3}\)\s*$/, "").trim();
54347
- }
54348
- function exitWithNonInteractiveError(client, err, exitCode = 1, options = {
54349
- variant: "members"
54350
- }) {
54351
- if (!shouldEmitNonInteractiveCommandError(client)) {
54352
- return;
54353
- }
54354
- const { variant } = options;
54355
- if (isLinkRequiredLike(err)) {
54356
- if (variant === "edge-config") {
54357
- writeAgentErrorPayloadAndExit(
54358
- client,
54359
- {
54360
- status: "error",
54361
- reason: "link_required",
54362
- message: err instanceof Error ? err.message : String(err),
54363
- next: buildNextStepsForEdgeConfig(client),
54364
- hint: EDGE_CONFIG_NON_INTERACTIVE_HINT
54365
- },
54366
- exitCode,
54367
- "edge-config"
54368
- );
54369
- return;
54370
- }
54371
- writeAgentErrorPayloadAndExit(
54372
- client,
54373
- {
54374
- status: "error",
54375
- reason: "link_required",
54376
- message: err instanceof Error ? err.message : String(err)
54377
- },
54378
- exitCode,
54379
- variant
54380
- );
54381
- return;
54382
- }
54383
- if (isProjectNotFoundLike(err)) {
54384
- writeAgentErrorPayloadAndExit(
54385
- client,
54386
- {
54387
- status: "error",
54388
- reason: "project_not_found",
54389
- message: err instanceof Error ? err.message : String(err)
54390
- },
54391
- exitCode,
54392
- variant
54393
- );
54394
- return;
54395
- }
54396
- if (isAPIError(err)) {
54397
- const rawMessage = err.serverMessage || err.message;
54398
- const message = normalizeApiErrorText(rawMessage);
54399
- const reason = err.status === 403 ? "forbidden" : err.status === 401 ? "not_authorized" : err.status === 404 ? variant === "edge-config" ? "not_found" : "project_not_found" : err.status === 429 ? "rate_limited" : "api_error";
54400
- writeAgentErrorPayloadAndExit(
54401
- client,
54402
- {
54403
- status: "error",
54404
- reason,
54405
- message
54406
- },
54407
- exitCode,
54408
- variant
54409
- );
54410
- }
54411
- writeAgentErrorPayloadAndExit(
54412
- client,
54413
- {
54414
- status: "error",
54415
- reason: "unexpected_error",
54416
- message: err instanceof Error ? err.message : String(err)
54417
- },
54418
- exitCode,
54419
- variant
54420
- );
54421
- }
54422
- function openUrlInBrowserCommand(url) {
54423
- if (process.platform === "win32")
54424
- return `start ${url}`;
54425
- if (process.platform === "darwin")
54426
- return `open '${url}'`;
54427
- return `xdg-open '${url}'`;
54428
- }
54429
-
54430
54149
  // src/util/input/select-org.ts
54431
54150
  function getScopeOrTeamFromArgv(argv) {
54432
54151
  const args = argv.slice(2);
@@ -55584,7 +55303,7 @@ function addDeltaSection(prefix, arr, changed = false) {
55584
55303
  }
55585
55304
 
55586
55305
  // src/commands/env/pull.ts
55587
- var import_error_utils3 = __toESM(require_dist(), 1);
55306
+ var import_error_utils2 = __toESM(require_dist(), 1);
55588
55307
  var import_json_parse_better_errors = __toESM(require_json_parse_better_errors(), 1);
55589
55308
 
55590
55309
  // src/util/projects/format-project.ts
@@ -56046,7 +55765,7 @@ function tryReadHeadSync(path2, length) {
56046
55765
  try {
56047
55766
  return readHeadSync(path2, length);
56048
55767
  } catch (err) {
56049
- if (!(0, import_error_utils3.isErrnoException)(err) || err.code !== "ENOENT") {
55768
+ if (!(0, import_error_utils2.isErrnoException)(err) || err.code !== "ENOENT") {
56050
55769
  throw err;
56051
55770
  }
56052
55771
  }
@@ -56237,7 +55956,7 @@ import { basename as basename2, join as join6 } from "path";
56237
55956
  // src/util/read-json-file.ts
56238
55957
  var import_fs_extra6 = __toESM(require_lib2(), 1);
56239
55958
  var import_json_parse_better_errors2 = __toESM(require_json_parse_better_errors(), 1);
56240
- var import_error_utils4 = __toESM(require_dist(), 1);
55959
+ var import_error_utils3 = __toESM(require_dist(), 1);
56241
55960
  async function readJSONFile(file) {
56242
55961
  const content = await readFileSafe(file);
56243
55962
  if (content === null) {
@@ -56247,7 +55966,7 @@ async function readJSONFile(file) {
56247
55966
  const json = (0, import_json_parse_better_errors2.default)(content);
56248
55967
  return json;
56249
55968
  } catch (error) {
56250
- return new CantParseJSONFile(file, (0, import_error_utils4.errorToString)(error));
55969
+ return new CantParseJSONFile(file, (0, import_error_utils3.errorToString)(error));
56251
55970
  }
56252
55971
  }
56253
55972
  async function readFileSafe(file) {
@@ -56438,6 +56157,11 @@ var serviceConfigSchema = {
56438
56157
  type: {
56439
56158
  enum: ["web", "cron", "worker"]
56440
56159
  },
56160
+ root: {
56161
+ type: "string",
56162
+ minLength: 1,
56163
+ maxLength: 512
56164
+ },
56441
56165
  entrypoint: {
56442
56166
  type: "string",
56443
56167
  minLength: 1,
@@ -56885,10 +56609,10 @@ async function getLinkFromDir(dir) {
56885
56609
  }
56886
56610
  return link;
56887
56611
  } catch (err) {
56888
- if ((0, import_error_utils5.isErrnoException)(err) && err.code && ["ENOENT", "ENOTDIR"].includes(err.code)) {
56612
+ if ((0, import_error_utils4.isErrnoException)(err) && err.code && ["ENOENT", "ENOTDIR"].includes(err.code)) {
56889
56613
  return null;
56890
56614
  }
56891
- if ((0, import_error_utils5.isError)(err) && err.name === "SyntaxError") {
56615
+ if ((0, import_error_utils4.isError)(err) && err.name === "SyntaxError") {
56892
56616
  throw new Error(
56893
56617
  `Project Settings could not be retrieved. To link your project again, remove the ${dir} directory.`
56894
56618
  );
@@ -57047,7 +56771,7 @@ async function linkFolderToProject(client, path2, projectLink, projectName, orgS
57047
56771
  try {
57048
56772
  await (0, import_fs_extra8.ensureDir)(join8(path2, VERCEL_DIR));
57049
56773
  } catch (err) {
57050
- if ((0, import_error_utils5.isErrnoException)(err) && err.code === "ENOTDIR") {
56774
+ if ((0, import_error_utils4.isErrnoException)(err) && err.code === "ENOTDIR") {
57051
56775
  return;
57052
56776
  }
57053
56777
  throw err;
@@ -57490,22 +57214,6 @@ export {
57490
57214
  createGitMeta,
57491
57215
  parseGitConfig,
57492
57216
  pluckRemoteUrls,
57493
- buildCommandWithYes,
57494
- getGlobalFlagsFromArgv,
57495
- buildIntegrationCommandTailFromArgv,
57496
- buildCommandWithGlobalFlags,
57497
- getPreservedArgsForEnvAdd,
57498
- buildEnvAddCommandWithPreservedArgs,
57499
- getPreservedArgsForEnvRm,
57500
- buildEnvRmCommandWithPreservedArgs,
57501
- getPreservedArgsForEnvUpdate,
57502
- buildEnvUpdateCommandWithPreservedArgs,
57503
- outputActionRequired,
57504
- argvHasNonInteractive,
57505
- shouldEmitNonInteractiveCommandError,
57506
- outputAgentError,
57507
- exitWithNonInteractiveError,
57508
- openUrlInBrowserCommand,
57509
57217
  selectOrg,
57510
57218
  createProject,
57511
57219
  require_frameworks,