vercel 57.0.0 → 58.0.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 (71) hide show
  1. package/dist/chunks/{add-YRZTDNXX.js → add-7PPD4ZUJ.js} +2 -2
  2. package/dist/chunks/{add-7M577U56.js → add-E4KH6P4A.js} +3 -3
  3. package/dist/chunks/{chunk-3242RXCN.js → chunk-AZTV7WPZ.js} +1 -1
  4. package/dist/chunks/{chunk-4PGF367U.js → chunk-B2MTCHPO.js} +19 -1
  5. package/dist/chunks/{chunk-RYO6FJFB.js → chunk-BYQQLGCT.js} +1 -1
  6. package/dist/chunks/{chunk-555WJSO5.js → chunk-DGFASMSE.js} +1 -1
  7. package/dist/chunks/{chunk-NH43BFJ3.js → chunk-EA22NMFU.js} +1 -1
  8. package/dist/chunks/{chunk-RAFH25WW.js → chunk-FB4UFWEC.js} +1 -1
  9. package/dist/chunks/{chunk-T4NODP6Y.js → chunk-FYR7WEUJ.js} +1 -1
  10. package/dist/chunks/{chunk-NRNMT43R.js → chunk-KGVT2RSG.js} +1 -1
  11. package/dist/chunks/{chunk-2EDWKVNP.js → chunk-L4WYMJB3.js} +4 -4
  12. package/dist/chunks/{chunk-F5PQWDOC.js → chunk-MDQJLTGN.js} +1 -1
  13. package/dist/chunks/{chunk-LMHT3QR3.js → chunk-OQGN4TEC.js} +1 -1
  14. package/dist/chunks/{chunk-MAHINYBW.js → chunk-R54DAHCL.js} +1 -1
  15. package/dist/chunks/{chunk-F7X55TOY.js → chunk-RSCSALZH.js} +3 -3
  16. package/dist/chunks/{chunk-MIFDRYTN.js → chunk-TEWJ7TIW.js} +1 -1
  17. package/dist/chunks/{chunk-TBR2Q37Y.js → chunk-TPX7RZBM.js} +243 -44
  18. package/dist/chunks/{chunk-GP5VCTEU.js → chunk-VUESC3YO.js} +1 -1
  19. package/dist/chunks/{chunk-A2TYQBX2.js → chunk-WANVKOVB.js} +24 -4
  20. package/dist/chunks/{chunk-HD7B425F.js → chunk-WDE2EDYX.js} +2 -2
  21. package/dist/chunks/{chunk-YOZCJHLZ.js → chunk-YZMZCQP3.js} +4 -4
  22. package/dist/chunks/{chunk-IOAZNR6Z.js → chunk-ZMVFTCQF.js} +1 -1
  23. package/dist/chunks/{compile-vercel-config-3OHO3TJA.js → compile-vercel-config-G2IVBXEI.js} +1 -1
  24. package/dist/chunks/config-validator.mjs +1 -1
  25. package/dist/chunks/{delete-VOSJLNEA.js → delete-2EIVGM6P.js} +2 -2
  26. package/dist/chunks/{delete-3DZOCWCC.js → delete-E6ZQNE5X.js} +2 -2
  27. package/dist/chunks/{disable-LQDEVRQF.js → disable-M3Q6BBB7.js} +2 -2
  28. package/dist/chunks/{discard-RGV4JKXQ.js → discard-3R6ETBPS.js} +2 -2
  29. package/dist/chunks/{edit-SFIEOQ24.js → edit-7JUDPVXD.js} +3 -3
  30. package/dist/chunks/{edit-UPZPI54L.js → edit-ICVMGRRU.js} +2 -2
  31. package/dist/chunks/{enable-6UVH35WC.js → enable-HLTA35QL.js} +2 -2
  32. package/dist/chunks/{export-6CEG3CK7.js → export-E6XZUFW3.js} +2 -2
  33. package/dist/chunks/{image-CQRCD2OE.js → image-SIRPPQZT.js} +3 -3
  34. package/dist/chunks/{inspect-UM3LDRPV.js → inspect-4FYBOOM5.js} +2 -2
  35. package/dist/chunks/{inspect-K5ZMQG7X.js → inspect-65YX7L3O.js} +2 -2
  36. package/dist/chunks/{inspect-EXQBIAFF.js → inspect-6TQWDIBG.js} +2 -2
  37. package/dist/chunks/{inspect-ZFRY3X3H.js → inspect-NFOURIGN.js} +2 -2
  38. package/dist/chunks/{inspect-4ZAH3RFT.js → inspect-OEWWGAHZ.js} +3 -3
  39. package/dist/chunks/{list-FJCBOCCA.js → list-27DCGMBI.js} +1 -1
  40. package/dist/chunks/{list-4DRVM7Q4.js → list-APFMKZJO.js} +2 -2
  41. package/dist/chunks/{list-KCUHD4OA.js → list-XQCZVLES.js} +3 -3
  42. package/dist/chunks/{login-DFGYNU3K.js → login-FMU4CQOV.js} +2 -2
  43. package/dist/chunks/{ls-CG6A7UXF.js → ls-24BRCAZR.js} +2 -2
  44. package/dist/chunks/{ls-RHEQ6YQB.js → ls-3L6EN4YU.js} +3 -3
  45. package/dist/chunks/{ls-4QHHVXXD.js → ls-BFACWH6C.js} +2 -2
  46. package/dist/chunks/{ls-34NCZKBE.js → ls-T5RGDBCV.js} +2 -2
  47. package/dist/chunks/{open-E3XADEMX.js → open-AG3VYJZM.js} +2 -2
  48. package/dist/chunks/{publish-Z3AQRUCS.js → publish-5OVCPS4J.js} +2 -2
  49. package/dist/chunks/{query-3EV66DO3.js → query-QS4VKBXJ.js} +1 -1
  50. package/dist/chunks/{reorder-VA5E5ZJT.js → reorder-B5V2P7YM.js} +2 -2
  51. package/dist/chunks/{reply-SNSCNKAW.js → reply-JBLWE6RS.js} +2 -2
  52. package/dist/chunks/{resolve-6ZX4RTXX.js → resolve-2I6XH2G3.js} +2 -2
  53. package/dist/chunks/{restore-NEHI5B5P.js → restore-O63FZXCL.js} +2 -2
  54. package/dist/chunks/{rm-FR6KE744.js → rm-HUED5R3Q.js} +3 -3
  55. package/dist/chunks/{rm-E5ZVLAKO.js → rm-N7W3QYWZ.js} +2 -2
  56. package/dist/chunks/{rm-22B22E47.js → rm-P3NJSCMY.js} +2 -2
  57. package/dist/chunks/{rule-inspect-DMP2CKJQ.js → rule-inspect-M3QUSPU2.js} +3 -3
  58. package/dist/chunks/{rules-EYGXEI2Z.js → rules-NSSWPJ2B.js} +6 -6
  59. package/dist/chunks/{schema-2IIWOBSQ.js → schema-G2PAXPVA.js} +1 -1
  60. package/dist/chunks/{tags-ZDVYRHAY.js → tags-JFMO63D4.js} +2 -2
  61. package/dist/chunks/{update-QH4DQMZV.js → update-VJCKD6YG.js} +3 -3
  62. package/dist/commands/build/index.js +7 -7
  63. package/dist/commands/deploy/index.js +8 -8
  64. package/dist/commands/dev/index.js +19 -6
  65. package/dist/commands/env/index.js +4 -4
  66. package/dist/commands/link/index.js +5 -5
  67. package/dist/commands/list/index.js +2 -2
  68. package/dist/commands-bulk.js +170 -67
  69. package/dist/index.js +6 -6
  70. package/dist/version.mjs +1 -1
  71. package/package.json +35 -35
