vercel 59.4.0 → 59.6.2

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 (137) hide show
  1. package/dist/chunks/{add-FQMB3XPM.js → add-4GQZ22ZN.js} +20 -16
  2. package/dist/chunks/{add-73X2SKBH.js → add-HJSEM4YJ.js} +17 -13
  3. package/dist/chunks/{add-QJ3WT4FW.js → add-SIGUSM3Y.js} +21 -17
  4. package/dist/chunks/{build-YUYCLCXD.js → build-XOMJDX4M.js} +18 -15
  5. package/dist/chunks/{chunk-F7OXZLY2.js → chunk-26XDDLXM.js} +2 -2
  6. package/dist/chunks/{chunk-VCE6QKFE.js → chunk-2O5J3KMT.js} +4 -4
  7. package/dist/chunks/{chunk-XI6NJLI4.js → chunk-2YRAWYGE.js} +3 -3
  8. package/dist/chunks/{chunk-X6O6XJEA.js → chunk-37V5P4VO.js} +16 -14
  9. package/dist/chunks/{chunk-EB7NJKPL.js → chunk-3F5EGINT.js} +3 -3
  10. package/dist/chunks/{chunk-RIB4S2IB.js → chunk-3HZLXCVL.js} +1 -1
  11. package/dist/chunks/{chunk-KQRVZWJU.js → chunk-3T7WSWZH.js} +1 -1
  12. package/dist/chunks/{chunk-3KNPVXJ3.js → chunk-4KD5BYHB.js} +1 -1
  13. package/dist/chunks/{chunk-XLKFJPMT.js → chunk-57RHXXXG.js} +1 -1
  14. package/dist/chunks/chunk-5GGUB4EO.js +31 -0
  15. package/dist/chunks/{chunk-R6IGDGX3.js → chunk-5XECIWME.js} +1 -1
  16. package/dist/chunks/{chunk-KAYSW4CJ.js → chunk-6JPVTPTU.js} +3 -3
  17. package/dist/chunks/{chunk-ZFWNMVNR.js → chunk-6M2KZUED.js} +19 -8
  18. package/dist/chunks/{chunk-HT2XWSAJ.js → chunk-7AEEQOD4.js} +2 -29
  19. package/dist/chunks/{chunk-HURL5EBN.js → chunk-7HE63HCR.js} +124 -161
  20. package/dist/chunks/chunk-7Q45OKWR.js +149 -0
  21. package/dist/chunks/{chunk-RI7KKKII.js → chunk-7R6M3BHM.js} +4 -18
  22. package/dist/chunks/{chunk-XBN2O34P.js → chunk-7ST552E3.js} +17 -4
  23. package/dist/chunks/{chunk-JKQWQA2T.js → chunk-AINIBIP4.js} +1 -1
  24. package/dist/chunks/{chunk-CV4S27SS.js → chunk-ASBP32T6.js} +1 -1
  25. package/dist/chunks/chunk-AYLY3ZVL.js +104 -0
  26. package/dist/chunks/{chunk-SOFC4MLS.js → chunk-BMKU5KEL.js} +9 -569
  27. package/dist/chunks/{chunk-KDYRLN6H.js → chunk-C5HKWXRR.js} +1 -1
  28. package/dist/chunks/{chunk-2MF3ZAVW.js → chunk-CJV7J7B5.js} +6 -6
  29. package/dist/chunks/{chunk-HJVTLJHO.js → chunk-DE7MBNHQ.js} +6 -6
  30. package/dist/chunks/{chunk-3L2YLLHC.js → chunk-DWIC7MRV.js} +2 -2
  31. package/dist/chunks/{chunk-GFCTRJI5.js → chunk-EZKW5YJ2.js} +1 -1
  32. package/dist/chunks/{chunk-MWYQ24FO.js → chunk-FRAXI2WT.js} +3 -3
  33. package/dist/chunks/{chunk-DDIZGOCK.js → chunk-FRZULOVH.js} +8 -6
  34. package/dist/chunks/{chunk-Y3J4VU2H.js → chunk-FWKSJYDV.js} +2 -2
  35. package/dist/chunks/chunk-FXD67VN5.js +467 -0
  36. package/dist/chunks/{chunk-EB5NBVTV.js → chunk-GISTGGBO.js} +8 -8
  37. package/dist/chunks/chunk-GY5I4AYD.js +122 -0
  38. package/dist/chunks/{chunk-PD4DYNSB.js → chunk-GZQQNLF5.js} +5 -5
  39. package/dist/chunks/{chunk-PIMIKY4X.js → chunk-IJ4X426J.js} +1 -1
  40. package/dist/chunks/{chunk-KSZ4MNHO.js → chunk-JH4WQRIU.js} +2 -2
  41. package/dist/chunks/{chunk-TVXCXIRO.js → chunk-L3UXB2CW.js} +1 -1
  42. package/dist/chunks/{chunk-O5DLWLT7.js → chunk-LXZVOR6F.js} +9 -9
  43. package/dist/chunks/{chunk-EG5BSAXD.js → chunk-MTWHQEXI.js} +1 -1
  44. package/dist/chunks/{chunk-WC7IINFV.js → chunk-NFU4XJIR.js} +1 -1
  45. package/dist/chunks/{chunk-TH2XUVDP.js → chunk-NGGLYKNU.js} +30 -6
  46. package/dist/chunks/{chunk-2PX6N4FE.js → chunk-NGNN6WF2.js} +10 -10
  47. package/dist/chunks/{chunk-GGPE5377.js → chunk-O26N2UPI.js} +1 -1
  48. package/dist/chunks/chunk-O75LSD3C.js +34 -0
  49. package/dist/chunks/{chunk-BBSS3XIW.js → chunk-OQ3C5VXZ.js} +1 -1
  50. package/dist/chunks/{chunk-M22O6CYY.js → chunk-POOO7W47.js} +1 -1
  51. package/dist/chunks/{chunk-LKTQR5JE.js → chunk-PRH6KRUT.js} +2 -2
  52. package/dist/chunks/chunk-Q2DGFCO7.js +579 -0
  53. package/dist/chunks/{chunk-OX7KI3LF.js → chunk-QFAS4OVW.js} +18 -0
  54. package/dist/chunks/{chunk-CHEZBD7H.js → chunk-R5PULMHT.js} +3 -3
  55. package/dist/chunks/{chunk-VAFU7DXZ.js → chunk-RKDCNQ4S.js} +1 -91
  56. package/dist/chunks/{chunk-BLYBHFIE.js → chunk-SF3AYAIF.js} +61 -24
  57. package/dist/chunks/{chunk-GMWRTZVZ.js → chunk-SLPSPYVR.js} +1 -1
  58. package/dist/chunks/{chunk-J5Y2QGGU.js → chunk-SWI6F4X3.js} +2 -2
  59. package/dist/chunks/chunk-V3MDDR2X.js +249 -0
  60. package/dist/chunks/{chunk-HMJVUXE6.js → chunk-VJ5NAOWB.js} +867 -625
  61. package/dist/chunks/{chunk-O5GNPPTU.js → chunk-VP5Y3SZG.js} +1 -1
  62. package/dist/chunks/{chunk-G75NFPIT.js → chunk-WNAKOXGK.js} +1 -1
  63. package/dist/chunks/{chunk-NP6BQPCN.js → chunk-WZ2S3A2A.js} +8 -6
  64. package/dist/chunks/{chunk-7QVJTI5H.js → chunk-XDGOOW3K.js} +1 -1
  65. package/dist/chunks/{chunk-UMA66MKW.js → chunk-XM3LOQIX.js} +1 -1
  66. package/dist/chunks/{chunk-CYNB6LL4.js → chunk-XNFHNTS2.js} +1 -1
  67. package/dist/chunks/{chunk-VDJN4WKH.js → chunk-XRWOTCDO.js} +1 -1
  68. package/dist/chunks/{chunk-UV2ZMFVG.js → chunk-YJKZQEHS.js} +2 -2
  69. package/dist/chunks/{chunk-STPH4Y62.js → chunk-YJUO3EKH.js} +1 -1
  70. package/dist/chunks/{chunk-Y42SPI2H.js → chunk-ZNMTDLYH.js} +6 -6
  71. package/dist/chunks/{chunk-VLPLCJZC.js → chunk-ZSFEACZU.js} +1 -1
  72. package/dist/chunks/{clear-USQM5VW5.js → clear-BWT2FJY4.js} +17 -13
  73. package/dist/chunks/{compile-vercel-config-2JNYMI6W.js → compile-vercel-config-DGM4NISW.js} +10 -7
  74. package/dist/chunks/{config-VTRIDLY4.js → config-NJAN3RMU.js} +20 -16
  75. package/dist/chunks/config-RSE6Z4LB.js +122 -0
  76. package/dist/chunks/{constants-YMCRE6IG.js → constants-WEQVJSYS.js} +1 -1
  77. package/dist/chunks/{delete-ILLSBCVQ.js → delete-LROBRBAH.js} +15 -11
  78. package/dist/chunks/{delete-VTPHK3EB.js → delete-SSL2PK2F.js} +12 -9
  79. package/dist/chunks/{disable-VTOMO64V.js → disable-ASG5JDZR.js} +12 -9
  80. package/dist/chunks/{discard-ZIOZ34ZI.js → discard-PV47B6IL.js} +12 -9
  81. package/dist/chunks/{edit-E3AMR4KM.js → edit-5ATYIOLX.js} +14 -11
  82. package/dist/chunks/{edit-JMZ5XWVW.js → edit-REI7HXGG.js} +16 -12
  83. package/dist/chunks/{enable-A4PMZ7QZ.js → enable-LZXL7XAG.js} +12 -9
  84. package/dist/chunks/{exec-CNBOV577.js → exec-XH4K34JM.js} +3 -3
  85. package/dist/chunks/{export-Y6AJ3WRZ.js → export-ZAZFQU2E.js} +12 -9
  86. package/dist/chunks/{image-26BKPAUB.js → image-QPHN5V7L.js} +7 -6
  87. package/dist/chunks/{import-builders-3H7J2SEK.js → import-builders-W3YE2V6A.js} +12 -9
  88. package/dist/chunks/{inspect-7DGKYHKW.js → inspect-BFGK72WY.js} +18 -14
  89. package/dist/chunks/{inspect-OEY4DJRI.js → inspect-FRXJRM6T.js} +18 -14
  90. package/dist/chunks/{inspect-ZW5N6O5P.js → inspect-RDMC2Z3Q.js} +17 -13
  91. package/dist/chunks/{inspect-GJFVAZIJ.js → inspect-SJEZVGPK.js} +20 -16
  92. package/dist/chunks/{inspect-N3E2PO6K.js → inspect-SSOM3FXS.js} +17 -13
  93. package/dist/chunks/{list-MIQ5D6PM.js → list-2HTR7Q3J.js} +18 -14
  94. package/dist/chunks/{list-2VTCNQEB.js → list-PHDUZVMR.js} +15 -11
  95. package/dist/chunks/{list-DTJBW7OQ.js → list-W33GXKDA.js} +18 -14
  96. package/dist/chunks/{login-L34UHAU5.js → login-JWAFHVDG.js} +30 -17
  97. package/dist/chunks/{ls-OBUDC4SB.js → ls-3AN2DZHN.js} +20 -15
  98. package/dist/chunks/{ls-SXJFBLUT.js → ls-3MH2OCP3.js} +20 -15
  99. package/dist/chunks/ls-D2POUHI7.js +176 -0
  100. package/dist/chunks/{ls-VDYUFSSC.js → ls-KDFU224B.js} +20 -15
  101. package/dist/chunks/{ls-OKO4IHWB.js → ls-KX2VBOGV.js} +18 -14
  102. package/dist/chunks/{ls-NCPQY4FV.js → ls-RWKNJQNT.js} +23 -18
  103. package/dist/chunks/{open-V5JDGXUP.js → open-IEYRB6RL.js} +15 -11
  104. package/dist/chunks/{permissions-6CPRPPBY.js → permissions-ZWZUMEHR.js} +10 -9
  105. package/dist/chunks/{publish-R27DPHFO.js → publish-UWZYBDHK.js} +12 -9
  106. package/dist/chunks/{push-VLVTBS42.js → push-IAEQ3FBF.js} +18 -15
  107. package/dist/chunks/{query-IVVRYMJN.js → query-NNOZYSED.js} +18 -14
  108. package/dist/chunks/{reorder-LJ2RBZM2.js → reorder-TKBM244W.js} +12 -9
  109. package/dist/chunks/{reply-USAISZYC.js → reply-FLBSBMTW.js} +16 -12
  110. package/dist/chunks/{resolve-CRCJYVS5.js → resolve-GJYPMWUE.js} +15 -11
  111. package/dist/chunks/{restore-6PBPEAMU.js → restore-PNI3TM3U.js} +12 -9
  112. package/dist/chunks/{rm-HHELZB7R.js → rm-76CSSSSV.js} +17 -13
  113. package/dist/chunks/{rm-TWU3JR6Z.js → rm-FN7LTIIL.js} +17 -13
  114. package/dist/chunks/{rm-KGOEOWVK.js → rm-FTE33UHE.js} +16 -12
  115. package/dist/chunks/rm-FXA5DLXQ.js +315 -0
  116. package/dist/chunks/{rm-EOD7RDSO.js → rm-PGJ4KR6U.js} +20 -16
  117. package/dist/chunks/{routes-SZI2G4SE.js → routes-2OLIBRYX.js} +3 -3
  118. package/dist/chunks/{rule-inspect-WFTVRK6B.js → rule-inspect-LJIGPTWS.js} +18 -14
  119. package/dist/chunks/{rules-AQYTFJI6.js → rules-6BMNO6M5.js} +11 -10
  120. package/dist/chunks/{schema-LUVFYPWN.js → schema-45SJNY5L.js} +9 -7
  121. package/dist/chunks/{schema-ZCDCJC7E.js → schema-HATXEQDP.js} +14 -11
  122. package/dist/chunks/set-C3UQUQ42.js +243 -0
  123. package/dist/chunks/{tags-RCNRFX7U.js → tags-BTVDROFG.js} +6 -5
  124. package/dist/chunks/{types-AJHILHO5.js → types-JGANJ5EQ.js} +12 -8
  125. package/dist/chunks/{update-I7QGAOYF.js → update-B6PSOHUW.js} +19 -15
  126. package/dist/commands/build/builder-worker.cjs +281 -0
  127. package/dist/commands/build/index.js +695 -236
  128. package/dist/commands/deploy/index.js +131 -50
  129. package/dist/commands/dev/index.js +677 -144
  130. package/dist/commands/env/index.js +1199 -565
  131. package/dist/commands/link/index.js +27 -22
  132. package/dist/commands/list/index.js +21 -14
  133. package/dist/commands-bulk.js +2051 -1019
  134. package/dist/help.js +1 -1
  135. package/dist/index.js +39 -33
  136. package/dist/version.mjs +1 -1
  137. package/package.json +48 -48
