vercel 59.11.7 → 59.13.1

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 (125) hide show
  1. package/dist/chunks/{add-WU2QYHYL.js → add-7OX6PBFD.js} +3 -3
  2. package/dist/chunks/add-7RYUFBZ3.js +221 -0
  3. package/dist/chunks/{add-KSJQYR5C.js → add-FX5WWUXU.js} +3 -3
  4. package/dist/chunks/{build-F3J6FLPD.js → build-Q3TR46K4.js} +3 -3
  5. package/dist/chunks/{chunk-N4QHMXOO.js → chunk-2GXA4NGG.js} +3 -2
  6. package/dist/chunks/{chunk-CNDPIHY5.js → chunk-2QFYCMKN.js} +24 -19
  7. package/dist/chunks/{chunk-7KROIXQM.js → chunk-3FIEWWMM.js} +3 -3
  8. package/dist/chunks/{chunk-OIH6FP5Y.js → chunk-4TUMNBEE.js} +2 -2
  9. package/dist/chunks/{chunk-FVT74RZ5.js → chunk-5JDX6XOS.js} +11 -11
  10. package/dist/chunks/{chunk-WL6QYSGD.js → chunk-5ORMFNXL.js} +586 -41
  11. package/dist/chunks/{chunk-C762AAVU.js → chunk-66LPM47Z.js} +4 -4
  12. package/dist/chunks/{chunk-4IVSM24H.js → chunk-76CB3CF2.js} +1 -1
  13. package/dist/chunks/{chunk-2TSBB22D.js → chunk-7F5RNOTP.js} +2 -2
  14. package/dist/chunks/{chunk-UARGTFCT.js → chunk-7NRNFV77.js} +1 -1
  15. package/dist/chunks/chunk-DQ23J2KG.js +305 -0
  16. package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
  17. package/dist/chunks/{chunk-Z7JWYFOY.js → chunk-EEV2LKFC.js} +1 -1
  18. package/dist/chunks/{chunk-DSTNNQVV.js → chunk-EIBH6FCR.js} +3 -3
  19. package/dist/chunks/chunk-F4S6Q4OY.js +79 -0
  20. package/dist/chunks/chunk-GDOUDU6O.js +74 -0
  21. package/dist/chunks/{chunk-DBYHS3CK.js → chunk-GQRG7VFK.js} +2 -2
  22. package/dist/chunks/{chunk-GCVXKRR5.js → chunk-HD4DR3DA.js} +1 -0
  23. package/dist/chunks/{chunk-DWIC7MRV.js → chunk-HKHXKSXQ.js} +1 -1
  24. package/dist/chunks/{chunk-ZBEECGFD.js → chunk-HM24ZWQL.js} +1 -1
  25. package/dist/chunks/{chunk-GHKJAK5V.js → chunk-IK6PC2JA.js} +4 -4
  26. package/dist/chunks/{chunk-A5JZS6ZN.js → chunk-IUC3TR3S.js} +1 -1
  27. package/dist/chunks/{chunk-VYC45Q4Z.js → chunk-JIK2FUMT.js} +1 -1
  28. package/dist/chunks/{chunk-TGNEG57M.js → chunk-KU2WCB6G.js} +110 -14
  29. package/dist/chunks/{chunk-FVNJTRCE.js → chunk-KXTXGYG7.js} +2 -2
  30. package/dist/chunks/{chunk-QOPTXV4G.js → chunk-L4H3DP65.js} +1 -1
  31. package/dist/chunks/{chunk-FL4JLNT2.js → chunk-LE5V7G2U.js} +2 -2
  32. package/dist/chunks/chunk-LVCCV2YJ.js +324 -0
  33. package/dist/chunks/{chunk-SHFNEZVI.js → chunk-MUGF3SGQ.js} +1 -1
  34. package/dist/chunks/{chunk-G3PXSXIB.js → chunk-N6HP5BLI.js} +5 -3
  35. package/dist/chunks/{chunk-EZQDYIVB.js → chunk-NSGRICJ2.js} +1 -1
  36. package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
  37. package/dist/chunks/{chunk-X7DBBZQD.js → chunk-QRFRS2JH.js} +1 -1
  38. package/dist/chunks/{chunk-PFM75KY3.js → chunk-QSJ6Q5QP.js} +3 -3
  39. package/dist/chunks/{chunk-XD4DCYMX.js → chunk-S3HYE6ZE.js} +2 -2
  40. package/dist/chunks/{chunk-QHS645AZ.js → chunk-SPRQ4IBQ.js} +3 -3
  41. package/dist/chunks/{chunk-NSOYO6JQ.js → chunk-T3NB7VQG.js} +6 -6
  42. package/dist/chunks/{chunk-PJXMXMCO.js → chunk-TLPHZ7M4.js} +2 -2
  43. package/dist/chunks/{chunk-EPOLDWRA.js → chunk-TOXZAP5I.js} +1 -1
  44. package/dist/chunks/{chunk-XIFATBH5.js → chunk-U4ZLWJQD.js} +4 -4
  45. package/dist/chunks/{chunk-CEDN47PH.js → chunk-UXKNSAP2.js} +1 -1
  46. package/dist/chunks/{chunk-GUU4Z2AQ.js → chunk-XEVKGAVI.js} +6 -6
  47. package/dist/chunks/{chunk-VT3Z7HF6.js → chunk-Z6YZMXVN.js} +4 -4
  48. package/dist/chunks/{clear-XUQO4ZTK.js → clear-GIAFWC5X.js} +3 -3
  49. package/dist/chunks/{compile-vercel-config-D3ARNHTN.js → compile-vercel-config-QJGEQKK4.js} +2 -2
  50. package/dist/chunks/{config-MEDLXUVM.js → config-AOA2HS4R.js} +3 -3
  51. package/dist/chunks/{config-37OAE7QJ.js → config-HYBSW733.js} +7 -7
  52. package/dist/chunks/config-validator.mjs +1 -1
  53. package/dist/chunks/{delete-VSWDZ2SW.js → delete-BBFI75A2.js} +5 -5
  54. package/dist/chunks/{delete-3N3YZZOF.js → delete-DJ7RI2NX.js} +5 -5
  55. package/dist/chunks/{detect-services-TESZCQWG.js → detect-services-Q2DVXVMH.js} +6 -6
  56. package/dist/chunks/{disable-A4FLFMC7.js → disable-P7X2V5LS.js} +5 -5
  57. package/dist/chunks/{discard-CHGFULBZ.js → discard-JNQBH4XU.js} +5 -5
  58. package/dist/chunks/{edit-JZ63AJYQ.js → edit-AXQEMBQC.js} +5 -5
  59. package/dist/chunks/{edit-MHSYAPDR.js → edit-BO3GXEKA.js} +6 -6
  60. package/dist/chunks/{enable-KD46SEC5.js → enable-NC4BN7EQ.js} +5 -5
  61. package/dist/chunks/{export-42QZLBSN.js → export-HQ42UNYD.js} +5 -5
  62. package/dist/chunks/{image-GP4H73A2.js → image-UM4FQYOA.js} +3 -3
  63. package/dist/chunks/{import-builders-6TBLMPL2.js → import-builders-F6SWNCHK.js} +4 -4
  64. package/dist/chunks/{inspect-MUVK6MMT.js → inspect-EXEA57MP.js} +3 -3
  65. package/dist/chunks/{inspect-5FMWMY3C.js → inspect-H3M3XJNB.js} +10 -10
  66. package/dist/chunks/{inspect-QFXAOUL4.js → inspect-MTNQOLNM.js} +3 -3
  67. package/dist/chunks/{inspect-RNTSYM6O.js → inspect-PYFF2K4X.js} +3 -3
  68. package/dist/chunks/{inspect-Q3DWW7MC.js → inspect-XF324IQ2.js} +9 -9
  69. package/dist/chunks/{list-JRNWLSO5.js → list-4JHZJUBS.js} +2 -2
  70. package/dist/chunks/{list-IHHIPXEC.js → list-YEN54SGY.js} +6 -6
  71. package/dist/chunks/{list-XHD5DLEX.js → list-ZKD2O4D2.js} +7 -7
  72. package/dist/chunks/{login-PCT6KFWY.js → login-56KGZQI2.js} +3 -3
  73. package/dist/chunks/{ls-SVOHC3XW.js → ls-ELYVF6EU.js} +4 -4
  74. package/dist/chunks/{ls-PQZ2RIDX.js → ls-HZEMZY2R.js} +4 -4
  75. package/dist/chunks/{ls-TGHCCARZ.js → ls-IJW74NG3.js} +4 -4
  76. package/dist/chunks/{ls-GPEHEFCF.js → ls-OAGYLILX.js} +4 -4
  77. package/dist/chunks/{ls-VRIH5WA3.js → ls-QNTHMTIH.js} +7 -7
  78. package/dist/chunks/ls-WW5UFH5B.js +204 -0
  79. package/dist/chunks/{open-E7DEKYDU.js → open-D2E5TEKN.js} +5 -5
  80. package/dist/chunks/{permissions-JKOONWVL.js → permissions-CFUXWXSK.js} +4 -4
  81. package/dist/chunks/{publish-EDDELDE5.js → publish-BP4IUYNM.js} +5 -5
  82. package/dist/chunks/{pull-646WEVDE.js → pull-DL72B6RW.js} +7 -7
  83. package/dist/chunks/{push-LTNW5OVD.js → push-6YCS4YQW.js} +3 -3
  84. package/dist/chunks/{query-LU4N6KPO.js → query-7N3YB4LE.js} +7 -7
  85. package/dist/chunks/{reorder-22PKJMZP.js → reorder-YJN36TPT.js} +5 -5
  86. package/dist/chunks/{reply-SF2EZMVZ.js → reply-3U3O7LNG.js} +5 -5
  87. package/dist/chunks/{resolve-ZCZGXTOT.js → resolve-TT75WCWT.js} +5 -5
  88. package/dist/chunks/{restore-VJAWZXB4.js → restore-6UF6W23A.js} +5 -5
  89. package/dist/chunks/rm-3QIDFPVA.js +162 -0
  90. package/dist/chunks/{rm-WNPGTUBH.js → rm-6MJ7ZPXQ.js} +3 -3
  91. package/dist/chunks/{rm-KVEAJPRE.js → rm-JZRS2NBH.js} +3 -3
  92. package/dist/chunks/{rm-OSZ5FZUM.js → rm-KI4W2HYP.js} +7 -7
  93. package/dist/chunks/{rm-KN2QFCKO.js → rm-QCQXVB54.js} +3 -3
  94. package/dist/chunks/rule-inspect-PX73J52Q.js +123 -0
  95. package/dist/chunks/{rules-65LKAQ35.js → rules-Q334NBUC.js} +7 -7
  96. package/dist/chunks/schema-GRTOHAZO.js +381 -0
  97. package/dist/chunks/{schema-NXCW4M75.js → schema-YV3XYL3A.js} +6 -6
  98. package/dist/chunks/{set-FYJVKMPV.js → set-J3AQKL6V.js} +7 -7
  99. package/dist/chunks/{setup-and-link-KXPZE32P.js → setup-and-link-R5N7WJ46.js} +16 -16
  100. package/dist/chunks/{tags-ANIRP5E3.js → tags-2VLJ4VIH.js} +2 -2
  101. package/dist/chunks/update-VMS45VF2.js +224 -0
  102. package/dist/chunks/vlt-builder-importer-USCFHWPL.js +322 -0
  103. package/dist/commands/build/index.js +19 -19
  104. package/dist/commands/deploy/index.js +19 -19
  105. package/dist/commands/dev/index.js +25 -25
  106. package/dist/commands/env/index.js +12 -12
  107. package/dist/commands/link/index.js +12 -12
  108. package/dist/commands/list/index.js +5 -5
  109. package/dist/commands-bulk.js +11343 -4386
  110. package/dist/help.js +1 -1
  111. package/dist/index.js +28 -18
  112. package/dist/runtime-assets/node-preloads/next-dev-websocket.cjs +6 -0
  113. package/dist/version.mjs +1 -1
  114. package/package.json +52 -48
  115. package/dist/chunks/add-PERLOALD.js +0 -233
  116. package/dist/chunks/chunk-5GGUB4EO.js +0 -31
  117. package/dist/chunks/chunk-ARU7VBKR.js +0 -144
  118. package/dist/chunks/chunk-KEKR7OCB.js +0 -140
  119. package/dist/chunks/chunk-MXLA3VQS.js +0 -20
  120. package/dist/chunks/chunk-QKX7WKIN.js +0 -98
  121. package/dist/chunks/ls-PF7F4PP4.js +0 -197
  122. package/dist/chunks/rm-W722Q2AO.js +0 -173
  123. package/dist/chunks/rule-inspect-25Z6SNX3.js +0 -285
  124. package/dist/chunks/schema-7D6IGJEJ.js +0 -429
  125. package/dist/chunks/update-UT6CTKVG.js +0 -246
