vercel 54.17.2 → 54.17.3

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 (51) hide show
  1. package/dist/chunks/{add-ADMRKNTV.js → add-PQWZCK7O.js} +5 -5
  2. package/dist/chunks/{chunk-AZP6TNVD.js → chunk-2CYJVSAM.js} +1 -1
  3. package/dist/chunks/{chunk-KAICYGS4.js → chunk-4FG6Q2EM.js} +1 -1
  4. package/dist/chunks/{chunk-3ESVKDUA.js → chunk-5FAPBIX6.js} +1 -1
  5. package/dist/chunks/{chunk-7CTNFMKH.js → chunk-6V37RSQB.js} +1 -1
  6. package/dist/chunks/{chunk-NG53DNDG.js → chunk-ATBH7KGL.js} +1 -1
  7. package/dist/chunks/{chunk-LUORN5H7.js → chunk-BHMMV3HE.js} +2 -2
  8. package/dist/chunks/{chunk-2YIEJRSL.js → chunk-FMBDRMTZ.js} +4 -4
  9. package/dist/chunks/{chunk-A6I3RGAN.js → chunk-G4YL2LRL.js} +2 -2
  10. package/dist/chunks/{chunk-CQRLZB3Y.js → chunk-HCJRHKSM.js} +2 -2
  11. package/dist/chunks/{chunk-U7HYX4V6.js → chunk-IAOBSXJ5.js} +3 -3
  12. package/dist/chunks/{chunk-RL7DANWP.js → chunk-JKIM3UW3.js} +4 -4
  13. package/dist/chunks/{chunk-WR6JALPR.js → chunk-MB63D7UN.js} +1 -1
  14. package/dist/chunks/{chunk-PEJCJXGI.js → chunk-NRP6ZKXJ.js} +1 -1
  15. package/dist/chunks/{chunk-ZKAWVYGP.js → chunk-OSXRHH6W.js} +40 -40
  16. package/dist/chunks/{chunk-FR2CJ7AV.js → chunk-OYQKUG4C.js} +4 -4
  17. package/dist/chunks/{chunk-52DDM5F6.js → chunk-QM7D5H2G.js} +2 -2
  18. package/dist/chunks/{chunk-64KT5RVX.js → chunk-QMMMXYOY.js} +3 -3
  19. package/dist/chunks/{chunk-JYTOXUQJ.js → chunk-SBYEIQ32.js} +1 -1
  20. package/dist/chunks/{chunk-UZZBWCU2.js → chunk-UXP2N2WD.js} +3 -3
  21. package/dist/chunks/{chunk-NHGCQRK5.js → chunk-X5UROEGN.js} +12 -0
  22. package/dist/chunks/{compile-vercel-config-7IAWGVM7.js → compile-vercel-config-45XN4U4D.js} +2 -2
  23. package/dist/chunks/{delete-DHYJ7ZYD.js → delete-RQYOSBNO.js} +3 -3
  24. package/dist/chunks/{disable-A4D7SZ6G.js → disable-RRGOZIA7.js} +3 -3
  25. package/dist/chunks/{discard-PRE343AI.js → discard-X2NIGII5.js} +3 -3
  26. package/dist/chunks/{edit-MWFKADR7.js → edit-QV3Y6IUT.js} +4 -4
  27. package/dist/chunks/{enable-6P6TDM6D.js → enable-UQAJJKCG.js} +3 -3
  28. package/dist/chunks/{export-WISO5LBX.js → export-D4YNS2G5.js} +3 -3
  29. package/dist/chunks/{inspect-EBIQ5XF3.js → inspect-FHB3H3NA.js} +4 -4
  30. package/dist/chunks/{list-OD7KO5BB.js → list-6RAHTDT2.js} +3 -3
  31. package/dist/chunks/{list-755IMC6Y.js → list-QYUCZR26.js} +4 -4
  32. package/dist/chunks/{ls-ZSVMQVZX.js → ls-GKWWEHQS.js} +5 -5
  33. package/dist/chunks/{publish-LMGSRL3X.js → publish-UTKKRA4P.js} +3 -3
  34. package/dist/chunks/{query-WZTKABE4.js → query-NM7MXRFW.js} +3 -3
  35. package/dist/chunks/{reorder-QK5QJ6TW.js → reorder-ZLVQQBMG.js} +3 -3
  36. package/dist/chunks/{restore-VF3HDGON.js → restore-SDTDA4A6.js} +3 -3
  37. package/dist/chunks/{rm-QP57BPQO.js → rm-65PQY7XN.js} +5 -5
  38. package/dist/chunks/{rule-inspect-ZZJ7SQJF.js → rule-inspect-JFKSPCDU.js} +5 -5
  39. package/dist/chunks/{rules-SUBKFNPR.js → rules-6672IXZE.js} +7 -7
  40. package/dist/chunks/{schema-FSQEAUMR.js → schema-DC2LLUHD.js} +3 -3
  41. package/dist/chunks/{update-DDCJ2EDT.js → update-7VFELUTD.js} +5 -5
  42. package/dist/commands/build/index.js +10 -10
  43. package/dist/commands/deploy/index.js +11 -11
  44. package/dist/commands/dev/index.js +9 -9
  45. package/dist/commands/env/index.js +5 -5
  46. package/dist/commands/link/index.js +8 -8
  47. package/dist/commands/list/index.js +4 -4
  48. package/dist/commands-bulk.js +380 -239
  49. package/dist/index.js +9 -9
  50. package/dist/version.mjs +1 -1
  51. package/package.json +14 -14
@@ -31,7 +31,7 @@ import {
31
31
  runInteractiveEditLoop,
32
32
  stripQuotes,
33
33
  validateActionFlags
34
- } from "./chunks/chunk-PEJCJXGI.js";
34
+ } from "./chunks/chunk-NRP6ZKXJ.js";
35
35
  import {
36
36
  getRouteVersions
37
37
  } from "./chunks/chunk-AHU7WNL2.js";