@@ -0,0 +1,243 @@
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
+ EMPTY_PATH_ERROR,
9
+ ENVIRONMENT_ERROR,
10
+ RATE_ERROR,
11
+ RULE_LIMIT,
12
+ formatRate,
13
+ formatRuleTarget,
14
+ handleTracingApiError,
15
+ hasSameKey,
16
+ invalidArguments,
17
+ isRuleEnvironment,
18
+ parseSampleRate,
19
+ readProjectTracing,
20
+ resolveConfigScope,
21
+ subcommandArguments,
22
+ toApiRate,
23
+ toRule,
24
+ writeConfigJson,
25
+ writeSamplingRules
26
+ } from "./chunk-V3MDDR2X.js";
27
+ import "./chunk-5GGUB4EO.js";
28
+ import {
29
+ validateJsonOutput
30
+ } from "./chunk-KXDWXXJH.js";
31
+ import {
32
+ tracesCommand
33
+ } from "./chunk-7Q45OKWR.js";
34
+ import {
35
+ setSubcommand
36
+ } from "./chunk-GY5I4AYD.js";
37
+ import {
38
+ help
39
+ } from "./chunk-2YRAWYGE.js";
40
+ import "./chunk-VJ5NAOWB.js";
41
+ import "./chunk-FXD67VN5.js";
42
+ import {
43
+ TelemetryClient
44
+ } from "./chunk-XNFHNTS2.js";
45
+ import "./chunk-NGGLYKNU.js";
46
+ import "./chunk-GGP5R3FU.js";
47
+ import {
48
+ printError
49
+ } from "./chunk-AYLY3ZVL.js";
50
+ import {
51
+ parseArguments
52
+ } from "./chunk-57RHXXXG.js";
53
+ import "./chunk-RKDCNQ4S.js";
54
+ import "./chunk-BMKU5KEL.js";
55
+ import {
56
+ getCommandName,
57
+ getCommandNamePlain,
58
+ getFlagsSpecification
59
+ } from "./chunk-Q2DGFCO7.js";
60
+ import "./chunk-P4QNYOFB.js";
61
+ import "./chunk-52QYYTM5.js";
62
+ import {
63
+ output_manager_default
64
+ } from "./chunk-QFAS4OVW.js";
65
+ import {
66
+ require_source
67
+ } from "./chunk-S7KYDPEM.js";
68
+ import {
69
+ __toESM
70
+ } from "./chunk-TZ2YI2VH.js";
71
+
72
+ // src/commands/traces/config/set.ts
73
+ var import_chalk = __toESM(require_source(), 1);
74
+
75
+ // src/util/telemetry/commands/traces/config/set.ts
76
+ var TracesConfigSetTelemetryClient = class extends TelemetryClient {
77
+ /**
78
+ * The environment word is a closed set, so a valid value is tracked raw.
79
+ * Anything else is a typo the CLI rejected and is redacted.
80
+ */
81
+ trackCliArgumentEnvironment(environment) {
82
+ if (environment) {
83
+ this.trackCliArgument({
84
+ arg: "environment",
85
+ value: isRuleEnvironment(environment) ? environment : this.redactedValue
86
+ });
87
+ }
88
+ }
89
+ trackCliArgumentRate(rate) {
90
+ if (rate) {
91
+ this.trackCliArgument({
92
+ arg: "rate",
93
+ value: this.redactedValue
94
+ });
95
+ }
96
+ }
97
+ /** The path prefix is customer data. */
98
+ trackCliArgumentRequestPath(requestPath) {
99
+ if (requestPath) {
100
+ this.trackCliArgument({
101
+ arg: "requestPath",
102
+ value: this.redactedValue
103
+ });
104
+ }
105
+ }
106
+ trackCliFlagJson(json) {
107
+ if (json) {
108
+ this.trackCliFlag("json");
109
+ }
110
+ }
111
+ };
112
+
113
+ // src/commands/traces/config/set.ts
114
+ var USAGE = "traces config set <environment> <rate> [requestPath]";
115
+ async function set(client) {
116
+ const telemetry = new TracesConfigSetTelemetryClient({
117
+ opts: { store: client.telemetryEventStore }
118
+ });
119
+ let parsedArgs;
120
+ const flagsSpecification = getFlagsSpecification(setSubcommand.options);
121
+ try {
122
+ parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
123
+ } catch (err) {
124
+ printError(err);
125
+ return 1;
126
+ }
127
+ const { flags } = parsedArgs;
128
+ const [environmentArg, rateArg, ...pathArgs] = subcommandArguments(
129
+ parsedArgs.args
130
+ );
131
+ const pathArg = pathArgs[0];
132
+ telemetry.trackCliArgumentEnvironment(environmentArg);
133
+ telemetry.trackCliArgumentRate(rateArg);
134
+ telemetry.trackCliArgumentRequestPath(pathArg);
135
+ telemetry.trackCliOptionFormat(flags["--format"]);
136
+ telemetry.trackCliFlagJson(flags["--json"]);
137
+ telemetry.trackCliOptionProject(flags["--project"]);
138
+ if (environmentArg === void 0 || rateArg === void 0) {
139
+ output_manager_default.print(
140
+ help(setSubcommand, {
141
+ parent: { ...tracesCommand, name: "traces config" },
142
+ columns: client.stderr.columns
143
+ })
144
+ );
145
+ return 2;
146
+ }
147
+ if (pathArgs.length > 1) {
148
+ output_manager_default.error(`Too many arguments. Usage: ${getCommandName(USAGE)}`);
149
+ return 2;
150
+ }
151
+ if (!isRuleEnvironment(environmentArg)) {
152
+ return invalidArguments(
153
+ client,
154
+ `${ENVIRONMENT_ERROR} Received: ${environmentArg}`
155
+ );
156
+ }
157
+ const sampleRate = parseSampleRate(rateArg);
158
+ if (sampleRate === void 0) {
159
+ return invalidArguments(client, `${RATE_ERROR} Received: ${rateArg}`);
160
+ }
161
+ if (pathArg !== void 0 && pathArg.trim() === "") {
162
+ return invalidArguments(client, EMPTY_PATH_ERROR);
163
+ }
164
+ const formatResult = validateJsonOutput(flags);
165
+ if (!formatResult.valid) {
166
+ output_manager_default.error(formatResult.error);
167
+ return 1;
168
+ }
169
+ const asJson = formatResult.jsonOutput || client.nonInteractive;
170
+ const scope = await resolveConfigScope(client, {
171
+ project: flags["--project"]
172
+ });
173
+ if ("exitCode" in scope) {
174
+ return scope.exitCode;
175
+ }
176
+ const rule = {
177
+ environment: environmentArg,
178
+ requestPath: pathArg ?? null,
179
+ sampleRate
180
+ };
181
+ if (!asJson) {
182
+ output_manager_default.spinner("Updating trace sampling rules\u2026");
183
+ }
184
+ let project;
185
+ let tracing;
186
+ let entries;
187
+ try {
188
+ ({ project, tracing, entries } = await readProjectTracing({
189
+ client,
190
+ ...scope
191
+ }));
192
+ } catch (err) {
193
+ output_manager_default.stopSpinner();
194
+ return handleTracingApiError(client, err);
195
+ }
196
+ const existingIndex = entries.findIndex((entry) => hasSameKey(entry.row, rule));
197
+ const previous = existingIndex === -1 ? void 0 : entries[existingIndex].row;
198
+ const nextRules = existingIndex === -1 ? [...entries.map((entry) => entry.rule), toRule(rule)] : entries.map(
199
+ (entry, index) => index === existingIndex ? { ...entry.rule, rate: toApiRate(rule.sampleRate) } : entry.rule
200
+ );
201
+ if (nextRules.length > RULE_LIMIT) {
202
+ output_manager_default.stopSpinner();
203
+ return invalidArguments(
204
+ client,
205
+ `A project can have at most ${RULE_LIMIT} trace sampling rules, and ${project.name} already has ${entries.length}. Remove one with ${getCommandName("traces config rm <environment> [requestPath]")} first.`
206
+ );
207
+ }
208
+ try {
209
+ await writeSamplingRules({ client, ...scope, tracing, rules: nextRules });
210
+ } catch (err) {
211
+ output_manager_default.stopSpinner();
212
+ return handleTracingApiError(client, err);
213
+ }
214
+ output_manager_default.stopSpinner();
215
+ const target = formatRuleTarget(rule.environment, rule.requestPath);
216
+ const wasClause = previous ? ` (was ${formatRate(previous.sampleRate)})` : "";
217
+ const successLine = (subject) => `Set ${subject} to ${formatRate(rule.sampleRate)}${wasClause}. ${nextRules.length} of ${RULE_LIMIT} rules.`;
218
+ if (asJson) {
219
+ writeConfigJson(client, {
220
+ project,
221
+ bare: rule,
222
+ envelope: {
223
+ rule,
224
+ previousSampleRate: previous?.sampleRate ?? null,
225
+ ruleCount: nextRules.length,
226
+ ruleLimit: RULE_LIMIT
227
+ },
228
+ message: successLine(target),
229
+ next: [
230
+ {
231
+ command: getCommandNamePlain("traces config ls"),
232
+ when: "Read back every sampling rule"
233
+ }
234
+ ]
235
+ });
236
+ return 0;
237
+ }
238
+ output_manager_default.success(successLine(import_chalk.default.bold(target)));
239
+ return 0;
240
+ }
241
+ export {
242
+ set as default
243
+ };
@@ -14,12 +14,13 @@ import {
14
14
  AGENT_REASON,
15
15
  buildCommandWithGlobalFlags,
16
16
  outputAgentError
17
- } from "./chunk-TH2XUVDP.js";
18
- import "./chunk-SOFC4MLS.js";
17
+ } from "./chunk-NGGLYKNU.js";
18
+ import "./chunk-BMKU5KEL.js";
19
+ import "./chunk-Q2DGFCO7.js";
19
20
  import "./chunk-P4QNYOFB.js";
