@depup/vercel 50.32.5-depup.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 (96) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +38 -0
  3. package/changes.json +38 -0
  4. package/dist/chunks/chunk-2DLBVZWU.js +197 -0
  5. package/dist/chunks/chunk-2HSQ7YUK.js +93 -0
  6. package/dist/chunks/chunk-2IQTNMUG.js +86 -0
  7. package/dist/chunks/chunk-3FRG2XGZ.js +466 -0
  8. package/dist/chunks/chunk-3KMKI2FP.js +34 -0
  9. package/dist/chunks/chunk-3XFFP2BA.js +110 -0
  10. package/dist/chunks/chunk-4S3Y3ATR.js +5383 -0
  11. package/dist/chunks/chunk-7EHTK7LP.js +359 -0
  12. package/dist/chunks/chunk-7YHZDJ4G.js +116 -0
  13. package/dist/chunks/chunk-A3NYPUKZ.js +17 -0
  14. package/dist/chunks/chunk-AA7QEJFB.js +5204 -0
  15. package/dist/chunks/chunk-AHU7WNL2.js +24 -0
  16. package/dist/chunks/chunk-AKQZ7KG3.js +4172 -0
  17. package/dist/chunks/chunk-AQLVWVEN.js +39155 -0
  18. package/dist/chunks/chunk-BQ3DXZNT.js +968 -0
  19. package/dist/chunks/chunk-E65JE2CC.js +102 -0
  20. package/dist/chunks/chunk-EKPSCRJZ.js +26 -0
  21. package/dist/chunks/chunk-EOZFDJSY.js +18 -0
  22. package/dist/chunks/chunk-FDJURQMQ.js +4676 -0
  23. package/dist/chunks/chunk-FLKHKWZV.js +1854 -0
  24. package/dist/chunks/chunk-G6BUEBF5.js +192 -0
  25. package/dist/chunks/chunk-GBNIO3KP.js +771 -0
  26. package/dist/chunks/chunk-GGP5R3FU.js +129 -0
  27. package/dist/chunks/chunk-H5XJSH37.js +91 -0
  28. package/dist/chunks/chunk-IB5L4LKZ.js +1082 -0
  29. package/dist/chunks/chunk-IE7MNZ56.js +149 -0
  30. package/dist/chunks/chunk-IK7DLK2T.js +16112 -0
  31. package/dist/chunks/chunk-IUGPWINM.js +104 -0
  32. package/dist/chunks/chunk-J7HDA5GH.js +54 -0
  33. package/dist/chunks/chunk-JLYZNGYY.js +293 -0
  34. package/dist/chunks/chunk-JQ4NA5MX.js +250 -0
  35. package/dist/chunks/chunk-LL26LVRR.js +81 -0
  36. package/dist/chunks/chunk-LW5ZNGW7.js +127 -0
  37. package/dist/chunks/chunk-LWBSOTJP.js +1772 -0
  38. package/dist/chunks/chunk-MBGJBHYD.js +388 -0
  39. package/dist/chunks/chunk-NUKAG3YM.js +168 -0
  40. package/dist/chunks/chunk-O7I4ZOCC.js +58 -0
  41. package/dist/chunks/chunk-OWR3XNE3.js +48 -0
  42. package/dist/chunks/chunk-P3SKP5WM.js +27 -0
  43. package/dist/chunks/chunk-P4I4DMEU.js +342 -0
  44. package/dist/chunks/chunk-P5Q6F5IA.js +107 -0
  45. package/dist/chunks/chunk-PMSMUMUO.js +30 -0
  46. package/dist/chunks/chunk-QXRJ52T4.js +2977 -0
  47. package/dist/chunks/chunk-RQXPRFRM.js +90 -0
  48. package/dist/chunks/chunk-S7KYDPEM.js +1564 -0
  49. package/dist/chunks/chunk-SGGLJFUZ.js +68 -0
  50. package/dist/chunks/chunk-SOTR4CXR.js +34 -0
  51. package/dist/chunks/chunk-TEVP63TU.js +1717 -0
  52. package/dist/chunks/chunk-TNBMKNET.js +323 -0
  53. package/dist/chunks/chunk-TZ2YI2VH.js +87 -0
  54. package/dist/chunks/chunk-U6XOC6E4.js +903 -0
  55. package/dist/chunks/chunk-V5P25P7F.js +22 -0
  56. package/dist/chunks/chunk-WQ5CUZWR.js +333 -0
  57. package/dist/chunks/chunk-WU2BPWRP.js +12237 -0
  58. package/dist/chunks/chunk-XPKWKPWA.js +44 -0
  59. package/dist/chunks/chunk-XR53KVJD.js +33 -0
  60. package/dist/chunks/chunk-Y4JJYHUG.js +16 -0
  61. package/dist/chunks/chunk-YPQSDAEW.js +29 -0
  62. package/dist/chunks/chunk-ZB2UO4V2.js +135 -0
  63. package/dist/chunks/chunk-ZLCMHY2G.js +1528 -0
  64. package/dist/chunks/compile-vercel-config-XU3YY2CZ.js +32 -0
  65. package/dist/chunks/delete-EJ2V7KQO.js +144 -0
  66. package/dist/chunks/disable-BKRFMX4U.js +122 -0
  67. package/dist/chunks/discard-4WF34DXK.js +118 -0
  68. package/dist/chunks/edit-FQE7JGU3.js +509 -0
  69. package/dist/chunks/emit-flags-datafiles-QYKPNWPX.js +17 -0
  70. package/dist/chunks/enable-VCNMX63U.js +122 -0
  71. package/dist/chunks/export-3KNVJCQR.js +133 -0
  72. package/dist/chunks/list-43XQCGKH.js +382 -0
  73. package/dist/chunks/list-DUL6PHUR.js +394 -0
  74. package/dist/chunks/publish-CF7GVZK3.js +128 -0
  75. package/dist/chunks/query-KWKO7VWO.js +954 -0
  76. package/dist/chunks/reorder-GU65YMIN.js +259 -0
  77. package/dist/chunks/restore-Q7ENGWVJ.js +158 -0
  78. package/dist/chunks/routes-Q5CWG44T.js +20 -0
  79. package/dist/chunks/schema-PJKLO2K2.js +176 -0
  80. package/dist/chunks/stamp-RTPE2EBB.js +15 -0
  81. package/dist/chunks/types-563KUQRV.js +108 -0
  82. package/dist/chunks/update-route-version-E3V47KNI.js +13 -0
  83. package/dist/commands/build/index.js +1597 -0
  84. package/dist/commands/deploy/index.js +1711 -0
  85. package/dist/commands/dev/builder-worker.cjs +95 -0
  86. package/dist/commands/dev/index.js +20810 -0
  87. package/dist/commands/env/index.js +2154 -0
  88. package/dist/commands/link/index.js +225 -0
  89. package/dist/commands/list/index.js +528 -0
  90. package/dist/commands-bulk.js +29627 -0
  91. package/dist/get-latest-worker.cjs +272 -0
  92. package/dist/help.js +14 -0
  93. package/dist/index.js +24274 -0
  94. package/dist/vc.js +36 -0
  95. package/dist/version.mjs +1 -0
  96. package/package.json +254 -0
