vercel 59.11.2 → 59.11.7

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 (154) hide show
  1. package/dist/chunks/{add-BKSHWTPX.js → add-KSJQYR5C.js} +23 -18
  2. package/dist/chunks/{add-RBW7QITR.js → add-PERLOALD.js} +37 -23
  3. package/dist/chunks/{add-HPLJZFM2.js → add-WU2QYHYL.js} +23 -18
  4. package/dist/chunks/{build-V4ZLAJWB.js → build-F3J6FLPD.js} +23 -18
  5. package/dist/chunks/{chunk-NGGLYKNU.js → chunk-26CU4Q3C.js} +3 -115
  6. package/dist/chunks/{chunk-QFAS4OVW.js → chunk-2JIX6UMI.js} +3 -84
  7. package/dist/chunks/chunk-2TSBB22D.js +14059 -0
  8. package/dist/chunks/chunk-332LMJLZ.js +16014 -0
  9. package/dist/chunks/{chunk-AYLY3ZVL.js → chunk-3VM7HWF6.js} +2 -2
  10. package/dist/chunks/chunk-4IALDGB7.js +22 -0
  11. package/dist/chunks/chunk-4IVSM24H.js +522 -0
  12. package/dist/chunks/{chunk-5XECIWME.js → chunk-5NF5HOBJ.js} +5 -3
  13. package/dist/chunks/chunk-6E6KPBXY.js +43 -0
  14. package/dist/chunks/chunk-7KROIXQM.js +59 -0
  15. package/dist/chunks/{chunk-ASBP32T6.js → chunk-7MRDIPJY.js} +1 -1
  16. package/dist/chunks/chunk-A5JZS6ZN.js +92 -0
  17. package/dist/chunks/{chunk-7ST552E3.js → chunk-AKLTIZCU.js} +1 -1
  18. package/dist/chunks/{chunk-26XDDLXM.js → chunk-ARU7VBKR.js} +2 -2
  19. package/dist/chunks/chunk-B5XLQKHI.js +849 -0
  20. package/dist/chunks/chunk-C762AAVU.js +137 -0
  21. package/dist/chunks/{chunk-WA2SJE5S.js → chunk-CEDN47PH.js} +4 -4
  22. package/dist/chunks/{chunk-ONRLTUP2.js → chunk-CNDPIHY5.js} +24 -22
  23. package/dist/chunks/{chunk-BMKU5KEL.js → chunk-CV5YC2EN.js} +1 -1
  24. package/dist/chunks/chunk-DBYHS3CK.js +257 -0
  25. package/dist/chunks/{chunk-HDBQPBL6.js → chunk-DSTNNQVV.js} +12 -8
  26. package/dist/chunks/{chunk-QAT3CW4G.js → chunk-EFYMIIER.js} +2 -2
  27. package/dist/chunks/{chunk-NBW3BWOJ.js → chunk-EPOLDWRA.js} +2 -2
  28. package/dist/chunks/{chunk-B4TXCKXE.js → chunk-EZQDYIVB.js} +10 -8
  29. package/dist/chunks/{chunk-2EAIC3SH.js → chunk-FL4JLNT2.js} +8 -8
  30. package/dist/chunks/chunk-FRVG4OW3.js +7438 -0
  31. package/dist/chunks/{chunk-FKDO3CM4.js → chunk-FVNJTRCE.js} +17 -13
  32. package/dist/chunks/chunk-FVT74RZ5.js +1536 -0
  33. package/dist/chunks/chunk-G3PXSXIB.js +18188 -0
  34. package/dist/chunks/chunk-G5FBSUL4.js +822 -0
  35. package/dist/chunks/{chunk-FRAXI2WT.js → chunk-GCVXKRR5.js} +3 -3
  36. package/dist/chunks/chunk-GHKJAK5V.js +1288 -0
  37. package/dist/chunks/{chunk-Q5K5DEOK.js → chunk-GUU4Z2AQ.js} +42 -28
  38. package/dist/chunks/{chunk-OQ3C5VXZ.js → chunk-GVNCVKCI.js} +4 -2
  39. package/dist/chunks/chunk-HB4UKFDO.js +1295 -0
  40. package/dist/chunks/chunk-HRXRELD3.js +338 -0
  41. package/dist/chunks/{chunk-IJ4X426J.js → chunk-IIMSID24.js} +1 -1
  42. package/dist/chunks/{chunk-O75LSD3C.js → chunk-JSD4EZL3.js} +1 -1
  43. package/dist/chunks/{chunk-7AEEQOD4.js → chunk-K3RED3VO.js} +1 -1
  44. package/dist/chunks/{chunk-RSEAADCE.js → chunk-KEKR7OCB.js} +6 -4
  45. package/dist/chunks/{chunk-3T7WSWZH.js → chunk-KFWQ3EFH.js} +1 -1
  46. package/dist/chunks/{chunk-L3UXB2CW.js → chunk-KW7BS25T.js} +1 -1
  47. package/dist/chunks/{chunk-RO44KX6Y.js → chunk-N4QHMXOO.js} +11 -7
  48. package/dist/chunks/{chunk-XRWOTCDO.js → chunk-ND5CF2H3.js} +1 -1
  49. package/dist/chunks/{chunk-RSJBU3ON.js → chunk-NSOYO6JQ.js} +35 -27
  50. package/dist/chunks/{chunk-RKDCNQ4S.js → chunk-NW34PW6V.js} +3 -105
  51. package/dist/chunks/{chunk-C5HKWXRR.js → chunk-OAMU5QO6.js} +1 -1
  52. package/dist/chunks/{chunk-MTWHQEXI.js → chunk-OIH6FP5Y.js} +5 -3
  53. package/dist/chunks/chunk-P7VSBDR4.js +827 -0
  54. package/dist/chunks/chunk-PEC3CQSK.js +90 -0
  55. package/dist/chunks/{chunk-QDV5LZ4Q.js → chunk-PFM75KY3.js} +12 -8
  56. package/dist/chunks/chunk-PJXMXMCO.js +81 -0
  57. package/dist/chunks/chunk-PNGVSHR3.js +40 -0
  58. package/dist/chunks/{chunk-TPATD2MM.js → chunk-QHS645AZ.js} +14 -6
  59. package/dist/chunks/{chunk-OTXE7MHI.js → chunk-QKX7WKIN.js} +8 -6
  60. package/dist/chunks/chunk-QOPTXV4G.js +417 -0
  61. package/dist/chunks/chunk-RN6V5ODW.js +114 -0
  62. package/dist/chunks/chunk-RVBZ64EQ.js +52 -0
  63. package/dist/chunks/chunk-SHFNEZVI.js +49 -0
  64. package/dist/chunks/{chunk-OO3OF6MK.js → chunk-TGNEG57M.js} +44 -15
  65. package/dist/chunks/{chunk-WNAKOXGK.js → chunk-TO7QZGYK.js} +1 -1
  66. package/dist/chunks/chunk-UARGTFCT.js +875 -0
  67. package/dist/chunks/{chunk-FWKSJYDV.js → chunk-UG2WOB5L.js} +1 -1
  68. package/dist/chunks/chunk-V4RMJKQP.js +36 -0
  69. package/dist/chunks/chunk-VT3Z7HF6.js +233 -0
  70. package/dist/chunks/chunk-VUS2JQB2.js +121 -0
  71. package/dist/chunks/{chunk-6CZZ3SH3.js → chunk-VYC45Q4Z.js} +2 -2
  72. package/dist/chunks/{chunk-4KVJ2M4J.js → chunk-WL6QYSGD.js} +78 -17
  73. package/dist/chunks/{chunk-FZRBF25Y.js → chunk-X7DBBZQD.js} +4 -4
  74. package/dist/chunks/{chunk-2NJJ2K5S.js → chunk-XD4DCYMX.js} +6 -6
  75. package/dist/chunks/{chunk-ZSFEACZU.js → chunk-XFF5TGRA.js} +1 -1
  76. package/dist/chunks/{chunk-6TBDHUXK.js → chunk-XIFATBH5.js} +21 -15
  77. package/dist/chunks/chunk-XNIZGCN5.js +58 -0
  78. package/dist/chunks/chunk-XPJLPUKO.js +117 -0
  79. package/dist/chunks/{chunk-FXD67VN5.js → chunk-XUAWTW4W.js} +1 -1
  80. package/dist/chunks/{chunk-I526H4AS.js → chunk-YS76T533.js} +2 -2
  81. package/dist/chunks/chunk-Z7JWYFOY.js +58 -0
  82. package/dist/chunks/{chunk-6JPVTPTU.js → chunk-ZBEECGFD.js} +3 -3
  83. package/dist/chunks/{chunk-52QYYTM5.js → chunk-ZDU2NODC.js} +3 -127
  84. package/dist/chunks/chunk-ZW6HETRE.js +97 -0
  85. package/dist/chunks/{clear-IYGWCNXT.js → clear-XUQO4ZTK.js} +23 -18
  86. package/dist/chunks/{compile-vercel-config-NEEBZRUJ.js → compile-vercel-config-D3ARNHTN.js} +8 -11
  87. package/dist/chunks/{config-6DS6BBR2.js → config-37OAE7QJ.js} +22 -17
  88. package/dist/chunks/{config-NTB5EMV4.js → config-MEDLXUVM.js} +23 -18
  89. package/dist/chunks/{delete-LLC2OGHA.js → delete-3N3YZZOF.js} +16 -12
  90. package/dist/chunks/{delete-LSGID5FV.js → delete-VSWDZ2SW.js} +19 -14
  91. package/dist/chunks/detect-projects-ODNU4PK2.js +18 -0
  92. package/dist/chunks/detect-services-TESZCQWG.js +40 -0
  93. package/dist/chunks/{disable-H4EXEQK7.js → disable-A4FLFMC7.js} +17 -13
  94. package/dist/chunks/{discard-FG6VKHWN.js → discard-CHGFULBZ.js} +17 -13
  95. package/dist/chunks/{edit-YE7D3CPJ.js → edit-JZ63AJYQ.js} +17 -13
  96. package/dist/chunks/{edit-BZJSGUHT.js → edit-MHSYAPDR.js} +19 -15
  97. package/dist/chunks/{enable-6ESD4QTE.js → enable-KD46SEC5.js} +17 -13
  98. package/dist/chunks/{exec-XH4K34JM.js → exec-4IPHZ55G.js} +9 -5
  99. package/dist/chunks/{export-QWSJROLG.js → export-42QZLBSN.js} +16 -13
  100. package/dist/chunks/{image-LTHQMKFG.js → image-GP4H73A2.js} +11 -8
  101. package/dist/chunks/{import-builders-6O7ILGQJ.js → import-builders-6TBLMPL2.js} +18 -13
  102. package/dist/chunks/{inspect-2C4ZSNYC.js → inspect-5FMWMY3C.js} +22 -18
  103. package/dist/chunks/{inspect-N6SMHV3Z.js → inspect-MUVK6MMT.js} +18 -14
  104. package/dist/chunks/{inspect-F7KCTHIL.js → inspect-Q3DWW7MC.js} +22 -18
  105. package/dist/chunks/{inspect-TWDPMXZ5.js → inspect-QFXAOUL4.js} +18 -14
  106. package/dist/chunks/{inspect-ICKNCDMT.js → inspect-RNTSYM6O.js} +18 -14
  107. package/dist/chunks/{list-NWTIJF3L.js → list-IHHIPXEC.js} +20 -16
  108. package/dist/chunks/{list-IPGQVBJO.js → list-JRNWLSO5.js} +16 -14
  109. package/dist/chunks/{list-DS7ZOUXA.js → list-XHD5DLEX.js} +23 -19
  110. package/dist/chunks/{login-F7A7ONKC.js → login-PCT6KFWY.js} +23 -18
  111. package/dist/chunks/{ls-NBDX3MKN.js → ls-GPEHEFCF.js} +24 -18
  112. package/dist/chunks/{ls-RNGO257R.js → ls-PF7F4PP4.js} +27 -23
  113. package/dist/chunks/{ls-XINES6PL.js → ls-PQZ2RIDX.js} +24 -18
  114. package/dist/chunks/{ls-D4TUDBIH.js → ls-SVOHC3XW.js} +24 -18
  115. package/dist/chunks/{ls-2QW3ZSM6.js → ls-TGHCCARZ.js} +24 -18
  116. package/dist/chunks/{ls-LSJEUPFX.js → ls-VRIH5WA3.js} +22 -15
  117. package/dist/chunks/{open-VRQDWZAW.js → open-E7DEKYDU.js} +18 -13
  118. package/dist/chunks/{permissions-6C5C7TEV.js → permissions-JKOONWVL.js} +14 -11
  119. package/dist/chunks/{publish-GVIZPNLN.js → publish-EDDELDE5.js} +17 -13
  120. package/dist/chunks/pull-646WEVDE.js +45 -0
  121. package/dist/chunks/{push-EFZ5P5Z6.js → push-LTNW5OVD.js} +23 -18
  122. package/dist/chunks/{query-GBS2PIT4.js → query-LU4N6KPO.js} +22 -19
  123. package/dist/chunks/{reorder-TN65IFRL.js → reorder-22PKJMZP.js} +17 -13
  124. package/dist/chunks/{reply-DYVEV3PY.js → reply-SF2EZMVZ.js} +17 -13
  125. package/dist/chunks/{resolve-JAWFBPUM.js → resolve-ZCZGXTOT.js} +16 -12
  126. package/dist/chunks/resolve-deployment-framework-preset-NPE6RLV3.js +36 -0
  127. package/dist/chunks/{restore-TJVMHUBQ.js → restore-VJAWZXB4.js} +17 -13
  128. package/dist/chunks/{rm-7XACNZ2U.js → rm-KN2QFCKO.js} +23 -18
  129. package/dist/chunks/{rm-REJVXALW.js → rm-KVEAJPRE.js} +23 -18
  130. package/dist/chunks/{rm-CBPNMSRP.js → rm-OSZ5FZUM.js} +23 -16
  131. package/dist/chunks/{rm-5B5VHWWN.js → rm-W722Q2AO.js} +21 -18
  132. package/dist/chunks/{rm-HQ5CYNJA.js → rm-WNPGTUBH.js} +23 -18
  133. package/dist/chunks/{routes-2OLIBRYX.js → routes-QVMBXOSX.js} +7 -3
  134. package/dist/chunks/{rule-inspect-ZSTDDFID.js → rule-inspect-25Z6SNX3.js} +28 -24
  135. package/dist/chunks/{rules-VGV4M4KY.js → rules-65LKAQ35.js} +15 -12
  136. package/dist/chunks/{schema-45SJNY5L.js → schema-7D6IGJEJ.js} +9 -7
  137. package/dist/chunks/{schema-GMTQOQCV.js → schema-NXCW4M75.js} +19 -17
  138. package/dist/chunks/{set-Z5FO2FCC.js → set-FYJVKMPV.js} +20 -13
  139. package/dist/chunks/setup-and-link-KXPZE32P.js +65 -0
  140. package/dist/chunks/{tags-SDRXWJ63.js → tags-ANIRP5E3.js} +10 -7
  141. package/dist/chunks/{types-JGANJ5EQ.js → types-4GAJ7XQQ.js} +9 -7
  142. package/dist/chunks/{update-JBQBC3IV.js → update-UT6CTKVG.js} +32 -19
  143. package/dist/commands/build/index.js +86 -49
  144. package/dist/commands/deploy/index.js +75 -66
  145. package/dist/commands/dev/index.js +98 -52
  146. package/dist/commands/env/index.js +67 -43
  147. package/dist/commands/link/index.js +48 -27
  148. package/dist/commands/list/index.js +33 -22
  149. package/dist/commands-bulk.js +1659 -1287
  150. package/dist/index.js +62 -40
  151. package/dist/version.mjs +1 -1
  152. package/package.json +46 -46
  153. package/dist/chunks/chunk-WYU64FLP.js +0 -62123
  154. package/dist/chunks/chunk-XNFHNTS2.js +0 -2939
