vercel 59.1.4 → 59.3.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-4L46WVRT.js} +5 -5
- package/dist/chunks/{add-CUGPQYFW.js → add-BBWVXE2R.js} +5 -5
- package/dist/chunks/{add-PRG4KKYH.js → add-KOD24LEM.js} +8 -8
- package/dist/chunks/{build-T22GMLY6.js → build-2SX3XIRI.js} +5 -5
- package/dist/chunks/{chunk-XZLI27ES.js → chunk-6GWLC2IP.js} +3 -3
- package/dist/chunks/{chunk-SOKQBFF7.js → chunk-7GE2K2WR.js} +239 -41
- package/dist/chunks/{chunk-7NQLRE5V.js → chunk-7PEQVFHI.js} +1 -1
- package/dist/chunks/{chunk-QD5NX7RG.js → chunk-AAMJ4ZU4.js} +1 -1
- package/dist/chunks/{chunk-M34ZRNDQ.js → chunk-ANIKVXGZ.js} +2 -2
- package/dist/chunks/{chunk-DEB45ND4.js → chunk-CURHMEJX.js} +2 -2
- 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-SQGMTRZD.js → chunk-D35JUCTC.js} +641 -461
- package/dist/chunks/{chunk-5DVMXOFT.js → chunk-DAA5RXUK.js} +32 -30
- package/dist/chunks/{chunk-CSJBZKC5.js → chunk-EG5BSAXD.js} +69 -57
- package/dist/chunks/{chunk-BCZFZETZ.js → chunk-G55RLNFE.js} +5 -5
- package/dist/chunks/{chunk-TJLBCLEX.js → chunk-J5ZEHLFM.js} +1 -0
- package/dist/chunks/{chunk-QCVKGY2A.js → chunk-KAYSW4CJ.js} +35 -12
- package/dist/chunks/{chunk-DOMLWKKZ.js → chunk-KBUCAAG6.js} +17 -20
- package/dist/chunks/{chunk-VE545BR3.js → chunk-KDL2L4KL.js} +42 -39
- package/dist/chunks/{chunk-P65EEFTR.js → chunk-KQRVZWJU.js} +1 -0
- package/dist/chunks/{chunk-JYEO6OJS.js → chunk-MWYQ24FO.js} +4 -3
- package/dist/chunks/{chunk-4JKZ7SRX.js → chunk-NN2W7WFC.js} +4 -4
- package/dist/chunks/{chunk-KTLFN5FV.js → chunk-OISTYQGR.js} +1 -1
- package/dist/chunks/{chunk-ZUVJISHS.js → chunk-P3BFTZXW.js} +2 -2
- package/dist/chunks/{chunk-3BU2UCGV.js → chunk-PIMIKY4X.js} +1 -1
- package/dist/chunks/{chunk-57G6HBJ4.js → chunk-Q6QCRFTC.js} +3 -3
- package/dist/chunks/{chunk-IKKUCZE7.js → chunk-QKO2DGWR.js} +3 -3
- package/dist/chunks/{chunk-QQ6PH4RY.js → chunk-STPH4Y62.js} +10 -0
- package/dist/chunks/{chunk-P2QZZ6MR.js → chunk-TVXCXIRO.js} +1 -1
- package/dist/chunks/{chunk-43DD2KNM.js → chunk-VTP6WIQA.js} +1114 -943
- package/dist/chunks/{chunk-DOAYLTBJ.js → chunk-WNS53IOA.js} +1 -1
- package/dist/chunks/{chunk-DAWJOQF6.js → chunk-WODLA275.js} +2 -2
- package/dist/chunks/{chunk-SJQEGGH7.js → chunk-XI6NJLI4.js} +1 -1
- package/dist/chunks/{chunk-LNVZ3T7X.js → chunk-YPPWGI3F.js} +5 -5
- package/dist/chunks/{chunk-TM3F7PLR.js → chunk-Z2G6SO5B.js} +3 -3
- package/dist/chunks/{chunk-4HI7G6KG.js → chunk-ZHRZMQGN.js} +1 -1
- package/dist/chunks/{clear-Z4IKUIN7.js → clear-2DMDKLWZ.js} +5 -5
- package/dist/chunks/{compile-vercel-config-PSVXFAZW.js → compile-vercel-config-7HZ4UN6R.js} +3 -3
- package/dist/chunks/{config-M5GMZ2X5.js → config-CVZ25C54.js} +5 -5
- package/dist/chunks/{delete-P4XIBY7T.js → delete-4LQKP5DG.js} +5 -5
- package/dist/chunks/{delete-5GRRDJSF.js → delete-QNAGJM6C.js} +4 -4
- package/dist/chunks/{disable-NT5NYVO7.js → disable-2RBFIZUB.js} +4 -4
- package/dist/chunks/{discard-TBNIEAJZ.js → discard-UCOSPSUU.js} +4 -4
- package/dist/chunks/{edit-DJ6MT6HA.js → edit-JX73BG3V.js} +6 -6
- package/dist/chunks/{edit-UF3D2CCH.js → edit-QSAO74S4.js} +6 -6
- package/dist/chunks/{enable-JTQBQMBO.js → enable-NDSB4T26.js} +4 -4
- package/dist/chunks/{export-OKMRGRVM.js → export-DB6BIYQJ.js} +4 -4
- package/dist/chunks/{image-ARUJH4H5.js → image-MKB6II6L.js} +4 -4
- package/dist/chunks/{import-builders-3NTMZM64.js → import-builders-FIQ7QTVG.js} +10 -9
- package/dist/chunks/{inspect-CHFKZKKP.js → inspect-IYRKEWTM.js} +5 -5
- package/dist/chunks/{inspect-PTXIBSYW.js → inspect-NY6QRX5W.js} +5 -5
- package/dist/chunks/{inspect-RI4K77NG.js → inspect-QWTWAYLS.js} +6 -6
- package/dist/chunks/{inspect-UXP2HDES.js → inspect-REJXLWLL.js} +5 -5
- package/dist/chunks/{inspect-5NETOGAI.js → inspect-XS2TC7TC.js} +5 -5
- package/dist/chunks/{list-DYCZA2VX.js → list-CDCITV4K.js} +4 -4
- package/dist/chunks/{list-G7LGVDAJ.js → list-PXKVKXHG.js} +6 -6
- package/dist/chunks/{list-ADI55WKW.js → list-VQHBVY3Q.js} +5 -5
- package/dist/chunks/{login-YCSIQG6B.js → login-PE4JK7A2.js} +5 -5
- package/dist/chunks/{ls-VIOMDUGW.js → ls-3GRHYFDM.js} +5 -5
- package/dist/chunks/{ls-PQFDGOJL.js → ls-DL2POAY2.js} +6 -6
- package/dist/chunks/{ls-EOMIQLRH.js → ls-S67TNMEG.js} +5 -5
- package/dist/chunks/{ls-2TKUIUK4.js → ls-SKOQOPK4.js} +5 -5
- package/dist/chunks/{ls-RZVTIP5U.js → ls-YHS5IEBJ.js} +5 -5
- package/dist/chunks/{open-JYPWOXQD.js → open-DUN3BTDH.js} +5 -5
- package/dist/chunks/{permissions-SGJWGEVD.js → permissions-VLIZYINB.js} +5 -5
- package/dist/chunks/{publish-ZUQHJAXL.js → publish-36BIJPLN.js} +4 -4
- package/dist/chunks/{push-XMVKG5A5.js → push-5NTQV3EC.js} +5 -5
- package/dist/chunks/{query-ZLJZEGZB.js → query-ONR2W7HS.js} +218 -81
- package/dist/chunks/{reorder-NVHDWMRU.js → reorder-YKAT4XG3.js} +4 -4
- package/dist/chunks/{reply-PUUPUQ3V.js → reply-DH4ZPEXT.js} +6 -6
- package/dist/chunks/{resolve-5U2LJVE6.js → resolve-446IVH6V.js} +5 -5
- package/dist/chunks/{restore-OXIUY2UI.js → restore-HA6TSOOE.js} +4 -4
- package/dist/chunks/{rm-BZNKJRXU.js → rm-BCPJUK2C.js} +5 -5
- package/dist/chunks/{rm-3IOCBNPE.js → rm-COV73VE4.js} +6 -6
- package/dist/chunks/{rm-Z2KYJ7XT.js → rm-EG35766L.js} +5 -5
- package/dist/chunks/{rm-OUI4ZB5R.js → rm-IKYJI7MP.js} +5 -5
- package/dist/chunks/{routes-JP2CNQ5J.js → routes-SZI2G4SE.js} +2 -2
- package/dist/chunks/{rule-inspect-ZBJJCDQV.js → rule-inspect-FQ2635LY.js} +6 -6
- package/dist/chunks/{rules-HEGAXXUN.js → rules-PBOQISWV.js} +8 -8
- package/dist/chunks/{schema-7GVL3BNP.js → schema-4CDJVH7T.js} +22 -12
- package/dist/chunks/{schema-ZYIJYA2E.js → schema-LUVFYPWN.js} +1 -1
- package/dist/chunks/{tags-3SCWCMNQ.js → tags-HNOL4JXL.js} +3 -3
- package/dist/chunks/{update-YR2GCCJN.js → update-ZIGVLUYG.js} +8 -8
- package/dist/commands/build/index.js +3095 -2519
- package/dist/commands/deploy/index.js +12 -12
- package/dist/commands/dev/index.js +22 -15
- package/dist/commands/env/index.js +8 -8
- package/dist/commands/link/index.js +7 -7
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +2548 -1829
- 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 +42 -40
|
@@ -5,11 +5,10 @@ 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
9
|
require_dist3,
|
|
11
10
|
require_lib
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KDL2L4KL.js";
|
|
13
12
|
import {
|
|
14
13
|
output_manager_default,
|
|
15
14
|
require_dist
|
|
@@ -7872,7 +7871,7 @@ var require_mime_types = __commonJS({
|
|
|
7872
7871
|
"../../node_modules/.pnpm/mime-types@2.1.24/node_modules/mime-types/index.js"(exports) {
|
|
7873
7872
|
"use strict";
|
|
7874
7873
|
var db = require_mime_db();
|
|
7875
|
-
var
|
|
7874
|
+
var extname = __require("path").extname;
|
|
7876
7875
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
7877
7876
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
7878
7877
|
exports.charset = charset;
|
|
@@ -7923,11 +7922,11 @@ var require_mime_types = __commonJS({
|
|
|
7923
7922
|
}
|
|
7924
7923
|
return exts[0];
|
|
7925
7924
|
}
|
|
7926
|
-
function lookup(
|
|
7927
|
-
if (!
|
|
7925
|
+
function lookup(path) {
|
|
7926
|
+
if (!path || typeof path !== "string") {
|
|
7928
7927
|
return false;
|
|
7929
7928
|
}
|
|
7930
|
-
var extension2 =
|
|
7929
|
+
var extension2 = extname("x." + path).toLowerCase().substr(1);
|
|
7931
7930
|
if (!extension2) {
|
|
7932
7931
|
return false;
|
|
7933
7932
|
}
|
|
@@ -7980,13 +7979,13 @@ var require_promisepipe = __commonJS({
|
|
|
7980
7979
|
}
|
|
7981
7980
|
const isReadable = stream.readable || typeof stream._read === "function";
|
|
7982
7981
|
function on(evt) {
|
|
7983
|
-
function executor(
|
|
7982
|
+
function executor(resolve, reject) {
|
|
7984
7983
|
const fn = evt === "error" ? (err) => reject(new StreamError(err, stream)) : () => {
|
|
7985
7984
|
if (isReadable && evt === "finish" && !state.error) {
|
|
7986
7985
|
return;
|
|
7987
7986
|
}
|
|
7988
7987
|
cleanupEventHandlers(stream, fn);
|
|
7989
|
-
|
|
7988
|
+
resolve(stream);
|
|
7990
7989
|
};
|
|
7991
7990
|
stream.on(evt, fn);
|
|
7992
7991
|
}
|
|
@@ -8032,6 +8031,77 @@ var require_promisepipe = __commonJS({
|
|
|
8032
8031
|
}
|
|
8033
8032
|
});
|
|
8034
8033
|
|
|
8034
|
+
// ../../internals/builder-orchestration/dist/merge.js
|
|
8035
|
+
var require_merge = __commonJS({
|
|
8036
|
+
"../../internals/builder-orchestration/dist/merge.js"(exports, module) {
|
|
8037
|
+
"use strict";
|
|
8038
|
+
var __defProp = Object.defineProperty;
|
|
8039
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8040
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8041
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8042
|
+
var __export = (target, all) => {
|
|
8043
|
+
for (var name in all)
|
|
8044
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8045
|
+
};
|
|
8046
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8047
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8048
|
+
for (let key of __getOwnPropNames(from))
|
|
8049
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
8050
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
8051
|
+
}
|
|
8052
|
+
return to;
|
|
8053
|
+
};
|
|
8054
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
8055
|
+
var merge_exports = {};
|
|
8056
|
+
__export(merge_exports, {
|
|
8057
|
+
merge: () => merge
|
|
8058
|
+
});
|
|
8059
|
+
module.exports = __toCommonJS(merge_exports);
|
|
8060
|
+
var import_path = __require("path");
|
|
8061
|
+
var import_error_utils = require_dist();
|
|
8062
|
+
var import_fs_extra = require_lib();
|
|
8063
|
+
async function merge(source, destination, ignoreFilter, sourceRoot) {
|
|
8064
|
+
const root = sourceRoot || source;
|
|
8065
|
+
if (ignoreFilter) {
|
|
8066
|
+
const relPath = (0, import_path.relative)(root, source);
|
|
8067
|
+
if (relPath && !ignoreFilter(relPath)) {
|
|
8068
|
+
await (0, import_fs_extra.remove)(source);
|
|
8069
|
+
return;
|
|
8070
|
+
}
|
|
8071
|
+
}
|
|
8072
|
+
const destStat = await (0, import_fs_extra.stat)(destination).catch(
|
|
8073
|
+
(err) => err
|
|
8074
|
+
);
|
|
8075
|
+
if ((0, import_error_utils.isErrnoException)(destStat)) {
|
|
8076
|
+
if (destStat.code === "ENOENT") {
|
|
8077
|
+
await (0, import_fs_extra.move)(source, destination);
|
|
8078
|
+
return;
|
|
8079
|
+
}
|
|
8080
|
+
throw destStat;
|
|
8081
|
+
} else if (destStat.isDirectory()) {
|
|
8082
|
+
const contents = await (0, import_fs_extra.readdir)(
|
|
8083
|
+
source
|
|
8084
|
+
).catch((err) => err);
|
|
8085
|
+
if ((0, import_error_utils.isErrnoException)(contents)) {
|
|
8086
|
+
if (contents.code !== "ENOTDIR") {
|
|
8087
|
+
throw contents;
|
|
8088
|
+
}
|
|
8089
|
+
} else {
|
|
8090
|
+
await Promise.all(
|
|
8091
|
+
contents.map(
|
|
8092
|
+
(name) => merge((0, import_path.join)(source, name), (0, import_path.join)(destination, name), ignoreFilter, root)
|
|
8093
|
+
)
|
|
8094
|
+
);
|
|
8095
|
+
await (0, import_fs_extra.rmdir)(source);
|
|
8096
|
+
return;
|
|
8097
|
+
}
|
|
8098
|
+
}
|
|
8099
|
+
await (0, import_fs_extra.remove)(destination);
|
|
8100
|
+
await (0, import_fs_extra.move)(source, destination);
|
|
8101
|
+
}
|
|
8102
|
+
}
|
|
8103
|
+
});
|
|
8104
|
+
|
|
8035
8105
|
// ../../node_modules/.pnpm/pend@1.2.0/node_modules/pend/index.js
|
|
8036
8106
|
var require_pend = __commonJS({
|
|
8037
8107
|
"../../node_modules/.pnpm/pend@1.2.0/node_modules/pend/index.js"(exports, module) {
|
|
@@ -8091,7 +8161,7 @@ var require_pend = __commonJS({
|
|
|
8091
8161
|
// ../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js
|
|
8092
8162
|
var require_fd_slicer = __commonJS({
|
|
8093
8163
|
"../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js"(exports) {
|
|
8094
|
-
var
|
|
8164
|
+
var fs = __require("fs");
|
|
8095
8165
|
var util = __require("util");
|
|
8096
8166
|
var stream = __require("stream");
|
|
8097
8167
|
var Readable = stream.Readable;
|
|
@@ -8116,7 +8186,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8116
8186
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
8117
8187
|
var self = this;
|
|
8118
8188
|
self.pend.go(function(cb) {
|
|
8119
|
-
|
|
8189
|
+
fs.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
8120
8190
|
cb();
|
|
8121
8191
|
callback(err, bytesRead, buffer2);
|
|
8122
8192
|
});
|
|
@@ -8125,7 +8195,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8125
8195
|
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
8126
8196
|
var self = this;
|
|
8127
8197
|
self.pend.go(function(cb) {
|
|
8128
|
-
|
|
8198
|
+
fs.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
|
|
8129
8199
|
cb();
|
|
8130
8200
|
callback(err, written, buffer2);
|
|
8131
8201
|
});
|
|
@@ -8148,7 +8218,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8148
8218
|
if (self.refCount < 0)
|
|
8149
8219
|
throw new Error("invalid unref");
|
|
8150
8220
|
if (self.autoClose) {
|
|
8151
|
-
|
|
8221
|
+
fs.close(self.fd, onCloseDone);
|
|
8152
8222
|
}
|
|
8153
8223
|
function onCloseDone(err) {
|
|
8154
8224
|
if (err) {
|
|
@@ -8187,7 +8257,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8187
8257
|
if (self.destroyed)
|
|
8188
8258
|
return cb();
|
|
8189
8259
|
var buffer = new Buffer(toRead);
|
|
8190
|
-
|
|
8260
|
+
fs.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
8191
8261
|
if (err) {
|
|
8192
8262
|
self.destroy(err);
|
|
8193
8263
|
} else if (bytesRead === 0) {
|
|
@@ -8237,7 +8307,7 @@ var require_fd_slicer = __commonJS({
|
|
|
8237
8307
|
self.context.pend.go(function(cb) {
|
|
8238
8308
|
if (self.destroyed)
|
|
8239
8309
|
return cb();
|
|
8240
|
-
|
|
8310
|
+
fs.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
|
|
8241
8311
|
if (err2) {
|
|
8242
8312
|
self.destroy();
|
|
8243
8313
|
cb();
|
|
@@ -8666,7 +8736,7 @@ var require_buffer_crc32 = __commonJS({
|
|
|
8666
8736
|
// ../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js
|
|
8667
8737
|
var require_yauzl = __commonJS({
|
|
8668
8738
|
"../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js"(exports) {
|
|
8669
|
-
var
|
|
8739
|
+
var fs = __require("fs");
|
|
8670
8740
|
var zlib = __require("zlib");
|
|
8671
8741
|
var fd_slicer = require_fd_slicer();
|
|
8672
8742
|
var crc32 = require_buffer_crc32();
|
|
@@ -8684,7 +8754,7 @@ var require_yauzl = __commonJS({
|
|
|
8684
8754
|
exports.ZipFile = ZipFile;
|
|
8685
8755
|
exports.Entry = Entry;
|
|
8686
8756
|
exports.RandomAccessReader = RandomAccessReader;
|
|
8687
|
-
function open(
|
|
8757
|
+
function open(path, options, callback) {
|
|
8688
8758
|
if (typeof options === "function") {
|
|
8689
8759
|
callback = options;
|
|
8690
8760
|
options = null;
|
|
@@ -8703,12 +8773,12 @@ var require_yauzl = __commonJS({
|
|
|
8703
8773
|
options.strictFileNames = false;
|
|
8704
8774
|
if (callback == null)
|
|
8705
8775
|
callback = defaultCallback;
|
|
8706
|
-
|
|
8776
|
+
fs.open(path, "r", function(err, fd) {
|
|
8707
8777
|
if (err)
|
|
8708
8778
|
return callback(err);
|
|
8709
8779
|
fromFd(fd, options, function(err2, zipfile) {
|
|
8710
8780
|
if (err2)
|
|
8711
|
-
|
|
8781
|
+
fs.close(fd, defaultCallback);
|
|
8712
8782
|
callback(err2, zipfile);
|
|
8713
8783
|
});
|
|
8714
8784
|
});
|
|
@@ -8732,7 +8802,7 @@ var require_yauzl = __commonJS({
|
|
|
8732
8802
|
options.strictFileNames = false;
|
|
8733
8803
|
if (callback == null)
|
|
8734
8804
|
callback = defaultCallback;
|
|
8735
|
-
|
|
8805
|
+
fs.fstat(fd, function(err, stats) {
|
|
8736
8806
|
if (err)
|
|
8737
8807
|
return callback(err);
|
|
8738
8808
|
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
@@ -9613,27 +9683,27 @@ var require_lib2 = __commonJS({
|
|
|
9613
9683
|
return shimmed.call(this, reader, totalSize, options, callback);
|
|
9614
9684
|
};
|
|
9615
9685
|
} else {
|
|
9616
|
-
const shimmed = fn(function(
|
|
9617
|
-
return original.call(this,
|
|
9686
|
+
const shimmed = fn(function(path, unused, options, callback) {
|
|
9687
|
+
return original.call(this, path, options, callback);
|
|
9618
9688
|
});
|
|
9619
|
-
yauzl[methodName] = function(
|
|
9689
|
+
yauzl[methodName] = function(path, options, callback) {
|
|
9620
9690
|
if (typeof options == "function") {
|
|
9621
9691
|
callback = options;
|
|
9622
9692
|
options = {};
|
|
9623
9693
|
} else if (!options) {
|
|
9624
9694
|
options = {};
|
|
9625
9695
|
}
|
|
9626
|
-
return shimmed.call(this,
|
|
9696
|
+
return shimmed.call(this, path, null, options, callback);
|
|
9627
9697
|
};
|
|
9628
9698
|
}
|
|
9629
9699
|
return yauzl[methodName];
|
|
9630
9700
|
}
|
|
9631
9701
|
function zipFilePatcher(original, ZipFile) {
|
|
9632
|
-
return function(
|
|
9702
|
+
return function(path, totalSize, options, callback) {
|
|
9633
9703
|
const { lazyEntries } = options, hasLazyEntries = options.hasOwnProperty("lazyEntries");
|
|
9634
9704
|
if (!lazyEntries)
|
|
9635
9705
|
options.lazyEntries = true;
|
|
9636
|
-
return original.call(this,
|
|
9706
|
+
return original.call(this, path, totalSize, options, function(err, zipFile) {
|
|
9637
9707
|
if (err)
|
|
9638
9708
|
return callback(err);
|
|
9639
9709
|
const zipFileInternal = zipFile;
|
|
@@ -9654,8 +9724,8 @@ var require_lib2 = __commonJS({
|
|
|
9654
9724
|
};
|
|
9655
9725
|
}
|
|
9656
9726
|
function entryPatcher(original, Entry) {
|
|
9657
|
-
return function(
|
|
9658
|
-
return original.call(this,
|
|
9727
|
+
return function(path, totalSize, options, callback) {
|
|
9728
|
+
return original.call(this, path, totalSize, options, function(err, zipFile) {
|
|
9659
9729
|
if (err)
|
|
9660
9730
|
return callback(err);
|
|
9661
9731
|
zipFile.intercept("entry", function(entry, cb) {
|
|
@@ -9706,19 +9776,19 @@ var require_promisify = __commonJS({
|
|
|
9706
9776
|
function promisifyMethod(yauzl, Promise2, fnName) {
|
|
9707
9777
|
const fromBuffer = fnName == "fromBuffer";
|
|
9708
9778
|
cloner.patch(yauzl, fnName, (original) => {
|
|
9709
|
-
return function(
|
|
9710
|
-
return new Promise2((
|
|
9779
|
+
return function(path, totalSize, options) {
|
|
9780
|
+
return new Promise2((resolve, reject) => {
|
|
9711
9781
|
options = Object.assign({}, options, { lazyEntries: true, autoClose: false });
|
|
9712
|
-
original(
|
|
9782
|
+
original(path, totalSize, options, (err, zipFile) => {
|
|
9713
9783
|
if (err)
|
|
9714
9784
|
return reject(err);
|
|
9715
|
-
opened(zipFile,
|
|
9785
|
+
opened(zipFile, resolve, fromBuffer, yauzl);
|
|
9716
9786
|
});
|
|
9717
9787
|
});
|
|
9718
9788
|
};
|
|
9719
9789
|
});
|
|
9720
9790
|
}
|
|
9721
|
-
function opened(zipFile,
|
|
9791
|
+
function opened(zipFile, resolve, fromBuffer, yauzl) {
|
|
9722
9792
|
if (fromBuffer) {
|
|
9723
9793
|
zipFile.reader.unref = yauzl.RandomAccessReader.prototype.unref;
|
|
9724
9794
|
zipFile.reader.close = (cb) => cb();
|
|
@@ -9729,7 +9799,7 @@ var require_promisify = __commonJS({
|
|
|
9729
9799
|
zipFile.intercept("end", emittedEnd);
|
|
9730
9800
|
zipFile.intercept("close", emittedClose);
|
|
9731
9801
|
zipFile.intercept("error", emittedError);
|
|
9732
|
-
|
|
9802
|
+
resolve(zipFile);
|
|
9733
9803
|
}
|
|
9734
9804
|
function emittedError(err) {
|
|
9735
9805
|
const state = getState(this);
|
|
@@ -9748,14 +9818,14 @@ var require_promisify = __commonJS({
|
|
|
9748
9818
|
function promisifyClose(ZipFile, Promise2) {
|
|
9749
9819
|
const close = ZipFile.prototype.close;
|
|
9750
9820
|
ZipFile.prototype.close = function() {
|
|
9751
|
-
return new Promise2((
|
|
9821
|
+
return new Promise2((resolve, reject) => {
|
|
9752
9822
|
if (getError(this))
|
|
9753
9823
|
return rejectWithStoredError(this, reject);
|
|
9754
9824
|
if (!this.isOpen)
|
|
9755
|
-
return
|
|
9825
|
+
return resolve();
|
|
9756
9826
|
if (getState(this))
|
|
9757
9827
|
return reject(new Error("Previous operation has not completed yet"));
|
|
9758
|
-
setState(this, { action: "close", resolve
|
|
9828
|
+
setState(this, { action: "close", resolve, reject });
|
|
9759
9829
|
close.call(this);
|
|
9760
9830
|
});
|
|
9761
9831
|
};
|
|
@@ -9770,14 +9840,14 @@ var require_promisify = __commonJS({
|
|
|
9770
9840
|
function promisifyReadEntry(ZipFile, Promise2) {
|
|
9771
9841
|
const readEntry = ZipFile.prototype.readEntry;
|
|
9772
9842
|
ZipFile.prototype.readEntry = function() {
|
|
9773
|
-
return new Promise2((
|
|
9843
|
+
return new Promise2((resolve, reject) => {
|
|
9774
9844
|
if (getError(this))
|
|
9775
9845
|
return rejectWithStoredError(this, reject);
|
|
9776
9846
|
if (!this.isOpen)
|
|
9777
9847
|
return reject(new Error("ZipFile is not open"));
|
|
9778
9848
|
if (getState(this))
|
|
9779
9849
|
return reject(new Error("Previous operation has not completed yet"));
|
|
9780
|
-
setState(this, { action: "read", resolve
|
|
9850
|
+
setState(this, { action: "read", resolve, reject });
|
|
9781
9851
|
readEntry.call(this);
|
|
9782
9852
|
});
|
|
9783
9853
|
};
|
|
@@ -9823,11 +9893,11 @@ var require_promisify = __commonJS({
|
|
|
9823
9893
|
function addWalkEntriesMethod(ZipFile, Promise2) {
|
|
9824
9894
|
ZipFile.prototype.walkEntries = function(callback, numEntries) {
|
|
9825
9895
|
callback = wrapFunctionToReturnPromise(callback, Promise2);
|
|
9826
|
-
return new Promise2((
|
|
9896
|
+
return new Promise2((resolve, reject) => {
|
|
9827
9897
|
walkNextEntry(this, callback, numEntries, 0, (err) => {
|
|
9828
9898
|
if (err)
|
|
9829
9899
|
return reject(err);
|
|
9830
|
-
|
|
9900
|
+
resolve();
|
|
9831
9901
|
});
|
|
9832
9902
|
});
|
|
9833
9903
|
};
|
|
@@ -9848,13 +9918,13 @@ var require_promisify = __commonJS({
|
|
|
9848
9918
|
function promisifyOpenReadStream(ZipFile, Promise2) {
|
|
9849
9919
|
const openReadStream = ZipFile.prototype.openReadStream;
|
|
9850
9920
|
ZipFile.prototype.openReadStream = function(entry, options) {
|
|
9851
|
-
return new Promise2((
|
|
9921
|
+
return new Promise2((resolve, reject) => {
|
|
9852
9922
|
if (getError(this))
|
|
9853
9923
|
return rejectWithStoredError(this, reject);
|
|
9854
9924
|
openReadStream.call(this, entry, options || {}, (err, stream) => {
|
|
9855
9925
|
if (err)
|
|
9856
9926
|
return reject(err);
|
|
9857
|
-
|
|
9927
|
+
resolve(stream);
|
|
9858
9928
|
});
|
|
9859
9929
|
});
|
|
9860
9930
|
};
|
|
@@ -9870,7 +9940,7 @@ var require_promisify = __commonJS({
|
|
|
9870
9940
|
return result;
|
|
9871
9941
|
return Promise2.resolve(result);
|
|
9872
9942
|
} catch (err) {
|
|
9873
|
-
return new Promise2((
|
|
9943
|
+
return new Promise2((resolve, reject) => {
|
|
9874
9944
|
reject(err);
|
|
9875
9945
|
});
|
|
9876
9946
|
}
|
|
@@ -9916,471 +9986,461 @@ var require_lib3 = __commonJS({
|
|
|
9916
9986
|
}
|
|
9917
9987
|
});
|
|
9918
9988
|
|
|
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;
|
|
9989
|
+
// ../../internals/builder-orchestration/dist/unzip.js
|
|
9990
|
+
var require_unzip = __commonJS({
|
|
9991
|
+
"../../internals/builder-orchestration/dist/unzip.js"(exports, module) {
|
|
9992
|
+
"use strict";
|
|
9993
|
+
var __create = Object.create;
|
|
9994
|
+
var __defProp = Object.defineProperty;
|
|
9995
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9996
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9997
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9998
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9999
|
+
var __export = (target, all) => {
|
|
10000
|
+
for (var name in all)
|
|
10001
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10002
|
+
};
|
|
10003
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10004
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10005
|
+
for (let key of __getOwnPropNames(from))
|
|
10006
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10007
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10008
|
+
}
|
|
10009
|
+
return to;
|
|
10010
|
+
};
|
|
10011
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
10012
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
10013
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
10014
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
10015
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
10016
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
10017
|
+
mod
|
|
10018
|
+
));
|
|
10019
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10020
|
+
var unzip_exports = {};
|
|
10021
|
+
__export(unzip_exports, {
|
|
10022
|
+
unzip: () => unzip
|
|
10023
|
+
});
|
|
10024
|
+
module.exports = __toCommonJS(unzip_exports);
|
|
10025
|
+
var import_path = __toESM2(__require("path"));
|
|
10026
|
+
var import_promisepipe = __toESM2(require_promisepipe());
|
|
10027
|
+
var fs = __toESM2(require_lib());
|
|
10028
|
+
var import_build_utils = __require("@vercel/build-utils");
|
|
10029
|
+
var import_yauzl_promise = require_lib3();
|
|
10030
|
+
async function* createZipIterator(zipFile) {
|
|
10031
|
+
let entry;
|
|
10032
|
+
while ((entry = await zipFile.readEntry()) !== null) {
|
|
10033
|
+
yield entry;
|
|
10034
|
+
}
|
|
9966
10035
|
}
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
10036
|
+
async function unzip(buffer, dir) {
|
|
10037
|
+
const zipFile = await (0, import_yauzl_promise.fromBuffer)(buffer);
|
|
10038
|
+
for await (const entry of createZipIterator(zipFile)) {
|
|
10039
|
+
if (entry.fileName.startsWith("__MACOSX/"))
|
|
10040
|
+
continue;
|
|
10041
|
+
try {
|
|
10042
|
+
const destDir = import_path.default.dirname(import_path.default.join(dir, entry.fileName));
|
|
10043
|
+
await fs.mkdirp(destDir);
|
|
10044
|
+
const canonicalDestDir = await fs.realpath(destDir);
|
|
10045
|
+
const relativeDestDir = import_path.default.relative(dir, canonicalDestDir);
|
|
10046
|
+
if (relativeDestDir.split(import_path.default.sep).includes("..")) {
|
|
10047
|
+
throw new Error(
|
|
10048
|
+
`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`
|
|
10049
|
+
);
|
|
10050
|
+
}
|
|
10051
|
+
await extractEntry(zipFile, entry, dir);
|
|
10052
|
+
} catch (err) {
|
|
10053
|
+
await zipFile.close();
|
|
10054
|
+
throw err;
|
|
10055
|
+
}
|
|
9975
10056
|
}
|
|
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
10057
|
}
|
|
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
|
-
);
|
|
10058
|
+
async function extractEntry(zipFile, entry, dir) {
|
|
10059
|
+
const dest = import_path.default.join(dir, entry.fileName);
|
|
10060
|
+
const mode = entry.externalFileAttributes >> 16 & 65535;
|
|
10061
|
+
const IFMT = 61440;
|
|
10062
|
+
const IFDIR = 16384;
|
|
10063
|
+
const IFLNK = 40960;
|
|
10064
|
+
const symlink = (mode & IFMT) === IFLNK;
|
|
10065
|
+
let isDir = (mode & IFMT) === IFDIR;
|
|
10066
|
+
if (!isDir && entry.fileName.endsWith("/")) {
|
|
10067
|
+
isDir = true;
|
|
10068
|
+
}
|
|
10069
|
+
const madeBy = entry.versionMadeBy >> 8;
|
|
10070
|
+
if (!isDir)
|
|
10071
|
+
isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
|
10072
|
+
const procMode = getExtractedMode(mode, isDir) & 511;
|
|
10073
|
+
const destDir = isDir ? dest : import_path.default.dirname(dest);
|
|
10074
|
+
const mkdirOptions = { recursive: true };
|
|
10075
|
+
if (isDir) {
|
|
10076
|
+
mkdirOptions.mode = procMode;
|
|
10077
|
+
}
|
|
10078
|
+
await fs.mkdir(destDir, mkdirOptions);
|
|
10079
|
+
if (isDir)
|
|
10080
|
+
return;
|
|
10081
|
+
const readStream = await zipFile.openReadStream(entry);
|
|
10082
|
+
if (symlink) {
|
|
10083
|
+
const link = await (0, import_build_utils.streamToBuffer)(readStream);
|
|
10084
|
+
await fs.symlink(link.toString("utf8"), dest);
|
|
10085
|
+
} else {
|
|
10086
|
+
await (0, import_promisepipe.default)(readStream, fs.createWriteStream(dest, { mode: procMode }));
|
|
10016
10087
|
}
|
|
10017
|
-
await extractEntry(zipFile, entry, dir);
|
|
10018
|
-
} catch (err) {
|
|
10019
|
-
await zipFile.close();
|
|
10020
|
-
throw err;
|
|
10021
10088
|
}
|
|
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;
|
|
10089
|
+
function getExtractedMode(entryMode, isDir) {
|
|
10090
|
+
let mode = entryMode;
|
|
10091
|
+
if (mode === 0) {
|
|
10092
|
+
if (isDir) {
|
|
10093
|
+
mode = 493;
|
|
10094
|
+
} else {
|
|
10095
|
+
mode = 420;
|
|
10096
|
+
}
|
|
10097
|
+
}
|
|
10098
|
+
return mode;
|
|
10062
10099
|
}
|
|
10063
10100
|
}
|
|
10064
|
-
|
|
10065
|
-
}
|
|
10101
|
+
});
|
|
10066
10102
|
|
|
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
|
|
10103
|
+
// ../../internals/builder-orchestration/dist/write-build-result.js
|
|
10104
|
+
var require_write_build_result = __commonJS({
|
|
10105
|
+
"../../internals/builder-orchestration/dist/write-build-result.js"(exports, module) {
|
|
10106
|
+
"use strict";
|
|
10107
|
+
var __create = Object.create;
|
|
10108
|
+
var __defProp = Object.defineProperty;
|
|
10109
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10110
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10111
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10112
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10113
|
+
var __export = (target, all) => {
|
|
10114
|
+
for (var name in all)
|
|
10115
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10116
|
+
};
|
|
10117
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10118
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10119
|
+
for (let key of __getOwnPropNames(from))
|
|
10120
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10121
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10188
10122
|
}
|
|
10123
|
+
return to;
|
|
10124
|
+
};
|
|
10125
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
10126
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
10127
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
10128
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
10129
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
10130
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
10131
|
+
mod
|
|
10132
|
+
));
|
|
10133
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10134
|
+
var write_build_result_exports = {};
|
|
10135
|
+
__export(write_build_result_exports, {
|
|
10136
|
+
OUTPUT_DIR: () => OUTPUT_DIR2,
|
|
10137
|
+
createWriteBuildResult: () => createWriteBuildResult2,
|
|
10138
|
+
filesWithoutFsRefs: () => filesWithoutFsRefs2,
|
|
10139
|
+
findDirs: () => findDirs2,
|
|
10140
|
+
isLambda: () => isLambda2,
|
|
10141
|
+
relocateRootBuildOutputToService: () => relocateRootBuildOutputToService2
|
|
10189
10142
|
});
|
|
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
|
-
|
|
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(
|
|
10143
|
+
module.exports = __toCommonJS(write_build_result_exports);
|
|
10144
|
+
var import_fs_extra = __toESM2(require_lib());
|
|
10145
|
+
var import_mime_types = __toESM2(require_mime_types());
|
|
10146
|
+
var import_path = __require("path");
|
|
10147
|
+
var import_build_utils = __require("@vercel/build-utils");
|
|
10148
|
+
var import_fs_detectors = require_dist3();
|
|
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,613 @@ async function writeBuildResultV3(args) {
|
|
|
10390
10450
|
workPath,
|
|
10391
10451
|
service,
|
|
10392
10452
|
rootOutputDir,
|
|
10393
|
-
stripServiceRoutePrefix
|
|
10394
|
-
|
|
10395
|
-
|
|
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
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
}
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
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_fs_detectors.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
|
+
}
|
|
10479
10557
|
}
|
|
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;
|
|
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);
|
|
10540
10593
|
}
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
const config = {
|
|
10552
|
-
runtime: "edge",
|
|
10553
|
-
...edgeFunction,
|
|
10554
|
-
entrypoint: normalizePath(edgeFunction.entrypoint),
|
|
10555
|
-
filePathMap,
|
|
10556
|
-
files: void 0,
|
|
10557
|
-
type: void 0
|
|
10558
|
-
};
|
|
10559
|
-
const configPath = join2(dest, ".vc-config.json");
|
|
10560
|
-
ops.push(
|
|
10561
|
-
import_fs_extra2.default.writeJSON(configPath, config, {
|
|
10562
|
-
spaces: 2
|
|
10563
|
-
})
|
|
10564
|
-
);
|
|
10565
|
-
await Promise.all(ops);
|
|
10566
|
-
}
|
|
10567
|
-
async function writeLambda(repoRootPath, outputDir, lambda, path2, functionConfiguration, existingFunctions, standalone = false) {
|
|
10568
|
-
const dest = join2(outputDir, "functions", `${path2}.func`);
|
|
10569
|
-
if (existingFunctions) {
|
|
10570
|
-
if (await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)) {
|
|
10571
|
-
return;
|
|
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;
|
|
10572
10604
|
}
|
|
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
|
-
type: void 0,
|
|
10608
|
-
files: void 0,
|
|
10609
|
-
zipBuffer: void 0
|
|
10610
|
-
};
|
|
10611
|
-
const configPath = join2(dest, ".vc-config.json");
|
|
10612
|
-
ops.push(
|
|
10613
|
-
import_fs_extra2.default.writeJSON(configPath, config, {
|
|
10614
|
-
spaces: 2
|
|
10615
|
-
})
|
|
10616
|
-
);
|
|
10617
|
-
await Promise.all(ops);
|
|
10618
|
-
for await (const dir of findDirs(".vercel", dest)) {
|
|
10619
|
-
const absDir = join2(dest, dir);
|
|
10620
|
-
const entries = await import_fs_extra2.default.readdir(absDir);
|
|
10621
|
-
if (entries.includes("cache")) {
|
|
10622
|
-
await Promise.all(
|
|
10623
|
-
entries.filter((e) => e !== "cache").map((entry) => import_fs_extra2.default.remove(join2(absDir, entry)))
|
|
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 }
|
|
10624
10639
|
);
|
|
10625
|
-
} else {
|
|
10626
|
-
await import_fs_extra2.default.remove(absDir);
|
|
10627
|
-
}
|
|
10628
|
-
}
|
|
10629
|
-
}
|
|
10630
|
-
async function mergeBuilderOutput(outputDir, buildResult, workPath, rootOutputDir) {
|
|
10631
|
-
const absOutputDir = resolve(outputDir);
|
|
10632
|
-
const absRootOutputDir = resolve(rootOutputDir);
|
|
10633
|
-
const { ig } = await (0, import_client.getVercelIgnore)(workPath);
|
|
10634
|
-
const filter = ig.createFilter();
|
|
10635
|
-
if (absOutputDir === buildResult.buildOutputPath) {
|
|
10636
|
-
const staticDir = join2(outputDir, "static");
|
|
10637
|
-
try {
|
|
10638
|
-
await cleanIgnoredFiles(staticDir, staticDir, filter);
|
|
10639
|
-
} catch (err) {
|
|
10640
|
-
if (err.code !== "ENOENT")
|
|
10641
|
-
throw err;
|
|
10642
10640
|
}
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
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);
|
|
10653
10677
|
}
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
if (
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
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));
|
|
10670
10695
|
} else {
|
|
10671
|
-
|
|
10696
|
+
throw new Error('Malformed `Lambda` - no "files" present');
|
|
10672
10697
|
}
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
const
|
|
10681
|
-
const
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
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);
|
|
10688
10738
|
}
|
|
10689
|
-
} else if (!filter(relativePath)) {
|
|
10690
|
-
output_manager_default.debug(`Removing ignored file: ${relativePath}`);
|
|
10691
|
-
await import_fs_extra2.default.remove(entryPath);
|
|
10692
10739
|
}
|
|
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
10740
|
}
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
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);
|
|
10716
10768
|
}
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
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);
|
|
10773
|
+
await Promise.all(
|
|
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
|
+
})
|
|
10785
|
+
);
|
|
10728
10786
|
}
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
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
|
+
);
|
|
10806
|
+
}
|
|
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
|
+
}
|
|
10734
10817
|
}
|
|
10818
|
+
return ext;
|
|
10735
10819
|
}
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
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 = [];
|
|
10829
|
+
}
|
|
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
|
+
}
|
|
10748
10846
|
}
|
|
10749
|
-
out[normalized] = file;
|
|
10750
|
-
} else {
|
|
10751
|
-
if (!filePathMap)
|
|
10752
|
-
filePathMap = {};
|
|
10753
|
-
filePathMap[normalizePath(path2)] = normalizePath(
|
|
10754
|
-
relative2(repoRootPath, file.fsPath)
|
|
10755
|
-
);
|
|
10756
10847
|
}
|
|
10757
|
-
}
|
|
10758
|
-
|
|
10848
|
+
}
|
|
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 };
|
|
10759
10873
|
}
|
|
10760
10874
|
}
|
|
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";
|
|
10768
|
-
|
|
10769
|
-
// src/util/unique-strings.ts
|
|
10770
|
-
var unique_strings_default = (arr) => {
|
|
10771
|
-
const len = arr.length;
|
|
10772
|
-
const res = [];
|
|
10773
|
-
const o = {};
|
|
10774
|
-
let i;
|
|
10775
|
-
for (i = 0; i < len; i += 1) {
|
|
10776
|
-
o[arr[i]] = o[arr[i]] || res.push(arr[i]);
|
|
10777
|
-
}
|
|
10778
|
-
return res;
|
|
10779
|
-
};
|
|
10875
|
+
});
|
|
10780
10876
|
|
|
10781
|
-
//
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10877
|
+
// ../../internals/cli-builder-integration/dist/service-schedules.js
|
|
10878
|
+
var require_service_schedules = __commonJS({
|
|
10879
|
+
"../../internals/cli-builder-integration/dist/service-schedules.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 service_schedules_exports = {};
|
|
10899
|
+
__export(service_schedules_exports, {
|
|
10900
|
+
getStaticServiceSchedules: () => getStaticServiceSchedules
|
|
10901
|
+
});
|
|
10902
|
+
module.exports = __toCommonJS(service_schedules_exports);
|
|
10903
|
+
var DYNAMIC_SCHEDULE = "<dynamic>";
|
|
10904
|
+
function getStaticServiceSchedules(schedule) {
|
|
10905
|
+
if (!schedule || schedule === DYNAMIC_SCHEDULE) {
|
|
10906
|
+
return [];
|
|
10907
|
+
}
|
|
10908
|
+
return Array.isArray(schedule) ? schedule.filter((item) => item !== DYNAMIC_SCHEDULE) : [schedule];
|
|
10788
10909
|
}
|
|
10789
10910
|
}
|
|
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
|
-
|
|
10911
|
+
});
|
|
10912
|
+
|
|
10913
|
+
// ../../internals/cli-builder-integration/dist/get-files.js
|
|
10914
|
+
var require_get_files = __commonJS({
|
|
10915
|
+
"../../internals/cli-builder-integration/dist/get-files.js"(exports, module) {
|
|
10916
|
+
"use strict";
|
|
10917
|
+
var __create = Object.create;
|
|
10918
|
+
var __defProp = Object.defineProperty;
|
|
10919
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10920
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10921
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10922
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10923
|
+
var __export = (target, all) => {
|
|
10924
|
+
for (var name in all)
|
|
10925
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10926
|
+
};
|
|
10927
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10928
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10929
|
+
for (let key of __getOwnPropNames(from))
|
|
10930
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10931
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10932
|
+
}
|
|
10933
|
+
return to;
|
|
10934
|
+
};
|
|
10935
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
10936
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
10937
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
10938
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
10939
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
10940
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
10941
|
+
mod
|
|
10942
|
+
));
|
|
10943
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10944
|
+
var get_files_exports = {};
|
|
10945
|
+
__export(get_files_exports, {
|
|
10946
|
+
staticFiles: () => staticFiles
|
|
10947
|
+
});
|
|
10948
|
+
module.exports = __toCommonJS(get_files_exports);
|
|
10949
|
+
var import_fs_extra = __toESM2(require_lib());
|
|
10950
|
+
var import_path = __require("path");
|
|
10951
|
+
var import_client = require_dist2();
|
|
10952
|
+
function flatten(arr, res = []) {
|
|
10953
|
+
for (const cur of arr) {
|
|
10954
|
+
if (Array.isArray(cur)) {
|
|
10955
|
+
flatten(cur, res);
|
|
10956
|
+
} else {
|
|
10957
|
+
res.push(cur);
|
|
10958
|
+
}
|
|
10959
|
+
}
|
|
10960
|
+
return res;
|
|
10832
10961
|
}
|
|
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;
|
|
10962
|
+
var asAbsolute = function(path, parent) {
|
|
10963
|
+
if (path[0] === "/") {
|
|
10964
|
+
return path;
|
|
10842
10965
|
}
|
|
10966
|
+
return (0, import_path.resolve)(parent, path);
|
|
10967
|
+
};
|
|
10968
|
+
async function staticFiles(path, { src }, output) {
|
|
10969
|
+
const { debug, time } = output;
|
|
10970
|
+
let files = [];
|
|
10971
|
+
const source = src || ".";
|
|
10972
|
+
const search = (0, import_path.resolve)(path, source);
|
|
10973
|
+
const { ig } = await (0, import_client.getVercelIgnore)(path);
|
|
10974
|
+
const filter = ig.createFilter();
|
|
10975
|
+
const prefixLength = path.length + 1;
|
|
10976
|
+
const accepts = (file) => {
|
|
10977
|
+
const relativePath = file.slice(prefixLength);
|
|
10978
|
+
if (relativePath === "") {
|
|
10979
|
+
return true;
|
|
10980
|
+
}
|
|
10981
|
+
const accepted = filter(relativePath);
|
|
10982
|
+
if (!accepted) {
|
|
10983
|
+
debug(`Ignoring ${file}`);
|
|
10984
|
+
}
|
|
10985
|
+
return accepted;
|
|
10986
|
+
};
|
|
10987
|
+
files = await time(
|
|
10988
|
+
`Locating files ${path}`,
|
|
10989
|
+
explode([search], {
|
|
10990
|
+
accepts,
|
|
10991
|
+
output
|
|
10992
|
+
})
|
|
10993
|
+
);
|
|
10994
|
+
return Array.from(new Set(files));
|
|
10843
10995
|
}
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
10851
|
-
debug(`Ignoring directory that has since been removed ${file}`);
|
|
10996
|
+
async function explode(paths, { accepts, output }) {
|
|
10997
|
+
const { debug } = output;
|
|
10998
|
+
const list = async (file) => {
|
|
10999
|
+
let path = file;
|
|
11000
|
+
let s;
|
|
11001
|
+
if (!accepts(file)) {
|
|
10852
11002
|
return null;
|
|
10853
11003
|
}
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
11004
|
+
try {
|
|
11005
|
+
s = await import_fs_extra.default.stat(path);
|
|
11006
|
+
} catch (_e) {
|
|
11007
|
+
path = `${file}.js`;
|
|
11008
|
+
try {
|
|
11009
|
+
s = await import_fs_extra.default.stat(path);
|
|
11010
|
+
} catch (_e2) {
|
|
11011
|
+
debug(`Ignoring invalid file ${file}`);
|
|
11012
|
+
return null;
|
|
11013
|
+
}
|
|
11014
|
+
}
|
|
11015
|
+
if (s.isDirectory()) {
|
|
11016
|
+
let all;
|
|
11017
|
+
try {
|
|
11018
|
+
all = await import_fs_extra.default.readdir(file);
|
|
11019
|
+
} catch (err) {
|
|
11020
|
+
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
11021
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
11022
|
+
debug(`Ignoring directory that has since been removed ${file}`);
|
|
11023
|
+
return null;
|
|
11024
|
+
}
|
|
11025
|
+
throw err;
|
|
11026
|
+
}
|
|
11027
|
+
return many(all.map((subdir) => asAbsolute(subdir, file)));
|
|
11028
|
+
}
|
|
11029
|
+
if (!s.isFile()) {
|
|
11030
|
+
debug(`Ignoring special file ${file}`);
|
|
11031
|
+
return null;
|
|
11032
|
+
}
|
|
11033
|
+
return path;
|
|
11034
|
+
};
|
|
11035
|
+
const many = (all) => Promise.all(all.map((file) => list(file)));
|
|
11036
|
+
const arrayOfArrays = await many(paths);
|
|
11037
|
+
return flatten(arrayOfArrays).filter(notNull);
|
|
10858
11038
|
}
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
return null;
|
|
11039
|
+
function notNull(value) {
|
|
11040
|
+
return value !== null;
|
|
10862
11041
|
}
|
|
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
11042
|
}
|
|
10879
|
-
|
|
10880
|
-
|
|
11043
|
+
});
|
|
11044
|
+
|
|
11045
|
+
// src/builders/write-build-result.ts
|
|
11046
|
+
var import_write_build_result = __toESM(require_write_build_result(), 1);
|
|
11047
|
+
var {
|
|
11048
|
+
filesWithoutFsRefs,
|
|
11049
|
+
relocateRootBuildOutputToService,
|
|
11050
|
+
writeBuildResult
|
|
11051
|
+
} = (0, import_write_build_result.createWriteBuildResult)(output_manager_default);
|
|
10881
11052
|
|
|
10882
11053
|
export {
|
|
10883
11054
|
require_mime_types,
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
11055
|
+
require_write_build_result,
|
|
11056
|
+
require_service_schedules,
|
|
11057
|
+
require_get_files,
|
|
11058
|
+
import_write_build_result,
|
|
11059
|
+
writeBuildResult
|
|
10889
11060
|
};
|
|
10890
11061
|
/*! Bundled license information:
|
|
10891
11062
|
|