20
21
  import {
21
22
  output_manager_default
22
- } from "./chunk-OX7KI3LF.js";
23
+ } from "./chunk-QFAS4OVW.js";
23
24
  import "./chunk-S7KYDPEM.js";
24
25
  import "./chunk-TZ2YI2VH.js";
25
26
 
@@ -52,9 +53,9 @@ async function tags(client, argv, telemetry) {
52
53
  }
53
54
  switch (subcommand) {
54
55
  case "ls":
55
- return (await import("./ls-SXJFBLUT.js")).default(client, args, telemetry);
56
+ return (await import("./ls-3MH2OCP3.js")).default(client, args, telemetry);
56
57
  case "inspect":
57
- return (await import("./inspect-ZW5N6O5P.js")).default(client, args, telemetry);
58
+ return (await import("./inspect-RDMC2Z3Q.js")).default(client, args, telemetry);
58
59
  default:
59
60
  output_manager_default.error(`Unhandled tags subcommand: ${subcommand}`);
60
61
  return 1;
@@ -9,22 +9,26 @@ import {
9
9
  } from "./chunk-KXDWXXJH.js";
10
10
  import {
11
11
  typesSubcommand
12
- } from "./chunk-3KNPVXJ3.js";
12
+ } from "./chunk-4KD5BYHB.js";
13
13
  import {
14
- printError,
15
- table
16
- } from "./chunk-VAFU7DXZ.js";
14
+ printError
15
+ } from "./chunk-AYLY3ZVL.js";
17
16
  import {
18
17
  parseArguments
19
- } from "./chunk-XLKFJPMT.js";
18
+ } from "./chunk-57RHXXXG.js";
19
+ import {
20
+ table
21
+ } from "./chunk-RKDCNQ4S.js";
20
22
  import {
21
- getFlagsSpecification,
22
23
  isAPIError
23
- } from "./chunk-SOFC4MLS.js";
24
+ } from "./chunk-BMKU5KEL.js";
25
+ import {
26
+ getFlagsSpecification
27
+ } from "./chunk-Q2DGFCO7.js";
24
28
  import "./chunk-P4QNYOFB.js";
