vercel 58.10.0 → 59.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 (85) hide show
  1. package/dist/chunks/{add-5KFK4EFH.js → add-3LO3UMYC.js} +6 -6
  2. package/dist/chunks/{add-W4XR5GYX.js → add-QZUQNL2C.js} +2 -2
  3. package/dist/chunks/{add-NMYLVDBN.js → add-SQ6ERCFZ.js} +2 -2
  4. package/dist/chunks/{build-BCMSG7TU.js → build-WMUKZEFH.js} +2 -2
  5. package/dist/chunks/{chunk-IBIZT5M4.js → chunk-3R5JGMHV.js} +62 -20
  6. package/dist/chunks/{chunk-CLUCO4RD.js → chunk-5KI3SUJI.js} +81 -18
  7. package/dist/chunks/{chunk-MGCBTAA7.js → chunk-BGILSKZ5.js} +1 -1
  8. package/dist/chunks/{chunk-BZGIBXY6.js → chunk-CMR5KQVR.js} +1 -1
  9. package/dist/chunks/{chunk-AZCZV4XI.js → chunk-DMLU5KQE.js} +1 -1
  10. package/dist/chunks/chunk-DQDJVHA5.js +559 -0
  11. package/dist/chunks/{chunk-UDHYVIJL.js → chunk-L6NIIAB7.js} +4 -4
  12. package/dist/chunks/{chunk-2J7BL7IF.js → chunk-LT5UQNTC.js} +2 -2
  13. package/dist/chunks/{chunk-MAZ2BUBX.js → chunk-MZ3L3SGZ.js} +2 -2
  14. package/dist/chunks/{chunk-5MERQE7H.js → chunk-N5DK7EMY.js} +1 -1
  15. package/dist/chunks/{chunk-KUZCVMVA.js → chunk-PBECT5BN.js} +4 -3
  16. package/dist/chunks/{chunk-N5YCPDWG.js → chunk-PSZQNYEV.js} +1 -1
  17. package/dist/chunks/{chunk-6SXIT6Q3.js → chunk-PVCJIMVY.js} +2 -2
  18. package/dist/chunks/{chunk-H25BISPQ.js → chunk-QGQX7BYN.js} +10 -518
  19. package/dist/chunks/{chunk-PTZ6X4P4.js → chunk-RWRSUGXY.js} +1 -1
  20. package/dist/chunks/{chunk-TNKTZDOL.js → chunk-S3H7ITUR.js} +1 -1
  21. package/dist/chunks/{chunk-U4LWFSR4.js → chunk-SD2QZHZA.js} +1 -1
  22. package/dist/chunks/{chunk-2SEBBSKD.js → chunk-SHR6DYA5.js} +1 -1
  23. package/dist/chunks/{chunk-DQDAQYQI.js → chunk-SQAQED4U.js} +1 -1
  24. package/dist/chunks/{chunk-NDOZRKTB.js → chunk-UQVOFOP2.js} +1 -1
  25. package/dist/chunks/{chunk-L6BFCLXF.js → chunk-V42UVZDX.js} +80 -38
  26. package/dist/chunks/chunk-W34XLJ44.js +61 -0
  27. package/dist/chunks/{chunk-6WWATEWK.js → chunk-WE3TFESA.js} +1 -1
  28. package/dist/chunks/{chunk-ELJ56NBY.js → chunk-ZFTRB6AB.js} +173 -173
  29. package/dist/chunks/{chunk-7RUZPHW7.js → chunk-ZRWSSPW5.js} +1 -1
  30. package/dist/chunks/{clear-54WX3NA2.js → clear-W2B4CHTP.js} +2 -2
  31. package/dist/chunks/{compile-vercel-config-LSW4TWGX.js → compile-vercel-config-HTWOS7DZ.js} +1 -1
  32. package/dist/chunks/{config-WXQTPQW7.js → config-EGJY4UUE.js} +2 -2
  33. package/dist/chunks/{delete-OGP3RVWM.js → delete-6I7V5AGV.js} +2 -2
  34. package/dist/chunks/{delete-HQMI44SG.js → delete-BVMID4W2.js} +2 -2
  35. package/dist/chunks/{disable-HC266OB7.js → disable-I54JNXJE.js} +2 -2
  36. package/dist/chunks/{discard-3RFIPLXY.js → discard-6TSJJCUQ.js} +2 -2
  37. package/dist/chunks/{edit-TZOCRGG6.js → edit-KCWYQ2YT.js} +2 -2
  38. package/dist/chunks/{edit-NXPQFWM6.js → edit-YS2SWHFJ.js} +3 -3
  39. package/dist/chunks/{enable-OGFRN4CG.js → enable-RYXRIGQN.js} +2 -2
  40. package/dist/chunks/{export-AEESZFZX.js → export-G3NYOADE.js} +2 -2
  41. package/dist/chunks/{image-EIAO7LVN.js → image-RJBLSUES.js} +3 -3
  42. package/dist/chunks/{import-builders-KCQLA2YR.js → import-builders-M6F3F4DH.js} +2 -2
  43. package/dist/chunks/{inspect-RUGPLO7A.js → inspect-7XUEVBDM.js} +2 -2
  44. package/dist/chunks/{inspect-MGIECVLH.js → inspect-AE4YIJYS.js} +2 -2
  45. package/dist/chunks/{inspect-TTHC6L7Q.js → inspect-E7TBGK7D.js} +2 -2
  46. package/dist/chunks/{inspect-HHSDXTII.js → inspect-YTCVTZHY.js} +2 -2
  47. package/dist/chunks/{inspect-EM34BOTE.js → inspect-Z74NZZ2A.js} +3 -3
  48. package/dist/chunks/{list-A74MGEOB.js → list-KJNC3NOE.js} +2 -2
  49. package/dist/chunks/{list-GQDUIRBU.js → list-SGPLL4KJ.js} +3 -3
  50. package/dist/chunks/{list-EOG3TYBE.js → list-WXS2AFQD.js} +1 -1
  51. package/dist/chunks/{login-L4EWZOGH.js → login-XD3CFPBF.js} +2 -2
  52. package/dist/chunks/{ls-F6WCPVB7.js → ls-5A4327XJ.js} +2 -2
  53. package/dist/chunks/{ls-OWHNAGNT.js → ls-5DSOTTYX.js} +2 -2
  54. package/dist/chunks/{ls-OJGSWVWO.js → ls-KE5I7BZO.js} +2 -2
  55. package/dist/chunks/{ls-D5ESYWG5.js → ls-NBKSDTWX.js} +2 -2
  56. package/dist/chunks/{ls-VBFBWSWD.js → ls-SVSO3677.js} +3 -3
  57. package/dist/chunks/{open-FHER5QV2.js → open-M2MOAE2K.js} +2 -2
  58. package/dist/chunks/{permissions-JSXC7BRD.js → permissions-ADPY554K.js} +4 -4
  59. package/dist/chunks/{publish-CM6ZGWIE.js → publish-OBIOOL7T.js} +2 -2
  60. package/dist/chunks/{push-5NYG7HIR.js → push-5237XBTO.js} +2 -2
  61. package/dist/chunks/{query-5GQLF2BR.js → query-ILL74HIA.js} +1 -1
  62. package/dist/chunks/{reorder-5GCNY75W.js → reorder-GAUAO4LW.js} +2 -2
  63. package/dist/chunks/{reply-B2XCK5XR.js → reply-IZJHEULD.js} +2 -2
  64. package/dist/chunks/{resolve-YQP5C2QY.js → resolve-HTIT7CGL.js} +2 -2
  65. package/dist/chunks/{restore-VHX4JV5J.js → restore-IKL74HSE.js} +2 -2
  66. package/dist/chunks/{rm-VDFSX3LH.js → rm-5Y6BL47T.js} +2 -2
  67. package/dist/chunks/{rm-AUUT2YIT.js → rm-C37ZORQV.js} +2 -2
  68. package/dist/chunks/{rm-QVVQDCDX.js → rm-QAVNP5KX.js} +3 -3
  69. package/dist/chunks/{rm-OILUGCTW.js → rm-XJU5SBGH.js} +2 -2
  70. package/dist/chunks/{rule-inspect-LKTUPW4B.js → rule-inspect-DYHWWROS.js} +3 -3
  71. package/dist/chunks/{rules-J5JM5VFQ.js → rules-M6EJ2Y6S.js} +6 -6
  72. package/dist/chunks/{schema-OIKSCLDU.js → schema-LLBDZNIC.js} +1 -1
  73. package/dist/chunks/{tags-AMTMNRLQ.js → tags-HR5RVQFA.js} +2 -2
  74. package/dist/chunks/{update-AFL3GHKB.js → update-6A5V6HBH.js} +6 -6
  75. package/dist/commands/build/index.js +15 -11
  76. package/dist/commands/deploy/index.js +347 -49
  77. package/dist/commands/dev/index.js +8 -8
  78. package/dist/commands/env/index.js +4 -4
  79. package/dist/commands/link/index.js +6 -6
  80. package/dist/commands/list/index.js +2 -2
  81. package/dist/commands-bulk.js +2111 -1619
  82. package/dist/index.js +32 -42
  83. package/dist/version.mjs +1 -1
  84. package/package.json +35 -35
  85. package/dist/chunks/chunk-I2XE3GMB.js +0 -21