@@ -0,0 +1,1295 @@
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
+ require_load_json_file,
9
+ require_pify
10
+ } from "./chunk-B5XLQKHI.js";
11
+ import {
12
+ isNativeBinaryInstall
13
+ } from "./chunk-4IALDGB7.js";
14
+ import {
15
+ require_graceful_fs
16
+ } from "./chunk-G5FBSUL4.js";
17
+ import {
18
+ output_manager_default,
19
+ require_signal_exit
20
+ } from "./chunk-2JIX6UMI.js";
21
+ import {
22
+ __commonJS,
23
+ __require,
24
+ __toESM
25
+ } from "./chunk-TZ2YI2VH.js";
26
+
27
+ // ../../internals/constants/dist/index.js
28
+ var require_dist = __commonJS({
29
+ "../../internals/constants/dist/index.js"(exports) {
30
+ "use strict";
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.TITLE = exports.NAME = exports.LOGO = exports.PROJECT_ENV_TARGET = void 0;
33
+ exports.PROJECT_ENV_TARGET = [
34
+ "production",
35
+ "preview",
36
+ "development"
37
+ ];
38
+ exports.LOGO = "\u25B2";
39
+ exports.NAME = "vercel";
40
+ exports.TITLE = "Vercel";
41
+ }
42
+ });
43
+
44
+ // ../../node_modules/.pnpm/imurmurhash@0.1.4/node_modules/imurmurhash/imurmurhash.js
45
+ var require_imurmurhash = __commonJS({
46
+ "../../node_modules/.pnpm/imurmurhash@0.1.4/node_modules/imurmurhash/imurmurhash.js"(exports, module) {
47
+ (function() {
48
+ var cache;
49
+ function MurmurHash3(key, seed) {
50
+ var m = this instanceof MurmurHash3 ? this : cache;
51
+ m.reset(seed);
52
+ if (typeof key === "string" && key.length > 0) {
53
+ m.hash(key);
54
+ }
55
+ if (m !== this) {
56
+ return m;
57
+ }
58
+ }
59
+ ;
60
+ MurmurHash3.prototype.hash = function(key) {
61
+ var h1, k1, i, top, len;
62
+ len = key.length;
63
+ this.len += len;
64
+ k1 = this.k1;
65
+ i = 0;
66
+ switch (this.rem) {
67
+ case 0:
68
+ k1 ^= len > i ? key.charCodeAt(i++) & 65535 : 0;
69
+ case 1:
70
+ k1 ^= len > i ? (key.charCodeAt(i++) & 65535) << 8 : 0;
71
+ case 2:
72
+ k1 ^= len > i ? (key.charCodeAt(i++) & 65535) << 16 : 0;
73
+ case 3:
74
+ k1 ^= len > i ? (key.charCodeAt(i) & 255) << 24 : 0;
75
+ k1 ^= len > i ? (key.charCodeAt(i++) & 65280) >> 8 : 0;
76
+ }
77
+ this.rem = len + this.rem & 3;
78
+ len -= this.rem;
79
+ if (len > 0) {
80
+ h1 = this.h1;
81
+ while (1) {
82
+ k1 = k1 * 11601 + (k1 & 65535) * 3432906752 & 4294967295;
83
+ k1 = k1 << 15 | k1 >>> 17;
84
+ k1 = k1 * 13715 + (k1 & 65535) * 461832192 & 4294967295;
85
+ h1 ^= k1;
86
+ h1 = h1 << 13 | h1 >>> 19;
87
+ h1 = h1 * 5 + 3864292196 & 4294967295;
88
+ if (i >= len) {
89
+ break;
90
+ }
91
+ k1 = key.charCodeAt(i++) & 65535 ^ (key.charCodeAt(i++) & 65535) << 8 ^ (key.charCodeAt(i++) & 65535) << 16;
92
+ top = key.charCodeAt(i++);
93
+ k1 ^= (top & 255) << 24 ^ (top & 65280) >> 8;
94
+ }
95
+ k1 = 0;
96
+ switch (this.rem) {
97
+ case 3:
98
+ k1 ^= (key.charCodeAt(i + 2) & 65535) << 16;
99
+ case 2:
100
+ k1 ^= (key.charCodeAt(i + 1) & 65535) << 8;
101
+ case 1:
102
+ k1 ^= key.charCodeAt(i) & 65535;
103
+ }
104
+ this.h1 = h1;
105
+ }
106
+ this.k1 = k1;
107
+ return this;
108
+ };
109
+ MurmurHash3.prototype.result = function() {
110
+ var k1, h1;
111
+ k1 = this.k1;
112
+ h1 = this.h1;
113
+ if (k1 > 0) {
114
+ k1 = k1 * 11601 + (k1 & 65535) * 3432906752 & 4294967295;
115
+ k1 = k1 << 15 | k1 >>> 17;
116
+ k1 = k1 * 13715 + (k1 & 65535) * 461832192 & 4294967295;
117
+ h1 ^= k1;
118
+ }
119
+ h1 ^= this.len;
120
+ h1 ^= h1 >>> 16;
121
+ h1 = h1 * 51819 + (h1 & 65535) * 2246770688 & 4294967295;
122
+ h1 ^= h1 >>> 13;
123
+ h1 = h1 * 44597 + (h1 & 65535) * 3266445312 & 4294967295;
124
+ h1 ^= h1 >>> 16;
125
+ return h1 >>> 0;
126
+ };
127
+ MurmurHash3.prototype.reset = function(seed) {
128
+ this.h1 = typeof seed === "number" ? seed : 0;
129
+ this.rem = this.k1 = this.len = 0;
130
+ return this;
131
+ };
132
+ cache = new MurmurHash3();
133
+ if (typeof module != "undefined") {
134
+ module.exports = MurmurHash3;
135
+ } else {
136
+ this.MurmurHash3 = MurmurHash3;
137
+ }
138
+ })();
139
+ }
140
+ });
141
+
142
+ // ../../node_modules/.pnpm/write-file-atomic@2.4.3/node_modules/write-file-atomic/index.js
143
+ var require_write_file_atomic = __commonJS({
144
+ "../../node_modules/.pnpm/write-file-atomic@2.4.3/node_modules/write-file-atomic/index.js"(exports, module) {
145
+ "use strict";
146
+ module.exports = writeFile;
147
+ module.exports.sync = writeFileSync;
148
+ module.exports._getTmpname = getTmpname;
149
+ module.exports._cleanupOnExit = cleanupOnExit;
150
+ var fs = require_graceful_fs();
151
+ var MurmurHash3 = require_imurmurhash();
152
+ var onExit = require_signal_exit();
153
+ var path = __require("path");
154
+ var activeFiles = {};
155
+ var threadId = function getId() {
156
+ try {
157
+ var workerThreads = __require("worker_threads");
158
+ return workerThreads.threadId;
159
+ } catch (e) {
160
+ return 0;
161
+ }
162
+ }();
163
+ var invocations = 0;
164
+ function getTmpname(filename) {
165
+ return filename + "." + MurmurHash3(__filename).hash(String(process.pid)).hash(String(threadId)).hash(String(++invocations)).result();
166
+ }
167
+ function cleanupOnExit(tmpfile) {
168
+ return function() {
169
+ try {
170
+ fs.unlinkSync(typeof tmpfile === "function" ? tmpfile() : tmpfile);
171
+ } catch (_) {
172
+ }
173
+ };
174
+ }
175
+ function writeFile(filename, data, options, callback) {
176
+ if (options) {
177
+ if (options instanceof Function) {
178
+ callback = options;
179
+ options = {};
180
+ } else if (typeof options === "string") {
181
+ options = { encoding: options };
182
+ }
183
+ } else {
184
+ options = {};
185
+ }
186
+ var Promise2 = options.Promise || global.Promise;
187
+ var truename;
188
+ var fd;
189
+ var tmpfile;
190
+ var removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile));
191
+ var absoluteName = path.resolve(filename);
192
+ new Promise2(function serializeSameFile(resolve) {
193
+ if (!activeFiles[absoluteName])
194
+ activeFiles[absoluteName] = [];
195
+ activeFiles[absoluteName].push(resolve);
196
+ if (activeFiles[absoluteName].length === 1)
197
+ resolve();
198
+ }).then(function getRealPath() {
199
+ return new Promise2(function(resolve) {
200
+ fs.realpath(filename, function(_, realname) {
201
+ truename = realname || filename;
202
+ tmpfile = getTmpname(truename);
203
+ resolve();
204
+ });
205
+ });
206
+ }).then(function stat() {
207
+ return new Promise2(function stat2(resolve) {
208
+ if (options.mode && options.chown)
209
+ resolve();
210
+ else {
211
+ fs.stat(truename, function(err, stats) {
212
+ if (err || !stats)
213
+ resolve();
214
+ else {
215
+ options = Object.assign({}, options);
216
+ if (options.mode == null) {
217
+ options.mode = stats.mode;
218
+ }
219
+ if (options.chown == null && process.getuid) {
220
+ options.chown = { uid: stats.uid, gid: stats.gid };
221
+ }
222
+ resolve();
223
+ }
224
+ });
225
+ }
226
+ });
227
+ }).then(function thenWriteFile() {
228
+ return new Promise2(function(resolve, reject) {
229
+ fs.open(tmpfile, "w", options.mode, function(err, _fd) {
230
+ fd = _fd;
231
+ if (err)
232
+ reject(err);
233
+ else
234
+ resolve();
235
+ });
236
+ });
237
+ }).then(function write() {
238
+ return new Promise2(function(resolve, reject) {
239
+ if (Buffer.isBuffer(data)) {
240
+ fs.write(fd, data, 0, data.length, 0, function(err) {
241
+ if (err)
242
+ reject(err);
243
+ else
244
+ resolve();
245
+ });
246
+ } else if (data != null) {
247
+ fs.write(fd, String(data), 0, String(options.encoding || "utf8"), function(err) {
248
+ if (err)
249
+ reject(err);
250
+ else
251
+ resolve();
252
+ });
253
+ } else
254
+ resolve();
255
+ });
256
+ }).then(function syncAndClose() {
257
+ return new Promise2(function(resolve, reject) {
258
+ if (options.fsync !== false) {
259
+ fs.fsync(fd, function(err) {
260
+ if (err)
261
+ fs.close(fd, () => reject(err));
262
+ else
263
+ fs.close(fd, resolve);
264
+ });
265
+ } else {
266
+ fs.close(fd, resolve);
267
+ }
268
+ });
269
+ }).then(function chown() {
270
+ fd = null;
271
+ if (options.chown) {
272
+ return new Promise2(function(resolve, reject) {
273
+ fs.chown(tmpfile, options.chown.uid, options.chown.gid, function(err) {
274
+ if (err)
275
+ reject(err);
276
+ else
277
+ resolve();
278
+ });
279
+ });
280
+ }
281
+ }).then(function chmod() {
282
+ if (options.mode) {
283
+ return new Promise2(function(resolve, reject) {
284
+ fs.chmod(tmpfile, options.mode, function(err) {
285
+ if (err)
286
+ reject(err);
287
+ else
288
+ resolve();
289
+ });
290
+ });
291
+ }
292
+ }).then(function rename() {
293
+ return new Promise2(function(resolve, reject) {
294
+ fs.rename(tmpfile, truename, function(err) {
295
+ if (err)
296
+ reject(err);
297
+ else
298
+ resolve();
299
+ });
300
+ });
301
+ }).then(function success() {
302
+ removeOnExitHandler();
303
+ callback();
304
+ }, function fail(err) {
305
+ return new Promise2((resolve) => {
306
+ return fd ? fs.close(fd, resolve) : resolve();
307
+ }).then(() => {
308
+ removeOnExitHandler();
309
+ fs.unlink(tmpfile, function() {
310
+ callback(err);
311
+ });
312
+ });
313
+ }).then(function checkQueue() {
314
+ activeFiles[absoluteName].shift();
315
+ if (activeFiles[absoluteName].length > 0) {
316
+ activeFiles[absoluteName][0]();
317
+ } else
318
+ delete activeFiles[absoluteName];
319
+ });
320
+ }
321
+ function writeFileSync(filename, data, options) {
322
+ if (typeof options === "string")
323
+ options = { encoding: options };
324
+ else if (!options)
325
+ options = {};
326
+ try {
327
+ filename = fs.realpathSync(filename);
328
+ } catch (ex) {
329
+ }
330
+ var tmpfile = getTmpname(filename);
331
+ if (!options.mode || !options.chown) {
332
+ try {
333
+ var stats = fs.statSync(filename);
334
+ options = Object.assign({}, options);
335
+ if (!options.mode) {
336
+ options.mode = stats.mode;
337
+ }
338
+ if (!options.chown && process.getuid) {
339
+ options.chown = { uid: stats.uid, gid: stats.gid };
340
+ }
341
+ } catch (ex) {
342
+ }
343
+ }
344
+ var fd;
345
+ var cleanup = cleanupOnExit(tmpfile);
346
+ var removeOnExitHandler = onExit(cleanup);
347
+ try {
348
+ fd = fs.openSync(tmpfile, "w", options.mode);
349
+ if (Buffer.isBuffer(data)) {
350
+ fs.writeSync(fd, data, 0, data.length, 0);
351
+ } else if (data != null) {
352
+ fs.writeSync(fd, String(data), 0, String(options.encoding || "utf8"));
353
+ }
354
+ if (options.fsync !== false) {
355
+ fs.fsyncSync(fd);
356
+ }
357
+ fs.closeSync(fd);
358
+ if (options.chown)
359
+ fs.chownSync(tmpfile, options.chown.uid, options.chown.gid);
360
+ if (options.mode)
361
+ fs.chmodSync(tmpfile, options.mode);
362
+ fs.renameSync(tmpfile, filename);
363
+ removeOnExitHandler();
364
+ } catch (err) {
365
+ if (fd) {
366
+ try {
367
+ fs.closeSync(fd);
368
+ } catch (ex) {
369
+ }
370
+ }
371
+ removeOnExitHandler();
372
+ cleanup();
373
+ throw err;
374
+ }
375
+ }
376
+ }
377
+ });
378
+
379
+ // ../../node_modules/.pnpm/is-plain-obj@1.1.0/node_modules/is-plain-obj/index.js
380
+ var require_is_plain_obj = __commonJS({
381
+ "../../node_modules/.pnpm/is-plain-obj@1.1.0/node_modules/is-plain-obj/index.js"(exports, module) {
382
+ "use strict";
383
+ var toString = Object.prototype.toString;
384
+ module.exports = function(x) {
385
+ var prototype;
386
+ return toString.call(x) === "[object Object]" && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({}));
387
+ };
388
+ }
389
+ });
390
+
391
+ // ../../node_modules/.pnpm/sort-keys@1.1.2/node_modules/sort-keys/index.js
392
+ var require_sort_keys = __commonJS({
393
+ "../../node_modules/.pnpm/sort-keys@1.1.2/node_modules/sort-keys/index.js"(exports, module) {
394
+ "use strict";
395
+ var isPlainObj = require_is_plain_obj();
396
+ module.exports = function(obj, opts) {
397
+ if (!isPlainObj(obj)) {
398
+ throw new TypeError("Expected a plain object");
399
+ }
400
+ opts = opts || {};
401
+ if (typeof opts === "function") {
402
+ opts = { compare: opts };
403
+ }
404
+ var deep = opts.deep;
405
+ var seenInput = [];
406
+ var seenOutput = [];
407
+ var sortKeys = function(x) {
408
+ var seenIndex = seenInput.indexOf(x);
409
+ if (seenIndex !== -1) {
410
+ return seenOutput[seenIndex];
411
+ }
412
+ var ret = {};
413
+ var keys = Object.keys(x).sort(opts.compare);
414
+ seenInput.push(x);
415
+ seenOutput.push(ret);
416
+ for (var i = 0; i < keys.length; i++) {
417
+ var key = keys[i];
418
+ var val = x[key];
419
+ ret[key] = deep && isPlainObj(val) ? sortKeys(val) : val;
420
+ }
421
+ return ret;
422
+ };
423
+ return sortKeys(obj);
424
+ };
425
+ }
426
+ });
427
+
428
+ // ../../node_modules/.pnpm/pify@3.0.0/node_modules/pify/index.js
429
+ var require_pify2 = __commonJS({
430
+ "../../node_modules/.pnpm/pify@3.0.0/node_modules/pify/index.js"(exports, module) {
431
+ "use strict";
432
+ var processFn = (fn, opts) => function() {
433
+ const P = opts.promiseModule;
434
+ const args = new Array(arguments.length);
435
+ for (let i = 0; i < arguments.length; i++) {
436
+ args[i] = arguments[i];
437
+ }
438
+ return new P((resolve, reject) => {
439
+ if (opts.errorFirst) {
440
+ args.push(function(err, result) {
441
+ if (opts.multiArgs) {
442
+ const results = new Array(arguments.length - 1);
443
+ for (let i = 1; i < arguments.length; i++) {
444
+ results[i - 1] = arguments[i];
445
+ }
446
+ if (err) {
447
+ results.unshift(err);
448
+ reject(results);
449
+ } else {
450
+ resolve(results);
451
+ }
452
+ } else if (err) {
453
+ reject(err);
454
+ } else {
455
+ resolve(result);
456
+ }
457
+ });
458
+ } else {
459
+ args.push(function(result) {
460
+ if (opts.multiArgs) {
461
+ const results = new Array(arguments.length - 1);
462
+ for (let i = 0; i < arguments.length; i++) {
463
+ results[i] = arguments[i];
464
+ }
465
+ resolve(results);
466
+ } else {
467
+ resolve(result);
468
+ }
469
+ });
470
+ }
471
+ fn.apply(this, args);
472
+ });
473
+ };
474
+ module.exports = (obj, opts) => {
475
+ opts = Object.assign({
476
+ exclude: [/.+(Sync|Stream)$/],
477
+ errorFirst: true,
478
+ promiseModule: Promise
479
+ }, opts);
480
+ const filter = (key) => {
481
+ const match = (pattern) => typeof pattern === "string" ? key === pattern : pattern.test(key);
482
+ return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
483
+ };
484
+ let ret;
485
+ if (typeof obj === "function") {
486
+ ret = function() {
487
+ if (opts.excludeMain) {
488
+ return obj.apply(this, arguments);
489
+ }
490
+ return processFn(obj, opts).apply(this, arguments);
491
+ };
492
+ } else {
493
+ ret = Object.create(Object.getPrototypeOf(obj));
494
+ }
495
+ for (const key in obj) {
496
+ const x = obj[key];
497
+ ret[key] = typeof x === "function" && filter(key) ? processFn(x, opts) : x;
498
+ }
499
+ return ret;
500
+ };
501
+ }
502
+ });
503
+
504
+ // ../../node_modules/.pnpm/make-dir@1.3.0/node_modules/make-dir/index.js
505
+ var require_make_dir = __commonJS({
506
+ "../../node_modules/.pnpm/make-dir@1.3.0/node_modules/make-dir/index.js"(exports, module) {
507
+ "use strict";
508
+ var fs = __require("fs");
509
+ var path = __require("path");
510
+ var pify = require_pify2();
511
+ var defaults = {
512
+ mode: 511 & ~process.umask(),
513
+ fs
514
+ };
515
+ var checkPath = (pth) => {
516
+ if (process.platform === "win32") {
517
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
518
+ if (pathHasInvalidWinCharacters) {
519
+ const err = new Error(`Path contains invalid characters: ${pth}`);
520
+ err.code = "EINVAL";
521
+ throw err;
522
+ }
523
+ }
524
+ };
525
+ module.exports = (input, opts) => Promise.resolve().then(() => {
526
+ checkPath(input);
527
+ opts = Object.assign({}, defaults, opts);
528
+ const mkdir = pify(opts.fs.mkdir);
529
+ const stat = pify(opts.fs.stat);
530
+ const make = (pth) => {
531
+ return mkdir(pth, opts.mode).then(() => pth).catch((err) => {
532
+ if (err.code === "ENOENT") {
533
+ if (err.message.includes("null bytes") || path.dirname(pth) === pth) {
534
+ throw err;
535
+ }
536
+ return make(path.dirname(pth)).then(() => make(pth));
537
+ }
538
+ return stat(pth).then((stats) => stats.isDirectory() ? pth : Promise.reject()).catch(() => {
539
+ throw err;
540
+ });
541
+ });
542
+ };
543
+ return make(path.resolve(input));
544
+ });
545
+ module.exports.sync = (input, opts) => {
546
+ checkPath(input);
547
+ opts = Object.assign({}, defaults, opts);
548
+ const make = (pth) => {
549
+ try {
550
+ opts.fs.mkdirSync(pth, opts.mode);
551
+ } catch (err) {
552
+ if (err.code === "ENOENT") {
553
+ if (err.message.includes("null bytes") || path.dirname(pth) === pth) {
554
+ throw err;
555
+ }
556
+ make(path.dirname(pth));
557
+ return make(pth);
558
+ }
559
+ try {
560
+ if (!opts.fs.statSync(pth).isDirectory()) {
561
+ throw new Error("The path is not a directory");
562
+ }
563
+ } catch (_) {
564
+ throw err;
565
+ }
566
+ }
567
+ return pth;
568
+ };
569
+ return make(path.resolve(input));
570
+ };
571
+ }
572
+ });
573
+
574
+ // ../../node_modules/.pnpm/detect-indent@5.0.0/node_modules/detect-indent/index.js
575
+ var require_detect_indent = __commonJS({
576
+ "../../node_modules/.pnpm/detect-indent@5.0.0/node_modules/detect-indent/index.js"(exports, module) {
577
+ "use strict";
578
+ var INDENT_RE = /^(?:( )+|\t+)/;
579
+ function getMostUsed(indents) {
580
+ let result = 0;
581
+ let maxUsed = 0;
582
+ let maxWeight = 0;
583
+ for (const entry of indents) {
584
+ const key = entry[0];
585
+ const val = entry[1];
586
+ const u = val[0];
587
+ const w = val[1];
588
+ if (u > maxUsed || u === maxUsed && w > maxWeight) {
589
+ maxUsed = u;
590
+ maxWeight = w;
591
+ result = Number(key);
592
+ }
593
+ }
594
+ return result;
595
+ }
596
+ module.exports = (str) => {
597
+ if (typeof str !== "string") {
598
+ throw new TypeError("Expected a string");
599
+ }
600
+ let tabs = 0;
601
+ let spaces = 0;
602
+ let prev = 0;
603
+ const indents = /* @__PURE__ */ new Map();
604
+ let current;
605
+ let isIndent;
606
+ for (const line of str.split(/\n/g)) {
607
+ if (!line) {
608
+ continue;
609
+ }
610
+ let indent2;
611
+ const matches = line.match(INDENT_RE);
612
+ if (matches) {
613
+ indent2 = matches[0].length;
614
+ if (matches[1]) {
615
+ spaces++;
616
+ } else {
617
+ tabs++;
618
+ }
619
+ } else {
620
+ indent2 = 0;
621
+ }
622
+ const diff = indent2 - prev;
623
+ prev = indent2;
624
+ if (diff) {
625
+ isIndent = diff > 0;
626
+ current = indents.get(isIndent ? diff : -diff);
627
+ if (current) {
628
+ current[0]++;
629
+ } else {
630
+ current = [1, 0];
631
+ indents.set(diff, current);
632
+ }
633
+ } else if (current) {
634
+ current[1] += Number(isIndent);
635
+ }
636
+ }
637
+ const amount = getMostUsed(indents);
638
+ let type;
639
+ let indent;
640
+ if (!amount) {
641
+ type = null;
642
+ indent = "";
643
+ } else if (spaces >= tabs) {
644
+ type = "space";
645
+ indent = " ".repeat(amount);
646
+ } else {
647
+ type = "tab";
648
+ indent = " ".repeat(amount);
649
+ }
650
+ return {
651
+ amount,
652
+ type,
653
+ indent
654
+ };
655
+ };
656
+ }
657
+ });
658
+
659
+ // ../../node_modules/.pnpm/write-json-file@2.2.0/node_modules/write-json-file/index.js
660
+ var require_write_json_file = __commonJS({
661
+ "../../node_modules/.pnpm/write-json-file@2.2.0/node_modules/write-json-file/index.js"(exports, module) {
662
+ "use strict";
663
+ var path = __require("path");
664
+ var fs = require_graceful_fs();
665
+ var writeFileAtomic = require_write_file_atomic();
666
+ var sortKeys = require_sort_keys();
667
+ var makeDir = require_make_dir();
668
+ var pify = require_pify();
669
+ var detectIndent = require_detect_indent();
670
+ var init = (fn, fp, data, opts) => {
671
+ if (!fp) {
672
+ throw new TypeError("Expected a filepath");
673
+ }
674
+ if (data === void 0) {
675
+ throw new TypeError("Expected data to stringify");
676
+ }
677
+ opts = Object.assign({
678
+ indent: " ",
679
+ sortKeys: false
680
+ }, opts);
681
+ if (opts.sortKeys) {
682
+ data = sortKeys(data, {
683
+ deep: true,
684
+ compare: typeof opts.sortKeys === "function" && opts.sortKeys
685
+ });
686
+ }
687
+ return fn(fp, data, opts);
688
+ };
689
+ var readFile = (fp) => pify(fs.readFile)(fp, "utf8").catch(() => {
690
+ });
691
+ var main = (fp, data, opts) => {
692
+ return (opts.detectIndent ? readFile(fp) : Promise.resolve()).then((str) => {
693
+ const indent = str ? detectIndent(str).indent : opts.indent;
694
+ const json = JSON.stringify(data, opts.replacer, indent);
695
+ return pify(writeFileAtomic)(fp, `${json}
696
+ `, { mode: opts.mode });
697
+ });
698
+ };
699
+ var mainSync = (fp, data, opts) => {
700
+ let indent = opts.indent;
701
+ if (opts.detectIndent) {
702
+ try {
703
+ const file = fs.readFileSync(fp, "utf8");
704
+ indent = detectIndent(file).indent;
705
+ } catch (err) {
706
+ if (err.code !== "ENOENT") {
707
+ throw err;
708
+ }
709
+ }
710
+ }
711
+ const json = JSON.stringify(data, opts.replacer, indent);
712
+ return writeFileAtomic.sync(fp, `${json}
713
+ `, { mode: opts.mode });
714
+ };
715
+ module.exports = (fp, data, opts) => {
716
+ return makeDir(path.dirname(fp), { fs }).then(() => init(main, fp, data, opts));
717
+ };
718
+ module.exports.sync = (fp, data, opts) => {
719
+ makeDir.sync(path.dirname(fp), { fs });
720
+ init(mainSync, fp, data, opts);
721
+ };
722
+ }
723
+ });
724
+
725
+ // src/util/telemetry/index.ts
726
+ import { randomUUID as randomUUID2 } from "crypto";
727
+ import os from "os";
728
+ var import_constants = __toESM(require_dist(), 1);
729
+ import { spawn } from "child_process";
730
+ import { cloneEnv } from "@vercel/build-utils";
731
+
732
+ // src/util/telemetry/session.ts
733
+ var import_load_json_file = __toESM(require_load_json_file(), 1);
734
+ var import_write_json_file = __toESM(require_write_json_file(), 1);
735
+ import { randomUUID } from "crypto";
736
+ import { mkdirSync } from "fs";
737
+ import { dirname } from "path";
738
+ var DEFAULT_CLI_SESSION_INACTIVITY_TIMEOUT_MS = 30 * 60 * 1e3;
739
+ var DEFAULT_CLI_SESSION_MAX_LIFETIME_MS = 24 * 60 * 60 * 1e3;
740
+ function isPersistedCliSession(value) {
741
+ if (!value || typeof value !== "object") {
742
+ return false;
743
+ }
744
+ const session = value;
745
+ return typeof session.id === "string" && typeof session.createdAt === "number" && Number.isFinite(session.createdAt) && typeof session.lastSeenAt === "number" && Number.isFinite(session.lastSeenAt);
746
+ }
747
+ function isPersistedCliDevice(value) {
748
+ if (!value || typeof value !== "object") {
749
+ return false;
750
+ }
751
+ const device = value;
752
+ return typeof device.id === "string";
753
+ }
754
+ function readPersistedCliSession(filePath) {
755
+ try {
756
+ const session = import_load_json_file.default.sync(filePath);
757
+ return isPersistedCliSession(session) ? session : null;
758
+ } catch {
759
+ return null;
760
+ }
761
+ }
762
+ function writePersistedCliSession(filePath, session) {
763
+ try {
764
+ mkdirSync(dirname(filePath), { recursive: true });
765
+ import_write_json_file.default.sync(filePath, session, { indent: 2 });
766
+ } catch {
767
+ }
768
+ }
769
+ function readPersistedCliDevice(filePath) {
770
+ try {
771
+ const device = import_load_json_file.default.sync(filePath);
772
+ return isPersistedCliDevice(device) ? device : null;
773
+ } catch {
774
+ return null;
775
+ }
776
+ }
777
+ function writePersistedCliDevice(filePath, device) {
778
+ try {
779
+ mkdirSync(dirname(filePath), { recursive: true });
780
+ import_write_json_file.default.sync(filePath, device, { indent: 2 });
781
+ } catch {
782
+ }
783
+ }
784
+ function getOrCreatePersistedCliSession(opts) {
785
+ const now = opts.now?.() ?? Date.now();
786
+ const inactivityTimeoutMs = opts.inactivityTimeoutMs ?? DEFAULT_CLI_SESSION_INACTIVITY_TIMEOUT_MS;
787
+ const maxLifetimeMs = opts.maxLifetimeMs ?? DEFAULT_CLI_SESSION_MAX_LIFETIME_MS;
788
+ const existing = readPersistedCliSession(opts.filePath);
789
+ const shouldReuseExisting = existing && now - existing.lastSeenAt <= inactivityTimeoutMs && now - existing.createdAt <= maxLifetimeMs;
790
+ const session = shouldReuseExisting ? {
791
+ ...existing,
792
+ lastSeenAt: now
793
+ } : {
794
+ id: randomUUID(),
795
+ createdAt: now,
796
+ lastSeenAt: now
797
+ };
798
+ writePersistedCliSession(opts.filePath, session);
799
+ return session;
800
+ }
801
+ function touchPersistedCliSession(opts, session) {
802
+ const nextSession = {
803
+ ...session,
804
+ lastSeenAt: opts.now?.() ?? Date.now()
805
+ };
806
+ writePersistedCliSession(opts.filePath, nextSession);
807
+ return nextSession;
808
+ }
809
+ function getOrCreatePersistedCliDevice(opts) {
810
+ const existing = readPersistedCliDevice(opts.filePath);
811
+ if (existing) {
812
+ return existing;
813
+ }
814
+ const device = {
815
+ id: randomUUID()
816
+ };
817
+ writePersistedCliDevice(opts.filePath, device);
818
+ return device;
819
+ }
820
+
821
+ // src/util/telemetry/index.ts
822
+ var LogLabel = `['telemetry']:`;
823
+ var MAX_ERROR_SERVER_MESSAGE_LENGTH = 500;
824
+ var TelemetryClient = class {
825
+ constructor({ opts }) {
826
+ this.redactedValue = "[REDACTED]";
827
+ this.noValueToTriggerPrompt = "[TRIGGER_PROMPT]";
828
+ this.redactedArgumentsLength = (args) => {
829
+ if (args && args.length === 1) {
830
+ return "ONE";
831
+ }
832
+ if (args.length > 1) {
833
+ return "MANY";
834
+ }
835
+ return "NONE";
836
+ };
837
+ this.redactedTargetName = (target) => {
838
+ if (import_constants.PROJECT_ENV_TARGET.includes(target)) {
839
+ return target;
840
+ }
841
+ return this.redactedValue;
842
+ };
843
+ this.isDebug = opts.isDebug || false;
844
+ this.store = opts.store;
845
+ }
846
+ track(eventData) {
847
+ if (this.isDebug) {
848
+ output_manager_default.debug(`${LogLabel} ${eventData.key}:${eventData.value}`);
849
+ }
850
+ const event = {
851
+ id: randomUUID2(),
852
+ eventTime: Date.now(),
853
+ ...eventData
854
+ };
855
+ this.store.add(event);
856
+ }
857
+ trackCliCommand(eventData) {
858
+ this.track({
859
+ key: `command:${eventData.command}`,
860
+ value: eventData.value
861
+ });
862
+ }
863
+ trackCliSubcommand(eventData) {
864
+ this.track({
865
+ key: `subcommand:${eventData.subcommand}`,
866
+ value: eventData.value
867
+ });
868
+ }
869
+ trackCliArgument(eventData) {
870
+ if (eventData.value) {
871
+ this.track({
872
+ key: `argument:${eventData.arg}`,
873
+ value: eventData.value
874
+ });
875
+ }
876
+ }
877
+ trackCliOption(eventData) {
878
+ this.track({
879
+ key: `option:${eventData.option}`,
880
+ value: eventData.value
881
+ });
882
+ }
883
+ trackTargetEnvironment(targetEnvironment) {
884
+ this.track({
885
+ key: "target_environment",
886
+ value: targetEnvironment
887
+ });
888
+ }
889
+ trackCommandOutput(eventData) {
890
+ this.track({
891
+ key: `output:${eventData.key}`,
892
+ value: eventData.value
893
+ });
894
+ }
895
+ trackCliFlag(flag) {
896
+ this.track({
897
+ key: `flag:${flag}`,
898
+ value: "TRUE"
899
+ });
900
+ }
901
+ trackOidcTokenRefresh(count) {
902
+ this.track({
903
+ key: "oidc-token-refresh",
904
+ value: `${count}`
905
+ });
906
+ }
907
+ trackCPUs() {
908
+ this.track({
909
+ key: "cpu_count",
910
+ value: String(os.cpus().length)
911
+ });
912
+ }
913
+ trackAgenticUse(agent) {
914
+ if (agent) {
915
+ this.track({
916
+ key: "agent",
917
+ value: agent
918
+ });
919
+ }
920
+ }
921
+ trackPlatform() {
922
+ this.track({
923
+ key: "platform",
924
+ value: os.platform()
925
+ });
926
+ }
927
+ trackArch() {
928
+ this.track({
929
+ key: "arch",
930
+ value: os.arch()
931
+ });
932
+ }
933
+ trackCI(ciVendorName) {
934
+ if (ciVendorName) {
935
+ this.track({
936
+ key: "ci",
937
+ value: ciVendorName
938
+ });
939
+ }
940
+ }
941
+ trackStdinIsTTY(isTTY) {
942
+ this.track({
943
+ key: "stdin_is_tty",
944
+ value: isTTY ? "true" : "false"
945
+ });
946
+ }
947
+ trackVersion(version) {
948
+ if (version) {
949
+ this.track({
950
+ key: "version",
951
+ value: version
952
+ });
953
+ }
954
+ }
955
+ trackDefaultDeploy() {
956
+ this.track({
957
+ key: "default-deploy",
958
+ value: "TRUE"
959
+ });
960
+ }
961
+ trackProjectId(projectId) {
962
+ if (projectId) {
963
+ this.track({
964
+ key: "project_id",
965
+ value: projectId
966
+ });
967
+ }
968
+ }
969
+ trackInvocationId(invocationId) {
970
+ if (invocationId) {
971
+ this.track({
972
+ key: "invocation_id",
973
+ value: invocationId
974
+ });
975
+ }
976
+ }
977
+ trackDeviceId(deviceId) {
978
+ if (deviceId) {
979
+ this.track({
980
+ key: "device_id",
981
+ value: deviceId
982
+ });
983
+ }
984
+ }
985
+ trackVercelPluginActiveSession() {
986
+ this.track({
987
+ key: "vercel_plugin_active_session",
988
+ value: "TRUE"
989
+ });
990
+ }
991
+ trackVercelPluginVersion(version) {
992
+ if (version) {
993
+ this.track({
994
+ key: "vercel_plugin_version",
995
+ value: version
996
+ });
997
+ }
998
+ }
999
+ trackErrorStatus(status) {
1000
+ if (typeof status !== "undefined") {
1001
+ this.track({
1002
+ key: "error_status",
1003
+ value: String(status)
1004
+ });
1005
+ }
1006
+ }
1007
+ trackErrorCode(code) {
1008
+ if (code) {
1009
+ this.track({
1010
+ key: "error_code",
1011
+ value: code
1012
+ });
1013
+ }
1014
+ }
1015
+ trackErrorSlug(slug) {
1016
+ if (slug) {
1017
+ this.track({
1018
+ key: "error_slug",
1019
+ value: slug
1020
+ });
1021
+ }
1022
+ }
1023
+ trackErrorAction(action) {
1024
+ if (action) {
1025
+ this.track({
1026
+ key: "error_action",
1027
+ value: action
1028
+ });
1029
+ }
1030
+ }
1031
+ trackErrorServerMessage(serverMessage) {
1032
+ if (serverMessage) {
1033
+ const normalizedServerMessage = serverMessage.trim().replace(/\s+/g, " ");
1034
+ this.track({
1035
+ key: "error_server_message",
1036
+ value: normalizedServerMessage.slice(
1037
+ 0,
1038
+ MAX_ERROR_SERVER_MESSAGE_LENGTH
1039
+ )
1040
+ });
1041
+ }
1042
+ }
1043
+ trackExtension() {
1044
+ this.track({
1045
+ key: "extension",
1046
+ value: this.redactedValue
1047
+ });
1048
+ }
1049
+ trackLoginState(state) {
1050
+ if (state === "started")
1051
+ this.loginAttempt = randomUUID2();
1052
+ if (this.loginAttempt) {
1053
+ this.track({ key: `login:attempt:${this.loginAttempt}`, value: state });
1054
+ }
1055
+ if (state !== "started")
1056
+ this.loginAttempt = void 0;
1057
+ }
1058
+ trackCliFlagHelp(command, subcommands) {
1059
+ let subcommand;
1060
+ if (subcommands) {
1061
+ subcommand = Array.isArray(subcommands) ? subcommands[0] : subcommands;
1062
+ }
1063
+ this.track({
1064
+ key: "flag:help",
1065
+ value: subcommand ? `${command}:${subcommand}` : command
1066
+ });
1067
+ }
1068
+ /**
1069
+ * Tracks the --format option for JSON output.
1070
+ * This is a common option across many commands, so it's defined in the base class.
1071
+ */
1072
+ trackCliOptionFormat(format) {
1073
+ if (format) {
1074
+ const allowedFormat = ["json"].includes(format) ? format : this.redactedValue;
1075
+ this.trackCliOption({
1076
+ option: "format",
1077
+ value: allowedFormat
1078
+ });
1079
+ }
1080
+ }
1081
+ /**
1082
+ * Tracks the --project option. Value is redacted because project names/IDs
1083
+ * may be sensitive. Accepts `string | string[]` so commands with a repeatable
1084
+ * `--project` can override. Not all commands support repeated `--project` flags
1085
+ */
1086
+ trackCliOptionProject(value) {
1087
+ if (!value)
1088
+ return;
1089
+ if (Array.isArray(value) && value.length === 0)
1090
+ return;
1091
+ this.trackCliOption({
1092
+ option: "project",
1093
+ value: this.redactedValue
1094
+ });
1095
+ }
1096
+ };
1097
+ var TelemetryEventStore = class {
1098
+ constructor(opts) {
1099
+ this.teamId = "NO_TEAM_ID";
1100
+ this.userId = "NO_USER_ID";
1101
+ this.projectId = "NO_PROJECT_ID";
1102
+ this.isDebug = opts?.isDebug || false;
1103
+ this.events = [];
1104
+ this.config = opts?.config;
1105
+ this.cliDeviceOptions = opts?.cliDevice;
1106
+ this.cliSessionOptions = opts?.cliSession;
1107
+ this.invocationId = randomUUID2();
1108
+ this.deviceId = randomUUID2();
1109
+ if (this.cliDeviceOptions) {
1110
+ this.cliDevice = getOrCreatePersistedCliDevice(this.cliDeviceOptions);
1111
+ this.deviceId = this.cliDevice.id;
1112
+ }
1113
+ if (this.cliSessionOptions) {
1114
+ this.cliSession = getOrCreatePersistedCliSession(this.cliSessionOptions);
1115
+ this.sessionId = this.cliSession.id;
1116
+ } else {
1117
+ this.sessionId = randomUUID2();
1118
+ }
1119
+ }
1120
+ add(event) {
1121
+ event.sessionId = this.sessionId;
1122
+ event.teamId = this.teamId;
1123
+ event.userId = this.userId;
1124
+ event.projectId = this.projectId;
1125
+ this.events.push(event);
1126
+ }
1127
+ updateTeamId(teamId) {
1128
+ if (teamId) {
1129
+ this.teamId = teamId;
1130
+ }
1131
+ }
1132
+ updateUserId(userId) {
1133
+ if (userId) {
1134
+ this.userId = userId;
1135
+ }
1136
+ }
1137
+ updateProjectId(projectId) {
1138
+ if (projectId) {
1139
+ this.projectId = projectId;
1140
+ }
1141
+ }
1142
+ get hasUserId() {
1143
+ return this.userId !== "NO_USER_ID";
1144
+ }
1145
+ get currentProjectId() {
1146
+ return this.projectId;
1147
+ }
1148
+ get currentInvocationId() {
1149
+ return this.invocationId;
1150
+ }
1151
+ get currentDeviceId() {
1152
+ return this.deviceId;
1153
+ }
1154
+ get currentSessionId() {
1155
+ return this.sessionId;
1156
+ }
1157
+ get readonlyEvents() {
1158
+ return Array.from(this.events);
1159
+ }
1160
+ reset() {
1161
+ this.events = [];
1162
+ }
1163
+ get enabled() {
1164
+ if (process.env.VERCEL_TELEMETRY_DISABLED) {
1165
+ return false;
1166
+ }
1167
+ return this.config?.enabled ?? true;
1168
+ }
1169
+ async save() {
1170
+ if (this.cliSession && this.cliSessionOptions) {
1171
+ this.cliSession = touchPersistedCliSession(
1172
+ this.cliSessionOptions,
1173
+ this.cliSession
1174
+ );
1175
+ }
1176
+ if (this.isDebug) {
1177
+ output_manager_default.log(`${LogLabel} Flushing Events`);
1178
+ for (const event of this.events) {
1179
+ event.teamId = this.teamId;
1180
+ event.userId = this.userId;
1181
+ event.projectId = this.projectId;
1182
+ output_manager_default.log(JSON.stringify(event));
1183
+ }
1184
+ return;
1185
+ }
1186
+ if (this.enabled) {
1187
+ const sessionId = this.events[0].sessionId;
1188
+ if (!sessionId) {
1189
+ output_manager_default.debug("Unable to send metrics: no session ID");
1190
+ return;
1191
+ }
1192
+ const events = this.events.map((event) => {
1193
+ delete event.sessionId;
1194
+ delete event.teamId;
1195
+ delete event.userId;
1196
+ delete event.projectId;
1197
+ const { eventTime, ...rest } = event;
1198
+ return {
1199
+ event_time: eventTime,
1200
+ team_id: this.teamId,
1201
+ user_id: this.userId,
1202
+ project_id: this.projectId,
1203
+ ...rest
1204
+ };
1205
+ });
1206
+ const payload = {
1207
+ headers: {
1208
+ "Client-id": "vercel-cli",
1209
+ "x-vercel-cli-topic-id": "generic",
1210
+ "x-vercel-cli-session-id": sessionId
1211
+ },
1212
+ body: events
1213
+ };
1214
+ await this.sendToSubprocess(payload, output_manager_default.debugEnabled);
1215
+ }
1216
+ }
1217
+ /**
1218
+ * Send the telemetry events to a subprocess, this invokes the `telemetry flush` command
1219
+ * and passes a stringified payload to the subprocess, there's a risk that if the event payload
1220
+ * increases in size, it may exceed the maximum buffer size for the subprocess, in which case the
1221
+ * child process will error and not send anything.
1222
+ * FIXME: handle max buffer size
1223
+ */
1224
+ async sendToSubprocess(payload, outputDebugEnabled) {
1225
+ const flushArgs = ["telemetry", "flush", JSON.stringify(payload)];
1226
+ let nodeBinaryPath;
1227
+ let script;
1228
+ if (isNativeBinaryInstall()) {
1229
+ nodeBinaryPath = process.execPath;
1230
+ script = flushArgs;
1231
+ } else {
1232
+ const args = [process.execPath, process.argv[0], process.argv[1]];
1233
+ if (args[0] === args[1]) {
1234
+ args.shift();
1235
+ }
1236
+ nodeBinaryPath = args[0];
1237
+ script = [...args.slice(1), ...flushArgs];
1238
+ }
1239
+ const env = cloneEnv(process.env, {
1240
+ VERCEL_TELEMETRY_DISABLED: "1"
1241
+ });
1242
+ if (outputDebugEnabled) {
1243
+ return new Promise((resolve) => {
1244
+ const childProcess = spawn(nodeBinaryPath, script, {
1245
+ env,
1246
+ stdio: ["ignore", "pipe", "pipe"]
1247
+ });
1248
+ childProcess.stderr.on("data", (data) => output_manager_default.debug(data.toString()));
1249
+ childProcess.stdout.on("data", (data) => output_manager_default.debug(data.toString()));
1250
+ childProcess.on("error", (d) => {
1251
+ output_manager_default.debug(d);
1252
+ });
1253
+ const timeout = setTimeout(() => {
1254
+ output_manager_default.debug("Telemetry subprocess killed due to timeout");
1255
+ childProcess.kill();
1256
+ }, 2e3);
1257
+ childProcess.on("exit", (code) => {
1258
+ output_manager_default.debug(`Telemetry subprocess exited with code ${code}`);
1259
+ childProcess.unref();
1260
+ timeout.unref();
1261
+ resolve();
1262
+ });
1263
+ });
1264
+ } else {
1265
+ const childProcess = spawn(nodeBinaryPath, script, {
1266
+ stdio: "ignore",
1267
+ env,
1268
+ windowsHide: true,
1269
+ detached: true
1270
+ });
1271
+ childProcess.unref();
1272
+ }
1273
+ }
1274
+ };
1275
+
1276
+ export {
1277
+ require_dist,
1278
+ TelemetryClient,
1279
+ TelemetryEventStore
1280
+ };
1281
+ /*! Bundled license information:
1282
+
1283
+ imurmurhash/imurmurhash.js:
1284
+ (**
1285
+ * @preserve
1286
+ * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
1287
+ *
1288
+ * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
1289
+ * @see http://github.com/homebrewing/brauhaus-diff
1290
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
1291
+ * @see http://github.com/garycourt/murmurhash-js
1292
+ * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
1293
+ * @see http://sites.google.com/site/murmurhash/
1294
+ *)
1295
+ */