vercel 58.4.4 → 58.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/chunks/{add-245XOFJO.js → add-I7X6NXYD.js} +4 -4
  2. package/dist/chunks/{add-P7WBQMBW.js → add-KMRFKOPJ.js} +44 -9
  3. package/dist/chunks/{add-XH24V5VU.js → add-USFLACJX.js} +4 -4
  4. package/dist/chunks/{build-M7NJYJPE.js → build-GNX3QE6Q.js} +4 -4
  5. package/dist/chunks/{chunk-WR7JTCGL.js → chunk-3BU2UCGV.js} +1 -1
  6. package/dist/chunks/{chunk-MAHXF73X.js → chunk-3L2YLLHC.js} +1 -1
  7. package/dist/chunks/{chunk-ZGBBPJ6B.js → chunk-4XKF7JOF.js} +92 -1377
  8. package/dist/chunks/{chunk-2LBVX2H3.js → chunk-5SZ6VX2H.js} +2 -2
  9. package/dist/chunks/{chunk-2MAPZXVV.js → chunk-62SBYAED.js} +5 -5
  10. package/dist/chunks/{chunk-UE3JUVUZ.js → chunk-74XVGG52.js} +2 -2
  11. package/dist/chunks/{chunk-2FMPLU44.js → chunk-7KUQ7BHI.js} +2 -2
  12. package/dist/chunks/{chunk-YDUINEII.js → chunk-7SXWLTXT.js} +6 -4
  13. package/dist/chunks/{chunk-M5NOLAJ4.js → chunk-BIGFTNW6.js} +1 -1
  14. package/dist/chunks/{chunk-YCPUAG77.js → chunk-CDYBV7YA.js} +1 -1
  15. package/dist/chunks/{chunk-4BUPRO5B.js → chunk-D6SC2UJH.js} +1 -1
  16. package/dist/chunks/{chunk-62MH5KPX.js → chunk-DHTB5D3E.js} +5 -5
  17. package/dist/chunks/{chunk-NJ6QXKQD.js → chunk-H3KETQAA.js} +1 -1
  18. package/dist/chunks/{chunk-NJUPUGOE.js → chunk-HT2XWSAJ.js} +1 -1
  19. package/dist/chunks/chunk-I2XE3GMB.js +21 -0
  20. package/dist/chunks/chunk-LC5BYUUP.js +1337 -0
  21. package/dist/chunks/{chunk-SJYAUEZR.js → chunk-MNZUPMZZ.js} +3 -15
  22. package/dist/chunks/chunk-MXLA3VQS.js +20 -0
  23. package/dist/chunks/{chunk-XE5VSQ25.js → chunk-NI4DNP3D.js} +1 -1
  24. package/dist/chunks/{chunk-Y5GTPWXB.js → chunk-NOMQUVGM.js} +2 -2
  25. package/dist/chunks/{chunk-AQDWMAPM.js → chunk-NYKWLQQM.js} +10 -8
  26. package/dist/chunks/{chunk-4CCY5OPH.js → chunk-NZ6GDMPB.js} +306 -217
  27. package/dist/chunks/chunk-TE5MIANG.js +96 -0
  28. package/dist/chunks/{chunk-EBLH23AQ.js → chunk-TEQKKTJQ.js} +4 -7
  29. package/dist/chunks/{chunk-2WILSD7J.js → chunk-TNTJXJSE.js} +1 -1
  30. package/dist/chunks/{chunk-IEDUCUDV.js → chunk-UAVZOOOL.js} +10 -8
  31. package/dist/chunks/{chunk-4UYKSYKQ.js → chunk-UMA66MKW.js} +66 -2
  32. package/dist/chunks/{chunk-CPFNFVCL.js → chunk-UME4MVFU.js} +1 -1
  33. package/dist/chunks/{chunk-HSYF5SI3.js → chunk-YR6M7ZIU.js} +1 -1
  34. package/dist/chunks/{chunk-3QAUXPIR.js → chunk-ZZZEJXHD.js} +172 -51
  35. package/dist/chunks/{clear-HWIKQ4NC.js → clear-ERVHWAHX.js} +4 -4
  36. package/dist/chunks/{compile-vercel-config-U5NRIMZ2.js → compile-vercel-config-PM5ID4CV.js} +2 -2
  37. package/dist/chunks/{constants-3FSSR6E7.js → constants-T6BULVX6.js} +1 -1
  38. package/dist/chunks/{delete-NVMGVD5Z.js → delete-GMVIUCQV.js} +3 -3
  39. package/dist/chunks/{delete-FZCOUFGN.js → delete-XB24AZGV.js} +4 -4
  40. package/dist/chunks/{disable-ERM2BWEQ.js → disable-JJZZQ4IZ.js} +3 -3
  41. package/dist/chunks/{discard-KM5OLEN4.js → discard-CGAS2MSK.js} +3 -3
  42. package/dist/chunks/{edit-HT3UTATZ.js → edit-RKUUUBQF.js} +4 -4
  43. package/dist/chunks/{edit-TOSB2EMI.js → edit-TFZDCJTL.js} +5 -5
  44. package/dist/chunks/{enable-BQL6AOQV.js → enable-UXRVQO6C.js} +3 -3
  45. package/dist/chunks/{export-UOWQHOG3.js → export-WQE3UU4V.js} +3 -3
  46. package/dist/chunks/{image-F5SC6Q7Y.js → image-HV7N6RTK.js} +3 -3
  47. package/dist/chunks/import-builders-IEVZ7KYP.js +28 -0
  48. package/dist/chunks/{inspect-PZJM2CWT.js → inspect-4BXZOMC2.js} +7 -7
  49. package/dist/chunks/{inspect-35FU5R62.js → inspect-DT2PX6LB.js} +4 -4
  50. package/dist/chunks/{inspect-5J5GSTOB.js → inspect-E3YSH5BV.js} +4 -4
  51. package/dist/chunks/{inspect-GKJ6T5H4.js → inspect-NADJYMSZ.js} +4 -4
  52. package/dist/chunks/{inspect-LGKOLH2O.js → inspect-VDQEM3E6.js} +5 -5
  53. package/dist/chunks/{list-KZETH3ZE.js → list-5PLKF2GL.js} +3 -3
  54. package/dist/chunks/{list-ITFJYYQ2.js → list-ARM4RM22.js} +9 -9
  55. package/dist/chunks/{list-2IIE7CAP.js → list-RVE2NAC5.js} +5 -5
  56. package/dist/chunks/{login-BQPJCJEZ.js → login-VHGNOKBB.js} +4 -4
  57. package/dist/chunks/{ls-7GHDK4MD.js → ls-4QRIPSBC.js} +13 -13
  58. package/dist/chunks/{ls-DL2LA35C.js → ls-IVVP4H24.js} +4 -4
  59. package/dist/chunks/{ls-UXUEP54B.js → ls-OTCUUI4L.js} +4 -4
  60. package/dist/chunks/{ls-YSFWSM6J.js → ls-QBKFZC52.js} +4 -4
  61. package/dist/chunks/{ls-ZZFLH7PK.js → ls-YME2AL47.js} +4 -4
  62. package/dist/chunks/{open-ADNJQN5E.js → open-KYVW2GTM.js} +4 -4
  63. package/dist/chunks/{permissions-72SZCBIY.js → permissions-BLHKOJDO.js} +4 -4
  64. package/dist/chunks/{publish-OOAGSEBM.js → publish-4BKTL25X.js} +3 -3
  65. package/dist/chunks/{push-B6TZDXNF.js → push-IJFWOWD7.js} +4 -4
  66. package/dist/chunks/{query-LZWS5TDH.js → query-VIV66DLZ.js} +3 -3
  67. package/dist/chunks/{reorder-MRHFKPMK.js → reorder-C44IJZNE.js} +3 -3
  68. package/dist/chunks/{reply-BKTJXO3B.js → reply-M6WBMKBN.js} +5 -5
  69. package/dist/chunks/{resolve-BKVGSGPN.js → resolve-44ICWDRT.js} +4 -4
  70. package/dist/chunks/{restore-USR7SKWV.js → restore-ACDVNSTC.js} +3 -3
  71. package/dist/chunks/{rm-2UO6BT3A.js → rm-K2FDC5CL.js} +6 -6
  72. package/dist/chunks/{rm-37MKKV3I.js → rm-P2ILGP4I.js} +4 -4
  73. package/dist/chunks/{rm-VY3OHKFH.js → rm-Q7VXI345.js} +4 -4
  74. package/dist/chunks/{rm-KUWPNZIS.js → rm-RO3R3MZT.js} +4 -4
  75. package/dist/chunks/{rule-inspect-JVDOOTWK.js → rule-inspect-JGKJXOUD.js} +13 -20
  76. package/dist/chunks/{rules-NTBFZBIF.js → rules-BRTF5HJP.js} +9 -6
  77. package/dist/chunks/schema-T7RNRNKT.js +426 -0
  78. package/dist/chunks/{schema-6EZ72OVH.js → schema-Z3L5ZOEE.js} +2 -2
  79. package/dist/chunks/{tags-HNPC63QA.js → tags-BPHVFK53.js} +2 -2
  80. package/dist/chunks/{update-LUYWNZP3.js → update-5KQU4HCK.js} +38 -6
  81. package/dist/commands/build/index.js +65 -24
  82. package/dist/commands/deploy/index.js +24 -17
  83. package/dist/commands/dev/index.js +41 -18
  84. package/dist/commands/env/index.js +89 -150
  85. package/dist/commands/link/index.js +9 -9
  86. package/dist/commands/list/index.js +5 -5
  87. package/dist/commands-bulk.js +3183 -2199
  88. package/dist/index.js +12 -11
  89. package/dist/vc.js +11 -14
  90. package/dist/version.mjs +1 -1
  91. package/package.json +54 -48
  92. package/dist/chunks/{chunk-BUZRVER7.js → chunk-P65EEFTR.js} +3 -3