@@ -4,6 +4,9 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
+ import {
8
+ promptMissingCredentials
9
+ } from "../../chunks/chunk-W34XLJ44.js";
7
10
  import {
8
11
  Now,
9
12
  UploadErrorMissingArchive,
@@ -13,12 +16,15 @@ import {
13
16
  purchaseDomainIfAvailable,
14
17
  require_cjs,
15
18
  setupDomain
16
- } from "../../chunks/chunk-L6BFCLXF.js";
19
+ } from "../../chunks/chunk-V42UVZDX.js";
17
20
  import "../../chunks/chunk-PRWJUY5U.js";
18
- import "../../chunks/chunk-I2XE3GMB.js";
21
+ import {
22
+ login,
23
+ require_ci_info
24
+ } from "../../chunks/chunk-DQDJVHA5.js";
19
25
  import {
20
26
  readLocalConfig
21
- } from "../../chunks/chunk-MAZ2BUBX.js";
27
+ } from "../../chunks/chunk-MZ3L3SGZ.js";
22
28
  import {
23
29
  highlight
24
30
  } from "../../chunks/chunk-JKQWQA2T.js";
@@ -38,7 +44,7 @@ import {
38
44
  deprecatedArchiveSplitTgz,
39
45
  getCommandAliases,
40
46
  initSubcommand
41
- } from "../../chunks/chunk-CLUCO4RD.js";
47
+ } from "../../chunks/chunk-5KI3SUJI.js";
42
48
  import "../../chunks/chunk-ELA5VN3A.js";
