@vercel/go 3.7.1 → 3.8.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 (2) hide show
  1. package/dist/index.js +625 -378
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ var require_windows = __commonJS({
75
75
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
76
76
  module2.exports = isexe;
77
77
  isexe.sync = sync;
78
- var fs2 = require("fs");
78
+ var fs3 = require("fs");
79
79
  function checkPathExt(path, options) {
80
80
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
81
81
  if (!pathext) {
@@ -100,12 +100,12 @@ var require_windows = __commonJS({
100
100
  return checkPathExt(path, options);
101
101
  }
102
102
  function isexe(path, options, cb) {
103
- fs2.stat(path, function(er2, stat) {
103
+ fs3.stat(path, function(er2, stat) {
104
104
  cb(er2, er2 ? false : checkStat(stat, path, options));
105
105
  });
106
106
  }
107
107
  function sync(path, options) {
108
- return checkStat(fs2.statSync(path), path, options);
108
+ return checkStat(fs3.statSync(path), path, options);
109
109
  }
110
110
  }
111
111
  });
@@ -115,14 +115,14 @@ var require_mode = __commonJS({
115
115
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
116
116
  module2.exports = isexe;
117
117
  isexe.sync = sync;
118
- var fs2 = require("fs");
118
+ var fs3 = require("fs");
119
119
  function isexe(path, options, cb) {
120
- fs2.stat(path, function(er2, stat) {
120
+ fs3.stat(path, function(er2, stat) {
121
121
  cb(er2, er2 ? false : checkStat(stat, options));
122
122
  });
123
123
  }
124
124
  function sync(path, options) {
125
- return checkStat(fs2.statSync(path), options);
125
+ return checkStat(fs3.statSync(path), options);
126
126
  }
127
127
  function checkStat(stat, options) {
128
128
  return stat.isFile() && checkMode(stat, options);
@@ -146,7 +146,7 @@ var require_mode = __commonJS({
146
146
  // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
147
147
  var require_isexe = __commonJS({
148
148
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
149
- var fs2 = require("fs");
149
+ var fs3 = require("fs");
150
150
  var core;
151
151
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
152
152
  core = require_windows();
@@ -422,7 +422,7 @@ var require_shebang_command = __commonJS({
422
422
  var require_readShebang = __commonJS({
423
423
  "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
424
424
  "use strict";
425
- var fs2 = require("fs");
425
+ var fs3 = require("fs");
426
426
  var shebangCommand = require_shebang_command();
427
427
  function readShebang(command) {
428
428
  const size = 150;
@@ -435,9 +435,9 @@ var require_readShebang = __commonJS({
435
435
  }
436
436
  let fd;
437
437
  try {
438
- fd = fs2.openSync(command, "r");
439
- fs2.readSync(fd, buffer, 0, size, 0);
440
- fs2.closeSync(fd);
438
+ fd = fs3.openSync(command, "r");
439
+ fs3.readSync(fd, buffer, 0, size, 0);
440
+ fs3.closeSync(fd);
441
441
  } catch (e) {
442
442
  }
443
443
  return shebangCommand(buffer.toString());
@@ -1922,9 +1922,9 @@ var require_pump = __commonJS({
1922
1922
  "../../node_modules/.pnpm/pump@3.0.2/node_modules/pump/index.js"(exports, module2) {
1923
1923
  var once2 = require_once();
1924
1924
  var eos = require_end_of_stream();
1925
- var fs2;
1925
+ var fs3;
1926
1926
  try {
1927
- fs2 = require("fs");
1927
+ fs3 = require("fs");
1928
1928
  } catch (e) {
1929
1929
  }
1930
1930
  var noop = function() {
@@ -1936,9 +1936,9 @@ var require_pump = __commonJS({
1936
1936
  var isFS = function(stream) {
1937
1937
  if (!ancient)
1938
1938
  return false;
1939
- if (!fs2)
1939
+ if (!fs3)
1940
1940
  return false;
1941
- return (stream instanceof (fs2.ReadStream || noop) || stream instanceof (fs2.WriteStream || noop)) && isFn(stream.close);
1941
+ return (stream instanceof (fs3.ReadStream || noop) || stream instanceof (fs3.WriteStream || noop)) && isFn(stream.close);
1942
1942
  };
1943
1943
  var isRequest = function(stream) {
1944
1944
  return stream.setHeader && isFn(stream.abort);
@@ -3053,56 +3053,56 @@ var require_polyfills = __commonJS({
3053
3053
  }
3054
3054
  var chdir;
3055
3055
  module2.exports = patch;
3056
- function patch(fs2) {
3056
+ function patch(fs3) {
3057
3057
  if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
3058
- patchLchmod(fs2);
3059
- }
3060
- if (!fs2.lutimes) {
3061
- patchLutimes(fs2);
3062
- }
3063
- fs2.chown = chownFix(fs2.chown);
3064
- fs2.fchown = chownFix(fs2.fchown);
3065
- fs2.lchown = chownFix(fs2.lchown);
3066
- fs2.chmod = chmodFix(fs2.chmod);
3067
- fs2.fchmod = chmodFix(fs2.fchmod);
3068
- fs2.lchmod = chmodFix(fs2.lchmod);
3069
- fs2.chownSync = chownFixSync(fs2.chownSync);
3070
- fs2.fchownSync = chownFixSync(fs2.fchownSync);
3071
- fs2.lchownSync = chownFixSync(fs2.lchownSync);
3072
- fs2.chmodSync = chmodFixSync(fs2.chmodSync);
3073
- fs2.fchmodSync = chmodFixSync(fs2.fchmodSync);
3074
- fs2.lchmodSync = chmodFixSync(fs2.lchmodSync);
3075
- fs2.stat = statFix(fs2.stat);
3076
- fs2.fstat = statFix(fs2.fstat);
3077
- fs2.lstat = statFix(fs2.lstat);
3078
- fs2.statSync = statFixSync(fs2.statSync);
3079
- fs2.fstatSync = statFixSync(fs2.fstatSync);
3080
- fs2.lstatSync = statFixSync(fs2.lstatSync);
3081
- if (fs2.chmod && !fs2.lchmod) {
3082
- fs2.lchmod = function(path, mode, cb) {
3058
+ patchLchmod(fs3);
3059
+ }
3060
+ if (!fs3.lutimes) {
3061
+ patchLutimes(fs3);
3062
+ }
3063
+ fs3.chown = chownFix(fs3.chown);
3064
+ fs3.fchown = chownFix(fs3.fchown);
3065
+ fs3.lchown = chownFix(fs3.lchown);
3066
+ fs3.chmod = chmodFix(fs3.chmod);
3067
+ fs3.fchmod = chmodFix(fs3.fchmod);
3068
+ fs3.lchmod = chmodFix(fs3.lchmod);
3069
+ fs3.chownSync = chownFixSync(fs3.chownSync);
3070
+ fs3.fchownSync = chownFixSync(fs3.fchownSync);
3071
+ fs3.lchownSync = chownFixSync(fs3.lchownSync);
3072
+ fs3.chmodSync = chmodFixSync(fs3.chmodSync);
3073
+ fs3.fchmodSync = chmodFixSync(fs3.fchmodSync);
3074
+ fs3.lchmodSync = chmodFixSync(fs3.lchmodSync);
3075
+ fs3.stat = statFix(fs3.stat);
3076
+ fs3.fstat = statFix(fs3.fstat);
3077
+ fs3.lstat = statFix(fs3.lstat);
3078
+ fs3.statSync = statFixSync(fs3.statSync);
3079
+ fs3.fstatSync = statFixSync(fs3.fstatSync);
3080
+ fs3.lstatSync = statFixSync(fs3.lstatSync);
3081
+ if (fs3.chmod && !fs3.lchmod) {
3082
+ fs3.lchmod = function(path, mode, cb) {
3083
3083
  if (cb)
3084
3084
  process.nextTick(cb);
3085
3085
  };
3086
- fs2.lchmodSync = function() {
3086
+ fs3.lchmodSync = function() {
3087
3087
  };
3088
3088
  }
3089
- if (fs2.chown && !fs2.lchown) {
3090
- fs2.lchown = function(path, uid, gid, cb) {
3089
+ if (fs3.chown && !fs3.lchown) {
3090
+ fs3.lchown = function(path, uid, gid, cb) {
3091
3091
  if (cb)
3092
3092
  process.nextTick(cb);
3093
3093
  };
3094
- fs2.lchownSync = function() {
3094
+ fs3.lchownSync = function() {
3095
3095
  };
3096
3096
  }
3097
3097
  if (platform === "win32") {
3098
- fs2.rename = typeof fs2.rename !== "function" ? fs2.rename : function(fs$rename) {
3098
+ fs3.rename = typeof fs3.rename !== "function" ? fs3.rename : function(fs$rename) {
3099
3099
  function rename(from, to2, cb) {
3100
3100
  var start = Date.now();
3101
3101
  var backoff = 0;
3102
3102
  fs$rename(from, to2, function CB(er2) {
3103
3103
  if (er2 && (er2.code === "EACCES" || er2.code === "EPERM" || er2.code === "EBUSY") && Date.now() - start < 6e4) {
3104
3104
  setTimeout(function() {
3105
- fs2.stat(to2, function(stater, st2) {
3105
+ fs3.stat(to2, function(stater, st2) {
3106
3106
  if (stater && stater.code === "ENOENT")
3107
3107
  fs$rename(from, to2, CB);
3108
3108
  else
@@ -3120,9 +3120,9 @@ var require_polyfills = __commonJS({
3120
3120
  if (Object.setPrototypeOf)
3121
3121
  Object.setPrototypeOf(rename, fs$rename);
3122
3122
  return rename;
3123
- }(fs2.rename);
3123
+ }(fs3.rename);
3124
3124
  }
3125
- fs2.read = typeof fs2.read !== "function" ? fs2.read : function(fs$read) {
3125
+ fs3.read = typeof fs3.read !== "function" ? fs3.read : function(fs$read) {
3126
3126
  function read(fd, buffer, offset, length, position, callback_) {
3127
3127
  var callback;
3128
3128
  if (callback_ && typeof callback_ === "function") {
@@ -3130,23 +3130,23 @@ var require_polyfills = __commonJS({
3130
3130
  callback = function(er2, _2, __) {
3131
3131
  if (er2 && er2.code === "EAGAIN" && eagCounter < 10) {
3132
3132
  eagCounter++;
3133
- return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
3133
+ return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
3134
3134
  }
3135
3135
  callback_.apply(this, arguments);
3136
3136
  };
3137
3137
  }
3138
- return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
3138
+ return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
3139
3139
  }
3140
3140
  if (Object.setPrototypeOf)
3141
3141
  Object.setPrototypeOf(read, fs$read);
3142
3142
  return read;
3143
- }(fs2.read);
3144
- fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : function(fs$readSync) {
3143
+ }(fs3.read);
3144
+ fs3.readSync = typeof fs3.readSync !== "function" ? fs3.readSync : function(fs$readSync) {
3145
3145
  return function(fd, buffer, offset, length, position) {
3146
3146
  var eagCounter = 0;
3147
3147
  while (true) {
3148
3148
  try {
3149
- return fs$readSync.call(fs2, fd, buffer, offset, length, position);
3149
+ return fs$readSync.call(fs3, fd, buffer, offset, length, position);
3150
3150
  } catch (er2) {
3151
3151
  if (er2.code === "EAGAIN" && eagCounter < 10) {
3152
3152
  eagCounter++;
@@ -3156,10 +3156,10 @@ var require_polyfills = __commonJS({
3156
3156
  }
3157
3157
  }
3158
3158
  };
3159
- }(fs2.readSync);
3160
- function patchLchmod(fs3) {
3161
- fs3.lchmod = function(path, mode, callback) {
3162
- fs3.open(
3159
+ }(fs3.readSync);
3160
+ function patchLchmod(fs4) {
3161
+ fs4.lchmod = function(path, mode, callback) {
3162
+ fs4.open(
3163
3163
  path,
3164
3164
  constants.O_WRONLY | constants.O_SYMLINK,
3165
3165
  mode,
@@ -3169,8 +3169,8 @@ var require_polyfills = __commonJS({
3169
3169
  callback(err);
3170
3170
  return;
3171
3171
  }
3172
- fs3.fchmod(fd, mode, function(err2) {
3173
- fs3.close(fd, function(err22) {
3172
+ fs4.fchmod(fd, mode, function(err2) {
3173
+ fs4.close(fd, function(err22) {
3174
3174
  if (callback)
3175
3175
  callback(err2 || err22);
3176
3176
  });
@@ -3178,68 +3178,68 @@ var require_polyfills = __commonJS({
3178
3178
  }
3179
3179
  );
3180
3180
  };
3181
- fs3.lchmodSync = function(path, mode) {
3182
- var fd = fs3.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
3181
+ fs4.lchmodSync = function(path, mode) {
3182
+ var fd = fs4.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
3183
3183
  var threw = true;
3184
3184
  var ret;
3185
3185
  try {
3186
- ret = fs3.fchmodSync(fd, mode);
3186
+ ret = fs4.fchmodSync(fd, mode);
3187
3187
  threw = false;
3188
3188
  } finally {
3189
3189
  if (threw) {
3190
3190
  try {
3191
- fs3.closeSync(fd);
3191
+ fs4.closeSync(fd);
3192
3192
  } catch (er2) {
3193
3193
  }
3194
3194
  } else {
3195
- fs3.closeSync(fd);
3195
+ fs4.closeSync(fd);
3196
3196
  }
3197
3197
  }
3198
3198
  return ret;
3199
3199
  };
3200
3200
  }
3201
- function patchLutimes(fs3) {
3202
- if (constants.hasOwnProperty("O_SYMLINK") && fs3.futimes) {
3203
- fs3.lutimes = function(path, at2, mt2, cb) {
3204
- fs3.open(path, constants.O_SYMLINK, function(er2, fd) {
3201
+ function patchLutimes(fs4) {
3202
+ if (constants.hasOwnProperty("O_SYMLINK") && fs4.futimes) {
3203
+ fs4.lutimes = function(path, at2, mt2, cb) {
3204
+ fs4.open(path, constants.O_SYMLINK, function(er2, fd) {
3205
3205
  if (er2) {
3206
3206
  if (cb)
3207
3207
  cb(er2);
3208
3208
  return;
3209
3209
  }
3210
- fs3.futimes(fd, at2, mt2, function(er3) {
3211
- fs3.close(fd, function(er22) {
3210
+ fs4.futimes(fd, at2, mt2, function(er3) {
3211
+ fs4.close(fd, function(er22) {
3212
3212
  if (cb)
3213
3213
  cb(er3 || er22);
3214
3214
  });
3215
3215
  });
3216
3216
  });
3217
3217
  };
3218
- fs3.lutimesSync = function(path, at2, mt2) {
3219
- var fd = fs3.openSync(path, constants.O_SYMLINK);
3218
+ fs4.lutimesSync = function(path, at2, mt2) {
3219
+ var fd = fs4.openSync(path, constants.O_SYMLINK);
3220
3220
  var ret;
3221
3221
  var threw = true;
3222
3222
  try {
3223
- ret = fs3.futimesSync(fd, at2, mt2);
3223
+ ret = fs4.futimesSync(fd, at2, mt2);
3224
3224
  threw = false;
3225
3225
  } finally {
3226
3226
  if (threw) {
3227
3227
  try {
3228
- fs3.closeSync(fd);
3228
+ fs4.closeSync(fd);
3229
3229
  } catch (er2) {
3230
3230
  }
3231
3231
  } else {
3232
- fs3.closeSync(fd);
3232
+ fs4.closeSync(fd);
3233
3233
  }
3234
3234
  }
3235
3235
  return ret;
3236
3236
  };
3237
- } else if (fs3.futimes) {
3238
- fs3.lutimes = function(_a14, _b7, _c7, cb) {
3237
+ } else if (fs4.futimes) {
3238
+ fs4.lutimes = function(_a14, _b7, _c7, cb) {
3239
3239
  if (cb)
3240
3240
  process.nextTick(cb);
3241
3241
  };
3242
- fs3.lutimesSync = function() {
3242
+ fs4.lutimesSync = function() {
3243
3243
  };
3244
3244
  }
3245
3245
  }
@@ -3247,7 +3247,7 @@ var require_polyfills = __commonJS({
3247
3247
  if (!orig)
3248
3248
  return orig;
3249
3249
  return function(target, mode, cb) {
3250
- return orig.call(fs2, target, mode, function(er2) {
3250
+ return orig.call(fs3, target, mode, function(er2) {
3251
3251
  if (chownErOk(er2))
3252
3252
  er2 = null;
3253
3253
  if (cb)
@@ -3260,7 +3260,7 @@ var require_polyfills = __commonJS({
3260
3260
  return orig;
3261
3261
  return function(target, mode) {
3262
3262
  try {
3263
- return orig.call(fs2, target, mode);
3263
+ return orig.call(fs3, target, mode);
3264
3264
  } catch (er2) {
3265
3265
  if (!chownErOk(er2))
3266
3266
  throw er2;
@@ -3271,7 +3271,7 @@ var require_polyfills = __commonJS({
3271
3271
  if (!orig)
3272
3272
  return orig;
3273
3273
  return function(target, uid, gid, cb) {
3274
- return orig.call(fs2, target, uid, gid, function(er2) {
3274
+ return orig.call(fs3, target, uid, gid, function(er2) {
3275
3275
  if (chownErOk(er2))
3276
3276
  er2 = null;
3277
3277
  if (cb)
@@ -3284,7 +3284,7 @@ var require_polyfills = __commonJS({
3284
3284
  return orig;
3285
3285
  return function(target, uid, gid) {
3286
3286
  try {
3287
- return orig.call(fs2, target, uid, gid);
3287
+ return orig.call(fs3, target, uid, gid);
3288
3288
  } catch (er2) {
3289
3289
  if (!chownErOk(er2))
3290
3290
  throw er2;
@@ -3309,14 +3309,14 @@ var require_polyfills = __commonJS({
3309
3309
  if (cb)
3310
3310
  cb.apply(this, arguments);
3311
3311
  }
3312
- return options ? orig.call(fs2, target, options, callback) : orig.call(fs2, target, callback);
3312
+ return options ? orig.call(fs3, target, options, callback) : orig.call(fs3, target, callback);
3313
3313
  };
3314
3314
  }
3315
3315
  function statFixSync(orig) {
3316
3316
  if (!orig)
3317
3317
  return orig;
3318
3318
  return function(target, options) {
3319
- var stats = options ? orig.call(fs2, target, options) : orig.call(fs2, target);
3319
+ var stats = options ? orig.call(fs3, target, options) : orig.call(fs3, target);
3320
3320
  if (stats) {
3321
3321
  if (stats.uid < 0)
3322
3322
  stats.uid += 4294967296;
@@ -3347,7 +3347,7 @@ var require_legacy_streams = __commonJS({
3347
3347
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
3348
3348
  var Stream = require("stream").Stream;
3349
3349
  module2.exports = legacy;
3350
- function legacy(fs2) {
3350
+ function legacy(fs3) {
3351
3351
  return {
3352
3352
  ReadStream,
3353
3353
  WriteStream
@@ -3392,7 +3392,7 @@ var require_legacy_streams = __commonJS({
3392
3392
  });
3393
3393
  return;
3394
3394
  }
3395
- fs2.open(this.path, this.flags, this.mode, function(err, fd) {
3395
+ fs3.open(this.path, this.flags, this.mode, function(err, fd) {
3396
3396
  if (err) {
3397
3397
  self.emit("error", err);
3398
3398
  self.readable = false;
@@ -3432,7 +3432,7 @@ var require_legacy_streams = __commonJS({
3432
3432
  this.busy = false;
3433
3433
  this._queue = [];
3434
3434
  if (this.fd === null) {
3435
- this._open = fs2.open;
3435
+ this._open = fs3.open;
3436
3436
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
3437
3437
  this.flush();
3438
3438
  }
@@ -3453,13 +3453,13 @@ var require_clone = __commonJS({
3453
3453
  if (obj === null || typeof obj !== "object")
3454
3454
  return obj;
3455
3455
  if (obj instanceof Object)
3456
- var copy3 = { __proto__: getPrototypeOf(obj) };
3456
+ var copy4 = { __proto__: getPrototypeOf(obj) };
3457
3457
  else
3458
- var copy3 = /* @__PURE__ */ Object.create(null);
3458
+ var copy4 = /* @__PURE__ */ Object.create(null);
3459
3459
  Object.getOwnPropertyNames(obj).forEach(function(key) {
3460
- Object.defineProperty(copy3, key, Object.getOwnPropertyDescriptor(obj, key));
3460
+ Object.defineProperty(copy4, key, Object.getOwnPropertyDescriptor(obj, key));
3461
3461
  });
3462
- return copy3;
3462
+ return copy4;
3463
3463
  }
3464
3464
  }
3465
3465
  });
@@ -3467,7 +3467,7 @@ var require_clone = __commonJS({
3467
3467
  // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
3468
3468
  var require_graceful_fs = __commonJS({
3469
3469
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
3470
- var fs2 = require("fs");
3470
+ var fs3 = require("fs");
3471
3471
  var polyfills = require_polyfills();
3472
3472
  var legacy = require_legacy_streams();
3473
3473
  var clone = require_clone();
@@ -3499,12 +3499,12 @@ var require_graceful_fs = __commonJS({
3499
3499
  m2 = "GFS4: " + m2.split(/\n/).join("\nGFS4: ");
3500
3500
  console.error(m2);
3501
3501
  };
3502
- if (!fs2[gracefulQueue]) {
3502
+ if (!fs3[gracefulQueue]) {
3503
3503
  queue = global[gracefulQueue] || [];
3504
- publishQueue(fs2, queue);
3505
- fs2.close = function(fs$close) {
3504
+ publishQueue(fs3, queue);
3505
+ fs3.close = function(fs$close) {
3506
3506
  function close(fd, cb) {
3507
- return fs$close.call(fs2, fd, function(err) {
3507
+ return fs$close.call(fs3, fd, function(err) {
3508
3508
  if (!err) {
3509
3509
  resetQueue();
3510
3510
  }
@@ -3516,40 +3516,40 @@ var require_graceful_fs = __commonJS({
3516
3516
  value: fs$close
3517
3517
  });
3518
3518
  return close;
3519
- }(fs2.close);
3520
- fs2.closeSync = function(fs$closeSync) {
3519
+ }(fs3.close);
3520
+ fs3.closeSync = function(fs$closeSync) {
3521
3521
  function closeSync(fd) {
3522
- fs$closeSync.apply(fs2, arguments);
3522
+ fs$closeSync.apply(fs3, arguments);
3523
3523
  resetQueue();
3524
3524
  }
3525
3525
  Object.defineProperty(closeSync, previousSymbol, {
3526
3526
  value: fs$closeSync
3527
3527
  });
3528
3528
  return closeSync;
3529
- }(fs2.closeSync);
3529
+ }(fs3.closeSync);
3530
3530
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
3531
3531
  process.on("exit", function() {
3532
- debug5(fs2[gracefulQueue]);
3533
- require("assert").equal(fs2[gracefulQueue].length, 0);
3532
+ debug5(fs3[gracefulQueue]);
3533
+ require("assert").equal(fs3[gracefulQueue].length, 0);
3534
3534
  });
3535
3535
  }
3536
3536
  }
3537
3537
  var queue;
3538
3538
  if (!global[gracefulQueue]) {
3539
- publishQueue(global, fs2[gracefulQueue]);
3540
- }
3541
- module2.exports = patch(clone(fs2));
3542
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs2.__patched) {
3543
- module2.exports = patch(fs2);
3544
- fs2.__patched = true;
3545
- }
3546
- function patch(fs3) {
3547
- polyfills(fs3);
3548
- fs3.gracefulify = patch;
3549
- fs3.createReadStream = createReadStream;
3550
- fs3.createWriteStream = createWriteStream2;
3551
- var fs$readFile = fs3.readFile;
3552
- fs3.readFile = readFile4;
3539
+ publishQueue(global, fs3[gracefulQueue]);
3540
+ }
3541
+ module2.exports = patch(clone(fs3));
3542
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs3.__patched) {
3543
+ module2.exports = patch(fs3);
3544
+ fs3.__patched = true;
3545
+ }
3546
+ function patch(fs4) {
3547
+ polyfills(fs4);
3548
+ fs4.gracefulify = patch;
3549
+ fs4.createReadStream = createReadStream;
3550
+ fs4.createWriteStream = createWriteStream2;
3551
+ var fs$readFile = fs4.readFile;
3552
+ fs4.readFile = readFile4;
3553
3553
  function readFile4(path, options, cb) {
3554
3554
  if (typeof options === "function")
3555
3555
  cb = options, options = null;
@@ -3565,8 +3565,8 @@ var require_graceful_fs = __commonJS({
3565
3565
  });
3566
3566
  }
3567
3567
  }
3568
- var fs$writeFile = fs3.writeFile;
3569
- fs3.writeFile = writeFile2;
3568
+ var fs$writeFile = fs4.writeFile;
3569
+ fs4.writeFile = writeFile2;
3570
3570
  function writeFile2(path, data, options, cb) {
3571
3571
  if (typeof options === "function")
3572
3572
  cb = options, options = null;
@@ -3582,9 +3582,9 @@ var require_graceful_fs = __commonJS({
3582
3582
  });
3583
3583
  }
3584
3584
  }
3585
- var fs$appendFile = fs3.appendFile;
3585
+ var fs$appendFile = fs4.appendFile;
3586
3586
  if (fs$appendFile)
3587
- fs3.appendFile = appendFile;
3587
+ fs4.appendFile = appendFile;
3588
3588
  function appendFile(path, data, options, cb) {
3589
3589
  if (typeof options === "function")
3590
3590
  cb = options, options = null;
@@ -3600,9 +3600,9 @@ var require_graceful_fs = __commonJS({
3600
3600
  });
3601
3601
  }
3602
3602
  }
3603
- var fs$copyFile = fs3.copyFile;
3603
+ var fs$copyFile = fs4.copyFile;
3604
3604
  if (fs$copyFile)
3605
- fs3.copyFile = copyFile;
3605
+ fs4.copyFile = copyFile;
3606
3606
  function copyFile(src, dest, flags, cb) {
3607
3607
  if (typeof flags === "function") {
3608
3608
  cb = flags;
@@ -3620,8 +3620,8 @@ var require_graceful_fs = __commonJS({
3620
3620
  });
3621
3621
  }
3622
3622
  }
3623
- var fs$readdir = fs3.readdir;
3624
- fs3.readdir = readdir2;
3623
+ var fs$readdir = fs4.readdir;
3624
+ fs4.readdir = readdir2;
3625
3625
  var noReaddirOptionVersions = /^v[0-5]\./;
3626
3626
  function readdir2(path, options, cb) {
3627
3627
  if (typeof options === "function")
@@ -3662,21 +3662,21 @@ var require_graceful_fs = __commonJS({
3662
3662
  }
3663
3663
  }
3664
3664
  if (process.version.substr(0, 4) === "v0.8") {
3665
- var legStreams = legacy(fs3);
3665
+ var legStreams = legacy(fs4);
3666
3666
  ReadStream = legStreams.ReadStream;
3667
3667
  WriteStream = legStreams.WriteStream;
3668
3668
  }
3669
- var fs$ReadStream = fs3.ReadStream;
3669
+ var fs$ReadStream = fs4.ReadStream;
3670
3670
  if (fs$ReadStream) {
3671
3671
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
3672
3672
  ReadStream.prototype.open = ReadStream$open;
3673
3673
  }
3674
- var fs$WriteStream = fs3.WriteStream;
3674
+ var fs$WriteStream = fs4.WriteStream;
3675
3675
  if (fs$WriteStream) {
3676
3676
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
3677
3677
  WriteStream.prototype.open = WriteStream$open;
3678
3678
  }
3679
- Object.defineProperty(fs3, "ReadStream", {
3679
+ Object.defineProperty(fs4, "ReadStream", {
3680
3680
  get: function() {
3681
3681
  return ReadStream;
3682
3682
  },
@@ -3686,7 +3686,7 @@ var require_graceful_fs = __commonJS({
3686
3686
  enumerable: true,
3687
3687
  configurable: true
3688
3688
  });
3689
- Object.defineProperty(fs3, "WriteStream", {
3689
+ Object.defineProperty(fs4, "WriteStream", {
3690
3690
  get: function() {
3691
3691
  return WriteStream;
3692
3692
  },
@@ -3697,7 +3697,7 @@ var require_graceful_fs = __commonJS({
3697
3697
  configurable: true
3698
3698
  });
3699
3699
  var FileReadStream = ReadStream;
3700
- Object.defineProperty(fs3, "FileReadStream", {
3700
+ Object.defineProperty(fs4, "FileReadStream", {
3701
3701
  get: function() {
3702
3702
  return FileReadStream;
3703
3703
  },
@@ -3708,7 +3708,7 @@ var require_graceful_fs = __commonJS({
3708
3708
  configurable: true
3709
3709
  });
3710
3710
  var FileWriteStream = WriteStream;
3711
- Object.defineProperty(fs3, "FileWriteStream", {
3711
+ Object.defineProperty(fs4, "FileWriteStream", {
3712
3712
  get: function() {
3713
3713
  return FileWriteStream;
3714
3714
  },
@@ -3757,13 +3757,13 @@ var require_graceful_fs = __commonJS({
3757
3757
  });
3758
3758
  }
3759
3759
  function createReadStream(path, options) {
3760
- return new fs3.ReadStream(path, options);
3760
+ return new fs4.ReadStream(path, options);
3761
3761
  }
3762
3762
  function createWriteStream2(path, options) {
3763
- return new fs3.WriteStream(path, options);
3763
+ return new fs4.WriteStream(path, options);
3764
3764
  }
3765
- var fs$open = fs3.open;
3766
- fs3.open = open;
3765
+ var fs$open = fs4.open;
3766
+ fs4.open = open;
3767
3767
  function open(path, flags, mode, cb) {
3768
3768
  if (typeof mode === "function")
3769
3769
  cb = mode, mode = null;
@@ -3779,20 +3779,20 @@ var require_graceful_fs = __commonJS({
3779
3779
  });
3780
3780
  }
3781
3781
  }
3782
- return fs3;
3782
+ return fs4;
3783
3783
  }
3784
3784
  function enqueue(elem) {
3785
3785
  debug5("ENQUEUE", elem[0].name, elem[1]);
3786
- fs2[gracefulQueue].push(elem);
3786
+ fs3[gracefulQueue].push(elem);
3787
3787
  retry2();
3788
3788
  }
3789
3789
  var retryTimer;
3790
3790
  function resetQueue() {
3791
3791
  var now = Date.now();
3792
- for (var i = 0; i < fs2[gracefulQueue].length; ++i) {
3793
- if (fs2[gracefulQueue][i].length > 2) {
3794
- fs2[gracefulQueue][i][3] = now;
3795
- fs2[gracefulQueue][i][4] = now;
3792
+ for (var i = 0; i < fs3[gracefulQueue].length; ++i) {
3793
+ if (fs3[gracefulQueue][i].length > 2) {
3794
+ fs3[gracefulQueue][i][3] = now;
3795
+ fs3[gracefulQueue][i][4] = now;
3796
3796
  }
3797
3797
  }
3798
3798
  retry2();
@@ -3800,9 +3800,9 @@ var require_graceful_fs = __commonJS({
3800
3800
  function retry2() {
3801
3801
  clearTimeout(retryTimer);
3802
3802
  retryTimer = void 0;
3803
- if (fs2[gracefulQueue].length === 0)
3803
+ if (fs3[gracefulQueue].length === 0)
3804
3804
  return;
3805
- var elem = fs2[gracefulQueue].shift();
3805
+ var elem = fs3[gracefulQueue].shift();
3806
3806
  var fn2 = elem[0];
3807
3807
  var args = elem[1];
3808
3808
  var err = elem[2];
@@ -3824,7 +3824,7 @@ var require_graceful_fs = __commonJS({
3824
3824
  debug5("RETRY", fn2.name, args);
3825
3825
  fn2.apply(null, args.concat([startTime]));
3826
3826
  } else {
3827
- fs2[gracefulQueue].push(elem);
3827
+ fs3[gracefulQueue].push(elem);
3828
3828
  }
3829
3829
  }
3830
3830
  if (retryTimer === void 0) {
@@ -3839,7 +3839,7 @@ var require_fs = __commonJS({
3839
3839
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/fs/index.js"(exports) {
3840
3840
  "use strict";
3841
3841
  var u2 = require_universalify().fromCallback;
3842
- var fs2 = require_graceful_fs();
3842
+ var fs3 = require_graceful_fs();
3843
3843
  var api = [
3844
3844
  "access",
3845
3845
  "appendFile",
@@ -3874,31 +3874,31 @@ var require_fs = __commonJS({
3874
3874
  "utimes",
3875
3875
  "writeFile"
3876
3876
  ].filter((key) => {
3877
- return typeof fs2[key] === "function";
3877
+ return typeof fs3[key] === "function";
3878
3878
  });
3879
- Object.keys(fs2).forEach((key) => {
3879
+ Object.keys(fs3).forEach((key) => {
3880
3880
  if (key === "promises") {
3881
3881
  return;
3882
3882
  }
3883
- exports[key] = fs2[key];
3883
+ exports[key] = fs3[key];
3884
3884
  });
3885
3885
  api.forEach((method) => {
3886
- exports[method] = u2(fs2[method]);
3886
+ exports[method] = u2(fs3[method]);
3887
3887
  });
3888
3888
  exports.exists = function(filename, callback) {
3889
3889
  if (typeof callback === "function") {
3890
- return fs2.exists(filename, callback);
3890
+ return fs3.exists(filename, callback);
3891
3891
  }
3892
3892
  return new Promise((resolve) => {
3893
- return fs2.exists(filename, resolve);
3893
+ return fs3.exists(filename, resolve);
3894
3894
  });
3895
3895
  };
3896
3896
  exports.read = function(fd, buffer, offset, length, position, callback) {
3897
3897
  if (typeof callback === "function") {
3898
- return fs2.read(fd, buffer, offset, length, position, callback);
3898
+ return fs3.read(fd, buffer, offset, length, position, callback);
3899
3899
  }
3900
3900
  return new Promise((resolve, reject) => {
3901
- fs2.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
3901
+ fs3.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
3902
3902
  if (err)
3903
3903
  return reject(err);
3904
3904
  resolve({ bytesRead, buffer: buffer2 });
@@ -3907,10 +3907,10 @@ var require_fs = __commonJS({
3907
3907
  };
3908
3908
  exports.write = function(fd, buffer, ...args) {
3909
3909
  if (typeof args[args.length - 1] === "function") {
3910
- return fs2.write(fd, buffer, ...args);
3910
+ return fs3.write(fd, buffer, ...args);
3911
3911
  }
3912
3912
  return new Promise((resolve, reject) => {
3913
- fs2.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
3913
+ fs3.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
3914
3914
  if (err)
3915
3915
  return reject(err);
3916
3916
  resolve({ bytesWritten, buffer: buffer2 });
@@ -3948,7 +3948,7 @@ var require_win32 = __commonJS({
3948
3948
  var require_mkdirs = __commonJS({
3949
3949
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports, module2) {
3950
3950
  "use strict";
3951
- var fs2 = require_graceful_fs();
3951
+ var fs3 = require_graceful_fs();
3952
3952
  var path = require("path");
3953
3953
  var invalidWin32Path = require_win32().invalidWin32Path;
3954
3954
  var o777 = parseInt("0777", 8);
@@ -3965,7 +3965,7 @@ var require_mkdirs = __commonJS({
3965
3965
  return callback(errInval);
3966
3966
  }
3967
3967
  let mode = opts.mode;
3968
- const xfs = opts.fs || fs2;
3968
+ const xfs = opts.fs || fs3;
3969
3969
  if (mode === void 0) {
3970
3970
  mode = o777 & ~process.umask();
3971
3971
  }
@@ -4009,7 +4009,7 @@ var require_mkdirs = __commonJS({
4009
4009
  var require_mkdirs_sync = __commonJS({
4010
4010
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports, module2) {
4011
4011
  "use strict";
4012
- var fs2 = require_graceful_fs();
4012
+ var fs3 = require_graceful_fs();
4013
4013
  var path = require("path");
4014
4014
  var invalidWin32Path = require_win32().invalidWin32Path;
4015
4015
  var o777 = parseInt("0777", 8);
@@ -4018,7 +4018,7 @@ var require_mkdirs_sync = __commonJS({
4018
4018
  opts = { mode: opts };
4019
4019
  }
4020
4020
  let mode = opts.mode;
4021
- const xfs = opts.fs || fs2;
4021
+ const xfs = opts.fs || fs3;
4022
4022
  if (process.platform === "win32" && invalidWin32Path(p2)) {
4023
4023
  const errInval = new Error(p2 + " contains invalid WIN32 path characters.");
4024
4024
  errInval.code = "EINVAL";
@@ -4079,36 +4079,36 @@ var require_mkdirs2 = __commonJS({
4079
4079
  var require_utimes = __commonJS({
4080
4080
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
4081
4081
  "use strict";
4082
- var fs2 = require_graceful_fs();
4082
+ var fs3 = require_graceful_fs();
4083
4083
  var os2 = require("os");
4084
4084
  var path = require("path");
4085
4085
  function hasMillisResSync() {
4086
4086
  let tmpfile = path.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2));
4087
4087
  tmpfile = path.join(os2.tmpdir(), tmpfile);
4088
4088
  const d = /* @__PURE__ */ new Date(1435410243862);
4089
- fs2.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141");
4090
- const fd = fs2.openSync(tmpfile, "r+");
4091
- fs2.futimesSync(fd, d, d);
4092
- fs2.closeSync(fd);
4093
- return fs2.statSync(tmpfile).mtime > 1435410243e3;
4089
+ fs3.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141");
4090
+ const fd = fs3.openSync(tmpfile, "r+");
4091
+ fs3.futimesSync(fd, d, d);
4092
+ fs3.closeSync(fd);
4093
+ return fs3.statSync(tmpfile).mtime > 1435410243e3;
4094
4094
  }
4095
4095
  function hasMillisRes(callback) {
4096
4096
  let tmpfile = path.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2));
4097
4097
  tmpfile = path.join(os2.tmpdir(), tmpfile);
4098
4098
  const d = /* @__PURE__ */ new Date(1435410243862);
4099
- fs2.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
4099
+ fs3.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
4100
4100
  if (err)
4101
4101
  return callback(err);
4102
- fs2.open(tmpfile, "r+", (err2, fd) => {
4102
+ fs3.open(tmpfile, "r+", (err2, fd) => {
4103
4103
  if (err2)
4104
4104
  return callback(err2);
4105
- fs2.futimes(fd, d, d, (err3) => {
4105
+ fs3.futimes(fd, d, d, (err3) => {
4106
4106
  if (err3)
4107
4107
  return callback(err3);
4108
- fs2.close(fd, (err4) => {
4108
+ fs3.close(fd, (err4) => {
4109
4109
  if (err4)
4110
4110
  return callback(err4);
4111
- fs2.stat(tmpfile, (err5, stats) => {
4111
+ fs3.stat(tmpfile, (err5, stats) => {
4112
4112
  if (err5)
4113
4113
  return callback(err5);
4114
4114
  callback(null, stats.mtime > 1435410243e3);
@@ -4128,11 +4128,11 @@ var require_utimes = __commonJS({
4128
4128
  }
4129
4129
  }
4130
4130
  function utimesMillis(path2, atime, mtime, callback) {
4131
- fs2.open(path2, "r+", (err, fd) => {
4131
+ fs3.open(path2, "r+", (err, fd) => {
4132
4132
  if (err)
4133
4133
  return callback(err);
4134
- fs2.futimes(fd, atime, mtime, (futimesErr) => {
4135
- fs2.close(fd, (closeErr) => {
4134
+ fs3.futimes(fd, atime, mtime, (futimesErr) => {
4135
+ fs3.close(fd, (closeErr) => {
4136
4136
  if (callback)
4137
4137
  callback(futimesErr || closeErr);
4138
4138
  });
@@ -4140,9 +4140,9 @@ var require_utimes = __commonJS({
4140
4140
  });
4141
4141
  }
4142
4142
  function utimesMillisSync(path2, atime, mtime) {
4143
- const fd = fs2.openSync(path2, "r+");
4144
- fs2.futimesSync(fd, atime, mtime);
4145
- return fs2.closeSync(fd);
4143
+ const fd = fs3.openSync(path2, "r+");
4144
+ fs3.futimesSync(fd, atime, mtime);
4145
+ return fs3.closeSync(fd);
4146
4146
  }
4147
4147
  module2.exports = {
4148
4148
  hasMillisRes,
@@ -4175,7 +4175,7 @@ var require_buffer = __commonJS({
4175
4175
  var require_copy_sync = __commonJS({
4176
4176
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports, module2) {
4177
4177
  "use strict";
4178
- var fs2 = require_graceful_fs();
4178
+ var fs3 = require_graceful_fs();
4179
4179
  var path = require("path");
4180
4180
  var mkdirpSync = require_mkdirs2().mkdirsSync;
4181
4181
  var utimesSync = require_utimes().utimesMillisSync;
@@ -4196,7 +4196,7 @@ var require_copy_sync = __commonJS({
4196
4196
  if (opts.filter && !opts.filter(src, dest))
4197
4197
  return;
4198
4198
  const destParent = path.dirname(dest);
4199
- if (!fs2.existsSync(destParent))
4199
+ if (!fs3.existsSync(destParent))
4200
4200
  mkdirpSync(destParent);
4201
4201
  return startCopy(destStat, src, dest, opts);
4202
4202
  }
@@ -4206,7 +4206,7 @@ var require_copy_sync = __commonJS({
4206
4206
  return getStats(destStat, src, dest, opts);
4207
4207
  }
4208
4208
  function getStats(destStat, src, dest, opts) {
4209
- const statSync = opts.dereference ? fs2.statSync : fs2.lstatSync;
4209
+ const statSync = opts.dereference ? fs3.statSync : fs3.lstatSync;
4210
4210
  const srcStat = statSync(src);
4211
4211
  if (srcStat.isDirectory())
4212
4212
  return onDir(srcStat, destStat, src, dest, opts);
@@ -4222,16 +4222,16 @@ var require_copy_sync = __commonJS({
4222
4222
  }
4223
4223
  function mayCopyFile(srcStat, src, dest, opts) {
4224
4224
  if (opts.overwrite) {
4225
- fs2.unlinkSync(dest);
4225
+ fs3.unlinkSync(dest);
4226
4226
  return copyFile(srcStat, src, dest, opts);
4227
4227
  } else if (opts.errorOnExist) {
4228
4228
  throw new Error(`'${dest}' already exists`);
4229
4229
  }
4230
4230
  }
4231
4231
  function copyFile(srcStat, src, dest, opts) {
4232
- if (typeof fs2.copyFileSync === "function") {
4233
- fs2.copyFileSync(src, dest);
4234
- fs2.chmodSync(dest, srcStat.mode);
4232
+ if (typeof fs3.copyFileSync === "function") {
4233
+ fs3.copyFileSync(src, dest);
4234
+ fs3.chmodSync(dest, srcStat.mode);
4235
4235
  if (opts.preserveTimestamps) {
4236
4236
  return utimesSync(dest, srcStat.atime, srcStat.mtime);
4237
4237
  }
@@ -4242,18 +4242,18 @@ var require_copy_sync = __commonJS({
4242
4242
  function copyFileFallback(srcStat, src, dest, opts) {
4243
4243
  const BUF_LENGTH = 64 * 1024;
4244
4244
  const _buff = require_buffer()(BUF_LENGTH);
4245
- const fdr = fs2.openSync(src, "r");
4246
- const fdw = fs2.openSync(dest, "w", srcStat.mode);
4245
+ const fdr = fs3.openSync(src, "r");
4246
+ const fdw = fs3.openSync(dest, "w", srcStat.mode);
4247
4247
  let pos = 0;
4248
4248
  while (pos < srcStat.size) {
4249
- const bytesRead = fs2.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
4250
- fs2.writeSync(fdw, _buff, 0, bytesRead);
4249
+ const bytesRead = fs3.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
4250
+ fs3.writeSync(fdw, _buff, 0, bytesRead);
4251
4251
  pos += bytesRead;
4252
4252
  }
4253
4253
  if (opts.preserveTimestamps)
4254
- fs2.futimesSync(fdw, srcStat.atime, srcStat.mtime);
4255
- fs2.closeSync(fdr);
4256
- fs2.closeSync(fdw);
4254
+ fs3.futimesSync(fdw, srcStat.atime, srcStat.mtime);
4255
+ fs3.closeSync(fdr);
4256
+ fs3.closeSync(fdw);
4257
4257
  }
4258
4258
  function onDir(srcStat, destStat, src, dest, opts) {
4259
4259
  if (destStat === notExist)
@@ -4264,12 +4264,12 @@ var require_copy_sync = __commonJS({
4264
4264
  return copyDir(src, dest, opts);
4265
4265
  }
4266
4266
  function mkDirAndCopy(srcStat, src, dest, opts) {
4267
- fs2.mkdirSync(dest);
4267
+ fs3.mkdirSync(dest);
4268
4268
  copyDir(src, dest, opts);
4269
- return fs2.chmodSync(dest, srcStat.mode);
4269
+ return fs3.chmodSync(dest, srcStat.mode);
4270
4270
  }
4271
4271
  function copyDir(src, dest, opts) {
4272
- fs2.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
4272
+ fs3.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
4273
4273
  }
4274
4274
  function copyDirItem(item, src, dest, opts) {
4275
4275
  const srcItem = path.join(src, item);
@@ -4278,19 +4278,19 @@ var require_copy_sync = __commonJS({
4278
4278
  return startCopy(destStat, srcItem, destItem, opts);
4279
4279
  }
4280
4280
  function onLink(destStat, src, dest, opts) {
4281
- let resolvedSrc = fs2.readlinkSync(src);
4281
+ let resolvedSrc = fs3.readlinkSync(src);
4282
4282
  if (opts.dereference) {
4283
4283
  resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
4284
4284
  }
4285
4285
  if (destStat === notExist) {
4286
- return fs2.symlinkSync(resolvedSrc, dest);
4286
+ return fs3.symlinkSync(resolvedSrc, dest);
4287
4287
  } else {
4288
4288
  let resolvedDest;
4289
4289
  try {
4290
- resolvedDest = fs2.readlinkSync(dest);
4290
+ resolvedDest = fs3.readlinkSync(dest);
4291
4291
  } catch (err) {
4292
4292
  if (err.code === "EINVAL" || err.code === "UNKNOWN")
4293
- return fs2.symlinkSync(resolvedSrc, dest);
4293
+ return fs3.symlinkSync(resolvedSrc, dest);
4294
4294
  throw err;
4295
4295
  }
4296
4296
  if (opts.dereference) {
@@ -4299,15 +4299,15 @@ var require_copy_sync = __commonJS({
4299
4299
  if (isSrcSubdir(resolvedSrc, resolvedDest)) {
4300
4300
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
4301
4301
  }
4302
- if (fs2.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
4302
+ if (fs3.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
4303
4303
  throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
4304
4304
  }
4305
4305
  return copyLink(resolvedSrc, dest);
4306
4306
  }
4307
4307
  }
4308
4308
  function copyLink(resolvedSrc, dest) {
4309
- fs2.unlinkSync(dest);
4310
- return fs2.symlinkSync(resolvedSrc, dest);
4309
+ fs3.unlinkSync(dest);
4310
+ return fs3.symlinkSync(resolvedSrc, dest);
4311
4311
  }
4312
4312
  function isSrcSubdir(src, dest) {
4313
4313
  const srcArray = path.resolve(src).split(path.sep);
@@ -4315,10 +4315,10 @@ var require_copy_sync = __commonJS({
4315
4315
  return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
4316
4316
  }
4317
4317
  function checkStats(src, dest) {
4318
- const srcStat = fs2.statSync(src);
4318
+ const srcStat = fs3.statSync(src);
4319
4319
  let destStat;
4320
4320
  try {
4321
- destStat = fs2.statSync(dest);
4321
+ destStat = fs3.statSync(dest);
4322
4322
  } catch (err) {
4323
4323
  if (err.code === "ENOENT")
4324
4324
  return { srcStat, destStat: notExist };
@@ -4355,13 +4355,13 @@ var require_path_exists = __commonJS({
4355
4355
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
4356
4356
  "use strict";
4357
4357
  var u2 = require_universalify().fromPromise;
4358
- var fs2 = require_fs();
4358
+ var fs3 = require_fs();
4359
4359
  function pathExists5(path) {
4360
- return fs2.access(path).then(() => true).catch(() => false);
4360
+ return fs3.access(path).then(() => true).catch(() => false);
4361
4361
  }
4362
4362
  module2.exports = {
4363
4363
  pathExists: u2(pathExists5),
4364
- pathExistsSync: fs2.existsSync
4364
+ pathExistsSync: fs3.existsSync
4365
4365
  };
4366
4366
  }
4367
4367
  });
@@ -4370,13 +4370,13 @@ var require_path_exists = __commonJS({
4370
4370
  var require_copy = __commonJS({
4371
4371
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
4372
4372
  "use strict";
4373
- var fs2 = require_graceful_fs();
4373
+ var fs3 = require_graceful_fs();
4374
4374
  var path = require("path");
4375
4375
  var mkdirp3 = require_mkdirs2().mkdirs;
4376
4376
  var pathExists5 = require_path_exists().pathExists;
4377
4377
  var utimes = require_utimes().utimesMillis;
4378
4378
  var notExist = Symbol("notExist");
4379
- function copy3(src, dest, opts, cb) {
4379
+ function copy4(src, dest, opts, cb) {
4380
4380
  if (typeof opts === "function" && !cb) {
4381
4381
  cb = opts;
4382
4382
  opts = {};
@@ -4431,7 +4431,7 @@ var require_copy = __commonJS({
4431
4431
  return getStats(destStat, src, dest, opts, cb);
4432
4432
  }
4433
4433
  function getStats(destStat, src, dest, opts, cb) {
4434
- const stat = opts.dereference ? fs2.stat : fs2.lstat;
4434
+ const stat = opts.dereference ? fs3.stat : fs3.lstat;
4435
4435
  stat(src, (err, srcStat) => {
4436
4436
  if (err)
4437
4437
  return cb(err);
@@ -4450,7 +4450,7 @@ var require_copy = __commonJS({
4450
4450
  }
4451
4451
  function mayCopyFile(srcStat, src, dest, opts, cb) {
4452
4452
  if (opts.overwrite) {
4453
- fs2.unlink(dest, (err) => {
4453
+ fs3.unlink(dest, (err) => {
4454
4454
  if (err)
4455
4455
  return cb(err);
4456
4456
  return copyFile(srcStat, src, dest, opts, cb);
@@ -4461,8 +4461,8 @@ var require_copy = __commonJS({
4461
4461
  return cb();
4462
4462
  }
4463
4463
  function copyFile(srcStat, src, dest, opts, cb) {
4464
- if (typeof fs2.copyFile === "function") {
4465
- return fs2.copyFile(src, dest, (err) => {
4464
+ if (typeof fs3.copyFile === "function") {
4465
+ return fs3.copyFile(src, dest, (err) => {
4466
4466
  if (err)
4467
4467
  return cb(err);
4468
4468
  return setDestModeAndTimestamps(srcStat, dest, opts, cb);
@@ -4471,14 +4471,14 @@ var require_copy = __commonJS({
4471
4471
  return copyFileFallback(srcStat, src, dest, opts, cb);
4472
4472
  }
4473
4473
  function copyFileFallback(srcStat, src, dest, opts, cb) {
4474
- const rs2 = fs2.createReadStream(src);
4474
+ const rs2 = fs3.createReadStream(src);
4475
4475
  rs2.on("error", (err) => cb(err)).once("open", () => {
4476
- const ws2 = fs2.createWriteStream(dest, { mode: srcStat.mode });
4476
+ const ws2 = fs3.createWriteStream(dest, { mode: srcStat.mode });
4477
4477
  ws2.on("error", (err) => cb(err)).on("open", () => rs2.pipe(ws2)).once("close", () => setDestModeAndTimestamps(srcStat, dest, opts, cb));
4478
4478
  });
4479
4479
  }
4480
4480
  function setDestModeAndTimestamps(srcStat, dest, opts, cb) {
4481
- fs2.chmod(dest, srcStat.mode, (err) => {
4481
+ fs3.chmod(dest, srcStat.mode, (err) => {
4482
4482
  if (err)
4483
4483
  return cb(err);
4484
4484
  if (opts.preserveTimestamps) {
@@ -4496,18 +4496,18 @@ var require_copy = __commonJS({
4496
4496
  return copyDir(src, dest, opts, cb);
4497
4497
  }
4498
4498
  function mkDirAndCopy(srcStat, src, dest, opts, cb) {
4499
- fs2.mkdir(dest, (err) => {
4499
+ fs3.mkdir(dest, (err) => {
4500
4500
  if (err)
4501
4501
  return cb(err);
4502
4502
  copyDir(src, dest, opts, (err2) => {
4503
4503
  if (err2)
4504
4504
  return cb(err2);
4505
- return fs2.chmod(dest, srcStat.mode, cb);
4505
+ return fs3.chmod(dest, srcStat.mode, cb);
4506
4506
  });
4507
4507
  });
4508
4508
  }
4509
4509
  function copyDir(src, dest, opts, cb) {
4510
- fs2.readdir(src, (err, items) => {
4510
+ fs3.readdir(src, (err, items) => {
4511
4511
  if (err)
4512
4512
  return cb(err);
4513
4513
  return copyDirItems(items, src, dest, opts, cb);
@@ -4533,19 +4533,19 @@ var require_copy = __commonJS({
4533
4533
  });
4534
4534
  }
4535
4535
  function onLink(destStat, src, dest, opts, cb) {
4536
- fs2.readlink(src, (err, resolvedSrc) => {
4536
+ fs3.readlink(src, (err, resolvedSrc) => {
4537
4537
  if (err)
4538
4538
  return cb(err);
4539
4539
  if (opts.dereference) {
4540
4540
  resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
4541
4541
  }
4542
4542
  if (destStat === notExist) {
4543
- return fs2.symlink(resolvedSrc, dest, cb);
4543
+ return fs3.symlink(resolvedSrc, dest, cb);
4544
4544
  } else {
4545
- fs2.readlink(dest, (err2, resolvedDest) => {
4545
+ fs3.readlink(dest, (err2, resolvedDest) => {
4546
4546
  if (err2) {
4547
4547
  if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
4548
- return fs2.symlink(resolvedSrc, dest, cb);
4548
+ return fs3.symlink(resolvedSrc, dest, cb);
4549
4549
  return cb(err2);
4550
4550
  }
4551
4551
  if (opts.dereference) {
@@ -4563,10 +4563,10 @@ var require_copy = __commonJS({
4563
4563
  });
4564
4564
  }
4565
4565
  function copyLink(resolvedSrc, dest, cb) {
4566
- fs2.unlink(dest, (err) => {
4566
+ fs3.unlink(dest, (err) => {
4567
4567
  if (err)
4568
4568
  return cb(err);
4569
- return fs2.symlink(resolvedSrc, dest, cb);
4569
+ return fs3.symlink(resolvedSrc, dest, cb);
4570
4570
  });
4571
4571
  }
4572
4572
  function isSrcSubdir(src, dest) {
@@ -4575,10 +4575,10 @@ var require_copy = __commonJS({
4575
4575
  return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
4576
4576
  }
4577
4577
  function checkStats(src, dest, cb) {
4578
- fs2.stat(src, (err, srcStat) => {
4578
+ fs3.stat(src, (err, srcStat) => {
4579
4579
  if (err)
4580
4580
  return cb(err);
4581
- fs2.stat(dest, (err2, destStat) => {
4581
+ fs3.stat(dest, (err2, destStat) => {
4582
4582
  if (err2) {
4583
4583
  if (err2.code === "ENOENT")
4584
4584
  return cb(null, { srcStat, destStat: notExist });
@@ -4602,7 +4602,7 @@ var require_copy = __commonJS({
4602
4602
  return cb(null, destStat);
4603
4603
  });
4604
4604
  }
4605
- module2.exports = copy3;
4605
+ module2.exports = copy4;
4606
4606
  }
4607
4607
  });
4608
4608
 
@@ -4621,7 +4621,7 @@ var require_copy2 = __commonJS({
4621
4621
  var require_rimraf = __commonJS({
4622
4622
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/remove/rimraf.js"(exports, module2) {
4623
4623
  "use strict";
4624
- var fs2 = require_graceful_fs();
4624
+ var fs3 = require_graceful_fs();
4625
4625
  var path = require("path");
4626
4626
  var assert = require("assert");
4627
4627
  var isWindows = process.platform === "win32";
@@ -4635,9 +4635,9 @@ var require_rimraf = __commonJS({
4635
4635
  "readdir"
4636
4636
  ];
4637
4637
  methods.forEach((m2) => {
4638
- options[m2] = options[m2] || fs2[m2];
4638
+ options[m2] = options[m2] || fs3[m2];
4639
4639
  m2 = m2 + "Sync";
4640
- options[m2] = options[m2] || fs2[m2];
4640
+ options[m2] = options[m2] || fs3[m2];
4641
4641
  });
4642
4642
  options.maxBusyTries = options.maxBusyTries || 3;
4643
4643
  }
@@ -4886,14 +4886,14 @@ var require_empty = __commonJS({
4886
4886
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
4887
4887
  "use strict";
4888
4888
  var u2 = require_universalify().fromCallback;
4889
- var fs2 = require("fs");
4889
+ var fs3 = require("fs");
4890
4890
  var path = require("path");
4891
4891
  var mkdir = require_mkdirs2();
4892
4892
  var remove3 = require_remove();
4893
4893
  var emptyDir = u2(function emptyDir2(dir, callback) {
4894
4894
  callback = callback || function() {
4895
4895
  };
4896
- fs2.readdir(dir, (err, items) => {
4896
+ fs3.readdir(dir, (err, items) => {
4897
4897
  if (err)
4898
4898
  return mkdir.mkdirs(dir, callback);
4899
4899
  items = items.map((item) => path.join(dir, item));
@@ -4913,7 +4913,7 @@ var require_empty = __commonJS({
4913
4913
  function emptyDirSync(dir) {
4914
4914
  let items;
4915
4915
  try {
4916
- items = fs2.readdirSync(dir);
4916
+ items = fs3.readdirSync(dir);
4917
4917
  } catch (err) {
4918
4918
  return mkdir.mkdirsSync(dir);
4919
4919
  }
@@ -4937,18 +4937,18 @@ var require_file = __commonJS({
4937
4937
  "use strict";
4938
4938
  var u2 = require_universalify().fromCallback;
4939
4939
  var path = require("path");
4940
- var fs2 = require_graceful_fs();
4940
+ var fs3 = require_graceful_fs();
4941
4941
  var mkdir = require_mkdirs2();
4942
4942
  var pathExists5 = require_path_exists().pathExists;
4943
4943
  function createFile(file, callback) {
4944
4944
  function makeFile() {
4945
- fs2.writeFile(file, "", (err) => {
4945
+ fs3.writeFile(file, "", (err) => {
4946
4946
  if (err)
4947
4947
  return callback(err);
4948
4948
  callback();
4949
4949
  });
4950
4950
  }
4951
- fs2.stat(file, (err, stats) => {
4951
+ fs3.stat(file, (err, stats) => {
4952
4952
  if (!err && stats.isFile())
4953
4953
  return callback();
4954
4954
  const dir = path.dirname(file);
@@ -4968,16 +4968,16 @@ var require_file = __commonJS({
4968
4968
  function createFileSync(file) {
4969
4969
  let stats;
4970
4970
  try {
4971
- stats = fs2.statSync(file);
4971
+ stats = fs3.statSync(file);
4972
4972
  } catch (e) {
4973
4973
  }
4974
4974
  if (stats && stats.isFile())
4975
4975
  return;
4976
4976
  const dir = path.dirname(file);
4977
- if (!fs2.existsSync(dir)) {
4977
+ if (!fs3.existsSync(dir)) {
4978
4978
  mkdir.mkdirsSync(dir);
4979
4979
  }
4980
- fs2.writeFileSync(file, "");
4980
+ fs3.writeFileSync(file, "");
4981
4981
  }
4982
4982
  module2.exports = {
4983
4983
  createFile: u2(createFile),
@@ -4992,12 +4992,12 @@ var require_link = __commonJS({
4992
4992
  "use strict";
4993
4993
  var u2 = require_universalify().fromCallback;
4994
4994
  var path = require("path");
4995
- var fs2 = require_graceful_fs();
4995
+ var fs3 = require_graceful_fs();
4996
4996
  var mkdir = require_mkdirs2();
4997
4997
  var pathExists5 = require_path_exists().pathExists;
4998
4998
  function createLink(srcpath, dstpath, callback) {
4999
4999
  function makeLink(srcpath2, dstpath2) {
5000
- fs2.link(srcpath2, dstpath2, (err) => {
5000
+ fs3.link(srcpath2, dstpath2, (err) => {
5001
5001
  if (err)
5002
5002
  return callback(err);
5003
5003
  callback(null);
@@ -5008,7 +5008,7 @@ var require_link = __commonJS({
5008
5008
  return callback(err);
5009
5009
  if (destinationExists)
5010
5010
  return callback(null);
5011
- fs2.lstat(srcpath, (err2) => {
5011
+ fs3.lstat(srcpath, (err2) => {
5012
5012
  if (err2) {
5013
5013
  err2.message = err2.message.replace("lstat", "ensureLink");
5014
5014
  return callback(err2);
@@ -5029,21 +5029,21 @@ var require_link = __commonJS({
5029
5029
  });
5030
5030
  }
5031
5031
  function createLinkSync(srcpath, dstpath) {
5032
- const destinationExists = fs2.existsSync(dstpath);
5032
+ const destinationExists = fs3.existsSync(dstpath);
5033
5033
  if (destinationExists)
5034
5034
  return void 0;
5035
5035
  try {
5036
- fs2.lstatSync(srcpath);
5036
+ fs3.lstatSync(srcpath);
5037
5037
  } catch (err) {
5038
5038
  err.message = err.message.replace("lstat", "ensureLink");
5039
5039
  throw err;
5040
5040
  }
5041
5041
  const dir = path.dirname(dstpath);
5042
- const dirExists = fs2.existsSync(dir);
5042
+ const dirExists = fs3.existsSync(dir);
5043
5043
  if (dirExists)
5044
- return fs2.linkSync(srcpath, dstpath);
5044
+ return fs3.linkSync(srcpath, dstpath);
5045
5045
  mkdir.mkdirsSync(dir);
5046
- return fs2.linkSync(srcpath, dstpath);
5046
+ return fs3.linkSync(srcpath, dstpath);
5047
5047
  }
5048
5048
  module2.exports = {
5049
5049
  createLink: u2(createLink),
@@ -5057,11 +5057,11 @@ var require_symlink_paths = __commonJS({
5057
5057
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
5058
5058
  "use strict";
5059
5059
  var path = require("path");
5060
- var fs2 = require_graceful_fs();
5060
+ var fs3 = require_graceful_fs();
5061
5061
  var pathExists5 = require_path_exists().pathExists;
5062
5062
  function symlinkPaths(srcpath, dstpath, callback) {
5063
5063
  if (path.isAbsolute(srcpath)) {
5064
- return fs2.lstat(srcpath, (err) => {
5064
+ return fs3.lstat(srcpath, (err) => {
5065
5065
  if (err) {
5066
5066
  err.message = err.message.replace("lstat", "ensureSymlink");
5067
5067
  return callback(err);
@@ -5083,7 +5083,7 @@ var require_symlink_paths = __commonJS({
5083
5083
  "toDst": srcpath
5084
5084
  });
5085
5085
  } else {
5086
- return fs2.lstat(srcpath, (err2) => {
5086
+ return fs3.lstat(srcpath, (err2) => {
5087
5087
  if (err2) {
5088
5088
  err2.message = err2.message.replace("lstat", "ensureSymlink");
5089
5089
  return callback(err2);
@@ -5100,7 +5100,7 @@ var require_symlink_paths = __commonJS({
5100
5100
  function symlinkPathsSync(srcpath, dstpath) {
5101
5101
  let exists;
5102
5102
  if (path.isAbsolute(srcpath)) {
5103
- exists = fs2.existsSync(srcpath);
5103
+ exists = fs3.existsSync(srcpath);
5104
5104
  if (!exists)
5105
5105
  throw new Error("absolute srcpath does not exist");
5106
5106
  return {
@@ -5110,14 +5110,14 @@ var require_symlink_paths = __commonJS({
5110
5110
  } else {
5111
5111
  const dstdir = path.dirname(dstpath);
5112
5112
  const relativeToDst = path.join(dstdir, srcpath);
5113
- exists = fs2.existsSync(relativeToDst);
5113
+ exists = fs3.existsSync(relativeToDst);
5114
5114
  if (exists) {
5115
5115
  return {
5116
5116
  "toCwd": relativeToDst,
5117
5117
  "toDst": srcpath
5118
5118
  };
5119
5119
  } else {
5120
- exists = fs2.existsSync(srcpath);
5120
+ exists = fs3.existsSync(srcpath);
5121
5121
  if (!exists)
5122
5122
  throw new Error("relative srcpath does not exist");
5123
5123
  return {
@@ -5138,13 +5138,13 @@ var require_symlink_paths = __commonJS({
5138
5138
  var require_symlink_type = __commonJS({
5139
5139
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
5140
5140
  "use strict";
5141
- var fs2 = require_graceful_fs();
5141
+ var fs3 = require_graceful_fs();
5142
5142
  function symlinkType(srcpath, type, callback) {
5143
5143
  callback = typeof type === "function" ? type : callback;
5144
5144
  type = typeof type === "function" ? false : type;
5145
5145
  if (type)
5146
5146
  return callback(null, type);
5147
- fs2.lstat(srcpath, (err, stats) => {
5147
+ fs3.lstat(srcpath, (err, stats) => {
5148
5148
  if (err)
5149
5149
  return callback(null, "file");
5150
5150
  type = stats && stats.isDirectory() ? "dir" : "file";
@@ -5156,7 +5156,7 @@ var require_symlink_type = __commonJS({
5156
5156
  if (type)
5157
5157
  return type;
5158
5158
  try {
5159
- stats = fs2.lstatSync(srcpath);
5159
+ stats = fs3.lstatSync(srcpath);
5160
5160
  } catch (e) {
5161
5161
  return "file";
5162
5162
  }
@@ -5175,7 +5175,7 @@ var require_symlink = __commonJS({
5175
5175
  "use strict";
5176
5176
  var u2 = require_universalify().fromCallback;
5177
5177
  var path = require("path");
5178
- var fs2 = require_graceful_fs();
5178
+ var fs3 = require_graceful_fs();
5179
5179
  var _mkdirs = require_mkdirs2();
5180
5180
  var mkdirs = _mkdirs.mkdirs;
5181
5181
  var mkdirsSync = _mkdirs.mkdirsSync;
@@ -5206,11 +5206,11 @@ var require_symlink = __commonJS({
5206
5206
  if (err4)
5207
5207
  return callback(err4);
5208
5208
  if (dirExists)
5209
- return fs2.symlink(srcpath, dstpath, type2, callback);
5209
+ return fs3.symlink(srcpath, dstpath, type2, callback);
5210
5210
  mkdirs(dir, (err5) => {
5211
5211
  if (err5)
5212
5212
  return callback(err5);
5213
- fs2.symlink(srcpath, dstpath, type2, callback);
5213
+ fs3.symlink(srcpath, dstpath, type2, callback);
5214
5214
  });
5215
5215
  });
5216
5216
  });
@@ -5218,18 +5218,18 @@ var require_symlink = __commonJS({
5218
5218
  });
5219
5219
  }
5220
5220
  function createSymlinkSync(srcpath, dstpath, type) {
5221
- const destinationExists = fs2.existsSync(dstpath);
5221
+ const destinationExists = fs3.existsSync(dstpath);
5222
5222
  if (destinationExists)
5223
5223
  return void 0;
5224
5224
  const relative2 = symlinkPathsSync(srcpath, dstpath);
5225
5225
  srcpath = relative2.toDst;
5226
5226
  type = symlinkTypeSync(relative2.toCwd, type);
5227
5227
  const dir = path.dirname(dstpath);
5228
- const exists = fs2.existsSync(dir);
5228
+ const exists = fs3.existsSync(dir);
5229
5229
  if (exists)
5230
- return fs2.symlinkSync(srcpath, dstpath, type);
5230
+ return fs3.symlinkSync(srcpath, dstpath, type);
5231
5231
  mkdirsSync(dir);
5232
- return fs2.symlinkSync(srcpath, dstpath, type);
5232
+ return fs3.symlinkSync(srcpath, dstpath, type);
5233
5233
  }
5234
5234
  module2.exports = {
5235
5235
  createSymlink: u2(createSymlink),
@@ -5283,12 +5283,12 @@ var require_jsonfile = __commonJS({
5283
5283
  options = { encoding: options };
5284
5284
  }
5285
5285
  options = options || {};
5286
- var fs2 = options.fs || _fs;
5286
+ var fs3 = options.fs || _fs;
5287
5287
  var shouldThrow = true;
5288
5288
  if ("throws" in options) {
5289
5289
  shouldThrow = options.throws;
5290
5290
  }
5291
- fs2.readFile(file, options, function(err, data) {
5291
+ fs3.readFile(file, options, function(err, data) {
5292
5292
  if (err)
5293
5293
  return callback(err);
5294
5294
  data = stripBom(data);
@@ -5311,13 +5311,13 @@ var require_jsonfile = __commonJS({
5311
5311
  if (typeof options === "string") {
5312
5312
  options = { encoding: options };
5313
5313
  }
5314
- var fs2 = options.fs || _fs;
5314
+ var fs3 = options.fs || _fs;
5315
5315
  var shouldThrow = true;
5316
5316
  if ("throws" in options) {
5317
5317
  shouldThrow = options.throws;
5318
5318
  }
5319
5319
  try {
5320
- var content = fs2.readFileSync(file, options);
5320
+ var content = fs3.readFileSync(file, options);
5321
5321
  content = stripBom(content);
5322
5322
  return JSON.parse(content, options.reviver);
5323
5323
  } catch (err) {
@@ -5349,7 +5349,7 @@ var require_jsonfile = __commonJS({
5349
5349
  options = {};
5350
5350
  }
5351
5351
  options = options || {};
5352
- var fs2 = options.fs || _fs;
5352
+ var fs3 = options.fs || _fs;
5353
5353
  var str = "";
5354
5354
  try {
5355
5355
  str = stringify(obj, options);
@@ -5358,13 +5358,13 @@ var require_jsonfile = __commonJS({
5358
5358
  callback(err, null);
5359
5359
  return;
5360
5360
  }
5361
- fs2.writeFile(file, str, options, callback);
5361
+ fs3.writeFile(file, str, options, callback);
5362
5362
  }
5363
5363
  function writeFileSync(file, obj, options) {
5364
5364
  options = options || {};
5365
- var fs2 = options.fs || _fs;
5365
+ var fs3 = options.fs || _fs;
5366
5366
  var str = stringify(obj, options);
5367
- return fs2.writeFileSync(file, str, options);
5367
+ return fs3.writeFileSync(file, str, options);
5368
5368
  }
5369
5369
  function stripBom(content) {
5370
5370
  if (Buffer.isBuffer(content))
@@ -5432,13 +5432,13 @@ var require_output_json = __commonJS({
5432
5432
  var require_output_json_sync = __commonJS({
5433
5433
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
5434
5434
  "use strict";
5435
- var fs2 = require_graceful_fs();
5435
+ var fs3 = require_graceful_fs();
5436
5436
  var path = require("path");
5437
5437
  var mkdir = require_mkdirs2();
5438
5438
  var jsonFile = require_jsonfile2();
5439
5439
  function outputJsonSync(file, data, options) {
5440
5440
  const dir = path.dirname(file);
5441
- if (!fs2.existsSync(dir)) {
5441
+ if (!fs3.existsSync(dir)) {
5442
5442
  mkdir.mkdirsSync(dir);
5443
5443
  }
5444
5444
  jsonFile.writeJsonSync(file, data, options);
@@ -5469,7 +5469,7 @@ var require_json = __commonJS({
5469
5469
  var require_move_sync = __commonJS({
5470
5470
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/move-sync/index.js"(exports, module2) {
5471
5471
  "use strict";
5472
- var fs2 = require_graceful_fs();
5472
+ var fs3 = require_graceful_fs();
5473
5473
  var path = require("path");
5474
5474
  var copySync = require_copy_sync2().copySync;
5475
5475
  var removeSync = require_remove().removeSync;
@@ -5481,7 +5481,7 @@ var require_move_sync = __commonJS({
5481
5481
  src = path.resolve(src);
5482
5482
  dest = path.resolve(dest);
5483
5483
  if (src === dest)
5484
- return fs2.accessSync(src);
5484
+ return fs3.accessSync(src);
5485
5485
  if (isSrcSubdir(src, dest))
5486
5486
  throw new Error(`Cannot move '${src}' into itself '${dest}'.`);
5487
5487
  mkdirpSync(path.dirname(dest));
@@ -5489,7 +5489,7 @@ var require_move_sync = __commonJS({
5489
5489
  function tryRenameSync() {
5490
5490
  if (overwrite) {
5491
5491
  try {
5492
- return fs2.renameSync(src, dest);
5492
+ return fs3.renameSync(src, dest);
5493
5493
  } catch (err) {
5494
5494
  if (err.code === "ENOTEMPTY" || err.code === "EEXIST" || err.code === "EPERM") {
5495
5495
  removeSync(dest);
@@ -5502,8 +5502,8 @@ var require_move_sync = __commonJS({
5502
5502
  }
5503
5503
  } else {
5504
5504
  try {
5505
- fs2.linkSync(src, dest);
5506
- return fs2.unlinkSync(src);
5505
+ fs3.linkSync(src, dest);
5506
+ return fs3.unlinkSync(src);
5507
5507
  } catch (err) {
5508
5508
  if (err.code === "EXDEV" || err.code === "EISDIR" || err.code === "EPERM" || err.code === "ENOTSUP") {
5509
5509
  return moveSyncAcrossDevice(src, dest, overwrite);
@@ -5514,7 +5514,7 @@ var require_move_sync = __commonJS({
5514
5514
  }
5515
5515
  }
5516
5516
  function moveSyncAcrossDevice(src, dest, overwrite) {
5517
- const stat = fs2.statSync(src);
5517
+ const stat = fs3.statSync(src);
5518
5518
  if (stat.isDirectory()) {
5519
5519
  return moveDirSyncAcrossDevice(src, dest, overwrite);
5520
5520
  } else {
@@ -5525,18 +5525,18 @@ var require_move_sync = __commonJS({
5525
5525
  const BUF_LENGTH = 64 * 1024;
5526
5526
  const _buff = buffer(BUF_LENGTH);
5527
5527
  const flags = overwrite ? "w" : "wx";
5528
- const fdr = fs2.openSync(src, "r");
5529
- const stat = fs2.fstatSync(fdr);
5530
- const fdw = fs2.openSync(dest, flags, stat.mode);
5528
+ const fdr = fs3.openSync(src, "r");
5529
+ const stat = fs3.fstatSync(fdr);
5530
+ const fdw = fs3.openSync(dest, flags, stat.mode);
5531
5531
  let pos = 0;
5532
5532
  while (pos < stat.size) {
5533
- const bytesRead = fs2.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
5534
- fs2.writeSync(fdw, _buff, 0, bytesRead);
5533
+ const bytesRead = fs3.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
5534
+ fs3.writeSync(fdw, _buff, 0, bytesRead);
5535
5535
  pos += bytesRead;
5536
5536
  }
5537
- fs2.closeSync(fdr);
5538
- fs2.closeSync(fdw);
5539
- return fs2.unlinkSync(src);
5537
+ fs3.closeSync(fdr);
5538
+ fs3.closeSync(fdw);
5539
+ return fs3.unlinkSync(src);
5540
5540
  }
5541
5541
  function moveDirSyncAcrossDevice(src, dest, overwrite) {
5542
5542
  const options = {
@@ -5555,7 +5555,7 @@ var require_move_sync = __commonJS({
5555
5555
  }
5556
5556
  function isSrcSubdir(src, dest) {
5557
5557
  try {
5558
- return fs2.statSync(src).isDirectory() && src !== dest && dest.indexOf(src) > -1 && dest.split(path.dirname(src) + path.sep)[1].split(path.sep)[0] === path.basename(src);
5558
+ return fs3.statSync(src).isDirectory() && src !== dest && dest.indexOf(src) > -1 && dest.split(path.dirname(src) + path.sep)[1].split(path.sep)[0] === path.basename(src);
5559
5559
  } catch (e) {
5560
5560
  return false;
5561
5561
  }
@@ -5571,9 +5571,9 @@ var require_move = __commonJS({
5571
5571
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
5572
5572
  "use strict";
5573
5573
  var u2 = require_universalify().fromCallback;
5574
- var fs2 = require_graceful_fs();
5574
+ var fs3 = require_graceful_fs();
5575
5575
  var path = require("path");
5576
- var copy3 = require_copy2().copy;
5576
+ var copy4 = require_copy2().copy;
5577
5577
  var remove3 = require_remove().remove;
5578
5578
  var mkdirp3 = require_mkdirs2().mkdirp;
5579
5579
  var pathExists5 = require_path_exists().pathExists;
@@ -5586,8 +5586,8 @@ var require_move = __commonJS({
5586
5586
  src = path.resolve(src);
5587
5587
  dest = path.resolve(dest);
5588
5588
  if (src === dest)
5589
- return fs2.access(src, cb);
5590
- fs2.stat(src, (err, st2) => {
5589
+ return fs3.access(src, cb);
5590
+ fs3.stat(src, (err, st2) => {
5591
5591
  if (err)
5592
5592
  return cb(err);
5593
5593
  if (st2.isDirectory() && isSrcSubdir(src, dest)) {
@@ -5617,7 +5617,7 @@ var require_move = __commonJS({
5617
5617
  });
5618
5618
  }
5619
5619
  function rename(src, dest, overwrite, cb) {
5620
- fs2.rename(src, dest, (err) => {
5620
+ fs3.rename(src, dest, (err) => {
5621
5621
  if (!err)
5622
5622
  return cb();
5623
5623
  if (err.code !== "EXDEV")
@@ -5630,7 +5630,7 @@ var require_move = __commonJS({
5630
5630
  overwrite,
5631
5631
  errorOnExist: true
5632
5632
  };
5633
- copy3(src, dest, opts, (err) => {
5633
+ copy4(src, dest, opts, (err) => {
5634
5634
  if (err)
5635
5635
  return cb(err);
5636
5636
  return remove3(src, cb);
@@ -5654,7 +5654,7 @@ var require_output = __commonJS({
5654
5654
  "../../node_modules/.pnpm/fs-extra@7.0.1/node_modules/fs-extra/lib/output/index.js"(exports, module2) {
5655
5655
  "use strict";
5656
5656
  var u2 = require_universalify().fromCallback;
5657
- var fs2 = require_graceful_fs();
5657
+ var fs3 = require_graceful_fs();
5658
5658
  var path = require("path");
5659
5659
  var mkdir = require_mkdirs2();
5660
5660
  var pathExists5 = require_path_exists().pathExists;
@@ -5668,21 +5668,21 @@ var require_output = __commonJS({
5668
5668
  if (err)
5669
5669
  return callback(err);
5670
5670
  if (itDoes)
5671
- return fs2.writeFile(file, data, encoding, callback);
5671
+ return fs3.writeFile(file, data, encoding, callback);
5672
5672
  mkdir.mkdirs(dir, (err2) => {
5673
5673
  if (err2)
5674
5674
  return callback(err2);
5675
- fs2.writeFile(file, data, encoding, callback);
5675
+ fs3.writeFile(file, data, encoding, callback);
5676
5676
  });
5677
5677
  });
5678
5678
  }
5679
5679
  function outputFileSync(file, ...args) {
5680
5680
  const dir = path.dirname(file);
5681
- if (fs2.existsSync(dir)) {
5682
- return fs2.writeFileSync(file, ...args);
5681
+ if (fs3.existsSync(dir)) {
5682
+ return fs3.writeFileSync(file, ...args);
5683
5683
  }
5684
5684
  mkdir.mkdirsSync(dir);
5685
- fs2.writeFileSync(file, ...args);
5685
+ fs3.writeFileSync(file, ...args);
5686
5686
  }
5687
5687
  module2.exports = {
5688
5688
  outputFile: u2(outputFile),
@@ -5712,11 +5712,11 @@ var require_lib2 = __commonJS({
5712
5712
  require_path_exists(),
5713
5713
  require_remove()
5714
5714
  );
5715
- var fs2 = require("fs");
5716
- if (Object.getOwnPropertyDescriptor(fs2, "promises")) {
5715
+ var fs3 = require("fs");
5716
+ if (Object.getOwnPropertyDescriptor(fs3, "promises")) {
5717
5717
  Object.defineProperty(module2.exports, "promises", {
5718
5718
  get() {
5719
- return fs2.promises;
5719
+ return fs3.promises;
5720
5720
  }
5721
5721
  });
5722
5722
  }
@@ -8786,7 +8786,7 @@ var require_pend = __commonJS({
8786
8786
  // ../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js
8787
8787
  var require_fd_slicer = __commonJS({
8788
8788
  "../../node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js"(exports) {
8789
- var fs2 = require("fs");
8789
+ var fs3 = require("fs");
8790
8790
  var util = require("util");
8791
8791
  var stream = require("stream");
8792
8792
  var Readable = stream.Readable;
@@ -8811,7 +8811,7 @@ var require_fd_slicer = __commonJS({
8811
8811
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
8812
8812
  var self = this;
8813
8813
  self.pend.go(function(cb) {
8814
- fs2.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
8814
+ fs3.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
8815
8815
  cb();
8816
8816
  callback(err, bytesRead, buffer2);
8817
8817
  });
@@ -8820,7 +8820,7 @@ var require_fd_slicer = __commonJS({
8820
8820
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
8821
8821
  var self = this;
8822
8822
  self.pend.go(function(cb) {
8823
- fs2.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
8823
+ fs3.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
8824
8824
  cb();
8825
8825
  callback(err, written, buffer2);
8826
8826
  });
@@ -8843,7 +8843,7 @@ var require_fd_slicer = __commonJS({
8843
8843
  if (self.refCount < 0)
8844
8844
  throw new Error("invalid unref");
8845
8845
  if (self.autoClose) {
8846
- fs2.close(self.fd, onCloseDone);
8846
+ fs3.close(self.fd, onCloseDone);
8847
8847
  }
8848
8848
  function onCloseDone(err) {
8849
8849
  if (err) {
@@ -8882,7 +8882,7 @@ var require_fd_slicer = __commonJS({
8882
8882
  if (self.destroyed)
8883
8883
  return cb();
8884
8884
  var buffer = new Buffer(toRead);
8885
- fs2.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
8885
+ fs3.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
8886
8886
  if (err) {
8887
8887
  self.destroy(err);
8888
8888
  } else if (bytesRead === 0) {
@@ -8932,7 +8932,7 @@ var require_fd_slicer = __commonJS({
8932
8932
  self.context.pend.go(function(cb) {
8933
8933
  if (self.destroyed)
8934
8934
  return cb();
8935
- fs2.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
8935
+ fs3.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
8936
8936
  if (err2) {
8937
8937
  self.destroy();
8938
8938
  cb();
@@ -9361,7 +9361,7 @@ var require_buffer_crc32 = __commonJS({
9361
9361
  // ../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js
9362
9362
  var require_yauzl = __commonJS({
9363
9363
  "../../node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js"(exports) {
9364
- var fs2 = require("fs");
9364
+ var fs3 = require("fs");
9365
9365
  var zlib = require("zlib");
9366
9366
  var fd_slicer = require_fd_slicer();
9367
9367
  var crc32 = require_buffer_crc32();
@@ -9398,12 +9398,12 @@ var require_yauzl = __commonJS({
9398
9398
  options.strictFileNames = false;
9399
9399
  if (callback == null)
9400
9400
  callback = defaultCallback;
9401
- fs2.open(path, "r", function(err, fd) {
9401
+ fs3.open(path, "r", function(err, fd) {
9402
9402
  if (err)
9403
9403
  return callback(err);
9404
9404
  fromFd(fd, options, function(err2, zipfile) {
9405
9405
  if (err2)
9406
- fs2.close(fd, defaultCallback);
9406
+ fs3.close(fd, defaultCallback);
9407
9407
  callback(err2, zipfile);
9408
9408
  });
9409
9409
  });
@@ -9427,7 +9427,7 @@ var require_yauzl = __commonJS({
9427
9427
  options.strictFileNames = false;
9428
9428
  if (callback == null)
9429
9429
  callback = defaultCallback;
9430
- fs2.fstat(fd, function(err, stats) {
9430
+ fs3.fstat(fd, function(err, stats) {
9431
9431
  if (err)
9432
9432
  return callback(err);
9433
9433
  var reader = fd_slicer.createFromFd(fd, { autoClose: true });
@@ -10883,9 +10883,10 @@ __export(src_exports, {
10883
10883
  build: () => build,
10884
10884
  detectEntrypoint: () => detectEntrypoint,
10885
10885
  detectGoEntrypoint: () => detectGoEntrypoint,
10886
+ diagnostics: () => diagnostics,
10886
10887
  getNewHandlerFunctionName: () => getNewHandlerFunctionName,
10887
10888
  prepareCache: () => prepareCache,
10888
- shouldServe: () => import_build_utils4.shouldServe,
10889
+ shouldServe: () => import_build_utils5.shouldServe,
10889
10890
  startDevServer: () => startDevServer,
10890
10891
  version: () => version
10891
10892
  });
@@ -10897,7 +10898,7 @@ var import_child_process2 = require("child_process");
10897
10898
  var import_once = __toESM(require_dist());
10898
10899
  var import_path7 = require("path");
10899
10900
  var import_fs_extra4 = __toESM(require_lib2());
10900
- var import_build_utils4 = require("@vercel/build-utils");
10901
+ var import_build_utils5 = require("@vercel/build-utils");
10901
10902
 
10902
10903
  // src/go-helpers.ts
10903
10904
  var import_crypto = require("crypto");
@@ -14120,6 +14121,7 @@ var wo = (s3) => {
14120
14121
  var import_execa = __toESM(require_execa());
14121
14122
  var import_node_fetch = __toESM(require_lib4());
14122
14123
  var import_fs_extra = __toESM(require_lib2());
14124
+ var import_fs5 = __toESM(require("fs"));
14123
14125
  var import_path4 = require("path");
14124
14126
  var import_string_argv = __toESM(require_string_argv());
14125
14127
  var import_build_utils = require("@vercel/build-utils");
@@ -14254,12 +14256,13 @@ Learn more: https://vercel.com/docs/functions/serverless-functions/runtimes/go
14254
14256
  return JSON.parse(analyzed);
14255
14257
  }
14256
14258
  var GoWrapper = class {
14257
- constructor(env, opts = {}) {
14259
+ constructor(env, opts = {}, resolvedVersion) {
14258
14260
  if (!opts.cwd) {
14259
14261
  opts.cwd = process.cwd();
14260
14262
  }
14261
14263
  this.env = env;
14262
14264
  this.opts = opts;
14265
+ this.resolvedVersion = resolvedVersion;
14263
14266
  }
14264
14267
  async execute(...args) {
14265
14268
  const { opts, env } = this;
@@ -14293,6 +14296,24 @@ var GoWrapper = class {
14293
14296
  }
14294
14297
  return this.execute(...args);
14295
14298
  }
14299
+ /**
14300
+ * Runs `go mod edit -json <path>` and returns the parsed structure.
14301
+ */
14302
+ async modEditJson(goModPath) {
14303
+ try {
14304
+ (0, import_build_utils.debug)(`Exec: go mod edit -json ${goModPath}`);
14305
+ const result = await (0, import_execa.default)("go", ["mod", "edit", "-json", goModPath], {
14306
+ ...this.opts,
14307
+ env: this.env,
14308
+ extendEnv: false,
14309
+ stdio: ["ignore", "pipe", "pipe"]
14310
+ });
14311
+ return JSON.parse(result.stdout);
14312
+ } catch (err) {
14313
+ (0, import_build_utils.debug)(`Failed to read go.mod for manifest: ${err}`);
14314
+ return null;
14315
+ }
14316
+ }
14296
14317
  vendor() {
14297
14318
  return this.execute("mod", "vendor");
14298
14319
  }
@@ -14306,6 +14327,9 @@ var GoWrapper = class {
14306
14327
  }
14307
14328
  return this.execute(...args);
14308
14329
  }
14330
+ getEnv() {
14331
+ return this.env;
14332
+ }
14309
14333
  build(src, dest, { vendorMode = false } = {}) {
14310
14334
  (0, import_build_utils.debug)(`Building optimized 'go' binary ${src} -> ${dest}`);
14311
14335
  const sources = Array.isArray(src) ? src : [src];
@@ -14407,7 +14431,7 @@ async function createGo({
14407
14431
  if (version2 === goSelectedVersion || short === goSelectedVersion) {
14408
14432
  (0, import_build_utils.debug)(`Selected go ${version2} (from ${label})`);
14409
14433
  await setGoEnv(goDir);
14410
- return new GoWrapper(env, opts);
14434
+ return new GoWrapper(env, opts, version2);
14411
14435
  } else {
14412
14436
  (0, import_build_utils.debug)(`Found go ${version2} in ${label}, but need ${goSelectedVersion}`);
14413
14437
  }
@@ -14420,7 +14444,7 @@ async function createGo({
14420
14444
  version: goSelectedVersion
14421
14445
  });
14422
14446
  await setGoEnv(goGlobalCacheDir);
14423
- return new GoWrapper(env, opts);
14447
+ return new GoWrapper(env, opts, goSelectedVersion);
14424
14448
  }
14425
14449
  async function download({ dest, version: version2 }) {
14426
14450
  const { filename, url } = getGoUrl(version2);
@@ -14499,6 +14523,83 @@ async function parseGoModVersionFromModule(modulePath) {
14499
14523
  }
14500
14524
  return version2;
14501
14525
  }
14526
+ async function isElfBinary(filePath) {
14527
+ const fd = await import_fs5.default.promises.open(filePath, "r");
14528
+ try {
14529
+ const buf = new Uint8Array(4);
14530
+ await fd.read(buf, 0, 4, 0);
14531
+ return buf[0] === 127 && buf[1] === 69 && buf[2] === 76 && buf[3] === 70;
14532
+ } finally {
14533
+ await fd.close();
14534
+ }
14535
+ }
14536
+ async function getGoModuleName(goModPath) {
14537
+ try {
14538
+ const content = await (0, import_fs_extra.readFile)(goModPath, "utf8");
14539
+ const match = content.match(/^\s*module\s+(.+)$/m);
14540
+ if (match) {
14541
+ const modulePath = match[1].trim();
14542
+ return (0, import_path4.basename)(modulePath);
14543
+ }
14544
+ } catch {
14545
+ }
14546
+ return void 0;
14547
+ }
14548
+ async function findGoBinary(workPath, destPath, goModPath, buildStartTime) {
14549
+ if (await (0, import_fs_extra.pathExists)(destPath)) {
14550
+ return;
14551
+ }
14552
+ const moduleName = goModPath ? await getGoModuleName(goModPath) : void 0;
14553
+ const candidates = [moduleName, "server", "app", "main", "api"].filter(
14554
+ (c) => Boolean(c)
14555
+ );
14556
+ for (const name of candidates) {
14557
+ const p2 = (0, import_path4.join)(workPath, name);
14558
+ if (await (0, import_fs_extra.pathExists)(p2)) {
14559
+ const stat = await import_fs5.default.promises.stat(p2);
14560
+ if (stat.isFile() && stat.mtimeMs >= buildStartTime && await isElfBinary(p2)) {
14561
+ (0, import_build_utils.debug)(`Found Go binary: ${name}`);
14562
+ await (0, import_fs_extra.copy)(p2, destPath);
14563
+ return;
14564
+ }
14565
+ }
14566
+ }
14567
+ const found = [];
14568
+ const entries = await import_fs5.default.promises.readdir(workPath);
14569
+ for (const entry of entries) {
14570
+ if (candidates.includes(entry))
14571
+ continue;
14572
+ const p2 = (0, import_path4.join)(workPath, entry);
14573
+ const stat = await import_fs5.default.promises.stat(p2);
14574
+ if (stat.isFile() && stat.mtimeMs >= buildStartTime && await isElfBinary(p2)) {
14575
+ found.push(entry);
14576
+ }
14577
+ }
14578
+ const binDir = (0, import_path4.join)(workPath, "bin");
14579
+ if (await (0, import_fs_extra.pathExists)(binDir)) {
14580
+ const binEntries = await import_fs5.default.promises.readdir(binDir);
14581
+ for (const entry of binEntries) {
14582
+ const p2 = (0, import_path4.join)(binDir, entry);
14583
+ const stat = await import_fs5.default.promises.stat(p2);
14584
+ if (stat.isFile() && stat.mtimeMs >= buildStartTime && await isElfBinary(p2)) {
14585
+ found.push((0, import_path4.join)("bin", entry));
14586
+ }
14587
+ }
14588
+ }
14589
+ if (found.length === 1) {
14590
+ (0, import_build_utils.debug)(`Found Go binary: ${found[0]}`);
14591
+ await (0, import_fs_extra.copy)((0, import_path4.join)(workPath, found[0]), destPath);
14592
+ return;
14593
+ }
14594
+ if (found.length > 1) {
14595
+ throw new Error(
14596
+ `Found multiple ELF binaries after buildCommand: ${found.join(", ")}. Use \`go build -o $VERCEL_OUTPUT_FILE\` to specify which binary to deploy.`
14597
+ );
14598
+ }
14599
+ throw new Error(
14600
+ "No compiled Go binary found after buildCommand. Ensure your command produces a Linux binary (GOOS=linux is set), or use `go build -o $VERCEL_OUTPUT_FILE`."
14601
+ );
14602
+ }
14502
14603
  function parseGoModVersion(content) {
14503
14604
  const goMatches = /^\s*go\s+(\d+)\.(\d+)(?:\.(\d+))?\s*(?:\/\/.*)?$/gm.exec(
14504
14605
  content
@@ -14566,7 +14667,92 @@ var detectEntrypoint = async ({ workPath }) => {
14566
14667
  var import_child_process = require("child_process");
14567
14668
  var import_path6 = require("path");
14568
14669
  var import_fs_extra3 = __toESM(require_lib2());
14670
+ var import_build_utils4 = require("@vercel/build-utils");
14671
+
14672
+ // src/diagnostics.ts
14569
14673
  var import_build_utils3 = require("@vercel/build-utils");
14674
+ function applyReplaces(goMod) {
14675
+ const requires = goMod.Require ?? [];
14676
+ const replaces = goMod.Replace ?? [];
14677
+ const result = [];
14678
+ for (const req of requires) {
14679
+ const specific = replaces.find(
14680
+ (r) => r.Old.Path === req.Path && r.Old.Version === req.Version
14681
+ );
14682
+ const wildcard = replaces.find(
14683
+ (r) => r.Old.Path === req.Path && r.Old.Version === void 0
14684
+ );
14685
+ const rule = specific ?? wildcard;
14686
+ const indirect = req.Indirect === true;
14687
+ if (!rule) {
14688
+ result.push({ name: req.Path, version: req.Version, indirect });
14689
+ continue;
14690
+ }
14691
+ if (rule.New.Version === void 0) {
14692
+ continue;
14693
+ }
14694
+ result.push({
14695
+ name: rule.New.Path,
14696
+ version: rule.New.Version,
14697
+ indirect
14698
+ });
14699
+ }
14700
+ return result;
14701
+ }
14702
+ async function generateProjectManifest({
14703
+ workPath,
14704
+ goModJson,
14705
+ resolvedGoVersion,
14706
+ framework,
14707
+ serviceType
14708
+ }) {
14709
+ try {
14710
+ if (!goModJson)
14711
+ return;
14712
+ const projectModule = goModJson.Module?.Path;
14713
+ const modules = applyReplaces(goModJson).filter(
14714
+ (m2) => m2.name !== projectModule
14715
+ );
14716
+ const requested = goModJson.Go;
14717
+ const directDeps = [];
14718
+ const transitiveDeps = [];
14719
+ for (const mod of modules) {
14720
+ const dep = {
14721
+ name: mod.name,
14722
+ type: mod.indirect ? "transitive" : "direct",
14723
+ scopes: ["prod"],
14724
+ requested: mod.version,
14725
+ resolved: mod.version,
14726
+ source: "registry",
14727
+ sourceUrl: "https://proxy.golang.org"
14728
+ };
14729
+ if (mod.indirect) {
14730
+ transitiveDeps.push(dep);
14731
+ } else {
14732
+ directDeps.push(dep);
14733
+ }
14734
+ }
14735
+ const manifest = {
14736
+ version: import_build_utils3.MANIFEST_VERSION,
14737
+ runtime: "go",
14738
+ ...framework ? { framework } : {},
14739
+ ...serviceType ? { serviceType } : {},
14740
+ runtimeVersion: {
14741
+ ...requested ? { requested } : {},
14742
+ resolved: resolvedGoVersion
14743
+ },
14744
+ dependencies: [
14745
+ ...directDeps.sort((a, b2) => a.name.localeCompare(b2.name)),
14746
+ ...transitiveDeps.sort((a, b2) => a.name.localeCompare(b2.name))
14747
+ ]
14748
+ };
14749
+ await (0, import_build_utils3.writeProjectManifest)(manifest, workPath, "go");
14750
+ } catch {
14751
+ }
14752
+ }
14753
+ var diagnostics = (0, import_build_utils3.createDiagnostics)("go");
14754
+
14755
+ // src/standalone-server.ts
14570
14756
  async function findGoModPath(entrypointDir, workPath) {
14571
14757
  let goModPath = void 0;
14572
14758
  let isGoModInRootDir = false;
@@ -14576,7 +14762,7 @@ async function findGoModPath(entrypointDir, workPath) {
14576
14762
  const goMod = (0, import_path6.join)(dir, "go.mod");
14577
14763
  if (await (0, import_fs_extra3.pathExists)(goMod)) {
14578
14764
  goModPath = goMod;
14579
- (0, import_build_utils3.debug)(`Found ${goModPath}"`);
14765
+ (0, import_build_utils4.debug)(`Found ${goModPath}"`);
14580
14766
  break;
14581
14767
  }
14582
14768
  dir = (0, import_path6.dirname)(dir);
@@ -14591,16 +14777,18 @@ async function buildStandaloneServer({
14591
14777
  entrypoint,
14592
14778
  config,
14593
14779
  workPath,
14594
- meta = {}
14780
+ meta = {},
14781
+ registerPreDeploy,
14782
+ service
14595
14783
  }) {
14596
- (0, import_build_utils3.debug)(`Building standalone Go server: ${entrypoint}`);
14597
- await (0, import_build_utils3.download)(files, workPath, meta);
14598
- const lambdaOptions = await (0, import_build_utils3.getLambdaOptionsFromFunction)({
14784
+ (0, import_build_utils4.debug)(`Building standalone Go server: ${entrypoint}`);
14785
+ await (0, import_build_utils4.download)(files, workPath, meta);
14786
+ const lambdaOptions = await (0, import_build_utils4.getLambdaOptionsFromFunction)({
14599
14787
  sourceFile: entrypoint,
14600
14788
  config
14601
14789
  });
14602
14790
  const architecture = lambdaOptions?.architecture || "x86_64";
14603
- const env = (0, import_build_utils3.cloneEnv)(process.env, meta.env, {
14791
+ const env = (0, import_build_utils4.cloneEnv)(process.env, meta.env, {
14604
14792
  GOARCH: architecture === "arm64" ? "arm64" : "amd64",
14605
14793
  GOOS: "linux",
14606
14794
  CGO_ENABLED: "0"
@@ -14612,31 +14800,42 @@ async function buildStandaloneServer({
14612
14800
  opts: { cwd: workPath, env },
14613
14801
  workPath
14614
14802
  });
14615
- const outDir = await (0, import_build_utils3.getWriteableDirectory)();
14803
+ const outDir = await (0, import_build_utils4.getWriteableDirectory)();
14616
14804
  const userServerPath = (0, import_path6.join)(outDir, "user-server");
14617
14805
  const bootstrapPath = (0, import_path6.join)(outDir, "executable");
14618
14806
  const vendorModulesPath = (0, import_path6.join)(workPath, "vendor", "modules.txt");
14619
14807
  const isVendored = await (0, import_fs_extra3.pathExists)(vendorModulesPath);
14620
14808
  if (isVendored) {
14621
- (0, import_build_utils3.debug)("Detected vendor directory, using -mod=vendor for build");
14622
- }
14623
- const buildTarget = entrypoint === "main.go" ? "." : "./" + (0, import_path6.dirname)(entrypoint);
14624
- (0, import_build_utils3.debug)(
14625
- `Building user Go server (${architecture}): go build ${buildTarget} -> ${userServerPath}`
14626
- );
14627
- try {
14628
- await go.build(buildTarget, userServerPath, { vendorMode: isVendored });
14629
- } catch (err) {
14630
- console.error(`Failed to build standalone Go server: ${buildTarget}`);
14631
- throw err;
14809
+ (0, import_build_utils4.debug)("Detected vendor directory, using -mod=vendor for build");
14810
+ }
14811
+ const buildCommand = config?.buildCommand ?? config?.projectSettings?.buildCommand ?? void 0;
14812
+ if (typeof buildCommand === "string") {
14813
+ (0, import_build_utils4.debug)(`Running custom build command: ${buildCommand}`);
14814
+ const buildStartTime = Date.now();
14815
+ await (0, import_build_utils4.execCommand)(buildCommand, {
14816
+ env: { ...go.getEnv(), VERCEL_OUTPUT_FILE: userServerPath },
14817
+ cwd: workPath
14818
+ });
14819
+ await findGoBinary(workPath, userServerPath, goModPath, buildStartTime);
14820
+ } else {
14821
+ const buildTarget = entrypoint === "main.go" ? "." : "./" + (0, import_path6.dirname)(entrypoint);
14822
+ (0, import_build_utils4.debug)(
14823
+ `Building user Go server (${architecture}): go build ${buildTarget} -> ${userServerPath}`
14824
+ );
14825
+ try {
14826
+ await go.build(buildTarget, userServerPath, { vendorMode: isVendored });
14827
+ } catch (err) {
14828
+ console.error(`Failed to build standalone Go server: ${buildTarget}`);
14829
+ throw err;
14830
+ }
14632
14831
  }
14633
14832
  const bootstrapDir = (0, import_path6.join)(__dirname, "../bootstrap");
14634
14833
  const bootstrapSrc = (0, import_path6.join)(bootstrapDir, "vc-init.go");
14635
14834
  const utilsSrc = (0, import_path6.join)(bootstrapDir, "vc-utils.go");
14636
14835
  const bootstrapGoModSrc = (0, import_path6.join)(bootstrapDir, "go.mod");
14637
- (0, import_build_utils3.debug)(`Building bootstrap wrapper: ${bootstrapSrc} -> ${bootstrapPath}`);
14836
+ (0, import_build_utils4.debug)(`Building bootstrap wrapper: ${bootstrapSrc} -> ${bootstrapPath}`);
14638
14837
  try {
14639
- const bootstrapBuildDir = await (0, import_build_utils3.getWriteableDirectory)();
14838
+ const bootstrapBuildDir = await (0, import_build_utils4.getWriteableDirectory)();
14640
14839
  const bootstrapGoFile = (0, import_path6.join)(bootstrapBuildDir, "main.go");
14641
14840
  await (0, import_fs_extra3.copy)(bootstrapSrc, bootstrapGoFile);
14642
14841
  await (0, import_fs_extra3.copy)(utilsSrc, (0, import_path6.join)(bootstrapBuildDir, "vc-utils.go"));
@@ -14663,7 +14862,7 @@ async function buildStandaloneServer({
14663
14862
  if (config && config.includeFiles) {
14664
14863
  const patterns = Array.isArray(config.includeFiles) ? config.includeFiles : [config.includeFiles];
14665
14864
  for (const pattern of patterns) {
14666
- const fsFiles = await (0, import_build_utils3.glob)(pattern, workPath);
14865
+ const fsFiles = await (0, import_build_utils4.glob)(pattern, workPath);
14667
14866
  for (const [assetName, asset] of Object.entries(fsFiles)) {
14668
14867
  includedFiles[assetName] = asset;
14669
14868
  }
@@ -14673,14 +14872,14 @@ async function buildStandaloneServer({
14673
14872
  (0, import_fs_extra3.readFile)(userServerPath),
14674
14873
  (0, import_fs_extra3.readFile)(bootstrapPath)
14675
14874
  ]);
14676
- const lambda = new import_build_utils3.Lambda({
14875
+ const lambda = new import_build_utils4.Lambda({
14677
14876
  ...lambdaOptions,
14678
14877
  files: {
14679
14878
  ...includedFiles,
14680
14879
  // Bootstrap is the main entrypoint (handles IPC protocol)
14681
- executable: new import_build_utils3.FileBlob({ mode: 493, data: bootstrapData }),
14880
+ executable: new import_build_utils4.FileBlob({ mode: 493, data: bootstrapData }),
14682
14881
  // User's server is spawned by bootstrap
14683
- "user-server": new import_build_utils3.FileBlob({ mode: 493, data: userServerData })
14882
+ "user-server": new import_build_utils4.FileBlob({ mode: 493, data: userServerData })
14684
14883
  },
14685
14884
  handler: "executable",
14686
14885
  runtime: "executable",
@@ -14688,18 +14887,38 @@ async function buildStandaloneServer({
14688
14887
  architecture,
14689
14888
  runtimeLanguage: "go"
14690
14889
  });
14890
+ const preDeployCommand = config?.preDeployCommand;
14891
+ if (registerPreDeploy && typeof preDeployCommand === "string") {
14892
+ const capturedEnv = { ...env };
14893
+ const capturedCwd = workPath;
14894
+ registerPreDeploy(async () => {
14895
+ (0, import_build_utils4.debug)(`Running pre-deploy command: \`${preDeployCommand}\``);
14896
+ await (0, import_build_utils4.execCommand)(preDeployCommand, {
14897
+ env: capturedEnv,
14898
+ cwd: capturedCwd
14899
+ });
14900
+ });
14901
+ }
14902
+ const goModJson = goModPath ? await go.modEditJson(goModPath) : null;
14903
+ await generateProjectManifest({
14904
+ workPath,
14905
+ goModJson,
14906
+ resolvedGoVersion: go.resolvedVersion,
14907
+ framework: config.framework ?? void 0,
14908
+ serviceType: service ? (0, import_build_utils4.getReportedServiceType)(service) : void 0
14909
+ });
14691
14910
  return { output: lambda };
14692
14911
  }
14693
14912
  async function startStandaloneDevServer(opts, resolvedEntrypoint) {
14694
14913
  const { workPath, meta = {} } = opts;
14695
14914
  const port = Math.floor(Math.random() * (65535 - 49152) + 49152);
14696
- const env = (0, import_build_utils3.cloneEnv)(process.env, meta.env, {
14915
+ const env = (0, import_build_utils4.cloneEnv)(process.env, meta.env, {
14697
14916
  PORT: String(port)
14698
14917
  });
14699
14918
  const runTarget = resolvedEntrypoint === "main.go" ? "." : "./" + (0, import_path6.dirname)(resolvedEntrypoint);
14700
14919
  const devWrapper = (0, import_path6.join)(__dirname, "../bootstrap/vc-init-dev.go");
14701
14920
  const devUtils = (0, import_path6.join)(__dirname, "../bootstrap/vc-utils.go");
14702
- (0, import_build_utils3.debug)(
14921
+ (0, import_build_utils4.debug)(
14703
14922
  `Starting standalone Go dev server wrapper: go run ${devWrapper} (target ${runTarget}, port ${port})`
14704
14923
  );
14705
14924
  const child = (0, import_child_process.spawn)("go", ["run", "-tags", "vcdev", devWrapper, devUtils], {
@@ -14769,31 +14988,38 @@ function getRenamedEntrypoint(entrypoint) {
14769
14988
  const filename = (0, import_path7.basename)(entrypoint);
14770
14989
  if (filename.startsWith("[")) {
14771
14990
  const newEntrypoint = entrypoint.replace("/[", "/now-bracket[");
14772
- (0, import_build_utils4.debug)(`Renamed entrypoint from ${entrypoint} to ${newEntrypoint}`);
14991
+ (0, import_build_utils5.debug)(`Renamed entrypoint from ${entrypoint} to ${newEntrypoint}`);
14773
14992
  return newEntrypoint;
14774
14993
  }
14775
14994
  return void 0;
14776
14995
  }
14777
14996
  var version = 3;
14778
14997
  async function build(options) {
14779
- const { files, config, workPath, meta = {} } = options;
14998
+ const {
14999
+ files,
15000
+ config,
15001
+ workPath,
15002
+ meta = {},
15003
+ service,
15004
+ registerPreDeploy
15005
+ } = options;
14780
15006
  let { entrypoint } = options;
14781
- const goPath = await (0, import_build_utils4.getWriteableDirectory)();
15007
+ const goPath = await (0, import_build_utils5.getWriteableDirectory)();
14782
15008
  const srcPath = (0, import_path7.join)(goPath, "src", "lambda");
14783
15009
  const downloadPath = meta.skipDownload ? workPath : srcPath;
14784
- await (0, import_build_utils4.download)(files, downloadPath, meta);
15010
+ await (0, import_build_utils5.download)(files, downloadPath, meta);
14785
15011
  const undo = {
14786
15012
  fileActions: [],
14787
15013
  directoryCreation: [],
14788
15014
  functionRenames: []
14789
15015
  };
14790
- const env = (0, import_build_utils4.cloneEnv)(process.env, meta.env, {
15016
+ const env = (0, import_build_utils5.cloneEnv)(process.env, meta.env, {
14791
15017
  GOARCH: "amd64",
14792
15018
  GOOS: "linux"
14793
15019
  });
14794
15020
  try {
14795
15021
  if (env.GIT_CREDENTIALS) {
14796
- (0, import_build_utils4.debug)("Initialize Git credentials...");
15022
+ (0, import_build_utils5.debug)("Initialize Git credentials...");
14797
15023
  await initPrivateGit(env.GIT_CREDENTIALS);
14798
15024
  }
14799
15025
  if (env.GO111MODULE) {
@@ -14815,7 +15041,7 @@ Manually assigning 'GO111MODULE' is not recommended.
14815
15041
  `No Go entrypoint found. Expected one of: ${GO_CANDIDATE_ENTRYPOINTS.join(", ")}`
14816
15042
  );
14817
15043
  }
14818
- (0, import_build_utils4.debug)(`Using standalone Go server mode for ${resolvedEntrypoint}`);
15044
+ (0, import_build_utils5.debug)(`Using standalone Go server mode for ${resolvedEntrypoint}`);
14819
15045
  return buildStandaloneServer({
14820
15046
  ...options,
14821
15047
  entrypoint: resolvedEntrypoint
@@ -14868,7 +15094,7 @@ Manually assigning 'GO111MODULE' is not recommended.
14868
15094
  if (config && config.includeFiles) {
14869
15095
  const patterns = Array.isArray(config.includeFiles) ? config.includeFiles : [config.includeFiles];
14870
15096
  for (const pattern of patterns) {
14871
- const fsFiles = await (0, import_build_utils4.glob)(pattern, entrypointDirname);
15097
+ const fsFiles = await (0, import_build_utils5.glob)(pattern, entrypointDirname);
14872
15098
  for (const [assetName, asset] of Object.entries(fsFiles)) {
14873
15099
  includedFiles[assetName] = asset;
14874
15100
  }
@@ -14883,7 +15109,15 @@ Manually assigning 'GO111MODULE' is not recommended.
14883
15109
  },
14884
15110
  workPath
14885
15111
  });
14886
- const outDir = await (0, import_build_utils4.getWriteableDirectory)();
15112
+ const goModJson = goModPath ? await go.modEditJson(goModPath) : null;
15113
+ await generateProjectManifest({
15114
+ workPath,
15115
+ goModJson,
15116
+ resolvedGoVersion: go.resolvedVersion,
15117
+ framework: config.framework ?? void 0,
15118
+ serviceType: service ? (0, import_build_utils5.getReportedServiceType)(service) : void 0
15119
+ });
15120
+ const outDir = await (0, import_build_utils5.getWriteableDirectory)();
14887
15121
  const buildOptions = {
14888
15122
  downloadPath,
14889
15123
  entrypoint,
@@ -14902,20 +15136,32 @@ Manually assigning 'GO111MODULE' is not recommended.
14902
15136
  } else {
14903
15137
  await buildHandlerWithGoMod(buildOptions);
14904
15138
  }
14905
- const runtime = await (0, import_build_utils4.getProvidedRuntime)();
14906
- const lambda = new import_build_utils4.Lambda({
14907
- files: { ...await (0, import_build_utils4.glob)("**", outDir), ...includedFiles },
15139
+ const runtime = await (0, import_build_utils5.getProvidedRuntime)();
15140
+ const lambda = new import_build_utils5.Lambda({
15141
+ files: { ...await (0, import_build_utils5.glob)("**", outDir), ...includedFiles },
14908
15142
  handler: HANDLER_FILENAME,
14909
15143
  runtime,
14910
15144
  runtimeLanguage: "go",
14911
15145
  supportsWrapper: true,
14912
15146
  environment: {}
14913
15147
  });
15148
+ const preDeployCommand = config?.preDeployCommand;
15149
+ if (registerPreDeploy && typeof preDeployCommand === "string") {
15150
+ const capturedEnv = { ...env };
15151
+ const capturedCwd = workPath;
15152
+ registerPreDeploy(async () => {
15153
+ (0, import_build_utils5.debug)(`Running pre-deploy command: \`${preDeployCommand}\``);
15154
+ await (0, import_build_utils5.execCommand)(preDeployCommand, {
15155
+ env: capturedEnv,
15156
+ cwd: capturedCwd
15157
+ });
15158
+ });
15159
+ }
14914
15160
  return {
14915
15161
  output: lambda
14916
15162
  };
14917
15163
  } catch (error) {
14918
- (0, import_build_utils4.debug)(`Go Builder Error: ${error}`);
15164
+ (0, import_build_utils5.debug)(`Go Builder Error: ${error}`);
14919
15165
  throw error;
14920
15166
  } finally {
14921
15167
  try {
@@ -14924,7 +15170,7 @@ Manually assigning 'GO111MODULE' is not recommended.
14924
15170
  if (error instanceof Error) {
14925
15171
  console.error(`Build cleanup failed: ${error.message}`);
14926
15172
  }
14927
- (0, import_build_utils4.debug)("Cleanup Error: " + error);
15173
+ (0, import_build_utils5.debug)("Cleanup Error: " + error);
14928
15174
  }
14929
15175
  }
14930
15176
  }
@@ -14941,7 +15187,7 @@ async function buildHandlerWithGoMod({
14941
15187
  packageName,
14942
15188
  undo
14943
15189
  }) {
14944
- (0, import_build_utils4.debug)(
15190
+ (0, import_build_utils5.debug)(
14945
15191
  `Building Go handler as package "${packageName}" (with${goModPath ? "" : "out"} go.mod)`
14946
15192
  );
14947
15193
  let goModDirname;
@@ -14970,7 +15216,7 @@ async function buildHandlerWithGoMod({
14970
15216
  );
14971
15217
  const isVendored = await (0, import_fs_extra4.pathExists)(vendorModulesPath);
14972
15218
  if (isVendored) {
14973
- (0, import_build_utils4.debug)("Detected vendor directory in project");
15219
+ (0, import_build_utils5.debug)("Detected vendor directory in project");
14974
15220
  const vendorModulesBackup = vendorModulesPath + ".bak";
14975
15221
  await (0, import_fs_extra4.copy)(vendorModulesPath, vendorModulesBackup);
14976
15222
  undo.fileActions.push({
@@ -14987,13 +15233,13 @@ async function buildHandlerWithGoMod({
14987
15233
  }
14988
15234
  let mainGoFile;
14989
15235
  if (goModPath && isGoModInRootDir) {
14990
- (0, import_build_utils4.debug)(`[mod-root] Write main file to ${downloadPath}`);
15236
+ (0, import_build_utils5.debug)(`[mod-root] Write main file to ${downloadPath}`);
14991
15237
  mainGoFile = (0, import_path7.join)(downloadPath, MAIN_GO_FILENAME);
14992
15238
  } else if (goModDirname && !isGoModInRootDir) {
14993
- (0, import_build_utils4.debug)(`[mod-other] Write main file to ${goModDirname}`);
15239
+ (0, import_build_utils5.debug)(`[mod-other] Write main file to ${goModDirname}`);
14994
15240
  mainGoFile = (0, import_path7.join)(goModDirname, MAIN_GO_FILENAME);
14995
15241
  } else {
14996
- (0, import_build_utils4.debug)(`[entrypoint] Write main file to ${entrypointDirname}`);
15242
+ (0, import_build_utils5.debug)(`[entrypoint] Write main file to ${entrypointDirname}`);
14997
15243
  mainGoFile = (0, import_path7.join)(entrypointDirname, MAIN_GO_FILENAME);
14998
15244
  }
14999
15245
  await Promise.all([
@@ -15019,7 +15265,7 @@ async function buildHandlerWithGoMod({
15019
15265
  );
15020
15266
  }
15021
15267
  if (!goModPath || (0, import_path7.dirname)(entrypointAbsolute) === (0, import_path7.dirname)(goModPath)) {
15022
- (0, import_build_utils4.debug)(
15268
+ (0, import_build_utils5.debug)(
15023
15269
  `moving entrypoint "${entrypointAbsolute}" to "${finalDestination}"`
15024
15270
  );
15025
15271
  await (0, import_fs_extra4.move)(entrypointAbsolute, finalDestination);
@@ -15041,7 +15287,7 @@ async function buildHandlerWithGoMod({
15041
15287
  } else {
15042
15288
  baseGoModPath = entrypointDirname;
15043
15289
  }
15044
- (0, import_build_utils4.debug)("Tidy `go.mod` file...");
15290
+ (0, import_build_utils5.debug)("Tidy `go.mod` file...");
15045
15291
  try {
15046
15292
  await go.mod({ tolerateErrors: isVendored });
15047
15293
  } catch (err) {
@@ -15049,7 +15295,7 @@ async function buildHandlerWithGoMod({
15049
15295
  throw err;
15050
15296
  }
15051
15297
  if (isVendored) {
15052
- (0, import_build_utils4.debug)("Regenerating vendor directory after go.mod rewrite...");
15298
+ (0, import_build_utils5.debug)("Regenerating vendor directory after go.mod rewrite...");
15053
15299
  try {
15054
15300
  await go.vendor();
15055
15301
  } catch (err) {
@@ -15057,7 +15303,7 @@ async function buildHandlerWithGoMod({
15057
15303
  throw err;
15058
15304
  }
15059
15305
  }
15060
- (0, import_build_utils4.debug)("Running `go build`...");
15306
+ (0, import_build_utils5.debug)("Running `go build`...");
15061
15307
  const destPath = (0, import_path7.join)(outDir, HANDLER_FILENAME);
15062
15308
  try {
15063
15309
  const src = [(0, import_path7.join)(baseGoModPath, MAIN_GO_FILENAME)];
@@ -15075,7 +15321,7 @@ async function buildHandlerAsPackageMain({
15075
15321
  outDir,
15076
15322
  undo
15077
15323
  }) {
15078
- (0, import_build_utils4.debug)('Building Go handler as package "main" (legacy)');
15324
+ (0, import_build_utils5.debug)('Building Go handler as package "main" (legacy)');
15079
15325
  await writeEntrypoint(
15080
15326
  (0, import_path7.join)(entrypointDirname, MAIN_GO_FILENAME),
15081
15327
  "",
@@ -15086,14 +15332,14 @@ async function buildHandlerAsPackageMain({
15086
15332
  // delete
15087
15333
  from: (0, import_path7.join)(entrypointDirname, MAIN_GO_FILENAME)
15088
15334
  });
15089
- (0, import_build_utils4.debug)("Running `go get`...");
15335
+ (0, import_build_utils5.debug)("Running `go get`...");
15090
15336
  try {
15091
15337
  await go.get();
15092
15338
  } catch (err) {
15093
15339
  console.error("Failed to `go get`");
15094
15340
  throw err;
15095
15341
  }
15096
- (0, import_build_utils4.debug)("Running `go build`...");
15342
+ (0, import_build_utils5.debug)("Running `go build`...");
15097
15343
  const destPath = (0, import_path7.join)(outDir, HANDLER_FILENAME);
15098
15344
  try {
15099
15345
  const src = [
@@ -15123,10 +15369,10 @@ function getNewHandlerFunctionName(originalFunctionName, entrypoint) {
15123
15369
  "Handler function renaming failed because entrypoint was empty."
15124
15370
  );
15125
15371
  }
15126
- (0, import_build_utils4.debug)(`Found exported function "${originalFunctionName}" in "${entrypoint}"`);
15372
+ (0, import_build_utils5.debug)(`Found exported function "${originalFunctionName}" in "${entrypoint}"`);
15127
15373
  const pathSlug = entrypoint.replace(/(\s|\\|\/|\]|\[|-|\.)/g, "_");
15128
15374
  const newHandlerName = `${originalFunctionName}_${pathSlug}`;
15129
- (0, import_build_utils4.debug)(
15375
+ (0, import_build_utils5.debug)(
15130
15376
  `Renaming handler function temporarily from "${originalFunctionName}" to "${newHandlerName}"`
15131
15377
  );
15132
15378
  return newHandlerName;
@@ -15164,7 +15410,7 @@ async function findGoModPath2(entrypointDir, workPath) {
15164
15410
  const goMod = (0, import_path7.join)(dir, "go.mod");
15165
15411
  if (await (0, import_fs_extra4.pathExists)(goMod)) {
15166
15412
  goModPath = goMod;
15167
- (0, import_build_utils4.debug)(`Found ${goModPath}"`);
15413
+ (0, import_build_utils5.debug)(`Found ${goModPath}"`);
15168
15414
  break;
15169
15415
  }
15170
15416
  dir = (0, import_path7.dirname)(dir);
@@ -15244,7 +15490,7 @@ async function writeGoMod({
15244
15490
  }
15245
15491
  }
15246
15492
  const destGoModPath = (0, import_path7.join)(destDir, "go.mod");
15247
- (0, import_build_utils4.debug)(`Writing ${destGoModPath}`);
15493
+ (0, import_build_utils5.debug)(`Writing ${destGoModPath}`);
15248
15494
  await (0, import_fs_extra4.writeFile)(destGoModPath, contents, "utf-8");
15249
15495
  }
15250
15496
  async function findGoWorkFile(goWorkDir, workPath) {
@@ -15361,7 +15607,7 @@ async function startDevServer(opts) {
15361
15607
  TMP,
15362
15608
  `vercel-dev-port-${Math.random().toString(32).substring(2)}`
15363
15609
  );
15364
- const env = (0, import_build_utils4.cloneEnv)(process.env, meta.env, {
15610
+ const env = (0, import_build_utils5.cloneEnv)(process.env, meta.env, {
15365
15611
  VERCEL_DEV_PORT_FILE: portFile
15366
15612
  });
15367
15613
  const executable = `./vercel-dev-server-go${process.platform === "win32" ? ".exe" : ""}`;
@@ -15374,7 +15620,7 @@ async function startDevServer(opts) {
15374
15620
  workPath
15375
15621
  });
15376
15622
  await go.build("./...", executable);
15377
- (0, import_build_utils4.debug)(`SPAWNING ${executable} CWD=${tmp}`);
15623
+ (0, import_build_utils5.debug)(`SPAWNING ${executable} CWD=${tmp}`);
15378
15624
  const child = (0, import_child_process2.spawn)(executable, [], {
15379
15625
  cwd: tmp,
15380
15626
  env,
@@ -15462,11 +15708,11 @@ async function prepareCache({
15462
15708
  const stat = await (0, import_fs_extra4.lstat)(goCacheDir);
15463
15709
  if (stat.isSymbolicLink()) {
15464
15710
  const goGlobalCacheDir = await (0, import_fs_extra4.readlink)(goCacheDir);
15465
- (0, import_build_utils4.debug)(`Preparing cache by moving ${goGlobalCacheDir} -> ${goCacheDir}`);
15711
+ (0, import_build_utils5.debug)(`Preparing cache by moving ${goGlobalCacheDir} -> ${goCacheDir}`);
15466
15712
  await (0, import_fs_extra4.unlink)(goCacheDir);
15467
15713
  await (0, import_fs_extra4.move)(goGlobalCacheDir, goCacheDir);
15468
15714
  }
15469
- const cache = await (0, import_build_utils4.glob)(`${localCacheDir}/**`, workPath);
15715
+ const cache = await (0, import_build_utils5.glob)(`${localCacheDir}/**`, workPath);
15470
15716
  return cache;
15471
15717
  }
15472
15718
  // Annotate the CommonJS export names for ESM import in node:
@@ -15474,6 +15720,7 @@ async function prepareCache({
15474
15720
  build,
15475
15721
  detectEntrypoint,
15476
15722
  detectGoEntrypoint,
15723
+ diagnostics,
15477
15724
  getNewHandlerFunctionName,
15478
15725
  prepareCache,
15479
15726
  shouldServe,