25
29
  import {
26
30
  output_manager_default
27
- } from "./chunk-OX7KI3LF.js";
31
+ } from "./chunk-QFAS4OVW.js";
28
32
  import {
29
33
  require_source
30
34
  } from "./chunk-S7KYDPEM.js";
@@ -8,47 +8,51 @@ import {
8
8
  parseCustomAlertQueryBody,
9
9
  resolveCustomAlertProjectName,
10
10
  setMissingCustomAlertProjectScope
11
- } from "./chunk-PD4DYNSB.js";
11
+ } from "./chunk-GZQQNLF5.js";
12
12
  import {
13
13
  emitRulesArgParseError,
14
14
  handleRulesApiError,
15
15
  parseRulesFlagsAndScope,
16
16
  rulesItemPath
17
- } from "./chunk-CHEZBD7H.js";
18
- import "./chunk-VCE6QKFE.js";
19
- import "./chunk-KQRVZWJU.js";
20
- import "./chunk-O5DLWLT7.js";
21
- import "./chunk-JKQWQA2T.js";
17
+ } from "./chunk-R5PULMHT.js";
18
+ import "./chunk-2O5J3KMT.js";
19
+ import "./chunk-3T7WSWZH.js";
20
+ import "./chunk-LXZVOR6F.js";
21
+ import "./chunk-AINIBIP4.js";
22
22
  import {
23
23
  validateJsonOutput
24
24
  } from "./chunk-KXDWXXJH.js";