43
49
  import "../../chunks/chunk-B3JTF4CF.js";
44
50
  import "../../chunks/chunk-A5KP5HAI.js";
@@ -53,7 +59,7 @@ import "../../chunks/chunk-7QVJTI5H.js";
53
59
  import "../../chunks/chunk-O5GNPPTU.js";
54
60
  import {
55
61
  pickOverrides
56
- } from "../../chunks/chunk-5MERQE7H.js";
62
+ } from "../../chunks/chunk-N5DK7EMY.js";
57
63
  import "../../chunks/chunk-HT2XWSAJ.js";
58
64
  import {
59
65
  stamp_default
@@ -61,13 +67,13 @@ import {
61
67
  import "../../chunks/chunk-VXYGCOKL.js";
62
68
  import {
63
69
  ensureLink
64
- } from "../../chunks/chunk-KUZCVMVA.js";
70
+ } from "../../chunks/chunk-PBECT5BN.js";
65
71
  import {
66
72
  validatePaths,
67
73
  validateRootDirectory
68
- } from "../../chunks/chunk-6SXIT6Q3.js";
69
- import "../../chunks/chunk-MGCBTAA7.js";
70
- import "../../chunks/chunk-2SEBBSKD.js";
74
+ } from "../../chunks/chunk-PVCJIMVY.js";
75
+ import "../../chunks/chunk-BGILSKZ5.js";
76
+ import "../../chunks/chunk-SHR6DYA5.js";
71
77
  import {
72
78
  help
73
79
  } from "../../chunks/chunk-ZX2FSPWV.js";
@@ -75,10 +81,18 @@ import {
75
81
  table
76
82
  } from "../../chunks/chunk-KT4XXKJK.js";
77
83
  import {
84
+ VERCEL_DIR,
85
+ VERCEL_DIR_PROJECT,
86
+ addToGitIgnore,
78
87
  compileVercelConfig,
79
88
  createGitMeta,
80
89
  getDeployment,
90
+ getLinkFromDir,
91
+ getRepoLink,
92
+ getVercelDirectory,
81
93
  isOwnerLookupUnavailableLink,
94
+ isRemoteLookupSkippedLink,
95
+ linkFolderToProject,
82
96
  mapCertError,
83
97
  param,
84
98
  parseEnv,
@@ -87,12 +101,16 @@ import {
87
101
  require_dist as require_dist2,
88
102
  require_frameworks,
89
103
  require_lib
90
- } from "../../chunks/chunk-IBIZT5M4.js";
104
+ } from "../../chunks/chunk-3R5JGMHV.js";
91
105
  import {
92
106
  TelemetryClient
93
107
  } from "../../chunks/chunk-ECCWJHC6.js";
94
108
  import {
109
+ AGENT_ACTION,
110
+ AGENT_REASON,
95
111
  AGENT_STATUS,
112
+ buildCommandWithYes,
113
+ outputActionRequired,
96
114
  outputAgentError,
97
115
  withGlobalFlags
98
116
  } from "../../chunks/chunk-TJJ562C5.js";