@@ -0,0 +1,1337 @@
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_semver
9
+ } from "./chunk-IB5L4LKZ.js";
10
+ import {
11
+ require_execa
12
+ } from "./chunk-R6IGDGX3.js";
13
+ import {
14
+ VERCEL_CONFIG_EXTENSIONS,
15
+ VERCEL_DIR,
16
+ readJSONFile,
17
+ require_dist3 as require_dist2,
18
+ require_lib,
19
+ require_minimatch,
20
+ require_pluralize
21
+ } from "./chunk-NZ6GDMPB.js";
22
+ import {
23
+ CantParseJSONFile,
24
+ cmd,
25
+ code
26
+ } from "./chunk-SOFC4MLS.js";
27
+ import {
28
+ pkg_default
29
+ } from "./chunk-P4QNYOFB.js";
30
+ import {
31
+ output_manager_default,
32
+ require_dist
33
+ } from "./chunk-OX7KI3LF.js";
34
+ import {
35
+ __commonJS,
36
+ __export,
37
+ __require,
38
+ __toESM
39
+ } from "./chunk-TZ2YI2VH.js";
40
+
41
+ // ../../node_modules/.pnpm/builtins@1.0.3/node_modules/builtins/builtins.json
42
+ var require_builtins = __commonJS({
43
+ "../../node_modules/.pnpm/builtins@1.0.3/node_modules/builtins/builtins.json"(exports, module) {
44
+ module.exports = [
45
+ "assert",
46
+ "buffer",
47
+ "child_process",
48
+ "cluster",
49
+ "console",
50
+ "constants",
51
+ "crypto",
52
+ "dgram",
53
+ "dns",
54
+ "domain",
55
+ "events",
56
+ "fs",
57
+ "http",
58
+ "https",
59
+ "module",
60
+ "net",
61
+ "os",
62
+ "path",
63
+ "process",
64
+ "punycode",
65
+ "querystring",
66
+ "readline",
67
+ "repl",
68
+ "stream",
69
+ "string_decoder",
70
+ "timers",
71
+ "tls",
72
+ "tty",
73
+ "url",
74
+ "util",
75
+ "v8",
76
+ "vm",
77
+ "zlib"
78
+ ];
79
+ }
80
+ });
81
+
82
+ // ../../node_modules/.pnpm/validate-npm-package-name@3.0.0/node_modules/validate-npm-package-name/index.js
83
+ var require_validate_npm_package_name = __commonJS({
84
+ "../../node_modules/.pnpm/validate-npm-package-name@3.0.0/node_modules/validate-npm-package-name/index.js"(exports, module) {
85
+ "use strict";
86
+ var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
87
+ var builtins = require_builtins();
88
+ var blacklist = [
89
+ "node_modules",
90
+ "favicon.ico"
91
+ ];
92
+ var validate = module.exports = function(name) {
93
+ var warnings = [];
94
+ var errors = [];
95
+ if (name === null) {
96
+ errors.push("name cannot be null");
97
+ return done(warnings, errors);
98
+ }
99
+ if (name === void 0) {
100
+ errors.push("name cannot be undefined");
101
+ return done(warnings, errors);
102
+ }
103
+ if (typeof name !== "string") {
104
+ errors.push("name must be a string");
105
+ return done(warnings, errors);
106
+ }
107
+ if (!name.length) {
108
+ errors.push("name length must be greater than zero");
109
+ }
110
+ if (name.match(/^\./)) {
111
+ errors.push("name cannot start with a period");
112
+ }
113
+ if (name.match(/^_/)) {
114
+ errors.push("name cannot start with an underscore");
115
+ }
116
+ if (name.trim() !== name) {
117
+ errors.push("name cannot contain leading or trailing spaces");
118
+ }
119
+ blacklist.forEach(function(blacklistedName) {
120
+ if (name.toLowerCase() === blacklistedName) {
121
+ errors.push(blacklistedName + " is a blacklisted name");
122
+ }
123
+ });
124
+ builtins.forEach(function(builtin) {
125
+ if (name.toLowerCase() === builtin) {
126
+ warnings.push(builtin + " is a core module name");
127
+ }
128
+ });
129
+ if (name.length > 214) {
130
+ warnings.push("name can no longer contain more than 214 characters");
131
+ }
132
+ if (name.toLowerCase() !== name) {
133
+ warnings.push("name can no longer contain capital letters");
134
+ }
135
+ if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) {
136
+ warnings.push(`name can no longer contain special characters ("~'!()*")`);
137
+ }
138
+ if (encodeURIComponent(name) !== name) {
139
+ var nameMatch = name.match(scopedPackagePattern);
140
+ if (nameMatch) {
141
+ var user = nameMatch[1];
142
+ var pkg = nameMatch[2];
143
+ if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) {
144
+ return done(warnings, errors);
145
+ }
146
+ }
147
+ errors.push("name can only contain URL-friendly characters");
148
+ }
149
+ return done(warnings, errors);
150
+ };
151
+ validate.scopedPackagePattern = scopedPackagePattern;
152
+ var done = function(warnings, errors) {
153
+ var result = {
154
+ validForNewPackages: errors.length === 0 && warnings.length === 0,
155
+ validForOldPackages: errors.length === 0,
156
+ warnings,
157
+ errors
158
+ };
159
+ if (!result.warnings.length)
160
+ delete result.warnings;
161
+ if (!result.errors.length)
162
+ delete result.errors;
163
+ return result;
164
+ };
165
+ }
166
+ });
167
+
168
+ // ../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host-info.js
169
+ var require_git_host_info = __commonJS({
170
+ "../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host-info.js"(exports, module) {
171
+ "use strict";
172
+ var gitHosts = module.exports = {
173
+ github: {
174
+ // First two are insecure and generally shouldn't be used any more, but
175
+ // they are still supported.
176
+ "protocols": ["git", "http", "git+ssh", "git+https", "ssh", "https"],
177
+ "domain": "github.com",
178
+ "treepath": "tree",
179
+ "filetemplate": "https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",
180
+ "bugstemplate": "https://{domain}/{user}/{project}/issues",
181
+ "gittemplate": "git://{auth@}{domain}/{user}/{project}.git{#committish}",
182
+ "tarballtemplate": "https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"
183
+ },
184
+ bitbucket: {
185
+ "protocols": ["git+ssh", "git+https", "ssh", "https"],
186
+ "domain": "bitbucket.org",
187
+ "treepath": "src",
188
+ "tarballtemplate": "https://{domain}/{user}/{project}/get/{committish}.tar.gz"
189
+ },
190
+ gitlab: {
191
+ "protocols": ["git+ssh", "git+https", "ssh", "https"],
192
+ "domain": "gitlab.com",
193
+ "treepath": "tree",
194
+ "bugstemplate": "https://{domain}/{user}/{project}/issues",
195
+ "httpstemplate": "git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",
196
+ "tarballtemplate": "https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",
197
+ "pathmatch": /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/
198
+ },
199
+ gist: {
200
+ "protocols": ["git", "git+ssh", "git+https", "ssh", "https"],
201
+ "domain": "gist.github.com",
202
+ "pathmatch": /^[/](?:([^/]+)[/])?([a-z0-9]{32,})(?:[.]git)?$/,
203
+ "filetemplate": "https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",
204
+ "bugstemplate": "https://{domain}/{project}",
205
+ "gittemplate": "git://{domain}/{project}.git{#committish}",
206
+ "sshtemplate": "git@{domain}:/{project}.git{#committish}",
207
+ "sshurltemplate": "git+ssh://git@{domain}/{project}.git{#committish}",
208
+ "browsetemplate": "https://{domain}/{project}{/committish}",
209
+ "browsefiletemplate": "https://{domain}/{project}{/committish}{#path}",
210
+ "docstemplate": "https://{domain}/{project}{/committish}",
211
+ "httpstemplate": "git+https://{domain}/{project}.git{#committish}",
212
+ "shortcuttemplate": "{type}:{project}{#committish}",
213
+ "pathtemplate": "{project}{#committish}",
214
+ "tarballtemplate": "https://codeload.github.com/gist/{project}/tar.gz/{committish}",
215
+ "hashformat": function(fragment) {
216
+ return "file-" + formatHashFragment(fragment);
217
+ }
218
+ }
219
+ };
220
+ var gitHostDefaults = {
221
+ "sshtemplate": "git@{domain}:{user}/{project}.git{#committish}",
222
+ "sshurltemplate": "git+ssh://git@{domain}/{user}/{project}.git{#committish}",
223
+ "browsetemplate": "https://{domain}/{user}/{project}{/tree/committish}",
224
+ "browsefiletemplate": "https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",
225
+ "docstemplate": "https://{domain}/{user}/{project}{/tree/committish}#readme",
226
+ "httpstemplate": "git+https://{auth@}{domain}/{user}/{project}.git{#committish}",
227
+ "filetemplate": "https://{domain}/{user}/{project}/raw/{committish}/{path}",
228
+ "shortcuttemplate": "{type}:{user}/{project}{#committish}",
229
+ "pathtemplate": "{user}/{project}{#committish}",
230
+ "pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,
231
+ "hashformat": formatHashFragment
232
+ };
233
+ Object.keys(gitHosts).forEach(function(name) {
234
+ Object.keys(gitHostDefaults).forEach(function(key) {
235
+ if (gitHosts[name][key])
236
+ return;
237
+ gitHosts[name][key] = gitHostDefaults[key];
238
+ });
239
+ gitHosts[name].protocols_re = RegExp("^(" + gitHosts[name].protocols.map(function(protocol) {
240
+ return protocol.replace(/([\\+*{}()[\]$^|])/g, "\\$1");
241
+ }).join("|") + "):$");
242
+ });
243
+ function formatHashFragment(fragment) {
244
+ return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, "").replace(/\W+/g, "-");
245
+ }
246
+ }
247
+ });
248
+
249
+ // ../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host.js
250
+ var require_git_host = __commonJS({
251
+ "../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host.js"(exports, module) {
252
+ "use strict";
253
+ var gitHosts = require_git_host_info();
254
+ var extend = Object.assign || function _extend(target, source) {
255
+ if (source === null || typeof source !== "object")
256
+ return target;
257
+ var keys = Object.keys(source);
258
+ var i = keys.length;
259
+ while (i--) {
260
+ target[keys[i]] = source[keys[i]];
261
+ }
262
+ return target;
263
+ };
264
+ module.exports = GitHost;
265
+ function GitHost(type, user, auth, project, committish, defaultRepresentation, opts) {
266
+ var gitHostInfo = this;
267
+ gitHostInfo.type = type;
268
+ Object.keys(gitHosts[type]).forEach(function(key) {
269
+ gitHostInfo[key] = gitHosts[type][key];
270
+ });
271
+ gitHostInfo.user = user;
272
+ gitHostInfo.auth = auth;
273
+ gitHostInfo.project = project;
274
+ gitHostInfo.committish = committish;
275
+ gitHostInfo.default = defaultRepresentation;
276
+ gitHostInfo.opts = opts || {};
277
+ }
278
+ GitHost.prototype.hash = function() {
279
+ return this.committish ? "#" + this.committish : "";
280
+ };
281
+ GitHost.prototype._fill = function(template, opts) {
282
+ if (!template)
283
+ return;
284
+ var vars = extend({}, opts);
285
+ vars.path = vars.path ? vars.path.replace(/^[/]+/g, "") : "";
286
+ opts = extend(extend({}, this.opts), opts);
287
+ var self = this;
288
+ Object.keys(this).forEach(function(key) {
289
+ if (self[key] != null && vars[key] == null)
290
+ vars[key] = self[key];
291
+ });
292
+ var rawAuth = vars.auth;
293
+ var rawcommittish = vars.committish;
294
+ var rawFragment = vars.fragment;
295
+ var rawPath = vars.path;
296
+ var rawProject = vars.project;
297
+ Object.keys(vars).forEach(function(key) {
298
+ var value = vars[key];
299
+ if ((key === "path" || key === "project") && typeof value === "string") {
300
+ vars[key] = value.split("/").map(function(pathComponent) {
301
+ return encodeURIComponent(pathComponent);
302
+ }).join("/");
303
+ } else {
304
+ vars[key] = encodeURIComponent(value);
305
+ }
306
+ });
307
+ vars["auth@"] = rawAuth ? rawAuth + "@" : "";
308
+ vars["#fragment"] = rawFragment ? "#" + this.hashformat(rawFragment) : "";
309
+ vars.fragment = vars.fragment ? vars.fragment : "";
310
+ vars["#path"] = rawPath ? "#" + this.hashformat(rawPath) : "";
311
+ vars["/path"] = vars.path ? "/" + vars.path : "";
312
+ vars.projectPath = rawProject.split("/").map(encodeURIComponent).join("/");
313
+ if (opts.noCommittish) {
314
+ vars["#committish"] = "";
315
+ vars["/tree/committish"] = "";
316
+ vars["/committish"] = "";
317
+ vars.committish = "";
318
+ } else {
319
+ vars["#committish"] = rawcommittish ? "#" + rawcommittish : "";
320
+ vars["/tree/committish"] = vars.committish ? "/" + vars.treepath + "/" + vars.committish : "";
321
+ vars["/committish"] = vars.committish ? "/" + vars.committish : "";
322
+ vars.committish = vars.committish || "master";
323
+ }
324
+ var res = template;
325
+ Object.keys(vars).forEach(function(key) {
326
+ res = res.replace(new RegExp("[{]" + key + "[}]", "g"), vars[key]);
327
+ });
328
+ if (opts.noGitPlus) {
329
+ return res.replace(/^git[+]/, "");
330
+ } else {
331
+ return res;
332
+ }
333
+ };
334
+ GitHost.prototype.ssh = function(opts) {
335
+ return this._fill(this.sshtemplate, opts);
336
+ };
337
+ GitHost.prototype.sshurl = function(opts) {
338
+ return this._fill(this.sshurltemplate, opts);
339
+ };
340
+ GitHost.prototype.browse = function(P, F, opts) {
341
+ if (typeof P === "string") {
342
+ if (typeof F !== "string") {
343
+ opts = F;
344
+ F = null;
345
+ }
346
+ return this._fill(this.browsefiletemplate, extend({
347
+ fragment: F,
348
+ path: P
349
+ }, opts));
350
+ } else {
351
+ return this._fill(this.browsetemplate, P);
352
+ }
353
+ };
354
+ GitHost.prototype.docs = function(opts) {
355
+ return this._fill(this.docstemplate, opts);
356
+ };
357
+ GitHost.prototype.bugs = function(opts) {
358
+ return this._fill(this.bugstemplate, opts);
359
+ };
360
+ GitHost.prototype.https = function(opts) {
361
+ return this._fill(this.httpstemplate, opts);
362
+ };
363
+ GitHost.prototype.git = function(opts) {
364
+ return this._fill(this.gittemplate, opts);
365
+ };
366
+ GitHost.prototype.shortcut = function(opts) {
367
+ return this._fill(this.shortcuttemplate, opts);
368
+ };
369
+ GitHost.prototype.path = function(opts) {
370
+ return this._fill(this.pathtemplate, opts);
371
+ };
372
+ GitHost.prototype.tarball = function(opts_) {
373
+ var opts = extend({}, opts_, { noCommittish: false });
374
+ return this._fill(this.tarballtemplate, opts);
375
+ };
376
+ GitHost.prototype.file = function(P, opts) {
377
+ return this._fill(this.filetemplate, extend({ path: P }, opts));
378
+ };
379
+ GitHost.prototype.getDefaultRepresentation = function() {
380
+ return this.default;
381
+ };
382
+ GitHost.prototype.toString = function(opts) {
383
+ if (this.default && typeof this[this.default] === "function")
384
+ return this[this.default](opts);
385
+ return this.sshurl(opts);
386
+ };
387
+ }
388
+ });
389
+
390
+ // ../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/index.js
391
+ var require_hosted_git_info = __commonJS({
392
+ "../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/index.js"(exports, module) {
393
+ "use strict";
394
+ var url = __require("url");
395
+ var gitHosts = require_git_host_info();
396
+ var GitHost = module.exports = require_git_host();
397
+ var protocolToRepresentationMap = {
398
+ "git+ssh:": "sshurl",
399
+ "git+https:": "https",
400
+ "ssh:": "sshurl",
401
+ "git:": "git"
402
+ };
403
+ function protocolToRepresentation(protocol) {
404
+ return protocolToRepresentationMap[protocol] || protocol.slice(0, -1);
405
+ }
406
+ var authProtocols = {
407
+ "git:": true,
408
+ "https:": true,
409
+ "git+https:": true,
410
+ "http:": true,
411
+ "git+http:": true
412
+ };
413
+ var cache = {};
414
+ module.exports.fromUrl = function(giturl, opts) {
415
+ if (typeof giturl !== "string")
416
+ return;
417
+ var key = giturl + JSON.stringify(opts || {});
418
+ if (!(key in cache)) {
419
+ cache[key] = fromUrl(giturl, opts);
420
+ }
421
+ return cache[key];
422
+ };
423
+ function fromUrl(giturl, opts) {
424
+ if (giturl == null || giturl === "")
425
+ return;
426
+ var url2 = fixupUnqualifiedGist(
427
+ isGitHubShorthand(giturl) ? "github:" + giturl : giturl
428
+ );
429
+ var parsed = parseGitUrl(url2);
430
+ var shortcutMatch = url2.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/);
431
+ var matches = Object.keys(gitHosts).map(function(gitHostName) {
432
+ try {
433
+ var gitHostInfo = gitHosts[gitHostName];
434
+ var auth = null;
435
+ if (parsed.auth && authProtocols[parsed.protocol]) {
436
+ auth = parsed.auth;
437
+ }
438
+ var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null;
439
+ var user = null;
440
+ var project = null;
441
+ var defaultRepresentation = null;
442
+ if (shortcutMatch && shortcutMatch[1] === gitHostName) {
443
+ user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2]);
444
+ project = decodeURIComponent(shortcutMatch[3].replace(/\.git$/, ""));
445
+ defaultRepresentation = "shortcut";
446
+ } else {
447
+ if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, "") !== gitHostInfo.domain)
448
+ return;
449
+ if (!gitHostInfo.protocols_re.test(parsed.protocol))
450
+ return;
451
+ if (!parsed.path)
452
+ return;
453
+ var pathmatch = gitHostInfo.pathmatch;
454
+ var matched = parsed.path.match(pathmatch);
455
+ if (!matched)
456
+ return;
457
+ if (matched[1] !== null && matched[1] !== void 0) {
458
+ user = decodeURIComponent(matched[1].replace(/^:/, ""));
459
+ }
460
+ project = decodeURIComponent(matched[2]);
461
+ defaultRepresentation = protocolToRepresentation(parsed.protocol);
462
+ }
463
+ return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts);
464
+ } catch (ex) {
465
+ if (ex instanceof URIError) {
466
+ } else
467
+ throw ex;
468
+ }
469
+ }).filter(function(gitHostInfo) {
470
+ return gitHostInfo;
471
+ });
472
+ if (matches.length !== 1)
473
+ return;
474
+ return matches[0];
475
+ }
476
+ function isGitHubShorthand(arg) {
477
+ return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg);
478
+ }
479
+ function fixupUnqualifiedGist(giturl) {
480
+ var parsed = url.parse(giturl);
481
+ if (parsed.protocol === "gist:" && parsed.host && !parsed.path) {
482
+ return parsed.protocol + "/" + parsed.host;
483
+ } else {
484
+ return giturl;
485
+ }
486
+ }
487
+ function parseGitUrl(giturl) {
488
+ var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);
489
+ if (!matched) {
490
+ var legacy = url.parse(giturl);
491
+ if (legacy.auth && typeof url.URL === "function") {
492
+ var authmatch = giturl.match(/[^@]+@[^:/]+/);
493
+ if (authmatch) {
494
+ var whatwg = new url.URL(authmatch[0]);
495
+ legacy.auth = whatwg.username || "";
496
+ if (whatwg.password)
497
+ legacy.auth += ":" + whatwg.password;
498
+ }
499
+ }
500
+ return legacy;
501
+ }
502
+ return {
503
+ protocol: "git+ssh:",
504
+ slashes: true,
505
+ auth: matched[1],
506
+ host: matched[2],
507
+ port: null,
508
+ hostname: matched[2],
509
+ hash: matched[4],
510
+ search: null,
511
+ query: null,
512
+ pathname: "/" + matched[3],
513
+ path: "/" + matched[3],
514
+ href: "git+ssh://" + matched[1] + "@" + matched[2] + "/" + matched[3] + (matched[4] || "")
515
+ };
516
+ }
517
+ }
518
+ });
519
+
520
+ // ../../node_modules/.pnpm/os-tmpdir@1.0.2/node_modules/os-tmpdir/index.js
521
+ var require_os_tmpdir = __commonJS({
522
+ "../../node_modules/.pnpm/os-tmpdir@1.0.2/node_modules/os-tmpdir/index.js"(exports, module) {
523
+ "use strict";
524
+ var isWindows = process.platform === "win32";
525
+ var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
526
+ module.exports = function() {
527
+ var path;
528
+ if (isWindows) {
529
+ path = process.env.TEMP || process.env.TMP || (process.env.SystemRoot || process.env.windir) + "\\temp";
530
+ } else {
531
+ path = process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp";
532
+ }
533
+ if (trailingSlashRe.test(path)) {
534
+ path = path.slice(0, -1);
535
+ }
536
+ return path;
537
+ };
538
+ }
539
+ });
540
+
541
+ // ../../node_modules/.pnpm/os-homedir@1.0.2/node_modules/os-homedir/index.js
542
+ var require_os_homedir = __commonJS({
543
+ "../../node_modules/.pnpm/os-homedir@1.0.2/node_modules/os-homedir/index.js"(exports, module) {
544
+ "use strict";
545
+ var os = __require("os");
546
+ function homedir() {
547
+ var env = process.env;
548
+ var home = env.HOME;
549
+ var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
550
+ if (process.platform === "win32") {
551
+ return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
552
+ }
553
+ if (process.platform === "darwin") {
554
+ return home || (user ? "/Users/" + user : null);
555
+ }
556
+ if (process.platform === "linux") {
557
+ return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
558
+ }
559
+ return home || null;
560
+ }
561
+ module.exports = typeof os.homedir === "function" ? os.homedir : homedir;
562
+ }
563
+ });
564
+
565
+ // ../../node_modules/.pnpm/osenv@0.1.5/node_modules/osenv/osenv.js
566
+ var require_osenv = __commonJS({
567
+ "../../node_modules/.pnpm/osenv@0.1.5/node_modules/osenv/osenv.js"(exports) {
568
+ var isWindows = process.platform === "win32";
569
+ var path = __require("path");
570
+ var exec = __require("child_process").exec;
571
+ var osTmpdir = require_os_tmpdir();
572
+ var osHomedir = require_os_homedir();
573
+ function memo(key, lookup, fallback) {
574
+ var fell = false;
575
+ var falling = false;
576
+ exports[key] = function(cb) {
577
+ var val = lookup();
578
+ if (!val && !fell && !falling && fallback) {
579
+ fell = true;
580
+ falling = true;
581
+ exec(fallback, function(er, output, stderr) {
582
+ falling = false;
583
+ if (er)
584
+ return;
585
+ val = output.trim();
586
+ });
587
+ }
588
+ exports[key] = function(cb2) {
589
+ if (cb2)
590
+ process.nextTick(cb2.bind(null, null, val));
591
+ return val;
592
+ };
593
+ if (cb && !falling)
594
+ process.nextTick(cb.bind(null, null, val));
595
+ return val;
596
+ };
597
+ }
598
+ memo("user", function() {
599
+ return isWindows ? process.env.USERDOMAIN + "\\" + process.env.USERNAME : process.env.USER;
600
+ }, "whoami");
601
+ memo("prompt", function() {
602
+ return isWindows ? process.env.PROMPT : process.env.PS1;
603
+ });
604
+ memo("hostname", function() {
605
+ return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME;
606
+ }, "hostname");
607
+ memo("tmpdir", function() {
608
+ return osTmpdir();
609
+ });
610
+ memo("home", function() {
611
+ return osHomedir();
612
+ });
613
+ memo("path", function() {
614
+ return (process.env.PATH || process.env.Path || process.env.path).split(isWindows ? ";" : ":");
615
+ });
616
+ memo("editor", function() {
617
+ return process.env.EDITOR || process.env.VISUAL || (isWindows ? "notepad.exe" : "vi");
618
+ });
619
+ memo("shell", function() {
620
+ return isWindows ? process.env.ComSpec || "cmd" : process.env.SHELL || "bash";
621
+ });
622
+ }
623
+ });
624
+
625
+ // ../../node_modules/.pnpm/npm-package-arg@6.1.0/node_modules/npm-package-arg/npa.js
626
+ var require_npa = __commonJS({
627
+ "../../node_modules/.pnpm/npm-package-arg@6.1.0/node_modules/npm-package-arg/npa.js"(exports, module) {
628
+ "use strict";
629
+ module.exports = npa2;
630
+ module.exports.resolve = resolve;
631
+ module.exports.Result = Result;
632
+ var url;
633
+ var HostedGit;
634
+ var semver;
635
+ var path;
636
+ var validatePackageName;
637
+ var osenv;
638
+ var isWindows = process.platform === "win32" || global.FAKE_WINDOWS;
639
+ var hasSlashes = isWindows ? /\\|[/]/ : /[/]/;
640
+ var isURL = /^(?:git[+])?[a-z]+:/i;
641
+ var isFilename = /[.](?:tgz|tar.gz|tar)$/i;
642
+ function npa2(arg, where) {
643
+ let name;
644
+ let spec;
645
+ if (typeof arg === "object") {
646
+ if (arg instanceof Result && (!where || where === arg.where)) {
647
+ return arg;
648
+ } else if (arg.name && arg.rawSpec) {
649
+ return npa2.resolve(arg.name, arg.rawSpec, where || arg.where);
650
+ } else {
651
+ return npa2(arg.raw, where || arg.where);
652
+ }
653
+ }
654
+ const nameEndsAt = arg[0] === "@" ? arg.slice(1).indexOf("@") + 1 : arg.indexOf("@");
655
+ const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg;
656
+ if (isURL.test(arg)) {
657
+ spec = arg;
658
+ } else if (namePart[0] !== "@" && (hasSlashes.test(namePart) || isFilename.test(namePart))) {
659
+ spec = arg;
660
+ } else if (nameEndsAt > 0) {
661
+ name = namePart;
662
+ spec = arg.slice(nameEndsAt + 1);
663
+ } else {
664
+ if (!validatePackageName)
665
+ validatePackageName = require_validate_npm_package_name();
666
+ const valid2 = validatePackageName(arg);
667
+ if (valid2.validForOldPackages) {
668
+ name = arg;
669
+ } else {
670
+ spec = arg;
671
+ }
672
+ }
673
+ return resolve(name, spec, where, arg);
674
+ }
675
+ var isFilespec = isWindows ? /^(?:[.]|~[/]|[/\\]|[a-zA-Z]:)/ : /^(?:[.]|~[/]|[/]|[a-zA-Z]:)/;
676
+ function resolve(name, spec, where, arg) {
677
+ const res = new Result({
678
+ raw: arg,
679
+ name,
680
+ rawSpec: spec,
681
+ fromArgument: arg != null
682
+ });
683
+ if (name)
684
+ res.setName(name);
685
+ if (spec && (isFilespec.test(spec) || /^file:/i.test(spec))) {
686
+ return fromFile(res, where);
687
+ } else if (spec && /^npm:/i.test(spec)) {
688
+ return fromAlias(res, where);
689
+ }
690
+ if (!HostedGit)
691
+ HostedGit = require_hosted_git_info();
692
+ const hosted = HostedGit.fromUrl(spec, { noGitPlus: true, noCommittish: true });
693
+ if (hosted) {
694
+ return fromHostedGit(res, hosted);
695
+ } else if (spec && isURL.test(spec)) {
696
+ return fromURL(res);
697
+ } else if (spec && (hasSlashes.test(spec) || isFilename.test(spec))) {
698
+ return fromFile(res, where);
699
+ } else {
700
+ return fromRegistry(res);
701
+ }
702
+ }
703
+ function invalidPackageName(name, valid2) {
704
+ const err = new Error(`Invalid package name "${name}": ${valid2.errors.join("; ")}`);
705
+ err.code = "EINVALIDPACKAGENAME";
706
+ return err;
707
+ }
708
+ function invalidTagName(name) {
709
+ const err = new Error(`Invalid tag name "${name}": Tags may not have any characters that encodeURIComponent encodes.`);
710
+ err.code = "EINVALIDTAGNAME";
711
+ return err;
712
+ }
713
+ function Result(opts) {
714
+ this.type = opts.type;
715
+ this.registry = opts.registry;
716
+ this.where = opts.where;
717
+ if (opts.raw == null) {
718
+ this.raw = opts.name ? opts.name + "@" + opts.rawSpec : opts.rawSpec;
719
+ } else {
720
+ this.raw = opts.raw;
721
+ }
722
+ this.name = void 0;
723
+ this.escapedName = void 0;
724
+ this.scope = void 0;
725
+ this.rawSpec = opts.rawSpec == null ? "" : opts.rawSpec;
726
+ this.saveSpec = opts.saveSpec;
727
+ this.fetchSpec = opts.fetchSpec;
728
+ if (opts.name)
729
+ this.setName(opts.name);
730
+ this.gitRange = opts.gitRange;
731
+ this.gitCommittish = opts.gitCommittish;
732
+ this.hosted = opts.hosted;
733
+ }
734
+ Result.prototype = {};
735
+ Result.prototype.setName = function(name) {
736
+ if (!validatePackageName)
737
+ validatePackageName = require_validate_npm_package_name();
738
+ const valid2 = validatePackageName(name);
739
+ if (!valid2.validForOldPackages) {
740
+ throw invalidPackageName(name, valid2);
741
+ }
742
+ this.name = name;
743
+ this.scope = name[0] === "@" ? name.slice(0, name.indexOf("/")) : void 0;
744
+ this.escapedName = name.replace("/", "%2f");
745
+ return this;
746
+ };
747
+ Result.prototype.toString = function() {
748
+ const full = [];
749
+ if (this.name != null && this.name !== "")
750
+ full.push(this.name);
751
+ const spec = this.saveSpec || this.fetchSpec || this.rawSpec;
752
+ if (spec != null && spec !== "")
753
+ full.push(spec);
754
+ return full.length ? full.join("@") : this.raw;
755
+ };
756
+ Result.prototype.toJSON = function() {
757
+ const result = Object.assign({}, this);
758
+ delete result.hosted;
759
+ return result;
760
+ };
761
+ function setGitCommittish(res, committish) {
762
+ if (committish != null && committish.length >= 7 && committish.slice(0, 7) === "semver:") {
763
+ res.gitRange = decodeURIComponent(committish.slice(7));
764
+ res.gitCommittish = null;
765
+ } else {
766
+ res.gitCommittish = committish === "" ? null : committish;
767
+ }
768
+ return res;
769
+ }
770
+ var isAbsolutePath = /^[/]|^[A-Za-z]:/;
771
+ function resolvePath(where, spec) {
772
+ if (isAbsolutePath.test(spec))
773
+ return spec;
774
+ if (!path)
775
+ path = __require("path");
776
+ return path.resolve(where, spec);
777
+ }
778
+ function isAbsolute(dir) {
779
+ if (dir[0] === "/")
780
+ return true;
781
+ if (/^[A-Za-z]:/.test(dir))
782
+ return true;
783
+ return false;
784
+ }
785
+ function fromFile(res, where) {
786
+ if (!where)
787
+ where = process.cwd();
788
+ res.type = isFilename.test(res.rawSpec) ? "file" : "directory";
789
+ res.where = where;
790
+ const spec = res.rawSpec.replace(/\\/g, "/").replace(/^file:[/]*([A-Za-z]:)/, "$1").replace(/^file:(?:[/]*([~./]))?/, "$1");
791
+ if (/^~[/]/.test(spec)) {
792
+ if (!osenv)
793
+ osenv = require_osenv();
794
+ res.fetchSpec = resolvePath(osenv.home(), spec.slice(2));
795
+ res.saveSpec = "file:" + spec;
796
+ } else {
797
+ res.fetchSpec = resolvePath(where, spec);
798
+ if (isAbsolute(spec)) {
799
+ res.saveSpec = "file:" + spec;
800
+ } else {
801
+ if (!path)
802
+ path = __require("path");
803
+ res.saveSpec = "file:" + path.relative(where, res.fetchSpec);
804
+ }
805
+ }
806
+ return res;
807
+ }
808
+ function fromHostedGit(res, hosted) {
809
+ res.type = "git";
810
+ res.hosted = hosted;
811
+ res.saveSpec = hosted.toString({ noGitPlus: false, noCommittish: false });
812
+ res.fetchSpec = hosted.getDefaultRepresentation() === "shortcut" ? null : hosted.toString();
813
+ return setGitCommittish(res, hosted.committish);
814
+ }
815
+ function unsupportedURLType(protocol, spec) {
816
+ const err = new Error(`Unsupported URL Type "${protocol}": ${spec}`);
817
+ err.code = "EUNSUPPORTEDPROTOCOL";
818
+ return err;
819
+ }
820
+ function matchGitScp(spec) {
821
+ const matched = spec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i);
822
+ return matched && !matched[1].match(/:[0-9]+\/?.*$/i) && {
823
+ fetchSpec: matched[1],
824
+ gitCommittish: matched[2] == null ? null : matched[2]
825
+ };
826
+ }
827
+ function fromURL(res) {
828
+ if (!url)
829
+ url = __require("url");
830
+ const urlparse = url.parse(res.rawSpec);
831
+ res.saveSpec = res.rawSpec;
832
+ switch (urlparse.protocol) {
833
+ case "git:":
834
+ case "git+http:":
835
+ case "git+https:":
836
+ case "git+rsync:":
837
+ case "git+ftp:":
838
+ case "git+file:":
839
+ case "git+ssh:":
840
+ res.type = "git";
841
+ const match = urlparse.protocol === "git+ssh:" && matchGitScp(res.rawSpec);
842
+ if (match) {
843
+ setGitCommittish(res, match.gitCommittish);
844
+ res.fetchSpec = match.fetchSpec;
845
+ } else {
846
+ setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : "");
847
+ urlparse.protocol = urlparse.protocol.replace(/^git[+]/, "");
848
+ delete urlparse.hash;
849
+ res.fetchSpec = url.format(urlparse);
850
+ }
851
+ break;
852
+ case "http:":
853
+ case "https:":
854
+ res.type = "remote";
855
+ res.fetchSpec = res.saveSpec;
856
+ break;
857
+ default:
858
+ throw unsupportedURLType(urlparse.protocol, res.rawSpec);
859
+ }
860
+ return res;
861
+ }
862
+ function fromAlias(res, where) {
863
+ const subSpec = npa2(res.rawSpec.substr(4), where);
864
+ if (subSpec.type === "alias") {
865
+ throw new Error("nested aliases not supported");
866
+ }
867
+ if (!subSpec.registry) {
868
+ throw new Error("aliases only work for registry deps");
869
+ }
870
+ res.subSpec = subSpec;
871
+ res.registry = true;
872
+ res.type = "alias";
873
+ res.saveSpec = null;
874
+ res.fetchSpec = null;
875
+ return res;
876
+ }
877
+ function fromRegistry(res) {
878
+ res.registry = true;
879
+ const spec = res.rawSpec === "" ? "latest" : res.rawSpec;
880
+ res.saveSpec = null;
881
+ res.fetchSpec = spec;
882
+ if (!semver)
883
+ semver = require_semver();
884
+ const version2 = semver.valid(spec, true);
885
+ const range = semver.validRange(spec, true);
886
+ if (version2) {
887
+ res.type = "version";
888
+ } else if (range) {
889
+ res.type = "range";
890
+ } else {
891
+ if (encodeURIComponent(spec) !== spec) {
892
+ throw invalidTagName(spec);
893
+ }
894
+ res.type = "tag";
895
+ }
896
+ return res;
897
+ }
898
+ }
899
+ });
900
+
901
+ // src/util/build/import-builders.ts
902
+ var import_npm_package_arg = __toESM(require_npa(), 1);
903
+ var import_semver2 = __toESM(require_semver(), 1);
904
+ var import_fs_extra2 = __toESM(require_lib(), 1);
905
+ var import_fs_detectors = __toESM(require_dist2(), 1);
906
+ import { dirname, join as join2 } from "path";
907
+ import { createRequire } from "module";
908
+
909
+ // src/util/build/static-builder.ts
910
+ var static_builder_exports = {};
911
+ __export(static_builder_exports, {
912
+ build: () => build,
913
+ shouldServe: () => shouldServe,
914
+ version: () => version
915
+ });
916
+ var import_minimatch = __toESM(require_minimatch(), 1);
917
+ import { shouldServe as defaultShouldServe } from "@vercel/build-utils";
918
+ var version = 2;
919
+ var ALWAYS_EXCLUDED_PREFIXES = [".git/", "node_modules/"];
920
+ var ALWAYS_EXCLUDED_FILES = [
921
+ "vercel.json",
922
+ "vercel.toml",
923
+ ...VERCEL_CONFIG_EXTENSIONS.map((ext) => `vercel.${ext}`),
924
+ ".vercelignore",
925
+ "now.json",
926
+ ".nowignore"
927
+ ];
928
+ var DEFAULT_EXCLUDED_FILES = [
929
+ ".gitignore",
930
+ "package.json",
931
+ "package-lock.json",
932
+ "yarn.lock",
933
+ "pnpm-lock.yaml",
934
+ "bun.lock",
935
+ "bun.lockb",
936
+ "README.md"
937
+ ];
938
+ var build = async ({ entrypoint, files, config }) => {
939
+ const output = {};
940
+ const outputDirectory = config.zeroConfig ? config.outputDirectory : "";
941
+ for (let [filename, fileFsRef] of Object.entries(files)) {
942
+ if (ALWAYS_EXCLUDED_PREFIXES.some((prefix) => filename.startsWith(prefix)) || ALWAYS_EXCLUDED_FILES.includes(filename) || DEFAULT_EXCLUDED_FILES.includes(filename) || filename.startsWith(".env")) {
943
+ continue;
944
+ }
945
+ if (entrypoint && !(entrypoint === filename || (0, import_minimatch.default)(filename, entrypoint, { dot: true }))) {
946
+ continue;
947
+ }
948
+ if (outputDirectory) {
949
+ const outputMatch = outputDirectory + "/";
950
+ if (filename.startsWith(outputMatch)) {
951
+ filename = filename.slice(outputMatch.length);
952
+ }
953
+ }
954
+ output[filename] = fileFsRef;
955
+ }
956
+ return { output };
957
+ };
958
+ var shouldServe = (_opts) => {
959
+ const opts = { ..._opts };
960
+ const {
961
+ config: { zeroConfig, outputDirectory }
962
+ } = opts;
963
+ if (zeroConfig && outputDirectory) {
964
+ opts.entrypoint = `${outputDirectory}/${opts.entrypoint}`;
965
+ opts.requestPath = `${outputDirectory}/${opts.requestPath}`;
966
+ }
967
+ return defaultShouldServe(opts);
968
+ };
969
+
970
+ // src/util/build/import-builders.ts
971
+ var import_error_utils2 = __toESM(require_dist(), 1);
972
+
973
+ // src/util/build/install-builders.ts
974
+ var import_pluralize = __toESM(require_pluralize(), 1);
975
+ var import_semver = __toESM(require_semver(), 1);
976
+ var import_fs_extra = __toESM(require_lib(), 1);
977
+ var import_execa = __toESM(require_execa(), 1);
978
+ import { URL } from "url";
979
+ import { join } from "path";
980
+ var import_error_utils = __toESM(require_dist(), 1);
981
+ function getErrorMessage(err, execaMessage) {
982
+ if (!err || !("stderr" in err)) {
983
+ return execaMessage;
984
+ }
985
+ if (typeof err.stderr === "string") {
986
+ return err.stderr;
987
+ }
988
+ return execaMessage;
989
+ }
990
+ async function untracedInstallBuilders(buildersDir, buildersToAdd) {
991
+ const resolvedSpecs = /* @__PURE__ */ new Map();
992
+ const buildersPkgPath = join(buildersDir, "package.json");
993
+ try {
994
+ const emptyPkgJson = {
995
+ private: true,
996
+ license: "UNLICENSED"
997
+ };
998
+ await (0, import_fs_extra.outputJSON)(buildersPkgPath, emptyPkgJson, {
999
+ flag: "wx"
1000
+ });
1001
+ } catch (err) {
1002
+ if (err.code !== "EEXIST")
1003
+ throw err;
1004
+ }
1005
+ output_manager_default.log(
1006
+ `Installing ${(0, import_pluralize.default)("Builder", buildersToAdd.size)}: ${Array.from(
1007
+ buildersToAdd
1008
+ ).join(", ")}`
1009
+ );
1010
+ const buildUtilsVersion = pkg_default.dependencies?.["@vercel/build-utils"];
1011
+ const buildUtilsSpec = buildUtilsVersion && (0, import_semver.validRange)(buildUtilsVersion) ? `@vercel/build-utils@${buildUtilsVersion}` : "@vercel/build-utils";
1012
+ try {
1013
+ const { stderr } = await (0, import_execa.default)(
1014
+ "npm",
1015
+ ["install", buildUtilsSpec, ...buildersToAdd],
1016
+ {
1017
+ cwd: buildersDir,
1018
+ stdio: "pipe",
1019
+ reject: true
1020
+ }
1021
+ );
1022
+ stderr.split("/\r?\n/").filter((line) => line.includes("npm WARN deprecated")).forEach((line) => {
1023
+ output_manager_default.warn(line);
1024
+ });
1025
+ } catch (err) {
1026
+ if ((0, import_error_utils.isError)(err)) {
1027
+ const execaMessage = err.message;
1028
+ let message = getErrorMessage(err, execaMessage);
1029
+ if (execaMessage.startsWith("Command failed with ENOENT")) {
1030
+ message = `Please install ${cmd("npm")} before continuing`;
1031
+ } else {
1032
+ const notFound = /GET (.*) - Not found/.exec(message);
1033
+ if (notFound) {
1034
+ const url = new URL(notFound[1]);
1035
+ const packageName = decodeURIComponent(url.pathname.slice(1));
1036
+ message = `The package ${code(
1037
+ packageName
1038
+ )} is not published on the npm registry`;
1039
+ }
1040
+ }
1041
+ err.message = message;
1042
+ err.link = "https://vercel.link/builder-dependencies-install-failed";
1043
+ }
1044
+ throw err;
1045
+ }
1046
+ const nowScopePath = join(buildersDir, "node_modules/@now");
1047
+ await (0, import_fs_extra.mkdirp)(nowScopePath);
1048
+ try {
1049
+ await (0, import_fs_extra.symlink)("../@vercel/build-utils", join(nowScopePath, "build-utils"));
1050
+ } catch (err) {
1051
+ if (!(0, import_error_utils.isErrnoException)(err) || err.code !== "EEXIST") {
1052
+ throw err;
1053
+ }
1054
+ }
1055
+ const buildersPkg = await readJSONFile(buildersPkgPath);
1056
+ if (buildersPkg instanceof CantParseJSONFile)
1057
+ throw buildersPkg;
1058
+ if (!buildersPkg) {
1059
+ throw new Error(`Failed to load "${buildersPkgPath}"`);
1060
+ }
1061
+ for (const spec of buildersToAdd) {
1062
+ for (const [name, version2] of Object.entries(
1063
+ buildersPkg.dependencies || {}
1064
+ )) {
1065
+ if (version2 === spec) {
1066
+ output_manager_default.debug(`Resolved Builder spec "${spec}" to name "${name}"`);
1067
+ resolvedSpecs.set(spec, name);
1068
+ }
1069
+ }
1070
+ }
1071
+ return resolvedSpecs;
1072
+ }
1073
+ async function installBuilders(buildersDir, buildersToAdd, span, installReasons, pinnedSpecs) {
1074
+ if (!span) {
1075
+ return untracedInstallBuilders(buildersDir, buildersToAdd);
1076
+ }
1077
+ const attributes = {
1078
+ packages: Array.from(buildersToAdd).join(",")
1079
+ };
1080
+ if (installReasons && installReasons.size > 0) {
1081
+ attributes.reasons = Array.from(installReasons).map(([spec, reason]) => `${spec}=${reason}`).join(",");
1082
+ }
1083
+ if (pinnedSpecs && pinnedSpecs.size > 0) {
1084
+ attributes.pinned = "true";
1085
+ attributes.pinnedPackages = Array.from(pinnedSpecs.values()).join(",");
1086
+ }
1087
+ const installSpan = span.child("vc.installBuilders", attributes);
1088
+ return installSpan.trace(async (s) => {
1089
+ try {
1090
+ return await untracedInstallBuilders(buildersDir, buildersToAdd);
1091
+ } catch (err) {
1092
+ s.setAttributes({
1093
+ error: (0, import_error_utils.isError)(err) ? err.message : String(err)
1094
+ });
1095
+ throw err;
1096
+ }
1097
+ });
1098
+ }
1099
+
1100
+ // src/util/build/import-builders.ts
1101
+ var require_ = createRequire(__filename);
1102
+ function isRemoteBuilderPin(pin) {
1103
+ return /^https?:\/\//i.test(pin);
1104
+ }
1105
+ function getBuilderPins() {
1106
+ const builderPins = /* @__PURE__ */ new Map();
1107
+ const pins = pkg_default.builders ?? {};
1108
+ for (const [name, version2] of Object.entries(pins)) {
1109
+ if ((0, import_semver2.validRange)(version2) || isRemoteBuilderPin(version2)) {
1110
+ builderPins.set(name, version2);
1111
+ }
1112
+ }
1113
+ return builderPins;
1114
+ }
1115
+ function isBareSpec(parsed) {
1116
+ return parsed.type === "tag" && parsed.rawSpec === "";
1117
+ }
1118
+ function previewPackSuffix() {
1119
+ const version2 = pkg_default.version;
1120
+ if (typeof version2 !== "string") {
1121
+ return void 0;
1122
+ }
1123
+ const idx = version2.lastIndexOf("-");
1124
+ if (idx === -1) {
1125
+ return void 0;
1126
+ }
1127
+ const suffix = version2.slice(idx + 1);
1128
+ return suffix.length > 0 ? suffix : void 0;
1129
+ }
1130
+ function formatResolvedBuilders(builders) {
1131
+ return Array.from(
1132
+ builders.values(),
1133
+ (b) => b.pkgPath ? `${b.pkg.name}@${b.pkg.version}=${dirname(b.pkgPath)}` : `${b.pkg.name}=built-in`
1134
+ ).join(",");
1135
+ }
1136
+ function pinBuilderSpecs(specs) {
1137
+ const pins = getBuilderPins();
1138
+ const pinnedSpecs = /* @__PURE__ */ new Map();
1139
+ for (const spec of specs) {
1140
+ const parsed = (0, import_npm_package_arg.default)(spec);
1141
+ if (parsed.name && isBareSpec(parsed)) {
1142
+ const version2 = pins.get(parsed.name);
1143
+ if (version2) {
1144
+ pinnedSpecs.set(
1145
+ spec,
1146
+ isRemoteBuilderPin(version2) ? version2 : `${parsed.name}@${version2}`
1147
+ );
1148
+ }
1149
+ }
1150
+ }
1151
+ return pinnedSpecs;
1152
+ }
1153
+ async function importBuilders(builderSpecs, cwd, span) {
1154
+ const buildersDir = join2(cwd, VERCEL_DIR, "builders");
1155
+ let importResult = await resolveBuilders(buildersDir, builderSpecs);
1156
+ if ("buildersToAdd" in importResult) {
1157
+ const { buildersToAdd, installReasons } = importResult;
1158
+ const pinnedSpecs = pinBuilderSpecs(buildersToAdd);
1159
+ const installResult = await installBuilders(
1160
+ buildersDir,
1161
+ new Set(Array.from(buildersToAdd, (spec) => pinnedSpecs.get(spec) ?? spec)),
1162
+ span,
1163
+ installReasons,
1164
+ pinnedSpecs
1165
+ );
1166
+ importResult = await resolveBuilders(
1167
+ buildersDir,
1168
+ builderSpecs,
1169
+ installResult
1170
+ );
1171
+ if ("buildersToAdd" in importResult) {
1172
+ const { buildersToAdd: failed, installReasons: reasons } = importResult;
1173
+ const failures = Array.from(failed, (spec) => {
1174
+ const reason = reasons.get(spec);
1175
+ return reason ? `${spec} (${reason})` : spec;
1176
+ });
1177
+ const err = new Error(
1178
+ `Failed to load Builders after installing them: ${failures.join(
1179
+ ", "
1180
+ )}. Retry the build. If the failure persists, contact Vercel Support.`
1181
+ );
1182
+ err.link = "https://vercel.link/builder-dependencies-install-failed";
1183
+ throw err;
1184
+ }
1185
+ }
1186
+ const resolvedBuildersDebug = [];
1187
+ for (const [spec, builderSpec] of importResult.builders) {
1188
+ resolvedBuildersDebug.push(`${spec} => ${builderSpec.pkg.version}`);
1189
+ }
1190
+ output_manager_default.debug(`Resolved builders: "${resolvedBuildersDebug.join(", ")}"`);
1191
+ return importResult.builders;
1192
+ }
1193
+ function missingModuleId(err) {
1194
+ const match = /Cannot find module '([^']+)'/.exec(err.message);
1195
+ const id = match?.[1];
1196
+ if (!id) {
1197
+ return void 0;
1198
+ }
1199
+ if (id.startsWith("/") || id.startsWith(".") || /^[A-Za-z]:[\\/]/.test(id)) {
1200
+ return void 0;
1201
+ }
1202
+ return id.replace(/[,=]/g, "_").slice(0, 100);
1203
+ }
1204
+ async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
1205
+ const builders = /* @__PURE__ */ new Map();
1206
+ const buildersToAdd = /* @__PURE__ */ new Set();
1207
+ const installReasons = /* @__PURE__ */ new Map();
1208
+ for (const spec of builderSpecs) {
1209
+ const resolvedSpec = resolvedSpecs?.get(spec) || spec;
1210
+ const parsed = (0, import_npm_package_arg.default)(resolvedSpec);
1211
+ const { name } = parsed;
1212
+ if (!name) {
1213
+ buildersToAdd.add(spec);
1214
+ installReasons.set(spec, "url-spec");
1215
+ continue;
1216
+ }
1217
+ if ((0, import_fs_detectors.isStaticRuntime)(name)) {
1218
+ builders.set(name, {
1219
+ builder: static_builder_exports,
1220
+ pkg: { name },
1221
+ path: "",
1222
+ pkgPath: "",
1223
+ dynamicallyInstalled: false
1224
+ });
1225
+ continue;
1226
+ }
1227
+ let entrypointLoadFailed = false;
1228
+ try {
1229
+ let pkgPath;
1230
+ let builderPkg;
1231
+ try {
1232
+ pkgPath = join2(buildersDir, "node_modules", name, "package.json");
1233
+ builderPkg = await (0, import_fs_extra2.readJSON)(pkgPath);
1234
+ } catch (error) {
1235
+ if (!(0, import_error_utils2.isErrnoException)(error)) {
1236
+ throw error;
1237
+ }
1238
+ if (error.code !== "ENOENT") {
1239
+ throw error;
1240
+ }
1241
+ pkgPath = require_.resolve(`${name}/package.json`, {
1242
+ paths: [__dirname]
1243
+ });
1244
+ builderPkg = await (0, import_fs_extra2.readJSON)(pkgPath);
1245
+ }
1246
+ if (!builderPkg || !pkgPath) {
1247
+ throw new Error(`Failed to load \`package.json\` for "${name}"`);
1248
+ }
1249
+ if (typeof builderPkg.version !== "string") {
1250
+ throw new Error(
1251
+ `\`package.json\` for "${name}" does not contain a "version" field`
1252
+ );
1253
+ }
1254
+ const peerVersion = getBuilderPins().get(name);
1255
+ if (isBareSpec(parsed) && peerVersion && (0, import_semver2.valid)(peerVersion) && builderPkg.version !== peerVersion) {
1256
+ output_manager_default.debug(
1257
+ `Resolved "${name}@${builderPkg.version}" does not match pin "${peerVersion}"`
1258
+ );
1259
+ buildersToAdd.add(spec);
1260
+ installReasons.set(spec, "pin-version-mismatch");
1261
+ continue;
1262
+ }
1263
+ const packSuffix = previewPackSuffix();
1264
+ if (isBareSpec(parsed) && peerVersion && isRemoteBuilderPin(peerVersion) && packSuffix && !builderPkg.version.endsWith(`-${packSuffix}`)) {
1265
+ output_manager_default.debug(
1266
+ `Resolved "${name}@${builderPkg.version}" does not carry preview pack suffix "-${packSuffix}"`
1267
+ );
1268
+ buildersToAdd.add(spec);
1269
+ installReasons.set(spec, "preview-pack-mismatch");
1270
+ continue;
1271
+ }
1272
+ if (parsed.type === "version" && parsed.rawSpec !== builderPkg.version) {
1273
+ output_manager_default.debug(
1274
+ `Installed version "${name}@${builderPkg.version}" does not match "${parsed.rawSpec}"`
1275
+ );
1276
+ buildersToAdd.add(spec);
1277
+ installReasons.set(spec, "version-mismatch");
1278
+ continue;
1279
+ }
1280
+ if (parsed.type === "range" && !(0, import_semver2.satisfies)(builderPkg.version, parsed.rawSpec)) {
1281
+ output_manager_default.debug(
1282
+ `Installed version "${name}@${builderPkg.version}" is not compatible with "${parsed.rawSpec}"`
1283
+ );
1284
+ buildersToAdd.add(spec);
1285
+ installReasons.set(spec, "range-mismatch");
1286
+ continue;
1287
+ }
1288
+ const path = join2(dirname(pkgPath), builderPkg.main || "index.js");
1289
+ let builder;
1290
+ try {
1291
+ builder = require_(path);
1292
+ } catch (requireErr) {
1293
+ entrypointLoadFailed = true;
1294
+ throw requireErr;
1295
+ }
1296
+ const dynamicallyInstalled = pkgPath.startsWith(buildersDir);
1297
+ builders.set(spec, {
1298
+ builder,
1299
+ pkg: {
1300
+ name,
1301
+ ...builderPkg
1302
+ },
1303
+ path,
1304
+ pkgPath,
1305
+ dynamicallyInstalled
1306
+ });
1307
+ output_manager_default.debug(`Imported Builder "${name}" from "${dirname(pkgPath)}"`);
1308
+ } catch (err) {
1309
+ if ((err.code === "MODULE_NOT_FOUND" || err.code === "ENOENT") && !resolvedSpecs) {
1310
+ output_manager_default.debug(`Failed to import "${name}": ${err}`);
1311
+ buildersToAdd.add(spec);
1312
+ if (entrypointLoadFailed) {
1313
+ const missing = missingModuleId(err);
1314
+ installReasons.set(
1315
+ spec,
1316
+ missing ? `entrypoint-load-failed:${missing}` : "entrypoint-load-failed"
1317
+ );
1318
+ } else {
1319
+ installReasons.set(spec, "not-installed");
1320
+ }
1321
+ } else {
1322
+ err.message = `Importing "${name}": ${err.message}`;
1323
+ throw err;
1324
+ }
1325
+ }
1326
+ }
1327
+ if (buildersToAdd.size > 0) {
1328
+ return { buildersToAdd, installReasons };
1329
+ }
1330
+ return { builders };
1331
+ }
1332
+
1333
+ export {
1334
+ require_npa,
1335
+ formatResolvedBuilders,
1336
+ importBuilders
1337
+ };