@@ -0,0 +1,224 @@
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
+ printRuleMutationReceipt
9
+ } from "./chunk-DQ23J2KG.js";
10
+ import "./chunk-GDOUDU6O.js";
11
+ import {
12
+ emitRulesArgParseError,
13
+ fetchRule,
14
+ handleRulesApiError,
15
+ outputRulesError,
16
+ readRuleBody,
17
+ resolveRulesProject,
18
+ resolveRulesTeam,
19
+ rulesItemPath
20
+ } from "./chunk-LVCCV2YJ.js";
21
+ import "./chunk-2GXA4NGG.js";
22
+ import "./chunk-GZLPFESR.js";
23
+ import "./chunk-A3NYPUKZ.js";
24
+ import "./chunk-KFWQ3EFH.js";
25
+ import "./chunk-FGDKMNEN.js";
26
+ import "./chunk-PRWJUY5U.js";
27
+ import "./chunk-XEVKGAVI.js";
28
+ import "./chunk-AINIBIP4.js";
29
+ import "./chunk-EEV2LKFC.js";
30
+ import "./chunk-ND5CF2H3.js";
31
+ import {
32
+ validateJsonOutput
33
+ } from "./chunk-KXDWXXJH.js";
34
+ import "./chunk-V4RMJKQP.js";
35
+ import {
36
+ rulesUpdateSubcommand
37
+ } from "./chunk-EDMW7SBH.js";
38
+ import "./chunk-N6HP5BLI.js";
39
+ import "./chunk-P7VSBDR4.js";
40
+ import "./chunk-L4H3DP65.js";
41
+ import "./chunk-ZDU2NODC.js";
42
+ import "./chunk-PEC3CQSK.js";
43
+ import "./chunk-GGP5R3FU.js";
44
+ import "./chunk-VUS2JQB2.js";
45
+ import "./chunk-GQRG7VFK.js";
46
+ import "./chunk-HRXRELD3.js";
47
+ import "./chunk-B5XLQKHI.js";
48
+ import "./chunk-76CB3CF2.js";
49
+ import "./chunk-XNIZGCN5.js";
50
+ import "./chunk-NW34PW6V.js";
51
+ import {
52
+ printError
53
+ } from "./chunk-3VM7HWF6.js";
54
+ import {
55
+ parseArguments
56
+ } from "./chunk-57RHXXXG.js";
57
+ import "./chunk-7F5RNOTP.js";
58
+ import "./chunk-G5FBSUL4.js";
59
+ import "./chunk-26CU4Q3C.js";
60
+ import "./chunk-XPJLPUKO.js";
61
+ import {
62
+ isAPIError
63
+ } from "./chunk-CV5YC2EN.js";
64
+ import {
65
+ getFlagsSpecification,
66
+ packageName
67
+ } from "./chunk-Q2DGFCO7.js";
68
+ import {
69
+ output_manager_default
70
+ } from "./chunk-2JIX6UMI.js";
71
+ import "./chunk-P4QNYOFB.js";
72
+ import "./chunk-ZW6HETRE.js";
73
+ import "./chunk-S7KYDPEM.js";
74
+ import "./chunk-TZ2YI2VH.js";
75
+
76
+ // src/commands/alerts/rules/update.ts
77
+ function sameScope(left, right) {
78
+ return JSON.stringify(left) === JSON.stringify(right);
79
+ }
80
+ function scopeForRule(client, type, scope, flags, jsonOutput) {
81
+ if (flags["--project"]) {
82
+ return type === "custom" ? { type: "project", projectId: scope.projectId } : { type: "include", projectIds: [scope.projectId] };
83
+ }
84
+ if (type === "custom") {
85
+ return outputRulesError(
86
+ client,
87
+ jsonOutput,
88
+ "INVALID_SCOPE",
89
+ "Custom alert rules must target one project. Use --project <name-or-id>."
90
+ );
91
+ }
92
+ return { type: "all" };
93
+ }
94
+ async function resolveUpdateScope(client, flags, jsonOutput, ruleId) {
95
+ if (flags["--project"] && flags["--all"]) {
96
+ return outputRulesError(
97
+ client,
98
+ jsonOutput,
99
+ "MUTUAL_EXCLUSIVITY",
100
+ "Cannot specify both --all and --project. Use one or the other."
101
+ );
102
+ }
103
+ return flags["--project"] ? resolveRulesProject(
104
+ client,
105
+ flags["--project"],
106
+ jsonOutput,
107
+ `alerts rules update ${ruleId}`
108
+ ) : resolveRulesTeam(client, jsonOutput);
109
+ }
110
+ function writeRuleResult(client, jsonOutput, action, rule) {
111
+ if (jsonOutput) {
112
+ client.stdout.write(`${JSON.stringify({ rule }, null, 2)}
113
+ `);
114
+ } else {
115
+ printRuleMutationReceipt(action, rule, client.argv);
116
+ }
117
+ }
118
+ async function update(client, argv) {
119
+ let parsedArgs;
120
+ try {
121
+ parsedArgs = parseArguments(
122
+ argv,
123
+ getFlagsSpecification(rulesUpdateSubcommand.options)
124
+ );
125
+ } catch (error) {
126
+ emitRulesArgParseError(
127
+ client,
128
+ error,
129
+ "alerts rules update <rule-id> --project <name-or-id>"
130
+ );
131
+ printError(error);
132
+ return 1;
133
+ }
134
+ const flags = parsedArgs.flags;
135
+ const format = validateJsonOutput(flags);
136
+ if (!format.valid) {
137
+ return outputRulesError(client, false, "INVALID_ARGUMENTS", format.error);
138
+ }
139
+ const ruleId = parsedArgs.args[0];
140
+ if (!ruleId) {
141
+ return outputRulesError(
142
+ client,
143
+ format.jsonOutput,
144
+ "MISSING_ARGUMENTS",
145
+ `Missing rule ID. Example: ${packageName} alerts rules update <rule-id> --body <file>`
146
+ );
147
+ }
148
+ const hasScopeFlag = Boolean(flags["--project"] || flags["--all"]);
149
+ if (!flags["--body"] && !hasScopeFlag) {
150
+ return outputRulesError(
151
+ client,
152
+ format.jsonOutput,
153
+ "MISSING_ARGUMENTS",
154
+ "Provide --body <PATH>, --project <name-or-id>, or --all."
155
+ );
156
+ }
157
+ const body = flags["--body"] ? readRuleBody(client, flags["--body"], format.jsonOutput) : {};
158
+ if (typeof body === "number")
159
+ return body;
160
+ if (Object.hasOwn(body, "type") && body.type !== "built-in" && body.type !== "custom") {
161
+ return outputRulesError(
162
+ client,
163
+ format.jsonOutput,
164
+ "INVALID_RULE_TYPE",
165
+ "When provided, update body type must be built-in or custom."
166
+ );
167
+ }
168
+ if (hasScopeFlag && Object.hasOwn(body, "ruleScope")) {
169
+ return outputRulesError(
170
+ client,
171
+ format.jsonOutput,
172
+ "SCOPE_CONFLICT",
173
+ "Specify rule scope either in the body or with --project/--all, not both."
174
+ );
175
+ }
176
+ const scope = await resolveUpdateScope(
177
+ client,
178
+ flags,
179
+ format.jsonOutput,
180
+ ruleId
181
+ );
182
+ if (typeof scope === "number")
183
+ return scope;
184
+ try {
185
+ let existing;
186
+ if (hasScopeFlag) {
187
+ output_manager_default.spinner("Fetching alert rule\u2026");
188
+ existing = await fetchRule(client, scope, ruleId);
189
+ const desiredScope = scopeForRule(
190
+ client,
191
+ existing.type,
192
+ scope,
193
+ flags,
194
+ format.jsonOutput
195
+ );
196
+ if (typeof desiredScope === "number")
197
+ return desiredScope;
198
+ if (!sameScope(existing.ruleScope, desiredScope)) {
199
+ body.ruleScope = desiredScope;
200
+ } else if (Object.keys(body).length === 0) {
201
+ output_manager_default.stopSpinner();
202
+ writeRuleResult(client, format.jsonOutput, "Unchanged", existing);
203
+ return 0;
204
+ }
205
+ }
206
+ output_manager_default.spinner("Updating alert rule\u2026");
207
+ const response = await client.fetch(
208
+ rulesItemPath(scope.teamId, ruleId),
209
+ { method: "PATCH", body }
210
+ );
211
+ writeRuleResult(client, format.jsonOutput, "Updated", response.rule);
212
+ return 0;
213
+ } catch (error) {
214
+ if (isAPIError(error)) {
215
+ return handleRulesApiError(client, error, format.jsonOutput);
216
+ }
217
+ throw error;
218
+ } finally {
219
+ output_manager_default.stopSpinner();
220
+ }
221
+ }
222
+ export {
223
+ update as default
224
+ };
@@ -0,0 +1,322 @@
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 "./chunk-TZ2YI2VH.js";
8
+
9
+ // src/builders/vlt-builder-importer.ts
10
+ import { createHash, randomBytes } from "crypto";
11
+ import {
12
+ link,
13
+ lstat,
14
+ mkdir,
15
+ open,
16
+ readFile,
17
+ rename,
18
+ rm,
19
+ unlink,
20
+ writeFile
21
+ } from "fs/promises";
22
+ import { join } from "path";
23
+ import { install } from "@vltpkg/graph";
24
+ import { PackageInfoClient } from "@vltpkg/package-info";
25
+ import { PackageJson } from "@vltpkg/package-json";
26
+ import { getCachePath } from "@vercel/cli-config";
27
+ import { PathScurry } from "path-scurry";
28
+ var LOCK_RETRY_MS = 50;
29
+ var LOCK_WAIT_MS = 5 * 60 * 1e3;
30
+ var LOCK_EMPTY_GRACE_MS = 1e3;
31
+ var TARBALL_FETCH_TIMEOUT_MS = 2 * 60 * 1e3;
32
+ var activeInstallations = /* @__PURE__ */ new Map();
33
+ function compareKeys(a, b) {
34
+ return a < b ? -1 : a > b ? 1 : 0;
35
+ }
36
+ function canonicalize(value) {
37
+ if (Array.isArray(value))
38
+ return value.map(canonicalize);
39
+ if (value && typeof value === "object") {
40
+ return Object.fromEntries(
41
+ Object.entries(value).sort(([a], [b]) => compareKeys(a, b)).map(([key, child]) => [key, canonicalize(child)])
42
+ );
43
+ }
44
+ return value;
45
+ }
46
+ function validateGraph(graph) {
47
+ const { hash, ...contents } = graph;
48
+ const actual = createHash("sha256").update(JSON.stringify(canonicalize(contents))).digest("hex");
49
+ if (actual !== hash) {
50
+ throw new Error(
51
+ `The embedded vlt Builder graph for ${graph.name} is invalid.`
52
+ );
53
+ }
54
+ }
55
+ async function wait(ms) {
56
+ await new Promise((resolve) => setTimeout(resolve, ms));
57
+ }
58
+ function hasErrorCode(error, code) {
59
+ return error instanceof Error && "code" in error && error.code === code;
60
+ }
61
+ function isProcessAlive(pid) {
62
+ try {
63
+ process.kill(pid, 0);
64
+ return true;
65
+ } catch (error) {
66
+ return hasErrorCode(error, "EPERM");
67
+ }
68
+ }
69
+ async function isLockHolderAlive(path) {
70
+ try {
71
+ const pid = Number.parseInt((await readFile(path, "utf8")).trim(), 10);
72
+ return Number.isInteger(pid) && pid > 0 && isProcessAlive(pid);
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+ async function tryStealStaleLock(path, emptyGraceMs) {
78
+ let first;
79
+ try {
80
+ first = await lstat(path);
81
+ } catch {
82
+ return true;
83
+ }
84
+ if (first.size === 0 && Date.now() - first.mtimeMs < emptyGraceMs) {
85
+ return false;
86
+ }
87
+ if (await isLockHolderAlive(path))
88
+ return false;
89
+ let second;
90
+ try {
91
+ second = await lstat(path);
92
+ } catch {
93
+ return true;
94
+ }
95
+ if (second.dev !== first.dev || second.ino !== first.ino || second.mtimeMs !== first.mtimeMs || second.size !== first.size) {
96
+ return false;
97
+ }
98
+ try {
99
+ await unlink(path);
100
+ return true;
101
+ } catch {
102
+ return false;
103
+ }
104
+ }
105
+ async function acquireLock(path, {
106
+ waitMs = LOCK_WAIT_MS,
107
+ emptyGraceMs = LOCK_EMPTY_GRACE_MS
108
+ } = {}) {
109
+ await mkdir(join(path, ".."), { recursive: true });
110
+ const startedAt = Date.now();
111
+ while (true) {
112
+ const tmp = `${path}.${process.pid}-${randomBytes(6).toString("hex")}`;
113
+ await writeFile(tmp, `${process.pid}
114
+ `, { flag: "wx" });
115
+ try {
116
+ await link(tmp, path);
117
+ await unlink(tmp).catch(() => void 0);
118
+ return await open(path, "r");
119
+ } catch (error) {
120
+ await unlink(tmp).catch(() => void 0);
121
+ if (!hasErrorCode(error, "EEXIST"))
122
+ throw error;
123
+ if (await tryStealStaleLock(path, emptyGraceMs))
124
+ continue;
125
+ if (Date.now() - startedAt > waitMs) {
126
+ throw new Error(`Timed out waiting for vlt Builder lock "${path}".`);
127
+ }
128
+ await wait(LOCK_RETRY_MS);
129
+ }
130
+ }
131
+ }
132
+ async function installationComplete(root, graph) {
133
+ try {
134
+ return (await readFile(join(root, ".vercel-builder-graph"), "utf8")).trim() === graph.hash;
135
+ } catch {
136
+ return false;
137
+ }
138
+ }
139
+ var EmbeddedPackageInfoClient = class extends PackageInfoClient {
140
+ constructor(options, fetchTimeoutMs = TARBALL_FETCH_TIMEOUT_MS) {
141
+ super(options);
142
+ this.fetchTimeoutMs = fetchTimeoutMs;
143
+ }
144
+ async extract(...args) {
145
+ const [rawSpec, target, rawOptions = {}] = args;
146
+ const spec = rawSpec;
147
+ const options = rawOptions;
148
+ if (spec.final?.type === "remote" && options.resolved) {
149
+ if (!options.integrity) {
150
+ throw new Error(
151
+ `Missing integrity for remote Builder dependency ${options.resolved}`
152
+ );
153
+ }
154
+ let response;
155
+ try {
156
+ response = await fetch(options.resolved, {
157
+ signal: AbortSignal.timeout(this.fetchTimeoutMs)
158
+ });
159
+ } catch (error) {
160
+ const aborted = error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
161
+ if (aborted) {
162
+ throw new Error(
163
+ `Timed out downloading remote Builder dependency ${options.resolved}`
164
+ );
165
+ }
166
+ throw error;
167
+ }
168
+ if (!response.ok) {
169
+ throw new Error(
170
+ `Could not download remote Builder dependency ${options.resolved}: ${response.status}`
171
+ );
172
+ }
173
+ const bytes = Buffer.from(await response.arrayBuffer());
174
+ const integrity = `sha512-${createHash("sha512").update(new Uint8Array(bytes)).digest("base64")}`;
175
+ if (options.integrity !== integrity) {
176
+ throw new Error(
177
+ `Integrity check failed for remote Builder dependency ${options.resolved}`
178
+ );
179
+ }
180
+ const prototype = PackageInfoClient.prototype;
181
+ await (await prototype.getTarPool.call(this)).unpack(
182
+ new Uint8Array(bytes),
183
+ target
184
+ );
185
+ return { resolved: options.resolved, integrity, spec: rawSpec };
186
+ }
187
+ return super.extract(...args);
188
+ }
189
+ };
190
+ async function reifyGraph(root, graph, packageInfoFactory) {
191
+ const packageJson = new PackageJson();
192
+ const packageInfo = packageInfoFactory({
193
+ ...graph.lockfile.options,
194
+ projectRoot: root,
195
+ packageJson
196
+ });
197
+ await install({
198
+ ...graph.lockfile.options,
199
+ projectRoot: root,
200
+ packageJson,
201
+ packageInfo,
202
+ scurry: new PathScurry(root),
203
+ allowScripts: ":not(*)",
204
+ frozenLockfile: true,
205
+ cleanInstall: true
206
+ });
207
+ }
208
+ async function ensureGraph(graph, cacheRoot, packageInfoFactory) {
209
+ validateGraph(graph);
210
+ const root = join(cacheRoot, graph.hash);
211
+ const active = activeInstallations.get(root);
212
+ if (active)
213
+ return active;
214
+ const installation = (async () => {
215
+ if (await installationComplete(root, graph))
216
+ return root;
217
+ const lockPath = join(cacheRoot, "locks", `${graph.hash}.lock`);
218
+ const lock = await acquireLock(lockPath);
219
+ let temporaryRoot;
220
+ try {
221
+ if (await installationComplete(root, graph))
222
+ return root;
223
+ await rm(root, { recursive: true, force: true });
224
+ temporaryRoot = process.platform === "win32" ? root : join(
225
+ cacheRoot,
226
+ "tmp",
227
+ `${graph.hash}-${process.pid}-${randomBytes(6).toString("hex")}`
228
+ );
229
+ await mkdir(temporaryRoot, { recursive: true });
230
+ await writeFile(
231
+ join(temporaryRoot, "package.json"),
232
+ `${JSON.stringify(graph.manifest, null, 2)}
233
+ `
234
+ );
235
+ await writeFile(
236
+ join(temporaryRoot, "vlt-lock.json"),
237
+ `${JSON.stringify(graph.lockfile, null, 2)}
238
+ `
239
+ );
240
+ await reifyGraph(temporaryRoot, graph, packageInfoFactory);
241
+ await writeFile(
242
+ join(temporaryRoot, ".vercel-builder-graph"),
243
+ `${graph.hash}
244
+ `
245
+ );
246
+ if (temporaryRoot !== root) {
247
+ await mkdir(join(root, ".."), { recursive: true });
248
+ await rename(temporaryRoot, root);
249
+ }
250
+ temporaryRoot = void 0;
251
+ return root;
252
+ } finally {
253
+ await lock.close();
254
+ await unlink(lockPath).catch(() => void 0);
255
+ if (temporaryRoot)
256
+ await rm(temporaryRoot, { recursive: true, force: true });
257
+ }
258
+ })();
259
+ activeInstallations.set(root, installation);
260
+ const clearInstallation = () => {
261
+ if (activeInstallations.get(root) === installation) {
262
+ activeInstallations.delete(root);
263
+ }
264
+ };
265
+ void installation.then(clearInstallation, clearInstallation);
266
+ return installation;
267
+ }
268
+ function createVltBuilderImporter({
269
+ graphs,
270
+ loadGraphs = async () => graphs,
271
+ require: require2,
272
+ cacheRoot = join(getCachePath(), "builders-vlt"),
273
+ packageInfoFactory = (options) => new EmbeddedPackageInfoClient(options),
274
+ debug = () => void 0
275
+ }) {
276
+ return async function importVltBuilders(specs) {
277
+ if (specs.size === 0)
278
+ return /* @__PURE__ */ new Map();
279
+ const loadedGraphs = await loadGraphs();
280
+ if (loadedGraphs.schemaVersion !== 1) {
281
+ throw new Error("The embedded vlt Builder graph index is invalid.");
282
+ }
283
+ const builders = /* @__PURE__ */ new Map();
284
+ await Promise.all(
285
+ [...specs].map(async ([spec, name]) => {
286
+ const graph = loadedGraphs.builders[name];
287
+ if (!graph)
288
+ throw new Error(`No pinned vlt graph exists for ${name}.`);
289
+ const root = await ensureGraph(graph, cacheRoot, packageInfoFactory);
290
+ const pkgPath = require2.resolve(`${name}/package.json`, {
291
+ paths: [root]
292
+ });
293
+ const pkg = JSON.parse(
294
+ await readFile(pkgPath, "utf8")
295
+ );
296
+ if (pkg.name !== name || pkg.version !== graph.version) {
297
+ throw new Error(
298
+ `The vlt Builder graph materialized ${String(pkg.name)}@${String(
299
+ pkg.version
300
+ )} instead of ${name}@${graph.version}.`
301
+ );
302
+ }
303
+ const path = require2.resolve(name, { paths: [root] });
304
+ debug(`Resolved ${name}@${graph.version} with vlt from ${root}`);
305
+ builders.set(spec, {
306
+ path,
307
+ pkgPath,
308
+ pkg: { ...pkg, name },
309
+ builder: require2(path),
310
+ dynamicallyInstalled: true
311
+ });
312
+ })
313
+ );
314
+ return builders;
315
+ };
316
+ }
317
+ export {
318
+ EmbeddedPackageInfoClient,
319
+ TARBALL_FETCH_TIMEOUT_MS,
320
+ acquireLock,
321
+ createVltBuilderImporter
322
+ };
@@ -11,19 +11,19 @@ import {
11
11
  require_service_schedules,
12
12
  require_write_build_result,
13
13
  writeBuildResult
14
- } from "../../chunks/chunk-QHS645AZ.js";
15
- import {
16
- importBuilders,
17
- import_import_builders
18
- } from "../../chunks/chunk-TGNEG57M.js";
14
+ } from "../../chunks/chunk-SPRQ4IBQ.js";
19
15
  import {
20
16
  require_dist as require_dist4,
21
17
  validateConfig
22
- } from "../../chunks/chunk-UARGTFCT.js";
18
+ } from "../../chunks/chunk-7NRNFV77.js";
19
+ import {
20
+ importBuilders,
21
+ import_import_builders
22
+ } from "../../chunks/chunk-KU2WCB6G.js";
23
23
  import {
24
24
  js_yaml_default,
25
25
  pullCommandLogic
26
- } from "../../chunks/chunk-XIFATBH5.js";
26
+ } from "../../chunks/chunk-U4ZLWJQD.js";
27
27
  import {
28
28
  require_dist as require_dist2,
29
29
  require_dist2 as require_dist3,
@@ -34,20 +34,20 @@ import {
34
34
  } from "../../chunks/chunk-IB5L4LKZ.js";
35
35
  import {
36
36
  readJSONFile
37
- } from "../../chunks/chunk-SHFNEZVI.js";
37
+ } from "../../chunks/chunk-MUGF3SGQ.js";
38
38
  import {
39
39
  readProjectSettings
40
- } from "../../chunks/chunk-EPOLDWRA.js";
40
+ } from "../../chunks/chunk-TOXZAP5I.js";
41
41
  import {
42
42
  require_dist
43
- } from "../../chunks/chunk-G3PXSXIB.js";
43
+ } from "../../chunks/chunk-N6HP5BLI.js";
44
44
  import "../../chunks/chunk-P7VSBDR4.js";