@@ -151,18 +169,98 @@ import {
151
169
 
152
170
  // src/commands/deploy/index.ts
153
171
  var import_client3 = __toESM(require_dist2(), 1);
154
- var import_error_utils = __toESM(require_dist(), 1);
172
+ var import_error_utils2 = __toESM(require_dist(), 1);
155
173
  var import_frameworks = __toESM(require_frameworks(), 1);
156
174
  var import_bytes = __toESM(require_bytes(), 1);
157
175
  var import_chalk = __toESM(require_source(), 1);
158
- var import_fs_extra2 = __toESM(require_lib(), 1);
176
+ var import_fs_extra3 = __toESM(require_lib(), 1);
159
177
  var import_ms = __toESM(require_ms(), 1);
160
178
  import {
161
179
  getPrettyError,
162
180
  getSupportedNodeVersion,
163
181
  scanParentDirs
164
182
  } from "@vercel/build-utils";
165
- import { join as join2, resolve } from "path";
183
+ import { join as join3, resolve } from "path";
184
+
185
+ // src/util/deploy/anonymous.ts
186
+ var import_fs_extra = __toESM(require_lib(), 1);
187
+ var import_ci_info = __toESM(require_ci_info(), 1);
188
+ var import_error_utils = __toESM(require_dist(), 1);
189
+ import { join } from "path";
190
+ import { getPlatformEnv } from "@vercel/build-utils";
191
+ var VERCEL_DIR_ANONYMOUS = "anonymous.json";
192
+ function anonymousStatePath(cwd) {
193
+ return join(cwd, VERCEL_DIR, VERCEL_DIR_ANONYMOUS);
194
+ }
195
+ async function readAnonymousState(cwd) {
196
+ try {
197
+ const state = await (0, import_fs_extra.readJSON)(anonymousStatePath(cwd));
198
+ if (typeof state?.projectId === "string" && typeof state.token === "string" && typeof state.claimUrl === "string" && typeof state.expiresAt === "number") {
199
+ return state;
200
+ }
201
+ } catch (_error) {
202
+ }
203
+ return null;
204
+ }
205
+ async function writeAnonymousState(cwd, state) {
206
+ await (0, import_fs_extra.outputJSON)(anonymousStatePath(cwd), state, { spaces: 2 });
207
+ await addToGitIgnore(cwd);
208
+ }
209
+ async function clearAnonymousState(cwd) {
210
+ await (0, import_fs_extra.remove)(anonymousStatePath(cwd));
211
+ }
212
+ async function bootstrapAnonymousProject(client) {
213
+ const { projectId, token, claimUrl, expiresAt } = await client.fetch("/v1/anonymous/projects?surface=cli", {
214
+ method: "POST",
215
+ body: {},
216
+ useCurrentTeam: false,
217
+ // Not idempotent: each attempt creates a project server-side.
218
+ retry: { retries: 0 }
219
+ });
220
+ return { projectId, token, claimUrl, expiresAt };
221
+ }
222
+ async function ensureAnonymousLink(client, cwd, { requireExistingState = false, confirmed = true } = {}) {
223
+ if (import_ci_info.default.isCI) {
224
+ return "refused";
225
+ }
226
+ const linked = Boolean(getPlatformEnv("ORG_ID") && getPlatformEnv("PROJECT_ID")) || Boolean(await getLinkFromDir(getVercelDirectory(cwd))) || Boolean((await getRepoLink(client, cwd))?.repoConfig);
227
+ if (linked) {
228
+ return "refused";
229
+ }
230
+ let state = await readAnonymousState(cwd);
231
+ if (state && state.expiresAt <= Date.now()) {
232
+ output_manager_default.prettyError({
233
+ message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
234
+ });
235
+ return "failed";
236
+ }
237
+ if (!state && requireExistingState) {
238
+ return "refused";
239
+ }
240
+ if (!confirmed && !state) {
241
+ return "confirmation-required";
242
+ }
243
+ if (!state) {
244
+ try {
245
+ state = await bootstrapAnonymousProject(client);
246
+ } catch (err) {
247
+ output_manager_default.debug(`Anonymous bootstrap failed: ${(0, import_error_utils.errorToString)(err)}`);
248
+ return "refused";
249
+ }
250
+ await writeAnonymousState(cwd, state);
251
+ output_manager_default.log("Not authenticated. Deploying anonymously.");
252
+ }
253
+ client.authConfig = { token: state.token, skipWrite: true };
254
+ delete process.env.VERCEL_TEAM_ID;
255
+ return {
256
+ status: "linked",
257
+ anonymous: true,
258
+ expiresAt: state.expiresAt,
259
+ claimUrl: state.claimUrl,
260
+ org: { type: "user", id: "", slug: "anonymous" },
261
+ project: { id: state.projectId, name: state.projectId }
262
+ };
263
+ }
166
264
 
167
265
  // src/util/deploy/generate-cert-for-deploy.ts
168
266
  var import_tldts = __toESM(require_cjs(), 1);
@@ -329,11 +427,11 @@ async function getDeploymentCheckRunLogs(client, deploymentId, checkRunId) {
329
427
  }
330
428
 
331
429
  // src/util/deploy/get-prebuilt-json.ts
332
- var import_fs_extra = __toESM(require_lib(), 1);
333
- import { join } from "path";
430
+ var import_fs_extra2 = __toESM(require_lib(), 1);
431
+ import { join as join2 } from "path";
334
432
  async function getPrebuiltJson(directory) {
335
433
  try {
336
- return await import_fs_extra.default.readJSON(join(directory, "builds.json"));
434
+ return await import_fs_extra2.default.readJSON(join2(directory, "builds.json"));
337
435
  } catch (_error) {
338
436
  }
339
437
  return null;
@@ -705,13 +803,13 @@ async function handleInitDeployment(client, telemetryClient) {
705
803
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
706
804
  if (rootDirectory && await validateRootDirectory(
707
805
  cwd,
708
- join2(cwd, rootDirectory),
806
+ join3(cwd, rootDirectory),
709
807
  project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
710
808
  ) === false) {
711
809
  return 1;
712
810
  }
713
811
  if (rootDirectory) {
714
- const rootDirectoryPath = join2(cwd, rootDirectory);
812
+ const rootDirectoryPath = join3(cwd, rootDirectory);
715
813
  await compileVercelConfig(rootDirectoryPath);
716
814
  const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
717
815
  if (rootDirectoryConfig) {
@@ -770,7 +868,7 @@ async function handleInitDeployment(client, telemetryClient) {
770
868
  }
771
869
  const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
772
870
  const gitMetadata = await createGitMeta(
773
- join2(cwd, project.rootDirectory || ""),
871
+ join3(cwd, project.rootDirectory || ""),
774
872
  project
775
873
  );
776
874
  const deploymentEnv = Object.assign(
@@ -787,7 +885,7 @@ async function handleInitDeployment(client, telemetryClient) {
787
885
  await addProcessEnv(log, deploymentEnv);
788
886
  await addProcessEnv(log, deploymentBuildEnv);
789
887
  } catch (err) {
790
- error((0, import_error_utils.errorToString)(err));
888
+ error((0, import_error_utils2.errorToString)(err));
791
889
  return 1;
792
890
  }
793
891
  const regionFlag = (parsedArguments.flags["--regions"] || "").split(",").map((s) => s.trim()).filter(Boolean);
@@ -843,7 +941,7 @@ async function handleInitDeployment(client, telemetryClient) {
843
941
  };
844
942
  }
845
943
  const { packageJson } = await scanParentDirs(
846
- join2(cwd, project?.rootDirectory ?? ""),
944
+ join3(cwd, project?.rootDirectory ?? ""),
847
945
  true,
848
946
  cwd
849
947
  );
@@ -1064,7 +1162,7 @@ async function handleInitDeployment(client, telemetryClient) {
1064
1162
  true
1065
1163
  );
1066
1164
  } catch (err) {
1067
- if ((0, import_error_utils.isError)(err)) {
1165
+ if ((0, import_error_utils2.isError)(err)) {
1068
1166
  debug(`Error: ${err}
1069
1167
  ${err.stack}`);
1070
1168
  }
@@ -1181,11 +1279,11 @@ async function handleContinueSubcommand(client, telemetryClient) {
1181
1279
  return 1;
1182
1280
  }
1183
1281
  }
1184
- let vercelOutputDir = join2(cwd, ".vercel/output");
1282
+ let vercelOutputDir = join3(cwd, ".vercel/output");
1185
1283
  if (link.repoRoot && link.project.rootDirectory) {
1186
- vercelOutputDir = join2(cwd, link.project.rootDirectory, ".vercel/output");
1284
+ vercelOutputDir = join3(cwd, link.project.rootDirectory, ".vercel/output");
1187
1285
  }
1188
- const prebuiltExists = await import_fs_extra2.default.pathExists(vercelOutputDir);
1286
+ const prebuiltExists = await import_fs_extra3.default.pathExists(vercelOutputDir);
1189
1287
  if (!prebuiltExists) {
1190
1288
  if (client.nonInteractive) {
1191
1289
  outputAgentError(
@@ -1353,11 +1451,20 @@ async function handleDefaultDeploy(client, telemetryClient) {
1353
1451
  );
1354
1452
  telemetryClient.trackCliFlagNoClipboard(true);
1355
1453
  }
1356
- const target = parseTarget({
1454
+ let isAnonymous = !client.authConfig.token;
1455
+ let target = parseTarget({
1357
1456
  flagName: "target",
1358
1457
  flags: parsedArguments.flags
1359
1458
  });
1360
1459
  telemetryClient.trackTargetEnvironment(target);
1460
+ if (isAnonymous && target && target !== "production") {
1461
+ error(
1462
+ `Anonymous deployments always target production, so "${target}" is not available. Remove the ${param(
1463
+ "--target"
1464
+ )} option, or run ${getCommandName("login")} to deploy to other environments.`
1465
+ );
1466
+ return 1;
1467
+ }
1361
1468
  const skipDomain = parsedArguments.flags["--skip-domain"];
1362
1469
  if (skipDomain && target !== "production") {
1363
1470
  output_manager_default.error(
@@ -1383,7 +1490,79 @@ async function handleDefaultDeploy(client, telemetryClient) {
1383
1490
  }
1384
1491
  const cliMeta = parseMeta(parsedArguments.flags["--meta"]);
1385
1492
  const isV0 = cliMeta.v0 === "true";
1386
- const link = await ensureLink("deploy", client, cwd, {
1493
+ if (!isAnonymous) {
1494
+ await clearAnonymousState(cwd);
1495
+ }
1496
+ let anonymousLink;
1497
+ if (isAnonymous) {
1498
+ const anonymousOptions = {
1499
+ requireExistingState: Boolean(parsedArguments.flags["--dry"]),
1500
+ confirmed: Boolean(
1501
+ parsedArguments.flags["--yes"] || parsedArguments.flags["--dry"]
1502
+ )
1503
+ };
1504
+ let anonymous = await ensureAnonymousLink(client, cwd, anonymousOptions);
1505
+ let temporaryDeploymentsUnavailable = anonymous === "refused";
1506
+ if (anonymous === "confirmation-required") {
1507
+ const command = buildCommandWithYes(client.argv);
1508
+ if (client.nonInteractive) {
1509
+ outputActionRequired(
1510
+ client,
1511
+ {
1512
+ status: AGENT_STATUS.ACTION_REQUIRED,
1513
+ reason: AGENT_REASON.CONFIRMATION_REQUIRED,
1514
+ action: AGENT_ACTION.CONFIRMATION_REQUIRED,
1515
+ message: "Deploying without credentials creates a temporary deployment. Re-run with --yes to confirm.",
1516
+ next: [
1517
+ {
1518
+ command,
1519
+ when: "Create a temporary deployment"
1520
+ }
1521
+ ]
1522
+ },
1523
+ 1
1524
+ );
1525
+ return 1;
1526
+ }
1527
+ if (!client.stdin.isTTY) {
1528
+ error(
1529
+ `Temporary deployment requires confirmation. Re-run with ${code(command)}.`
1530
+ );
1531
+ return 1;
1532
+ }
1533
+ const confirmed = await client.input.confirm(
1534
+ "Deploy temporarily without logging in?",
1535
+ true
1536
+ );
1537
+ if (confirmed) {
1538
+ anonymous = await ensureAnonymousLink(client, cwd, {
1539
+ ...anonymousOptions,
1540
+ confirmed: true
1541
+ });
1542
+ temporaryDeploymentsUnavailable = anonymous === "refused";
1543
+ } else {
1544
+ anonymous = "refused";
1545
+ }
1546
+ }
1547
+ if (anonymous === "refused") {
1548
+ if (temporaryDeploymentsUnavailable) {
1549
+ output_manager_default.log("Temporary deployments aren't available.");
1550
+ }
1551
+ const loginExitCode = await promptMissingCredentials(client);
1552
+ if (loginExitCode !== 0) {
1553
+ return loginExitCode;
1554
+ }
1555
+ isAnonymous = false;
1556
+ } else if (anonymous === "failed") {
1557
+ return 1;
1558
+ } else if (anonymous === "confirmation-required") {
1559
+ return 1;
1560
+ } else {
1561
+ anonymousLink = anonymous;
1562
+ target = "production";
1563
+ }
1564
+ }
1565
+ const link = anonymousLink ?? await ensureLink("deploy", client, cwd, {
1387
1566
  autoConfirm,
1388
1567
  // Only explicit names: the folder-name fallback is derived inside
1389
1568
  // `setupAndLink`, and passing it would suppress Git-match suggestions.
@@ -1391,6 +1570,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
1391
1570
  failIfNotFound: !!projectNameOrId,
1392
1571
  requireExistingLink: parsedArguments.flags["--dry"],
1393
1572
  allowOwnerLookupFallback: true,
1573
+ skipRemoteLookup: !parsedArguments.flags["--dry"],
1394
1574
  v0: isV0
1395
1575
  });
1396
1576
  if (typeof link === "number") {
@@ -1402,13 +1582,21 @@ async function handleDefaultDeploy(client, telemetryClient) {
1402
1582
  if (link.repoRoot) {
1403
1583
  cwd = link.repoRoot;
1404
1584
  }
1585
+ const prebuilt = isAnonymous || !!parsedArguments.flags["--prebuilt"];
1405
1586
  let vercelOutputDir;
1406
- if (parsedArguments.flags["--prebuilt"]) {
1407
- vercelOutputDir = join2(cwd, ".vercel/output");
1587
+ if (prebuilt) {
1588
+ vercelOutputDir = join3(cwd, ".vercel/output");
1408
1589
  if (link.repoRoot && link.project.rootDirectory) {
1409
- vercelOutputDir = join2(cwd, link.project.rootDirectory, ".vercel/output");
1590
+ vercelOutputDir = join3(cwd, link.project.rootDirectory, ".vercel/output");
1591
+ }
1592
+ let prebuiltExists = await import_fs_extra3.default.pathExists(vercelOutputDir);
1593
+ if (!prebuiltExists && isAnonymous && !parsedArguments.flags["--dry"]) {
1594
+ const buildExitCode = await runImplicitBuild(client, cwd);
1595
+ if (buildExitCode !== 0) {
1596
+ return buildExitCode;
1597
+ }
1598
+ prebuiltExists = await import_fs_extra3.default.pathExists(vercelOutputDir);
1410
1599
  }
1411
- const prebuiltExists = await import_fs_extra2.default.pathExists(vercelOutputDir);
1412
1600
  if (!prebuiltExists) {
1413
1601
  error(
1414
1602
  `The ${param(
@@ -1446,18 +1634,19 @@ async function handleDefaultDeploy(client, telemetryClient) {
1446
1634
  return 1;
1447
1635
  }
1448
1636
  }
1449
- const contextName = org.slug;
1637
+ const orgSlug = isRemoteLookupSkippedLink(link) ? void 0 : org.slug;
1638
+ const contextName = orgSlug ?? "the linked account";
1450
1639
  const currentTeam = isOwnerLookupUnavailableLink(link) || org.type !== "team" ? void 0 : org.id;
1451
1640
  client.config.currentTeam = currentTeam;
1452
1641
  if (rootDirectory && await validateRootDirectory(
1453
1642
  cwd,
1454
- join2(cwd, rootDirectory),
1455
- project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
1643
+ join3(cwd, rootDirectory),
1644
+ project && orgSlug ? `To change your Project Settings, go to https://vercel.com/${orgSlug}/${project.name}/settings` : ""
1456
1645
  ) === false) {
1457
1646
  return 1;
1458
1647
  }
1459
1648
  if (rootDirectory) {
1460
- const rootDirectoryPath = join2(cwd, rootDirectory);
1649
+ const rootDirectoryPath = join3(cwd, rootDirectory);
1461
1650
  await compileVercelConfig(rootDirectoryPath);
1462
1651
  const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
1463
1652
  if (rootDirectoryConfig) {
@@ -1482,7 +1671,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
1482
1671
  path: cwd,
1483
1672
  archive: parsedArchive ? "tgz" : void 0,
1484
1673
  debug: output_manager_default.isDebugEnabled(),
1485
- prebuilt: parsedArguments.flags["--prebuilt"],
1674
+ prebuilt,
1486
1675
  vercelOutputDir,
1487
1676
  projectName: project.name,
1488
1677
  rootDirectory,
@@ -1544,7 +1733,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
1544
1733
  }
1545
1734
  const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
1546
1735
  const gitMetadata = await createGitMeta(
1547
- join2(cwd, project.rootDirectory || ""),
1736
+ join3(cwd, project.rootDirectory || ""),
1548
1737
  project
1549
1738
  );
1550
1739
  const deploymentEnv = Object.assign(
@@ -1561,7 +1750,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
1561
1750
  await addProcessEnv(log, deploymentEnv);
1562
1751
  await addProcessEnv(log, deploymentBuildEnv);
1563
1752
  } catch (err) {
1564
- error((0, import_error_utils.errorToString)(err));
1753
+ error((0, import_error_utils2.errorToString)(err));
1565
1754
  return 1;
1566
1755
  }
1567
1756
  const regionFlag = (parsedArguments.flags["--regions"] || "").split(",").map((s) => s.trim()).filter(Boolean);
@@ -1585,11 +1774,13 @@ async function handleDefaultDeploy(client, telemetryClient) {
1585
1774
  const autoAssignCustomDomains = parsedArguments.flags["--skip-domain"] ? false : void 0;
1586
1775
  const createArgs = {
1587
1776
  name,
1777
+ project: project.id,
1588
1778
  env: deploymentEnv,
1589
1779
  build: { env: deploymentBuildEnv },
1590
1780
  forceNew: parsedArguments.flags["--force"],
1591
1781
  withCache: parsedArguments.flags["--with-cache"],
1592
- prebuilt: parsedArguments.flags["--prebuilt"],
1782
+ prebuilt,
1783
+ anonymous: isAnonymous,
1593
1784
  vercelOutputDir,
1594
1785
  rootDirectory,
1595
1786
  quiet,
@@ -1602,13 +1793,14 @@ async function handleDefaultDeploy(client, telemetryClient) {
1602
1793
  gitMetadata,
1603
1794
  deployStamp,
1604
1795
  target,
1605
- skipAutoDetectionConfirmation: autoConfirm,
1796
+ skipAutoDetectionConfirmation: autoConfirm || isAnonymous,
1606
1797
  noWait,
1607
1798
  withFullLogs,
1608
1799
  autoAssignCustomDomains,
1609
1800
  agentName: client.agentName,
1610
1801
  jsonOutput: asJson,
1611
- linkedProject: project
1802
+ linkedProject: project,
1803
+ linkedProjectIsPartial: isRemoteLookupSkippedLink(link)
1612
1804
  };
1613
1805
  if (!localConfig.builds || localConfig.builds.length === 0) {
1614
1806
  createArgs.projectSettings = {
@@ -1618,7 +1810,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
1618
1810
  };
1619
1811
  }
1620
1812
  const { packageJson } = await scanParentDirs(
1621
- join2(cwd, project?.rootDirectory ?? ""),
1813
+ join3(cwd, project?.rootDirectory ?? ""),
1622
1814
  true,
1623
1815
  cwd
1624
1816
  );
@@ -1809,10 +2001,63 @@ async function handleDefaultDeploy(client, telemetryClient) {
1809
2001
  }
1810
2002
  }
1811
2003
  } catch (err) {
1812
- if ((0, import_error_utils.isError)(err)) {
2004
+ if ((0, import_error_utils2.isError)(err)) {
1813
2005
  debug(`Error: ${err}
1814
2006
  ${err.stack}`);
1815
2007
  }
2008
+ if (anonymousLink && isAPIError(err) && err.code === "anonymous_project_claimed") {
2009
+ if (client.nonInteractive || !client.stdin.isTTY) {
2010
+ prettyError({
2011
+ message: `This project was claimed successfully. Run ${getCommandName("login")} to continue deploying it.`
2012
+ });
2013
+ return 1;
2014
+ }
2015
+ log(
2016
+ "This project was claimed successfully. Log in to continue deploying it."
2017
+ );
2018
+ let loginExitCode;
2019
+ try {
2020
+ loginExitCode = await login(client, { shouldParseArgs: false });
2021
+ } catch (loginError) {
2022
+ printError(loginError);
2023
+ return 1;
2024
+ }
2025
+ if (loginExitCode !== 0) {
2026
+ return loginExitCode;
2027
+ }
2028
+ const claimedProjectLink = await ensureLink("deploy", client, cwd, {
2029
+ autoConfirm: true,
2030
+ projectName: anonymousLink.project.id,
2031
+ failIfNotFound: true,
2032
+ allowOwnerLookupFallback: true,
2033
+ v0: isV0
2034
+ });
2035
+ if (typeof claimedProjectLink === "number") {
2036
+ return claimedProjectLink;
2037
+ }
2038
+ await linkFolderToProject(
2039
+ client,
2040
+ cwd,
2041
+ {
2042
+ projectId: claimedProjectLink.project.id,
2043
+ orgId: claimedProjectLink.org.id
2044
+ },
2045
+ claimedProjectLink.project.name,
2046
+ claimedProjectLink.org.slug,
2047
+ "link",
2048
+ true,
2049
+ false
2050
+ );
2051
+ await clearAnonymousState(cwd);
2052
+ return handleDefaultDeploy(client, telemetryClient);
2053
+ }
2054
+ if (anonymousLink && isAPIError(err) && (err.status === 401 || err.status === 410)) {
2055
+ await clearAnonymousState(cwd);
2056
+ prettyError({
2057
+ message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
2058
+ });
2059
+ return 1;
2060
+ }
1816
2061
  if (err instanceof UploadErrorMissingArchive) {
1817
2062
  if (client.nonInteractive) {
1818
2063
  client.stdout.write(
@@ -2019,16 +2264,33 @@ ${err.stack}`);
2019
2264
  }
2020
2265
  if (asJson) {
2021
2266
  output_manager_default.stopSpinner();
2022
- const deploymentJson = getDeploymentOutputJson(deployment, client.apiUrl);
2267
+ const anonymousUrl = anonymousLink ? deployment.alias?.[0] : void 0;
2268
+ const deploymentJson = {
2269
+ ...getDeploymentOutputJson(deployment, client.apiUrl),
2270
+ ...anonymousLink ? {
2271
+ expiresAt: anonymousLink.expiresAt,
2272
+ claimUrl: anonymousLink.claimUrl
2273
+ } : {},
2274
+ ...anonymousUrl ? { url: `https://${anonymousUrl}`, inspectorUrl: null } : {}
2275
+ };
2023
2276
  const isImplicitProduction = deployment.target === "production" && !target;
2024
2277
  const payload = client.nonInteractive ? {
2025
2278
  status: AGENT_STATUS.OK,
2026
2279
  deployment: deploymentJson,
2027
- message: `Deployment ${deployment.url} ready.`,
2280
+ message: anonymousLink ? `Anonymous deployment ${anonymousUrl ?? deployment.url} ready. It expires in ${(0, import_ms.default)(anonymousLink.expiresAt - Date.now(), { long: true })}. Claim it at ${anonymousLink.claimUrl} to keep it.` : `Deployment ${deployment.url} ready.`,
2028
2281
  ...isImplicitProduction ? {
2029
2282
  hint: "This is the project\u2019s first deployment, so it was assigned to production. Future deployments will be preview deployments unless you use --prod."
2030
2283
  } : {},
2031
- next: [
2284
+ next: anonymousLink ? [
2285
+ {
2286
+ command: withGlobalFlags(client, "deploy"),
2287
+ when: "Redeploy changes to the same anonymous deployment"
2288
+ },
2289
+ {
2290
+ command: withGlobalFlags(client, "login"),
2291
+ when: "Create an account to keep deploying"
2292
+ }
2293
+ ] : [
2032
2294
  {
2033
2295
  command: `${packageName} curl https://${deployment.url}`,
2034
2296
  when: "Verify deployment, including when Deployment Protection is enabled"
@@ -2050,8 +2312,18 @@ ${err.stack}`);
2050
2312
  return 0;
2051
2313
  }
2052
2314
  const { isAgent } = await determineAgent();
2053
- const guidanceMode = parsedArguments.flags["--guidance"] ?? isAgent;
2054
- return printDeploymentStatus(
2315
+ const guidanceMode = (parsedArguments.flags["--guidance"] ?? isAgent) && !anonymousLink;
2316
+ if (anonymousLink) {
2317
+ output_manager_default.print("\n");
2318
+ log(
2319
+ `This deployment expires in ${(0, import_ms.default)(anonymousLink.expiresAt - Date.now(), {
2320
+ long: true
2321
+ })}. Claim it to keep it live (don't share this link): ${import_chalk.default.cyan(
2322
+ anonymousLink.claimUrl
2323
+ )}`
2324
+ );
2325
+ }
2326
+ return await printDeploymentStatus(
2055
2327
  client,
2056
2328
  deployment,
2057
2329
  deployStamp,
@@ -2059,6 +2331,32 @@ ${err.stack}`);
2059
2331
  guidanceMode
2060
2332
  );
2061
2333
  }
2334
+ async function runImplicitBuild(client, cwd) {
2335
+ const projectJsonPath = join3(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
2336
+ if (!await import_fs_extra3.default.pathExists(projectJsonPath)) {
2337
+ await import_fs_extra3.default.outputJSON(projectJsonPath, { settings: {} }, { spaces: 2 });
2338
+ }
2339
+ if (await import_fs_extra3.default.pathExists(join3(cwd, "package.json"))) {
2340
+ output_manager_default.log("Building your project locally\u2026");
2341
+ }
2342
+ const originalArgv = client.argv;
2343
+ const originalCwd = client.cwd;
2344
+ const originalStdout = client.stdout;
2345
+ client.cwd = cwd;
2346
+ client.setArgv([...originalArgv.slice(0, 2), "build", "--prod", "--yes"]);
2347
+ client.stdout = createSinkStream();
2348
+ try {
2349
+ const build = (await import("../build/index.js")).default;
2350
+ return await build(client);
2351
+ } finally {
2352
+ client.setArgv(originalArgv);
2353
+ client.cwd = originalCwd;
2354
+ client.stdout = originalStdout;
2355
+ }
2356
+ }
2357
+ function createSinkStream() {
2358
+ return { isTTY: false, write: () => true };
2359
+ }
2062
2360
  function handleCreateDeployError(error, localConfig) {
2063
2361
  if (error instanceof InvalidDomain) {
2064
2362
  output_manager_default.error(`The domain ${error.meta.domain} is not valid`);
@@ -2370,7 +2668,7 @@ async function handleContinueDeployment({
2370
2668
  );
2371
2669
  } catch (err) {
2372
2670
  output_manager_default.stopSpinner();
2373
- if ((0, import_error_utils.isError)(err)) {
2671
+ if ((0, import_error_utils2.isError)(err)) {
2374
2672
  debug(`Error: ${err}
2375
2673
  ${err.stack}`);
2376
2674
  error(err.message);