25
25
  import {
26
26
  rulesUpdateSubcommand
27
- } from "./chunk-UMA66MKW.js";
28
- import "./chunk-HMJVUXE6.js";
29
- import "./chunk-CYNB6LL4.js";
27
+ } from "./chunk-XM3LOQIX.js";
28
+ import "./chunk-VJ5NAOWB.js";
29
+ import "./chunk-FXD67VN5.js";
30
+ import "./chunk-XNFHNTS2.js";
30
31
  import {
31
32
  AGENT_REASON,
32
33
  buildCommandWithGlobalFlags,
33
34
  outputAgentError
34
- } from "./chunk-TH2XUVDP.js";
35
+ } from "./chunk-NGGLYKNU.js";
35
36
  import "./chunk-GGP5R3FU.js";
36
37
  import {
37
38
  printError
38
- } from "./chunk-VAFU7DXZ.js";
39
+ } from "./chunk-AYLY3ZVL.js";
39
40
  import {
40
41
  parseArguments
41
- } from "./chunk-XLKFJPMT.js";
42
+ } from "./chunk-57RHXXXG.js";
43
+ import "./chunk-RKDCNQ4S.js";
44
+ import {
45
+ isAPIError
46
+ } from "./chunk-BMKU5KEL.js";
42
47
  import {
43
48
  getFlagsSpecification,
44
- isAPIError,
45
49
  packageName
46
- } from "./chunk-SOFC4MLS.js";
50
+ } from "./chunk-Q2DGFCO7.js";
47
51
  import "./chunk-P4QNYOFB.js";