@@ -49,7 +49,7 @@ import {
49
49
  parsePosition,
50
50
  parseSubcommandArgs,
51
51
  withGlobalFlags
52
- } from "./chunks/chunk-52DDM5F6.js";
52
+ } from "./chunks/chunk-QM7D5H2G.js";
53
53
  import {
54
54
  normalizeRepeatableStringFilters
55
55
  } from "./chunks/chunk-D7MGZH35.js";
@@ -65,19 +65,19 @@ import {
65
65
  resolveOpenApiTagForTeamsCli,
66
66
  setAutoUpdate,
67
67
  tryOpenApiFallback
68
- } from "./chunks/chunk-FR2CJ7AV.js";
68
+ } from "./chunks/chunk-OYQKUG4C.js";
69
69
  import {
70
70
  getUpdateCommand,
71
71
  isGlobal
72
- } from "./chunks/chunk-JYTOXUQJ.js";
72
+ } from "./chunks/chunk-SBYEIQ32.js";
73
73
  import {
74
74
  Now,
75
+ addDomain,
75
76
  collectContactInformation,
76
77
  createCertForCns,
77
78
  displayBuildLogs,
78
79
  displayRuntimeLogs,
79
80
  extractDomain,
80
- getDomain,
81
81
  getDomainByName,
82
82
  getDomainPrice,
83
83
  getDomainStatus,
@@ -90,14 +90,14 @@ import {
90
90
  require_format,
91
91
  require_jsonlines,
92
92
  setupDomain
93
- } from "./chunks/chunk-ZKAWVYGP.js";
93
+ } from "./chunks/chunk-OSXRHH6W.js";
94
94
  import {
95
95
  getGlobalPathConfig,
96
96
  persistAuthConfig,
97
97
  readLocalConfig,
98
98
  sleep,
99
99
  writeToConfigFile
100
- } from "./chunks/chunk-CQRLZB3Y.js";
100
+ } from "./chunks/chunk-HCJRHKSM.js";
101
101
  import "./chunks/chunk-V5P25P7F.js";
102
102
  import {
103
103
  ellipsis,
@@ -125,7 +125,7 @@ import {
125
125
  import {
126
126
  formatEnvironment,
127
127
  validateLsArgs
128
- } from "./chunks/chunk-3ESVKDUA.js";
128
+ } from "./chunks/chunk-5FAPBIX6.js";
129
129
  import {
130
130
  validateJsonOutput
131
131
  } from "./chunks/chunk-XPKWKPWA.js";
@@ -398,7 +398,7 @@ import {
398
398
  webAnalyticsSubcommand,
399
399
  webhooksCommand,
400
400
  whoamiCommand
401
- } from "./chunks/chunk-UZZBWCU2.js";
401
+ } from "./chunks/chunk-UXP2N2WD.js";
402
402
  import {
403
403
  metricsCommand,
404
404
  schemaSubcommand
@@ -440,9 +440,9 @@ import {
440
440
  import "./chunks/chunk-IJJOI63T.js";
441
441
  import {
442
442
  main
443
- } from "./chunks/chunk-RL7DANWP.js";
443
+ } from "./chunks/chunk-JKIM3UW3.js";
444
444
  import "./chunks/chunk-IB5L4LKZ.js";
445
- import "./chunks/chunk-KAICYGS4.js";
445
+ import "./chunks/chunk-4FG6Q2EM.js";
446
446
  import {
447
447
  require_execa
448
448
  } from "./chunks/chunk-YI3JV6GM.js";
@@ -457,19 +457,19 @@ import {
457
457
  } from "./chunks/chunk-VXYGCOKL.js";
458
458
  import {
459
459
  ensureLink
460
- } from "./chunks/chunk-64KT5RVX.js";
461
- import "./chunks/chunk-2YIEJRSL.js";
460
+ } from "./chunks/chunk-QMMMXYOY.js";
461
+ import "./chunks/chunk-FMBDRMTZ.js";
462
462
  import {
463
463
  AGENT_ACTION,
464
464
  AGENT_REASON,
465
465
  AGENT_STATUS
466
466
  } from "./chunks/chunk-QH7WYDEP.js";
467
- import "./chunks/chunk-AZP6TNVD.js";
468
- import "./chunks/chunk-NG53DNDG.js";
467
+ import "./chunks/chunk-2CYJVSAM.js";
468
+ import "./chunks/chunk-ATBH7KGL.js";
469
469
  import {
470
470
  detectExplicitScope,
471
471
  getScope
472
- } from "./chunks/chunk-7CTNFMKH.js";
472
+ } from "./chunks/chunk-6V37RSQB.js";
473
473
  import {
474
474
  help
475
475
  } from "./chunks/chunk-3NR6OYDV.js";
@@ -518,7 +518,7 @@ import {
518
518
  selectAndParseRemoteUrl,
519
519
  selectOrg,
520
520
  ua_default
521
- } from "./chunks/chunk-LUORN5H7.js";
521
+ } from "./chunks/chunk-BHMMV3HE.js";
522
522
  import {
523
523
  TelemetryClient
524
524
  } from "./chunks/chunk-Q77ALSXR.js";
@@ -532,8 +532,9 @@ import {
532
532
  openUrlInBrowserCommand,
533
533
  outputActionRequired,
534
534
  outputAgentError,
535
+ outputAgentSuccess,
535
536
  shouldEmitNonInteractiveCommandError
536
- } from "./chunks/chunk-NHGCQRK5.js";
537
+ } from "./chunks/chunk-X5UROEGN.js";
537
538
  import {
538
539
  require_lib as require_lib3
539
540
  } from "./chunks/chunk-N2T234LO.js";
@@ -899,7 +900,7 @@ async function activity(client) {
899
900
  return 0;
900
901
  }
901
902
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
902
- const listFn = (await import("./chunks/list-OD7KO5BB.js")).default;
903
+ const listFn = (await import("./chunks/list-6RAHTDT2.js")).default;
903
904
  return listFn(client, telemetry2);
904
905
  }
905
906
  }
