vercel 59.1.4 → 59.4.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-PP3PJPJV.js → add-73X2SKBH.js} +5 -5
- package/dist/chunks/{add-CUGPQYFW.js → add-FQMB3XPM.js} +5 -5
- package/dist/chunks/{add-PRG4KKYH.js → add-QJ3WT4FW.js} +8 -8
- package/dist/chunks/{build-T22GMLY6.js → build-YUYCLCXD.js} +5 -5
- package/dist/chunks/{chunk-LNVZ3T7X.js → chunk-2PX6N4FE.js} +5 -5
- package/dist/chunks/{chunk-BCZFZETZ.js → chunk-BLYBHFIE.js} +5 -5
- package/dist/chunks/{chunk-57G6HBJ4.js → chunk-CHEZBD7H.js} +3 -3
- package/dist/chunks/{chunk-NM43FFV6.js → chunk-CV4S27SS.js} +0 -1
- package/dist/chunks/{chunk-ECCWJHC6.js → chunk-CYNB6LL4.js} +43 -36
- package/dist/chunks/{chunk-5DVMXOFT.js → chunk-DDIZGOCK.js} +32 -30
- package/dist/chunks/{chunk-4JKZ7SRX.js → chunk-EB5NBVTV.js} +4 -4
- package/dist/chunks/{chunk-M34ZRNDQ.js → chunk-EB7NJKPL.js} +2 -2
- package/dist/chunks/{chunk-CSJBZKC5.js → chunk-EG5BSAXD.js} +69 -57
- package/dist/chunks/{chunk-ZUVJISHS.js → chunk-HJVTLJHO.js} +2 -2
- package/dist/chunks/{chunk-VE545BR3.js → chunk-HMJVUXE6.js} +13555 -13747
- package/dist/chunks/{chunk-SOKQBFF7.js → chunk-HURL5EBN.js} +549 -62
- package/dist/chunks/{chunk-43DD2KNM.js → chunk-J5Y2QGGU.js} +1362 -938
- package/dist/chunks/{chunk-QCVKGY2A.js → chunk-KAYSW4CJ.js} +35 -12
- package/dist/chunks/{chunk-P65EEFTR.js → chunk-KQRVZWJU.js} +1 -0
- package/dist/chunks/{chunk-4HI7G6KG.js → chunk-KSZ4MNHO.js} +1 -1
- package/dist/chunks/{chunk-DOAYLTBJ.js → chunk-LKTQR5JE.js} +1 -1
- package/dist/chunks/{chunk-JYEO6OJS.js → chunk-MWYQ24FO.js} +4 -3
- package/dist/chunks/{chunk-SQGMTRZD.js → chunk-NP6BQPCN.js} +642 -462
- package/dist/chunks/{chunk-DAWJOQF6.js → chunk-O5DLWLT7.js} +2 -2
- package/dist/chunks/{chunk-IKKUCZE7.js → chunk-PD4DYNSB.js} +3 -3
- package/dist/chunks/{chunk-3BU2UCGV.js → chunk-PIMIKY4X.js} +1 -1
- package/dist/chunks/{chunk-QD5NX7RG.js → chunk-RI7KKKII.js} +1 -1
- package/dist/chunks/{chunk-QQ6PH4RY.js → chunk-STPH4Y62.js} +10 -0
- package/dist/chunks/{chunk-TJLBCLEX.js → chunk-TH2XUVDP.js} +11 -1
- package/dist/chunks/{chunk-P2QZZ6MR.js → chunk-TVXCXIRO.js} +1 -1
- package/dist/chunks/{chunk-KTLFN5FV.js → chunk-UV2ZMFVG.js} +1 -1
- package/dist/chunks/{chunk-XZLI27ES.js → chunk-VCE6QKFE.js} +3 -3
- package/dist/chunks/{chunk-DOMLWKKZ.js → chunk-X6O6XJEA.js} +17 -20
- package/dist/chunks/{chunk-SJQEGGH7.js → chunk-XI6NJLI4.js} +1 -1
- package/dist/chunks/{chunk-7NQLRE5V.js → chunk-Y3J4VU2H.js} +1 -1
- package/dist/chunks/{chunk-DEB45ND4.js → chunk-Y42SPI2H.js} +2 -2
- package/dist/chunks/{chunk-TM3F7PLR.js → chunk-ZFWNMVNR.js} +3 -3
- package/dist/chunks/{clear-Z4IKUIN7.js → clear-USQM5VW5.js} +5 -5
- package/dist/chunks/{compile-vercel-config-PSVXFAZW.js → compile-vercel-config-2JNYMI6W.js} +3 -3
- package/dist/chunks/{config-M5GMZ2X5.js → config-VTRIDLY4.js} +5 -5
- package/dist/chunks/{delete-P4XIBY7T.js → delete-ILLSBCVQ.js} +5 -5
- package/dist/chunks/{delete-5GRRDJSF.js → delete-VTPHK3EB.js} +4 -4
- package/dist/chunks/{disable-NT5NYVO7.js → disable-VTOMO64V.js} +4 -4
- package/dist/chunks/{discard-TBNIEAJZ.js → discard-ZIOZ34ZI.js} +4 -4
- package/dist/chunks/{edit-DJ6MT6HA.js → edit-E3AMR4KM.js} +6 -6
- package/dist/chunks/{edit-UF3D2CCH.js → edit-JMZ5XWVW.js} +6 -6
- package/dist/chunks/{enable-JTQBQMBO.js → enable-A4PMZ7QZ.js} +4 -4
- package/dist/chunks/{export-OKMRGRVM.js → export-Y6AJ3WRZ.js} +4 -4
- package/dist/chunks/{image-ARUJH4H5.js → image-26BKPAUB.js} +4 -4
- package/dist/chunks/{import-builders-3NTMZM64.js → import-builders-3H7J2SEK.js} +10 -9
- package/dist/chunks/{inspect-RI4K77NG.js → inspect-7DGKYHKW.js} +6 -6
- package/dist/chunks/{inspect-PTXIBSYW.js → inspect-GJFVAZIJ.js} +5 -5
- package/dist/chunks/{inspect-CHFKZKKP.js → inspect-N3E2PO6K.js} +5 -5
- package/dist/chunks/{inspect-5NETOGAI.js → inspect-OEY4DJRI.js} +5 -5
- package/dist/chunks/{inspect-UXP2HDES.js → inspect-ZW5N6O5P.js} +5 -5
- package/dist/chunks/{list-DYCZA2VX.js → list-2VTCNQEB.js} +4 -4
- package/dist/chunks/{list-G7LGVDAJ.js → list-DTJBW7OQ.js} +6 -6
- package/dist/chunks/{list-ADI55WKW.js → list-MIQ5D6PM.js} +5 -5
- package/dist/chunks/{login-YCSIQG6B.js → login-L34UHAU5.js} +5 -5
- package/dist/chunks/{ls-VIOMDUGW.js → ls-NCPQY4FV.js} +5 -5
- package/dist/chunks/{ls-2TKUIUK4.js → ls-OBUDC4SB.js} +5 -5
- package/dist/chunks/{ls-PQFDGOJL.js → ls-OKO4IHWB.js} +6 -6
- package/dist/chunks/{ls-RZVTIP5U.js → ls-SXJFBLUT.js} +5 -5
- package/dist/chunks/{ls-EOMIQLRH.js → ls-VDYUFSSC.js} +5 -5
- package/dist/chunks/{open-JYPWOXQD.js → open-V5JDGXUP.js} +5 -5
- package/dist/chunks/{permissions-SGJWGEVD.js → permissions-6CPRPPBY.js} +5 -5
- package/dist/chunks/{publish-ZUQHJAXL.js → publish-R27DPHFO.js} +4 -4
- package/dist/chunks/{push-XMVKG5A5.js → push-VLVTBS42.js} +5 -5
- package/dist/chunks/{query-ZLJZEGZB.js → query-IVVRYMJN.js} +218 -81
- package/dist/chunks/{reorder-NVHDWMRU.js → reorder-LJ2RBZM2.js} +4 -4
- package/dist/chunks/{reply-PUUPUQ3V.js → reply-USAISZYC.js} +6 -6
- package/dist/chunks/{resolve-5U2LJVE6.js → resolve-CRCJYVS5.js} +5 -5
- package/dist/chunks/{restore-OXIUY2UI.js → restore-6PBPEAMU.js} +4 -4
- package/dist/chunks/{rm-Z2KYJ7XT.js → rm-EOD7RDSO.js} +5 -5
- package/dist/chunks/{rm-BZNKJRXU.js → rm-HHELZB7R.js} +5 -5
- package/dist/chunks/{rm-3IOCBNPE.js → rm-KGOEOWVK.js} +6 -6
- package/dist/chunks/{rm-OUI4ZB5R.js → rm-TWU3JR6Z.js} +5 -5
- package/dist/chunks/{routes-JP2CNQ5J.js → routes-SZI2G4SE.js} +2 -2
- package/dist/chunks/{rule-inspect-ZBJJCDQV.js → rule-inspect-WFTVRK6B.js} +6 -6
- package/dist/chunks/{rules-HEGAXXUN.js → rules-AQYTFJI6.js} +8 -8
- package/dist/chunks/{schema-ZYIJYA2E.js → schema-LUVFYPWN.js} +1 -1
- package/dist/chunks/{schema-7GVL3BNP.js → schema-ZCDCJC7E.js} +22 -12
- package/dist/chunks/{tags-3SCWCMNQ.js → tags-RCNRFX7U.js} +3 -3
- package/dist/chunks/{update-YR2GCCJN.js → update-I7QGAOYF.js} +8 -8
- package/dist/commands/build/index.js +3099 -2519
- package/dist/commands/deploy/index.js +12 -12
- package/dist/commands/dev/index.js +85 -39
- package/dist/commands/env/index.js +149 -226
- package/dist/commands/link/index.js +7 -7
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +4904 -2237
- package/dist/help.js +1 -1
- package/dist/index.js +27 -15
- package/dist/runtime-assets/node-preloads/next-dev-websocket.cjs +5 -1
- package/dist/version.mjs +1 -1
- package/package.json +54 -51
|
@@ -5,11 +5,11 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
|
-
VERCEL_DIR,
|
|
9
8
|
require_dist as require_dist2,
|
|
10
|
-
require_dist3,
|
|
9
|
+
require_dist2 as require_dist3,
|
|
10
|
+
require_dist4,
|
|
11
11
|
require_lib
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HMJVUXE6.js";
|
|
13
13
|
import {
|
|
14
14
|
output_manager_default,
|
|
15
15
|
require_dist
|
|
@@ -7872,7 +7872,7 @@ var require_mime_types = __commonJS({
|
|
|
7872
7872
|
"../../node_modules/.pnpm/mime-types@2.1.24/node_modules/mime-types/index.js"(exports) {
|
|
7873
7873
|
"use strict";
|
|
7874
7874
|
var db = require_mime_db();
|
|
7875
|
-
var
|
|
7875
|
+
var extname = __require("path").extname;
|
|
7876
7876
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
7877
7877
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
7878
7878
|
exports.charset = charset;
|
|
@@ -7923,11 +7923,11 @@ var require_mime_types = __commonJS({
|
|
|
7923
7923
|
}
|
|
7924
7924
|
return exts[0];
|
|
7925
7925
|
}
|
|
7926
|
-
function lookup(
|
|
7927
|
-
if (!
|
|
7926
|
+
function lookup(path) {
|
|
7927
|
+
if (!path || typeof path !== "string") {
|
|
7928
7928
|
return false;
|
|
7929
7929
|
}
|
|
7930
|
-
var extension2 =
|
|
7930
|
+
var extension2 = extname("x." + path).toLowerCase().substr(1);
|
|
7931
7931
|
if (!extension2) {
|
|
7932
7932
|
return false;
|
|
7933
7933
|
}
|
|
@@ -7980,13 +7980,13 @@ var require_promisepipe = __commonJS({
|
|
|
7980
7980
|
}
|
|
7981
7981
|
const isReadable = stream.readable || typeof stream._read === "function";
|
|
7982
7982
|
function on(evt) {
|
|
7983
|
-
function executor(
|
|
7983
|
+
function executor(resolve, reject) {
|
|
7984
7984
|
const fn = evt === "error" ? (err) => reject(new StreamError(err, stream)) : () => {
|
|
7985
7985
|
if (isReadable && evt === "finish" && !state.error) {
|
|
7986
7986
|
return;
|
|
7987
7987
|
}
|
|
7988
7988
|
cleanupEventHandlers(stream, fn);
|
|
7989
|
-
|
|
7989
|
+
resolve(stream);
|
|
7990
7990
|
};
|
|
7991
7991
|
stream.on(evt, fn);
|
|
7992
7992
|
}
|
|
@@ -8032,6 +8032,77 @@ var require_promisepipe = __commonJS({
|
|
|
8032
8032
|
}
|
|
8033
8033
|
});
|
|
8034
8034
|
|
|
8035
|
+
// ../../internals/builder-orchestration/dist/merge.js
|
|
8036
|
+
var require_merge = __commonJS({
|
|
8037
|
+
"../../internals/builder-orchestration/dist/merge.js"(exports, module) {
|
|
8038
|
+
"use strict";
|
|
8039
|
+
var __defProp = Object.defineProperty;
|
|
8040
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8041
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8042
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8043
|
+
var __export = (target, all) => {
|
|
8044
|
+
for (var name in all)
|
|
8045
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8046
|
+
};
|
|
8047
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8048
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8049
|
+
for (let key of __getOwnPropNames(from))
|
|
8050
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
8051
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
8052
|
+
}
|
|
8053
|
+
return to;
|
|
8054
|
+
};
|
|
8055
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
8056
|
+
var merge_exports = {};
|
|
8057
|
+
__export(merge_exports, {
|
|
8058
|
+
merge: () => merge
|
|
8059
|
+
});
|
|
8060
|
+
module.exports = __toCommonJS(merge_exports);
|
|
8061
|
+
var import_path = __require("path");
|
|
8062
|
+
var import_error_utils = require_dist();
|
|
8063
|
+
var import_fs_extra = require_lib();
|
|
8064
|
+
async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
8065
|
+
const root = sourceRoot || source;
|
|
8066
|
+
if (ignoreFilter) {
|
|
8067
|
+
const relPath = (0, import_path.relative)(root, source);
|
|
8068
|
+
if (relPath && !ignoreFilter(relPath)) {
|
|
8069
|
+
await (0, import_fs_extra.remove)(source);
|
|
8070
|
+
return;
|
|
8071
|
+
}
|
|
8072
|
+
}
|
|
8073
|
+
const destStat = await (0, import_fs_extra.stat)(destination).catch(
|
|
8074
|
+
(err) => err
|
|
8075
|
+
);
|
|
8076
|
+
if ((0, import_error_utils.isErrnoException)(destStat)) {
|
|
8077
|
+
if (destStat.code === "ENOENT") {
|
|
8078
|
+
await (0, import_fs_extra.move)(source, destination);
|
|
8079
|
+
return;
|
|
8080
|
+
}
|
|
8081
|
+
throw destStat;
|
|
8082
|
+
} else if (destStat.isDirectory()) {
|
|
8083
|
+
const contents = await (0, import_fs_extra.readdir)(
|
|
8084
|
+
source
|
|
8085
|
+
).catch((err) => err);
|
|
8086
|
+
if ((0, import_error_utils.isErrnoException)(contents)) {
|
|
8087
|
+
if (contents.code !== "ENOTDIR") {
|
|
8088
|
+
throw contents;
|
|
8089
|
+
}
|
|
8090
|
+
} else {
|
|
8091
|
+
await Promise.all(
|
|
8092
|
+
contents.map(
|
|
8093
|
+
(name) => merge((0, import_path.join)(source, name), (0, import_path.join)(destination, name), ignoreFilter, root)
|
|
8094
|
+
)
|
|
8095
|
+
);
|
|
8096
|
+
await (0, import_fs_extra.rmdir)(source);
|
|
8097
|
+
return;
|
|
8098
|
+
}
|
|
8099
|
+
}
|
|
8100
|
+
await (0, import_fs_extra.remove)(destination);
|
|
8101
|
+
await (0, import_fs_extra.move)(source, destination);
|
|
8102
|
+
}
|
|
8103
|
+
}
|
|
8104
|
+
});
|
|
8105
|
+
|
|
8035
8106
|
// ../../node_modules/.pnpm/pend@1.2.0/node_modules/pend/index.js
|
|
8036
8107
|
var require_pend = __commonJS({
|
|
8037
8108
|
"../../node_modules/.pnpm/pend@1.2.0/node_modules/pend/index.js"(exports, module) {
|
|
@@ -8091,7 +8162,7 @@ var require_pend = __commonJS({
|
|
|
8091
8162
|
// ../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js
|
|
8092
8163
|
var require_fd_slicer = __commonJS({
|
|
8093
8164
|
"../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js"(exports) {
|
|
8094
|
-
var
|
|
8165
|
+
var fs = __require("fs");
|
|
8095
8166
|
var util = __require("util");
|
|
8096
8167
|
var stream = __require("stream");
|
|
8097
8168
|
var Readable = stream.Readable;
|
|
@@ -8116,7 +8187,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8116
8187
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
8117
8188
|
var self = this;
|
|
8118
8189
|
self.pend.go(function(cb) {
|
|
8119
|
-
|
|
8190
|
+
fs.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
8120
8191
|
cb();
|
|
8121
8192
|
callback(err, bytesRead, buffer2);
|
|
8122
8193
|
});
|
|
@@ -8125,7 +8196,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8125
8196
|
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
8126
8197
|
var self = this;
|
|
8127
8198
|
self.pend.go(function(cb) {
|
|
8128
|
-
|
|
8199
|
+
fs.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
|
|
8129
8200
|
cb();
|
|
8130
8201
|
callback(err, written, buffer2);
|
|
8131
8202
|
});
|
|
@@ -8148,7 +8219,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8148
8219
|
if (self.refCount < 0)
|
|
8149
8220
|
throw new Error("invalid unref");
|
|
8150
8221
|
if (self.autoClose) {
|
|
8151
|
-
|
|
8222
|
+
fs.close(self.fd, onCloseDone);
|
|
8152
8223
|
}
|
|
8153
8224
|
function onCloseDone(err) {
|
|
8154
8225
|
if (err) {
|
|
@@ -8187,7 +8258,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8187
8258
|
if (self.destroyed)
|
|
8188
8259
|
return cb();
|
|
8189
8260
|
var buffer = new Buffer(toRead);
|
|
8190
|
-
|
|
8261
|
+
fs.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
8191
8262
|
if (err) {
|
|
8192
8263
|
self.destroy(err);
|
|
8193
8264
|
} else if (bytesRead === 0) {
|
|
@@ -8237,7 +8308,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8237
8308
|
self.context.pend.go(function(cb) {
|
|
8238
8309
|
if (self.destroyed)
|
|
8239
8310
|
return cb();
|
|
8240
|
-
|
|
8311
|
+
fs.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
|
|
8241
8312
|
if (err2) {
|
|
8242
8313
|
self.destroy();
|
|
8243
8314
|
cb();
|
|
@@ -8666,7 +8737,7 @@ var require_buffer_crc32 = __commonJS({
|
|
|
8666
8737
|
// ../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js
|
|
8667
8738
|
var require_yauzl = __commonJS({
|
|
8668
8739
|
"../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js"(exports) {
|
|
8669
|
-
var
|
|
8740
|
+
var fs = __require("fs");
|
|
8670
8741
|
var zlib = __require("zlib");
|
|
8671
8742
|
var fd_slicer = require_fd_slicer();
|
|
8672
8743
|
var crc32 = require_buffer_crc32();
|
|
@@ -8684,7 +8755,7 @@ var require_yauzl = __commonJS({
|
|
|
8684
8755
|
exports.ZipFile = ZipFile;
|
|
8685
8756
|
exports.Entry = Entry;
|
|
8686
8757
|
exports.RandomAccessReader = RandomAccessReader;
|
|
8687
|
-
function open(
|
|
8758
|
+
function open(path, options, callback) {
|
|
8688
8759
|
if (typeof options === "function") {
|
|
8689
8760
|
callback = options;
|
|
8690
8761
|
options = null;
|
|
@@ -8703,12 +8774,12 @@ var require_yauzl = __commonJS({
|
|
|
8703
8774
|
options.strictFileNames = false;
|
|
8704
8775
|
if (callback == null)
|
|
8705
8776
|
callback = defaultCallback;
|
|
8706
|
-
|
|
8777
|
+
fs.open(path, "r", function(err, fd) {
|
|
8707
8778
|
if (err)
|
|
8708
8779
|
return callback(err);
|
|
8709
8780
|
fromFd(fd, options, function(err2, zipfile) {
|
|
8710
8781
|
if (err2)
|
|
8711
|
-
|
|
8782
|
+
fs.close(fd, defaultCallback);
|
|
8712
8783
|
callback(err2, zipfile);
|
|
8713
8784
|
});
|
|
8714
8785
|
});
|
|
@@ -8732,7 +8803,7 @@ var require_yauzl = __commonJS({
|
|
|
8732
8803
|
options.strictFileNames = false;
|
|
8733
8804
|
if (callback == null)
|
|
8734
8805
|
callback = defaultCallback;
|
|
8735
|
-
|
|
8806
|
+
fs.fstat(fd, function(err, stats) {
|
|
8736
8807
|
if (err)
|
|
8737
8808
|
return callback(err);
|
|
8738
8809
|
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
@@ -9613,27 +9684,27 @@ var require_lib2 = __commonJS({
|
|
|
9613
9684
|
return shimmed.call(this, reader, totalSize, options, callback);
|
|
9614
9685
|
};
|
|
9615
9686
|
} else {
|
|
9616
|
-
const shimmed = fn(function(
|
|
9617
|
-
return original.call(this,
|
|
9687
|
+
const shimmed = fn(function(path, unused, options, callback) {
|
|
9688
|
+
return original.call(this, path, options, callback);
|
|
9618
9689
|
});
|
|
9619
|
-
yauzl[methodName] = function(
|
|
9690
|
+
yauzl[methodName] = function(path, options, callback) {
|
|
9620
9691
|
if (typeof options == "function") {
|
|
9621
9692
|
callback = options;
|
|
9622
9693
|
options = {};
|
|
9623
9694
|
} else if (!options) {
|
|
9624
9695
|
options = {};
|
|
9625
9696
|
}
|
|
9626
|
-
return shimmed.call(this,
|
|
9697
|
+
return shimmed.call(this, path, null, options, callback);
|
|
9627
9698
|
};
|
|
9628
9699
|
}
|
|
9629
9700
|
return yauzl[methodName];
|
|
9630
9701
|
}
|
|
9631
9702
|
function zipFilePatcher(original, ZipFile) {
|
|
9632
|
-
return function(
|
|
9703
|
+
return function(path, totalSize, options, callback) {
|
|
9633
9704
|
const { lazyEntries } = options, hasLazyEntries = options.hasOwnProperty("lazyEntries");
|
|
9634
9705
|
if (!lazyEntries)
|
|
9635
9706
|
options.lazyEntries = true;
|
|
9636
|
-
return original.call(this,
|
|
9707
|
+
return original.call(this, path, totalSize, options, function(err, zipFile) {
|
|
9637
9708
|
if (err)
|
|
9638
9709
|
return callback(err);
|
|
9639
9710
|
const zipFileInternal = zipFile;
|
|
@@ -9654,8 +9725,8 @@ var require_lib2 = __commonJS({
|
|
|
9654
9725
|
};
|
|
9655
9726
|
}
|
|
9656
9727
|
function entryPatcher(original, Entry) {
|
|
9657
|
-
return function(
|
|
9658
|
-
return original.call(this,
|
|
9728
|
+
return function(path, totalSize, options, callback) {
|
|
9729
|
+
return original.call(this, path, totalSize, options, function(err, zipFile) {
|
|
9659
9730
|
if (err)
|
|
9660
9731
|
return callback(err);
|
|
9661
9732
|
zipFile.intercept("entry", function(entry, cb) {
|
|
@@ -9706,19 +9777,19 @@ var require_promisify = __commonJS({
|
|
|
9706
9777
|
function promisifyMethod(yauzl, Promise2, fnName) {
|
|
9707
9778
|
const fromBuffer = fnName == "fromBuffer";
|
|
9708
9779
|
cloner.patch(yauzl, fnName, (original) => {
|
|
9709
|
-
return function(
|
|
9710
|
-
return new Promise2((
|
|
9780
|
+
return function(path, totalSize, options) {
|
|
9781
|
+
return new Promise2((resolve, reject) => {
|
|
9711
9782
|
options = Object.assign({}, options, { lazyEntries: true, autoClose: false });
|
|
9712
|
-
original(
|
|
9783
|
+
original(path, totalSize, options, (err, zipFile) => {
|
|
9713
9784
|
if (err)
|
|
9714
9785
|
return reject(err);
|
|
9715
|
-
opened(zipFile,
|
|
9786
|
+
opened(zipFile, resolve, fromBuffer, yauzl);
|
|
9716
9787
|
});
|
|
9717
9788
|
});
|
|
9718
9789
|
};
|
|
9719
9790
|
});
|
|
9720
9791
|
}
|
|
9721
|
-
function opened(zipFile,
|
|
9792
|
+
function opened(zipFile, resolve, fromBuffer, yauzl) {
|
|
9722
9793
|
if (fromBuffer) {
|
|
9723
9794
|
zipFile.reader.unref = yauzl.RandomAccessReader.prototype.unref;
|
|
9724
9795
|
zipFile.reader.close = (cb) => cb();
|
|
@@ -9729,7 +9800,7 @@ var require_promisify = __commonJS({
|
|
|
9729
9800
|
zipFile.intercept("end", emittedEnd);
|
|
9730
9801
|
zipFile.intercept("close", emittedClose);
|
|
9731
9802
|
zipFile.intercept("error", emittedError);
|
|
9732
|
-
|
|
9803
|
+
resolve(zipFile);
|
|
9733
9804
|
}
|
|
9734
9805
|
function emittedError(err) {
|
|
9735
9806
|
const state = getState(this);
|
|
@@ -9748,14 +9819,14 @@ var require_promisify = __commonJS({
|
|
|
9748
9819
|
function promisifyClose(ZipFile, Promise2) {
|
|
9749
9820
|
const close = ZipFile.prototype.close;
|
|
9750
9821
|
ZipFile.prototype.close = function() {
|
|
9751
|
-
return new Promise2((
|
|
9822
|
+
return new Promise2((resolve, reject) => {
|
|
9752
9823
|
if (getError(this))
|
|
9753
9824
|
return rejectWithStoredError(this, reject);
|
|
9754
9825
|
if (!this.isOpen)
|
|
9755
|
-
return
|
|
9826
|
+
return resolve();
|
|
9756
9827
|
if (getState(this))
|
|
9757
9828
|
return reject(new Error("Previous operation has not completed yet"));
|
|
9758
|
-
setState(this, { action: "close", resolve
|
|
9829
|
+
setState(this, { action: "close", resolve, reject });
|
|
9759
9830
|
close.call(this);
|
|
9760
9831
|
});
|
|
9761
9832
|
};
|
|
@@ -9770,14 +9841,14 @@ var require_promisify = __commonJS({
|
|
|
9770
9841
|
function promisifyReadEntry(ZipFile, Promise2) {
|
|
9771
9842
|
const readEntry = ZipFile.prototype.readEntry;
|
|
9772
9843
|
ZipFile.prototype.readEntry = function() {
|
|
9773
|
-
return new Promise2((
|
|
9844
|
+
return new Promise2((resolve, reject) => {
|
|
9774
9845
|
if (getError(this))
|
|
9775
9846
|
return rejectWithStoredError(this, reject);
|
|
9776
9847
|
if (!this.isOpen)
|
|
9777
9848
|
return reject(new Error("ZipFile is not open"));
|
|
9778
9849
|
if (getState(this))
|
|
9779
9850
|
return reject(new Error("Previous operation has not completed yet"));
|
|
9780
|
-
setState(this, { action: "read", resolve
|
|
9851
|
+
setState(this, { action: "read", resolve, reject });
|
|
9781
9852
|
readEntry.call(this);
|
|
9782
9853
|
});
|
|
9783
9854
|
};
|
|
@@ -9823,11 +9894,11 @@ var require_promisify = __commonJS({
|
|
|
9823
9894
|
function addWalkEntriesMethod(ZipFile, Promise2) {
|
|
9824
9895
|
ZipFile.prototype.walkEntries = function(callback, numEntries) {
|
|
9825
9896
|
callback = wrapFunctionToReturnPromise(callback, Promise2);
|
|
9826
|
-
return new Promise2((
|
|
9897
|
+
return new Promise2((resolve, reject) => {
|
|
9827
9898
|
walkNextEntry(this, callback, numEntries, 0, (err) => {
|
|
9828
9899
|
if (err)
|
|
9829
9900
|
return reject(err);
|
|
9830
|
-
|
|
9901
|
+
resolve();
|
|
9831
9902
|
});
|
|
9832
9903
|
});
|
|
9833
9904
|
};
|
|
@@ -9848,13 +9919,13 @@ var require_promisify = __commonJS({
|
|
|
9848
9919
|
function promisifyOpenReadStream(ZipFile, Promise2) {
|
|
9849
9920
|
const openReadStream = ZipFile.prototype.openReadStream;
|
|
9850
9921
|
ZipFile.prototype.openReadStream = function(entry, options) {
|
|
9851
|
-
return new Promise2((
|
|
9922
|
+
return new Promise2((resolve, reject) => {
|
|
9852
9923
|
if (getError(this))
|
|
9853
9924
|
return rejectWithStoredError(this, reject);
|
|
9854
9925
|
openReadStream.call(this, entry, options || {}, (err, stream) => {
|
|
9855
9926
|
if (err)
|
|
9856
9927
|
return reject(err);
|
|
9857
|
-
|
|
9928
|
+
resolve(stream);
|
|
9858
9929
|
});
|
|
9859
9930
|
});
|
|
9860
9931
|
};
|
|
@@ -9870,7 +9941,7 @@ var require_promisify = __commonJS({
|
|
|
9870
9941
|
return result;
|
|
9871
9942
|
return Promise2.resolve(result);
|
|
9872
9943
|
} catch (err) {
|
|
9873
|
-
return new Promise2((
|
|
9944
|
+
return new Promise2((resolve, reject) => {
|
|
9874
9945
|
reject(err);
|
|
9875
9946
|
});
|
|
9876
9947
|
}
|
|
@@ -9916,471 +9987,460 @@ var require_lib3 = __commonJS({
|
|
|
9916
9987
|
}
|
|
9917
9988
|
});
|
|
9918
9989
|
|
|
9919
|
-
//
|
|
9920
|
-
var
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
var
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
}
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
(
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
return;
|
|
9990
|
+
// ../../internals/builder-orchestration/dist/unzip.js
|
|
9991
|
+
var require_unzip = __commonJS({
|
|
9992
|
+
"../../internals/builder-orchestration/dist/unzip.js"(exports, module) {
|
|
9993
|
+
"use strict";
|
|
9994
|
+
var __create = Object.create;
|
|
9995
|
+
var __defProp = Object.defineProperty;
|
|
9996
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9997
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9998
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9999
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10000
|
+
var __export = (target, all) => {
|
|
10001
|
+
for (var name in all)
|
|
10002
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10003
|
+
};
|
|
10004
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10005
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10006
|
+
for (let key of __getOwnPropNames(from))
|
|
10007
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10008
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10009
|
+
}
|
|
10010
|
+
return to;
|
|
10011
|
+
};
|
|
10012
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
10013
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
10014
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
10015
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
10016
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
10017
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
10018
|
+
mod
|
|
10019
|
+
));
|
|
10020
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10021
|
+
var unzip_exports = {};
|
|
10022
|
+
__export(unzip_exports, {
|
|
10023
|
+
unzip: () => unzip
|
|
10024
|
+
});
|
|
10025
|
+
module.exports = __toCommonJS(unzip_exports);
|
|
10026
|
+
var import_path = __toESM2(__require("path"));
|
|
10027
|
+
var import_promisepipe = __toESM2(require_promisepipe());
|
|
10028
|
+
var fs = __toESM2(require_lib());
|
|
10029
|
+
var import_build_utils = __require("@vercel/build-utils");
|
|
10030
|
+
var import_yauzl_promise = require_lib3();
|
|
10031
|
+
async function* createZipIterator(zipFile) {
|
|
10032
|
+
let entry;
|
|
10033
|
+
while ((entry = await zipFile.readEntry()) !== null) {
|
|
10034
|
+
yield entry;
|
|
10035
|
+
}
|
|
9966
10036
|
}
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
10037
|
+
async function unzip(buffer, dir) {
|
|
10038
|
+
const zipFile = await (0, import_yauzl_promise.fromBuffer)(buffer);
|
|
10039
|
+
for await (const entry of createZipIterator(zipFile)) {
|
|
10040
|
+
if (entry.fileName.startsWith("__MACOSX/"))
|
|
10041
|
+
continue;
|
|
10042
|
+
try {
|
|
10043
|
+
const destDir = import_path.default.dirname(import_path.default.join(dir, entry.fileName));
|
|
10044
|
+
await fs.mkdirp(destDir);
|
|
10045
|
+
const canonicalDestDir = await fs.realpath(destDir);
|
|
10046
|
+
const relativeDestDir = import_path.default.relative(dir, canonicalDestDir);
|
|
10047
|
+
if (relativeDestDir.split(import_path.default.sep).includes("..")) {
|
|
10048
|
+
throw new Error(
|
|
10049
|
+
`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`
|
|
10050
|
+
);
|
|
10051
|
+
}
|
|
10052
|
+
await extractEntry(zipFile, entry, dir);
|
|
10053
|
+
} catch (err) {
|
|
10054
|
+
await zipFile.close();
|
|
10055
|
+
throw err;
|
|
10056
|
+
}
|
|
9975
10057
|
}
|
|
9976
|
-
} else {
|
|
9977
|
-
await Promise.all(
|
|
9978
|
-
contents.map(
|
|
9979
|
-
(name) => merge(join(source, name), join(destination, name), ignoreFilter, root)
|
|
9980
|
-
)
|
|
9981
|
-
);
|
|
9982
|
-
await (0, import_fs_extra.rmdir)(source);
|
|
9983
|
-
return;
|
|
9984
10058
|
}
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
}
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
const
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`
|
|
10015
|
-
);
|
|
10059
|
+
async function extractEntry(zipFile, entry, dir) {
|
|
10060
|
+
const dest = import_path.default.join(dir, entry.fileName);
|
|
10061
|
+
const mode = entry.externalFileAttributes >> 16 & 65535;
|
|
10062
|
+
const IFMT = 61440;
|
|
10063
|
+
const IFDIR = 16384;
|
|
10064
|
+
const IFLNK = 40960;
|
|
10065
|
+
const symlink = (mode & IFMT) === IFLNK;
|
|
10066
|
+
let isDir = (mode & IFMT) === IFDIR;
|
|
10067
|
+
if (!isDir && entry.fileName.endsWith("/")) {
|
|
10068
|
+
isDir = true;
|
|
10069
|
+
}
|
|
10070
|
+
const madeBy = entry.versionMadeBy >> 8;
|
|
10071
|
+
if (!isDir)
|
|
10072
|
+
isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
|
10073
|
+
const procMode = getExtractedMode(mode, isDir) & 511;
|
|
10074
|
+
const destDir = isDir ? dest : import_path.default.dirname(dest);
|
|
10075
|
+
const mkdirOptions = { recursive: true };
|
|
10076
|
+
if (isDir) {
|
|
10077
|
+
mkdirOptions.mode = procMode;
|
|
10078
|
+
}
|
|
10079
|
+
await fs.mkdir(destDir, mkdirOptions);
|
|
10080
|
+
if (isDir)
|
|
10081
|
+
return;
|
|
10082
|
+
const readStream = await zipFile.openReadStream(entry);
|
|
10083
|
+
if (symlink) {
|
|
10084
|
+
const link = await (0, import_build_utils.streamToBuffer)(readStream);
|
|
10085
|
+
await fs.symlink(link.toString("utf8"), dest);
|
|
10086
|
+
} else {
|
|
10087
|
+
await (0, import_promisepipe.default)(readStream, fs.createWriteStream(dest, { mode: procMode }));
|
|
10016
10088
|
}
|
|
10017
|
-
await extractEntry(zipFile, entry, dir);
|
|
10018
|
-
} catch (err) {
|
|
10019
|
-
await zipFile.close();
|
|
10020
|
-
throw err;
|
|
10021
10089
|
}
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
if (!isDir && entry.fileName.endsWith("/")) {
|
|
10033
|
-
isDir = true;
|
|
10034
|
-
}
|
|
10035
|
-
const madeBy = entry.versionMadeBy >> 8;
|
|
10036
|
-
if (!isDir)
|
|
10037
|
-
isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
|
10038
|
-
const procMode = getExtractedMode(mode, isDir) & 511;
|
|
10039
|
-
const destDir = isDir ? dest : path.dirname(dest);
|
|
10040
|
-
const mkdirOptions = { recursive: true };
|
|
10041
|
-
if (isDir) {
|
|
10042
|
-
mkdirOptions.mode = procMode;
|
|
10043
|
-
}
|
|
10044
|
-
await fs.mkdir(destDir, mkdirOptions);
|
|
10045
|
-
if (isDir)
|
|
10046
|
-
return;
|
|
10047
|
-
const readStream = await zipFile.openReadStream(entry);
|
|
10048
|
-
if (symlink2) {
|
|
10049
|
-
const link = await streamToBuffer(readStream);
|
|
10050
|
-
await fs.symlink(link.toString("utf8"), dest);
|
|
10051
|
-
} else {
|
|
10052
|
-
await (0, import_promisepipe.default)(readStream, fs.createWriteStream(dest, { mode: procMode }));
|
|
10053
|
-
}
|
|
10054
|
-
}
|
|
10055
|
-
function getExtractedMode(entryMode, isDir) {
|
|
10056
|
-
let mode = entryMode;
|
|
10057
|
-
if (mode === 0) {
|
|
10058
|
-
if (isDir) {
|
|
10059
|
-
mode = 493;
|
|
10060
|
-
} else {
|
|
10061
|
-
mode = 420;
|
|
10090
|
+
function getExtractedMode(entryMode, isDir) {
|
|
10091
|
+
let mode = entryMode;
|
|
10092
|
+
if (mode === 0) {
|
|
10093
|
+
if (isDir) {
|
|
10094
|
+
mode = 493;
|
|
10095
|
+
} else {
|
|
10096
|
+
mode = 420;
|
|
10097
|
+
}
|
|
10098
|
+
}
|
|
10099
|
+
return mode;
|
|
10062
10100
|
}
|
|
10063
10101
|
}
|
|
10064
|
-
|
|
10065
|
-
}
|
|
10102
|
+
});
|
|
10066
10103
|
|
|
10067
|
-
//
|
|
10068
|
-
var
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
var
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
standalone,
|
|
10087
|
-
workPath,
|
|
10088
|
-
service,
|
|
10089
|
-
nestServiceOutput = false,
|
|
10090
|
-
stripServiceRoutePrefix = false
|
|
10091
|
-
} = args;
|
|
10092
|
-
const writeOutputDir = service && nestServiceOutput ? getServiceOutputDir(outputDir, service) : outputDir;
|
|
10093
|
-
let version;
|
|
10094
|
-
let actualResult;
|
|
10095
|
-
if (builder.version === -1) {
|
|
10096
|
-
const vx = buildResult;
|
|
10097
|
-
version = vx.resultVersion;
|
|
10098
|
-
actualResult = vx.result;
|
|
10099
|
-
} else {
|
|
10100
|
-
version = builder.version;
|
|
10101
|
-
actualResult = buildResult;
|
|
10102
|
-
}
|
|
10103
|
-
if (typeof version !== "number" || version === 2) {
|
|
10104
|
-
return writeBuildResultV2({
|
|
10105
|
-
repoRootPath,
|
|
10106
|
-
outputDir: writeOutputDir,
|
|
10107
|
-
buildResult: actualResult,
|
|
10108
|
-
build,
|
|
10109
|
-
vercelConfig,
|
|
10110
|
-
standalone,
|
|
10111
|
-
workPath,
|
|
10112
|
-
service,
|
|
10113
|
-
rootOutputDir: outputDir,
|
|
10114
|
-
stripServiceRoutePrefix
|
|
10115
|
-
});
|
|
10116
|
-
} else if (version === 3) {
|
|
10117
|
-
return writeBuildResultV3({
|
|
10118
|
-
repoRootPath,
|
|
10119
|
-
outputDir: writeOutputDir,
|
|
10120
|
-
buildResult: actualResult,
|
|
10121
|
-
build,
|
|
10122
|
-
vercelConfig,
|
|
10123
|
-
standalone,
|
|
10124
|
-
workPath,
|
|
10125
|
-
service,
|
|
10126
|
-
rootOutputDir: outputDir,
|
|
10127
|
-
stripServiceRoutePrefix
|
|
10128
|
-
});
|
|
10129
|
-
}
|
|
10130
|
-
throw new Error(
|
|
10131
|
-
`Unsupported Builder version \`${version}\` from "${builderPkg.name}"`
|
|
10132
|
-
);
|
|
10133
|
-
}
|
|
10134
|
-
function isEdgeFunction(v) {
|
|
10135
|
-
return v?.type === "EdgeFunction";
|
|
10136
|
-
}
|
|
10137
|
-
function isContainerImage(value) {
|
|
10138
|
-
return typeof value === "object" && value !== null && "runtime" in value && value.runtime === "container";
|
|
10139
|
-
}
|
|
10140
|
-
function isLambda(v) {
|
|
10141
|
-
return v?.type === "Lambda";
|
|
10142
|
-
}
|
|
10143
|
-
function isPrerender(v) {
|
|
10144
|
-
return v?.type === "Prerender";
|
|
10145
|
-
}
|
|
10146
|
-
function isFile(v) {
|
|
10147
|
-
const type = v?.type;
|
|
10148
|
-
return type === "FileRef" || type === "FileFsRef" || type === "FileBlob";
|
|
10149
|
-
}
|
|
10150
|
-
function injectServiceEnvVars(fn, service, stripServiceRoutePrefix = false) {
|
|
10151
|
-
const target = fn.config ?? fn;
|
|
10152
|
-
target.environment ??= {};
|
|
10153
|
-
if (service?.name) {
|
|
10154
|
-
target.environment.VERCEL_SERVICE_NAME = service.name;
|
|
10155
|
-
}
|
|
10156
|
-
if (service?.type) {
|
|
10157
|
-
target.environment.VERCEL_SERVICE_TYPE = service.type;
|
|
10158
|
-
}
|
|
10159
|
-
if (service?.trigger) {
|
|
10160
|
-
target.environment.VERCEL_SERVICE_TRIGGER = service.trigger;
|
|
10161
|
-
}
|
|
10162
|
-
if (service?.routePrefix && service.routePrefix !== "/") {
|
|
10163
|
-
target.environment.VERCEL_SERVICE_ROUTE_PREFIX = service.routePrefix;
|
|
10164
|
-
}
|
|
10165
|
-
if (stripServiceRoutePrefix) {
|
|
10166
|
-
target.environment.VERCEL_SERVICE_ROUTE_PREFIX_STRIP = "1";
|
|
10167
|
-
}
|
|
10168
|
-
}
|
|
10169
|
-
function stripDuplicateSlashes(path2) {
|
|
10170
|
-
return normalize(path2).replace(/(^\/|\/$)/g, "");
|
|
10171
|
-
}
|
|
10172
|
-
async function resolveFunctionConfiguration(src, vercelConfig, service) {
|
|
10173
|
-
if (service && isExperimentalServiceV2(service) && service.functions) {
|
|
10174
|
-
let sourceFile = src;
|
|
10175
|
-
const serviceRoot = stripDuplicateSlashes(service.root);
|
|
10176
|
-
if (serviceRoot && serviceRoot !== ".") {
|
|
10177
|
-
const prefix = `${serviceRoot}/`;
|
|
10178
|
-
if (sourceFile.startsWith(prefix)) {
|
|
10179
|
-
sourceFile = sourceFile.slice(prefix.length);
|
|
10180
|
-
}
|
|
10181
|
-
}
|
|
10182
|
-
return getLambdaOptionsFromFunction({
|
|
10183
|
-
sourceFile,
|
|
10184
|
-
config: {
|
|
10185
|
-
...vercelConfig,
|
|
10186
|
-
functions: service.functions,
|
|
10187
|
-
serviceName: service.name
|
|
10104
|
+
// ../../internals/builder-orchestration/dist/write-build-result.js
|
|
10105
|
+
var require_write_build_result = __commonJS({
|
|
10106
|
+
"../../internals/builder-orchestration/dist/write-build-result.js"(exports, module) {
|
|
10107
|
+
"use strict";
|
|
10108
|
+
var __create = Object.create;
|
|
10109
|
+
var __defProp = Object.defineProperty;
|
|
10110
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10111
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10112
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10113
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10114
|
+
var __export = (target, all) => {
|
|
10115
|
+
for (var name in all)
|
|
10116
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10117
|
+
};
|
|
10118
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10119
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10120
|
+
for (let key of __getOwnPropNames(from))
|
|
10121
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10122
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10188
10123
|
}
|
|
10124
|
+
return to;
|
|
10125
|
+
};
|
|
10126
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
10127
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
10128
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
10129
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
10130
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
10131
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
10132
|
+
mod
|
|
10133
|
+
));
|
|
10134
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10135
|
+
var write_build_result_exports = {};
|
|
10136
|
+
__export(write_build_result_exports, {
|
|
10137
|
+
OUTPUT_DIR: () => OUTPUT_DIR2,
|
|
10138
|
+
createWriteBuildResult: () => createWriteBuildResult2,
|
|
10139
|
+
filesWithoutFsRefs: () => filesWithoutFsRefs2,
|
|
10140
|
+
findDirs: () => findDirs2,
|
|
10141
|
+
isLambda: () => isLambda2,
|
|
10142
|
+
relocateRootBuildOutputToService: () => relocateRootBuildOutputToService2
|
|
10189
10143
|
});
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
await mergeBuilderOutput(outputDir, buildResult, workPath, rootOutputDir);
|
|
10217
|
-
return;
|
|
10218
|
-
}
|
|
10219
|
-
if (!buildResult.output) {
|
|
10220
|
-
const configFile = vercelConfig?.[import_client.fileNameSymbol];
|
|
10221
|
-
const updateMessage = build.use.startsWith("@now/") ? ` Please update from "@now" to "@vercel" in your \`${configFile}\` file.` : "";
|
|
10222
|
-
throw new Error(
|
|
10223
|
-
`The build result from "${build.use}" is missing the "output" property.${updateMessage}`
|
|
10224
|
-
);
|
|
10225
|
-
}
|
|
10226
|
-
const existingFunctions = /* @__PURE__ */ new Map();
|
|
10227
|
-
const overrides = {};
|
|
10228
|
-
const functionConfiguration = build.src ? await resolveFunctionConfiguration(build.src, vercelConfig, service) : {};
|
|
10229
|
-
for (const [path2, output] of Object.entries(buildResult.output)) {
|
|
10230
|
-
const normalizedPath = stripDuplicateSlashes(path2);
|
|
10231
|
-
if (isContainerImage(output)) {
|
|
10232
|
-
injectServiceEnvVars(
|
|
10233
|
-
output,
|
|
10234
|
-
service && isExperimentalService(service) ? service : void 0,
|
|
10235
|
-
stripServiceRoutePrefix
|
|
10236
|
-
);
|
|
10237
|
-
await writeContainerImage(
|
|
10238
|
-
outputDir,
|
|
10239
|
-
output,
|
|
10240
|
-
normalizedPath,
|
|
10241
|
-
functionConfiguration
|
|
10242
|
-
);
|
|
10243
|
-
} else if (isLambda(output)) {
|
|
10244
|
-
injectServiceEnvVars(
|
|
10245
|
-
output,
|
|
10246
|
-
service && isExperimentalService(service) ? service : void 0,
|
|
10247
|
-
stripServiceRoutePrefix
|
|
10248
|
-
);
|
|
10249
|
-
await writeLambda(
|
|
10144
|
+
module.exports = __toCommonJS(write_build_result_exports);
|
|
10145
|
+
var import_fs_extra = __toESM2(require_lib());
|
|
10146
|
+
var import_mime_types = __toESM2(require_mime_types());
|
|
10147
|
+
var import_path = __require("path");
|
|
10148
|
+
var import_build_utils = __require("@vercel/build-utils");
|
|
10149
|
+
var import_promisepipe = __toESM2(require_promisepipe());
|
|
10150
|
+
var import_merge = require_merge();
|
|
10151
|
+
var import_unzip = require_unzip();
|
|
10152
|
+
var import_client = require_dist2();
|
|
10153
|
+
var { normalize } = import_path.posix;
|
|
10154
|
+
var OUTPUT_DIR2 = (0, import_path.join)(".vercel", "output");
|
|
10155
|
+
function createWriteBuildResult2(output) {
|
|
10156
|
+
return {
|
|
10157
|
+
writeBuildResult: (args) => writeBuildResult2(args, output),
|
|
10158
|
+
relocateRootBuildOutputToService: relocateRootBuildOutputToService2,
|
|
10159
|
+
filesWithoutFsRefs: filesWithoutFsRefs2
|
|
10160
|
+
};
|
|
10161
|
+
}
|
|
10162
|
+
var BUILD_OUTPUT_API_ENTRIES = [
|
|
10163
|
+
"config.json",
|
|
10164
|
+
"functions",
|
|
10165
|
+
"routes",
|
|
10166
|
+
"static"
|
|
10167
|
+
];
|
|
10168
|
+
async function writeBuildResult2(args, outputManager) {
|
|
10169
|
+
const {
|
|
10250
10170
|
repoRootPath,
|
|
10251
10171
|
outputDir,
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10172
|
+
buildResult,
|
|
10173
|
+
build,
|
|
10174
|
+
builder,
|
|
10175
|
+
builderPkg,
|
|
10176
|
+
vercelConfig,
|
|
10177
|
+
standalone,
|
|
10178
|
+
workPath,
|
|
10179
|
+
service,
|
|
10180
|
+
nestServiceOutput = false,
|
|
10181
|
+
stripServiceRoutePrefix = false
|
|
10182
|
+
} = args;
|
|
10183
|
+
const writeOutputDir = service && nestServiceOutput ? getServiceOutputDir(outputDir, service) : outputDir;
|
|
10184
|
+
let version;
|
|
10185
|
+
let actualResult;
|
|
10186
|
+
if (builder.version === -1) {
|
|
10187
|
+
const vx = buildResult;
|
|
10188
|
+
version = vx.resultVersion;
|
|
10189
|
+
actualResult = vx.result;
|
|
10190
|
+
} else {
|
|
10191
|
+
version = builder.version;
|
|
10192
|
+
actualResult = buildResult;
|
|
10263
10193
|
}
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10194
|
+
if (typeof version !== "number" || version === 2) {
|
|
10195
|
+
return writeBuildResultV2({
|
|
10196
|
+
repoRootPath,
|
|
10197
|
+
outputDir: writeOutputDir,
|
|
10198
|
+
buildResult: actualResult,
|
|
10199
|
+
build,
|
|
10200
|
+
vercelConfig,
|
|
10201
|
+
standalone,
|
|
10202
|
+
workPath,
|
|
10203
|
+
service,
|
|
10204
|
+
rootOutputDir: outputDir,
|
|
10205
|
+
stripServiceRoutePrefix,
|
|
10206
|
+
outputManager
|
|
10207
|
+
});
|
|
10208
|
+
} else if (version === 3) {
|
|
10209
|
+
return writeBuildResultV3({
|
|
10210
|
+
repoRootPath,
|
|
10211
|
+
outputDir: writeOutputDir,
|
|
10212
|
+
buildResult: actualResult,
|
|
10213
|
+
build,
|
|
10214
|
+
vercelConfig,
|
|
10215
|
+
standalone,
|
|
10216
|
+
workPath,
|
|
10217
|
+
service,
|
|
10218
|
+
rootOutputDir: outputDir,
|
|
10219
|
+
stripServiceRoutePrefix,
|
|
10220
|
+
outputManager
|
|
10221
|
+
});
|
|
10222
|
+
}
|
|
10223
|
+
throw new Error(
|
|
10224
|
+
`Unsupported Builder version \`${version}\` from "${builderPkg.name}"`
|
|
10272
10225
|
);
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10226
|
+
}
|
|
10227
|
+
function isEdgeFunction(v) {
|
|
10228
|
+
return v?.type === "EdgeFunction";
|
|
10229
|
+
}
|
|
10230
|
+
function isContainerImage(value) {
|
|
10231
|
+
return typeof value === "object" && value !== null && "runtime" in value && value.runtime === "container";
|
|
10232
|
+
}
|
|
10233
|
+
function isLambda2(v) {
|
|
10234
|
+
return v?.type === "Lambda";
|
|
10235
|
+
}
|
|
10236
|
+
function isPrerender(v) {
|
|
10237
|
+
return v?.type === "Prerender";
|
|
10238
|
+
}
|
|
10239
|
+
function isFile(v) {
|
|
10240
|
+
const type = v?.type;
|
|
10241
|
+
return type === "FileRef" || type === "FileFsRef" || type === "FileBlob";
|
|
10242
|
+
}
|
|
10243
|
+
function injectServiceEnvVars(fn, service, stripServiceRoutePrefix = false) {
|
|
10244
|
+
const target = fn.config ?? fn;
|
|
10245
|
+
target.environment ??= {};
|
|
10246
|
+
if (service?.name) {
|
|
10247
|
+
target.environment.VERCEL_SERVICE_NAME = service.name;
|
|
10248
|
+
}
|
|
10249
|
+
if (service?.type) {
|
|
10250
|
+
target.environment.VERCEL_SERVICE_TYPE = service.type;
|
|
10251
|
+
}
|
|
10252
|
+
if (service?.trigger) {
|
|
10253
|
+
target.environment.VERCEL_SERVICE_TRIGGER = service.trigger;
|
|
10254
|
+
}
|
|
10255
|
+
if (service?.routePrefix && service.routePrefix !== "/") {
|
|
10256
|
+
target.environment.VERCEL_SERVICE_ROUTE_PREFIX = service.routePrefix;
|
|
10257
|
+
}
|
|
10258
|
+
if (stripServiceRoutePrefix) {
|
|
10259
|
+
target.environment.VERCEL_SERVICE_ROUTE_PREFIX_STRIP = "1";
|
|
10260
|
+
}
|
|
10261
|
+
}
|
|
10262
|
+
function stripDuplicateSlashes(path) {
|
|
10263
|
+
return normalize(path).replace(/(^\/|\/$)/g, "");
|
|
10264
|
+
}
|
|
10265
|
+
async function resolveFunctionConfiguration(src, vercelConfig, service) {
|
|
10266
|
+
if (service && (0, import_build_utils.isExperimentalServiceV2)(service) && service.functions) {
|
|
10267
|
+
let sourceFile = src;
|
|
10268
|
+
const serviceRoot = stripDuplicateSlashes(service.root);
|
|
10269
|
+
if (serviceRoot && serviceRoot !== ".") {
|
|
10270
|
+
const prefix = `${serviceRoot}/`;
|
|
10271
|
+
if (sourceFile.startsWith(prefix)) {
|
|
10272
|
+
sourceFile = sourceFile.slice(prefix.length);
|
|
10284
10273
|
}
|
|
10285
10274
|
}
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
fallback = new FileFsRef({
|
|
10294
|
-
...output.fallback,
|
|
10295
|
-
fsPath: basename(fallbackName)
|
|
10275
|
+
return (0, import_build_utils.getLambdaOptionsFromFunction)({
|
|
10276
|
+
sourceFile,
|
|
10277
|
+
config: {
|
|
10278
|
+
...vercelConfig,
|
|
10279
|
+
functions: service.functions,
|
|
10280
|
+
serviceName: service.name
|
|
10281
|
+
}
|
|
10296
10282
|
});
|
|
10297
10283
|
}
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10284
|
+
if (vercelConfig) {
|
|
10285
|
+
return (0, import_build_utils.getLambdaOptionsFromFunction)({
|
|
10286
|
+
sourceFile: src,
|
|
10287
|
+
config: vercelConfig
|
|
10288
|
+
});
|
|
10289
|
+
}
|
|
10290
|
+
return {};
|
|
10291
|
+
}
|
|
10292
|
+
function getServiceOutputDir(outputDir, service) {
|
|
10293
|
+
return (0, import_path.join)(outputDir, "services", service.name);
|
|
10294
|
+
}
|
|
10295
|
+
async function relocateRootBuildOutputToService2(args) {
|
|
10296
|
+
const { outputDir, service, workPath } = args;
|
|
10297
|
+
await relocateBuildOutputApiEntries(
|
|
10311
10298
|
outputDir,
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
overrides,
|
|
10315
|
-
vercelConfig?.cleanUrls
|
|
10299
|
+
getServiceOutputDir(outputDir, service),
|
|
10300
|
+
workPath
|
|
10316
10301
|
);
|
|
10317
|
-
}
|
|
10318
|
-
|
|
10302
|
+
}
|
|
10303
|
+
async function writeBuildResultV2(args) {
|
|
10304
|
+
const {
|
|
10319
10305
|
repoRootPath,
|
|
10320
10306
|
outputDir,
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
standalone
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
const
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10307
|
+
buildResult,
|
|
10308
|
+
build,
|
|
10309
|
+
vercelConfig,
|
|
10310
|
+
standalone,
|
|
10311
|
+
workPath,
|
|
10312
|
+
service,
|
|
10313
|
+
rootOutputDir,
|
|
10314
|
+
stripServiceRoutePrefix,
|
|
10315
|
+
outputManager
|
|
10316
|
+
} = args;
|
|
10317
|
+
if ("buildOutputPath" in buildResult) {
|
|
10318
|
+
await mergeBuilderOutput(
|
|
10319
|
+
outputDir,
|
|
10320
|
+
buildResult,
|
|
10321
|
+
workPath,
|
|
10322
|
+
rootOutputDir,
|
|
10323
|
+
outputManager
|
|
10324
|
+
);
|
|
10325
|
+
return;
|
|
10326
|
+
}
|
|
10327
|
+
if (!buildResult.output) {
|
|
10328
|
+
const configFile = vercelConfig?.[import_client.fileNameSymbol];
|
|
10329
|
+
const updateMessage = build.use.startsWith("@now/") ? ` Please update from "@now" to "@vercel" in your \`${configFile}\` file.` : "";
|
|
10330
|
+
throw new Error(
|
|
10331
|
+
`The build result from "${build.use}" is missing the "output" property.${updateMessage}`
|
|
10332
|
+
);
|
|
10333
|
+
}
|
|
10334
|
+
const existingFunctions = /* @__PURE__ */ new Map();
|
|
10335
|
+
const overrides = {};
|
|
10336
|
+
const functionConfiguration = build.src ? await resolveFunctionConfiguration(build.src, vercelConfig, service) : {};
|
|
10337
|
+
for (const [path, output] of Object.entries(buildResult.output)) {
|
|
10338
|
+
const normalizedPath = stripDuplicateSlashes(path);
|
|
10339
|
+
if (isContainerImage(output)) {
|
|
10340
|
+
injectServiceEnvVars(
|
|
10341
|
+
output,
|
|
10342
|
+
service && (0, import_build_utils.isExperimentalService)(service) ? service : void 0,
|
|
10343
|
+
stripServiceRoutePrefix
|
|
10344
|
+
);
|
|
10345
|
+
await writeContainerImage(
|
|
10346
|
+
outputDir,
|
|
10347
|
+
output,
|
|
10348
|
+
normalizedPath,
|
|
10349
|
+
functionConfiguration
|
|
10350
|
+
);
|
|
10351
|
+
} else if (isLambda2(output)) {
|
|
10352
|
+
injectServiceEnvVars(
|
|
10353
|
+
output,
|
|
10354
|
+
service && (0, import_build_utils.isExperimentalService)(service) ? service : void 0,
|
|
10355
|
+
stripServiceRoutePrefix
|
|
10356
|
+
);
|
|
10357
|
+
await writeLambda(
|
|
10358
|
+
repoRootPath,
|
|
10359
|
+
outputDir,
|
|
10360
|
+
output,
|
|
10361
|
+
normalizedPath,
|
|
10362
|
+
void 0,
|
|
10363
|
+
existingFunctions,
|
|
10364
|
+
standalone
|
|
10365
|
+
);
|
|
10366
|
+
} else if (isPrerender(output)) {
|
|
10367
|
+
if (!output.lambda) {
|
|
10368
|
+
throw new Error(
|
|
10369
|
+
`Invalid Prerender with no "lambda" property: ${normalizedPath}`
|
|
10370
|
+
);
|
|
10371
|
+
}
|
|
10372
|
+
await writeLambda(
|
|
10373
|
+
repoRootPath,
|
|
10374
|
+
outputDir,
|
|
10375
|
+
output.lambda,
|
|
10376
|
+
normalizedPath,
|
|
10377
|
+
void 0,
|
|
10378
|
+
existingFunctions,
|
|
10379
|
+
standalone
|
|
10380
|
+
);
|
|
10381
|
+
let fallback = output.fallback;
|
|
10382
|
+
if (fallback) {
|
|
10383
|
+
const ext = getFileExtension(fallback);
|
|
10384
|
+
const fallbackName = `${normalizedPath}.prerender-fallback${ext}`;
|
|
10385
|
+
const fallbackPath = (0, import_path.join)(outputDir, "functions", fallbackName);
|
|
10386
|
+
let usedHardLink = false;
|
|
10387
|
+
if ("fsPath" in fallback) {
|
|
10388
|
+
try {
|
|
10389
|
+
await import_fs_extra.default.link(fallback.fsPath, fallbackPath);
|
|
10390
|
+
usedHardLink = true;
|
|
10391
|
+
} catch (_) {
|
|
10392
|
+
}
|
|
10360
10393
|
}
|
|
10361
|
-
if (
|
|
10362
|
-
|
|
10394
|
+
if (!usedHardLink) {
|
|
10395
|
+
const stream = fallback.toStream();
|
|
10396
|
+
await (0, import_promisepipe.default)(
|
|
10397
|
+
stream,
|
|
10398
|
+
import_fs_extra.default.createWriteStream(fallbackPath, { mode: fallback.mode })
|
|
10399
|
+
);
|
|
10363
10400
|
}
|
|
10401
|
+
fallback = new import_build_utils.FileFsRef({
|
|
10402
|
+
...output.fallback,
|
|
10403
|
+
fsPath: (0, import_path.basename)(fallbackName)
|
|
10404
|
+
});
|
|
10364
10405
|
}
|
|
10406
|
+
const prerenderConfigPath = (0, import_path.join)(
|
|
10407
|
+
outputDir,
|
|
10408
|
+
"functions",
|
|
10409
|
+
`${normalizedPath}.prerender-config.json`
|
|
10410
|
+
);
|
|
10411
|
+
const prerenderConfig = {
|
|
10412
|
+
...output,
|
|
10413
|
+
lambda: void 0,
|
|
10414
|
+
fallback
|
|
10415
|
+
};
|
|
10416
|
+
await import_fs_extra.default.writeJSON(prerenderConfigPath, prerenderConfig, { spaces: 2 });
|
|
10417
|
+
} else if (isFile(output)) {
|
|
10418
|
+
await writeStaticFile(
|
|
10419
|
+
outputDir,
|
|
10420
|
+
output,
|
|
10421
|
+
normalizedPath,
|
|
10422
|
+
overrides,
|
|
10423
|
+
vercelConfig?.cleanUrls
|
|
10424
|
+
);
|
|
10425
|
+
} else if (isEdgeFunction(output)) {
|
|
10426
|
+
await writeEdgeFunction(
|
|
10427
|
+
repoRootPath,
|
|
10428
|
+
outputDir,
|
|
10429
|
+
output,
|
|
10430
|
+
normalizedPath,
|
|
10431
|
+
existingFunctions,
|
|
10432
|
+
standalone
|
|
10433
|
+
);
|
|
10434
|
+
} else {
|
|
10435
|
+
throw new Error(
|
|
10436
|
+
`Unsupported output type: "${output.type}" for ${normalizedPath}`
|
|
10437
|
+
);
|
|
10365
10438
|
}
|
|
10366
|
-
return writeBuildResultV2({
|
|
10367
|
-
repoRootPath,
|
|
10368
|
-
outputDir,
|
|
10369
|
-
buildResult: { output: newOutput, routes: buildResult.routes },
|
|
10370
|
-
build,
|
|
10371
|
-
vercelConfig,
|
|
10372
|
-
standalone,
|
|
10373
|
-
workPath,
|
|
10374
|
-
service,
|
|
10375
|
-
rootOutputDir,
|
|
10376
|
-
stripServiceRoutePrefix
|
|
10377
|
-
});
|
|
10378
|
-
} catch (error) {
|
|
10379
|
-
output_manager_default.error(`Failed to read routes.json: ${error}`);
|
|
10380
10439
|
}
|
|
10440
|
+
return Object.keys(overrides).length > 0 ? overrides : void 0;
|
|
10381
10441
|
}
|
|
10382
|
-
|
|
10383
|
-
|
|
10442
|
+
async function writeBuildResultV3(args) {
|
|
10443
|
+
const {
|
|
10384
10444
|
repoRootPath,
|
|
10385
10445
|
outputDir,
|
|
10386
10446
|
buildResult,
|
|
@@ -10390,502 +10450,866 @@ async function writeBuildResultV3(args) {
|
|
|
10390
10450
|
workPath,
|
|
10391
10451
|
service,
|
|
10392
10452
|
rootOutputDir,
|
|
10393
|
-
stripServiceRoutePrefix
|
|
10394
|
-
|
|
10453
|
+
stripServiceRoutePrefix,
|
|
10454
|
+
outputManager
|
|
10455
|
+
} = args;
|
|
10456
|
+
const { output } = buildResult;
|
|
10457
|
+
const routesJsonPath = (0, import_path.join)(workPath, ".vercel", "routes.json");
|
|
10458
|
+
if ((0, import_build_utils.isBackendBuilder)(build) || build.use === "@vercel/python") {
|
|
10459
|
+
if ((0, import_fs_extra.existsSync)(routesJsonPath)) {
|
|
10460
|
+
try {
|
|
10461
|
+
const newOutput = {
|
|
10462
|
+
index: output
|
|
10463
|
+
};
|
|
10464
|
+
const routesJson = await import_fs_extra.default.readJSON(routesJsonPath);
|
|
10465
|
+
if (routesJson && typeof routesJson === "object" && "routes" in routesJson && Array.isArray(routesJson.routes)) {
|
|
10466
|
+
for (const route of routesJson.routes) {
|
|
10467
|
+
if (route.source === "/") {
|
|
10468
|
+
continue;
|
|
10469
|
+
}
|
|
10470
|
+
if (route.source) {
|
|
10471
|
+
newOutput[route.source] = output;
|
|
10472
|
+
}
|
|
10473
|
+
}
|
|
10474
|
+
}
|
|
10475
|
+
return writeBuildResultV2({
|
|
10476
|
+
repoRootPath,
|
|
10477
|
+
outputDir,
|
|
10478
|
+
buildResult: { output: newOutput, routes: buildResult.routes },
|
|
10479
|
+
build,
|
|
10480
|
+
vercelConfig,
|
|
10481
|
+
standalone,
|
|
10482
|
+
workPath,
|
|
10483
|
+
service,
|
|
10484
|
+
rootOutputDir,
|
|
10485
|
+
stripServiceRoutePrefix,
|
|
10486
|
+
outputManager
|
|
10487
|
+
});
|
|
10488
|
+
} catch (error) {
|
|
10489
|
+
outputManager.error(`Failed to read routes.json: ${error}`);
|
|
10490
|
+
}
|
|
10491
|
+
}
|
|
10492
|
+
if ((0, import_build_utils.isBackendBuilder)(build) && (0, import_build_utils.isExperimentalBackendsEnabled)() && "routes" in buildResult) {
|
|
10493
|
+
return writeBuildResultV2({
|
|
10494
|
+
repoRootPath,
|
|
10495
|
+
outputDir,
|
|
10496
|
+
buildResult,
|
|
10497
|
+
build,
|
|
10498
|
+
vercelConfig,
|
|
10499
|
+
standalone,
|
|
10500
|
+
workPath,
|
|
10501
|
+
service,
|
|
10502
|
+
rootOutputDir,
|
|
10503
|
+
stripServiceRoutePrefix,
|
|
10504
|
+
outputManager
|
|
10505
|
+
});
|
|
10506
|
+
}
|
|
10507
|
+
}
|
|
10508
|
+
const src = build.src;
|
|
10509
|
+
if (typeof src !== "string") {
|
|
10510
|
+
throw new Error(`Expected "build.src" to be a string`);
|
|
10511
|
+
}
|
|
10512
|
+
const functionConfiguration = await resolveFunctionConfiguration(
|
|
10513
|
+
src,
|
|
10514
|
+
vercelConfig,
|
|
10515
|
+
service
|
|
10516
|
+
);
|
|
10517
|
+
const ext = (0, import_path.extname)(src);
|
|
10518
|
+
const path = service && (0, import_build_utils.isExperimentalServiceV2)(service) ? "index" : service && typeof service.runtime === "string" ? stripDuplicateSlashes((0, import_build_utils.getInternalServiceFunctionPath)(service.name)) : stripDuplicateSlashes(
|
|
10519
|
+
build.config?.zeroConfig ? src.substring(0, src.length - ext.length) : src
|
|
10520
|
+
);
|
|
10521
|
+
if (isContainerImage(output)) {
|
|
10522
|
+
injectServiceEnvVars(
|
|
10523
|
+
output,
|
|
10524
|
+
service && (0, import_build_utils.isExperimentalService)(service) ? service : void 0,
|
|
10525
|
+
stripServiceRoutePrefix
|
|
10526
|
+
);
|
|
10527
|
+
await writeContainerImage(outputDir, output, path, functionConfiguration);
|
|
10528
|
+
} else if (isLambda2(output)) {
|
|
10529
|
+
injectServiceEnvVars(
|
|
10530
|
+
output,
|
|
10531
|
+
service && (0, import_build_utils.isExperimentalService)(service) ? service : void 0,
|
|
10532
|
+
stripServiceRoutePrefix
|
|
10533
|
+
);
|
|
10534
|
+
await writeLambda(
|
|
10535
|
+
repoRootPath,
|
|
10536
|
+
outputDir,
|
|
10537
|
+
output,
|
|
10538
|
+
path,
|
|
10539
|
+
functionConfiguration,
|
|
10540
|
+
void 0,
|
|
10541
|
+
standalone
|
|
10542
|
+
);
|
|
10543
|
+
} else if (isEdgeFunction(output)) {
|
|
10544
|
+
await writeEdgeFunction(
|
|
10545
|
+
repoRootPath,
|
|
10546
|
+
outputDir,
|
|
10547
|
+
output,
|
|
10548
|
+
path,
|
|
10549
|
+
void 0,
|
|
10550
|
+
standalone
|
|
10551
|
+
);
|
|
10552
|
+
} else {
|
|
10553
|
+
throw new Error(
|
|
10554
|
+
`Unsupported output type: "${output.type}" for ${build.src}`
|
|
10555
|
+
);
|
|
10556
|
+
}
|
|
10395
10557
|
}
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
);
|
|
10432
|
-
} else if (isEdgeFunction(output)) {
|
|
10433
|
-
await writeEdgeFunction(
|
|
10434
|
-
repoRootPath,
|
|
10435
|
-
outputDir,
|
|
10436
|
-
output,
|
|
10437
|
-
path2,
|
|
10438
|
-
void 0,
|
|
10439
|
-
standalone
|
|
10440
|
-
);
|
|
10441
|
-
} else {
|
|
10442
|
-
throw new Error(
|
|
10443
|
-
`Unsupported output type: "${output.type}" for ${build.src}`
|
|
10444
|
-
);
|
|
10445
|
-
}
|
|
10446
|
-
}
|
|
10447
|
-
async function writeStaticFile(outputDir, file, path2, overrides, cleanUrls = false) {
|
|
10448
|
-
let fsPath = path2;
|
|
10449
|
-
let override = null;
|
|
10450
|
-
const ext = getFileExtension(file);
|
|
10451
|
-
if (ext && extname(path2) !== ext) {
|
|
10452
|
-
fsPath += ext;
|
|
10453
|
-
if (!override)
|
|
10454
|
-
override = {};
|
|
10455
|
-
override.path = path2;
|
|
10456
|
-
}
|
|
10457
|
-
if (cleanUrls && path2.endsWith(".html")) {
|
|
10458
|
-
if (!override)
|
|
10459
|
-
override = {};
|
|
10460
|
-
override.path = path2.slice(0, -5);
|
|
10461
|
-
}
|
|
10462
|
-
if (file.contentType) {
|
|
10463
|
-
if (!override)
|
|
10464
|
-
override = {};
|
|
10465
|
-
override.contentType = file.contentType;
|
|
10466
|
-
}
|
|
10467
|
-
if (override) {
|
|
10468
|
-
overrides[fsPath] = override;
|
|
10469
|
-
}
|
|
10470
|
-
const dest = join2(outputDir, "static", fsPath);
|
|
10471
|
-
await import_fs_extra2.default.mkdirp(dirname(dest));
|
|
10472
|
-
if ("fsPath" in file) {
|
|
10473
|
-
if (resolve(file.fsPath) === resolve(dest)) {
|
|
10474
|
-
return;
|
|
10558
|
+
async function writeStaticFile(outputDir, file, path, overrides, cleanUrls = false) {
|
|
10559
|
+
let fsPath = path;
|
|
10560
|
+
let override = null;
|
|
10561
|
+
const ext = getFileExtension(file);
|
|
10562
|
+
if (ext && (0, import_path.extname)(path) !== ext) {
|
|
10563
|
+
fsPath += ext;
|
|
10564
|
+
if (!override)
|
|
10565
|
+
override = {};
|
|
10566
|
+
override.path = path;
|
|
10567
|
+
}
|
|
10568
|
+
if (cleanUrls && path.endsWith(".html")) {
|
|
10569
|
+
if (!override)
|
|
10570
|
+
override = {};
|
|
10571
|
+
override.path = path.slice(0, -5);
|
|
10572
|
+
}
|
|
10573
|
+
if (file.contentType) {
|
|
10574
|
+
if (!override)
|
|
10575
|
+
override = {};
|
|
10576
|
+
override.contentType = file.contentType;
|
|
10577
|
+
}
|
|
10578
|
+
if (override) {
|
|
10579
|
+
overrides[fsPath] = override;
|
|
10580
|
+
}
|
|
10581
|
+
const dest = (0, import_path.join)(outputDir, "static", fsPath);
|
|
10582
|
+
await import_fs_extra.default.mkdirp((0, import_path.dirname)(dest));
|
|
10583
|
+
if ("fsPath" in file) {
|
|
10584
|
+
if ((0, import_path.resolve)(file.fsPath) === (0, import_path.resolve)(dest)) {
|
|
10585
|
+
return;
|
|
10586
|
+
}
|
|
10587
|
+
try {
|
|
10588
|
+
return await import_fs_extra.default.link(file.fsPath, dest);
|
|
10589
|
+
} catch (_) {
|
|
10590
|
+
}
|
|
10591
|
+
}
|
|
10592
|
+
await (0, import_build_utils.downloadFile)(file, dest);
|
|
10475
10593
|
}
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10594
|
+
async function writeFunctionSymlink(outputDir, dest, fn, existingFunctions) {
|
|
10595
|
+
const existingPath = existingFunctions.get(fn);
|
|
10596
|
+
if (!existingPath)
|
|
10597
|
+
return false;
|
|
10598
|
+
const destDir = (0, import_path.dirname)(dest);
|
|
10599
|
+
const targetDest = (0, import_path.join)(outputDir, "functions", `${existingPath}.func`);
|
|
10600
|
+
const target = (0, import_path.relative)(destDir, targetDest);
|
|
10601
|
+
await import_fs_extra.default.mkdirp(destDir);
|
|
10602
|
+
await import_fs_extra.default.symlink(target, dest);
|
|
10603
|
+
return true;
|
|
10479
10604
|
}
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
runtime: "container",
|
|
10516
|
-
environment: containerImage.environment ?? {},
|
|
10517
|
-
...containerImage.command ? { command: containerImage.command } : {},
|
|
10518
|
-
...architecture !== void 0 ? { architecture } : {},
|
|
10519
|
-
...memory !== void 0 ? { memory } : {},
|
|
10520
|
-
...maxDuration !== void 0 ? { maxDuration } : {},
|
|
10521
|
-
...maxConcurrency !== void 0 ? { maxConcurrency } : {},
|
|
10522
|
-
...regions !== void 0 ? { regions } : {},
|
|
10523
|
-
...functionFailoverRegions !== void 0 ? { functionFailoverRegions } : {},
|
|
10524
|
-
...experimentalTriggers !== void 0 ? { experimentalTriggers } : {},
|
|
10525
|
-
...supportsCancellation !== void 0 ? { supportsCancellation } : {}
|
|
10526
|
-
},
|
|
10527
|
-
{ spaces: 2 }
|
|
10528
|
-
);
|
|
10529
|
-
}
|
|
10530
|
-
async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path2, existingFunctions, standalone = false) {
|
|
10531
|
-
const dest = join2(outputDir, "functions", `${path2}.func`);
|
|
10532
|
-
if (existingFunctions) {
|
|
10533
|
-
if (await writeFunctionSymlink(
|
|
10534
|
-
outputDir,
|
|
10535
|
-
dest,
|
|
10536
|
-
edgeFunction,
|
|
10537
|
-
existingFunctions
|
|
10538
|
-
)) {
|
|
10539
|
-
return;
|
|
10605
|
+
async function writeContainerImage(outputDir, containerImage, path, functionConfiguration) {
|
|
10606
|
+
const dest = (0, import_path.join)(outputDir, "functions", `${path}.func`);
|
|
10607
|
+
const handler = containerImage.handler;
|
|
10608
|
+
if (typeof handler !== "string" || handler.length === 0) {
|
|
10609
|
+
throw new Error(
|
|
10610
|
+
`Container image output for "${path}" is missing "handler".`
|
|
10611
|
+
);
|
|
10612
|
+
}
|
|
10613
|
+
const architecture = functionConfiguration?.architecture ?? containerImage.architecture;
|
|
10614
|
+
const memory = functionConfiguration?.memory ?? containerImage.memory;
|
|
10615
|
+
const maxDuration = functionConfiguration?.maxDuration ?? containerImage.maxDuration;
|
|
10616
|
+
const maxConcurrency = functionConfiguration?.maxConcurrency ?? containerImage.maxConcurrency;
|
|
10617
|
+
const regions = functionConfiguration?.regions ?? containerImage.regions;
|
|
10618
|
+
const functionFailoverRegions = functionConfiguration?.functionFailoverRegions ?? containerImage.functionFailoverRegions;
|
|
10619
|
+
const experimentalTriggers = functionConfiguration?.experimentalTriggers ?? containerImage.experimentalTriggers;
|
|
10620
|
+
const supportsCancellation = functionConfiguration?.supportsCancellation ?? containerImage.supportsCancellation;
|
|
10621
|
+
await import_fs_extra.default.mkdirp(dest);
|
|
10622
|
+
await import_fs_extra.default.writeJSON(
|
|
10623
|
+
(0, import_path.join)(dest, ".vc-config.json"),
|
|
10624
|
+
{
|
|
10625
|
+
handler,
|
|
10626
|
+
runtime: "container",
|
|
10627
|
+
environment: containerImage.environment ?? {},
|
|
10628
|
+
...containerImage.command ? { command: containerImage.command } : {},
|
|
10629
|
+
...architecture !== void 0 ? { architecture } : {},
|
|
10630
|
+
...memory !== void 0 ? { memory } : {},
|
|
10631
|
+
...maxDuration !== void 0 ? { maxDuration } : {},
|
|
10632
|
+
...maxConcurrency !== void 0 ? { maxConcurrency } : {},
|
|
10633
|
+
...regions !== void 0 ? { regions } : {},
|
|
10634
|
+
...functionFailoverRegions !== void 0 ? { functionFailoverRegions } : {},
|
|
10635
|
+
...experimentalTriggers !== void 0 ? { experimentalTriggers } : {},
|
|
10636
|
+
...supportsCancellation !== void 0 ? { supportsCancellation } : {}
|
|
10637
|
+
},
|
|
10638
|
+
{ spaces: 2 }
|
|
10639
|
+
);
|
|
10540
10640
|
}
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
10570
|
-
|
|
10571
|
-
|
|
10641
|
+
async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path, existingFunctions, standalone = false) {
|
|
10642
|
+
const dest = (0, import_path.join)(outputDir, "functions", `${path}.func`);
|
|
10643
|
+
if (existingFunctions) {
|
|
10644
|
+
if (await writeFunctionSymlink(
|
|
10645
|
+
outputDir,
|
|
10646
|
+
dest,
|
|
10647
|
+
edgeFunction,
|
|
10648
|
+
existingFunctions
|
|
10649
|
+
)) {
|
|
10650
|
+
return;
|
|
10651
|
+
}
|
|
10652
|
+
existingFunctions.set(edgeFunction, path);
|
|
10653
|
+
}
|
|
10654
|
+
await import_fs_extra.default.mkdirp(dest);
|
|
10655
|
+
const ops = [];
|
|
10656
|
+
const { files, filePathMap } = filesWithoutFsRefs2(
|
|
10657
|
+
edgeFunction.files,
|
|
10658
|
+
repoRootPath,
|
|
10659
|
+
standalone
|
|
10660
|
+
);
|
|
10661
|
+
ops.push((0, import_build_utils.download)(files, dest));
|
|
10662
|
+
const config = {
|
|
10663
|
+
runtime: "edge",
|
|
10664
|
+
...edgeFunction,
|
|
10665
|
+
entrypoint: (0, import_build_utils.normalizePath)(edgeFunction.entrypoint),
|
|
10666
|
+
filePathMap,
|
|
10667
|
+
files: void 0,
|
|
10668
|
+
type: void 0
|
|
10669
|
+
};
|
|
10670
|
+
const configPath = (0, import_path.join)(dest, ".vc-config.json");
|
|
10671
|
+
ops.push(
|
|
10672
|
+
import_fs_extra.default.writeJSON(configPath, config, {
|
|
10673
|
+
spaces: 2
|
|
10674
|
+
})
|
|
10675
|
+
);
|
|
10676
|
+
await Promise.all(ops);
|
|
10572
10677
|
}
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10678
|
+
async function writeLambda(repoRootPath, outputDir, lambda, path, functionConfiguration, existingFunctions, standalone = false) {
|
|
10679
|
+
const dest = (0, import_path.join)(outputDir, "functions", `${path}.func`);
|
|
10680
|
+
if (existingFunctions) {
|
|
10681
|
+
if (await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)) {
|
|
10682
|
+
return;
|
|
10683
|
+
}
|
|
10684
|
+
existingFunctions.set(lambda, path);
|
|
10685
|
+
}
|
|
10686
|
+
await import_fs_extra.default.mkdirp(dest);
|
|
10687
|
+
const ops = [];
|
|
10688
|
+
let filePathMap;
|
|
10689
|
+
if (lambda.files) {
|
|
10690
|
+
const f = filesWithoutFsRefs2(lambda.files, repoRootPath, standalone);
|
|
10691
|
+
filePathMap = f.filePathMap;
|
|
10692
|
+
ops.push((0, import_build_utils.download)(f.files, dest));
|
|
10693
|
+
} else if (lambda.zipBuffer) {
|
|
10694
|
+
ops.push((0, import_unzip.unzip)(lambda.zipBuffer, dest));
|
|
10695
|
+
} else {
|
|
10696
|
+
throw new Error('Malformed `Lambda` - no "files" present');
|
|
10697
|
+
}
|
|
10698
|
+
const architecture = functionConfiguration?.architecture ?? lambda.architecture;
|
|
10699
|
+
const memory = functionConfiguration?.memory ?? lambda.memory;
|
|
10700
|
+
const maxDuration = functionConfiguration?.maxDuration ?? lambda.maxDuration;
|
|
10701
|
+
const maxConcurrency = functionConfiguration?.maxConcurrency ?? lambda.maxConcurrency;
|
|
10702
|
+
const regions = functionConfiguration?.regions ?? lambda.regions;
|
|
10703
|
+
const functionFailoverRegions = functionConfiguration?.functionFailoverRegions ?? lambda.functionFailoverRegions;
|
|
10704
|
+
const experimentalTriggers = functionConfiguration?.experimentalTriggers ?? lambda.experimentalTriggers;
|
|
10705
|
+
const supportsCancellation = functionConfiguration?.supportsCancellation ?? lambda.supportsCancellation;
|
|
10706
|
+
const config = {
|
|
10707
|
+
...lambda,
|
|
10708
|
+
handler: (0, import_build_utils.normalizePath)(lambda.handler),
|
|
10709
|
+
architecture,
|
|
10710
|
+
memory,
|
|
10711
|
+
maxDuration,
|
|
10712
|
+
maxConcurrency,
|
|
10713
|
+
regions,
|
|
10714
|
+
functionFailoverRegions,
|
|
10715
|
+
experimentalTriggers,
|
|
10716
|
+
supportsCancellation,
|
|
10717
|
+
filePathMap,
|
|
10718
|
+
type: void 0,
|
|
10719
|
+
files: void 0,
|
|
10720
|
+
zipBuffer: void 0
|
|
10721
|
+
};
|
|
10722
|
+
const configPath = (0, import_path.join)(dest, ".vc-config.json");
|
|
10723
|
+
ops.push(
|
|
10724
|
+
import_fs_extra.default.writeJSON(configPath, config, {
|
|
10725
|
+
spaces: 2
|
|
10726
|
+
})
|
|
10727
|
+
);
|
|
10728
|
+
await Promise.all(ops);
|
|
10729
|
+
for await (const dir of findDirs2(".vercel", dest)) {
|
|
10730
|
+
const absDir = (0, import_path.join)(dest, dir);
|
|
10731
|
+
const entries = await import_fs_extra.default.readdir(absDir);
|
|
10732
|
+
if (entries.includes("cache")) {
|
|
10733
|
+
await Promise.all(
|
|
10734
|
+
entries.filter((e) => e !== "cache").map((entry) => import_fs_extra.default.remove((0, import_path.join)(absDir, entry)))
|
|
10735
|
+
);
|
|
10736
|
+
} else {
|
|
10737
|
+
await import_fs_extra.default.remove(absDir);
|
|
10738
|
+
}
|
|
10739
|
+
}
|
|
10740
|
+
}
|
|
10741
|
+
async function mergeBuilderOutput(outputDir, buildResult, workPath, rootOutputDir, outputManager) {
|
|
10742
|
+
const absOutputDir = (0, import_path.resolve)(outputDir);
|
|
10743
|
+
const absRootOutputDir = (0, import_path.resolve)(rootOutputDir);
|
|
10744
|
+
const { ig } = await (0, import_client.getVercelIgnore)(workPath);
|
|
10745
|
+
const filter = ig.createFilter();
|
|
10746
|
+
if (absOutputDir === buildResult.buildOutputPath) {
|
|
10747
|
+
const staticDir = (0, import_path.join)(outputDir, "static");
|
|
10748
|
+
try {
|
|
10749
|
+
await cleanIgnoredFiles(staticDir, staticDir, filter, outputManager);
|
|
10750
|
+
} catch (err) {
|
|
10751
|
+
if (err.code !== "ENOENT")
|
|
10752
|
+
throw err;
|
|
10753
|
+
}
|
|
10754
|
+
return;
|
|
10755
|
+
}
|
|
10756
|
+
if ((0, import_path.resolve)(buildResult.buildOutputPath) === absRootOutputDir) {
|
|
10757
|
+
await relocateBuildOutputApiEntries(rootOutputDir, outputDir, workPath);
|
|
10758
|
+
return;
|
|
10759
|
+
}
|
|
10760
|
+
const ignoreFilter = (path) => {
|
|
10761
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
10762
|
+
if (normalizedPath.startsWith("static/")) {
|
|
10763
|
+
return filter(normalizedPath.substring("static/".length));
|
|
10764
|
+
}
|
|
10765
|
+
return true;
|
|
10766
|
+
};
|
|
10767
|
+
await (0, import_merge.merge)(buildResult.buildOutputPath, outputDir, ignoreFilter);
|
|
10768
|
+
}
|
|
10769
|
+
async function relocateBuildOutputApiEntries(rootOutputDir, outputDir, workPath) {
|
|
10770
|
+
const { ig } = await (0, import_client.getVercelIgnore)(workPath);
|
|
10771
|
+
const filter = ig.createFilter();
|
|
10772
|
+
await import_fs_extra.default.mkdirp(outputDir);
|
|
10622
10773
|
await Promise.all(
|
|
10623
|
-
|
|
10774
|
+
BUILD_OUTPUT_API_ENTRIES.map(async (entry) => {
|
|
10775
|
+
const src = (0, import_path.join)(rootOutputDir, entry);
|
|
10776
|
+
if (!await import_fs_extra.default.pathExists(src))
|
|
10777
|
+
return;
|
|
10778
|
+
const dest = (0, import_path.join)(outputDir, entry);
|
|
10779
|
+
if (entry === "static") {
|
|
10780
|
+
await (0, import_merge.merge)(src, dest, (path) => filter(path));
|
|
10781
|
+
} else {
|
|
10782
|
+
await (0, import_merge.merge)(src, dest);
|
|
10783
|
+
}
|
|
10784
|
+
})
|
|
10624
10785
|
);
|
|
10625
|
-
} else {
|
|
10626
|
-
await import_fs_extra2.default.remove(absDir);
|
|
10627
10786
|
}
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10787
|
+
async function cleanIgnoredFiles(dir, staticRoot, filter, outputManager) {
|
|
10788
|
+
const entries = await import_fs_extra.default.readdir(dir);
|
|
10789
|
+
await Promise.all(
|
|
10790
|
+
entries.map(async (entry) => {
|
|
10791
|
+
const entryPath = (0, import_path.join)(dir, entry);
|
|
10792
|
+
const stat = await import_fs_extra.default.stat(entryPath);
|
|
10793
|
+
const relativePath = (0, import_path.relative)(staticRoot, entryPath);
|
|
10794
|
+
if (stat.isDirectory()) {
|
|
10795
|
+
await cleanIgnoredFiles(entryPath, staticRoot, filter, outputManager);
|
|
10796
|
+
const remaining = await import_fs_extra.default.readdir(entryPath);
|
|
10797
|
+
if (remaining.length === 0) {
|
|
10798
|
+
await import_fs_extra.default.rmdir(entryPath);
|
|
10799
|
+
}
|
|
10800
|
+
} else if (!filter(relativePath)) {
|
|
10801
|
+
outputManager.debug(`Removing ignored file: ${relativePath}`);
|
|
10802
|
+
await import_fs_extra.default.remove(entryPath);
|
|
10803
|
+
}
|
|
10804
|
+
})
|
|
10805
|
+
);
|
|
10642
10806
|
}
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10807
|
+
function getFileExtension(file) {
|
|
10808
|
+
let ext = "";
|
|
10809
|
+
if (file.type === "FileFsRef") {
|
|
10810
|
+
ext = (0, import_path.extname)(file.fsPath);
|
|
10811
|
+
}
|
|
10812
|
+
if (!ext && file.contentType) {
|
|
10813
|
+
const e = import_mime_types.default.extension(file.contentType);
|
|
10814
|
+
if (e) {
|
|
10815
|
+
ext = `.${e}`;
|
|
10816
|
+
}
|
|
10817
|
+
}
|
|
10818
|
+
return ext;
|
|
10653
10819
|
}
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
BUILD_OUTPUT_API_ENTRIES.map(async (entry) => {
|
|
10664
|
-
const src = join2(rootOutputDir, entry);
|
|
10665
|
-
if (!await import_fs_extra2.default.pathExists(src))
|
|
10666
|
-
return;
|
|
10667
|
-
const dest = join2(outputDir, entry);
|
|
10668
|
-
if (entry === "static") {
|
|
10669
|
-
await merge(src, dest, (path2) => filter(path2));
|
|
10670
|
-
} else {
|
|
10671
|
-
await merge(src, dest);
|
|
10820
|
+
async function* findDirs2(name, dir, root = dir) {
|
|
10821
|
+
let paths;
|
|
10822
|
+
try {
|
|
10823
|
+
paths = await import_fs_extra.default.readdir(dir);
|
|
10824
|
+
} catch (err) {
|
|
10825
|
+
if (err.code !== "ENOENT") {
|
|
10826
|
+
throw err;
|
|
10827
|
+
}
|
|
10828
|
+
paths = [];
|
|
10672
10829
|
}
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10830
|
+
for (const path of paths) {
|
|
10831
|
+
const abs = (0, import_path.join)(dir, path);
|
|
10832
|
+
let stat;
|
|
10833
|
+
try {
|
|
10834
|
+
stat = await import_fs_extra.default.lstat(abs);
|
|
10835
|
+
} catch (err) {
|
|
10836
|
+
if (err.code === "ENOENT")
|
|
10837
|
+
continue;
|
|
10838
|
+
throw err;
|
|
10839
|
+
}
|
|
10840
|
+
if (stat.isDirectory()) {
|
|
10841
|
+
if (path === name) {
|
|
10842
|
+
yield (0, import_path.relative)(root, abs);
|
|
10843
|
+
} else {
|
|
10844
|
+
yield* findDirs2(name, abs, root);
|
|
10845
|
+
}
|
|
10688
10846
|
}
|
|
10689
|
-
} else if (!filter(relativePath)) {
|
|
10690
|
-
output_manager_default.debug(`Removing ignored file: ${relativePath}`);
|
|
10691
|
-
await import_fs_extra2.default.remove(entryPath);
|
|
10692
10847
|
}
|
|
10693
|
-
})
|
|
10694
|
-
);
|
|
10695
|
-
}
|
|
10696
|
-
function getFileExtension(file) {
|
|
10697
|
-
let ext = "";
|
|
10698
|
-
if (file.type === "FileFsRef") {
|
|
10699
|
-
ext = extname(file.fsPath);
|
|
10700
|
-
}
|
|
10701
|
-
if (!ext && file.contentType) {
|
|
10702
|
-
const e = import_mime_types.default.extension(file.contentType);
|
|
10703
|
-
if (e) {
|
|
10704
|
-
ext = `.${e}`;
|
|
10705
10848
|
}
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10849
|
+
function filesWithoutFsRefs2(files, repoRootPath, standalone) {
|
|
10850
|
+
const symlinkDirs = standalone ? Object.entries(files).filter(([, f]) => f.type === "FileFsRef" && (0, import_build_utils.isSymbolicLink)(f.mode)).map(([p]) => `${(0, import_build_utils.normalizePath)(p)}/`) : [];
|
|
10851
|
+
let filePathMap;
|
|
10852
|
+
const out = {};
|
|
10853
|
+
for (const [path, file] of Object.entries(files)) {
|
|
10854
|
+
if (file.type === "FileFsRef") {
|
|
10855
|
+
if (standalone) {
|
|
10856
|
+
const normalized = (0, import_build_utils.normalizePath)(path);
|
|
10857
|
+
if (symlinkDirs.some((prefix) => normalized.startsWith(prefix))) {
|
|
10858
|
+
continue;
|
|
10859
|
+
}
|
|
10860
|
+
out[normalized] = file;
|
|
10861
|
+
} else {
|
|
10862
|
+
if (!filePathMap)
|
|
10863
|
+
filePathMap = {};
|
|
10864
|
+
filePathMap[(0, import_build_utils.normalizePath)(path)] = (0, import_build_utils.normalizePath)(
|
|
10865
|
+
(0, import_path.relative)(repoRootPath, file.fsPath)
|
|
10866
|
+
);
|
|
10867
|
+
}
|
|
10868
|
+
} else {
|
|
10869
|
+
out[path] = file;
|
|
10870
|
+
}
|
|
10871
|
+
}
|
|
10872
|
+
return { files: out, filePathMap };
|
|
10716
10873
|
}
|
|
10717
|
-
paths = [];
|
|
10718
10874
|
}
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10875
|
+
});
|
|
10876
|
+
|
|
10877
|
+
// ../../internals/cli-builder-integration/dist/get-services-builders.js
|
|
10878
|
+
var require_get_services_builders = __commonJS({
|
|
10879
|
+
"../../internals/cli-builder-integration/dist/get-services-builders.js"(exports, module) {
|
|
10880
|
+
"use strict";
|
|
10881
|
+
var __defProp = Object.defineProperty;
|
|
10882
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10883
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10884
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10885
|
+
var __export = (target, all) => {
|
|
10886
|
+
for (var name in all)
|
|
10887
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10888
|
+
};
|
|
10889
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10890
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10891
|
+
for (let key of __getOwnPropNames(from))
|
|
10892
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10893
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10894
|
+
}
|
|
10895
|
+
return to;
|
|
10896
|
+
};
|
|
10897
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10898
|
+
var get_services_builders_exports = {};
|
|
10899
|
+
__export(get_services_builders_exports, {
|
|
10900
|
+
getServicesBuilders: () => getServicesBuilders,
|
|
10901
|
+
warnIgnoredDirectories: () => warnIgnoredDirectories
|
|
10902
|
+
});
|
|
10903
|
+
module.exports = __toCommonJS(get_services_builders_exports);
|
|
10904
|
+
var import_fs_detectors = require_dist3();
|
|
10905
|
+
var import_service_topology = require_dist4();
|
|
10906
|
+
function isExperimentalServicesAutoDetectionEnabled() {
|
|
10907
|
+
const env = process.env.VERCEL_USE_EXPERIMENTAL_SERVICES;
|
|
10908
|
+
return env === "1" || env?.toLowerCase() === "true";
|
|
10728
10909
|
}
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10910
|
+
async function getServicesBuilders(options) {
|
|
10911
|
+
const {
|
|
10912
|
+
workPath,
|
|
10913
|
+
configuredServices,
|
|
10914
|
+
configuredServicesType,
|
|
10915
|
+
projectFramework
|
|
10916
|
+
} = options;
|
|
10917
|
+
const hasServiceDefinitions = configuredServices != null && Object.keys(configuredServices).length > 0;
|
|
10918
|
+
if (projectFramework === "services" && !hasServiceDefinitions && !isExperimentalServicesAutoDetectionEnabled()) {
|
|
10919
|
+
return {
|
|
10920
|
+
builders: null,
|
|
10921
|
+
errors: [
|
|
10922
|
+
{
|
|
10923
|
+
code: "MISSING_SERVICES",
|
|
10924
|
+
message: 'Project framework is set to "services", but no services are declared. Add `services` to vercel.json with at least one service, or change the project framework setting.'
|
|
10925
|
+
}
|
|
10926
|
+
],
|
|
10927
|
+
warnings: [],
|
|
10928
|
+
hostRewriteRoutes: null,
|
|
10929
|
+
defaultRoutes: null,
|
|
10930
|
+
fallbackRoutes: null,
|
|
10931
|
+
redirectRoutes: null,
|
|
10932
|
+
rewriteRoutes: null,
|
|
10933
|
+
errorRoutes: null
|
|
10934
|
+
};
|
|
10734
10935
|
}
|
|
10936
|
+
if (!workPath) {
|
|
10937
|
+
return {
|
|
10938
|
+
builders: null,
|
|
10939
|
+
errors: [
|
|
10940
|
+
{
|
|
10941
|
+
code: "MISSING_WORK_PATH",
|
|
10942
|
+
message: "workPath is required for services detection."
|
|
10943
|
+
}
|
|
10944
|
+
],
|
|
10945
|
+
warnings: [],
|
|
10946
|
+
hostRewriteRoutes: null,
|
|
10947
|
+
defaultRoutes: null,
|
|
10948
|
+
fallbackRoutes: null,
|
|
10949
|
+
redirectRoutes: null,
|
|
10950
|
+
rewriteRoutes: null,
|
|
10951
|
+
errorRoutes: null
|
|
10952
|
+
};
|
|
10953
|
+
}
|
|
10954
|
+
const fs = new import_fs_detectors.LocalFileSystemDetector(workPath);
|
|
10955
|
+
const result = await (0, import_service_topology.detectServices)({
|
|
10956
|
+
fs,
|
|
10957
|
+
configuredServices,
|
|
10958
|
+
configuredServicesType
|
|
10959
|
+
});
|
|
10960
|
+
const warningResponses = result.warnings.map((w) => ({
|
|
10961
|
+
code: w.code,
|
|
10962
|
+
message: w.message
|
|
10963
|
+
}));
|
|
10964
|
+
if (result.errors.length > 0) {
|
|
10965
|
+
return {
|
|
10966
|
+
builders: null,
|
|
10967
|
+
errors: result.errors.map((e) => ({
|
|
10968
|
+
code: e.code,
|
|
10969
|
+
message: e.message
|
|
10970
|
+
})),
|
|
10971
|
+
warnings: warningResponses,
|
|
10972
|
+
hostRewriteRoutes: null,
|
|
10973
|
+
defaultRoutes: null,
|
|
10974
|
+
fallbackRoutes: null,
|
|
10975
|
+
redirectRoutes: null,
|
|
10976
|
+
rewriteRoutes: null,
|
|
10977
|
+
errorRoutes: null
|
|
10978
|
+
};
|
|
10979
|
+
}
|
|
10980
|
+
if (result.services.length === 0) {
|
|
10981
|
+
return {
|
|
10982
|
+
builders: null,
|
|
10983
|
+
errors: [
|
|
10984
|
+
{
|
|
10985
|
+
code: "NO_SERVICES_CONFIGURED",
|
|
10986
|
+
message: "No services configured. Add `services` to vercel.json."
|
|
10987
|
+
}
|
|
10988
|
+
],
|
|
10989
|
+
warnings: warningResponses,
|
|
10990
|
+
hostRewriteRoutes: null,
|
|
10991
|
+
defaultRoutes: null,
|
|
10992
|
+
fallbackRoutes: null,
|
|
10993
|
+
redirectRoutes: null,
|
|
10994
|
+
rewriteRoutes: null,
|
|
10995
|
+
errorRoutes: null
|
|
10996
|
+
};
|
|
10997
|
+
}
|
|
10998
|
+
const builders = result.services.map((service) => service.builder);
|
|
10999
|
+
return {
|
|
11000
|
+
builders: builders.length > 0 ? builders : null,
|
|
11001
|
+
errors: null,
|
|
11002
|
+
warnings: warningResponses,
|
|
11003
|
+
hostRewriteRoutes: result.routes.hostRewrites.length > 0 ? result.routes.hostRewrites : null,
|
|
11004
|
+
defaultRoutes: result.routes.defaults.length > 0 ? result.routes.defaults : null,
|
|
11005
|
+
fallbackRoutes: result.routes.fallbacks.length > 0 ? result.routes.fallbacks : null,
|
|
11006
|
+
redirectRoutes: [],
|
|
11007
|
+
rewriteRoutes: result.routes.rewrites.length > 0 || result.routes.workers.length > 0 || result.routes.crons.length > 0 ? [
|
|
11008
|
+
...result.routes.rewrites,
|
|
11009
|
+
...result.routes.workers,
|
|
11010
|
+
...result.routes.crons
|
|
11011
|
+
] : null,
|
|
11012
|
+
errorRoutes: [],
|
|
11013
|
+
serviceRewrites: result.rewrites.length > 0 ? result.rewrites : void 0,
|
|
11014
|
+
experimentalServicesV2: result.experimentalServicesV2,
|
|
11015
|
+
services: result.services,
|
|
11016
|
+
useImplicitEnvInjection: result.useImplicitEnvInjection
|
|
11017
|
+
};
|
|
10735
11018
|
}
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
11019
|
+
function warnIgnoredDirectories(files, configuredServices) {
|
|
11020
|
+
const warnings = [];
|
|
11021
|
+
if (files.some((f) => f.startsWith("api/"))) {
|
|
11022
|
+
const serviceCoversApi = Object.values(configuredServices).some((service) => {
|
|
11023
|
+
const root = service.root ?? ".";
|
|
11024
|
+
const entrypoint = service.entrypoint ?? "";
|
|
11025
|
+
return root === "api" || root.startsWith("api/") || root === "." && entrypoint.startsWith("api/");
|
|
11026
|
+
});
|
|
11027
|
+
if (!serviceCoversApi) {
|
|
11028
|
+
warnings.push({
|
|
11029
|
+
code: "api_dir_ignored",
|
|
11030
|
+
message: "The `api/` directory will not be built because services are configured. To serve these files, declare them as a service in your `vercel.json`."
|
|
11031
|
+
});
|
|
10748
11032
|
}
|
|
10749
|
-
out[normalized] = file;
|
|
10750
|
-
} else {
|
|
10751
|
-
if (!filePathMap)
|
|
10752
|
-
filePathMap = {};
|
|
10753
|
-
filePathMap[normalizePath(path2)] = normalizePath(
|
|
10754
|
-
relative2(repoRootPath, file.fsPath)
|
|
10755
|
-
);
|
|
10756
11033
|
}
|
|
10757
|
-
|
|
10758
|
-
out[path2] = file;
|
|
11034
|
+
return warnings;
|
|
10759
11035
|
}
|
|
10760
11036
|
}
|
|
10761
|
-
|
|
10762
|
-
}
|
|
10763
|
-
|
|
10764
|
-
// src/util/get-files.ts
|
|
10765
|
-
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
10766
|
-
var import_client2 = __toESM(require_dist2(), 1);
|
|
10767
|
-
import { resolve as resolve2 } from "path";
|
|
11037
|
+
});
|
|
10768
11038
|
|
|
10769
|
-
//
|
|
10770
|
-
var
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
11039
|
+
// ../../internals/cli-builder-integration/dist/detect-builders-with-services.js
|
|
11040
|
+
var require_detect_builders_with_services = __commonJS({
|
|
11041
|
+
"../../internals/cli-builder-integration/dist/detect-builders-with-services.js"(exports, module) {
|
|
11042
|
+
"use strict";
|
|
11043
|
+
var __defProp = Object.defineProperty;
|
|
11044
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11045
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11046
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11047
|
+
var __export = (target, all) => {
|
|
11048
|
+
for (var name in all)
|
|
11049
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11050
|
+
};
|
|
11051
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11052
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11053
|
+
for (let key of __getOwnPropNames(from))
|
|
11054
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11055
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11056
|
+
}
|
|
11057
|
+
return to;
|
|
11058
|
+
};
|
|
11059
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
11060
|
+
var detect_builders_with_services_exports = {};
|
|
11061
|
+
__export(detect_builders_with_services_exports, {
|
|
11062
|
+
detectBuildersWithServices: () => detectBuildersWithServices
|
|
11063
|
+
});
|
|
11064
|
+
module.exports = __toCommonJS(detect_builders_with_services_exports);
|
|
11065
|
+
var import_fs_detectors = require_dist3();
|
|
11066
|
+
var import_get_services_builders = require_get_services_builders();
|
|
11067
|
+
async function detectBuildersWithServices(files, pkg, options = {}) {
|
|
11068
|
+
const {
|
|
11069
|
+
experimentalServices: experimentalServicesV1,
|
|
11070
|
+
services,
|
|
11071
|
+
experimentalServicesV2,
|
|
11072
|
+
projectSettings = {}
|
|
11073
|
+
} = options;
|
|
11074
|
+
if (services != null && experimentalServicesV2 != null) {
|
|
11075
|
+
return {
|
|
11076
|
+
builders: null,
|
|
11077
|
+
errors: [
|
|
11078
|
+
{
|
|
11079
|
+
code: "SERVICES_AND_EXPERIMENTAL_SERVICES_V2",
|
|
11080
|
+
message: "The `services` option cannot be used in conjunction with its deprecated alias `experimentalServicesV2`. Please use only `services`."
|
|
11081
|
+
}
|
|
11082
|
+
],
|
|
11083
|
+
warnings: [],
|
|
11084
|
+
defaultRoutes: null,
|
|
11085
|
+
redirectRoutes: null,
|
|
11086
|
+
rewriteRoutes: null,
|
|
11087
|
+
errorRoutes: null
|
|
11088
|
+
};
|
|
11089
|
+
}
|
|
11090
|
+
const proxyError = (0, import_fs_detectors.validateProxy)(options, files, projectSettings.framework);
|
|
11091
|
+
if (proxyError) {
|
|
11092
|
+
return {
|
|
11093
|
+
builders: null,
|
|
11094
|
+
errors: [proxyError],
|
|
11095
|
+
warnings: [],
|
|
11096
|
+
defaultRoutes: null,
|
|
11097
|
+
redirectRoutes: null,
|
|
11098
|
+
rewriteRoutes: null,
|
|
11099
|
+
errorRoutes: null
|
|
11100
|
+
};
|
|
11101
|
+
}
|
|
11102
|
+
const servicesConfig = services ?? experimentalServicesV2;
|
|
11103
|
+
const configuredServices = servicesConfig ?? experimentalServicesV1;
|
|
11104
|
+
const configuredServicesType = servicesConfig ? services ? "services" : "experimentalServicesV2" : "experimentalServices";
|
|
11105
|
+
const hasServicesConfig = configuredServices != null && typeof configuredServices === "object";
|
|
11106
|
+
if (!hasServicesConfig && projectSettings.framework !== "services") {
|
|
11107
|
+
return (0, import_fs_detectors.detectBuilders)(files, pkg, options);
|
|
11108
|
+
}
|
|
11109
|
+
const result = await (0, import_get_services_builders.getServicesBuilders)({
|
|
11110
|
+
workPath: options.workPath,
|
|
11111
|
+
configuredServices,
|
|
11112
|
+
configuredServicesType,
|
|
11113
|
+
projectFramework: projectSettings.framework
|
|
11114
|
+
});
|
|
11115
|
+
if (configuredServices != null) {
|
|
11116
|
+
result.warnings.push(...(0, import_get_services_builders.warnIgnoredDirectories)(files, configuredServices));
|
|
11117
|
+
}
|
|
11118
|
+
if (!result.errors && options.proxy) {
|
|
11119
|
+
result.builders = [
|
|
11120
|
+
(0, import_fs_detectors.getProxyBuilder)(options.proxy, options.tag, options.functions),
|
|
11121
|
+
...result.builders ?? []
|
|
11122
|
+
];
|
|
11123
|
+
}
|
|
11124
|
+
return result;
|
|
11125
|
+
}
|
|
10777
11126
|
}
|
|
10778
|
-
|
|
10779
|
-
};
|
|
11127
|
+
});
|
|
10780
11128
|
|
|
10781
|
-
//
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
11129
|
+
// ../../internals/cli-builder-integration/dist/service-schedules.js
|
|
11130
|
+
var require_service_schedules = __commonJS({
|
|
11131
|
+
"../../internals/cli-builder-integration/dist/service-schedules.js"(exports, module) {
|
|
11132
|
+
"use strict";
|
|
11133
|
+
var __defProp = Object.defineProperty;
|
|
11134
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11135
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11136
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11137
|
+
var __export = (target, all) => {
|
|
11138
|
+
for (var name in all)
|
|
11139
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11140
|
+
};
|
|
11141
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11142
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11143
|
+
for (let key of __getOwnPropNames(from))
|
|
11144
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11145
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11146
|
+
}
|
|
11147
|
+
return to;
|
|
11148
|
+
};
|
|
11149
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
11150
|
+
var service_schedules_exports = {};
|
|
11151
|
+
__export(service_schedules_exports, {
|
|
11152
|
+
getStaticServiceSchedules: () => getStaticServiceSchedules
|
|
11153
|
+
});
|
|
11154
|
+
module.exports = __toCommonJS(service_schedules_exports);
|
|
11155
|
+
var DYNAMIC_SCHEDULE = "<dynamic>";
|
|
11156
|
+
function getStaticServiceSchedules(schedule) {
|
|
11157
|
+
if (!schedule || schedule === DYNAMIC_SCHEDULE) {
|
|
11158
|
+
return [];
|
|
11159
|
+
}
|
|
11160
|
+
return Array.isArray(schedule) ? schedule.filter((item) => item !== DYNAMIC_SCHEDULE) : [schedule];
|
|
10788
11161
|
}
|
|
10789
11162
|
}
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
}
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
11163
|
+
});
|
|
11164
|
+
|
|
11165
|
+
// ../../internals/cli-builder-integration/dist/get-files.js
|
|
11166
|
+
var require_get_files = __commonJS({
|
|
11167
|
+
"../../internals/cli-builder-integration/dist/get-files.js"(exports, module) {
|
|
11168
|
+
"use strict";
|
|
11169
|
+
var __create = Object.create;
|
|
11170
|
+
var __defProp = Object.defineProperty;
|
|
11171
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11172
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11173
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11174
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11175
|
+
var __export = (target, all) => {
|
|
11176
|
+
for (var name in all)
|
|
11177
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11178
|
+
};
|
|
11179
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11180
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11181
|
+
for (let key of __getOwnPropNames(from))
|
|
11182
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11183
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11184
|
+
}
|
|
11185
|
+
return to;
|
|
11186
|
+
};
|
|
11187
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
11188
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
11189
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
11190
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
11191
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
11192
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
11193
|
+
mod
|
|
11194
|
+
));
|
|
11195
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
11196
|
+
var get_files_exports = {};
|
|
11197
|
+
__export(get_files_exports, {
|
|
11198
|
+
staticFiles: () => staticFiles
|
|
11199
|
+
});
|
|
11200
|
+
module.exports = __toCommonJS(get_files_exports);
|
|
11201
|
+
var import_fs_extra = __toESM2(require_lib());
|
|
11202
|
+
var import_path = __require("path");
|
|
11203
|
+
var import_client = require_dist2();
|
|
11204
|
+
function flatten(arr, res = []) {
|
|
11205
|
+
for (const cur of arr) {
|
|
11206
|
+
if (Array.isArray(cur)) {
|
|
11207
|
+
flatten(cur, res);
|
|
11208
|
+
} else {
|
|
11209
|
+
res.push(cur);
|
|
11210
|
+
}
|
|
11211
|
+
}
|
|
11212
|
+
return res;
|
|
10832
11213
|
}
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
path2 = `${file}.js`;
|
|
10837
|
-
try {
|
|
10838
|
-
s = await import_fs_extra3.default.stat(path2);
|
|
10839
|
-
} catch (_e2) {
|
|
10840
|
-
debug(`Ignoring invalid file ${file}`);
|
|
10841
|
-
return null;
|
|
11214
|
+
var asAbsolute = function(path, parent) {
|
|
11215
|
+
if (path[0] === "/") {
|
|
11216
|
+
return path;
|
|
10842
11217
|
}
|
|
11218
|
+
return (0, import_path.resolve)(parent, path);
|
|
11219
|
+
};
|
|
11220
|
+
async function staticFiles(path, { src }, output) {
|
|
11221
|
+
const { debug, time } = output;
|
|
11222
|
+
let files = [];
|
|
11223
|
+
const source = src || ".";
|
|
11224
|
+
const search = (0, import_path.resolve)(path, source);
|
|
11225
|
+
const { ig } = await (0, import_client.getVercelIgnore)(path);
|
|
11226
|
+
const filter = ig.createFilter();
|
|
11227
|
+
const prefixLength = path.length + 1;
|
|
11228
|
+
const accepts = (file) => {
|
|
11229
|
+
const relativePath = file.slice(prefixLength);
|
|
11230
|
+
if (relativePath === "") {
|
|
11231
|
+
return true;
|
|
11232
|
+
}
|
|
11233
|
+
const accepted = filter(relativePath);
|
|
11234
|
+
if (!accepted) {
|
|
11235
|
+
debug(`Ignoring ${file}`);
|
|
11236
|
+
}
|
|
11237
|
+
return accepted;
|
|
11238
|
+
};
|
|
11239
|
+
files = await time(
|
|
11240
|
+
`Locating files ${path}`,
|
|
11241
|
+
explode([search], {
|
|
11242
|
+
accepts,
|
|
11243
|
+
output
|
|
11244
|
+
})
|
|
11245
|
+
);
|
|
11246
|
+
return Array.from(new Set(files));
|
|
10843
11247
|
}
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
10851
|
-
debug(`Ignoring directory that has since been removed ${file}`);
|
|
11248
|
+
async function explode(paths, { accepts, output }) {
|
|
11249
|
+
const { debug } = output;
|
|
11250
|
+
const list = async (file) => {
|
|
11251
|
+
let path = file;
|
|
11252
|
+
let s;
|
|
11253
|
+
if (!accepts(file)) {
|
|
10852
11254
|
return null;
|
|
10853
11255
|
}
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
11256
|
+
try {
|
|
11257
|
+
s = await import_fs_extra.default.stat(path);
|
|
11258
|
+
} catch (_e) {
|
|
11259
|
+
path = `${file}.js`;
|
|
11260
|
+
try {
|
|
11261
|
+
s = await import_fs_extra.default.stat(path);
|
|
11262
|
+
} catch (_e2) {
|
|
11263
|
+
debug(`Ignoring invalid file ${file}`);
|
|
11264
|
+
return null;
|
|
11265
|
+
}
|
|
11266
|
+
}
|
|
11267
|
+
if (s.isDirectory()) {
|
|
11268
|
+
let all;
|
|
11269
|
+
try {
|
|
11270
|
+
all = await import_fs_extra.default.readdir(file);
|
|
11271
|
+
} catch (err) {
|
|
11272
|
+
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
11273
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
11274
|
+
debug(`Ignoring directory that has since been removed ${file}`);
|
|
11275
|
+
return null;
|
|
11276
|
+
}
|
|
11277
|
+
throw err;
|
|
11278
|
+
}
|
|
11279
|
+
return many(all.map((subdir) => asAbsolute(subdir, file)));
|
|
11280
|
+
}
|
|
11281
|
+
if (!s.isFile()) {
|
|
11282
|
+
debug(`Ignoring special file ${file}`);
|
|
11283
|
+
return null;
|
|
11284
|
+
}
|
|
11285
|
+
return path;
|
|
11286
|
+
};
|
|
11287
|
+
const many = (all) => Promise.all(all.map((file) => list(file)));
|
|
11288
|
+
const arrayOfArrays = await many(paths);
|
|
11289
|
+
return flatten(arrayOfArrays).filter(notNull);
|
|
10858
11290
|
}
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
return null;
|
|
11291
|
+
function notNull(value) {
|
|
11292
|
+
return value !== null;
|
|
10862
11293
|
}
|
|
10863
|
-
return path2;
|
|
10864
|
-
};
|
|
10865
|
-
const many = (all) => Promise.all(all.map((file) => list(file)));
|
|
10866
|
-
const arrayOfArrays = await many(paths);
|
|
10867
|
-
return flatten(arrayOfArrays).filter(notNull);
|
|
10868
|
-
}
|
|
10869
|
-
function notNull(value) {
|
|
10870
|
-
return value !== null;
|
|
10871
|
-
}
|
|
10872
|
-
|
|
10873
|
-
// src/util/service-schedules.ts
|
|
10874
|
-
var DYNAMIC_SCHEDULE = "<dynamic>";
|
|
10875
|
-
function getStaticServiceSchedules(schedule) {
|
|
10876
|
-
if (!schedule || schedule === DYNAMIC_SCHEDULE) {
|
|
10877
|
-
return [];
|
|
10878
11294
|
}
|
|
10879
|
-
|
|
10880
|
-
|
|
11295
|
+
});
|
|
11296
|
+
|
|
11297
|
+
// src/builders/write-build-result.ts
|
|
11298
|
+
var import_write_build_result = __toESM(require_write_build_result(), 1);
|
|
11299
|
+
var {
|
|
11300
|
+
filesWithoutFsRefs,
|
|
11301
|
+
relocateRootBuildOutputToService,
|
|
11302
|
+
writeBuildResult
|
|
11303
|
+
} = (0, import_write_build_result.createWriteBuildResult)(output_manager_default);
|
|
10881
11304
|
|
|
10882
11305
|
export {
|
|
11306
|
+
require_detect_builders_with_services,
|
|
10883
11307
|
require_mime_types,
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
11308
|
+
require_write_build_result,
|
|
11309
|
+
require_service_schedules,
|
|
11310
|
+
require_get_files,
|
|
11311
|
+
import_write_build_result,
|
|
11312
|
+
writeBuildResult
|
|
10889
11313
|
};
|
|
10890
11314
|
/*! Bundled license information:
|
|
10891
11315
|
|