@@ -0,0 +1,1711 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ Now,
9
+ UploadErrorMissingArchive,
10
+ createCertForCns,
11
+ displayBuildLogsUntilFinalError,
12
+ printDeploymentStatus,
13
+ purchaseDomainIfAvailable,
14
+ require_cjs,
15
+ setupDomain
16
+ } from "../../chunks/chunk-4S3Y3ATR.js";
17
+ import {
18
+ readLocalConfig
19
+ } from "../../chunks/chunk-AKQZ7KG3.js";
20
+ import {
21
+ highlight
22
+ } from "../../chunks/chunk-V5P25P7F.js";
23
+ import "../../chunks/chunk-XR53KVJD.js";
24
+ import {
25
+ parseMeta
26
+ } from "../../chunks/chunk-EKPSCRJZ.js";
27
+ import {
28
+ getDeployment,
29
+ mapCertError
30
+ } from "../../chunks/chunk-2IQTNMUG.js";
31
+ import "../../chunks/chunk-3KMKI2FP.js";
32
+ import {
33
+ validateJsonOutput
34
+ } from "../../chunks/chunk-XPKWKPWA.js";
35
+ import {
36
+ getSubcommand
37
+ } from "../../chunks/chunk-YPQSDAEW.js";
38
+ import {
39
+ continueSubcommand,
40
+ deployCommand,
41
+ deprecatedArchiveSplitTgz,
42
+ getCommandAliases,
43
+ initSubcommand
44
+ } from "../../chunks/chunk-AA7QEJFB.js";
45
+ import "../../chunks/chunk-U6XOC6E4.js";
46
+ import "../../chunks/chunk-O7I4ZOCC.js";
47
+ import "../../chunks/chunk-LW5ZNGW7.js";
48
+ import "../../chunks/chunk-P5Q6F5IA.js";
49
+ import "../../chunks/chunk-2DLBVZWU.js";
50
+ import "../../chunks/chunk-E65JE2CC.js";
51
+ import {
52
+ pickOverrides
53
+ } from "../../chunks/chunk-RQXPRFRM.js";
54
+ import {
55
+ require_dist as require_dist2
56
+ } from "../../chunks/chunk-IK7DLK2T.js";
57
+ import "../../chunks/chunk-QXRJ52T4.js";
58
+ import "../../chunks/chunk-IUGPWINM.js";
59
+ import {
60
+ ensureLink
61
+ } from "../../chunks/chunk-LL26LVRR.js";
62
+ import {
63
+ validatePaths,
64
+ validateRootDirectory
65
+ } from "../../chunks/chunk-GBNIO3KP.js";
66
+ import "../../chunks/chunk-OWR3XNE3.js";
67
+ import {
68
+ compileVercelConfig
69
+ } from "../../chunks/chunk-MBGJBHYD.js";
70
+ import "../../chunks/chunk-ZB2UO4V2.js";
71
+ import {
72
+ help
73
+ } from "../../chunks/chunk-JQ4NA5MX.js";
74
+ import {
75
+ createGitMeta,
76
+ param,
77
+ parseEnv,
78
+ parseTarget,
79
+ require_lib
80
+ } from "../../chunks/chunk-AQLVWVEN.js";
81
+ import {
82
+ TelemetryClient
83
+ } from "../../chunks/chunk-P4I4DMEU.js";
84
+ import {
85
+ stamp_default
86
+ } from "../../chunks/chunk-SOTR4CXR.js";
87
+ import "../../chunks/chunk-LWBSOTJP.js";
88
+ import "../../chunks/chunk-7EHTK7LP.js";
89
+ import {
90
+ require_ms
91
+ } from "../../chunks/chunk-GGP5R3FU.js";
92
+ import {
93
+ AliasDomainConfigured,
94
+ BuildError,
95
+ BuildsRateLimited,
96
+ ConflictingConfigFiles,
97
+ ConflictingFilePath,
98
+ ConflictingPathSegment,
99
+ DeploymentNotFound,
100
+ DeploymentsRateLimited,
101
+ DomainNotFound,
102
+ DomainNotVerified,
103
+ DomainPermissionDenied,
104
+ DomainVerificationFailed,
105
+ InvalidDomain,
106
+ MissingBuildScript,
107
+ NotDomainOwner,
108
+ NowError,
109
+ SchemaValidationFailed,
110
+ TooManyRequests,
111
+ UserAborted,
112
+ code,
113
+ getCommandName,
114
+ getFlagsSpecification,
115
+ isAPIError,
116
+ parseArguments,
117
+ printError,
118
+ require_bytes
119
+ } from "../../chunks/chunk-ZLCMHY2G.js";
120
+ import "../../chunks/chunk-3XFFP2BA.js";
121
+ import {
122
+ emoji,
123
+ output_manager_default,
124
+ prependEmoji,
125
+ require_dist
126
+ } from "../../chunks/chunk-FDJURQMQ.js";
127
+ import {
128
+ require_source
129
+ } from "../../chunks/chunk-S7KYDPEM.js";
130
+ import {
131
+ __toESM
132
+ } from "../../chunks/chunk-TZ2YI2VH.js";
133
+
134
+ // src/commands/deploy/index.ts
135
+ var import_client3 = __toESM(require_dist2(), 1);
136
+ var import_error_utils = __toESM(require_dist(), 1);
137
+ var import_bytes = __toESM(require_bytes(), 1);
138
+ var import_chalk = __toESM(require_source(), 1);
139
+ var import_fs_extra2 = __toESM(require_lib(), 1);
140
+ var import_ms = __toESM(require_ms(), 1);
141
+ import {
142
+ getPrettyError,
143
+ getSupportedNodeVersion,
144
+ scanParentDirs
145
+ } from "@vercel/build-utils";
146
+ import { join as join2, resolve } from "path";
147
+
148
+ // src/util/deploy/generate-cert-for-deploy.ts
149
+ var import_tldts = __toESM(require_cjs(), 1);
150
+ async function generateCertForDeploy(client, contextName, deployURL) {
151
+ const parsedDomain = (0, import_tldts.parse)(deployURL);
152
+ const { domain } = parsedDomain;
153
+ if (!domain) {
154
+ return new InvalidDomain(deployURL);
155
+ }
156
+ output_manager_default.spinner(`Setting custom suffix domain ${domain}`);
157
+ const result = await setupDomain(client, domain, contextName);
158
+ output_manager_default.stopSpinner();
159
+ if (result instanceof NowError) {
160
+ return result;
161
+ }
162
+ output_manager_default.spinner(`Generating a wildcard certificate for ${domain}`);
163
+ const cert = await createCertForCns(
164
+ client,
165
+ [domain, `*.${domain}`],
166
+ contextName
167
+ );
168
+ output_manager_default.stopSpinner();
169
+ if (cert instanceof NowError) {
170
+ return cert;
171
+ }
172
+ }
173
+
174
+ // src/util/deploy/create-deploy.ts
175
+ async function createDeploy(client, now, contextName, path, createArgs, org, isSettingUpProject, archive) {
176
+ try {
177
+ return await now.create(path, createArgs, org, isSettingUpProject, archive);
178
+ } catch (err) {
179
+ if (isAPIError(err)) {
180
+ if (err.code === "rate_limited") {
181
+ throw new DeploymentsRateLimited(err.message);
182
+ }
183
+ if (err.code === "domain_missing") {
184
+ throw new DomainNotFound(err.value);
185
+ }
186
+ if (err.code === "domain_not_found" && err.domain) {
187
+ throw new DomainNotFound(err.domain);
188
+ }
189
+ if (err.code === "domain_not_verified" && err.domain) {
190
+ throw new DomainNotVerified(err.domain);
191
+ }
192
+ if (err.code === "domain_not_verified" && err.value) {
193
+ throw new DomainVerificationFailed(err.value);
194
+ }
195
+ if (err.code === "not_domain_owner") {
196
+ throw new NotDomainOwner(err.message);
197
+ }
198
+ if (err.code === "builds_rate_limited") {
199
+ throw new BuildsRateLimited(err.message);
200
+ }
201
+ if (err.code === "forbidden") {
202
+ throw new DomainPermissionDenied(err.value, contextName);
203
+ }
204
+ if (err.code === "bad_request" && err.keyword) {
205
+ throw new SchemaValidationFailed(
206
+ err.message,
207
+ err.keyword,
208
+ err.dataPath,
209
+ err.params
210
+ );
211
+ }
212
+ if (err.code === "domain_configured") {
213
+ throw new AliasDomainConfigured(err);
214
+ }
215
+ if (err.code === "missing_build_script") {
216
+ throw new MissingBuildScript(err);
217
+ }
218
+ if (err.code === "conflicting_file_path") {
219
+ throw new ConflictingFilePath(err);
220
+ }
221
+ if (err.code === "conflicting_path_segment") {
222
+ throw new ConflictingPathSegment(err);
223
+ }
224
+ if (err.code === "cert_missing") {
225
+ const result = await generateCertForDeploy(
226
+ client,
227
+ contextName,
228
+ err.value
229
+ );
230
+ if (result instanceof NowError) {
231
+ return result;
232
+ }
233
+ return createDeploy(
234
+ client,
235
+ now,
236
+ contextName,
237
+ path,
238
+ createArgs,
239
+ org,
240
+ isSettingUpProject
241
+ );
242
+ }
243
+ if (err.code === "not_found") {
244
+ throw new DeploymentNotFound({ context: contextName });
245
+ }
246
+ const certError = mapCertError(err);
247
+ if (certError) {
248
+ return certError;
249
+ }
250
+ }
251
+ throw err;
252
+ }
253
+ }
254
+
255
+ // src/util/deploy/get-deployment-checks.ts
256
+ async function getDeploymentChecks(client, deploymentId) {
257
+ const checksResponse = await client.fetch(
258
+ `/v1/deployments/${encodeURIComponent(deploymentId)}/checks`
259
+ );
260
+ return checksResponse;
261
+ }
262
+
263
+ // src/util/deploy/get-prebuilt-json.ts
264
+ var import_fs_extra = __toESM(require_lib(), 1);
265
+ import { join } from "path";
266
+ async function getPrebuiltJson(directory) {
267
+ try {
268
+ return await import_fs_extra.default.readJSON(join(directory, "builds.json"));
269
+ } catch (_error) {
270
+ }
271
+ return null;
272
+ }
273
+
274
+ // src/util/deploy/validate-archive-format.ts
275
+ var import_client = __toESM(require_dist2(), 1);
276
+ var validArchiveFormats = new Set(import_client.VALID_ARCHIVE_FORMATS);
277
+ function isValidArchive(archive) {
278
+ return validArchiveFormats.has(archive);
279
+ }
280
+
281
+ // src/util/get-project-name.ts
282
+ import { basename } from "path";
283
+ function getProjectName({
284
+ nameParam,
285
+ nowConfig = {},
286
+ paths = []
287
+ }) {
288
+ if (nameParam) {
289
+ return nameParam;
290
+ }
291
+ if (nowConfig.name) {
292
+ return nowConfig.name;
293
+ }
294
+ return basename(paths[0] || "");
295
+ }
296
+
297
+ // src/util/telemetry/commands/deploy/index.ts
298
+ var import_client2 = __toESM(require_dist2(), 1);
299
+ var DeployTelemetryClient = class extends TelemetryClient {
300
+ trackCliArgumentProjectPath(projectPaths) {
301
+ if (projectPaths) {
302
+ this.trackCliArgument({
303
+ arg: "project-path",
304
+ value: this.redactedValue
305
+ });
306
+ }
307
+ }
308
+ trackCliOptionArchive(format) {
309
+ if (format) {
310
+ const allowedFormat = [
311
+ ...import_client2.VALID_ARCHIVE_FORMATS,
312
+ deprecatedArchiveSplitTgz
313
+ ].includes(format) ? format : this.redactedValue;
314
+ this.trackCliOption({
315
+ option: "archive",
316
+ value: allowedFormat
317
+ });
318
+ }
319
+ }
320
+ trackCliOptionBuildEnv(buildEnv) {
321
+ if (buildEnv && buildEnv.length > 0) {
322
+ this.trackCliOption({
323
+ option: "build-env",
324
+ value: this.redactedValue
325
+ });
326
+ }
327
+ }
328
+ trackCliOptionEnv(env) {
329
+ if (env && env.length > 0) {
330
+ this.trackCliOption({
331
+ option: "env",
332
+ value: this.redactedValue
333
+ });
334
+ }
335
+ }
336
+ trackCliOptionMeta(meta) {
337
+ if (meta && meta.length > 0) {
338
+ this.trackCliOption({
339
+ option: "meta",
340
+ value: this.redactedValue
341
+ });
342
+ }
343
+ }
344
+ trackCliOptionName(name) {
345
+ if (name) {
346
+ this.trackCliOption({
347
+ option: "name",
348
+ value: this.redactedValue
349
+ });
350
+ }
351
+ }
352
+ trackCliOptionRegions(regions) {
353
+ if (regions) {
354
+ this.trackCliOption({
355
+ option: "regions",
356
+ // consider revisiting once we come up with a way to query the list of regions
357
+ value: this.redactedValue
358
+ });
359
+ }
360
+ }
361
+ trackCliOptionTarget(target) {
362
+ if (target) {
363
+ this.trackCliOption({
364
+ option: "target",
365
+ value: this.redactedTargetName(target)
366
+ });
367
+ }
368
+ }
369
+ trackCliFlagConfirm(flag) {
370
+ if (flag) {
371
+ this.trackCliFlag("confirm");
372
+ }
373
+ }
374
+ trackCliFlagForce(flag) {
375
+ if (flag) {
376
+ this.trackCliFlag("force");
377
+ }
378
+ }
379
+ trackCliFlagLogs(flag) {
380
+ if (flag) {
381
+ this.trackCliFlag("logs");
382
+ }
383
+ }
384
+ trackCliFlagNoLogs(flag) {
385
+ if (flag) {
386
+ this.trackCliFlag("no-logs");
387
+ }
388
+ }
389
+ trackCliFlagGuidance(flag) {
390
+ if (flag) {
391
+ this.trackCliFlag("guidance");
392
+ }
393
+ }
394
+ trackCliFlagNoClipboard(flag) {
395
+ if (flag) {
396
+ this.trackCliFlag("no-clipboard");
397
+ }
398
+ }
399
+ trackCliFlagNoWait(flag) {
400
+ if (flag) {
401
+ this.trackCliFlag("no-wait");
402
+ }
403
+ }
404
+ trackCliFlagPrebuilt(flag) {
405
+ if (flag) {
406
+ this.trackCliFlag("prebuilt");
407
+ }
408
+ }
409
+ trackCliSubcommandInit(actual) {
410
+ this.trackCliSubcommand({
411
+ subcommand: "init",
412
+ value: actual
413
+ });
414
+ }
415
+ trackCliSubcommandContinue(actual) {
416
+ this.trackCliSubcommand({
417
+ subcommand: "continue",
418
+ value: actual
419
+ });
420
+ }
421
+ trackCliFlagProd(flag) {
422
+ if (flag) {
423
+ this.trackCliFlag("prod");
424
+ }
425
+ }
426
+ trackCliFlagPublic(flag) {
427
+ if (flag) {
428
+ this.trackCliFlag("public");
429
+ }
430
+ }
431
+ trackCliFlagSkipDomain(flag) {
432
+ if (flag) {
433
+ this.trackCliFlag("skip-domain");
434
+ }
435
+ }
436
+ trackCliFlagWithCache(flag) {
437
+ if (flag) {
438
+ this.trackCliFlag("with-cache");
439
+ }
440
+ }
441
+ trackCliFlagYes(flag) {
442
+ if (flag) {
443
+ this.trackCliFlag("yes");
444
+ }
445
+ }
446
+ trackCliFlagJson(flag) {
447
+ if (flag) {
448
+ this.trackCliFlag("json");
449
+ }
450
+ }
451
+ trackCliOptionFormat(format) {
452
+ if (format) {
453
+ this.trackCliOption({
454
+ option: "format",
455
+ value: format
456
+ });
457
+ }
458
+ }
459
+ trackDeploymentId(id) {
460
+ if (id) {
461
+ this.trackCommandOutput({
462
+ key: "deployment-id",
463
+ value: id
464
+ });
465
+ }
466
+ }
467
+ };
468
+
469
+ // src/commands/deploy/index.ts
470
+ import { determineAgent } from "@vercel/detect-agent";
471
+ var COMMAND_CONFIG = {
472
+ init: getCommandAliases(initSubcommand),
473
+ continue: getCommandAliases(continueSubcommand)
474
+ };
475
+ var deploy_default = async (client) => {
476
+ const telemetryClient = new DeployTelemetryClient({
477
+ opts: {
478
+ store: client.telemetryEventStore
479
+ }
480
+ });
481
+ let parsedArguments = null;
482
+ const flagsSpecification = getFlagsSpecification(deployCommand.options);
483
+ try {
484
+ parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification, {
485
+ permissive: true
486
+ });
487
+ } catch (error) {
488
+ printError(error);
489
+ return 1;
490
+ }
491
+ const subArgs = parsedArguments.args[0] === deployCommand.name ? parsedArguments.args.slice(1) : parsedArguments.args;
492
+ const { subcommand, subcommandOriginal } = getSubcommand(
493
+ subArgs,
494
+ COMMAND_CONFIG
495
+ );
496
+ function printSubcommandHelp(command) {
497
+ output_manager_default.print(
498
+ help(command, { parent: deployCommand, columns: client.stderr.columns })
499
+ );
500
+ }
501
+ switch (subcommand) {
502
+ case "init":
503
+ if (parsedArguments.flags["--help"]) {
504
+ telemetryClient.trackCliFlagHelp("deploy", subcommandOriginal);
505
+ printSubcommandHelp(initSubcommand);
506
+ return 2;
507
+ }
508
+ telemetryClient.trackCliSubcommandInit(subcommandOriginal);
509
+ return handleInitDeployment(client, telemetryClient);
510
+ case "continue":
511
+ if (parsedArguments.flags["--help"]) {
512
+ telemetryClient.trackCliFlagHelp("deploy", subcommandOriginal);
513
+ printSubcommandHelp(continueSubcommand);
514
+ return 2;
515
+ }
516
+ telemetryClient.trackCliSubcommandContinue(subcommandOriginal);
517
+ return handleContinueSubcommand(client);
518
+ default:
519
+ if (parsedArguments.flags["--help"]) {
520
+ telemetryClient.trackCliFlagHelp("deploy");
521
+ output_manager_default.print(help(deployCommand, { columns: client.stderr.columns }));
522
+ return 2;
523
+ }
524
+ return handleDefaultDeploy(client, telemetryClient);
525
+ }
526
+ };
527
+ async function handleInitDeployment(client, telemetryClient) {
528
+ const flagsSpecification = getFlagsSpecification(initSubcommand.options);
529
+ let parsedArguments;
530
+ try {
531
+ parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification);
532
+ } catch (error2) {
533
+ printError(error2);
534
+ return 1;
535
+ }
536
+ telemetryClient.trackCliFlagJson(parsedArguments.flags["--json"]);
537
+ telemetryClient.trackCliOptionFormat(parsedArguments.flags["--format"]);
538
+ const formatResult = validateJsonOutput(parsedArguments.flags);
539
+ if (!formatResult.valid) {
540
+ output_manager_default.error(formatResult.error);
541
+ return 1;
542
+ }
543
+ const asJson = formatResult.jsonOutput;
544
+ let args = parsedArguments.args;
545
+ if (args[0] === "deploy")
546
+ args = args.slice(1);
547
+ if (args[0] === "init")
548
+ args = args.slice(1);
549
+ let paths;
550
+ if (args.length > 0) {
551
+ paths = args.map((item) => resolve(client.cwd, item));
552
+ telemetryClient.trackCliArgumentProjectPath(paths[0]);
553
+ } else {
554
+ paths = [client.cwd];
555
+ }
556
+ const pathValidation = await validatePaths(client, paths);
557
+ if (!pathValidation.valid) {
558
+ return pathValidation.exitCode;
559
+ }
560
+ await compileVercelConfig(paths[0]);
561
+ let localConfig = client.localConfig || readLocalConfig(paths[0]);
562
+ if (localConfig) {
563
+ client.localConfig = localConfig;
564
+ const { version } = localConfig;
565
+ const file = highlight(localConfig[import_client3.fileNameSymbol]);
566
+ const prop = code("version");
567
+ if (version) {
568
+ if (typeof version === "number") {
569
+ if (version !== 2) {
570
+ const two = code(String(2));
571
+ output_manager_default.error(
572
+ `The value of the ${prop} property within ${file} can only be ${two}.`
573
+ );
574
+ return 1;
575
+ }
576
+ } else {
577
+ output_manager_default.error(
578
+ `The ${prop} property inside your ${file} file must be a number.`
579
+ );
580
+ return 1;
581
+ }
582
+ }
583
+ }
584
+ const { log, debug, error } = output_manager_default;
585
+ const quiet = !client.stdout.isTTY;
586
+ let { path: cwd } = pathValidation;
587
+ const autoConfirm = parsedArguments.flags["--yes"];
588
+ const target = parseTarget({
589
+ flagName: "target",
590
+ flags: parsedArguments.flags
591
+ });
592
+ const parsedArchive = parsedArguments.flags["--archive"];
593
+ if (typeof parsedArchive === "string" && !(isValidArchive(parsedArchive) || parsedArchive === deprecatedArchiveSplitTgz)) {
594
+ output_manager_default.error(`Format must be one of: ${import_client3.VALID_ARCHIVE_FORMATS.join(", ")}`);
595
+ return 1;
596
+ }
597
+ if (parsedArchive === deprecatedArchiveSplitTgz) {
598
+ output_manager_default.print(
599
+ `${prependEmoji(
600
+ `${param("--archive=tgz")} now has the same behavior as ${param(
601
+ "--archive=split-tgz"
602
+ )}. Please use ${param("--archive=tgz")} instead.`,
603
+ emoji("warning")
604
+ )}
605
+ `
606
+ );
607
+ }
608
+ const cliMeta = parseMeta(parsedArguments.flags["--meta"]);
609
+ const isV0 = cliMeta.v0 === "true";
610
+ const link = await ensureLink("deploy", client, cwd, {
611
+ autoConfirm,
612
+ setupMsg: "Set up and deploy",
613
+ projectName: getProjectName({
614
+ nameParam: void 0,
615
+ nowConfig: localConfig,
616
+ paths
617
+ }),
618
+ v0: isV0
619
+ });
620
+ if (typeof link === "number") {
621
+ return link;
622
+ }
623
+ const { org, project } = link;
624
+ const rootDirectory = project.rootDirectory;
625
+ const sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory ?? true;
626
+ if (link.repoRoot) {
627
+ cwd = link.repoRoot;
628
+ }
629
+ const contextName = org.slug;
630
+ client.config.currentTeam = org.type === "team" ? org.id : void 0;
631
+ if (rootDirectory && await validateRootDirectory(
632
+ cwd,
633
+ join2(cwd, rootDirectory),
634
+ project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
635
+ ) === false) {
636
+ return 1;
637
+ }
638
+ if (rootDirectory) {
639
+ const rootDirectoryPath = join2(cwd, rootDirectory);
640
+ await compileVercelConfig(rootDirectoryPath);
641
+ const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
642
+ if (rootDirectoryConfig) {
643
+ debug(`Read local config from root directory (${rootDirectory})`);
644
+ localConfig = rootDirectoryConfig;
645
+ } else if (localConfig) {
646
+ output_manager_default.print(
647
+ `${prependEmoji(
648
+ `The ${highlight(
649
+ localConfig[import_client3.fileNameSymbol]
650
+ )} file should be inside of the provided root directory.`,
651
+ emoji("warning")
652
+ )}
653
+ `
654
+ );
655
+ }
656
+ }
657
+ localConfig = localConfig || {};
658
+ if (localConfig.name) {
659
+ output_manager_default.print(
660
+ `${prependEmoji(
661
+ `The ${code("name")} property in ${highlight(
662
+ localConfig[import_client3.fileNameSymbol]
663
+ )} is deprecated (https://vercel.link/name-prop)`,
664
+ emoji("warning")
665
+ )}
666
+ `
667
+ );
668
+ }
669
+ const isObject = (item) => Object.prototype.toString.call(item) === "[object Object]";
670
+ if (typeof localConfig.env !== "undefined" && !isObject(localConfig.env)) {
671
+ error(
672
+ `The ${code("env")} property in ${highlight(
673
+ localConfig[import_client3.fileNameSymbol]
674
+ )} needs to be an object`
675
+ );
676
+ return 1;
677
+ }
678
+ if (typeof localConfig.build !== "undefined") {
679
+ if (!isObject(localConfig.build)) {
680
+ error(
681
+ `The ${code("build")} property in ${highlight(
682
+ localConfig[import_client3.fileNameSymbol]
683
+ )} needs to be an object`
684
+ );
685
+ return 1;
686
+ }
687
+ if (typeof localConfig.build.env !== "undefined" && !isObject(localConfig.build.env)) {
688
+ error(
689
+ `The ${code("build.env")} property in ${highlight(
690
+ localConfig[import_client3.fileNameSymbol]
691
+ )} needs to be an object`
692
+ );
693
+ return 1;
694
+ }
695
+ }
696
+ const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
697
+ const gitMetadata = await createGitMeta(cwd, project);
698
+ const deploymentEnv = Object.assign(
699
+ {},
700
+ parseEnv(localConfig.env),
701
+ parseEnv(parsedArguments.flags["--env"])
702
+ );
703
+ const deploymentBuildEnv = Object.assign(
704
+ {},
705
+ parseEnv(localConfig.build && localConfig.build.env),
706
+ parseEnv(parsedArguments.flags["--build-env"])
707
+ );
708
+ try {
709
+ await addProcessEnv(log, deploymentEnv);
710
+ await addProcessEnv(log, deploymentBuildEnv);
711
+ } catch (err) {
712
+ error((0, import_error_utils.errorToString)(err));
713
+ return 1;
714
+ }
715
+ const regionFlag = (parsedArguments.flags["--regions"] || "").split(",").map((s) => s.trim()).filter(Boolean);
716
+ const regions = regionFlag.length > 0 ? regionFlag : localConfig.regions;
717
+ const currentTeam = org.type === "team" ? org.id : void 0;
718
+ const now = new Now({
719
+ client,
720
+ currentTeam
721
+ });
722
+ const deployStamp = stamp_default();
723
+ const localConfigurationOverrides = pickOverrides(localConfig);
724
+ const name = project.name;
725
+ if (!name) {
726
+ throw new Error(
727
+ "`name` not found on project or provided by existing project"
728
+ );
729
+ }
730
+ const noWait = true;
731
+ try {
732
+ const autoAssignCustomDomains = parsedArguments.flags["--skip-domain"] ? false : void 0;
733
+ const createArgs = {
734
+ name,
735
+ env: deploymentEnv,
736
+ build: { env: deploymentBuildEnv },
737
+ forceNew: parsedArguments.flags["--force"],
738
+ withCache: parsedArguments.flags["--with-cache"],
739
+ prebuilt: true,
740
+ vercelOutputDir: void 0,
741
+ rootDirectory,
742
+ quiet,
743
+ wantsPublic: Boolean(
744
+ parsedArguments.flags["--public"] || localConfig.public
745
+ ),
746
+ nowConfig: {
747
+ ...localConfig,
748
+ images: void 0
749
+ },
750
+ regions,
751
+ meta,
752
+ gitMetadata,
753
+ deployStamp,
754
+ target,
755
+ skipAutoDetectionConfirmation: autoConfirm,
756
+ noWait,
757
+ withFullLogs: false,
758
+ autoAssignCustomDomains,
759
+ manual: true,
760
+ jsonOutput: asJson
761
+ };
762
+ if (!localConfig.builds || localConfig.builds.length === 0) {
763
+ createArgs.projectSettings = {
764
+ sourceFilesOutsideRootDirectory,
765
+ rootDirectory,
766
+ ...localConfigurationOverrides
767
+ };
768
+ }
769
+ const { packageJson } = await scanParentDirs(
770
+ join2(cwd, project?.rootDirectory ?? ""),
771
+ true,
772
+ cwd
773
+ );
774
+ let nodeVersion;
775
+ if (packageJson?.engines?.node) {
776
+ try {
777
+ const { range } = await getSupportedNodeVersion(
778
+ packageJson.engines.node
779
+ );
780
+ nodeVersion = range;
781
+ } catch (error2) {
782
+ if (error2 instanceof Error) {
783
+ output_manager_default.warn(error2.message);
784
+ }
785
+ }
786
+ }
787
+ if (!createArgs.projectSettings)
788
+ createArgs.projectSettings = {};
789
+ createArgs.projectSettings.nodeVersion = nodeVersion;
790
+ const deployment = await createDeploy(
791
+ client,
792
+ now,
793
+ contextName,
794
+ cwd,
795
+ createArgs,
796
+ org,
797
+ !project,
798
+ parsedArchive ? "tgz" : void 0
799
+ );
800
+ if (deployment instanceof NotDomainOwner) {
801
+ output_manager_default.error(deployment.message);
802
+ return 1;
803
+ }
804
+ if (deployment instanceof Error) {
805
+ output_manager_default.error(
806
+ deployment.message || "An unexpected error occurred while deploying your project",
807
+ void 0,
808
+ "https://vercel.link/help",
809
+ "Contact Support"
810
+ );
811
+ return 1;
812
+ }
813
+ if (deployment.readyState === "CANCELED") {
814
+ if (asJson) {
815
+ output_manager_default.stopSpinner();
816
+ client.stdout.write(
817
+ `${JSON.stringify(
818
+ getDeploymentOutputJson(deployment, client.apiUrl, {
819
+ name: "DEPLOYMENT_CANCELED",
820
+ message: "The deployment has been canceled."
821
+ }),
822
+ null,
823
+ 2
824
+ )}
825
+ `
826
+ );
827
+ } else {
828
+ output_manager_default.print("The deployment has been canceled.\n");
829
+ }
830
+ return 1;
831
+ }
832
+ if (deployment === null) {
833
+ error("Uploading failed. Please try again.");
834
+ return 1;
835
+ }
836
+ if (asJson) {
837
+ output_manager_default.stopSpinner();
838
+ client.stdout.write(
839
+ `${JSON.stringify(getDeploymentOutputJson(deployment, client.apiUrl), null, 2)}
840
+ `
841
+ );
842
+ return 0;
843
+ }
844
+ return printDeploymentStatus(deployment, deployStamp, noWait, false, true);
845
+ } catch (err) {
846
+ if ((0, import_error_utils.isError)(err)) {
847
+ debug(`Error: ${err}
848
+ ${err.stack}`);
849
+ }
850
+ if (err instanceof UploadErrorMissingArchive) {
851
+ output_manager_default.prettyError(err);
852
+ return 1;
853
+ }
854
+ if (err instanceof NotDomainOwner) {
855
+ output_manager_default.error(err.message);
856
+ return 1;
857
+ }
858
+ if (err instanceof DomainNotFound || err instanceof DomainNotVerified || err instanceof NotDomainOwner || err instanceof DomainPermissionDenied || err instanceof DomainVerificationFailed || err instanceof SchemaValidationFailed || err instanceof InvalidDomain || err instanceof DeploymentNotFound || err instanceof BuildsRateLimited || err instanceof DeploymentsRateLimited || err instanceof AliasDomainConfigured || err instanceof MissingBuildScript || err instanceof ConflictingFilePath || err instanceof ConflictingPathSegment || err instanceof ConflictingConfigFiles) {
859
+ handleCreateDeployError(err, localConfig);
860
+ return 1;
861
+ }
862
+ if (isAPIError(err) && err.code === "size_limit_exceeded") {
863
+ const { sizeLimit = 0 } = err;
864
+ const message = `File size limit exceeded (${(0, import_bytes.default)(sizeLimit)})`;
865
+ error(message);
866
+ return 1;
867
+ }
868
+ printError(err);
869
+ return 1;
870
+ }
871
+ }
872
+ async function handleContinueSubcommand(client) {
873
+ const flagsSpecification = getFlagsSpecification(continueSubcommand.options);
874
+ let parsedArguments;
875
+ try {
876
+ parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification);
877
+ } catch (error) {
878
+ printError(error);
879
+ return 1;
880
+ }
881
+ const idFlag = parsedArguments.flags["--id"];
882
+ if (!idFlag) {
883
+ output_manager_default.error(
884
+ `Missing required ${param("--id")} flag. Usage: ${getCommandName("deploy continue --id <deployment-id>")}`
885
+ );
886
+ return 1;
887
+ }
888
+ const paths = [client.cwd];
889
+ const pathValidation = await validatePaths(client, paths);
890
+ if (!pathValidation.valid) {
891
+ return pathValidation.exitCode;
892
+ }
893
+ await compileVercelConfig(paths[0]);
894
+ const localConfig = client.localConfig || readLocalConfig(paths[0]);
895
+ if (localConfig) {
896
+ client.localConfig = localConfig;
897
+ }
898
+ let { path: cwd } = pathValidation;
899
+ const link = await ensureLink("deploy", client, cwd, {
900
+ autoConfirm: true,
901
+ setupMsg: "Set up and deploy",
902
+ projectName: getProjectName({
903
+ nameParam: void 0,
904
+ nowConfig: localConfig,
905
+ paths
906
+ })
907
+ });
908
+ if (typeof link === "number") {
909
+ return link;
910
+ }
911
+ const { org } = link;
912
+ if (link.repoRoot) {
913
+ cwd = link.repoRoot;
914
+ }
915
+ let vercelOutputDir = join2(cwd, ".vercel/output");
916
+ if (link.repoRoot && link.project.rootDirectory) {
917
+ vercelOutputDir = join2(cwd, link.project.rootDirectory, ".vercel/output");
918
+ }
919
+ const prebuiltExists = await import_fs_extra2.default.pathExists(vercelOutputDir);
920
+ if (!prebuiltExists) {
921
+ output_manager_default.error(
922
+ `No prebuilt output found in ".vercel/output". Run ${getCommandName(
923
+ "build"
924
+ )} to generate a local build.`
925
+ );
926
+ return 1;
927
+ }
928
+ client.config.currentTeam = org.type === "team" ? org.id : void 0;
929
+ const deployStamp = stamp_default();
930
+ return handleContinueDeployment({
931
+ client,
932
+ deploymentId: idFlag,
933
+ cwd,
934
+ deployStamp,
935
+ noWait: false,
936
+ org,
937
+ vercelOutputDir
938
+ });
939
+ }
940
+ async function handleDefaultDeploy(client, telemetryClient) {
941
+ const flagsSpecification = getFlagsSpecification(deployCommand.options);
942
+ let parsedArguments;
943
+ try {
944
+ parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification);
945
+ } catch (error2) {
946
+ printError(error2);
947
+ return 1;
948
+ }
949
+ telemetryClient.trackCliOptionArchive(parsedArguments.flags["--archive"]);
950
+ telemetryClient.trackCliOptionEnv(parsedArguments.flags["--env"]);
951
+ telemetryClient.trackCliOptionBuildEnv(parsedArguments.flags["--build-env"]);
952
+ telemetryClient.trackCliOptionMeta(parsedArguments.flags["--meta"]);
953
+ telemetryClient.trackCliFlagPrebuilt(parsedArguments.flags["--prebuilt"]);
954
+ telemetryClient.trackCliOptionRegions(parsedArguments.flags["--regions"]);
955
+ telemetryClient.trackCliFlagNoWait(parsedArguments.flags["--no-wait"]);
956
+ telemetryClient.trackCliFlagYes(parsedArguments.flags["--yes"]);
957
+ telemetryClient.trackCliOptionTarget(parsedArguments.flags["--target"]);
958
+ telemetryClient.trackCliFlagProd(parsedArguments.flags["--prod"]);
959
+ telemetryClient.trackCliFlagSkipDomain(
960
+ parsedArguments.flags["--skip-domain"]
961
+ );
962
+ telemetryClient.trackCliFlagPublic(parsedArguments.flags["--public"]);
963
+ telemetryClient.trackCliFlagLogs(parsedArguments.flags["--logs"]);
964
+ telemetryClient.trackCliFlagNoLogs(parsedArguments.flags["--no-logs"]);
965
+ telemetryClient.trackCliFlagGuidance(parsedArguments.flags["--guidance"]);
966
+ telemetryClient.trackCliFlagForce(parsedArguments.flags["--force"]);
967
+ telemetryClient.trackCliFlagWithCache(parsedArguments.flags["--with-cache"]);
968
+ telemetryClient.trackCliFlagJson(parsedArguments.flags["--json"]);
969
+ telemetryClient.trackCliOptionFormat(parsedArguments.flags["--format"]);
970
+ const formatResult = validateJsonOutput(parsedArguments.flags);
971
+ if (!formatResult.valid) {
972
+ output_manager_default.error(formatResult.error);
973
+ return 1;
974
+ }
975
+ const asJson = formatResult.jsonOutput;
976
+ if ("--confirm" in parsedArguments.flags) {
977
+ telemetryClient.trackCliFlagConfirm(parsedArguments.flags["--confirm"]);
978
+ output_manager_default.warn("`--confirm` is deprecated, please use `--yes` instead");
979
+ parsedArguments.flags["--yes"] = parsedArguments.flags["--confirm"];
980
+ }
981
+ if ("--no-logs" in parsedArguments.flags) {
982
+ output_manager_default.warn("`--no-logs` is deprecated and now the default behavior.");
983
+ }
984
+ if (parsedArguments.args[0] === deployCommand.name) {
985
+ parsedArguments.args.shift();
986
+ }
987
+ let paths;
988
+ if (parsedArguments.args.length > 0) {
989
+ paths = parsedArguments.args.map((item) => resolve(client.cwd, item));
990
+ telemetryClient.trackCliArgumentProjectPath(paths[0]);
991
+ } else {
992
+ paths = [client.cwd];
993
+ }
994
+ const pathValidation = await validatePaths(client, paths);
995
+ if (!pathValidation.valid) {
996
+ return pathValidation.exitCode;
997
+ }
998
+ await compileVercelConfig(paths[0]);
999
+ let localConfig = client.localConfig || readLocalConfig(paths[0]);
1000
+ if (localConfig) {
1001
+ client.localConfig = localConfig;
1002
+ const { version } = localConfig;
1003
+ const file = highlight(localConfig[import_client3.fileNameSymbol]);
1004
+ const prop = code("version");
1005
+ if (version) {
1006
+ if (typeof version === "number") {
1007
+ if (version !== 2) {
1008
+ const two = code(String(2));
1009
+ output_manager_default.error(
1010
+ `The value of the ${prop} property within ${file} can only be ${two}.`
1011
+ );
1012
+ return 1;
1013
+ }
1014
+ } else {
1015
+ output_manager_default.error(
1016
+ `The ${prop} property inside your ${file} file must be a number.`
1017
+ );
1018
+ return 1;
1019
+ }
1020
+ }
1021
+ }
1022
+ const { log, debug, error, prettyError } = output_manager_default;
1023
+ const quiet = !client.stdout.isTTY;
1024
+ let { path: cwd } = pathValidation;
1025
+ const autoConfirm = parsedArguments.flags["--yes"];
1026
+ if (parsedArguments.flags["--name"]) {
1027
+ output_manager_default.print(
1028
+ `${prependEmoji(
1029
+ `The ${param(
1030
+ "--name"
1031
+ )} option is deprecated (https://vercel.link/name-flag)`,
1032
+ emoji("warning")
1033
+ )}
1034
+ `
1035
+ );
1036
+ telemetryClient.trackCliOptionName(parsedArguments.flags["--name"]);
1037
+ }
1038
+ if (parsedArguments.flags["--no-clipboard"]) {
1039
+ output_manager_default.print(
1040
+ `${prependEmoji(
1041
+ `The ${param(
1042
+ "--no-clipboard"
1043
+ )} option was ignored because it is the default behavior. Please remove it.`,
1044
+ emoji("warning")
1045
+ )}
1046
+ `
1047
+ );
1048
+ telemetryClient.trackCliFlagNoClipboard(true);
1049
+ }
1050
+ const target = parseTarget({
1051
+ flagName: "target",
1052
+ flags: parsedArguments.flags
1053
+ });
1054
+ const parsedArchive = parsedArguments.flags["--archive"];
1055
+ if (typeof parsedArchive === "string" && !(isValidArchive(parsedArchive) || parsedArchive === deprecatedArchiveSplitTgz)) {
1056
+ output_manager_default.error(`Format must be one of: ${import_client3.VALID_ARCHIVE_FORMATS.join(", ")}`);
1057
+ return 1;
1058
+ }
1059
+ if (parsedArchive === deprecatedArchiveSplitTgz) {
1060
+ output_manager_default.print(
1061
+ `${prependEmoji(
1062
+ `${param("--archive=tgz")} now has the same behavior as ${param(
1063
+ "--archive=split-tgz"
1064
+ )}. Please use ${param("--archive=tgz")} instead.`,
1065
+ emoji("warning")
1066
+ )}
1067
+ `
1068
+ );
1069
+ }
1070
+ const cliMeta = parseMeta(parsedArguments.flags["--meta"]);
1071
+ const isV0 = cliMeta.v0 === "true";
1072
+ const link = await ensureLink("deploy", client, cwd, {
1073
+ autoConfirm,
1074
+ setupMsg: "Set up and deploy",
1075
+ projectName: getProjectName({
1076
+ nameParam: parsedArguments.flags["--name"],
1077
+ nowConfig: localConfig,
1078
+ paths
1079
+ }),
1080
+ v0: isV0
1081
+ });
1082
+ if (typeof link === "number") {
1083
+ return link;
1084
+ }
1085
+ const { org, project } = link;
1086
+ const rootDirectory = project.rootDirectory;
1087
+ const sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory ?? true;
1088
+ if (link.repoRoot) {
1089
+ cwd = link.repoRoot;
1090
+ }
1091
+ let vercelOutputDir;
1092
+ if (parsedArguments.flags["--prebuilt"]) {
1093
+ vercelOutputDir = join2(cwd, ".vercel/output");
1094
+ if (link.repoRoot && link.project.rootDirectory) {
1095
+ vercelOutputDir = join2(cwd, link.project.rootDirectory, ".vercel/output");
1096
+ }
1097
+ const prebuiltExists = await import_fs_extra2.default.pathExists(vercelOutputDir);
1098
+ if (!prebuiltExists) {
1099
+ error(
1100
+ `The ${param(
1101
+ "--prebuilt"
1102
+ )} option was used, but no prebuilt output found in ".vercel/output". Run ${getCommandName(
1103
+ "build"
1104
+ )} to generate a local build.`
1105
+ );
1106
+ return 1;
1107
+ }
1108
+ const prebuiltBuild = await getPrebuiltJson(vercelOutputDir);
1109
+ const prebuiltError = prebuiltBuild?.error || prebuiltBuild?.builds?.find((build) => "error" in build)?.error;
1110
+ if (prebuiltError) {
1111
+ output_manager_default.log(
1112
+ `Prebuilt deployment cannot be created because ${getCommandName(
1113
+ "build"
1114
+ )} failed with error:
1115
+ `
1116
+ );
1117
+ prettyError(prebuiltError);
1118
+ return 1;
1119
+ }
1120
+ const assumedTarget = target || "preview";
1121
+ if (prebuiltBuild?.target && prebuiltBuild.target !== assumedTarget) {
1122
+ let specifyTarget = "";
1123
+ if (prebuiltBuild.target === "production") {
1124
+ specifyTarget = ` --prod`;
1125
+ }
1126
+ prettyError({
1127
+ message: `The ${param(
1128
+ "--prebuilt"
1129
+ )} option was used with the target environment "${assumedTarget}", but the prebuilt output found in ".vercel/output" was built with target environment "${prebuiltBuild.target}". Please run ${getCommandName(`--prebuilt${specifyTarget}`)}.`,
1130
+ link: "https://vercel.link/prebuilt-environment-mismatch"
1131
+ });
1132
+ return 1;
1133
+ }
1134
+ }
1135
+ const contextName = org.slug;
1136
+ client.config.currentTeam = org.type === "team" ? org.id : void 0;
1137
+ if (rootDirectory && await validateRootDirectory(
1138
+ cwd,
1139
+ join2(cwd, rootDirectory),
1140
+ project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
1141
+ ) === false) {
1142
+ return 1;
1143
+ }
1144
+ if (rootDirectory) {
1145
+ const rootDirectoryPath = join2(cwd, rootDirectory);
1146
+ await compileVercelConfig(rootDirectoryPath);
1147
+ const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
1148
+ if (rootDirectoryConfig) {
1149
+ debug(`Read local config from root directory (${rootDirectory})`);
1150
+ localConfig = rootDirectoryConfig;
1151
+ } else if (localConfig) {
1152
+ output_manager_default.print(
1153
+ `${prependEmoji(
1154
+ `The ${highlight(
1155
+ localConfig[import_client3.fileNameSymbol]
1156
+ )} file should be inside of the provided root directory.`,
1157
+ emoji("warning")
1158
+ )}
1159
+ `
1160
+ );
1161
+ }
1162
+ }
1163
+ localConfig = localConfig || {};
1164
+ if (localConfig.name) {
1165
+ output_manager_default.print(
1166
+ `${prependEmoji(
1167
+ `The ${code("name")} property in ${highlight(
1168
+ localConfig[import_client3.fileNameSymbol]
1169
+ )} is deprecated (https://vercel.link/name-prop)`,
1170
+ emoji("warning")
1171
+ )}
1172
+ `
1173
+ );
1174
+ }
1175
+ const isObject = (item) => Object.prototype.toString.call(item) === "[object Object]";
1176
+ if (typeof localConfig.env !== "undefined" && !isObject(localConfig.env)) {
1177
+ error(
1178
+ `The ${code("env")} property in ${highlight(
1179
+ localConfig[import_client3.fileNameSymbol]
1180
+ )} needs to be an object`
1181
+ );
1182
+ return 1;
1183
+ }
1184
+ if (typeof localConfig.build !== "undefined") {
1185
+ if (!isObject(localConfig.build)) {
1186
+ error(
1187
+ `The ${code("build")} property in ${highlight(
1188
+ localConfig[import_client3.fileNameSymbol]
1189
+ )} needs to be an object`
1190
+ );
1191
+ return 1;
1192
+ }
1193
+ if (typeof localConfig.build.env !== "undefined" && !isObject(localConfig.build.env)) {
1194
+ error(
1195
+ `The ${code("build.env")} property in ${highlight(
1196
+ localConfig[import_client3.fileNameSymbol]
1197
+ )} needs to be an object`
1198
+ );
1199
+ return 1;
1200
+ }
1201
+ }
1202
+ const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
1203
+ const gitMetadata = await createGitMeta(cwd, project);
1204
+ const deploymentEnv = Object.assign(
1205
+ {},
1206
+ parseEnv(localConfig.env),
1207
+ parseEnv(parsedArguments.flags["--env"])
1208
+ );
1209
+ const deploymentBuildEnv = Object.assign(
1210
+ {},
1211
+ parseEnv(localConfig.build && localConfig.build.env),
1212
+ parseEnv(parsedArguments.flags["--build-env"])
1213
+ );
1214
+ try {
1215
+ await addProcessEnv(log, deploymentEnv);
1216
+ await addProcessEnv(log, deploymentBuildEnv);
1217
+ } catch (err) {
1218
+ error((0, import_error_utils.errorToString)(err));
1219
+ return 1;
1220
+ }
1221
+ const regionFlag = (parsedArguments.flags["--regions"] || "").split(",").map((s) => s.trim()).filter(Boolean);
1222
+ const regions = regionFlag.length > 0 ? regionFlag : localConfig.regions;
1223
+ const currentTeam = org.type === "team" ? org.id : void 0;
1224
+ const now = new Now({
1225
+ client,
1226
+ currentTeam
1227
+ });
1228
+ const deployStamp = stamp_default();
1229
+ let deployment = null;
1230
+ const noWait = !!parsedArguments.flags["--no-wait"];
1231
+ const withFullLogs = !!parsedArguments.flags["--logs"];
1232
+ const localConfigurationOverrides = pickOverrides(localConfig);
1233
+ const name = project.name;
1234
+ if (!name) {
1235
+ throw new Error(
1236
+ "`name` not found on project or provided by existing project"
1237
+ );
1238
+ }
1239
+ try {
1240
+ const autoAssignCustomDomains = parsedArguments.flags["--skip-domain"] ? false : void 0;
1241
+ const createArgs = {
1242
+ name,
1243
+ env: deploymentEnv,
1244
+ build: { env: deploymentBuildEnv },
1245
+ forceNew: parsedArguments.flags["--force"],
1246
+ withCache: parsedArguments.flags["--with-cache"],
1247
+ prebuilt: parsedArguments.flags["--prebuilt"],
1248
+ vercelOutputDir,
1249
+ rootDirectory,
1250
+ quiet,
1251
+ wantsPublic: Boolean(
1252
+ parsedArguments.flags["--public"] || localConfig.public
1253
+ ),
1254
+ nowConfig: {
1255
+ ...localConfig,
1256
+ images: void 0
1257
+ },
1258
+ regions,
1259
+ meta,
1260
+ gitMetadata,
1261
+ deployStamp,
1262
+ target,
1263
+ skipAutoDetectionConfirmation: autoConfirm,
1264
+ noWait,
1265
+ withFullLogs,
1266
+ autoAssignCustomDomains,
1267
+ agentName: client.agentName,
1268
+ jsonOutput: asJson
1269
+ };
1270
+ if (!localConfig.builds || localConfig.builds.length === 0) {
1271
+ createArgs.projectSettings = {
1272
+ sourceFilesOutsideRootDirectory,
1273
+ rootDirectory,
1274
+ ...localConfigurationOverrides
1275
+ };
1276
+ }
1277
+ const { packageJson } = await scanParentDirs(
1278
+ join2(cwd, project?.rootDirectory ?? ""),
1279
+ true,
1280
+ cwd
1281
+ );
1282
+ let nodeVersion;
1283
+ if (packageJson?.engines?.node) {
1284
+ try {
1285
+ const { range } = await getSupportedNodeVersion(
1286
+ packageJson.engines.node
1287
+ );
1288
+ nodeVersion = range;
1289
+ } catch (error2) {
1290
+ if (error2 instanceof Error) {
1291
+ output_manager_default.warn(error2.message);
1292
+ }
1293
+ }
1294
+ }
1295
+ if (!createArgs.projectSettings)
1296
+ createArgs.projectSettings = {};
1297
+ createArgs.projectSettings.nodeVersion = nodeVersion;
1298
+ deployment = await createDeploy(
1299
+ client,
1300
+ now,
1301
+ contextName,
1302
+ cwd,
1303
+ createArgs,
1304
+ org,
1305
+ !project,
1306
+ parsedArchive ? "tgz" : void 0
1307
+ );
1308
+ if (deployment && !(deployment instanceof Error)) {
1309
+ telemetryClient.trackDeploymentId(deployment.id);
1310
+ }
1311
+ if (deployment instanceof NotDomainOwner) {
1312
+ output_manager_default.error(deployment.message);
1313
+ return 1;
1314
+ }
1315
+ if (deployment instanceof Error) {
1316
+ output_manager_default.error(
1317
+ deployment.message || "An unexpected error occurred while deploying your project",
1318
+ void 0,
1319
+ "https://vercel.link/help",
1320
+ "Contact Support"
1321
+ );
1322
+ return 1;
1323
+ }
1324
+ if (deployment.readyState === "CANCELED") {
1325
+ if (asJson) {
1326
+ output_manager_default.stopSpinner();
1327
+ client.stdout.write(
1328
+ `${JSON.stringify(
1329
+ getDeploymentOutputJson(deployment, client.apiUrl, {
1330
+ name: "DEPLOYMENT_CANCELED",
1331
+ message: "The deployment has been canceled."
1332
+ }),
1333
+ null,
1334
+ 2
1335
+ )}
1336
+ `
1337
+ );
1338
+ } else {
1339
+ output_manager_default.print("The deployment has been canceled.\n");
1340
+ }
1341
+ return 1;
1342
+ }
1343
+ if (deployment.checksConclusion === "failed") {
1344
+ const { checks } = await getDeploymentChecks(client, deployment.id);
1345
+ const counters = /* @__PURE__ */ new Map();
1346
+ checks.forEach((c) => {
1347
+ counters.set(c.conclusion, (counters.get(c.conclusion) ?? 0) + 1);
1348
+ });
1349
+ const counterList = Array.from(counters).map(([name2, no]) => `${no} ${name2}`).join(", ");
1350
+ if (asJson) {
1351
+ output_manager_default.stopSpinner();
1352
+ client.stdout.write(
1353
+ `${JSON.stringify(
1354
+ getDeploymentOutputJson(deployment, client.apiUrl, {
1355
+ name: "CHECKS_FAILED",
1356
+ message: `Running Checks: ${counterList}`
1357
+ }),
1358
+ null,
1359
+ 2
1360
+ )}
1361
+ `
1362
+ );
1363
+ } else {
1364
+ output_manager_default.error(`Running Checks: ${counterList}`);
1365
+ }
1366
+ return 1;
1367
+ }
1368
+ if (!noWait) {
1369
+ await getDeployment(client, contextName, deployment.id);
1370
+ }
1371
+ if (deployment === null) {
1372
+ error("Uploading failed. Please try again.");
1373
+ return 1;
1374
+ }
1375
+ } catch (err) {
1376
+ if ((0, import_error_utils.isError)(err)) {
1377
+ debug(`Error: ${err}
1378
+ ${err.stack}`);
1379
+ }
1380
+ if (err instanceof UploadErrorMissingArchive) {
1381
+ output_manager_default.prettyError(err);
1382
+ return 1;
1383
+ }
1384
+ if (err instanceof NotDomainOwner) {
1385
+ output_manager_default.error(err.message);
1386
+ return 1;
1387
+ }
1388
+ if (err instanceof DomainNotFound && err.meta && err.meta.domain) {
1389
+ output_manager_default.debug(
1390
+ `The domain ${err.meta.domain} was not found, trying to purchase it`
1391
+ );
1392
+ const purchase = await purchaseDomainIfAvailable(
1393
+ client,
1394
+ err.meta.domain,
1395
+ contextName
1396
+ );
1397
+ if (purchase === true) {
1398
+ output_manager_default.success(`Successfully purchased the domain ${err.meta.domain}!`);
1399
+ return 0;
1400
+ }
1401
+ if (purchase === false || purchase instanceof UserAborted) {
1402
+ handleCreateDeployError(deployment, localConfig);
1403
+ return 1;
1404
+ }
1405
+ handleCreateDeployError(purchase, localConfig);
1406
+ return 1;
1407
+ }
1408
+ if (err instanceof DomainNotFound || err instanceof DomainNotVerified || err instanceof NotDomainOwner || err instanceof DomainPermissionDenied || err instanceof DomainVerificationFailed || err instanceof SchemaValidationFailed || err instanceof InvalidDomain || err instanceof DeploymentNotFound || err instanceof BuildsRateLimited || err instanceof DeploymentsRateLimited || err instanceof AliasDomainConfigured || err instanceof MissingBuildScript || err instanceof ConflictingFilePath || err instanceof ConflictingPathSegment || err instanceof ConflictingConfigFiles) {
1409
+ handleCreateDeployError(err, localConfig);
1410
+ return 1;
1411
+ }
1412
+ if (err instanceof BuildError) {
1413
+ if (now.url) {
1414
+ try {
1415
+ const failedDeployment = await getDeployment(
1416
+ client,
1417
+ contextName,
1418
+ now.url
1419
+ );
1420
+ if (asJson) {
1421
+ output_manager_default.stopSpinner();
1422
+ client.stdout.write(
1423
+ `${JSON.stringify(
1424
+ getDeploymentOutputJson(failedDeployment, client.apiUrl, {
1425
+ name: "BUILD_ERROR",
1426
+ message: err.message
1427
+ }),
1428
+ null,
1429
+ 2
1430
+ )}
1431
+ `
1432
+ );
1433
+ } else if (withFullLogs === false) {
1434
+ await displayBuildLogsUntilFinalError(
1435
+ client,
1436
+ failedDeployment,
1437
+ err.message
1438
+ );
1439
+ }
1440
+ } catch (_) {
1441
+ if (asJson) {
1442
+ output_manager_default.stopSpinner();
1443
+ client.stdout.write(
1444
+ `${JSON.stringify(
1445
+ {
1446
+ error: {
1447
+ name: "BUILD_ERROR",
1448
+ message: err.message
1449
+ },
1450
+ url: `https://${now.url}`
1451
+ },
1452
+ null,
1453
+ 2
1454
+ )}
1455
+ `
1456
+ );
1457
+ } else {
1458
+ output_manager_default.log(
1459
+ `To check build logs run: ${getCommandName(
1460
+ `inspect ${now.url} --logs`
1461
+ )}`
1462
+ );
1463
+ output_manager_default.log(
1464
+ `Or inspect them in your browser at https://${now.url}/_logs`
1465
+ );
1466
+ }
1467
+ }
1468
+ }
1469
+ return 1;
1470
+ }
1471
+ if (isAPIError(err) && err.code === "size_limit_exceeded") {
1472
+ const { sizeLimit = 0 } = err;
1473
+ const message = `File size limit exceeded (${(0, import_bytes.default)(sizeLimit)})`;
1474
+ error(message);
1475
+ return 1;
1476
+ }
1477
+ printError(err);
1478
+ return 1;
1479
+ }
1480
+ if (asJson) {
1481
+ output_manager_default.stopSpinner();
1482
+ client.stdout.write(
1483
+ `${JSON.stringify(getDeploymentOutputJson(deployment, client.apiUrl), null, 2)}
1484
+ `
1485
+ );
1486
+ return 0;
1487
+ }
1488
+ const { isAgent } = await determineAgent();
1489
+ const guidanceMode = parsedArguments.flags["--guidance"] ?? isAgent;
1490
+ return printDeploymentStatus(deployment, deployStamp, noWait, guidanceMode);
1491
+ }
1492
+ function handleCreateDeployError(error, localConfig) {
1493
+ if (error instanceof InvalidDomain) {
1494
+ output_manager_default.error(`The domain ${error.meta.domain} is not valid`);
1495
+ return 1;
1496
+ }
1497
+ if (error instanceof DomainVerificationFailed) {
1498
+ output_manager_default.error(
1499
+ `The domain used as a suffix ${import_chalk.default.underline(
1500
+ error.meta.domain
1501
+ )} is not verified and can't be used as custom suffix.`
1502
+ );
1503
+ return 1;
1504
+ }
1505
+ if (error instanceof DomainPermissionDenied) {
1506
+ output_manager_default.error(
1507
+ `You don't have permissions to access the domain used as a suffix ${import_chalk.default.underline(
1508
+ error.meta.domain
1509
+ )}.`
1510
+ );
1511
+ return 1;
1512
+ }
1513
+ if (error instanceof SchemaValidationFailed) {
1514
+ const niceError = getPrettyError(error.meta);
1515
+ const fileName = localConfig[import_client3.fileNameSymbol] || "vercel.json";
1516
+ niceError.message = `Invalid ${fileName} - ${niceError.message}`;
1517
+ output_manager_default.prettyError(niceError);
1518
+ return 1;
1519
+ }
1520
+ if (error instanceof TooManyRequests) {
1521
+ output_manager_default.error(
1522
+ `Too many requests detected for ${error.meta.api} API. Try again in ${(0, import_ms.default)(
1523
+ error.meta.retryAfterMs,
1524
+ {
1525
+ long: true
1526
+ }
1527
+ )}.`
1528
+ );
1529
+ return 1;
1530
+ }
1531
+ if (error instanceof DomainNotVerified) {
1532
+ output_manager_default.error(
1533
+ `The domain used as an alias ${import_chalk.default.underline(
1534
+ error.meta.domain
1535
+ )} is not verified yet. Please verify it.`
1536
+ );
1537
+ return 1;
1538
+ }
1539
+ if (error instanceof BuildsRateLimited) {
1540
+ output_manager_default.error(error.message);
1541
+ output_manager_default.note(
1542
+ `Run ${getCommandName("upgrade")} to increase your builds limit.`
1543
+ );
1544
+ return 1;
1545
+ }
1546
+ if (error instanceof DeploymentNotFound || error instanceof NotDomainOwner || error instanceof DeploymentsRateLimited || error instanceof AliasDomainConfigured || error instanceof MissingBuildScript || error instanceof ConflictingFilePath || error instanceof ConflictingPathSegment || error instanceof ConflictingConfigFiles) {
1547
+ output_manager_default.error(error.message);
1548
+ return 1;
1549
+ }
1550
+ return error;
1551
+ }
1552
+ var addProcessEnv = async (log, env) => {
1553
+ let val;
1554
+ for (const key of Object.keys(env)) {
1555
+ if (typeof env[key] !== "undefined") {
1556
+ continue;
1557
+ }
1558
+ val = process.env[key];
1559
+ if (typeof val === "string") {
1560
+ log(
1561
+ `Reading ${import_chalk.default.bold(
1562
+ `"${import_chalk.default.bold(key)}"`
1563
+ )} from your env (as no value was specified)`
1564
+ );
1565
+ env[key] = val.replace(/^@/, "\\@");
1566
+ } else {
1567
+ throw new Error(
1568
+ `No value specified for env variable ${import_chalk.default.bold(
1569
+ `"${import_chalk.default.bold(key)}"`
1570
+ )} and it was not found in your env. If you meant to specify an environment to deploy to, use ${param("--target")}`
1571
+ );
1572
+ }
1573
+ }
1574
+ };
1575
+ async function handleContinueDeployment({
1576
+ client,
1577
+ deploymentId,
1578
+ cwd,
1579
+ deployStamp,
1580
+ noWait,
1581
+ org,
1582
+ vercelOutputDir
1583
+ }) {
1584
+ const { debug, error } = output_manager_default;
1585
+ debug(`Continuing deployment: ${deploymentId}`);
1586
+ if (!vercelOutputDir) {
1587
+ error("Could not determine vercel output directory");
1588
+ return 1;
1589
+ }
1590
+ const token = client.authConfig.token;
1591
+ if (!token) {
1592
+ error("Missing authentication token");
1593
+ return 1;
1594
+ }
1595
+ output_manager_default.spinner(`Continuing deployment...`, 0);
1596
+ try {
1597
+ let finalDeployment = null;
1598
+ for await (const event of (0, import_client3.continueDeployment)({
1599
+ apiUrl: client.apiUrl,
1600
+ debug: output_manager_default.isDebugEnabled(),
1601
+ deploymentId,
1602
+ path: cwd,
1603
+ teamId: org.type === "team" ? org.id : void 0,
1604
+ token,
1605
+ vercelOutputDir
1606
+ })) {
1607
+ debug(`Event: ${event.type}`);
1608
+ if (event.type === "hashes-calculated") {
1609
+ const hashCount = Object.keys(event.payload).length;
1610
+ debug(`Calculated ${hashCount} hashes`);
1611
+ }
1612
+ if (event.type === "file-count") {
1613
+ const { total, missing } = event.payload;
1614
+ output_manager_default.spinner(
1615
+ `Uploading ${missing.length} of ${total.size} files...`,
1616
+ 0
1617
+ );
1618
+ }
1619
+ if (event.type === "file-uploaded") {
1620
+ debug(`Uploaded: ${event.payload.file.names.join(" ")}`);
1621
+ }
1622
+ if (event.type === "all-files-uploaded") {
1623
+ output_manager_default.spinner("Continuing deployment...", 0);
1624
+ }
1625
+ if (event.type === "created") {
1626
+ finalDeployment = event.payload;
1627
+ output_manager_default.stopSpinner();
1628
+ if (finalDeployment.inspectorUrl) {
1629
+ output_manager_default.print(
1630
+ prependEmoji(
1631
+ `Inspect: ${import_chalk.default.bold(finalDeployment.inspectorUrl)} ${deployStamp()}`,
1632
+ emoji("inspect")
1633
+ ) + "\n"
1634
+ );
1635
+ }
1636
+ const previewUrl = `https://${finalDeployment.url}`;
1637
+ output_manager_default.print(
1638
+ prependEmoji(
1639
+ `Preview: ${import_chalk.default.bold(previewUrl)} ${deployStamp()}`,
1640
+ emoji("success")
1641
+ ) + "\n"
1642
+ );
1643
+ if (noWait) {
1644
+ return printDeploymentStatus(
1645
+ finalDeployment,
1646
+ deployStamp,
1647
+ noWait,
1648
+ false
1649
+ );
1650
+ }
1651
+ output_manager_default.spinner("Building...", 0);
1652
+ }
1653
+ if (event.type === "building") {
1654
+ output_manager_default.spinner("Building...", 0);
1655
+ }
1656
+ if (event.type === "ready") {
1657
+ finalDeployment = event.payload;
1658
+ output_manager_default.stopSpinner();
1659
+ }
1660
+ if (event.type === "alias-assigned") {
1661
+ finalDeployment = event.payload;
1662
+ output_manager_default.stopSpinner();
1663
+ if (finalDeployment.target === "production" && finalDeployment.alias && finalDeployment.alias.length > 0) {
1664
+ const primaryDomain = finalDeployment.alias[0];
1665
+ const prodUrl = `https://${primaryDomain}`;
1666
+ output_manager_default.print(
1667
+ prependEmoji(
1668
+ `Production: ${import_chalk.default.bold(prodUrl)} ${deployStamp()}`,
1669
+ emoji("link")
1670
+ ) + "\n"
1671
+ );
1672
+ }
1673
+ }
1674
+ if (event.type === "error") {
1675
+ output_manager_default.stopSpinner();
1676
+ const payload = event.payload;
1677
+ error(payload.message || "An error occurred during deployment");
1678
+ return 1;
1679
+ }
1680
+ }
1681
+ if (!finalDeployment) {
1682
+ error("Deployment failed: no deployment returned");
1683
+ return 1;
1684
+ }
1685
+ return printDeploymentStatus(finalDeployment, deployStamp, noWait, false);
1686
+ } catch (err) {
1687
+ output_manager_default.stopSpinner();
1688
+ if ((0, import_error_utils.isError)(err)) {
1689
+ debug(`Error: ${err}
1690
+ ${err.stack}`);
1691
+ error(err.message);
1692
+ } else {
1693
+ error("An unexpected error occurred");
1694
+ }
1695
+ return 1;
1696
+ }
1697
+ }
1698
+ function getDeploymentOutputJson(deployment, apiUrl, error) {
1699
+ return {
1700
+ id: deployment.id,
1701
+ url: `https://${deployment.url}`,
1702
+ inspectorUrl: deployment.inspectorUrl ?? null,
1703
+ readyState: deployment.readyState,
1704
+ target: deployment.target ?? null,
1705
+ deploymentApiUrl: `${apiUrl}/v13/deployments/${deployment.id}`,
1706
+ ...error ? { error } : {}
1707
+ };
1708
+ }
1709
+ export {
1710
+ deploy_default as default
1711
+ };