45
45
  import {
46
46
  DEFAULT_VERCEL_CONFIG_FILENAME,
47
47
  compileVercelConfig,
48
48
  findSourceVercelConfigFile,
49
49
  require_main
50
- } from "../../chunks/chunk-QOPTXV4G.js";
50
+ } from "../../chunks/chunk-L4H3DP65.js";
51
51
  import "../../chunks/chunk-K3RED3VO.js";
52
52
  import "../../chunks/chunk-5NF5HOBJ.js";
53
53
  import {
@@ -59,18 +59,18 @@ import "../../chunks/chunk-VXYGCOKL.js";
59
59
  import "../../chunks/chunk-GGP5R3FU.js";
60
60
  import {
61
61
  pullEnvRecords
62
- } from "../../chunks/chunk-GHKJAK5V.js";
63
- import "../../chunks/chunk-7KROIXQM.js";
62
+ } from "../../chunks/chunk-IK6PC2JA.js";
63
+ import "../../chunks/chunk-3FIEWWMM.js";
64
64
  import {
65
65
  require_frameworks
66
66
  } from "../../chunks/chunk-FRVG4OW3.js";
67
67
  import "../../chunks/chunk-6E6KPBXY.js";
68
68
  import {
69
69
  ensureLink
70
- } from "../../chunks/chunk-C762AAVU.js";
70
+ } from "../../chunks/chunk-66LPM47Z.js";
71
71
  import {
72
72
  printProjectNotFoundError
73
- } from "../../chunks/chunk-PJXMXMCO.js";
73
+ } from "../../chunks/chunk-TLPHZ7M4.js";
74
74
  import {
75
75
  AGENT_REASON,
76
76
  AGENT_STATUS
@@ -79,7 +79,7 @@ import {
79
79
  buildCommand
80
80
  } from "../../chunks/chunk-UG2WOB5L.js";
81
81
  import "../../chunks/chunk-XUAWTW4W.js";
82
- import "../../chunks/chunk-DBYHS3CK.js";
82
+ import "../../chunks/chunk-GQRG7VFK.js";
83
83
  import "../../chunks/chunk-HRXRELD3.js";
84
84
  import "../../chunks/chunk-PNGVSHR3.js";
85
85
  import {
@@ -92,12 +92,12 @@ import {
92
92
  TelemetryClient
93
93
  } from "../../chunks/chunk-HB4UKFDO.js";
94
94
  import "../../chunks/chunk-B5XLQKHI.js";
95
- import "../../chunks/chunk-NW34PW6V.js";
96
95
  import {
97
96
  detectExplicitScope,
98
97
  ua_default
99
- } from "../../chunks/chunk-4IVSM24H.js";
98
+ } from "../../chunks/chunk-76CB3CF2.js";
100
99
  import "../../chunks/chunk-XNIZGCN5.js";
100
+ import "../../chunks/chunk-NW34PW6V.js";
101
101
  import {
102
102
  printError,
103
103
  toEnumerableError
@@ -113,7 +113,7 @@ import {
113
113
  require_ajv,
114
114
  require_lib,
115
115
  resolveProjectCwd
116
- } from "../../chunks/chunk-2TSBB22D.js";
116
+ } from "../../chunks/chunk-7F5RNOTP.js";
117
117
  import "../../chunks/chunk-G5FBSUL4.js";
118
118
  import {
119
119
  outputAgentError