@@ -2002,17 +2003,17 @@ async function alerts(client) {
2002
2003
  switch (subcommand) {
2003
2004
  case "inspect": {
2004
2005
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
2005
- const inspectFn = (await import("./chunks/inspect-EBIQ5XF3.js")).default;
2006
+ const inspectFn = (await import("./chunks/inspect-FHB3H3NA.js")).default;
2006
2007
  return inspectFn(client, args);
2007
2008
  }
2008
2009
  case "rules": {
2009
2010
  telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
2010
- const rulesFn = (await import("./chunks/rules-SUBKFNPR.js")).default;
2011
+ const rulesFn = (await import("./chunks/rules-6672IXZE.js")).default;
2011
2012
  return rulesFn(client, args);
2012
2013
  }
2013
2014
  default: {
2014
2015
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
2015
- const listFn = (await import("./chunks/list-755IMC6Y.js")).default;
2016
+ const listFn = (await import("./chunks/list-QYUCZR26.js")).default;
2016
2017
  return listFn(client, telemetry2);
2017
2018
  }
2018
2019
  }
@@ -14002,52 +14003,21 @@ async function dns(client) {
14002
14003
  }
14003
14004
 
14004
14005
  // src/commands/domains/add.ts
14005
- var import_chalk59 = __toESM(require_source(), 1);
14006
-
14007
- // src/util/format-ns-table.ts
14008
- var import_chalk56 = __toESM(require_source(), 1);
14009
-
14010
- // src/util/output/chars.ts
14011
- var chars = {
14012
- tick: process.platform === "win32" ? "\u221A" : "\u2714",
14013
- cross: process.platform === "win32" ? "\u2613" : "\u2718"
14014
- };
14015
- var chars_default = chars;
14016
-
14017
- // src/util/format-ns-table.ts
14018
- function formatNSTable(intendedNameservers, currentNameservers, { extraSpace = "" } = {}) {
14019
- const sortedIntended = intendedNameservers.sort();
14020
- const sortedCurrent = currentNameservers.sort();
14021
- const maxLength = Math.max(
14022
- intendedNameservers.length,
14023
- currentNameservers.length
14024
- );
14025
- const rows = [];
14026
- for (let i = 0; i < maxLength; i++) {
14027
- rows.push([
14028
- sortedIntended[i] || import_chalk56.default.gray("-"),
14029
- sortedCurrent[i] || import_chalk56.default.gray("-"),
14030
- sortedIntended[i] === sortedCurrent[i] ? import_chalk56.default.green(chars_default.tick) : import_chalk56.default.red(chars_default.cross)
14031
- ]);
14032
- }
14033
- return table(
14034
- [
14035
- [
14036
- import_chalk56.default.gray("Intended Nameservers"),
14037
- import_chalk56.default.gray("Current Nameservers"),
14038
- ""
14039
- ],
14040
- ...rows
14041
- ],
14042
- { hsep: 4 }
14043
- ).replace(/^(.*)/gm, `${extraSpace}$1`);
14044
- }
14006
+ var import_chalk58 = __toESM(require_source(), 1);
14045
14007
 
14046
14008
  // src/util/domains/is-public-suffix.ts
14047
14009
  function isPublicSuffix(domainName) {
14048
14010
  return domainName.endsWith(".vercel.app") || domainName.endsWith(".now.sh");
14049
14011
  }
14050
14012
 
14013
+ // src/util/is-root-domain.ts
14014
+ var import_tldts5 = __toESM(require_cjs(), 1);
14015
+ function isRootDomain(domainName) {
14016
+ const parsedDomain = (0, import_tldts5.parse)(domainName);
14017
+ const { domain: rootDomain, subdomain } = parsedDomain;
14018
+ return Boolean(!subdomain && rootDomain);
14019
+ }
14020
+
14051
14021
  // src/util/domains/get-domain-config.ts
14052
14022
  async function getDomainConfig(client, domainName) {
14053
14023
  try {
@@ -14064,10 +14034,10 @@ async function getDomainConfig(client, domainName) {
14064
14034
  }
14065
14035
 
14066
14036
  // src/util/projects/add-domain-to-project.ts
14067
- var import_chalk57 = __toESM(require_source(), 1);
14037
+ var import_chalk56 = __toESM(require_source(), 1);
14068
14038
  async function addDomainToProject(client, projectNameOrId, domain2) {
14069
14039
  output_manager_default.spinner(
14070
- `Adding domain ${domain2} to project ${import_chalk57.default.bold(projectNameOrId)}`
14040
+ `Adding domain ${domain2} to project ${import_chalk56.default.bold(projectNameOrId)}`
14071
14041
  );
14072
14042
  try {
14073
14043
  const response = await client.fetch(
@@ -14097,11 +14067,44 @@ async function addDomainToProject(client, projectNameOrId, domain2) {
14097
14067
  }
14098
14068
  }
14099
14069
 
14070
+ // src/util/projects/get-project-domain.ts
14071
+ function getProjectDomain(client, projectIdOrName, domainName, options = {}) {
14072
+ return fetchProjectDomain(
14073
+ client,
14074
+ `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}`,
14075
+ options
14076
+ );
14077
+ }
14078
+ function getProjectDomainByName(client, domainName, options = {}) {
14079
+ return fetchProjectDomain(
14080
+ client,
14081
+ `/project-domains/${encodeURIComponent(domainName)}`,
14082
+ options
14083
+ );
14084
+ }
14085
+ function verifyProjectDomain(client, projectIdOrName, domainName, options = {}) {
14086
+ return fetchProjectDomain(
14087
+ client,
14088
+ `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}/verify`,
14089
+ { ...options, method: "POST" }
14090
+ );
14091
+ }
14092
+ async function fetchProjectDomain(client, url, init2) {
14093
+ try {
14094
+ return await client.fetch(url, init2);
14095
+ } catch (err) {
14096
+ if (isAPIError(err) && err.status < 500) {
14097
+ return err;
14098
+ }
14099
+ throw err;
14100
+ }
14101
+ }
14102
+
14100
14103
  // src/util/projects/remove-domain-from-project.ts
14101
- var import_chalk58 = __toESM(require_source(), 1);
14104
+ var import_chalk57 = __toESM(require_source(), 1);
14102
14105
  async function removeDomainFromProject(client, projectNameOrId, domain2) {
14103
14106
  output_manager_default.spinner(
14104
- `Removing domain ${domain2} from project ${import_chalk58.default.bold(projectNameOrId)}`
14107
+ `Removing domain ${domain2} from project ${import_chalk57.default.bold(projectNameOrId)}`
14105
14108
  );
14106
14109
  try {
14107
14110
  const response = await client.fetch(
@@ -14153,7 +14156,7 @@ function withGlobalFlags5(client, commandTemplate) {
14153
14156
  return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
14154
14157
  }
14155
14158
  var VERCEL_DOMAINS_DASHBOARD = "https://vercel.com/dashboard/domains";
14156
- function nextCommandsForDomainsAddFailure(client, domainName, projectName, err, linkedProject) {
14159
+ function nextCommandsForDomainsAddFailure(client, domainName, projectName, err) {
14157
14160
  const next = [
14158
14161
  {
14159
14162
  command: withGlobalFlags5(client, `domains inspect ${domainName}`),
@@ -14180,15 +14183,62 @@ function nextCommandsForDomainsAddFailure(client, domainName, projectName, err,
14180
14183
  when: "to open the Domains dashboard in your browser"
14181
14184
  });
14182
14185
  }
14183
- if (aliasConflict && !looksLikeOwnershipOrPurchaseIssue) {
14184
- const forceCmd = linkedProject ? `domains add ${domainName} --force` : `domains add ${domainName} ${projectName} --force`;
14186
+ if (aliasConflict && !looksLikeOwnershipOrPurchaseIssue && projectName) {
14185
14187
  next.push({
14186
- command: withGlobalFlags5(client, forceCmd),
14188
+ command: withGlobalFlags5(
14189
+ client,
14190
+ `domains add ${domainName} ${projectName} --force`
14191
+ ),
14187
14192
  when: "to force move from another project (only if API returns project id\u2014otherwise remove domain from the other project first)"
14188
14193
  });
14189
14194
  }
14190
14195
  return next;
14191
14196
  }
14197
+ function nextCommandsForDomainsAddSuccess(client, domainName, projectName) {
14198
+ if (!projectName) {
14199
+ return [
14200
+ {
14201
+ command: withGlobalFlags5(client, `domains add ${domainName} <project>`),
14202
+ when: "to attach this domain to a project"
14203
+ },
14204
+ {
14205
+ command: withGlobalFlags5(client, `domains inspect ${domainName}`),
14206
+ when: "to inspect domain configuration and ownership"
14207
+ }
14208
+ ];
14209
+ }
14210
+ return [
14211
+ {
14212
+ command: withGlobalFlags5(client, `domains verify ${domainName}`),
14213
+ when: "to check DNS configuration and see the records you need to set"
14214
+ },
14215
+ {
14216
+ command: withGlobalFlags5(client, `domains inspect ${domainName}`),
14217
+ when: "to inspect domain configuration and ownership"
14218
+ }
14219
+ ];
14220
+ }
14221
+ async function printDomainConfiguration(client, domainName) {
14222
+ if (isPublicSuffix(domainName)) {
14223
+ output_manager_default.log(
14224
+ "The domain will automatically get assigned to your latest production deployment."
14225
+ );
14226
+ return 0;
14227
+ }
14228
+ const domainConfig = await getDomainConfig(client, domainName);
14229
+ if (!(domainConfig instanceof Error) && domainConfig.misconfigured) {
14230
+ output_manager_default.warn(
14231
+ `This domain is not configured properly. Run ${getCommandName(
14232
+ `domains verify ${domainName}`
14233
+ )} to see how to configure it.`
14234
+ );
14235
+ } else {
14236
+ output_manager_default.log(
14237
+ "The domain will automatically get assigned to your latest production deployment."
14238
+ );
14239
+ }
14240
+ return 0;
14241
+ }
14192
14242
  async function add5(client, argv) {
14193
14243
  const telemetry2 = new DomainsAddTelemetryClient({
14194
14244
  opts: {
@@ -14218,25 +14268,20 @@ async function add5(client, argv) {
14218
14268
  const force = opts["--force"];
14219
14269
  telemetry2.trackCliFlagForce(force);
14220
14270
  const { contextName } = await getScope(client);
14221
- const project = await getLinkedProject(client).then((result) => {
14222
- if (result.status === "linked") {
14223
- return result.project;
14224
- }
14225
- return null;
14226
- });
14227
- if (project && args.length !== 1) {
14271
+ if (args.length < 1 || args.length > 2) {
14228
14272
  if (client.nonInteractive) {
14273
+ const cmd2 = withGlobalFlags5(client, "domains add <domain> [project]");
14229
14274
  outputActionRequired(
14230
14275
  client,
14231
14276
  {
14232
14277
  status: "action_required",
14233
14278
  reason: "missing_arguments",
14234
14279
  action: "missing_arguments",
14235
- message: `Linked project is "${project.name}". Run: ${withGlobalFlags5(client, `domains add <domain>`)}`,
14280
+ message: `Run: ${cmd2}`,
14236
14281
  next: [
14237
14282
  {
14238
- command: withGlobalFlags5(client, `domains add <domain>`),
14239
- when: "to add a domain to the linked project (single argument)"
14283
+ command: cmd2,
14284
+ when: "to add a domain to your team, or pass a project name to assign it to a project"
14240
14285
  }
14241
14286
  ]
14242
14287
  },
@@ -14244,67 +14289,209 @@ async function add5(client, argv) {
14244
14289
  );
14245
14290
  }
14246
14291
  output_manager_default.error(
14247
- `${getCommandName("domains add <domain>")} expects one argument.`
14292
+ `${getCommandName(
14293
+ "domains add <domain> [project]"
14294
+ )} expects one or two arguments.`
14248
14295
  );
14249
14296
  return 1;
14250
14297
  }
14251
- if (!project && args.length !== 2) {
14298
+ const domainName = String(args[0]);
14299
+ const projectName = args.length === 2 ? String(args[1]) : void 0;
14300
+ telemetry2.trackCliArgumentDomain(domainName);
14301
+ telemetry2.trackCliArgumentProject(args[1]);
14302
+ if (!projectName) {
14303
+ if (!isPublicSuffix(domainName) && !isRootDomain(domainName)) {
14304
+ const cmd2 = withGlobalFlags5(
14305
+ client,
14306
+ `domains add ${domainName} <project>`
14307
+ );
14308
+ const message = `Only apex domains can be added without a project. To add the subdomain ${domainName}, pass a project: ${cmd2}`;
14309
+ if (client.nonInteractive) {
14310
+ outputActionRequired(
14311
+ client,
14312
+ {
14313
+ status: "action_required",
14314
+ reason: "project_required_for_subdomain",
14315
+ action: "add_with_project",
14316
+ message,
14317
+ next: [
14318
+ {
14319
+ command: cmd2,
14320
+ when: "to add this subdomain to a specific project"
14321
+ }
14322
+ ]
14323
+ },
14324
+ 1
14325
+ );
14326
+ }
14327
+ output_manager_default.error(message);
14328
+ return 1;
14329
+ }
14330
+ const addStamp2 = stamp_default();
14331
+ let addResult;
14332
+ try {
14333
+ addResult = await addDomain(client, domainName, contextName);
14334
+ } catch (err) {
14335
+ const error = err instanceof Error ? err : new Error(String(err));
14336
+ if (client.nonInteractive) {
14337
+ const status3 = isAPIError(error) ? error.status : void 0;
14338
+ const apiErr = error;
14339
+ const code2 = typeof apiErr.code === "string" ? apiErr.code : "";
14340
+ const msg = error.message.toLowerCase();
14341
+ let reason = status3 === 403 ? "forbidden" : status3 === 404 ? "not_found" : status3 === 409 || msg.includes("already") ? "alias_conflict" : "domain_add_failed";
14342
+ if (code2 === "not_domain_owner" || status3 === 403 && msg.includes("not authorized")) {
14343
+ reason = "domain_not_owned";
14344
+ }
14345
+ let message = (0, import_error_utils8.errorToString)(error);
14346
+ if (reason === "domain_not_owned" || code2 === "invalid_domain" || msg.includes("not authorized to use")) {
14347
+ message += " domains add is for domains you already own or control via DNS. If you have not purchased the domain yet, the user must run 'domains buy' interactively (agents must not purchase) or buy in the dashboard; use 'domains transfer-in' to move an existing registration to Vercel.";
14348
+ }
14349
+ outputAgentError(
14350
+ client,
14351
+ {
14352
+ status: "error",
14353
+ reason,
14354
+ message,
14355
+ next: nextCommandsForDomainsAddFailure(
14356
+ client,
14357
+ domainName,
14358
+ "",
14359
+ error
14360
+ )
14361
+ },
14362
+ 1
14363
+ );
14364
+ }
14365
+ output_manager_default.prettyError(error);
14366
+ return 1;
14367
+ }
14368
+ if (addResult instanceof InvalidDomain) {
14369
+ if (client.nonInteractive) {
14370
+ outputAgentError(
14371
+ client,
14372
+ {
14373
+ status: "error",
14374
+ reason: "invalid_domain",
14375
+ message: (0, import_error_utils8.errorToString)(addResult)
14376
+ },
14377
+ 1
14378
+ );
14379
+ }
14380
+ output_manager_default.prettyError(addResult);
14381
+ return 1;
14382
+ }
14383
+ if (addResult instanceof DomainAlreadyExists) {
14384
+ if (client.nonInteractive) {
14385
+ outputAgentError(
14386
+ client,
14387
+ {
14388
+ status: "error",
14389
+ reason: "domain_already_exists",
14390
+ message: (0, import_error_utils8.errorToString)(addResult)
14391
+ },
14392
+ 1
14393
+ );
14394
+ }
14395
+ output_manager_default.prettyError(addResult);
14396
+ return 1;
14397
+ }
14252
14398
  if (client.nonInteractive) {
14253
- const cmd2 = withGlobalFlags5(client, "domains add <domain> <project>");
14254
- outputActionRequired(
14399
+ outputAgentSuccess(
14255
14400
  client,
14256
14401
  {
14257
- status: "action_required",
14258
- reason: "missing_arguments",
14259
- action: "missing_arguments",
14260
- message: `No linked project and domain needs a project. Run: ${cmd2}`,
14261
- next: [
14262
- {
14263
- command: cmd2,
14264
- when: "to add a domain to a project (or link a project first)"
14265
- }
14266
- ]
14402
+ status: "success",
14403
+ reason: "domain_added",
14404
+ message: `Domain ${domainName} added to ${contextName}.`,
14405
+ next: nextCommandsForDomainsAddSuccess(client, domainName)
14267
14406
  },
14268
- 1
14407
+ 0
14269
14408
  );
14270
14409
  }
14271
- output_manager_default.error(
14272
- `${getCommandName(
14273
- "domains add <domain> <project>"
14274
- )} expects two arguments.`
14410
+ output_manager_default.success(
14411
+ `Domain ${import_chalk58.default.bold(domainName)} added to ${import_chalk58.default.bold(
14412
+ contextName
14413
+ )}. ${addStamp2()}`
14275
14414
  );
14276
- return 1;
14415
+ return 0;
14277
14416
  }
14278
- const domainName = String(args[0]);
14279
- const projectName = project ? project.name : String(args[1]);
14280
- telemetry2.trackCliArgumentDomain(domainName);
14281
- telemetry2.trackCliArgumentProject(args[1]);
14282
14417
  const addStamp = stamp_default();
14283
14418
  let aliasTarget = await addDomainToProject(client, projectName, domainName);
14284
14419
  if (aliasTarget instanceof Error) {
14285
- if (aliasTarget instanceof APIError && aliasTarget.code === "ALIAS_DOMAIN_EXIST" && aliasTarget.project && aliasTarget.project.id) {
14286
- if (force) {
14287
- const removeResponse = await removeDomainFromProject(
14420
+ if (aliasTarget instanceof APIError && aliasTarget.code === "ALIAS_DOMAIN_EXIST") {
14421
+ const conflictProject = aliasTarget.project;
14422
+ let alreadyOnRequestedProject = Boolean(
14423
+ conflictProject && (conflictProject.id === projectName || conflictProject.name === projectName)
14424
+ );
14425
+ if (!alreadyOnRequestedProject) {
14426
+ const existing = await getProjectDomain(
14288
14427
  client,
14289
- aliasTarget.project.id,
14428
+ projectName,
14290
14429
  domainName
14291
14430
  );
14292
- if (removeResponse instanceof Error) {
14293
- if (client.nonInteractive) {
14294
- outputAgentError(
14295
- client,
14296
- {
14297
- status: "error",
14298
- reason: "domain_remove_failed",
14299
- message: (0, import_error_utils8.errorToString)(removeResponse)
14300
- },
14301
- 1
14302
- );
14431
+ alreadyOnRequestedProject = !(existing instanceof Error);
14432
+ }
14433
+ if (alreadyOnRequestedProject) {
14434
+ if (client.nonInteractive) {
14435
+ outputAgentSuccess(
14436
+ client,
14437
+ {
14438
+ status: "success",
14439
+ reason: "domain_already_assigned",
14440
+ message: `Domain ${domainName} is already assigned to project ${projectName}.`,
14441
+ next: nextCommandsForDomainsAddSuccess(
14442
+ client,
14443
+ domainName,
14444
+ projectName
14445
+ )
14446
+ },
14447
+ 0
14448
+ );
14449
+ }
14450
+ output_manager_default.log(
14451
+ `Domain ${import_chalk58.default.bold(domainName)} is already assigned to project ${import_chalk58.default.bold(
14452
+ projectName
14453
+ )}. ${addStamp()}`
14454
+ );
14455
+ return printDomainConfiguration(client, domainName);
14456
+ }
14457
+ if (force) {
14458
+ let currentProjectId = conflictProject?.id;
14459
+ if (!currentProjectId) {
14460
+ const currentProjectDomain = await getProjectDomainByName(
14461
+ client,
14462
+ domainName
14463
+ );
14464
+ if (!(currentProjectDomain instanceof Error)) {
14465
+ currentProjectId = currentProjectDomain.projectId;
14303
14466
  }
14304
- output_manager_default.prettyError(removeResponse);
14305
- return 1;
14306
14467
  }
14307
- aliasTarget = await addDomainToProject(client, projectName, domainName);
14468
+ if (currentProjectId) {
14469
+ const removeResponse = await removeDomainFromProject(
14470
+ client,
14471
+ currentProjectId,
14472
+ domainName
14473
+ );
14474
+ if (removeResponse instanceof Error) {
14475
+ if (client.nonInteractive) {
14476
+ outputAgentError(
14477
+ client,
14478
+ {
14479
+ status: "error",
14480
+ reason: "domain_remove_failed",
14481
+ message: (0, import_error_utils8.errorToString)(removeResponse)
14482
+ },
14483
+ 1
14484
+ );
14485
+ }
14486
+ output_manager_default.prettyError(removeResponse);
14487
+ return 1;
14488
+ }
14489
+ aliasTarget = await addDomainToProject(
14490
+ client,
14491
+ projectName,
14492
+ domainName
14493
+ );
14494
+ }
14308
14495
  }
14309
14496
  }
14310
14497
  if (aliasTarget instanceof Error) {
@@ -14331,8 +14518,7 @@ async function add5(client, argv) {
14331
14518
  client,
14332
14519
  domainName,
14333
14520
  projectName,
14334
- aliasTarget,
14335
- !!project
14521
+ aliasTarget
14336
14522
  )
14337
14523
  },
14338
14524
  1
@@ -14342,79 +14528,28 @@ async function add5(client, argv) {
14342
14528
  return 1;
14343
14529
  }
14344
14530
  }
14531
+ if (client.nonInteractive) {
14532
+ outputAgentSuccess(
14533
+ client,
14534
+ {
14535
+ status: "success",
14536
+ reason: "domain_added",
14537
+ message: `Domain ${domainName} added to project ${projectName}.`,
14538
+ next: nextCommandsForDomainsAddSuccess(client, domainName, projectName)
14539
+ },
14540
+ 0
14541
+ );
14542
+ }
14345
14543
  output_manager_default.success(
14346
- `Domain ${import_chalk59.default.bold(domainName)} added to project ${import_chalk59.default.bold(
14544
+ `Domain ${import_chalk58.default.bold(domainName)} added to project ${import_chalk58.default.bold(
14347
14545
  projectName
14348
14546
  )}. ${addStamp()}`
14349
14547
  );
14350
- if (isPublicSuffix(domainName)) {
14351
- output_manager_default.log(
14352
- "The domain will automatically get assigned to your latest production deployment."
14353
- );
14354
- return 0;
14355
- }
14356
- const domainResponse = await getDomain(client, contextName, domainName);
14357
- if (domainResponse instanceof Error) {
14358
- if (client.nonInteractive) {
14359
- outputAgentError(
14360
- client,
14361
- {
14362
- status: "error",
14363
- reason: "domain_fetch_failed",
14364
- message: (0, import_error_utils8.errorToString)(domainResponse)
14365
- },
14366
- 1
14367
- );
14368
- }
14369
- output_manager_default.prettyError(domainResponse);
14370
- return 1;
14371
- }
14372
- const domainConfig = await getDomainConfig(client, domainName);
14373
- if (domainConfig.misconfigured) {
14374
- output_manager_default.warn(
14375
- "This domain is not configured properly. To configure it you should either:"
14376
- );
14377
- output_manager_default.print(
14378
- ` ${import_chalk59.default.grey("a)")} Set the following record on your DNS provider to continue: ${code(`A ${domainName} 76.76.21.21`)} ${import_chalk59.default.grey("[recommended]")}
14379
- `
14380
- );
14381
- output_manager_default.print(
14382
- ` ${import_chalk59.default.grey("b)")} Change your Domains's nameservers to the intended set`
14383
- );
14384
- output_manager_default.print(
14385
- `
14386
- ${formatNSTable(
14387
- domainResponse.intendedNameservers,
14388
- domainResponse.nameservers,
14389
- { extraSpace: " " }
14390
- )}
14391
-
14392
- `
14393
- );
14394
- output_manager_default.print(
14395
- " We will run a verification for you and you will receive an email upon completion.\n"
14396
- );
14397
- output_manager_default.print(" Read more: https://vercel.link/domain-configuration\n\n");
14398
- } else {
14399
- output_manager_default.log(
14400
- "The domain will automatically get assigned to your latest production deployment."
14401
- );
14402
- }
14403
- return 0;
14404
- }
14405
-
14406
- // src/commands/domains/check.ts
14407
- var import_chalk60 = __toESM(require_source(), 1);
14408
-
14409
- // src/util/is-root-domain.ts
14410
- var import_tldts5 = __toESM(require_cjs(), 1);
14411
- function isRootDomain(domainName) {
14412
- const parsedDomain = (0, import_tldts5.parse)(domainName);
14413
- const { domain: rootDomain, subdomain } = parsedDomain;
14414
- return Boolean(!subdomain && rootDomain);
14548
+ return printDomainConfiguration(client, domainName);
14415
14549
  }
14416
14550
 
14417
14551
  // src/commands/domains/check.ts
14552
+ var import_chalk59 = __toESM(require_source(), 1);
14418
14553
  async function check(client, argv) {
14419
14554
  let parsedArgs;
14420
14555
  const flagsSpecification = getFlagsSpecification(checkSubcommand.options);
@@ -14496,7 +14631,7 @@ async function check(client, argv) {
14496
14631
  }
14497
14632
  for (const result of results) {
14498
14633
  output_manager_default.log(
14499
- `The domain ${param(result.domain)} is ${import_chalk60.default.underline(
14634
+ `The domain ${param(result.domain)} is ${import_chalk59.default.underline(
14500
14635
  result.available ? "available" : "unavailable"
14501
14636
  )}.`
14502
14637
  );
@@ -14525,7 +14660,7 @@ async function check(client, argv) {
14525
14660
  }
14526
14661
 
14527
14662
  // src/commands/domains/transfer-in.ts
14528
- var import_chalk61 = __toESM(require_source(), 1);
14663
+ var import_chalk60 = __toESM(require_source(), 1);
14529
14664
 
14530
14665
  // src/util/domains/transfer-in-domain.ts
14531
14666
  async function transferInDomain(client, name, authCode, expectedPrice, years) {
@@ -14668,13 +14803,13 @@ async function transferIn(client, argv) {
14668
14803
  }
14669
14804
  const { contextName } = await getScope(client);
14670
14805
  output_manager_default.log(
14671
- `The domain ${param(domainName)} is ${import_chalk61.default.underline(
14806
+ `The domain ${param(domainName)} is ${import_chalk60.default.underline(
14672
14807
  "available"
14673
- )} to transfer under ${import_chalk61.default.bold(contextName)}! ${availableStamp()}`
14808
+ )} to transfer under ${import_chalk60.default.bold(contextName)}! ${availableStamp()}`
14674
14809
  );
14675
14810
  const authCode = await getAuthCode(client, opts["--code"]);
14676
14811
  const shouldTransfer = await client.input.confirm(
14677
- `Transfer now with 1yr renewal for ${import_chalk61.default.bold(`$${transferPrice}`)}?`,
14812
+ `Transfer now with 1yr renewal for ${import_chalk60.default.bold(`$${transferPrice}`)}?`,
14678
14813
  false
14679
14814
  );
14680
14815
  if (!shouldTransfer) {
@@ -14745,6 +14880,45 @@ async function transferIn(client, argv) {
14745
14880
  // src/commands/domains/inspect.ts
14746
14881
  var import_chalk62 = __toESM(require_source(), 1);
14747
14882
 
14883
+ // src/util/format-ns-table.ts
14884
+ var import_chalk61 = __toESM(require_source(), 1);
14885
+
14886
+ // src/util/output/chars.ts
14887
+ var chars = {
14888
+ tick: process.platform === "win32" ? "\u221A" : "\u2714",
14889
+ cross: process.platform === "win32" ? "\u2613" : "\u2718"
14890
+ };
14891
+ var chars_default = chars;
14892
+
14893
+ // src/util/format-ns-table.ts
14894
+ function formatNSTable(intendedNameservers, currentNameservers, { extraSpace = "" } = {}) {
14895
+ const sortedIntended = intendedNameservers.sort();
14896
+ const sortedCurrent = currentNameservers.sort();
14897
+ const maxLength = Math.max(
14898
+ intendedNameservers.length,
14899
+ currentNameservers.length
14900
+ );
14901
+ const rows = [];
14902
+ for (let i = 0; i < maxLength; i++) {
14903
+ rows.push([
14904
+ sortedIntended[i] || import_chalk61.default.gray("-"),
14905
+ sortedCurrent[i] || import_chalk61.default.gray("-"),
14906
+ sortedIntended[i] === sortedCurrent[i] ? import_chalk61.default.green(chars_default.tick) : import_chalk61.default.red(chars_default.cross)
14907
+ ]);
14908
+ }
14909
+ return table(
14910
+ [
14911
+ [
14912
+ import_chalk61.default.gray("Intended Nameservers"),
14913
+ import_chalk61.default.gray("Current Nameservers"),
14914
+ ""
14915
+ ],
14916
+ ...rows
14917
+ ],
14918
+ { hsep: 4 }
14919
+ ).replace(/^(.*)/gm, `${extraSpace}$1`);
14920
+ }
14921
+
14748
14922
  // src/util/projects/find-projects-for-domain.ts
14749
14923
  async function findProjectsForDomain(client, domainName) {
14750
14924
  try {
@@ -16229,39 +16403,6 @@ async function getDomainConfigV6(client, domainName, options = {}) {
16229
16403
  }
16230
16404
  }
16231
16405
 
16232
- // src/util/projects/get-project-domain.ts
16233
- function getProjectDomain(client, projectIdOrName, domainName, options = {}) {
16234
- return fetchProjectDomain(
16235
- client,
16236
- `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}`,
16237
- options
16238
- );
16239
- }
16240
- function getProjectDomainByName(client, domainName, options = {}) {
16241
- return fetchProjectDomain(
16242
- client,
16243
- `/project-domains/${encodeURIComponent(domainName)}`,
16244
- options
16245
- );
16246
- }
16247
- function verifyProjectDomain(client, projectIdOrName, domainName, options = {}) {
16248
- return fetchProjectDomain(
16249
- client,
16250
- `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}/verify`,
16251
- { ...options, method: "POST" }
16252
- );
16253
- }
16254
- async function fetchProjectDomain(client, url, init2) {
16255
- try {
16256
- return await client.fetch(url, init2);
16257
- } catch (err) {
16258
- if (isAPIError(err) && err.status < 500) {
16259
- return err;
16260
- }
16261
- throw err;
16262
- }
16263
- }
16264
-
16265
16406
  // src/commands/domains/verify-acquisition.ts
16266
16407
  async function acquireVerificationFacts(client, options) {
16267
16408
  const { domainName } = options;
@@ -41266,7 +41407,7 @@ async function metrics(client) {
41266
41407
  return 0;
41267
41408
  }
41268
41409
  telemetry2.trackCliSubcommandSchema(subcommandOriginal);
41269
- const schemaFn = (await import("./chunks/schema-FSQEAUMR.js")).default;
41410
+ const schemaFn = (await import("./chunks/schema-DC2LLUHD.js")).default;
41270
41411
  return schemaFn(client, telemetry2);
41271
41412
  }
41272
41413
  default: {
@@ -41279,7 +41420,7 @@ async function metrics(client) {
41279
41420
  output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
41280
41421
  return 2;
41281
41422
  }
41282
- const queryFn = (await import("./chunks/query-WZTKABE4.js")).default;
41423
+ const queryFn = (await import("./chunks/query-NM7MXRFW.js")).default;
41283
41424
  return queryFn(client, telemetry2);
41284
41425
  }
41285
41426
  }
@@ -52190,7 +52331,7 @@ async function main27(client) {
52190
52331
  return 2;
52191
52332
  }
52192
52333
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
52193
- return (await import("./chunks/edit-MWFKADR7.js")).default(client, args);
52334
+ return (await import("./chunks/edit-QV3Y6IUT.js")).default(client, args);
52194
52335
  case "delete":
52195
52336
  if (needHelp) {
52196
52337
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52198,7 +52339,7 @@ async function main27(client) {
52198
52339
  return 2;
52199
52340
  }
52200
52341
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
52201
- return (await import("./chunks/delete-DHYJ7ZYD.js")).default(client, args);
52342
+ return (await import("./chunks/delete-RQYOSBNO.js")).default(client, args);
52202
52343
  case "enable":
52203
52344
  if (needHelp) {
52204
52345
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52206,7 +52347,7 @@ async function main27(client) {
52206
52347
  return 2;
52207
52348
  }
52208
52349
  telemetry2.trackCliSubcommandEnable(subcommandOriginal);
52209
- return (await import("./chunks/enable-6P6TDM6D.js")).default(client, args);
52350
+ return (await import("./chunks/enable-UQAJJKCG.js")).default(client, args);
52210
52351
  case "disable":
52211
52352
  if (needHelp) {
52212
52353
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52214,7 +52355,7 @@ async function main27(client) {
52214
52355
  return 2;
52215
52356
  }
52216
52357
  telemetry2.trackCliSubcommandDisable(subcommandOriginal);
52217
- return (await import("./chunks/disable-A4D7SZ6G.js")).default(client, args);
52358
+ return (await import("./chunks/disable-RRGOZIA7.js")).default(client, args);
52218
52359
  case "reorder":
52219
52360
  if (needHelp) {
52220
52361
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52222,7 +52363,7 @@ async function main27(client) {
52222
52363
  return 2;
52223
52364
  }
52224
52365
  telemetry2.trackCliSubcommandReorder(subcommandOriginal);
52225
- return (await import("./chunks/reorder-QK5QJ6TW.js")).default(client, args);
52366
+ return (await import("./chunks/reorder-ZLVQQBMG.js")).default(client, args);
52226
52367
  case "export":
52227
52368
  if (needHelp) {
52228
52369
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52230,7 +52371,7 @@ async function main27(client) {
52230
52371
  return 2;
52231
52372
  }
52232
52373
  telemetry2.trackCliSubcommandExport(subcommandOriginal);
52233
- return (await import("./chunks/export-WISO5LBX.js")).default(client, args);
52374
+ return (await import("./chunks/export-D4YNS2G5.js")).default(client, args);
52234
52375
  case "publish":
52235
52376
  if (needHelp) {
52236
52377
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52238,7 +52379,7 @@ async function main27(client) {
52238
52379
  return 2;
52239
52380
  }
52240
52381
  telemetry2.trackCliSubcommandPublish(subcommandOriginal);
52241
- return (await import("./chunks/publish-LMGSRL3X.js")).default(client, args);
52382
+ return (await import("./chunks/publish-UTKKRA4P.js")).default(client, args);
52242
52383
  case "restore":
52243
52384
  if (needHelp) {
52244
52385
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52246,7 +52387,7 @@ async function main27(client) {
52246
52387
  return 2;
52247
52388
  }
52248
52389
  telemetry2.trackCliSubcommandRestore(subcommandOriginal);
52249
- return (await import("./chunks/restore-VF3HDGON.js")).default(client, args);
52390
+ return (await import("./chunks/restore-SDTDA4A6.js")).default(client, args);
52250
52391
  case "discard-staging":
52251
52392
  if (needHelp) {
52252
52393
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52254,7 +52395,7 @@ async function main27(client) {
52254
52395
  return 2;
52255
52396
  }
52256
52397
  telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
52257
- return (await import("./chunks/discard-PRE343AI.js")).default(client, args);
52398
+ return (await import("./chunks/discard-X2NIGII5.js")).default(client, args);
52258
52399
  default:
52259
52400
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG37));
52260
52401
  output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));