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.
- package/dist/chunks/{add-245XOFJO.js → add-I7X6NXYD.js} +4 -4
- package/dist/chunks/{add-P7WBQMBW.js → add-KMRFKOPJ.js} +44 -9
- package/dist/chunks/{add-XH24V5VU.js → add-USFLACJX.js} +4 -4
- package/dist/chunks/{build-M7NJYJPE.js → build-GNX3QE6Q.js} +4 -4
- package/dist/chunks/{chunk-WR7JTCGL.js → chunk-3BU2UCGV.js} +1 -1
- package/dist/chunks/{chunk-MAHXF73X.js → chunk-3L2YLLHC.js} +1 -1
- package/dist/chunks/{chunk-ZGBBPJ6B.js → chunk-4XKF7JOF.js} +92 -1377
- package/dist/chunks/{chunk-2LBVX2H3.js → chunk-5SZ6VX2H.js} +2 -2
- package/dist/chunks/{chunk-2MAPZXVV.js → chunk-62SBYAED.js} +5 -5
- package/dist/chunks/{chunk-UE3JUVUZ.js → chunk-74XVGG52.js} +2 -2
- package/dist/chunks/{chunk-2FMPLU44.js → chunk-7KUQ7BHI.js} +2 -2
- package/dist/chunks/{chunk-YDUINEII.js → chunk-7SXWLTXT.js} +6 -4
- package/dist/chunks/{chunk-M5NOLAJ4.js → chunk-BIGFTNW6.js} +1 -1
- package/dist/chunks/{chunk-YCPUAG77.js → chunk-CDYBV7YA.js} +1 -1
- package/dist/chunks/{chunk-4BUPRO5B.js → chunk-D6SC2UJH.js} +1 -1
- package/dist/chunks/{chunk-62MH5KPX.js → chunk-DHTB5D3E.js} +5 -5
- package/dist/chunks/{chunk-NJ6QXKQD.js → chunk-H3KETQAA.js} +1 -1
- package/dist/chunks/{chunk-NJUPUGOE.js → chunk-HT2XWSAJ.js} +1 -1
- package/dist/chunks/chunk-I2XE3GMB.js +21 -0
- package/dist/chunks/chunk-LC5BYUUP.js +1337 -0
- package/dist/chunks/{chunk-SJYAUEZR.js → chunk-MNZUPMZZ.js} +3 -15
- package/dist/chunks/chunk-MXLA3VQS.js +20 -0
- package/dist/chunks/{chunk-XE5VSQ25.js → chunk-NI4DNP3D.js} +1 -1
- package/dist/chunks/{chunk-Y5GTPWXB.js → chunk-NOMQUVGM.js} +2 -2
- package/dist/chunks/{chunk-AQDWMAPM.js → chunk-NYKWLQQM.js} +10 -8
- package/dist/chunks/{chunk-4CCY5OPH.js → chunk-NZ6GDMPB.js} +306 -217
- package/dist/chunks/chunk-TE5MIANG.js +96 -0
- package/dist/chunks/{chunk-EBLH23AQ.js → chunk-TEQKKTJQ.js} +4 -7
- package/dist/chunks/{chunk-2WILSD7J.js → chunk-TNTJXJSE.js} +1 -1
- package/dist/chunks/{chunk-IEDUCUDV.js → chunk-UAVZOOOL.js} +10 -8
- package/dist/chunks/{chunk-4UYKSYKQ.js → chunk-UMA66MKW.js} +66 -2
- package/dist/chunks/{chunk-CPFNFVCL.js → chunk-UME4MVFU.js} +1 -1
- package/dist/chunks/{chunk-HSYF5SI3.js → chunk-YR6M7ZIU.js} +1 -1
- package/dist/chunks/{chunk-3QAUXPIR.js → chunk-ZZZEJXHD.js} +172 -51
- package/dist/chunks/{clear-HWIKQ4NC.js → clear-ERVHWAHX.js} +4 -4
- package/dist/chunks/{compile-vercel-config-U5NRIMZ2.js → compile-vercel-config-PM5ID4CV.js} +2 -2
- package/dist/chunks/{constants-3FSSR6E7.js → constants-T6BULVX6.js} +1 -1
- package/dist/chunks/{delete-NVMGVD5Z.js → delete-GMVIUCQV.js} +3 -3
- package/dist/chunks/{delete-FZCOUFGN.js → delete-XB24AZGV.js} +4 -4
- package/dist/chunks/{disable-ERM2BWEQ.js → disable-JJZZQ4IZ.js} +3 -3
- package/dist/chunks/{discard-KM5OLEN4.js → discard-CGAS2MSK.js} +3 -3
- package/dist/chunks/{edit-HT3UTATZ.js → edit-RKUUUBQF.js} +4 -4
- package/dist/chunks/{edit-TOSB2EMI.js → edit-TFZDCJTL.js} +5 -5
- package/dist/chunks/{enable-BQL6AOQV.js → enable-UXRVQO6C.js} +3 -3
- package/dist/chunks/{export-UOWQHOG3.js → export-WQE3UU4V.js} +3 -3
- package/dist/chunks/{image-F5SC6Q7Y.js → image-HV7N6RTK.js} +3 -3
- package/dist/chunks/import-builders-IEVZ7KYP.js +28 -0
- package/dist/chunks/{inspect-PZJM2CWT.js → inspect-4BXZOMC2.js} +7 -7
- package/dist/chunks/{inspect-35FU5R62.js → inspect-DT2PX6LB.js} +4 -4
- package/dist/chunks/{inspect-5J5GSTOB.js → inspect-E3YSH5BV.js} +4 -4
- package/dist/chunks/{inspect-GKJ6T5H4.js → inspect-NADJYMSZ.js} +4 -4
- package/dist/chunks/{inspect-LGKOLH2O.js → inspect-VDQEM3E6.js} +5 -5
- package/dist/chunks/{list-KZETH3ZE.js → list-5PLKF2GL.js} +3 -3
- package/dist/chunks/{list-ITFJYYQ2.js → list-ARM4RM22.js} +9 -9
- package/dist/chunks/{list-2IIE7CAP.js → list-RVE2NAC5.js} +5 -5
- package/dist/chunks/{login-BQPJCJEZ.js → login-VHGNOKBB.js} +4 -4
- package/dist/chunks/{ls-7GHDK4MD.js → ls-4QRIPSBC.js} +13 -13
- package/dist/chunks/{ls-DL2LA35C.js → ls-IVVP4H24.js} +4 -4
- package/dist/chunks/{ls-UXUEP54B.js → ls-OTCUUI4L.js} +4 -4
- package/dist/chunks/{ls-YSFWSM6J.js → ls-QBKFZC52.js} +4 -4
- package/dist/chunks/{ls-ZZFLH7PK.js → ls-YME2AL47.js} +4 -4
- package/dist/chunks/{open-ADNJQN5E.js → open-KYVW2GTM.js} +4 -4
- package/dist/chunks/{permissions-72SZCBIY.js → permissions-BLHKOJDO.js} +4 -4
- package/dist/chunks/{publish-OOAGSEBM.js → publish-4BKTL25X.js} +3 -3
- package/dist/chunks/{push-B6TZDXNF.js → push-IJFWOWD7.js} +4 -4
- package/dist/chunks/{query-LZWS5TDH.js → query-VIV66DLZ.js} +3 -3
- package/dist/chunks/{reorder-MRHFKPMK.js → reorder-C44IJZNE.js} +3 -3
- package/dist/chunks/{reply-BKTJXO3B.js → reply-M6WBMKBN.js} +5 -5
- package/dist/chunks/{resolve-BKVGSGPN.js → resolve-44ICWDRT.js} +4 -4
- package/dist/chunks/{restore-USR7SKWV.js → restore-ACDVNSTC.js} +3 -3
- package/dist/chunks/{rm-2UO6BT3A.js → rm-K2FDC5CL.js} +6 -6
- package/dist/chunks/{rm-37MKKV3I.js → rm-P2ILGP4I.js} +4 -4
- package/dist/chunks/{rm-VY3OHKFH.js → rm-Q7VXI345.js} +4 -4
- package/dist/chunks/{rm-KUWPNZIS.js → rm-RO3R3MZT.js} +4 -4
- package/dist/chunks/{rule-inspect-JVDOOTWK.js → rule-inspect-JGKJXOUD.js} +13 -20
- package/dist/chunks/{rules-NTBFZBIF.js → rules-BRTF5HJP.js} +9 -6
- package/dist/chunks/schema-T7RNRNKT.js +426 -0
- package/dist/chunks/{schema-6EZ72OVH.js → schema-Z3L5ZOEE.js} +2 -2
- package/dist/chunks/{tags-HNPC63QA.js → tags-BPHVFK53.js} +2 -2
- package/dist/chunks/{update-LUYWNZP3.js → update-5KQU4HCK.js} +38 -6
- package/dist/commands/build/index.js +65 -24
- package/dist/commands/deploy/index.js +24 -17
- package/dist/commands/dev/index.js +41 -18
- package/dist/commands/env/index.js +89 -150
- package/dist/commands/link/index.js +9 -9
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +3183 -2199
- package/dist/index.js +12 -11
- package/dist/vc.js +11 -14
- package/dist/version.mjs +1 -1
- package/package.json +54 -48
- package/dist/chunks/{chunk-BUZRVER7.js → chunk-P65EEFTR.js} +3 -3
|
@@ -5,900 +5,21 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
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
8
|
VERCEL_DIR,
|
|
16
|
-
readJSONFile,
|
|
17
9
|
require_dist as require_dist2,
|
|
18
10
|
require_dist3,
|
|
19
|
-
require_lib
|
|
20
|
-
|
|
21
|
-
require_pluralize
|
|
22
|
-
} from "./chunk-4CCY5OPH.js";
|
|
23
|
-
import {
|
|
24
|
-
CantParseJSONFile,
|
|
25
|
-
cmd,
|
|
26
|
-
code
|
|
27
|
-
} from "./chunk-SOFC4MLS.js";
|
|
28
|
-
import {
|
|
29
|
-
pkg_default
|
|
30
|
-
} from "./chunk-P4QNYOFB.js";
|
|
11
|
+
require_lib
|
|
12
|
+
} from "./chunk-NZ6GDMPB.js";
|
|
31
13
|
import {
|
|
32
14
|
output_manager_default,
|
|
33
15
|
require_dist
|
|
34
16
|
} from "./chunk-OX7KI3LF.js";
|
|
35
17
|
import {
|
|
36
18
|
__commonJS,
|
|
37
|
-
__export,
|
|
38
19
|
__require,
|
|
39
20
|
__toESM
|
|
40
21
|
} from "./chunk-TZ2YI2VH.js";
|
|
41
22
|
|
|
42
|
-
// ../../node_modules/.pnpm/builtins@1.0.3/node_modules/builtins/builtins.json
|
|
43
|
-
var require_builtins = __commonJS({
|
|
44
|
-
"../../node_modules/.pnpm/builtins@1.0.3/node_modules/builtins/builtins.json"(exports, module) {
|
|
45
|
-
module.exports = [
|
|
46
|
-
"assert",
|
|
47
|
-
"buffer",
|
|
48
|
-
"child_process",
|
|
49
|
-
"cluster",
|
|
50
|
-
"console",
|
|
51
|
-
"constants",
|
|
52
|
-
"crypto",
|
|
53
|
-
"dgram",
|
|
54
|
-
"dns",
|
|
55
|
-
"domain",
|
|
56
|
-
"events",
|
|
57
|
-
"fs",
|
|
58
|
-
"http",
|
|
59
|
-
"https",
|
|
60
|
-
"module",
|
|
61
|
-
"net",
|
|
62
|
-
"os",
|
|
63
|
-
"path",
|
|
64
|
-
"process",
|
|
65
|
-
"punycode",
|
|
66
|
-
"querystring",
|
|
67
|
-
"readline",
|
|
68
|
-
"repl",
|
|
69
|
-
"stream",
|
|
70
|
-
"string_decoder",
|
|
71
|
-
"timers",
|
|
72
|
-
"tls",
|
|
73
|
-
"tty",
|
|
74
|
-
"url",
|
|
75
|
-
"util",
|
|
76
|
-
"v8",
|
|
77
|
-
"vm",
|
|
78
|
-
"zlib"
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// ../../node_modules/.pnpm/validate-npm-package-name@3.0.0/node_modules/validate-npm-package-name/index.js
|
|
84
|
-
var require_validate_npm_package_name = __commonJS({
|
|
85
|
-
"../../node_modules/.pnpm/validate-npm-package-name@3.0.0/node_modules/validate-npm-package-name/index.js"(exports, module) {
|
|
86
|
-
"use strict";
|
|
87
|
-
var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
|
|
88
|
-
var builtins = require_builtins();
|
|
89
|
-
var blacklist = [
|
|
90
|
-
"node_modules",
|
|
91
|
-
"favicon.ico"
|
|
92
|
-
];
|
|
93
|
-
var validate = module.exports = function(name) {
|
|
94
|
-
var warnings = [];
|
|
95
|
-
var errors = [];
|
|
96
|
-
if (name === null) {
|
|
97
|
-
errors.push("name cannot be null");
|
|
98
|
-
return done(warnings, errors);
|
|
99
|
-
}
|
|
100
|
-
if (name === void 0) {
|
|
101
|
-
errors.push("name cannot be undefined");
|
|
102
|
-
return done(warnings, errors);
|
|
103
|
-
}
|
|
104
|
-
if (typeof name !== "string") {
|
|
105
|
-
errors.push("name must be a string");
|
|
106
|
-
return done(warnings, errors);
|
|
107
|
-
}
|
|
108
|
-
if (!name.length) {
|
|
109
|
-
errors.push("name length must be greater than zero");
|
|
110
|
-
}
|
|
111
|
-
if (name.match(/^\./)) {
|
|
112
|
-
errors.push("name cannot start with a period");
|
|
113
|
-
}
|
|
114
|
-
if (name.match(/^_/)) {
|
|
115
|
-
errors.push("name cannot start with an underscore");
|
|
116
|
-
}
|
|
117
|
-
if (name.trim() !== name) {
|
|
118
|
-
errors.push("name cannot contain leading or trailing spaces");
|
|
119
|
-
}
|
|
120
|
-
blacklist.forEach(function(blacklistedName) {
|
|
121
|
-
if (name.toLowerCase() === blacklistedName) {
|
|
122
|
-
errors.push(blacklistedName + " is a blacklisted name");
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
builtins.forEach(function(builtin) {
|
|
126
|
-
if (name.toLowerCase() === builtin) {
|
|
127
|
-
warnings.push(builtin + " is a core module name");
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
if (name.length > 214) {
|
|
131
|
-
warnings.push("name can no longer contain more than 214 characters");
|
|
132
|
-
}
|
|
133
|
-
if (name.toLowerCase() !== name) {
|
|
134
|
-
warnings.push("name can no longer contain capital letters");
|
|
135
|
-
}
|
|
136
|
-
if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) {
|
|
137
|
-
warnings.push(`name can no longer contain special characters ("~'!()*")`);
|
|
138
|
-
}
|
|
139
|
-
if (encodeURIComponent(name) !== name) {
|
|
140
|
-
var nameMatch = name.match(scopedPackagePattern);
|
|
141
|
-
if (nameMatch) {
|
|
142
|
-
var user = nameMatch[1];
|
|
143
|
-
var pkg = nameMatch[2];
|
|
144
|
-
if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) {
|
|
145
|
-
return done(warnings, errors);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
errors.push("name can only contain URL-friendly characters");
|
|
149
|
-
}
|
|
150
|
-
return done(warnings, errors);
|
|
151
|
-
};
|
|
152
|
-
validate.scopedPackagePattern = scopedPackagePattern;
|
|
153
|
-
var done = function(warnings, errors) {
|
|
154
|
-
var result = {
|
|
155
|
-
validForNewPackages: errors.length === 0 && warnings.length === 0,
|
|
156
|
-
validForOldPackages: errors.length === 0,
|
|
157
|
-
warnings,
|
|
158
|
-
errors
|
|
159
|
-
};
|
|
160
|
-
if (!result.warnings.length)
|
|
161
|
-
delete result.warnings;
|
|
162
|
-
if (!result.errors.length)
|
|
163
|
-
delete result.errors;
|
|
164
|
-
return result;
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// ../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host-info.js
|
|
170
|
-
var require_git_host_info = __commonJS({
|
|
171
|
-
"../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host-info.js"(exports, module) {
|
|
172
|
-
"use strict";
|
|
173
|
-
var gitHosts = module.exports = {
|
|
174
|
-
github: {
|
|
175
|
-
// First two are insecure and generally shouldn't be used any more, but
|
|
176
|
-
// they are still supported.
|
|
177
|
-
"protocols": ["git", "http", "git+ssh", "git+https", "ssh", "https"],
|
|
178
|
-
"domain": "github.com",
|
|
179
|
-
"treepath": "tree",
|
|
180
|
-
"filetemplate": "https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",
|
|
181
|
-
"bugstemplate": "https://{domain}/{user}/{project}/issues",
|
|
182
|
-
"gittemplate": "git://{auth@}{domain}/{user}/{project}.git{#committish}",
|
|
183
|
-
"tarballtemplate": "https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"
|
|
184
|
-
},
|
|
185
|
-
bitbucket: {
|
|
186
|
-
"protocols": ["git+ssh", "git+https", "ssh", "https"],
|
|
187
|
-
"domain": "bitbucket.org",
|
|
188
|
-
"treepath": "src",
|
|
189
|
-
"tarballtemplate": "https://{domain}/{user}/{project}/get/{committish}.tar.gz"
|
|
190
|
-
},
|
|
191
|
-
gitlab: {
|
|
192
|
-
"protocols": ["git+ssh", "git+https", "ssh", "https"],
|
|
193
|
-
"domain": "gitlab.com",
|
|
194
|
-
"treepath": "tree",
|
|
195
|
-
"bugstemplate": "https://{domain}/{user}/{project}/issues",
|
|
196
|
-
"httpstemplate": "git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",
|
|
197
|
-
"tarballtemplate": "https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",
|
|
198
|
-
"pathmatch": /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/
|
|
199
|
-
},
|
|
200
|
-
gist: {
|
|
201
|
-
"protocols": ["git", "git+ssh", "git+https", "ssh", "https"],
|
|
202
|
-
"domain": "gist.github.com",
|
|
203
|
-
"pathmatch": /^[/](?:([^/]+)[/])?([a-z0-9]{32,})(?:[.]git)?$/,
|
|
204
|
-
"filetemplate": "https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",
|
|
205
|
-
"bugstemplate": "https://{domain}/{project}",
|
|
206
|
-
"gittemplate": "git://{domain}/{project}.git{#committish}",
|
|
207
|
-
"sshtemplate": "git@{domain}:/{project}.git{#committish}",
|
|
208
|
-
"sshurltemplate": "git+ssh://git@{domain}/{project}.git{#committish}",
|
|
209
|
-
"browsetemplate": "https://{domain}/{project}{/committish}",
|
|
210
|
-
"browsefiletemplate": "https://{domain}/{project}{/committish}{#path}",
|
|
211
|
-
"docstemplate": "https://{domain}/{project}{/committish}",
|
|
212
|
-
"httpstemplate": "git+https://{domain}/{project}.git{#committish}",
|
|
213
|
-
"shortcuttemplate": "{type}:{project}{#committish}",
|
|
214
|
-
"pathtemplate": "{project}{#committish}",
|
|
215
|
-
"tarballtemplate": "https://codeload.github.com/gist/{project}/tar.gz/{committish}",
|
|
216
|
-
"hashformat": function(fragment) {
|
|
217
|
-
return "file-" + formatHashFragment(fragment);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
var gitHostDefaults = {
|
|
222
|
-
"sshtemplate": "git@{domain}:{user}/{project}.git{#committish}",
|
|
223
|
-
"sshurltemplate": "git+ssh://git@{domain}/{user}/{project}.git{#committish}",
|
|
224
|
-
"browsetemplate": "https://{domain}/{user}/{project}{/tree/committish}",
|
|
225
|
-
"browsefiletemplate": "https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",
|
|
226
|
-
"docstemplate": "https://{domain}/{user}/{project}{/tree/committish}#readme",
|
|
227
|
-
"httpstemplate": "git+https://{auth@}{domain}/{user}/{project}.git{#committish}",
|
|
228
|
-
"filetemplate": "https://{domain}/{user}/{project}/raw/{committish}/{path}",
|
|
229
|
-
"shortcuttemplate": "{type}:{user}/{project}{#committish}",
|
|
230
|
-
"pathtemplate": "{user}/{project}{#committish}",
|
|
231
|
-
"pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,
|
|
232
|
-
"hashformat": formatHashFragment
|
|
233
|
-
};
|
|
234
|
-
Object.keys(gitHosts).forEach(function(name) {
|
|
235
|
-
Object.keys(gitHostDefaults).forEach(function(key) {
|
|
236
|
-
if (gitHosts[name][key])
|
|
237
|
-
return;
|
|
238
|
-
gitHosts[name][key] = gitHostDefaults[key];
|
|
239
|
-
});
|
|
240
|
-
gitHosts[name].protocols_re = RegExp("^(" + gitHosts[name].protocols.map(function(protocol) {
|
|
241
|
-
return protocol.replace(/([\\+*{}()[\]$^|])/g, "\\$1");
|
|
242
|
-
}).join("|") + "):$");
|
|
243
|
-
});
|
|
244
|
-
function formatHashFragment(fragment) {
|
|
245
|
-
return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, "").replace(/\W+/g, "-");
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
// ../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host.js
|
|
251
|
-
var require_git_host = __commonJS({
|
|
252
|
-
"../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/git-host.js"(exports, module) {
|
|
253
|
-
"use strict";
|
|
254
|
-
var gitHosts = require_git_host_info();
|
|
255
|
-
var extend = Object.assign || function _extend(target, source) {
|
|
256
|
-
if (source === null || typeof source !== "object")
|
|
257
|
-
return target;
|
|
258
|
-
var keys = Object.keys(source);
|
|
259
|
-
var i = keys.length;
|
|
260
|
-
while (i--) {
|
|
261
|
-
target[keys[i]] = source[keys[i]];
|
|
262
|
-
}
|
|
263
|
-
return target;
|
|
264
|
-
};
|
|
265
|
-
module.exports = GitHost;
|
|
266
|
-
function GitHost(type, user, auth, project, committish, defaultRepresentation, opts) {
|
|
267
|
-
var gitHostInfo = this;
|
|
268
|
-
gitHostInfo.type = type;
|
|
269
|
-
Object.keys(gitHosts[type]).forEach(function(key) {
|
|
270
|
-
gitHostInfo[key] = gitHosts[type][key];
|
|
271
|
-
});
|
|
272
|
-
gitHostInfo.user = user;
|
|
273
|
-
gitHostInfo.auth = auth;
|
|
274
|
-
gitHostInfo.project = project;
|
|
275
|
-
gitHostInfo.committish = committish;
|
|
276
|
-
gitHostInfo.default = defaultRepresentation;
|
|
277
|
-
gitHostInfo.opts = opts || {};
|
|
278
|
-
}
|
|
279
|
-
GitHost.prototype.hash = function() {
|
|
280
|
-
return this.committish ? "#" + this.committish : "";
|
|
281
|
-
};
|
|
282
|
-
GitHost.prototype._fill = function(template, opts) {
|
|
283
|
-
if (!template)
|
|
284
|
-
return;
|
|
285
|
-
var vars = extend({}, opts);
|
|
286
|
-
vars.path = vars.path ? vars.path.replace(/^[/]+/g, "") : "";
|
|
287
|
-
opts = extend(extend({}, this.opts), opts);
|
|
288
|
-
var self = this;
|
|
289
|
-
Object.keys(this).forEach(function(key) {
|
|
290
|
-
if (self[key] != null && vars[key] == null)
|
|
291
|
-
vars[key] = self[key];
|
|
292
|
-
});
|
|
293
|
-
var rawAuth = vars.auth;
|
|
294
|
-
var rawcommittish = vars.committish;
|
|
295
|
-
var rawFragment = vars.fragment;
|
|
296
|
-
var rawPath = vars.path;
|
|
297
|
-
var rawProject = vars.project;
|
|
298
|
-
Object.keys(vars).forEach(function(key) {
|
|
299
|
-
var value = vars[key];
|
|
300
|
-
if ((key === "path" || key === "project") && typeof value === "string") {
|
|
301
|
-
vars[key] = value.split("/").map(function(pathComponent) {
|
|
302
|
-
return encodeURIComponent(pathComponent);
|
|
303
|
-
}).join("/");
|
|
304
|
-
} else {
|
|
305
|
-
vars[key] = encodeURIComponent(value);
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
vars["auth@"] = rawAuth ? rawAuth + "@" : "";
|
|
309
|
-
vars["#fragment"] = rawFragment ? "#" + this.hashformat(rawFragment) : "";
|
|
310
|
-
vars.fragment = vars.fragment ? vars.fragment : "";
|
|
311
|
-
vars["#path"] = rawPath ? "#" + this.hashformat(rawPath) : "";
|
|
312
|
-
vars["/path"] = vars.path ? "/" + vars.path : "";
|
|
313
|
-
vars.projectPath = rawProject.split("/").map(encodeURIComponent).join("/");
|
|
314
|
-
if (opts.noCommittish) {
|
|
315
|
-
vars["#committish"] = "";
|
|
316
|
-
vars["/tree/committish"] = "";
|
|
317
|
-
vars["/committish"] = "";
|
|
318
|
-
vars.committish = "";
|
|
319
|
-
} else {
|
|
320
|
-
vars["#committish"] = rawcommittish ? "#" + rawcommittish : "";
|
|
321
|
-
vars["/tree/committish"] = vars.committish ? "/" + vars.treepath + "/" + vars.committish : "";
|
|
322
|
-
vars["/committish"] = vars.committish ? "/" + vars.committish : "";
|
|
323
|
-
vars.committish = vars.committish || "master";
|
|
324
|
-
}
|
|
325
|
-
var res = template;
|
|
326
|
-
Object.keys(vars).forEach(function(key) {
|
|
327
|
-
res = res.replace(new RegExp("[{]" + key + "[}]", "g"), vars[key]);
|
|
328
|
-
});
|
|
329
|
-
if (opts.noGitPlus) {
|
|
330
|
-
return res.replace(/^git[+]/, "");
|
|
331
|
-
} else {
|
|
332
|
-
return res;
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
GitHost.prototype.ssh = function(opts) {
|
|
336
|
-
return this._fill(this.sshtemplate, opts);
|
|
337
|
-
};
|
|
338
|
-
GitHost.prototype.sshurl = function(opts) {
|
|
339
|
-
return this._fill(this.sshurltemplate, opts);
|
|
340
|
-
};
|
|
341
|
-
GitHost.prototype.browse = function(P, F, opts) {
|
|
342
|
-
if (typeof P === "string") {
|
|
343
|
-
if (typeof F !== "string") {
|
|
344
|
-
opts = F;
|
|
345
|
-
F = null;
|
|
346
|
-
}
|
|
347
|
-
return this._fill(this.browsefiletemplate, extend({
|
|
348
|
-
fragment: F,
|
|
349
|
-
path: P
|
|
350
|
-
}, opts));
|
|
351
|
-
} else {
|
|
352
|
-
return this._fill(this.browsetemplate, P);
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
GitHost.prototype.docs = function(opts) {
|
|
356
|
-
return this._fill(this.docstemplate, opts);
|
|
357
|
-
};
|
|
358
|
-
GitHost.prototype.bugs = function(opts) {
|
|
359
|
-
return this._fill(this.bugstemplate, opts);
|
|
360
|
-
};
|
|
361
|
-
GitHost.prototype.https = function(opts) {
|
|
362
|
-
return this._fill(this.httpstemplate, opts);
|
|
363
|
-
};
|
|
364
|
-
GitHost.prototype.git = function(opts) {
|
|
365
|
-
return this._fill(this.gittemplate, opts);
|
|
366
|
-
};
|
|
367
|
-
GitHost.prototype.shortcut = function(opts) {
|
|
368
|
-
return this._fill(this.shortcuttemplate, opts);
|
|
369
|
-
};
|
|
370
|
-
GitHost.prototype.path = function(opts) {
|
|
371
|
-
return this._fill(this.pathtemplate, opts);
|
|
372
|
-
};
|
|
373
|
-
GitHost.prototype.tarball = function(opts_) {
|
|
374
|
-
var opts = extend({}, opts_, { noCommittish: false });
|
|
375
|
-
return this._fill(this.tarballtemplate, opts);
|
|
376
|
-
};
|
|
377
|
-
GitHost.prototype.file = function(P, opts) {
|
|
378
|
-
return this._fill(this.filetemplate, extend({ path: P }, opts));
|
|
379
|
-
};
|
|
380
|
-
GitHost.prototype.getDefaultRepresentation = function() {
|
|
381
|
-
return this.default;
|
|
382
|
-
};
|
|
383
|
-
GitHost.prototype.toString = function(opts) {
|
|
384
|
-
if (this.default && typeof this[this.default] === "function")
|
|
385
|
-
return this[this.default](opts);
|
|
386
|
-
return this.sshurl(opts);
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
// ../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/index.js
|
|
392
|
-
var require_hosted_git_info = __commonJS({
|
|
393
|
-
"../../node_modules/.pnpm/hosted-git-info@2.8.9/node_modules/hosted-git-info/index.js"(exports, module) {
|
|
394
|
-
"use strict";
|
|
395
|
-
var url = __require("url");
|
|
396
|
-
var gitHosts = require_git_host_info();
|
|
397
|
-
var GitHost = module.exports = require_git_host();
|
|
398
|
-
var protocolToRepresentationMap = {
|
|
399
|
-
"git+ssh:": "sshurl",
|
|
400
|
-
"git+https:": "https",
|
|
401
|
-
"ssh:": "sshurl",
|
|
402
|
-
"git:": "git"
|
|
403
|
-
};
|
|
404
|
-
function protocolToRepresentation(protocol) {
|
|
405
|
-
return protocolToRepresentationMap[protocol] || protocol.slice(0, -1);
|
|
406
|
-
}
|
|
407
|
-
var authProtocols = {
|
|
408
|
-
"git:": true,
|
|
409
|
-
"https:": true,
|
|
410
|
-
"git+https:": true,
|
|
411
|
-
"http:": true,
|
|
412
|
-
"git+http:": true
|
|
413
|
-
};
|
|
414
|
-
var cache = {};
|
|
415
|
-
module.exports.fromUrl = function(giturl, opts) {
|
|
416
|
-
if (typeof giturl !== "string")
|
|
417
|
-
return;
|
|
418
|
-
var key = giturl + JSON.stringify(opts || {});
|
|
419
|
-
if (!(key in cache)) {
|
|
420
|
-
cache[key] = fromUrl(giturl, opts);
|
|
421
|
-
}
|
|
422
|
-
return cache[key];
|
|
423
|
-
};
|
|
424
|
-
function fromUrl(giturl, opts) {
|
|
425
|
-
if (giturl == null || giturl === "")
|
|
426
|
-
return;
|
|
427
|
-
var url2 = fixupUnqualifiedGist(
|
|
428
|
-
isGitHubShorthand(giturl) ? "github:" + giturl : giturl
|
|
429
|
-
);
|
|
430
|
-
var parsed = parseGitUrl(url2);
|
|
431
|
-
var shortcutMatch = url2.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/);
|
|
432
|
-
var matches = Object.keys(gitHosts).map(function(gitHostName) {
|
|
433
|
-
try {
|
|
434
|
-
var gitHostInfo = gitHosts[gitHostName];
|
|
435
|
-
var auth = null;
|
|
436
|
-
if (parsed.auth && authProtocols[parsed.protocol]) {
|
|
437
|
-
auth = parsed.auth;
|
|
438
|
-
}
|
|
439
|
-
var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null;
|
|
440
|
-
var user = null;
|
|
441
|
-
var project = null;
|
|
442
|
-
var defaultRepresentation = null;
|
|
443
|
-
if (shortcutMatch && shortcutMatch[1] === gitHostName) {
|
|
444
|
-
user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2]);
|
|
445
|
-
project = decodeURIComponent(shortcutMatch[3].replace(/\.git$/, ""));
|
|
446
|
-
defaultRepresentation = "shortcut";
|
|
447
|
-
} else {
|
|
448
|
-
if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, "") !== gitHostInfo.domain)
|
|
449
|
-
return;
|
|
450
|
-
if (!gitHostInfo.protocols_re.test(parsed.protocol))
|
|
451
|
-
return;
|
|
452
|
-
if (!parsed.path)
|
|
453
|
-
return;
|
|
454
|
-
var pathmatch = gitHostInfo.pathmatch;
|
|
455
|
-
var matched = parsed.path.match(pathmatch);
|
|
456
|
-
if (!matched)
|
|
457
|
-
return;
|
|
458
|
-
if (matched[1] !== null && matched[1] !== void 0) {
|
|
459
|
-
user = decodeURIComponent(matched[1].replace(/^:/, ""));
|
|
460
|
-
}
|
|
461
|
-
project = decodeURIComponent(matched[2]);
|
|
462
|
-
defaultRepresentation = protocolToRepresentation(parsed.protocol);
|
|
463
|
-
}
|
|
464
|
-
return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts);
|
|
465
|
-
} catch (ex) {
|
|
466
|
-
if (ex instanceof URIError) {
|
|
467
|
-
} else
|
|
468
|
-
throw ex;
|
|
469
|
-
}
|
|
470
|
-
}).filter(function(gitHostInfo) {
|
|
471
|
-
return gitHostInfo;
|
|
472
|
-
});
|
|
473
|
-
if (matches.length !== 1)
|
|
474
|
-
return;
|
|
475
|
-
return matches[0];
|
|
476
|
-
}
|
|
477
|
-
function isGitHubShorthand(arg) {
|
|
478
|
-
return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg);
|
|
479
|
-
}
|
|
480
|
-
function fixupUnqualifiedGist(giturl) {
|
|
481
|
-
var parsed = url.parse(giturl);
|
|
482
|
-
if (parsed.protocol === "gist:" && parsed.host && !parsed.path) {
|
|
483
|
-
return parsed.protocol + "/" + parsed.host;
|
|
484
|
-
} else {
|
|
485
|
-
return giturl;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
function parseGitUrl(giturl) {
|
|
489
|
-
var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);
|
|
490
|
-
if (!matched) {
|
|
491
|
-
var legacy = url.parse(giturl);
|
|
492
|
-
if (legacy.auth && typeof url.URL === "function") {
|
|
493
|
-
var authmatch = giturl.match(/[^@]+@[^:/]+/);
|
|
494
|
-
if (authmatch) {
|
|
495
|
-
var whatwg = new url.URL(authmatch[0]);
|
|
496
|
-
legacy.auth = whatwg.username || "";
|
|
497
|
-
if (whatwg.password)
|
|
498
|
-
legacy.auth += ":" + whatwg.password;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return legacy;
|
|
502
|
-
}
|
|
503
|
-
return {
|
|
504
|
-
protocol: "git+ssh:",
|
|
505
|
-
slashes: true,
|
|
506
|
-
auth: matched[1],
|
|
507
|
-
host: matched[2],
|
|
508
|
-
port: null,
|
|
509
|
-
hostname: matched[2],
|
|
510
|
-
hash: matched[4],
|
|
511
|
-
search: null,
|
|
512
|
-
query: null,
|
|
513
|
-
pathname: "/" + matched[3],
|
|
514
|
-
path: "/" + matched[3],
|
|
515
|
-
href: "git+ssh://" + matched[1] + "@" + matched[2] + "/" + matched[3] + (matched[4] || "")
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
// ../../node_modules/.pnpm/os-tmpdir@1.0.2/node_modules/os-tmpdir/index.js
|
|
522
|
-
var require_os_tmpdir = __commonJS({
|
|
523
|
-
"../../node_modules/.pnpm/os-tmpdir@1.0.2/node_modules/os-tmpdir/index.js"(exports, module) {
|
|
524
|
-
"use strict";
|
|
525
|
-
var isWindows = process.platform === "win32";
|
|
526
|
-
var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
|
|
527
|
-
module.exports = function() {
|
|
528
|
-
var path2;
|
|
529
|
-
if (isWindows) {
|
|
530
|
-
path2 = process.env.TEMP || process.env.TMP || (process.env.SystemRoot || process.env.windir) + "\\temp";
|
|
531
|
-
} else {
|
|
532
|
-
path2 = process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp";
|
|
533
|
-
}
|
|
534
|
-
if (trailingSlashRe.test(path2)) {
|
|
535
|
-
path2 = path2.slice(0, -1);
|
|
536
|
-
}
|
|
537
|
-
return path2;
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
// ../../node_modules/.pnpm/os-homedir@1.0.2/node_modules/os-homedir/index.js
|
|
543
|
-
var require_os_homedir = __commonJS({
|
|
544
|
-
"../../node_modules/.pnpm/os-homedir@1.0.2/node_modules/os-homedir/index.js"(exports, module) {
|
|
545
|
-
"use strict";
|
|
546
|
-
var os = __require("os");
|
|
547
|
-
function homedir() {
|
|
548
|
-
var env = process.env;
|
|
549
|
-
var home = env.HOME;
|
|
550
|
-
var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
|
|
551
|
-
if (process.platform === "win32") {
|
|
552
|
-
return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
|
|
553
|
-
}
|
|
554
|
-
if (process.platform === "darwin") {
|
|
555
|
-
return home || (user ? "/Users/" + user : null);
|
|
556
|
-
}
|
|
557
|
-
if (process.platform === "linux") {
|
|
558
|
-
return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
|
|
559
|
-
}
|
|
560
|
-
return home || null;
|
|
561
|
-
}
|
|
562
|
-
module.exports = typeof os.homedir === "function" ? os.homedir : homedir;
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
// ../../node_modules/.pnpm/osenv@0.1.5/node_modules/osenv/osenv.js
|
|
567
|
-
var require_osenv = __commonJS({
|
|
568
|
-
"../../node_modules/.pnpm/osenv@0.1.5/node_modules/osenv/osenv.js"(exports) {
|
|
569
|
-
var isWindows = process.platform === "win32";
|
|
570
|
-
var path2 = __require("path");
|
|
571
|
-
var exec = __require("child_process").exec;
|
|
572
|
-
var osTmpdir = require_os_tmpdir();
|
|
573
|
-
var osHomedir = require_os_homedir();
|
|
574
|
-
function memo(key, lookup, fallback) {
|
|
575
|
-
var fell = false;
|
|
576
|
-
var falling = false;
|
|
577
|
-
exports[key] = function(cb) {
|
|
578
|
-
var val = lookup();
|
|
579
|
-
if (!val && !fell && !falling && fallback) {
|
|
580
|
-
fell = true;
|
|
581
|
-
falling = true;
|
|
582
|
-
exec(fallback, function(er, output, stderr) {
|
|
583
|
-
falling = false;
|
|
584
|
-
if (er)
|
|
585
|
-
return;
|
|
586
|
-
val = output.trim();
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
exports[key] = function(cb2) {
|
|
590
|
-
if (cb2)
|
|
591
|
-
process.nextTick(cb2.bind(null, null, val));
|
|
592
|
-
return val;
|
|
593
|
-
};
|
|
594
|
-
if (cb && !falling)
|
|
595
|
-
process.nextTick(cb.bind(null, null, val));
|
|
596
|
-
return val;
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
memo("user", function() {
|
|
600
|
-
return isWindows ? process.env.USERDOMAIN + "\\" + process.env.USERNAME : process.env.USER;
|
|
601
|
-
}, "whoami");
|
|
602
|
-
memo("prompt", function() {
|
|
603
|
-
return isWindows ? process.env.PROMPT : process.env.PS1;
|
|
604
|
-
});
|
|
605
|
-
memo("hostname", function() {
|
|
606
|
-
return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME;
|
|
607
|
-
}, "hostname");
|
|
608
|
-
memo("tmpdir", function() {
|
|
609
|
-
return osTmpdir();
|
|
610
|
-
});
|
|
611
|
-
memo("home", function() {
|
|
612
|
-
return osHomedir();
|
|
613
|
-
});
|
|
614
|
-
memo("path", function() {
|
|
615
|
-
return (process.env.PATH || process.env.Path || process.env.path).split(isWindows ? ";" : ":");
|
|
616
|
-
});
|
|
617
|
-
memo("editor", function() {
|
|
618
|
-
return process.env.EDITOR || process.env.VISUAL || (isWindows ? "notepad.exe" : "vi");
|
|
619
|
-
});
|
|
620
|
-
memo("shell", function() {
|
|
621
|
-
return isWindows ? process.env.ComSpec || "cmd" : process.env.SHELL || "bash";
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
// ../../node_modules/.pnpm/npm-package-arg@6.1.0/node_modules/npm-package-arg/npa.js
|
|
627
|
-
var require_npa = __commonJS({
|
|
628
|
-
"../../node_modules/.pnpm/npm-package-arg@6.1.0/node_modules/npm-package-arg/npa.js"(exports, module) {
|
|
629
|
-
"use strict";
|
|
630
|
-
module.exports = npa2;
|
|
631
|
-
module.exports.resolve = resolve3;
|
|
632
|
-
module.exports.Result = Result;
|
|
633
|
-
var url;
|
|
634
|
-
var HostedGit;
|
|
635
|
-
var semver;
|
|
636
|
-
var path2;
|
|
637
|
-
var validatePackageName;
|
|
638
|
-
var osenv;
|
|
639
|
-
var isWindows = process.platform === "win32" || global.FAKE_WINDOWS;
|
|
640
|
-
var hasSlashes = isWindows ? /\\|[/]/ : /[/]/;
|
|
641
|
-
var isURL = /^(?:git[+])?[a-z]+:/i;
|
|
642
|
-
var isFilename = /[.](?:tgz|tar.gz|tar)$/i;
|
|
643
|
-
function npa2(arg, where) {
|
|
644
|
-
let name;
|
|
645
|
-
let spec;
|
|
646
|
-
if (typeof arg === "object") {
|
|
647
|
-
if (arg instanceof Result && (!where || where === arg.where)) {
|
|
648
|
-
return arg;
|
|
649
|
-
} else if (arg.name && arg.rawSpec) {
|
|
650
|
-
return npa2.resolve(arg.name, arg.rawSpec, where || arg.where);
|
|
651
|
-
} else {
|
|
652
|
-
return npa2(arg.raw, where || arg.where);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
const nameEndsAt = arg[0] === "@" ? arg.slice(1).indexOf("@") + 1 : arg.indexOf("@");
|
|
656
|
-
const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg;
|
|
657
|
-
if (isURL.test(arg)) {
|
|
658
|
-
spec = arg;
|
|
659
|
-
} else if (namePart[0] !== "@" && (hasSlashes.test(namePart) || isFilename.test(namePart))) {
|
|
660
|
-
spec = arg;
|
|
661
|
-
} else if (nameEndsAt > 0) {
|
|
662
|
-
name = namePart;
|
|
663
|
-
spec = arg.slice(nameEndsAt + 1);
|
|
664
|
-
} else {
|
|
665
|
-
if (!validatePackageName)
|
|
666
|
-
validatePackageName = require_validate_npm_package_name();
|
|
667
|
-
const valid = validatePackageName(arg);
|
|
668
|
-
if (valid.validForOldPackages) {
|
|
669
|
-
name = arg;
|
|
670
|
-
} else {
|
|
671
|
-
spec = arg;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
return resolve3(name, spec, where, arg);
|
|
675
|
-
}
|
|
676
|
-
var isFilespec = isWindows ? /^(?:[.]|~[/]|[/\\]|[a-zA-Z]:)/ : /^(?:[.]|~[/]|[/]|[a-zA-Z]:)/;
|
|
677
|
-
function resolve3(name, spec, where, arg) {
|
|
678
|
-
const res = new Result({
|
|
679
|
-
raw: arg,
|
|
680
|
-
name,
|
|
681
|
-
rawSpec: spec,
|
|
682
|
-
fromArgument: arg != null
|
|
683
|
-
});
|
|
684
|
-
if (name)
|
|
685
|
-
res.setName(name);
|
|
686
|
-
if (spec && (isFilespec.test(spec) || /^file:/i.test(spec))) {
|
|
687
|
-
return fromFile(res, where);
|
|
688
|
-
} else if (spec && /^npm:/i.test(spec)) {
|
|
689
|
-
return fromAlias(res, where);
|
|
690
|
-
}
|
|
691
|
-
if (!HostedGit)
|
|
692
|
-
HostedGit = require_hosted_git_info();
|
|
693
|
-
const hosted = HostedGit.fromUrl(spec, { noGitPlus: true, noCommittish: true });
|
|
694
|
-
if (hosted) {
|
|
695
|
-
return fromHostedGit(res, hosted);
|
|
696
|
-
} else if (spec && isURL.test(spec)) {
|
|
697
|
-
return fromURL(res);
|
|
698
|
-
} else if (spec && (hasSlashes.test(spec) || isFilename.test(spec))) {
|
|
699
|
-
return fromFile(res, where);
|
|
700
|
-
} else {
|
|
701
|
-
return fromRegistry(res);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
function invalidPackageName(name, valid) {
|
|
705
|
-
const err = new Error(`Invalid package name "${name}": ${valid.errors.join("; ")}`);
|
|
706
|
-
err.code = "EINVALIDPACKAGENAME";
|
|
707
|
-
return err;
|
|
708
|
-
}
|
|
709
|
-
function invalidTagName(name) {
|
|
710
|
-
const err = new Error(`Invalid tag name "${name}": Tags may not have any characters that encodeURIComponent encodes.`);
|
|
711
|
-
err.code = "EINVALIDTAGNAME";
|
|
712
|
-
return err;
|
|
713
|
-
}
|
|
714
|
-
function Result(opts) {
|
|
715
|
-
this.type = opts.type;
|
|
716
|
-
this.registry = opts.registry;
|
|
717
|
-
this.where = opts.where;
|
|
718
|
-
if (opts.raw == null) {
|
|
719
|
-
this.raw = opts.name ? opts.name + "@" + opts.rawSpec : opts.rawSpec;
|
|
720
|
-
} else {
|
|
721
|
-
this.raw = opts.raw;
|
|
722
|
-
}
|
|
723
|
-
this.name = void 0;
|
|
724
|
-
this.escapedName = void 0;
|
|
725
|
-
this.scope = void 0;
|
|
726
|
-
this.rawSpec = opts.rawSpec == null ? "" : opts.rawSpec;
|
|
727
|
-
this.saveSpec = opts.saveSpec;
|
|
728
|
-
this.fetchSpec = opts.fetchSpec;
|
|
729
|
-
if (opts.name)
|
|
730
|
-
this.setName(opts.name);
|
|
731
|
-
this.gitRange = opts.gitRange;
|
|
732
|
-
this.gitCommittish = opts.gitCommittish;
|
|
733
|
-
this.hosted = opts.hosted;
|
|
734
|
-
}
|
|
735
|
-
Result.prototype = {};
|
|
736
|
-
Result.prototype.setName = function(name) {
|
|
737
|
-
if (!validatePackageName)
|
|
738
|
-
validatePackageName = require_validate_npm_package_name();
|
|
739
|
-
const valid = validatePackageName(name);
|
|
740
|
-
if (!valid.validForOldPackages) {
|
|
741
|
-
throw invalidPackageName(name, valid);
|
|
742
|
-
}
|
|
743
|
-
this.name = name;
|
|
744
|
-
this.scope = name[0] === "@" ? name.slice(0, name.indexOf("/")) : void 0;
|
|
745
|
-
this.escapedName = name.replace("/", "%2f");
|
|
746
|
-
return this;
|
|
747
|
-
};
|
|
748
|
-
Result.prototype.toString = function() {
|
|
749
|
-
const full = [];
|
|
750
|
-
if (this.name != null && this.name !== "")
|
|
751
|
-
full.push(this.name);
|
|
752
|
-
const spec = this.saveSpec || this.fetchSpec || this.rawSpec;
|
|
753
|
-
if (spec != null && spec !== "")
|
|
754
|
-
full.push(spec);
|
|
755
|
-
return full.length ? full.join("@") : this.raw;
|
|
756
|
-
};
|
|
757
|
-
Result.prototype.toJSON = function() {
|
|
758
|
-
const result = Object.assign({}, this);
|
|
759
|
-
delete result.hosted;
|
|
760
|
-
return result;
|
|
761
|
-
};
|
|
762
|
-
function setGitCommittish(res, committish) {
|
|
763
|
-
if (committish != null && committish.length >= 7 && committish.slice(0, 7) === "semver:") {
|
|
764
|
-
res.gitRange = decodeURIComponent(committish.slice(7));
|
|
765
|
-
res.gitCommittish = null;
|
|
766
|
-
} else {
|
|
767
|
-
res.gitCommittish = committish === "" ? null : committish;
|
|
768
|
-
}
|
|
769
|
-
return res;
|
|
770
|
-
}
|
|
771
|
-
var isAbsolutePath = /^[/]|^[A-Za-z]:/;
|
|
772
|
-
function resolvePath(where, spec) {
|
|
773
|
-
if (isAbsolutePath.test(spec))
|
|
774
|
-
return spec;
|
|
775
|
-
if (!path2)
|
|
776
|
-
path2 = __require("path");
|
|
777
|
-
return path2.resolve(where, spec);
|
|
778
|
-
}
|
|
779
|
-
function isAbsolute(dir) {
|
|
780
|
-
if (dir[0] === "/")
|
|
781
|
-
return true;
|
|
782
|
-
if (/^[A-Za-z]:/.test(dir))
|
|
783
|
-
return true;
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
function fromFile(res, where) {
|
|
787
|
-
if (!where)
|
|
788
|
-
where = process.cwd();
|
|
789
|
-
res.type = isFilename.test(res.rawSpec) ? "file" : "directory";
|
|
790
|
-
res.where = where;
|
|
791
|
-
const spec = res.rawSpec.replace(/\\/g, "/").replace(/^file:[/]*([A-Za-z]:)/, "$1").replace(/^file:(?:[/]*([~./]))?/, "$1");
|
|
792
|
-
if (/^~[/]/.test(spec)) {
|
|
793
|
-
if (!osenv)
|
|
794
|
-
osenv = require_osenv();
|
|
795
|
-
res.fetchSpec = resolvePath(osenv.home(), spec.slice(2));
|
|
796
|
-
res.saveSpec = "file:" + spec;
|
|
797
|
-
} else {
|
|
798
|
-
res.fetchSpec = resolvePath(where, spec);
|
|
799
|
-
if (isAbsolute(spec)) {
|
|
800
|
-
res.saveSpec = "file:" + spec;
|
|
801
|
-
} else {
|
|
802
|
-
if (!path2)
|
|
803
|
-
path2 = __require("path");
|
|
804
|
-
res.saveSpec = "file:" + path2.relative(where, res.fetchSpec);
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
return res;
|
|
808
|
-
}
|
|
809
|
-
function fromHostedGit(res, hosted) {
|
|
810
|
-
res.type = "git";
|
|
811
|
-
res.hosted = hosted;
|
|
812
|
-
res.saveSpec = hosted.toString({ noGitPlus: false, noCommittish: false });
|
|
813
|
-
res.fetchSpec = hosted.getDefaultRepresentation() === "shortcut" ? null : hosted.toString();
|
|
814
|
-
return setGitCommittish(res, hosted.committish);
|
|
815
|
-
}
|
|
816
|
-
function unsupportedURLType(protocol, spec) {
|
|
817
|
-
const err = new Error(`Unsupported URL Type "${protocol}": ${spec}`);
|
|
818
|
-
err.code = "EUNSUPPORTEDPROTOCOL";
|
|
819
|
-
return err;
|
|
820
|
-
}
|
|
821
|
-
function matchGitScp(spec) {
|
|
822
|
-
const matched = spec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i);
|
|
823
|
-
return matched && !matched[1].match(/:[0-9]+\/?.*$/i) && {
|
|
824
|
-
fetchSpec: matched[1],
|
|
825
|
-
gitCommittish: matched[2] == null ? null : matched[2]
|
|
826
|
-
};
|
|
827
|
-
}
|
|
828
|
-
function fromURL(res) {
|
|
829
|
-
if (!url)
|
|
830
|
-
url = __require("url");
|
|
831
|
-
const urlparse = url.parse(res.rawSpec);
|
|
832
|
-
res.saveSpec = res.rawSpec;
|
|
833
|
-
switch (urlparse.protocol) {
|
|
834
|
-
case "git:":
|
|
835
|
-
case "git+http:":
|
|
836
|
-
case "git+https:":
|
|
837
|
-
case "git+rsync:":
|
|
838
|
-
case "git+ftp:":
|
|
839
|
-
case "git+file:":
|
|
840
|
-
case "git+ssh:":
|
|
841
|
-
res.type = "git";
|
|
842
|
-
const match = urlparse.protocol === "git+ssh:" && matchGitScp(res.rawSpec);
|
|
843
|
-
if (match) {
|
|
844
|
-
setGitCommittish(res, match.gitCommittish);
|
|
845
|
-
res.fetchSpec = match.fetchSpec;
|
|
846
|
-
} else {
|
|
847
|
-
setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : "");
|
|
848
|
-
urlparse.protocol = urlparse.protocol.replace(/^git[+]/, "");
|
|
849
|
-
delete urlparse.hash;
|
|
850
|
-
res.fetchSpec = url.format(urlparse);
|
|
851
|
-
}
|
|
852
|
-
break;
|
|
853
|
-
case "http:":
|
|
854
|
-
case "https:":
|
|
855
|
-
res.type = "remote";
|
|
856
|
-
res.fetchSpec = res.saveSpec;
|
|
857
|
-
break;
|
|
858
|
-
default:
|
|
859
|
-
throw unsupportedURLType(urlparse.protocol, res.rawSpec);
|
|
860
|
-
}
|
|
861
|
-
return res;
|
|
862
|
-
}
|
|
863
|
-
function fromAlias(res, where) {
|
|
864
|
-
const subSpec = npa2(res.rawSpec.substr(4), where);
|
|
865
|
-
if (subSpec.type === "alias") {
|
|
866
|
-
throw new Error("nested aliases not supported");
|
|
867
|
-
}
|
|
868
|
-
if (!subSpec.registry) {
|
|
869
|
-
throw new Error("aliases only work for registry deps");
|
|
870
|
-
}
|
|
871
|
-
res.subSpec = subSpec;
|
|
872
|
-
res.registry = true;
|
|
873
|
-
res.type = "alias";
|
|
874
|
-
res.saveSpec = null;
|
|
875
|
-
res.fetchSpec = null;
|
|
876
|
-
return res;
|
|
877
|
-
}
|
|
878
|
-
function fromRegistry(res) {
|
|
879
|
-
res.registry = true;
|
|
880
|
-
const spec = res.rawSpec === "" ? "latest" : res.rawSpec;
|
|
881
|
-
res.saveSpec = null;
|
|
882
|
-
res.fetchSpec = spec;
|
|
883
|
-
if (!semver)
|
|
884
|
-
semver = require_semver();
|
|
885
|
-
const version2 = semver.valid(spec, true);
|
|
886
|
-
const range = semver.validRange(spec, true);
|
|
887
|
-
if (version2) {
|
|
888
|
-
res.type = "version";
|
|
889
|
-
} else if (range) {
|
|
890
|
-
res.type = "range";
|
|
891
|
-
} else {
|
|
892
|
-
if (encodeURIComponent(spec) !== spec) {
|
|
893
|
-
throw invalidTagName(spec);
|
|
894
|
-
}
|
|
895
|
-
res.type = "tag";
|
|
896
|
-
}
|
|
897
|
-
return res;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
|
|
902
23
|
// ../../node_modules/.pnpm/mime-db@1.40.0/node_modules/mime-db/db.json
|
|
903
24
|
var require_db = __commonJS({
|
|
904
25
|
"../../node_modules/.pnpm/mime-db@1.40.0/node_modules/mime-db/db.json"(exports, module) {
|
|
@@ -10880,8 +10001,8 @@ async function explode(paths, { accepts }) {
|
|
|
10880
10001
|
try {
|
|
10881
10002
|
all = await import_fs_extra.default.readdir(file);
|
|
10882
10003
|
} catch (err) {
|
|
10883
|
-
const
|
|
10884
|
-
if (
|
|
10004
|
+
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
10005
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
10885
10006
|
debug(`Ignoring directory that has since been removed ${file}`);
|
|
10886
10007
|
return null;
|
|
10887
10008
|
}
|
|
@@ -10904,409 +10025,6 @@ function notNull(value) {
|
|
|
10904
10025
|
return value !== null;
|
|
10905
10026
|
}
|
|
10906
10027
|
|
|
10907
|
-
// src/util/build/import-builders.ts
|
|
10908
|
-
var import_npm_package_arg = __toESM(require_npa(), 1);
|
|
10909
|
-
var import_semver2 = __toESM(require_semver(), 1);
|
|
10910
|
-
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
10911
|
-
var import_fs_detectors = __toESM(require_dist3(), 1);
|
|
10912
|
-
import { dirname, join as join2 } from "path";
|
|
10913
|
-
import { createRequire } from "module";
|
|
10914
|
-
|
|
10915
|
-
// src/util/build/static-builder.ts
|
|
10916
|
-
var static_builder_exports = {};
|
|
10917
|
-
__export(static_builder_exports, {
|
|
10918
|
-
build: () => build,
|
|
10919
|
-
shouldServe: () => shouldServe,
|
|
10920
|
-
version: () => version
|
|
10921
|
-
});
|
|
10922
|
-
var import_minimatch = __toESM(require_minimatch(), 1);
|
|
10923
|
-
import { shouldServe as defaultShouldServe } from "@vercel/build-utils";
|
|
10924
|
-
var version = 2;
|
|
10925
|
-
var ALWAYS_EXCLUDED_PREFIXES = [".git/", "node_modules/"];
|
|
10926
|
-
var ALWAYS_EXCLUDED_FILES = [
|
|
10927
|
-
"vercel.json",
|
|
10928
|
-
"vercel.toml",
|
|
10929
|
-
...VERCEL_CONFIG_EXTENSIONS.map((ext) => `vercel.${ext}`),
|
|
10930
|
-
".vercelignore",
|
|
10931
|
-
"now.json",
|
|
10932
|
-
".nowignore"
|
|
10933
|
-
];
|
|
10934
|
-
var DEFAULT_EXCLUDED_FILES = [
|
|
10935
|
-
".gitignore",
|
|
10936
|
-
"package.json",
|
|
10937
|
-
"package-lock.json",
|
|
10938
|
-
"yarn.lock",
|
|
10939
|
-
"pnpm-lock.yaml",
|
|
10940
|
-
"bun.lock",
|
|
10941
|
-
"bun.lockb",
|
|
10942
|
-
"README.md"
|
|
10943
|
-
];
|
|
10944
|
-
var build = async ({ entrypoint, files, config }) => {
|
|
10945
|
-
const output = {};
|
|
10946
|
-
const outputDirectory = config.zeroConfig ? config.outputDirectory : "";
|
|
10947
|
-
for (let [filename, fileFsRef] of Object.entries(files)) {
|
|
10948
|
-
if (ALWAYS_EXCLUDED_PREFIXES.some((prefix) => filename.startsWith(prefix)) || ALWAYS_EXCLUDED_FILES.includes(filename) || DEFAULT_EXCLUDED_FILES.includes(filename) || filename.startsWith(".env")) {
|
|
10949
|
-
continue;
|
|
10950
|
-
}
|
|
10951
|
-
if (entrypoint && !(entrypoint === filename || (0, import_minimatch.default)(filename, entrypoint, { dot: true }))) {
|
|
10952
|
-
continue;
|
|
10953
|
-
}
|
|
10954
|
-
if (outputDirectory) {
|
|
10955
|
-
const outputMatch = outputDirectory + "/";
|
|
10956
|
-
if (filename.startsWith(outputMatch)) {
|
|
10957
|
-
filename = filename.slice(outputMatch.length);
|
|
10958
|
-
}
|
|
10959
|
-
}
|
|
10960
|
-
output[filename] = fileFsRef;
|
|
10961
|
-
}
|
|
10962
|
-
return { output };
|
|
10963
|
-
};
|
|
10964
|
-
var shouldServe = (_opts) => {
|
|
10965
|
-
const opts = { ..._opts };
|
|
10966
|
-
const {
|
|
10967
|
-
config: { zeroConfig, outputDirectory }
|
|
10968
|
-
} = opts;
|
|
10969
|
-
if (zeroConfig && outputDirectory) {
|
|
10970
|
-
opts.entrypoint = `${outputDirectory}/${opts.entrypoint}`;
|
|
10971
|
-
opts.requestPath = `${outputDirectory}/${opts.requestPath}`;
|
|
10972
|
-
}
|
|
10973
|
-
return defaultShouldServe(opts);
|
|
10974
|
-
};
|
|
10975
|
-
|
|
10976
|
-
// src/util/build/import-builders.ts
|
|
10977
|
-
var import_error_utils2 = __toESM(require_dist(), 1);
|
|
10978
|
-
|
|
10979
|
-
// src/util/build/install-builders.ts
|
|
10980
|
-
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
10981
|
-
var import_semver = __toESM(require_semver(), 1);
|
|
10982
|
-
var import_fs_extra2 = __toESM(require_lib(), 1);
|
|
10983
|
-
var import_execa = __toESM(require_execa(), 1);
|
|
10984
|
-
import { URL } from "url";
|
|
10985
|
-
import { join } from "path";
|
|
10986
|
-
var import_error_utils = __toESM(require_dist(), 1);
|
|
10987
|
-
function getErrorMessage(err, execaMessage) {
|
|
10988
|
-
if (!err || !("stderr" in err)) {
|
|
10989
|
-
return execaMessage;
|
|
10990
|
-
}
|
|
10991
|
-
if (typeof err.stderr === "string") {
|
|
10992
|
-
return err.stderr;
|
|
10993
|
-
}
|
|
10994
|
-
return execaMessage;
|
|
10995
|
-
}
|
|
10996
|
-
async function untracedInstallBuilders(buildersDir, buildersToAdd) {
|
|
10997
|
-
const resolvedSpecs = /* @__PURE__ */ new Map();
|
|
10998
|
-
const buildersPkgPath = join(buildersDir, "package.json");
|
|
10999
|
-
try {
|
|
11000
|
-
const emptyPkgJson = {
|
|
11001
|
-
private: true,
|
|
11002
|
-
license: "UNLICENSED"
|
|
11003
|
-
};
|
|
11004
|
-
await (0, import_fs_extra2.outputJSON)(buildersPkgPath, emptyPkgJson, {
|
|
11005
|
-
flag: "wx"
|
|
11006
|
-
});
|
|
11007
|
-
} catch (err) {
|
|
11008
|
-
if (err.code !== "EEXIST")
|
|
11009
|
-
throw err;
|
|
11010
|
-
}
|
|
11011
|
-
output_manager_default.log(
|
|
11012
|
-
`Installing ${(0, import_pluralize.default)("Builder", buildersToAdd.size)}: ${Array.from(
|
|
11013
|
-
buildersToAdd
|
|
11014
|
-
).join(", ")}`
|
|
11015
|
-
);
|
|
11016
|
-
const buildUtilsVersion = pkg_default.dependencies?.["@vercel/build-utils"];
|
|
11017
|
-
const buildUtilsSpec = buildUtilsVersion && (0, import_semver.validRange)(buildUtilsVersion) ? `@vercel/build-utils@${buildUtilsVersion}` : "@vercel/build-utils";
|
|
11018
|
-
try {
|
|
11019
|
-
const { stderr } = await (0, import_execa.default)(
|
|
11020
|
-
"npm",
|
|
11021
|
-
["install", buildUtilsSpec, ...buildersToAdd],
|
|
11022
|
-
{
|
|
11023
|
-
cwd: buildersDir,
|
|
11024
|
-
stdio: "pipe",
|
|
11025
|
-
reject: true
|
|
11026
|
-
}
|
|
11027
|
-
);
|
|
11028
|
-
stderr.split("/\r?\n/").filter((line) => line.includes("npm WARN deprecated")).forEach((line) => {
|
|
11029
|
-
output_manager_default.warn(line);
|
|
11030
|
-
});
|
|
11031
|
-
} catch (err) {
|
|
11032
|
-
if ((0, import_error_utils.isError)(err)) {
|
|
11033
|
-
const execaMessage = err.message;
|
|
11034
|
-
let message = getErrorMessage(err, execaMessage);
|
|
11035
|
-
if (execaMessage.startsWith("Command failed with ENOENT")) {
|
|
11036
|
-
message = `Please install ${cmd("npm")} before continuing`;
|
|
11037
|
-
} else {
|
|
11038
|
-
const notFound = /GET (.*) - Not found/.exec(message);
|
|
11039
|
-
if (notFound) {
|
|
11040
|
-
const url = new URL(notFound[1]);
|
|
11041
|
-
const packageName = decodeURIComponent(url.pathname.slice(1));
|
|
11042
|
-
message = `The package ${code(
|
|
11043
|
-
packageName
|
|
11044
|
-
)} is not published on the npm registry`;
|
|
11045
|
-
}
|
|
11046
|
-
}
|
|
11047
|
-
err.message = message;
|
|
11048
|
-
err.link = "https://vercel.link/builder-dependencies-install-failed";
|
|
11049
|
-
}
|
|
11050
|
-
throw err;
|
|
11051
|
-
}
|
|
11052
|
-
const nowScopePath = join(buildersDir, "node_modules/@now");
|
|
11053
|
-
await (0, import_fs_extra2.mkdirp)(nowScopePath);
|
|
11054
|
-
try {
|
|
11055
|
-
await (0, import_fs_extra2.symlink)("../@vercel/build-utils", join(nowScopePath, "build-utils"));
|
|
11056
|
-
} catch (err) {
|
|
11057
|
-
if (!(0, import_error_utils.isErrnoException)(err) || err.code !== "EEXIST") {
|
|
11058
|
-
throw err;
|
|
11059
|
-
}
|
|
11060
|
-
}
|
|
11061
|
-
const buildersPkg = await readJSONFile(buildersPkgPath);
|
|
11062
|
-
if (buildersPkg instanceof CantParseJSONFile)
|
|
11063
|
-
throw buildersPkg;
|
|
11064
|
-
if (!buildersPkg) {
|
|
11065
|
-
throw new Error(`Failed to load "${buildersPkgPath}"`);
|
|
11066
|
-
}
|
|
11067
|
-
for (const spec of buildersToAdd) {
|
|
11068
|
-
for (const [name, version2] of Object.entries(
|
|
11069
|
-
buildersPkg.dependencies || {}
|
|
11070
|
-
)) {
|
|
11071
|
-
if (version2 === spec) {
|
|
11072
|
-
output_manager_default.debug(`Resolved Builder spec "${spec}" to name "${name}"`);
|
|
11073
|
-
resolvedSpecs.set(spec, name);
|
|
11074
|
-
}
|
|
11075
|
-
}
|
|
11076
|
-
}
|
|
11077
|
-
return resolvedSpecs;
|
|
11078
|
-
}
|
|
11079
|
-
async function installBuilders(buildersDir, buildersToAdd, span, installReasons) {
|
|
11080
|
-
if (!span) {
|
|
11081
|
-
return untracedInstallBuilders(buildersDir, buildersToAdd);
|
|
11082
|
-
}
|
|
11083
|
-
const attributes = {
|
|
11084
|
-
packages: Array.from(buildersToAdd).join(",")
|
|
11085
|
-
};
|
|
11086
|
-
if (installReasons && installReasons.size > 0) {
|
|
11087
|
-
attributes.reasons = Array.from(installReasons).map(([spec, reason]) => `${spec}=${reason}`).join(",");
|
|
11088
|
-
}
|
|
11089
|
-
const installSpan = span.child("vc.installBuilders", attributes);
|
|
11090
|
-
return installSpan.trace(async (s) => {
|
|
11091
|
-
try {
|
|
11092
|
-
return await untracedInstallBuilders(buildersDir, buildersToAdd);
|
|
11093
|
-
} catch (err) {
|
|
11094
|
-
s.setAttributes({
|
|
11095
|
-
error: (0, import_error_utils.isError)(err) ? err.message : String(err)
|
|
11096
|
-
});
|
|
11097
|
-
throw err;
|
|
11098
|
-
}
|
|
11099
|
-
});
|
|
11100
|
-
}
|
|
11101
|
-
|
|
11102
|
-
// src/util/build/import-builders.ts
|
|
11103
|
-
var require_ = createRequire(__filename);
|
|
11104
|
-
var builderPins;
|
|
11105
|
-
function getBuilderPins() {
|
|
11106
|
-
if (!builderPins) {
|
|
11107
|
-
builderPins = /* @__PURE__ */ new Map();
|
|
11108
|
-
const pins = pkg_default.builders ?? {};
|
|
11109
|
-
for (const [name, version2] of Object.entries(pins)) {
|
|
11110
|
-
if ((0, import_semver2.validRange)(version2)) {
|
|
11111
|
-
builderPins.set(name, version2);
|
|
11112
|
-
}
|
|
11113
|
-
}
|
|
11114
|
-
}
|
|
11115
|
-
return builderPins;
|
|
11116
|
-
}
|
|
11117
|
-
function isBareSpec(parsed) {
|
|
11118
|
-
return parsed.type === "tag" && parsed.rawSpec === "";
|
|
11119
|
-
}
|
|
11120
|
-
function formatResolvedBuilders(builders) {
|
|
11121
|
-
return Array.from(
|
|
11122
|
-
builders.values(),
|
|
11123
|
-
(b) => b.pkgPath ? `${b.pkg.name}@${b.pkg.version}=${dirname(b.pkgPath)}` : `${b.pkg.name}=built-in`
|
|
11124
|
-
).join(",");
|
|
11125
|
-
}
|
|
11126
|
-
function pinBuilderSpecs(specs) {
|
|
11127
|
-
const pins = getBuilderPins();
|
|
11128
|
-
const pinnedSpecs = /* @__PURE__ */ new Map();
|
|
11129
|
-
for (const spec of specs) {
|
|
11130
|
-
const parsed = (0, import_npm_package_arg.default)(spec);
|
|
11131
|
-
if (parsed.name && isBareSpec(parsed)) {
|
|
11132
|
-
const version2 = pins.get(parsed.name);
|
|
11133
|
-
if (version2) {
|
|
11134
|
-
pinnedSpecs.set(spec, `${parsed.name}@${version2}`);
|
|
11135
|
-
}
|
|
11136
|
-
}
|
|
11137
|
-
}
|
|
11138
|
-
return pinnedSpecs;
|
|
11139
|
-
}
|
|
11140
|
-
async function importBuilders(builderSpecs, cwd, span) {
|
|
11141
|
-
const buildersDir = join2(cwd, VERCEL_DIR, "builders");
|
|
11142
|
-
let importResult = await resolveBuilders(buildersDir, builderSpecs);
|
|
11143
|
-
if ("buildersToAdd" in importResult) {
|
|
11144
|
-
const { buildersToAdd, installReasons } = importResult;
|
|
11145
|
-
const pinnedSpecs = pinBuilderSpecs(buildersToAdd);
|
|
11146
|
-
const installResult = await installBuilders(
|
|
11147
|
-
buildersDir,
|
|
11148
|
-
new Set(Array.from(buildersToAdd, (spec) => pinnedSpecs.get(spec) ?? spec)),
|
|
11149
|
-
span,
|
|
11150
|
-
installReasons
|
|
11151
|
-
);
|
|
11152
|
-
importResult = await resolveBuilders(
|
|
11153
|
-
buildersDir,
|
|
11154
|
-
builderSpecs,
|
|
11155
|
-
installResult
|
|
11156
|
-
);
|
|
11157
|
-
if ("buildersToAdd" in importResult) {
|
|
11158
|
-
const { buildersToAdd: failed, installReasons: reasons } = importResult;
|
|
11159
|
-
const failures = Array.from(failed, (spec) => {
|
|
11160
|
-
const reason = reasons.get(spec);
|
|
11161
|
-
return reason ? `${spec} (${reason})` : spec;
|
|
11162
|
-
});
|
|
11163
|
-
const err = new Error(
|
|
11164
|
-
`Failed to load Builders after installing them: ${failures.join(
|
|
11165
|
-
", "
|
|
11166
|
-
)}. Retry the build. If the failure persists, contact Vercel Support.`
|
|
11167
|
-
);
|
|
11168
|
-
err.link = "https://vercel.link/builder-dependencies-install-failed";
|
|
11169
|
-
throw err;
|
|
11170
|
-
}
|
|
11171
|
-
}
|
|
11172
|
-
const resolvedBuildersDebug = [];
|
|
11173
|
-
for (const [spec, builderSpec] of importResult.builders) {
|
|
11174
|
-
resolvedBuildersDebug.push(`${spec} => ${builderSpec.pkg.version}`);
|
|
11175
|
-
}
|
|
11176
|
-
output_manager_default.debug(`Resolved builders: "${resolvedBuildersDebug.join(", ")}"`);
|
|
11177
|
-
return importResult.builders;
|
|
11178
|
-
}
|
|
11179
|
-
function missingModuleId(err) {
|
|
11180
|
-
const match = /Cannot find module '([^']+)'/.exec(err.message);
|
|
11181
|
-
const id = match?.[1];
|
|
11182
|
-
if (!id) {
|
|
11183
|
-
return void 0;
|
|
11184
|
-
}
|
|
11185
|
-
if (id.startsWith("/") || id.startsWith(".") || /^[A-Za-z]:[\\/]/.test(id)) {
|
|
11186
|
-
return void 0;
|
|
11187
|
-
}
|
|
11188
|
-
return id.replace(/[,=]/g, "_").slice(0, 100);
|
|
11189
|
-
}
|
|
11190
|
-
async function resolveBuilders(buildersDir, builderSpecs, resolvedSpecs) {
|
|
11191
|
-
const builders = /* @__PURE__ */ new Map();
|
|
11192
|
-
const buildersToAdd = /* @__PURE__ */ new Set();
|
|
11193
|
-
const installReasons = /* @__PURE__ */ new Map();
|
|
11194
|
-
for (const spec of builderSpecs) {
|
|
11195
|
-
const resolvedSpec = resolvedSpecs?.get(spec) || spec;
|
|
11196
|
-
const parsed = (0, import_npm_package_arg.default)(resolvedSpec);
|
|
11197
|
-
const { name } = parsed;
|
|
11198
|
-
if (!name) {
|
|
11199
|
-
buildersToAdd.add(spec);
|
|
11200
|
-
installReasons.set(spec, "url-spec");
|
|
11201
|
-
continue;
|
|
11202
|
-
}
|
|
11203
|
-
if ((0, import_fs_detectors.isStaticRuntime)(name)) {
|
|
11204
|
-
builders.set(name, {
|
|
11205
|
-
builder: static_builder_exports,
|
|
11206
|
-
pkg: { name },
|
|
11207
|
-
path: "",
|
|
11208
|
-
pkgPath: "",
|
|
11209
|
-
dynamicallyInstalled: false
|
|
11210
|
-
});
|
|
11211
|
-
continue;
|
|
11212
|
-
}
|
|
11213
|
-
let entrypointLoadFailed = false;
|
|
11214
|
-
try {
|
|
11215
|
-
let pkgPath;
|
|
11216
|
-
let builderPkg;
|
|
11217
|
-
try {
|
|
11218
|
-
pkgPath = join2(buildersDir, "node_modules", name, "package.json");
|
|
11219
|
-
builderPkg = await (0, import_fs_extra3.readJSON)(pkgPath);
|
|
11220
|
-
} catch (error) {
|
|
11221
|
-
if (!(0, import_error_utils2.isErrnoException)(error)) {
|
|
11222
|
-
throw error;
|
|
11223
|
-
}
|
|
11224
|
-
if (error.code !== "ENOENT") {
|
|
11225
|
-
throw error;
|
|
11226
|
-
}
|
|
11227
|
-
pkgPath = require_.resolve(`${name}/package.json`, {
|
|
11228
|
-
paths: [__dirname]
|
|
11229
|
-
});
|
|
11230
|
-
builderPkg = await (0, import_fs_extra3.readJSON)(pkgPath);
|
|
11231
|
-
}
|
|
11232
|
-
if (!builderPkg || !pkgPath) {
|
|
11233
|
-
throw new Error(`Failed to load \`package.json\` for "${name}"`);
|
|
11234
|
-
}
|
|
11235
|
-
if (typeof builderPkg.version !== "string") {
|
|
11236
|
-
throw new Error(
|
|
11237
|
-
`\`package.json\` for "${name}" does not contain a "version" field`
|
|
11238
|
-
);
|
|
11239
|
-
}
|
|
11240
|
-
const peerVersion = getBuilderPins().get(name);
|
|
11241
|
-
if (isBareSpec(parsed) && peerVersion && pkgPath.startsWith(buildersDir) && !(0, import_semver2.satisfies)(builderPkg.version, peerVersion)) {
|
|
11242
|
-
output_manager_default.debug(
|
|
11243
|
-
`Cached "${name}@${builderPkg.version}" does not satisfy "${peerVersion}"`
|
|
11244
|
-
);
|
|
11245
|
-
buildersToAdd.add(spec);
|
|
11246
|
-
installReasons.set(spec, "peer-version-mismatch");
|
|
11247
|
-
continue;
|
|
11248
|
-
}
|
|
11249
|
-
if (parsed.type === "version" && parsed.rawSpec !== builderPkg.version) {
|
|
11250
|
-
output_manager_default.debug(
|
|
11251
|
-
`Installed version "${name}@${builderPkg.version}" does not match "${parsed.rawSpec}"`
|
|
11252
|
-
);
|
|
11253
|
-
buildersToAdd.add(spec);
|
|
11254
|
-
installReasons.set(spec, "version-mismatch");
|
|
11255
|
-
continue;
|
|
11256
|
-
}
|
|
11257
|
-
if (parsed.type === "range" && !(0, import_semver2.satisfies)(builderPkg.version, parsed.rawSpec)) {
|
|
11258
|
-
output_manager_default.debug(
|
|
11259
|
-
`Installed version "${name}@${builderPkg.version}" is not compatible with "${parsed.rawSpec}"`
|
|
11260
|
-
);
|
|
11261
|
-
buildersToAdd.add(spec);
|
|
11262
|
-
installReasons.set(spec, "range-mismatch");
|
|
11263
|
-
continue;
|
|
11264
|
-
}
|
|
11265
|
-
const path2 = join2(dirname(pkgPath), builderPkg.main || "index.js");
|
|
11266
|
-
let builder;
|
|
11267
|
-
try {
|
|
11268
|
-
builder = require_(path2);
|
|
11269
|
-
} catch (requireErr) {
|
|
11270
|
-
entrypointLoadFailed = true;
|
|
11271
|
-
throw requireErr;
|
|
11272
|
-
}
|
|
11273
|
-
const dynamicallyInstalled = pkgPath.startsWith(buildersDir);
|
|
11274
|
-
builders.set(spec, {
|
|
11275
|
-
builder,
|
|
11276
|
-
pkg: {
|
|
11277
|
-
name,
|
|
11278
|
-
...builderPkg
|
|
11279
|
-
},
|
|
11280
|
-
path: path2,
|
|
11281
|
-
pkgPath,
|
|
11282
|
-
dynamicallyInstalled
|
|
11283
|
-
});
|
|
11284
|
-
output_manager_default.debug(`Imported Builder "${name}" from "${dirname(pkgPath)}"`);
|
|
11285
|
-
} catch (err) {
|
|
11286
|
-
if (err.code === "MODULE_NOT_FOUND" && !resolvedSpecs) {
|
|
11287
|
-
output_manager_default.debug(`Failed to import "${name}": ${err}`);
|
|
11288
|
-
buildersToAdd.add(spec);
|
|
11289
|
-
if (entrypointLoadFailed) {
|
|
11290
|
-
const missing = missingModuleId(err);
|
|
11291
|
-
installReasons.set(
|
|
11292
|
-
spec,
|
|
11293
|
-
missing ? `entrypoint-load-failed:${missing}` : "entrypoint-load-failed"
|
|
11294
|
-
);
|
|
11295
|
-
} else {
|
|
11296
|
-
installReasons.set(spec, "not-installed");
|
|
11297
|
-
}
|
|
11298
|
-
} else {
|
|
11299
|
-
err.message = `Importing "${name}": ${err.message}`;
|
|
11300
|
-
throw err;
|
|
11301
|
-
}
|
|
11302
|
-
}
|
|
11303
|
-
}
|
|
11304
|
-
if (buildersToAdd.size > 0) {
|
|
11305
|
-
return { buildersToAdd, installReasons };
|
|
11306
|
-
}
|
|
11307
|
-
return { builders };
|
|
11308
|
-
}
|
|
11309
|
-
|
|
11310
10028
|
// src/util/service-schedules.ts
|
|
11311
10029
|
var DYNAMIC_SCHEDULE = "<dynamic>";
|
|
11312
10030
|
function getStaticServiceSchedules(schedule) {
|
|
@@ -11317,15 +10035,15 @@ function getStaticServiceSchedules(schedule) {
|
|
|
11317
10035
|
}
|
|
11318
10036
|
|
|
11319
10037
|
// src/util/build/write-build-result.ts
|
|
11320
|
-
var
|
|
10038
|
+
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
11321
10039
|
var import_mime_types = __toESM(require_mime_types(), 1);
|
|
11322
|
-
var
|
|
10040
|
+
var import_fs_detectors = __toESM(require_dist3(), 1);
|
|
11323
10041
|
var import_promisepipe2 = __toESM(require_promisepipe(), 1);
|
|
11324
10042
|
import {
|
|
11325
10043
|
basename,
|
|
11326
|
-
dirname
|
|
10044
|
+
dirname,
|
|
11327
10045
|
extname,
|
|
11328
|
-
join as
|
|
10046
|
+
join as join2,
|
|
11329
10047
|
relative as relative2,
|
|
11330
10048
|
resolve as resolve2,
|
|
11331
10049
|
posix
|
|
@@ -11344,47 +10062,47 @@ import {
|
|
|
11344
10062
|
} from "@vercel/build-utils";
|
|
11345
10063
|
|
|
11346
10064
|
// src/util/build/merge.ts
|
|
11347
|
-
var
|
|
11348
|
-
var
|
|
11349
|
-
import { join
|
|
10065
|
+
var import_error_utils = __toESM(require_dist(), 1);
|
|
10066
|
+
var import_fs_extra2 = __toESM(require_lib(), 1);
|
|
10067
|
+
import { join, relative } from "path";
|
|
11350
10068
|
async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
11351
10069
|
const root = sourceRoot || source;
|
|
11352
10070
|
if (ignoreFilter) {
|
|
11353
10071
|
const relPath = relative(root, source);
|
|
11354
10072
|
if (relPath && !ignoreFilter(relPath)) {
|
|
11355
|
-
await (0,
|
|
10073
|
+
await (0, import_fs_extra2.remove)(source);
|
|
11356
10074
|
return;
|
|
11357
10075
|
}
|
|
11358
10076
|
}
|
|
11359
|
-
const destStat = await (0,
|
|
10077
|
+
const destStat = await (0, import_fs_extra2.stat)(destination).catch(
|
|
11360
10078
|
(err) => err
|
|
11361
10079
|
);
|
|
11362
|
-
if ((0,
|
|
10080
|
+
if ((0, import_error_utils.isErrnoException)(destStat)) {
|
|
11363
10081
|
if (destStat.code === "ENOENT") {
|
|
11364
|
-
await (0,
|
|
10082
|
+
await (0, import_fs_extra2.move)(source, destination);
|
|
11365
10083
|
return;
|
|
11366
10084
|
}
|
|
11367
10085
|
throw destStat;
|
|
11368
10086
|
} else if (destStat.isDirectory()) {
|
|
11369
|
-
const contents = await (0,
|
|
10087
|
+
const contents = await (0, import_fs_extra2.readdir)(
|
|
11370
10088
|
source
|
|
11371
10089
|
).catch((err) => err);
|
|
11372
|
-
if ((0,
|
|
10090
|
+
if ((0, import_error_utils.isErrnoException)(contents)) {
|
|
11373
10091
|
if (contents.code !== "ENOTDIR") {
|
|
11374
10092
|
throw contents;
|
|
11375
10093
|
}
|
|
11376
10094
|
} else {
|
|
11377
10095
|
await Promise.all(
|
|
11378
10096
|
contents.map(
|
|
11379
|
-
(name) => merge(
|
|
10097
|
+
(name) => merge(join(source, name), join(destination, name), ignoreFilter, root)
|
|
11380
10098
|
)
|
|
11381
10099
|
);
|
|
11382
|
-
await (0,
|
|
10100
|
+
await (0, import_fs_extra2.rmdir)(source);
|
|
11383
10101
|
return;
|
|
11384
10102
|
}
|
|
11385
10103
|
}
|
|
11386
|
-
await (0,
|
|
11387
|
-
await (0,
|
|
10104
|
+
await (0, import_fs_extra2.remove)(destination);
|
|
10105
|
+
await (0, import_fs_extra2.move)(source, destination);
|
|
11388
10106
|
}
|
|
11389
10107
|
|
|
11390
10108
|
// src/util/build/unzip.ts
|
|
@@ -11427,7 +10145,7 @@ async function extractEntry(zipFile, entry, dir) {
|
|
|
11427
10145
|
const IFMT = 61440;
|
|
11428
10146
|
const IFDIR = 16384;
|
|
11429
10147
|
const IFLNK = 40960;
|
|
11430
|
-
const
|
|
10148
|
+
const symlink2 = (mode & IFMT) === IFLNK;
|
|
11431
10149
|
let isDir = (mode & IFMT) === IFDIR;
|
|
11432
10150
|
if (!isDir && entry.fileName.endsWith("/")) {
|
|
11433
10151
|
isDir = true;
|
|
@@ -11445,7 +10163,7 @@ async function extractEntry(zipFile, entry, dir) {
|
|
|
11445
10163
|
if (isDir)
|
|
11446
10164
|
return;
|
|
11447
10165
|
const readStream = await zipFile.openReadStream(entry);
|
|
11448
|
-
if (
|
|
10166
|
+
if (symlink2) {
|
|
11449
10167
|
const link = await streamToBuffer(readStream);
|
|
11450
10168
|
await fs2.symlink(link.toString("utf8"), dest);
|
|
11451
10169
|
} else {
|
|
@@ -11467,7 +10185,7 @@ function getExtractedMode(entryMode, isDir) {
|
|
|
11467
10185
|
// src/util/build/write-build-result.ts
|
|
11468
10186
|
var import_client2 = __toESM(require_dist2(), 1);
|
|
11469
10187
|
var { normalize } = posix;
|
|
11470
|
-
var OUTPUT_DIR =
|
|
10188
|
+
var OUTPUT_DIR = join2(VERCEL_DIR, "output");
|
|
11471
10189
|
var BUILD_OUTPUT_API_ENTRIES = [
|
|
11472
10190
|
"config.json",
|
|
11473
10191
|
"functions",
|
|
@@ -11479,7 +10197,7 @@ async function writeBuildResult(args) {
|
|
|
11479
10197
|
repoRootPath,
|
|
11480
10198
|
outputDir,
|
|
11481
10199
|
buildResult,
|
|
11482
|
-
build
|
|
10200
|
+
build,
|
|
11483
10201
|
builder,
|
|
11484
10202
|
builderPkg,
|
|
11485
10203
|
vercelConfig,
|
|
@@ -11490,22 +10208,22 @@ async function writeBuildResult(args) {
|
|
|
11490
10208
|
stripServiceRoutePrefix = false
|
|
11491
10209
|
} = args;
|
|
11492
10210
|
const writeOutputDir = service && nestServiceOutput ? getServiceOutputDir(outputDir, service) : outputDir;
|
|
11493
|
-
let
|
|
10211
|
+
let version;
|
|
11494
10212
|
let actualResult;
|
|
11495
10213
|
if (builder.version === -1) {
|
|
11496
10214
|
const vx = buildResult;
|
|
11497
|
-
|
|
10215
|
+
version = vx.resultVersion;
|
|
11498
10216
|
actualResult = vx.result;
|
|
11499
10217
|
} else {
|
|
11500
|
-
|
|
10218
|
+
version = builder.version;
|
|
11501
10219
|
actualResult = buildResult;
|
|
11502
10220
|
}
|
|
11503
|
-
if (typeof
|
|
10221
|
+
if (typeof version !== "number" || version === 2) {
|
|
11504
10222
|
return writeBuildResultV2({
|
|
11505
10223
|
repoRootPath,
|
|
11506
10224
|
outputDir: writeOutputDir,
|
|
11507
10225
|
buildResult: actualResult,
|
|
11508
|
-
build
|
|
10226
|
+
build,
|
|
11509
10227
|
vercelConfig,
|
|
11510
10228
|
standalone,
|
|
11511
10229
|
workPath,
|
|
@@ -11513,12 +10231,12 @@ async function writeBuildResult(args) {
|
|
|
11513
10231
|
rootOutputDir: outputDir,
|
|
11514
10232
|
stripServiceRoutePrefix
|
|
11515
10233
|
});
|
|
11516
|
-
} else if (
|
|
10234
|
+
} else if (version === 3) {
|
|
11517
10235
|
return writeBuildResultV3({
|
|
11518
10236
|
repoRootPath,
|
|
11519
10237
|
outputDir: writeOutputDir,
|
|
11520
10238
|
buildResult: actualResult,
|
|
11521
|
-
build
|
|
10239
|
+
build,
|
|
11522
10240
|
vercelConfig,
|
|
11523
10241
|
standalone,
|
|
11524
10242
|
workPath,
|
|
@@ -11528,7 +10246,7 @@ async function writeBuildResult(args) {
|
|
|
11528
10246
|
});
|
|
11529
10247
|
}
|
|
11530
10248
|
throw new Error(
|
|
11531
|
-
`Unsupported Builder version \`${
|
|
10249
|
+
`Unsupported Builder version \`${version}\` from "${builderPkg.name}"`
|
|
11532
10250
|
);
|
|
11533
10251
|
}
|
|
11534
10252
|
function isEdgeFunction(v) {
|
|
@@ -11597,14 +10315,14 @@ async function resolveFunctionConfiguration(src, vercelConfig, service) {
|
|
|
11597
10315
|
return {};
|
|
11598
10316
|
}
|
|
11599
10317
|
function getServiceOutputDir(outputDir, service) {
|
|
11600
|
-
return
|
|
10318
|
+
return join2(outputDir, "services", service.name);
|
|
11601
10319
|
}
|
|
11602
10320
|
async function writeBuildResultV2(args) {
|
|
11603
10321
|
const {
|
|
11604
10322
|
repoRootPath,
|
|
11605
10323
|
outputDir,
|
|
11606
10324
|
buildResult,
|
|
11607
|
-
build
|
|
10325
|
+
build,
|
|
11608
10326
|
vercelConfig,
|
|
11609
10327
|
standalone,
|
|
11610
10328
|
workPath,
|
|
@@ -11618,14 +10336,14 @@ async function writeBuildResultV2(args) {
|
|
|
11618
10336
|
}
|
|
11619
10337
|
if (!buildResult.output) {
|
|
11620
10338
|
const configFile = vercelConfig?.[import_client2.fileNameSymbol];
|
|
11621
|
-
const updateMessage =
|
|
10339
|
+
const updateMessage = build.use.startsWith("@now/") ? ` Please update from "@now" to "@vercel" in your \`${configFile}\` file.` : "";
|
|
11622
10340
|
throw new Error(
|
|
11623
|
-
`The build result from "${
|
|
10341
|
+
`The build result from "${build.use}" is missing the "output" property.${updateMessage}`
|
|
11624
10342
|
);
|
|
11625
10343
|
}
|
|
11626
10344
|
const existingFunctions = /* @__PURE__ */ new Map();
|
|
11627
10345
|
const overrides = {};
|
|
11628
|
-
const functionConfiguration =
|
|
10346
|
+
const functionConfiguration = build.src ? await resolveFunctionConfiguration(build.src, vercelConfig, service) : {};
|
|
11629
10347
|
for (const [path2, output] of Object.entries(buildResult.output)) {
|
|
11630
10348
|
const normalizedPath = stripDuplicateSlashes(path2);
|
|
11631
10349
|
if (isContainerImage(output)) {
|
|
@@ -11674,11 +10392,11 @@ async function writeBuildResultV2(args) {
|
|
|
11674
10392
|
if (fallback) {
|
|
11675
10393
|
const ext = getFileExtension(fallback);
|
|
11676
10394
|
const fallbackName = `${normalizedPath}.prerender-fallback${ext}`;
|
|
11677
|
-
const fallbackPath =
|
|
10395
|
+
const fallbackPath = join2(outputDir, "functions", fallbackName);
|
|
11678
10396
|
let usedHardLink = false;
|
|
11679
10397
|
if ("fsPath" in fallback) {
|
|
11680
10398
|
try {
|
|
11681
|
-
await
|
|
10399
|
+
await import_fs_extra3.default.link(fallback.fsPath, fallbackPath);
|
|
11682
10400
|
usedHardLink = true;
|
|
11683
10401
|
} catch (_) {
|
|
11684
10402
|
}
|
|
@@ -11687,7 +10405,7 @@ async function writeBuildResultV2(args) {
|
|
|
11687
10405
|
const stream = fallback.toStream();
|
|
11688
10406
|
await (0, import_promisepipe2.default)(
|
|
11689
10407
|
stream,
|
|
11690
|
-
|
|
10408
|
+
import_fs_extra3.default.createWriteStream(fallbackPath, { mode: fallback.mode })
|
|
11691
10409
|
);
|
|
11692
10410
|
}
|
|
11693
10411
|
fallback = new FileFsRef({
|
|
@@ -11695,7 +10413,7 @@ async function writeBuildResultV2(args) {
|
|
|
11695
10413
|
fsPath: basename(fallbackName)
|
|
11696
10414
|
});
|
|
11697
10415
|
}
|
|
11698
|
-
const prerenderConfigPath =
|
|
10416
|
+
const prerenderConfigPath = join2(
|
|
11699
10417
|
outputDir,
|
|
11700
10418
|
"functions",
|
|
11701
10419
|
`${normalizedPath}.prerender-config.json`
|
|
@@ -11705,7 +10423,7 @@ async function writeBuildResultV2(args) {
|
|
|
11705
10423
|
lambda: void 0,
|
|
11706
10424
|
fallback
|
|
11707
10425
|
};
|
|
11708
|
-
await
|
|
10426
|
+
await import_fs_extra3.default.writeJSON(prerenderConfigPath, prerenderConfig, { spaces: 2 });
|
|
11709
10427
|
} else if (isFile(output)) {
|
|
11710
10428
|
await writeStaticFile(
|
|
11711
10429
|
outputDir,
|
|
@@ -11736,7 +10454,7 @@ async function writeBuildResultV3(args) {
|
|
|
11736
10454
|
repoRootPath,
|
|
11737
10455
|
outputDir,
|
|
11738
10456
|
buildResult,
|
|
11739
|
-
build
|
|
10457
|
+
build,
|
|
11740
10458
|
vercelConfig,
|
|
11741
10459
|
standalone,
|
|
11742
10460
|
workPath,
|
|
@@ -11745,14 +10463,14 @@ async function writeBuildResultV3(args) {
|
|
|
11745
10463
|
stripServiceRoutePrefix
|
|
11746
10464
|
} = args;
|
|
11747
10465
|
const { output } = buildResult;
|
|
11748
|
-
const routesJsonPath =
|
|
11749
|
-
if (isBackendBuilder(
|
|
11750
|
-
if ((0,
|
|
10466
|
+
const routesJsonPath = join2(workPath, ".vercel", "routes.json");
|
|
10467
|
+
if (isBackendBuilder(build) || build.use === "@vercel/python") {
|
|
10468
|
+
if ((0, import_fs_extra3.existsSync)(routesJsonPath)) {
|
|
11751
10469
|
try {
|
|
11752
10470
|
const newOutput = {
|
|
11753
10471
|
index: output
|
|
11754
10472
|
};
|
|
11755
|
-
const routesJson = await
|
|
10473
|
+
const routesJson = await import_fs_extra3.default.readJSON(routesJsonPath);
|
|
11756
10474
|
if (routesJson && typeof routesJson === "object" && "routes" in routesJson && Array.isArray(routesJson.routes)) {
|
|
11757
10475
|
for (const route of routesJson.routes) {
|
|
11758
10476
|
if (route.source === "/") {
|
|
@@ -11767,7 +10485,7 @@ async function writeBuildResultV3(args) {
|
|
|
11767
10485
|
repoRootPath,
|
|
11768
10486
|
outputDir,
|
|
11769
10487
|
buildResult: { output: newOutput, routes: buildResult.routes },
|
|
11770
|
-
build
|
|
10488
|
+
build,
|
|
11771
10489
|
vercelConfig,
|
|
11772
10490
|
standalone,
|
|
11773
10491
|
workPath,
|
|
@@ -11779,12 +10497,12 @@ async function writeBuildResultV3(args) {
|
|
|
11779
10497
|
output_manager_default.error(`Failed to read routes.json: ${error}`);
|
|
11780
10498
|
}
|
|
11781
10499
|
}
|
|
11782
|
-
if (isBackendBuilder(
|
|
10500
|
+
if (isBackendBuilder(build) && isExperimentalBackendsEnabled() && "routes" in buildResult) {
|
|
11783
10501
|
return writeBuildResultV2({
|
|
11784
10502
|
repoRootPath,
|
|
11785
10503
|
outputDir,
|
|
11786
10504
|
buildResult,
|
|
11787
|
-
build
|
|
10505
|
+
build,
|
|
11788
10506
|
vercelConfig,
|
|
11789
10507
|
standalone,
|
|
11790
10508
|
workPath,
|
|
@@ -11794,7 +10512,7 @@ async function writeBuildResultV3(args) {
|
|
|
11794
10512
|
});
|
|
11795
10513
|
}
|
|
11796
10514
|
}
|
|
11797
|
-
const src =
|
|
10515
|
+
const src = build.src;
|
|
11798
10516
|
if (typeof src !== "string") {
|
|
11799
10517
|
throw new Error(`Expected "build.src" to be a string`);
|
|
11800
10518
|
}
|
|
@@ -11804,8 +10522,8 @@ async function writeBuildResultV3(args) {
|
|
|
11804
10522
|
service
|
|
11805
10523
|
);
|
|
11806
10524
|
const ext = extname(src);
|
|
11807
|
-
const path2 = service && isExperimentalServiceV2(service) ? "index" : service && typeof service.runtime === "string" ? stripDuplicateSlashes((0,
|
|
11808
|
-
|
|
10525
|
+
const path2 = service && isExperimentalServiceV2(service) ? "index" : service && typeof service.runtime === "string" ? stripDuplicateSlashes((0, import_fs_detectors.getInternalServiceFunctionPath)(service.name)) : stripDuplicateSlashes(
|
|
10526
|
+
build.config?.zeroConfig ? src.substring(0, src.length - ext.length) : src
|
|
11809
10527
|
);
|
|
11810
10528
|
if (isContainerImage(output)) {
|
|
11811
10529
|
injectServiceEnvVars(
|
|
@@ -11840,7 +10558,7 @@ async function writeBuildResultV3(args) {
|
|
|
11840
10558
|
);
|
|
11841
10559
|
} else {
|
|
11842
10560
|
throw new Error(
|
|
11843
|
-
`Unsupported output type: "${output.type}" for ${
|
|
10561
|
+
`Unsupported output type: "${output.type}" for ${build.src}`
|
|
11844
10562
|
);
|
|
11845
10563
|
}
|
|
11846
10564
|
}
|
|
@@ -11867,14 +10585,14 @@ async function writeStaticFile(outputDir, file, path2, overrides, cleanUrls = fa
|
|
|
11867
10585
|
if (override) {
|
|
11868
10586
|
overrides[fsPath] = override;
|
|
11869
10587
|
}
|
|
11870
|
-
const dest =
|
|
11871
|
-
await
|
|
10588
|
+
const dest = join2(outputDir, "static", fsPath);
|
|
10589
|
+
await import_fs_extra3.default.mkdirp(dirname(dest));
|
|
11872
10590
|
if ("fsPath" in file) {
|
|
11873
10591
|
if (resolve2(file.fsPath) === resolve2(dest)) {
|
|
11874
10592
|
return;
|
|
11875
10593
|
}
|
|
11876
10594
|
try {
|
|
11877
|
-
return await
|
|
10595
|
+
return await import_fs_extra3.default.link(file.fsPath, dest);
|
|
11878
10596
|
} catch (_) {
|
|
11879
10597
|
}
|
|
11880
10598
|
}
|
|
@@ -11884,15 +10602,15 @@ async function writeFunctionSymlink(outputDir, dest, fn, existingFunctions) {
|
|
|
11884
10602
|
const existingPath = existingFunctions.get(fn);
|
|
11885
10603
|
if (!existingPath)
|
|
11886
10604
|
return false;
|
|
11887
|
-
const destDir =
|
|
11888
|
-
const targetDest =
|
|
10605
|
+
const destDir = dirname(dest);
|
|
10606
|
+
const targetDest = join2(outputDir, "functions", `${existingPath}.func`);
|
|
11889
10607
|
const target = relative2(destDir, targetDest);
|
|
11890
|
-
await
|
|
11891
|
-
await
|
|
10608
|
+
await import_fs_extra3.default.mkdirp(destDir);
|
|
10609
|
+
await import_fs_extra3.default.symlink(target, dest);
|
|
11892
10610
|
return true;
|
|
11893
10611
|
}
|
|
11894
10612
|
async function writeContainerImage(outputDir, containerImage, path2, functionConfiguration) {
|
|
11895
|
-
const dest =
|
|
10613
|
+
const dest = join2(outputDir, "functions", `${path2}.func`);
|
|
11896
10614
|
const handler = containerImage.handler;
|
|
11897
10615
|
if (typeof handler !== "string" || handler.length === 0) {
|
|
11898
10616
|
throw new Error(
|
|
@@ -11907,9 +10625,9 @@ async function writeContainerImage(outputDir, containerImage, path2, functionCon
|
|
|
11907
10625
|
const functionFailoverRegions = functionConfiguration?.functionFailoverRegions ?? containerImage.functionFailoverRegions;
|
|
11908
10626
|
const experimentalTriggers = functionConfiguration?.experimentalTriggers ?? containerImage.experimentalTriggers;
|
|
11909
10627
|
const supportsCancellation = functionConfiguration?.supportsCancellation ?? containerImage.supportsCancellation;
|
|
11910
|
-
await
|
|
11911
|
-
await
|
|
11912
|
-
|
|
10628
|
+
await import_fs_extra3.default.mkdirp(dest);
|
|
10629
|
+
await import_fs_extra3.default.writeJSON(
|
|
10630
|
+
join2(dest, ".vc-config.json"),
|
|
11913
10631
|
{
|
|
11914
10632
|
handler,
|
|
11915
10633
|
runtime: "container",
|
|
@@ -11928,7 +10646,7 @@ async function writeContainerImage(outputDir, containerImage, path2, functionCon
|
|
|
11928
10646
|
);
|
|
11929
10647
|
}
|
|
11930
10648
|
async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path2, existingFunctions, standalone = false) {
|
|
11931
|
-
const dest =
|
|
10649
|
+
const dest = join2(outputDir, "functions", `${path2}.func`);
|
|
11932
10650
|
if (existingFunctions) {
|
|
11933
10651
|
if (await writeFunctionSymlink(
|
|
11934
10652
|
outputDir,
|
|
@@ -11940,7 +10658,7 @@ async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path2, e
|
|
|
11940
10658
|
}
|
|
11941
10659
|
existingFunctions.set(edgeFunction, path2);
|
|
11942
10660
|
}
|
|
11943
|
-
await
|
|
10661
|
+
await import_fs_extra3.default.mkdirp(dest);
|
|
11944
10662
|
const ops = [];
|
|
11945
10663
|
const { files, filePathMap } = filesWithoutFsRefs(
|
|
11946
10664
|
edgeFunction.files,
|
|
@@ -11956,23 +10674,23 @@ async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path2, e
|
|
|
11956
10674
|
files: void 0,
|
|
11957
10675
|
type: void 0
|
|
11958
10676
|
};
|
|
11959
|
-
const configPath =
|
|
10677
|
+
const configPath = join2(dest, ".vc-config.json");
|
|
11960
10678
|
ops.push(
|
|
11961
|
-
|
|
10679
|
+
import_fs_extra3.default.writeJSON(configPath, config, {
|
|
11962
10680
|
spaces: 2
|
|
11963
10681
|
})
|
|
11964
10682
|
);
|
|
11965
10683
|
await Promise.all(ops);
|
|
11966
10684
|
}
|
|
11967
10685
|
async function writeLambda(repoRootPath, outputDir, lambda, path2, functionConfiguration, existingFunctions, standalone = false) {
|
|
11968
|
-
const dest =
|
|
10686
|
+
const dest = join2(outputDir, "functions", `${path2}.func`);
|
|
11969
10687
|
if (existingFunctions) {
|
|
11970
10688
|
if (await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)) {
|
|
11971
10689
|
return;
|
|
11972
10690
|
}
|
|
11973
10691
|
existingFunctions.set(lambda, path2);
|
|
11974
10692
|
}
|
|
11975
|
-
await
|
|
10693
|
+
await import_fs_extra3.default.mkdirp(dest);
|
|
11976
10694
|
const ops = [];
|
|
11977
10695
|
let filePathMap;
|
|
11978
10696
|
if (lambda.files) {
|
|
@@ -12008,22 +10726,22 @@ async function writeLambda(repoRootPath, outputDir, lambda, path2, functionConfi
|
|
|
12008
10726
|
files: void 0,
|
|
12009
10727
|
zipBuffer: void 0
|
|
12010
10728
|
};
|
|
12011
|
-
const configPath =
|
|
10729
|
+
const configPath = join2(dest, ".vc-config.json");
|
|
12012
10730
|
ops.push(
|
|
12013
|
-
|
|
10731
|
+
import_fs_extra3.default.writeJSON(configPath, config, {
|
|
12014
10732
|
spaces: 2
|
|
12015
10733
|
})
|
|
12016
10734
|
);
|
|
12017
10735
|
await Promise.all(ops);
|
|
12018
10736
|
for await (const dir of findDirs(".vercel", dest)) {
|
|
12019
|
-
const absDir =
|
|
12020
|
-
const entries = await
|
|
10737
|
+
const absDir = join2(dest, dir);
|
|
10738
|
+
const entries = await import_fs_extra3.default.readdir(absDir);
|
|
12021
10739
|
if (entries.includes("cache")) {
|
|
12022
10740
|
await Promise.all(
|
|
12023
|
-
entries.filter((e) => e !== "cache").map((entry) =>
|
|
10741
|
+
entries.filter((e) => e !== "cache").map((entry) => import_fs_extra3.default.remove(join2(absDir, entry)))
|
|
12024
10742
|
);
|
|
12025
10743
|
} else {
|
|
12026
|
-
await
|
|
10744
|
+
await import_fs_extra3.default.remove(absDir);
|
|
12027
10745
|
}
|
|
12028
10746
|
}
|
|
12029
10747
|
}
|
|
@@ -12033,7 +10751,7 @@ async function mergeBuilderOutput(outputDir, buildResult, workPath, rootOutputDi
|
|
|
12033
10751
|
const { ig } = await (0, import_client2.getVercelIgnore)(workPath);
|
|
12034
10752
|
const filter = ig.createFilter();
|
|
12035
10753
|
if (absOutputDir === buildResult.buildOutputPath) {
|
|
12036
|
-
const staticDir =
|
|
10754
|
+
const staticDir = join2(outputDir, "static");
|
|
12037
10755
|
try {
|
|
12038
10756
|
await cleanIgnoredFiles(staticDir, staticDir, filter);
|
|
12039
10757
|
} catch (err) {
|
|
@@ -12058,13 +10776,13 @@ async function mergeBuilderOutput(outputDir, buildResult, workPath, rootOutputDi
|
|
|
12058
10776
|
async function relocateBuildOutputApiEntries(rootOutputDir, outputDir, workPath) {
|
|
12059
10777
|
const { ig } = await (0, import_client2.getVercelIgnore)(workPath);
|
|
12060
10778
|
const filter = ig.createFilter();
|
|
12061
|
-
await
|
|
10779
|
+
await import_fs_extra3.default.mkdirp(outputDir);
|
|
12062
10780
|
await Promise.all(
|
|
12063
10781
|
BUILD_OUTPUT_API_ENTRIES.map(async (entry) => {
|
|
12064
|
-
const src =
|
|
12065
|
-
if (!await
|
|
10782
|
+
const src = join2(rootOutputDir, entry);
|
|
10783
|
+
if (!await import_fs_extra3.default.pathExists(src))
|
|
12066
10784
|
return;
|
|
12067
|
-
const dest =
|
|
10785
|
+
const dest = join2(outputDir, entry);
|
|
12068
10786
|
if (entry === "static") {
|
|
12069
10787
|
await merge(src, dest, (path2) => filter(path2));
|
|
12070
10788
|
} else {
|
|
@@ -12074,21 +10792,21 @@ async function relocateBuildOutputApiEntries(rootOutputDir, outputDir, workPath)
|
|
|
12074
10792
|
);
|
|
12075
10793
|
}
|
|
12076
10794
|
async function cleanIgnoredFiles(dir, staticRoot, filter) {
|
|
12077
|
-
const entries = await
|
|
10795
|
+
const entries = await import_fs_extra3.default.readdir(dir);
|
|
12078
10796
|
await Promise.all(
|
|
12079
10797
|
entries.map(async (entry) => {
|
|
12080
|
-
const entryPath =
|
|
12081
|
-
const stat2 = await
|
|
10798
|
+
const entryPath = join2(dir, entry);
|
|
10799
|
+
const stat2 = await import_fs_extra3.default.stat(entryPath);
|
|
12082
10800
|
const relativePath = relative2(staticRoot, entryPath);
|
|
12083
10801
|
if (stat2.isDirectory()) {
|
|
12084
10802
|
await cleanIgnoredFiles(entryPath, staticRoot, filter);
|
|
12085
|
-
const remaining = await
|
|
10803
|
+
const remaining = await import_fs_extra3.default.readdir(entryPath);
|
|
12086
10804
|
if (remaining.length === 0) {
|
|
12087
|
-
await
|
|
10805
|
+
await import_fs_extra3.default.rmdir(entryPath);
|
|
12088
10806
|
}
|
|
12089
10807
|
} else if (!filter(relativePath)) {
|
|
12090
10808
|
output_manager_default.debug(`Removing ignored file: ${relativePath}`);
|
|
12091
|
-
await
|
|
10809
|
+
await import_fs_extra3.default.remove(entryPath);
|
|
12092
10810
|
}
|
|
12093
10811
|
})
|
|
12094
10812
|
);
|
|
@@ -12109,7 +10827,7 @@ function getFileExtension(file) {
|
|
|
12109
10827
|
async function* findDirs(name, dir, root = dir) {
|
|
12110
10828
|
let paths;
|
|
12111
10829
|
try {
|
|
12112
|
-
paths = await
|
|
10830
|
+
paths = await import_fs_extra3.default.readdir(dir);
|
|
12113
10831
|
} catch (err) {
|
|
12114
10832
|
if (err.code !== "ENOENT") {
|
|
12115
10833
|
throw err;
|
|
@@ -12117,10 +10835,10 @@ async function* findDirs(name, dir, root = dir) {
|
|
|
12117
10835
|
paths = [];
|
|
12118
10836
|
}
|
|
12119
10837
|
for (const path2 of paths) {
|
|
12120
|
-
const abs =
|
|
10838
|
+
const abs = join2(dir, path2);
|
|
12121
10839
|
let stat2;
|
|
12122
10840
|
try {
|
|
12123
|
-
stat2 = await
|
|
10841
|
+
stat2 = await import_fs_extra3.default.lstat(abs);
|
|
12124
10842
|
} catch (err) {
|
|
12125
10843
|
if (err.code === "ENOENT")
|
|
12126
10844
|
continue;
|
|
@@ -12162,11 +10880,8 @@ function filesWithoutFsRefs(files, repoRootPath, standalone) {
|
|
|
12162
10880
|
}
|
|
12163
10881
|
|
|
12164
10882
|
export {
|
|
12165
|
-
require_npa,
|
|
12166
10883
|
staticFiles,
|
|
12167
10884
|
require_mime_types,
|
|
12168
|
-
formatResolvedBuilders,
|
|
12169
|
-
importBuilders,
|
|
12170
10885
|
getStaticServiceSchedules,
|
|
12171
10886
|
OUTPUT_DIR,
|
|
12172
10887
|
writeBuildResult,
|