@@ -23280,7 +23280,7 @@ var require_utils3 = __commonJS({
23280
23280
  };
23281
23281
  }
23282
23282
  }
23283
- const hasVercelToml = process.env.VERCEL_TOML_CONFIG_ENABLED === "1" && await fs5.hasPath("vercel.toml");
23283
+ const hasVercelToml = await fs5.hasPath("vercel.toml");
23284
23284
  if (hasVercelToml) {
23285
23285
  try {
23286
23286
  const { parse: tomlParse3 } = await import("smol-toml");
@@ -29584,7 +29584,9 @@ var require_detect_builders = __commonJS({
29584
29584
  detectApiExtensions: () => detectApiExtensions2,
29585
29585
  detectBuilders: () => detectBuilders2,
29586
29586
  detectOutputDirectory: () => detectOutputDirectory2,
29587
- sortFiles: () => sortFiles
29587
+ getProxyBuilder: () => getProxyBuilder2,
29588
+ sortFiles: () => sortFiles,
29589
+ validateProxyConfig: () => validateProxyConfig3
29588
29590
  });
29589
29591
  module.exports = __toCommonJS2(detect_builders_exports);
29590
29592
  var import_minimatch = __toESM2(require_minimatch());
@@ -29595,7 +29597,7 @@ var require_detect_builders = __commonJS({
29595
29597
  var import_build_utils7 = __require("@vercel/build-utils");
29596
29598
  var import_get_services_builders = require_get_services_builders();
29597
29599
  var REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
29598
- var REGEX_VERCEL_PLATFORM_FILES = [
29600
+ var VERCEL_PLATFORM_FILES = [
29599
29601
  "api/**",
29600
29602
  "node_modules/**",
29601
29603
  REGEX_MIDDLEWARE_FILES,
@@ -29607,8 +29609,18 @@ var require_detect_builders = __commonJS({
29607
29609
  "bun.lockb",
29608
29610
  ".gitignore",
29609
29611
  "README.md"
29610
- ].join(",");
29611
- var REGEX_NON_VERCEL_PLATFORM_FILES2 = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
29612
+ ];
29613
+ var REGEX_VERCEL_PLATFORM_FILES = VERCEL_PLATFORM_FILES.join(",");
29614
+ function escapeMinimatchPath(path3) {
29615
+ return path3.replace(/([\\,*?[\]{}()!+@])/g, "\\$1");
29616
+ }
29617
+ function getStaticFilesPattern(additionalExclusions = []) {
29618
+ return `!{${[
29619
+ ...VERCEL_PLATFORM_FILES,
29620
+ ...additionalExclusions.map(escapeMinimatchPath)
29621
+ ].join(",")}}`;
29622
+ }
29623
+ var REGEX_NON_VERCEL_PLATFORM_FILES2 = getStaticFilesPattern();
29612
29624
  var slugToFramework = new Map(
29613
29625
  import_frameworks2.frameworkList.map((f) => [f.slug, f])
29614
29626
  );
@@ -29664,6 +29676,18 @@ var require_detect_builders = __commonJS({
29664
29676
  };
29665
29677
  }
29666
29678
  const { framework } = projectSettings;
29679
+ const proxyError = validateProxy(options, files, framework);
29680
+ if (proxyError) {
29681
+ return {
29682
+ builders: null,
29683
+ errors: [proxyError],
29684
+ warnings: [],
29685
+ defaultRoutes: null,
29686
+ redirectRoutes: null,
29687
+ rewriteRoutes: null,
29688
+ errorRoutes: null
29689
+ };
29690
+ }
29667
29691
  const servicesConfig = services ?? experimentalServicesV2;
29668
29692
  const configuredServices = servicesConfig ?? experimentalServicesV1;
29669
29693
  const configuredServicesType = servicesConfig ? services ? "services" : "experimentalServicesV2" : "experimentalServices";
@@ -29680,6 +29704,12 @@ var require_detect_builders = __commonJS({
29680
29704
  ...(0, import_get_services_builders.warnIgnoredDirectories)(files, configuredServices)
29681
29705
  );
29682
29706
  }
29707
+ if (!result.errors && options.proxy) {
29708
+ result.builders = [
29709
+ getProxyBuilder2(options.proxy, options.tag, options.functions),
29710
+ ...result.builders ?? []
29711
+ ];
29712
+ }
29683
29713
  return result;
29684
29714
  }
29685
29715
  const errors = [];
@@ -29730,6 +29760,9 @@ var require_detect_builders = __commonJS({
29730
29760
  const apiRoutes = [];
29731
29761
  const dynamicRoutes = [];
29732
29762
  for (const fileName of sortedFiles) {
29763
+ if (fileName === options.proxy?.entrypoint) {
29764
+ continue;
29765
+ }
29733
29766
  const apiBuilder = await maybeGetApiBuilder(fileName, apiMatches, options);
29734
29767
  if (apiBuilder) {
29735
29768
  const { routeError, apiRoute, isDynamic } = getApiRoute(
@@ -29772,6 +29805,15 @@ var require_detect_builders = __commonJS({
29772
29805
  fallbackEntrypoint = fileName;
29773
29806
  }
29774
29807
  }
29808
+ if (options.proxy) {
29809
+ const proxyBuilder = getProxyBuilder2(
29810
+ options.proxy,
29811
+ options.tag,
29812
+ options.functions
29813
+ );
29814
+ addToUsedFunctions(proxyBuilder);
29815
+ apiBuilders.unshift(proxyBuilder);
29816
+ }
29775
29817
  if (!makeFrontendStatic && (hasBuildScript(pkg) || buildCommand || framework)) {
29776
29818
  frontendBuilder = detectFrontBuilder(
29777
29819
  pkg,
@@ -29805,13 +29847,31 @@ var require_detect_builders = __commonJS({
29805
29847
  } else if (apiBuilders.length && hasNoneApiFiles) {
29806
29848
  frontendBuilder = {
29807
29849
  use: "@vercel/static",
29808
- src: REGEX_NON_VERCEL_PLATFORM_FILES2,
29850
+ src: getStaticFilesPattern(
29851
+ options.proxy ? [options.proxy.entrypoint] : []
29852
+ ),
29809
29853
  config: {
29810
29854
  zeroConfig: true
29811
29855
  }
29812
29856
  };
29813
29857
  }
29814
29858
  }
29859
+ if (options.proxy && frontendBuilder && (0, import_is_official_runtime.isOfficialRuntime)("next", frontendBuilder.use)) {
29860
+ return {
29861
+ builders: null,
29862
+ errors: [
29863
+ {
29864
+ code: "proxy_framework_conflict",
29865
+ message: "The `proxy` property cannot be used with Next.js because the framework builds its own routing middleware."
29866
+ }
29867
+ ],
29868
+ warnings,
29869
+ defaultRoutes: null,
29870
+ redirectRoutes: null,
29871
+ rewriteRoutes: null,
29872
+ errorRoutes: null
29873
+ };
29874
+ }
29815
29875
  const unusedFunctionError = checkUnusedFunctions(
29816
29876
  frontendBuilder,
29817
29877
  usedFunctions,
@@ -29878,7 +29938,7 @@ var require_detect_builders = __commonJS({
29878
29938
  };
29879
29939
  }
29880
29940
  async function maybeGetApiBuilder(fileName, apiMatches, options) {
29881
- const middleware = fileName === "middleware.js" || fileName === "middleware.ts";
29941
+ const middleware = !options.proxy && (fileName === "middleware.js" || fileName === "middleware.ts");
29882
29942
  if (middleware && options.projectSettings?.framework === "nextjs") {
29883
29943
  return null;
29884
29944
  }
@@ -29951,6 +30011,30 @@ var require_detect_builders = __commonJS({
29951
30011
  const func = keys.find((key) => key === fileName || (0, import_minimatch.default)(fileName, key));
29952
30012
  return func ? { fnPattern: func, func: functions[func] } : { fnPattern: null, func: null };
29953
30013
  }
30014
+ function getProxyBuilder2(proxy, tag, functions = {}) {
30015
+ const { fnPattern, func } = getFunction(proxy.entrypoint, { functions });
30016
+ const runtime = func?.runtime;
30017
+ const config3 = {
30018
+ zeroConfig: true,
30019
+ middleware: true,
30020
+ ...!runtime ? { middlewareRuntime: "nodejs" } : {},
30021
+ ...proxy.matcher ? { middlewareMatcher: proxy.matcher } : {}
30022
+ };
30023
+ if (fnPattern && func) {
30024
+ config3.functions = { [fnPattern]: func };
30025
+ if (func.includeFiles) {
30026
+ config3.includeFiles = func.includeFiles;
30027
+ }
30028
+ if (func.excludeFiles) {
30029
+ config3.excludeFiles = func.excludeFiles;
30030
+ }
30031
+ }
30032
+ return {
30033
+ src: proxy.entrypoint,
30034
+ use: runtime || `@vercel/node${tag ? `@${tag}` : ""}`,
30035
+ config: config3
30036
+ };
30037
+ }
29954
30038
  function getApiMatches() {
29955
30039
  const config3 = { zeroConfig: true };
29956
30040
  return [
@@ -29966,6 +30050,63 @@ var require_detect_builders = __commonJS({
29966
30050
  { src: "api/**/*.rs", use: `@vercel/rust`, config: config3 }
29967
30051
  ];
29968
30052
  }
30053
+ function validateProxyConfig3(proxy) {
30054
+ if (typeof proxy !== "object" || typeof proxy.entrypoint !== "string" || !proxy.entrypoint) {
30055
+ return {
30056
+ code: "invalid_proxy",
30057
+ message: "The `proxy` property must contain an `entrypoint` string that references a `.js` or `.ts` file."
30058
+ };
30059
+ }
30060
+ const entrypoint = proxy.entrypoint;
30061
+ const segments = entrypoint.split("/");
30062
+ if (entrypoint.startsWith("/") || entrypoint.includes("\\") || segments.includes(".") || segments.includes("..") || /[?#\u0000-\u001f]/.test(entrypoint)) {
30063
+ return {
30064
+ code: "invalid_proxy_entrypoint",
30065
+ message: "The `proxy.entrypoint` path must be relative to the project root and cannot contain traversal, query, fragment, or control characters."
30066
+ };
30067
+ }
30068
+ if (!/\.(?:js|ts)$/.test(entrypoint) || entrypoint.endsWith(".d.ts")) {
30069
+ return {
30070
+ code: "invalid_proxy_entrypoint",
30071
+ message: "The `proxy.entrypoint` path must end in `.js` or `.ts` and reference an executable file."
30072
+ };
30073
+ }
30074
+ if (proxy.matcher !== void 0) {
30075
+ const matchers = Array.isArray(proxy.matcher) ? proxy.matcher : [proxy.matcher];
30076
+ if (matchers.length === 0 || matchers.some(
30077
+ (matcher) => typeof matcher !== "string" || !matcher.startsWith("/")
30078
+ )) {
30079
+ return {
30080
+ code: "invalid_proxy_matcher",
30081
+ message: "The `proxy.matcher` value must be a path matcher starting with `/`, or an array of path matchers starting with `/`."
30082
+ };
30083
+ }
30084
+ }
30085
+ return null;
30086
+ }
30087
+ function validateProxy(options, files, framework) {
30088
+ const { proxy } = options;
30089
+ if (!proxy) {
30090
+ return null;
30091
+ }
30092
+ const configError = validateProxyConfig3(proxy);
30093
+ if (configError) {
30094
+ return configError;
30095
+ }
30096
+ if (!files.includes(proxy.entrypoint)) {
30097
+ return {
30098
+ code: "proxy_entrypoint_not_found",
30099
+ message: `The proxy entrypoint \`${proxy.entrypoint}\` does not exist. Set \`proxy.entrypoint\` to an existing \`.js\` or \`.ts\` file.`
30100
+ };
30101
+ }
30102
+ if (framework === "nextjs" || framework === "astro") {
30103
+ return {
30104
+ code: "proxy_framework_conflict",
30105
+ message: `The \`proxy\` property cannot be used with ${framework === "nextjs" ? "Next.js" : "Astro"} because the framework builds its own routing middleware.`
30106
+ };
30107
+ }
30108
+ return null;
30109
+ }
29969
30110
  function hasBuildScript(pkg) {
29970
30111
  const { scripts = {} } = pkg || {};
29971
30112
  return Boolean(scripts && scripts["build"]);
@@ -34924,6 +35065,7 @@ var require_dist6 = __commonJS({
34924
35065
  getInternalServiceWorkerPath: () => import_utils4.getInternalServiceWorkerPath,
34925
35066
  getInternalServiceWorkerPathPrefix: () => import_utils4.getInternalServiceWorkerPathPrefix,
34926
35067
  getProjectPaths: () => import_get_project_paths.getProjectPaths,
35068
+ getProxyBuilder: () => import_detect_builders.getProxyBuilder,
34927
35069
  getServicesBuilders: () => import_get_services_builders.getServicesBuilders,
34928
35070
  getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
34929
35071
  getWorkspaces: () => import_get_workspaces.getWorkspaces,
@@ -34937,6 +35079,7 @@ var require_dist6 = __commonJS({
34937
35079
  packageManagers: () => import_package_managers.packageManagers,
34938
35080
  resolveAllConfiguredServicesV2: () => import_resolve_v2.resolveAllConfiguredServicesV2,
34939
35081
  resolveConfiguredServiceV2: () => import_resolve_v2.resolveConfiguredServiceV2,
35082
+ validateProxyConfig: () => import_detect_builders.validateProxyConfig,
34940
35083
  validateServiceConfigV2: () => import_resolve_v2.validateServiceConfigV2,
34941
35084
  workspaceManagers: () => import_workspace_managers.workspaceManagers
34942
35085
  });
@@ -38004,7 +38147,7 @@ var require_package = __commonJS({
38004
38147
  "../client/package.json"(exports, module) {
38005
38148
  module.exports = {
38006
38149
  name: "@vercel/client",
38007
- version: "18.1.1",
38150
+ version: "18.2.0",
38008
38151
  main: "dist/index.js",
38009
38152
  typings: "dist/index.d.ts",
38010
38153
  homepage: "https://vercel.com",
@@ -56320,7 +56463,19 @@ async function performDeviceCodeFlow(client, options) {
56320
56463
  );
56321
56464
  const [deviceAuthorizationError, deviceAuthorization] = await processDeviceAuthorizationResponse(deviceAuthorizationResponse);
56322
56465
  if (deviceAuthorizationError) {
56323
- printError(deviceAuthorizationError);
56466
+ if (options?.fallbackToLoginOnStepUpFailure && options.refreshToken && isOAuthError(deviceAuthorizationError) && (deviceAuthorizationError.code === "invalid_grant" || deviceAuthorizationError.code === "invalid_scope")) {
56467
+ output_manager_default.debug(
56468
+ `Step-up device authorization failed: ${deviceAuthorizationError.cause.message}`
56469
+ );
56470
+ output_manager_default.log("Couldn't refresh the saved login. Starting a new login.");
56471
+ return performDeviceCodeFlow(
56472
+ client,
56473
+ options.teamId ? { teamId: options.teamId } : void 0
56474
+ );
56475
+ }
56476
+ printError(
56477
+ isOAuthError(deviceAuthorizationError) ? deviceAuthorizationError.cause : deviceAuthorizationError
56478
+ );
56324
56479
  return null;
56325
56480
  }
56326
56481
  const { device_code, user_code, verification_uri, expiresAt, interval } = deviceAuthorization;
@@ -56481,38 +56636,47 @@ async function wait(intervalMs) {
56481
56636
  }
56482
56637
 
56483
56638
  // src/util/env/challenge-recovery.ts
56639
+ var RECOVERABLE_CHALLENGE_CODES = /* @__PURE__ */ new Set([
56640
+ "challenge_required",
56641
+ "challenge_required_email_otp",
56642
+ "user_auth_required"
56643
+ ]);
56484
56644
  async function withEnvChallengeRecovery(client, fn) {
56645
+ const hadStoredSession = Boolean(
56646
+ client.authConfig.token || client.authConfig.refreshToken
56647
+ );
56485
56648
  try {
56486
56649
  return await fn();
56487
56650
  } catch (error) {
56488
- if (!isAPIError(error) || error.code !== "challenge_required") {
56651
+ if (!isAPIError(error)) {
56489
56652
  throw error;
56490
56653
  }
56491
- const refreshToken = client.authConfig.refreshToken;
56492
- if (!refreshToken || client.authConfig.tokenSource || !client.stdin.isTTY) {
56654
+ const isRecoverableChallenge = RECOVERABLE_CHALLENGE_CODES.has(error.code);
56655
+ const isRejectedStoredSession = hadStoredSession && error.invalidToken === true;
56656
+ if (!isRecoverableChallenge && !isRejectedStoredSession) {
56657
+ throw error;
56658
+ }
56659
+ if (client.authConfig.tokenSource || !client.stdin.isTTY || client.nonInteractive) {
56493
56660
  throw error;
56494
56661
  }
56495
56662
  output_manager_default.stopSpinner();
56496
56663
  output_manager_default.log("Sensitive Environment Variables require fresh authentication.");
56664
+ const refreshToken = client.authConfig.refreshToken;
56497
56665
  const acrValues = getAcrValuesFromWWWAuthenticate(error.wwwAuthenticate);
56498
- if (!acrValues) {
56499
- throw error;
56500
- }
56501
- const tokens = await performDeviceCodeFlow(client, {
56666
+ const tokens = isRecoverableChallenge && refreshToken && acrValues ? await performDeviceCodeFlow(client, {
56502
56667
  refreshToken,
56503
- acrValues
56504
- });
56668
+ acrValues,
56669
+ fallbackToLoginOnStepUpFailure: true
56670
+ }) : await performDeviceCodeFlow(client);
56505
56671
  if (!tokens) {
56506
56672
  throw error;
56507
56673
  }
56508
56674
  client.updateAuthConfig({
56509
56675
  token: tokens.access_token,
56510
56676
  userId: void 0,
56511
- expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in
56677
+ expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in,
56678
+ refreshToken: tokens.refresh_token
56512
56679
  });
56513
- if (tokens.refresh_token) {
56514
- client.updateAuthConfig({ refreshToken: tokens.refresh_token });
56515
- }
56516
56680
  client.persistAuthConfig();
56517
56681
  return await fn();
56518
56682
  }
@@ -57215,13 +57379,6 @@ function getGlobalPathConfig2(argvSlice = process.argv.slice(2), cwd = process.c
57215
57379
  // src/util/config/local-path.ts
57216
57380
  import path2 from "path";
57217
57381
  import { existsSync } from "fs";
57218
-
57219
- // src/util/is-vercel-toml-enabled.ts
57220
- function isVercelTomlEnabled() {
57221
- return process.env.VERCEL_TOML_CONFIG_ENABLED === "1";
57222
- }
57223
-
57224
- // src/util/config/local-path.ts
57225
57382
  function getLocalPathConfig(prefix) {
57226
57383
  const argv = parseArguments(process.argv.slice(2), {}, { permissive: true });
57227
57384
  const customPath = argv.flags["--local-config"];
@@ -57235,7 +57392,7 @@ function getLocalPathConfig(prefix) {
57235
57392
  const vercelTomlPath = path2.join(prefix, "vercel.toml");
57236
57393
  const nowConfigPath = path2.join(prefix, "now.json");
57237
57394
  const vercelConfigExists = existsSync(vercelConfigPath);
57238
- const vercelTomlExists = isVercelTomlEnabled() && existsSync(vercelTomlPath);
57395
+ const vercelTomlExists = existsSync(vercelTomlPath);
57239
57396
  const nowConfigExists = existsSync(nowConfigPath);
57240
57397
  const foundConfigs = [];
57241
57398
  if (vercelConfigExists)
@@ -57367,7 +57524,7 @@ function readLocalConfig(prefix = process.cwd()) {
57367
57524
  } catch {
57368
57525
  }
57369
57526
  }
57370
- if (!sourceFile && isVercelTomlEnabled()) {
57527
+ if (!sourceFile) {
57371
57528
  const tomlPath = join6(workPath, "vercel.toml");
57372
57529
  try {
57373
57530
  accessSync(tomlPath, constants.F_OK);
@@ -57998,7 +58155,7 @@ import { stat } from "fs/promises";
57998
58155
  import { join as join9, dirname as dirname2 } from "path";
57999
58156
 
58000
58157
  // src/util/projects/detect-services.ts
58001
- var import_fs_detectors2 = __toESM(require_dist6(), 1);
58158
+ var import_fs_detectors3 = __toESM(require_dist6(), 1);
58002
58159
  import { readFile as readFile4, writeFile as writeFile2 } from "fs/promises";
58003
58160
  import { basename as basename3, join as join8 } from "path";
58004
58161
  import { parse as tomlParse, stringify as tomlStringify } from "smol-toml";
@@ -58030,6 +58187,7 @@ async function readFileSafe(file) {
58030
58187
  // src/util/validate-config.ts
58031
58188
  var import_routing_utils = __toESM(require_dist5(), 1);
58032
58189
  var import_client2 = __toESM(require_dist7(), 1);
58190
+ var import_fs_detectors2 = __toESM(require_dist6(), 1);
58033
58191
  import {
58034
58192
  getFunctionsSchema,
58035
58193
  buildsSchema,
@@ -58564,6 +58722,33 @@ var getServicesSchema = () => ({
58564
58722
  },
58565
58723
  additionalProperties: getServicesServiceConfigSchema()
58566
58724
  });
58725
+ var proxySchema = {
58726
+ type: "object",
58727
+ additionalProperties: false,
58728
+ required: ["entrypoint"],
58729
+ properties: {
58730
+ entrypoint: {
58731
+ type: "string",
58732
+ minLength: 1
58733
+ },
58734
+ matcher: {
58735
+ oneOf: [
58736
+ {
58737
+ type: "string",
58738
+ minLength: 1
58739
+ },
58740
+ {
58741
+ type: "array",
58742
+ minItems: 1,
58743
+ items: {
58744
+ type: "string",
58745
+ minLength: 1
58746
+ }
58747
+ }
58748
+ ]
58749
+ }
58750
+ }
58751
+ };
58567
58752
  function buildVercelConfigSchema() {
58568
58753
  return {
58569
58754
  type: "object",
@@ -58582,6 +58767,7 @@ function buildVercelConfigSchema() {
58582
58767
  images: imagesSchema,
58583
58768
  crons: cronsSchema,
58584
58769
  bunVersion: { type: "string" },
58770
+ proxy: proxySchema,
58585
58771
  experimentalServices: getExperimentalServicesSchema(),
58586
58772
  experimentalServiceGroups: experimentalServiceGroupsSchema,
58587
58773
  services: getServicesSchema(),
@@ -58600,6 +58786,15 @@ function validateConfig(config3) {
58600
58786
  return niceError;
58601
58787
  }
58602
58788
  }
58789
+ if (config3.proxy) {
58790
+ const proxyError = (0, import_fs_detectors2.validateProxyConfig)(config3.proxy);
58791
+ if (proxyError) {
58792
+ return new NowBuildError({
58793
+ code: proxyError.code.toUpperCase(),
58794
+ message: proxyError.message
58795
+ });
58796
+ }
58797
+ }
58603
58798
  if (config3.functions && config3.builds) {
58604
58799
  return new NowBuildError({
58605
58800
  code: "FUNCTIONS_AND_BUILDS",
@@ -58607,6 +58802,12 @@ function validateConfig(config3) {
58607
58802
  link: "https://vercel.link/functions-and-builds"
58608
58803
  });
58609
58804
  }
58805
+ if (config3.proxy && config3.builds) {
58806
+ return new NowBuildError({
58807
+ code: "PROXY_AND_BUILDS",
58808
+ message: "The `proxy` property cannot be used with the `builds` property. Remove `builds` to use an explicit proxy entrypoint."
58809
+ });
58810
+ }
58610
58811
  const hasExperimentalServices = Boolean(config3.experimentalServices);
58611
58812
  if (hasExperimentalServices && config3.builds) {
58612
58813
  return new NowBuildError({
@@ -58754,8 +58955,8 @@ async function tryDetectServices(cwd) {
58754
58955
  if (!isServicesEnabled) {
58755
58956
  return null;
58756
58957
  }
58757
- const fs5 = new import_fs_detectors2.LocalFileSystemDetector(cwd);
58758
- const result = await (0, import_fs_detectors2.detectServices)({
58958
+ const fs5 = new import_fs_detectors3.LocalFileSystemDetector(cwd);
58959
+ const result = await (0, import_fs_detectors3.detectServices)({
58759
58960
  fs: fs5,
58760
58961
  detectEntrypoint: createDetectEntrypoint(cwd)
58761
58962
  });
@@ -58815,7 +59016,7 @@ function toProjectServicesConfigPatch(config3) {
58815
59016
  async function prepareServicesConfigWrite(cwd, config3) {
58816
59017
  const compileResult = await compileVercelConfig(cwd);
58817
59018
  const configPath = join8(cwd, "vercel.json");
58818
- if (isVercelTomlEnabled() && compileResult.sourceFile === "vercel.toml") {
59019
+ if (compileResult.sourceFile === "vercel.toml") {
58819
59020
  return prepareTomlServicesConfigWrite(join8(cwd, "vercel.toml"), config3);
58820
59021
  }
58821
59022
  if (compileResult.wasCompiled) {
@@ -58908,7 +59109,7 @@ async function findProjectRoot(startDir) {
58908
59109
  }
58909
59110
  const hasVercelDir = await (0, import_fs_extra7.pathExists)(join9(dir, ".vercel"));
58910
59111
  const hasVercelJson = await (0, import_fs_extra7.pathExists)(join9(dir, "vercel.json"));
58911
- const hasVercelToml = isVercelTomlEnabled() && await (0, import_fs_extra7.pathExists)(join9(dir, "vercel.toml"));
59112
+ const hasVercelToml = await (0, import_fs_extra7.pathExists)(join9(dir, "vercel.toml"));
58912
59113
  const hasGit = await (0, import_fs_extra7.pathExists)(join9(dir, ".git"));
58913
59114
  if (hasVercelDir || hasVercelJson || hasVercelToml || hasGit) {
58914
59115
  return dir;
@@ -59448,11 +59649,9 @@ async function findSourceVercelConfigFile(workPath) {
59448
59649
  return basename4(configPath);
59449
59650
  }
59450
59651
  }
59451
- if (isVercelTomlEnabled()) {
59452
- const tomlPath = join11(workPath, "vercel.toml");
59453
- if (await fileExists(tomlPath)) {
59454
- return "vercel.toml";
59455
- }
59652
+ const tomlPath = join11(workPath, "vercel.toml");
59653
+ if (await fileExists(tomlPath)) {
59654
+ return "vercel.toml";
59456
59655
  }
59457
59656
  return null;
59458
59657
  }
@@ -59496,7 +59695,7 @@ async function compileVercelConfig(workPath) {
59496
59695
  const vercelTomlPath = join11(workPath, "vercel.toml");
59497
59696
  const hasVercelJson = await fileExists(vercelJsonPath);
59498
59697
  const hasNowJson = await fileExists(nowJsonPath);
59499
- const hasVercelToml = isVercelTomlEnabled() && await fileExists(vercelTomlPath);
59698
+ const hasVercelToml = await fileExists(vercelTomlPath);
59500
59699
  const vercelConfigPath = await findVercelConfigFile(workPath);
59501
59700
  const vercelDir = join11(workPath, VERCEL_DIR);
59502
59701
  const compiledConfigPath = join11(vercelDir, "vercel.json");
@@ -59675,7 +59874,7 @@ async function getVercelConfigPath(workPath) {
59675
59874
  if (await fileExists(vercelJsonPath)) {
59676
59875
  return vercelJsonPath;
59677
59876
  }
59678
- if (isVercelTomlEnabled() && await fileExists(vercelTomlPath)) {
59877
+ if (await fileExists(vercelTomlPath)) {
59679
59878
  return vercelTomlPath;
59680
59879
  }
59681
59880
  if (await fileExists(compiledConfigPath)) {
@@ -59726,6 +59925,7 @@ export {
59726
59925
  revocationRequest,
59727
59926
  processRevocationResponse,
59728
59927
  refreshTokenRequest,
59928
+ isOAuthError,
59729
59929
  performDeviceCodeFlow,
59730
59930
  login,
59731
59931
  modify,
@@ -59789,7 +59989,6 @@ export {
59789
59989
  pull,
59790
59990
  envPullCommandLogic,
59791
59991
  require_main,
59792
- isVercelTomlEnabled,
59793
59992
  normalizeConfig,
59794
59993
  VERCEL_CONFIG_EXTENSIONS,
59795
59994
  DEFAULT_VERCEL_CONFIG_FILENAME,
@@ -14,7 +14,7 @@ import {
14
14
  getLinkedProject,
15
15
  getProjectByNameOrId,
16
16
  getScope
17
- } from "./chunk-TBR2Q37Y.js";
17
+ } from "./chunk-TPX7RZBM.js";
18
18
  import {
19
19
  AGENT_REASON,
20
20
  buildCommandWithGlobalFlags,
@@ -31,10 +31,10 @@ import {
31
31
  import {
32
32
  buildCommand,
33
33
  pullCommand
34
- } from "./chunk-NH43BFJ3.js";
34
+ } from "./chunk-EA22NMFU.js";
35
35
  import {
36
36
  envCommand
37
- } from "./chunk-TBR2Q37Y.js";
37
+ } from "./chunk-TPX7RZBM.js";
38
38
  import {
39
39
  confirmOption,
40
40
  deploymentOption,
@@ -2440,7 +2440,7 @@ var attachSubcommand = {
2440
2440
  type: [String],
2441
2441
  argument: "ENV",
2442
2442
  deprecated: false,
2443
- description: "Environments to enable. Repeatable and comma-separated (e.g. -e production -e preview, or -e production,preview). Defaults to all environments."
2443
+ description: "Environments to enable by system name, custom slug, or custom ID. Repeatable and comma-separated. Defaults to production, preview, and development."
2444
2444
  },
2445
2445
  {
2446
2446
  ...projectOption,
@@ -2462,6 +2462,14 @@ var attachSubcommand = {
2462
2462
  deprecated: false,
2463
2463
  description: "Target a specific git branch for the trigger destination (default: production). Only valid with --triggers."
2464
2464
  },
2465
+ {
2466
+ name: "trigger-environment",
2467
+ shorthand: null,
2468
+ type: String,
2469
+ argument: "ENV",
2470
+ deprecated: false,
2471
+ description: "Target a custom environment by slug or stable ID. Mutually exclusive with --trigger-branch and only valid with --triggers."
2472
+ },
2465
2473
  {
2466
2474
  name: "trigger-path",
2467
2475
  shorthand: null,
@@ -2478,13 +2486,21 @@ var attachSubcommand = {
2478
2486
  ],
2479
2487
  examples: [
2480
2488
  {
2481
- name: "Attach the current project to a connector for all environments",
2489
+ name: "Attach the current project for all system environments",
2482
2490
  value: `${packageName} connect attach scl_abc123`
2483
2491
  },
2484
2492
  {
2485
2493
  name: "Restrict to specific environments",
2486
2494
  value: `${packageName} connect attach scl_abc123 -e production -e preview`
2487
2495
  },
2496
+ {
2497
+ name: "Attach to a custom environment by slug",
2498
+ value: `${packageName} connect attach scl_abc123 -e qa`
2499
+ },
2500
+ {
2501
+ name: "Attach to a custom environment by stable ID",
2502
+ value: `${packageName} connect attach scl_abc123 -e env_qa123`
2503
+ },
2488
2504
  {
2489
2505
  name: "Attach a different project by name",
2490
2506
  value: `${packageName} connect attach slack/my-bot --project my-app`
@@ -2497,6 +2513,10 @@ var attachSubcommand = {
2497
2513
  name: "Attach and register a preview-branch trigger destination",
2498
2514
  value: `${packageName} connect attach scl_abc123 --triggers --trigger-branch staging --trigger-path /slack`
2499
2515
  },
2516
+ {
2517
+ name: "Attach and register a custom-environment trigger destination",
2518
+ value: `${packageName} connect attach scl_abc123 --triggers --trigger-environment qa --trigger-path /slack`
2519
+ },
2500
2520
  {
2501
2521
  name: "Non-interactive output as JSON",
2502
2522
  value: `${packageName} connect attach scl_abc123 --yes --format=json`
@@ -6,14 +6,14 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  setupAndLink
9
- } from "./chunk-NRNMT43R.js";
9
+ } from "./chunk-KGVT2RSG.js";
10
10
  import {
11
11
  detectExplicitScope,
12
12
  getLinkedProject,
13
13
  param,
14
14
  printProjectNotFoundError,
15
15
  resolveProjectCwd
16
- } from "./chunk-TBR2Q37Y.js";
16
+ } from "./chunk-TPX7RZBM.js";
17
17
  import {
18
18
  buildCommandWithYes,
19
19
  outputActionRequired
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  writeProjectSettings
9
- } from "./chunk-3242RXCN.js";
9
+ } from "./chunk-AZTV7WPZ.js";
10
10
  import {
11
11
  autoInstallVercelPlugin
12
12
  } from "./chunk-NJUPUGOE.js";
@@ -15,10 +15,10 @@ import {
15
15
  } from "./chunk-64IF634X.js";
16
16
  import {
17
17
  ensureLink
18
- } from "./chunk-HD7B425F.js";
18
+ } from "./chunk-WDE2EDYX.js";
19
19
  import {
20
20
  pullCommand
21
- } from "./chunk-NH43BFJ3.js";
21
+ } from "./chunk-EA22NMFU.js";
22
22
  import {
23
23
  help
24
24
  } from "./chunk-DMSLNAVH.js";
@@ -28,7 +28,7 @@ import {
28
28
  envPullCommandLogic,
29
29
  humanizePath,
30
30
  parseTarget
31
- } from "./chunk-TBR2Q37Y.js";
31
+ } from "./chunk-TPX7RZBM.js";
32
32
  import {
33
33
  TelemetryClient
34
34
  } from "./chunk-ECCWJHC6.js";
@@ -8,7 +8,7 @@ import {
8
8
  formatCondition,
9
9
  formatTransform,
10
10
  isTargetTransform
11
- } from "./chunk-555WJSO5.js";
11
+ } from "./chunk-DGFASMSE.js";
12
12
  import {
13
13
  output_manager_default
14
14
  } from "./chunk-OX7KI3LF.js";