48
52
  import "./chunk-52QYYTM5.js";
49
53
  import {
50
54
  output_manager_default
51
- } from "./chunk-OX7KI3LF.js";
55
+ } from "./chunk-QFAS4OVW.js";
52
56
  import "./chunk-S7KYDPEM.js";
53
57
  import "./chunk-TZ2YI2VH.js";
54
58
 
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Forked worker that runs a single builder's `build()` (and `diagnostics()`) in its own
3
+ * process for `vc build`. Running each build out-of-process gives it isolated stdout/stderr
4
+ * — which the parent pipes and can prefix per line with the service name — and isolated
5
+ * env, which is a prerequisite for running builds in parallel.
6
+ *
7
+ * This is modeled on the `vc dev` worker (../dev/builder-worker.cjs) and shares its IPC
8
+ * contract (`ready` / `build` / `buildResult`), but it serializes Lambda/EdgeFunction outputs
9
+ * by preserving their `files` map (as FileFsRef/FileBlob descriptors) instead of zipping them.
10
+ * `vc build`'s writeLambda relies on `lambda.files` for the FileFsRef-by-reference optimization,
11
+ * the `filePathMap`, and `standalone` symlink handling — all of which are lost if we ship only
12
+ * a `zipBuffer` the way the dev worker does.
13
+ *
14
+ * Like the dev worker, this file is copied verbatim into `dist` next to the compiled `build`
15
+ * command, so it must only `require` `@vercel/build-utils` and Node built-ins.
16
+ */
17
+ const { FileFsRef, Span } = require('@vercel/build-utils');
18
+ const fs = require('node:fs');
19
+ const path = require('node:path');
20
+ const os = require('node:os');
21
+ const crypto = require('node:crypto');
22
+
23
+ // Trace events produced by the builder's own spans (children of buildOptions.span) are collected
24
+ // here and shipped back to the parent, which reports them under its `vc.builder` span so forked
25
+ // builds keep full trace fidelity. Included on both success and error messages so a failed build
26
+ // still contributes the spans it managed to record. Emptied after each send so a later phase
27
+ // (the deferred pre-deploy step) ships only the events it newly recorded.
28
+ let collectedTraceEvents = [];
29
+ const traceReporter = { report: event => collectedTraceEvents.push(event) };
30
+ // Take the events collected so far and reset the buffer, so the next send starts fresh.
31
+ function drainTraceEvents() {
32
+ const events = collectedTraceEvents;
33
+ collectedTraceEvents = [];
34
+ return events;
35
+ }
36
+
37
+ // Above this size a FileBlob's Buffer is written to a temp file rather than sent inline over
38
+ // IPC. Even under structured-clone serialization the whole Buffer is copied into a single IPC
39
+ // message; spilling very large blobs to disk bounds that per-message memory spike.
40
+ const BLOB_FILE_THRESHOLD = 256 * 1024 * 1024; // 256MB
41
+
42
+ process.on('unhandledRejection', err => {
43
+ // biome-ignore lint/suspicious/noConsole: intentional console usage
44
+ console.error('Exiting builder due to build error:');
45
+ // biome-ignore lint/suspicious/noConsole: intentional console usage
46
+ console.error(err);
47
+ process.exit(1);
48
+ });
49
+
50
+ // A builder may register a pre-deploy callback during build(). The CLI runs pre-deploys only
51
+ // after every build succeeds, so we hold the callback here and run it when the parent sends a
52
+ // `runPreDeploy` message, keeping the builder-computed env the callback captured.
53
+ let preDeployCallback;
54
+
55
+ // Key under which processMessage stashes the diagnostics it collected for a build that threw, so
56
+ // the error path in onMessage can ship them. A Symbol, so `serializeError` (which copies own
57
+ // property *names*) can't fold it into the error the parent writes into builds.json.
58
+ const DIAGNOSTICS = Symbol('diagnostics');
59
+
60
+ process.on('message', onMessage);
61
+
62
+ // Convert an Error into a plain object with all its properties enumerable. Structured-clone IPC
63
+ // reconstructs a native Error but keeps only `name`/`message`/`stack` — custom props a builder
64
+ // sets (e.g. NowBuildError's `code`/`link`, which the parent writes into builds.json) would be
65
+ // dropped. A plain object clones losslessly; the parent rebuilds an Error from it.
66
+ function serializeError(err) {
67
+ if (!err || typeof err !== 'object') return err;
68
+ const plain = { name: err.name, message: err.message, stack: err.stack };
69
+ for (const key of Object.getOwnPropertyNames(err)) {
70
+ plain[key] = err[key];
71
+ }
72
+ return plain;
73
+ }
74
+
75
+ function onMessage(message) {
76
+ if (message && message.type === 'runPreDeploy') {
77
+ runPreDeploy();
78
+ return;
79
+ }
80
+ processMessage(message).catch(err => {
81
+ process.removeListener('message', onMessage);
82
+ process.send(
83
+ {
84
+ type: 'buildResult',
85
+ error: serializeError(err),
86
+ // A failed build is exactly when diagnostics matter most, so ship whatever the builder
87
+ // recorded before it threw. `processMessage` collects them in a `finally` and stashes
88
+ // them on the error (see DIAGNOSTICS) on its way out.
89
+ diagnostics: err?.[DIAGNOSTICS],
90
+ traceEvents: drainTraceEvents(),
91
+ },
92
+ () => process.exit(1)
93
+ );
94
+ });
95
+ }
96
+
97
+ function runPreDeploy() {
98
+ Promise.resolve()
99
+ .then(() => preDeployCallback?.())
100
+ .then(
101
+ () =>
102
+ process.send(
103
+ { type: 'preDeployResult', traceEvents: drainTraceEvents() },
104
+ () => process.exit(0)
105
+ ),
106
+ err => {
107
+ process.send(
108
+ {
109
+ type: 'preDeployResult',
110
+ error: serializeError(err),
111
+ traceEvents: drainTraceEvents(),
112
+ },
113
+ () => process.exit(1)
114
+ );
115
+ }
116
+ );
117
+ }
118
+
119
+ // Re-prototype a plain object sent over IPC back into a FileFsRef instance.
120
+ function rehydrateFile(obj) {
121
+ return Object.assign(Object.create(FileFsRef.prototype), obj);
122
+ }
123
+
124
+ // Serialize a Files map for transport. FileFsRef entries are cheap path references and pass
125
+ // through as-is; FileBlob entries carry a Buffer, which is left inline unless it exceeds the
126
+ // threshold, in which case it is spilled to a temp file the parent reads and unlinks.
127
+ function serializeFiles(files) {
128
+ if (!files) return files;
129
+ for (const name of Object.keys(files)) {
130
+ const file = files[name];
131
+ if (file && file.type === 'FileBlob' && Buffer.isBuffer(file.data)) {
132
+ if (file.data.length > BLOB_FILE_THRESHOLD) {
133
+ const tmp = path.join(
134
+ os.tmpdir(),
135
+ `vercel-build-blob-${crypto.randomBytes(8).toString('hex')}`
136
+ );
137
+ fs.writeFileSync(tmp, file.data);
138
+ file.dataPath = tmp;
139
+ delete file.data;
140
+ }
141
+ }
142
+ }
143
+ return files;
144
+ }
145
+
146
+ // Collect diagnostics from the same builder instance that just built. diagnostics() returns a
147
+ // Files map (e.g. { 'package-manifest.json': FileBlob }); serialize it like build outputs so the
148
+ // parent can validate/write it. Traced here in the worker (the span rides back with the rest), and
149
+ // failures must not propagate — diagnostics are best-effort and never fail (or mask) a build.
150
+ async function collectDiagnostics(builder, buildOptions) {
151
+ try {
152
+ const diagnostics = await buildOptions.span
153
+ .child('vc.builder.diagnostics')
154
+ .trace(
155
+ async () => (await builder.diagnostics?.(buildOptions)) || undefined
156
+ );
157
+ if (diagnostics) serializeFiles(diagnostics);
158
+ return diagnostics;
159
+ } catch (err) {
160
+ // Surface to the worker's stderr (piped/inherited to the parent) but don't fail the build.
161
+ // biome-ignore lint/suspicious/noConsole: intentional console usage
162
+ console.error(`[vc] collecting diagnostics failed: ${err}`);
163
+ return undefined;
164
+ }
165
+ }
166
+
167
+ async function processMessage(message) {
168
+ const { requirePath, buildOptions, expectsPreDeploy } = message;
169
+ const builder = require(requirePath);
170
+
171
+ // `files` arrive as plain objects — turn them back into FileFsRef instances the builder expects.
172
+ for (const name of Object.keys(buildOptions.files)) {
173
+ buildOptions.files[name] = rehydrateFile(buildOptions.files[name]);
174
+ }
175
+
176
+ // Give the builder a span backed by our collecting reporter so the child spans it records are
177
+ // shipped back to the parent. The parent dropped the real Span (a class instance can't cross
178
+ // IPC), so we reconstruct one here; it has no parent id — the parent reparents this root under
179
+ // its own `vc.builder` span via Span.reportChildEvents when the events are reported.
180
+ buildOptions.span = new Span({
181
+ name: 'vc.builder.worker',
182
+ reporter: traceReporter,
183
+ });
184
+
185
+ // Capture any pre-deploy callback the builder registers during build(); the parent triggers
186
+ // it later via a `runPreDeploy` message. Only wired when the parent said a pre-deploy command
187
+ // is configured for this build.
188
+ if (expectsPreDeploy) {
189
+ buildOptions.registerPreDeploy = callback => {
190
+ preDeployCallback = callback;
191
+ };
192
+ }
193
+
194
+ // Build in a try/finally so diagnostics are collected on both outcomes, mirroring `doBuild`'s
195
+ // handling on the in-process path: a build that threw is exactly when its diagnostics matter
196
+ // most.
197
+ let result;
198
+ let diagnostics;
199
+ let buildError;
200
+ try {
201
+ result = await builder.build(buildOptions);
202
+ } catch (err) {
203
+ buildError = err;
204
+ throw err;
205
+ } finally {
206
+ diagnostics = await collectDiagnostics(builder, buildOptions);
207
+ // A failed build has no result message to carry the diagnostics, so stash them on the error
208
+ // for `onMessage` to ship. Symbol-keyed, so `serializeError` (which copies own property
209
+ // *names*) can't fold them into the error the parent writes into builds.json.
210
+ if (buildError && typeof buildError === 'object') {
211
+ Object.defineProperty(buildError, DIAGNOSTICS, { value: diagnostics });
212
+ }
213
+ // Stop the worker root span so it (and its recorded children) are collected before the events
214
+ // are drained and shipped for the parent to report under its `vc.builder` span.
215
+ buildOptions.span.stop();
216
+ }
217
+
218
+ // Locate the concrete V2/V3 result and its version WITHOUT unwrapping the wire payload:
219
+ // the parent (and writeBuildResult) still expect a BuildResultVX wrapper for
220
+ // `builder.version === -1` builders, so we serialize the inner outputs in place and send
221
+ // the original `result` back untouched in shape.
222
+ let effectiveVersion = builder.version;
223
+ let concrete = result;
224
+ if (builder.version === -1) {
225
+ effectiveVersion = result.resultVersion;
226
+ concrete = result.result;
227
+ }
228
+
229
+ // The IPC channel uses `serialization: 'advanced'` (V8 structured clone), which preserves
230
+ // Buffers, cycles (e.g. `@vercel/next`'s `result.childProcesses`), and shared object identity
231
+ // — the same Lambda referenced by many V2 keys or many `Prerender.lambda` fields arrives as
232
+ // ONE instance, which writeBuildResult relies on for symlink dedup. So the only remaining job
233
+ // here is spilling oversized FileBlob Buffers to temp files (see serializeFiles). We still walk
234
+ // every reachable `files` map, using `seen` so a shared Lambda is spilled at most once.
235
+ const seen = new Set();
236
+ const serializeOutput = output => {
237
+ if (!output || typeof output !== 'object' || seen.has(output)) return;
238
+ seen.add(output);
239
+ if (output.type === 'Lambda' || output.type === 'EdgeFunction') {
240
+ serializeFiles(output.files);
241
+ } else if (output.type === 'Prerender') {
242
+ // Prerender wraps a `lambda` (with its own `files`) and a `fallback` file.
243
+ if (output.lambda) serializeOutput(output.lambda);
244
+ if (output.fallback) serializeFiles({ fallback: output.fallback });
245
+ }
246
+ };
247
+
248
+ // Build Output API results (`{ buildOutputPath }`) have no in-memory `output` to serialize —
249
+ // their outputs live on disk and the parent reads them from there.
250
+ if (concrete.output) {
251
+ if (effectiveVersion === 3) {
252
+ serializeOutput(concrete.output);
253
+ } else {
254
+ for (const value of Object.values(concrete.output)) {
255
+ serializeOutput(value);
256
+ }
257
+ }
258
+ }
259
+
260
+ // With a pending pre-deploy the worker stays alive to run the callback (which holds the
261
+ // builder-computed env) when the parent later sends `runPreDeploy`; the parent tears the
262
+ // worker down once done. Without one, the parent kills the worker as soon as it has the result.
263
+ // Drain the collected events here so the deferred pre-deploy step ships only what it records.
264
+ const hasPreDeploy = Boolean(preDeployCallback);
265
+ process.send({
266
+ type: 'buildResult',
267
+ result,
268
+ // The concrete result's shape (single V3 output vs. a V2 map of named outputs) can't be
269
+ // inferred reliably from the payload — a V2 map may legitimately hold a key named `type`
270
+ // — so tell the parent which one it is instead of making it guess.
271
+ outputVersion: effectiveVersion,
272
+ diagnostics,
273
+ hasPreDeploy,
274
+ // Builders share state through `meta` (e.g. runNpmInstall's dedup set). This worker had a
275
+ // structured-clone copy, so send it back for the parent to merge into the shared meta.
276
+ meta: buildOptions.meta,
277
+ traceEvents: drainTraceEvents(),
278
+ });
279
+ }
280
+
281
+ process.send({ type: 'ready' });