vercel 59.1.4 → 59.4.0

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