@vercel/next 4.2.18 → 4.3.1

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 +973 -2269
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1185,42 +1185,40 @@ var require_find_up = __commonJS({
1185
1185
  }
1186
1186
  });
1187
1187
 
1188
- // ../../node_modules/.pnpm/universalify@0.1.2/node_modules/universalify/index.js
1188
+ // ../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js
1189
1189
  var require_universalify = __commonJS({
1190
- "../../node_modules/.pnpm/universalify@0.1.2/node_modules/universalify/index.js"(exports) {
1190
+ "../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js"(exports) {
1191
1191
  "use strict";
1192
1192
  exports.fromCallback = function(fn) {
1193
- return Object.defineProperty(function() {
1194
- if (typeof arguments[arguments.length - 1] === "function")
1195
- fn.apply(this, arguments);
1193
+ return Object.defineProperty(function(...args) {
1194
+ if (typeof args[args.length - 1] === "function")
1195
+ fn.apply(this, args);
1196
1196
  else {
1197
1197
  return new Promise((resolve, reject) => {
1198
- arguments[arguments.length] = (err, res) => {
1199
- if (err)
1200
- return reject(err);
1201
- resolve(res);
1202
- };
1203
- arguments.length++;
1204
- fn.apply(this, arguments);
1198
+ fn.call(
1199
+ this,
1200
+ ...args,
1201
+ (err, res) => err != null ? reject(err) : resolve(res)
1202
+ );
1205
1203
  });
1206
1204
  }
1207
1205
  }, "name", { value: fn.name });
1208
1206
  };
1209
1207
  exports.fromPromise = function(fn) {
1210
- return Object.defineProperty(function() {
1211
- const cb = arguments[arguments.length - 1];
1208
+ return Object.defineProperty(function(...args) {
1209
+ const cb = args[args.length - 1];
1212
1210
  if (typeof cb !== "function")
1213
- return fn.apply(this, arguments);
1211
+ return fn.apply(this, args);
1214
1212
  else
1215
- fn.apply(this, arguments).then((r) => cb(null, r), cb);
1213
+ fn.apply(this, args.slice(0, -1)).then((r) => cb(null, r), cb);
1216
1214
  }, "name", { value: fn.name });
1217
1215
  };
1218
1216
  }
1219
1217
  });
1220
1218
 
1221
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js
1219
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
1222
1220
  var require_polyfills = __commonJS({
1223
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports, module2) {
1221
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module2) {
1224
1222
  var constants = require("constants");
1225
1223
  var origCwd = process.cwd;
1226
1224
  var cwd = null;
@@ -1292,7 +1290,7 @@ var require_polyfills = __commonJS({
1292
1290
  var start = Date.now();
1293
1291
  var backoff = 0;
1294
1292
  fs$rename(from, to, function CB(er) {
1295
- if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
1293
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
1296
1294
  setTimeout(function() {
1297
1295
  fs5.stat(to, function(stater, st) {
1298
1296
  if (stater && stater.code === "ENOENT")
@@ -1534,9 +1532,9 @@ var require_polyfills = __commonJS({
1534
1532
  }
1535
1533
  });
1536
1534
 
1537
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js
1535
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
1538
1536
  var require_legacy_streams = __commonJS({
1539
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
1537
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
1540
1538
  var Stream = require("stream").Stream;
1541
1539
  module2.exports = legacy;
1542
1540
  function legacy(fs5) {
@@ -1633,9 +1631,9 @@ var require_legacy_streams = __commonJS({
1633
1631
  }
1634
1632
  });
1635
1633
 
1636
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js
1634
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
1637
1635
  var require_clone = __commonJS({
1638
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports, module2) {
1636
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module2) {
1639
1637
  "use strict";
1640
1638
  module2.exports = clone;
1641
1639
  var getPrototypeOf = Object.getPrototypeOf || function(obj) {
@@ -1656,9 +1654,9 @@ var require_clone = __commonJS({
1656
1654
  }
1657
1655
  });
1658
1656
 
1659
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js
1657
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
1660
1658
  var require_graceful_fs = __commonJS({
1661
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
1659
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
1662
1660
  var fs5 = require("fs");
1663
1661
  var polyfills = require_polyfills();
1664
1662
  var legacy = require_legacy_streams();
@@ -2026,9 +2024,9 @@ var require_graceful_fs = __commonJS({
2026
2024
  }
2027
2025
  });
2028
2026
 
2029
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/fs/index.js
2027
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js
2030
2028
  var require_fs = __commonJS({
2031
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/fs/index.js"(exports) {
2029
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js"(exports) {
2032
2030
  "use strict";
2033
2031
  var u = require_universalify().fromCallback;
2034
2032
  var fs5 = require_graceful_fs();
@@ -2046,18 +2044,20 @@ var require_fs = __commonJS({
2046
2044
  "fsync",
2047
2045
  "ftruncate",
2048
2046
  "futimes",
2049
- "lchown",
2050
2047
  "lchmod",
2048
+ "lchown",
2051
2049
  "link",
2052
2050
  "lstat",
2053
2051
  "mkdir",
2054
2052
  "mkdtemp",
2055
2053
  "open",
2056
- "readFile",
2054
+ "opendir",
2057
2055
  "readdir",
2056
+ "readFile",
2058
2057
  "readlink",
2059
2058
  "realpath",
2060
2059
  "rename",
2060
+ "rm",
2061
2061
  "rmdir",
2062
2062
  "stat",
2063
2063
  "symlink",
@@ -2068,12 +2068,7 @@ var require_fs = __commonJS({
2068
2068
  ].filter((key) => {
2069
2069
  return typeof fs5[key] === "function";
2070
2070
  });
2071
- Object.keys(fs5).forEach((key) => {
2072
- if (key === "promises") {
2073
- return;
2074
- }
2075
- exports[key] = fs5[key];
2076
- });
2071
+ Object.assign(exports, fs5);
2077
2072
  api.forEach((method) => {
2078
2073
  exports[method] = u(fs5[method]);
2079
2074
  });
@@ -2109,269 +2104,438 @@ var require_fs = __commonJS({
2109
2104
  });
2110
2105
  });
2111
2106
  };
2107
+ exports.readv = function(fd, buffers, ...args) {
2108
+ if (typeof args[args.length - 1] === "function") {
2109
+ return fs5.readv(fd, buffers, ...args);
2110
+ }
2111
+ return new Promise((resolve, reject) => {
2112
+ fs5.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
2113
+ if (err)
2114
+ return reject(err);
2115
+ resolve({ bytesRead, buffers: buffers2 });
2116
+ });
2117
+ });
2118
+ };
2119
+ exports.writev = function(fd, buffers, ...args) {
2120
+ if (typeof args[args.length - 1] === "function") {
2121
+ return fs5.writev(fd, buffers, ...args);
2122
+ }
2123
+ return new Promise((resolve, reject) => {
2124
+ fs5.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
2125
+ if (err)
2126
+ return reject(err);
2127
+ resolve({ bytesWritten, buffers: buffers2 });
2128
+ });
2129
+ });
2130
+ };
2131
+ if (typeof fs5.realpath.native === "function") {
2132
+ exports.realpath.native = u(fs5.realpath.native);
2133
+ } else {
2134
+ process.emitWarning(
2135
+ "fs.realpath.native is not a function. Is fs being monkey-patched?",
2136
+ "Warning",
2137
+ "fs-extra-WARN0003"
2138
+ );
2139
+ }
2112
2140
  }
2113
2141
  });
2114
2142
 
2115
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/win32.js
2116
- var require_win32 = __commonJS({
2117
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/win32.js"(exports, module2) {
2143
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js
2144
+ var require_utils = __commonJS({
2145
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module2) {
2118
2146
  "use strict";
2119
2147
  var path5 = require("path");
2120
- function getRootPath(p) {
2121
- p = path5.normalize(path5.resolve(p)).split(path5.sep);
2122
- if (p.length > 0)
2123
- return p[0];
2124
- return null;
2125
- }
2126
- var INVALID_PATH_CHARS = /[<>:"|?*]/;
2127
- function invalidWin32Path(p) {
2128
- const rp = getRootPath(p);
2129
- p = p.replace(rp, "");
2130
- return INVALID_PATH_CHARS.test(p);
2131
- }
2132
- module2.exports = {
2133
- getRootPath,
2134
- invalidWin32Path
2148
+ module2.exports.checkPath = function checkPath(pth) {
2149
+ if (process.platform === "win32") {
2150
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path5.parse(pth).root, ""));
2151
+ if (pathHasInvalidWinCharacters) {
2152
+ const error = new Error(`Path contains invalid characters: ${pth}`);
2153
+ error.code = "EINVAL";
2154
+ throw error;
2155
+ }
2156
+ }
2135
2157
  };
2136
2158
  }
2137
2159
  });
2138
2160
 
2139
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/mkdirs.js
2140
- var require_mkdirs = __commonJS({
2141
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports, module2) {
2161
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js
2162
+ var require_make_dir = __commonJS({
2163
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module2) {
2142
2164
  "use strict";
2143
- var fs5 = require_graceful_fs();
2144
- var path5 = require("path");
2145
- var invalidWin32Path = require_win32().invalidWin32Path;
2146
- var o777 = parseInt("0777", 8);
2147
- function mkdirs(p, opts, callback, made) {
2148
- if (typeof opts === "function") {
2149
- callback = opts;
2150
- opts = {};
2151
- } else if (!opts || typeof opts !== "object") {
2152
- opts = { mode: opts };
2153
- }
2154
- if (process.platform === "win32" && invalidWin32Path(p)) {
2155
- const errInval = new Error(p + " contains invalid WIN32 path characters.");
2156
- errInval.code = "EINVAL";
2157
- return callback(errInval);
2158
- }
2159
- let mode = opts.mode;
2160
- const xfs = opts.fs || fs5;
2161
- if (mode === void 0) {
2162
- mode = o777 & ~process.umask();
2163
- }
2164
- if (!made)
2165
- made = null;
2166
- callback = callback || function() {
2167
- };
2168
- p = path5.resolve(p);
2169
- xfs.mkdir(p, mode, (er) => {
2170
- if (!er) {
2171
- made = made || p;
2172
- return callback(null, made);
2173
- }
2174
- switch (er.code) {
2175
- case "ENOENT":
2176
- if (path5.dirname(p) === p)
2177
- return callback(er);
2178
- mkdirs(path5.dirname(p), opts, (er2, made2) => {
2179
- if (er2)
2180
- callback(er2, made2);
2181
- else
2182
- mkdirs(p, opts, callback, made2);
2183
- });
2184
- break;
2185
- default:
2186
- xfs.stat(p, (er2, stat2) => {
2187
- if (er2 || !stat2.isDirectory())
2188
- callback(er, made);
2189
- else
2190
- callback(null, made);
2191
- });
2192
- break;
2193
- }
2165
+ var fs5 = require_fs();
2166
+ var { checkPath } = require_utils();
2167
+ var getMode = (options) => {
2168
+ const defaults = { mode: 511 };
2169
+ if (typeof options === "number")
2170
+ return options;
2171
+ return { ...defaults, ...options }.mode;
2172
+ };
2173
+ module2.exports.makeDir = async (dir, options) => {
2174
+ checkPath(dir);
2175
+ return fs5.mkdir(dir, {
2176
+ mode: getMode(options),
2177
+ recursive: true
2194
2178
  });
2195
- }
2196
- module2.exports = mkdirs;
2179
+ };
2180
+ module2.exports.makeDirSync = (dir, options) => {
2181
+ checkPath(dir);
2182
+ return fs5.mkdirSync(dir, {
2183
+ mode: getMode(options),
2184
+ recursive: true
2185
+ });
2186
+ };
2197
2187
  }
2198
2188
  });
2199
2189
 
2200
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js
2201
- var require_mkdirs_sync = __commonJS({
2202
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports, module2) {
2190
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js
2191
+ var require_mkdirs = __commonJS({
2192
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module2) {
2203
2193
  "use strict";
2204
- var fs5 = require_graceful_fs();
2205
- var path5 = require("path");
2206
- var invalidWin32Path = require_win32().invalidWin32Path;
2207
- var o777 = parseInt("0777", 8);
2208
- function mkdirsSync(p, opts, made) {
2209
- if (!opts || typeof opts !== "object") {
2210
- opts = { mode: opts };
2211
- }
2212
- let mode = opts.mode;
2213
- const xfs = opts.fs || fs5;
2214
- if (process.platform === "win32" && invalidWin32Path(p)) {
2215
- const errInval = new Error(p + " contains invalid WIN32 path characters.");
2216
- errInval.code = "EINVAL";
2217
- throw errInval;
2218
- }
2219
- if (mode === void 0) {
2220
- mode = o777 & ~process.umask();
2221
- }
2222
- if (!made)
2223
- made = null;
2224
- p = path5.resolve(p);
2225
- try {
2226
- xfs.mkdirSync(p, mode);
2227
- made = made || p;
2228
- } catch (err0) {
2229
- if (err0.code === "ENOENT") {
2230
- if (path5.dirname(p) === p)
2231
- throw err0;
2232
- made = mkdirsSync(path5.dirname(p), opts, made);
2233
- mkdirsSync(p, opts, made);
2234
- } else {
2235
- let stat2;
2236
- try {
2237
- stat2 = xfs.statSync(p);
2238
- } catch (err1) {
2239
- throw err0;
2240
- }
2241
- if (!stat2.isDirectory())
2242
- throw err0;
2243
- }
2244
- }
2245
- return made;
2246
- }
2247
- module2.exports = mkdirsSync;
2194
+ var u = require_universalify().fromPromise;
2195
+ var { makeDir: _makeDir, makeDirSync } = require_make_dir();
2196
+ var makeDir = u(_makeDir);
2197
+ module2.exports = {
2198
+ mkdirs: makeDir,
2199
+ mkdirsSync: makeDirSync,
2200
+ // alias
2201
+ mkdirp: makeDir,
2202
+ mkdirpSync: makeDirSync,
2203
+ ensureDir: makeDir,
2204
+ ensureDirSync: makeDirSync
2205
+ };
2248
2206
  }
2249
2207
  });
2250
2208
 
2251
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/index.js
2252
- var require_mkdirs2 = __commonJS({
2253
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module2) {
2209
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js
2210
+ var require_path_exists2 = __commonJS({
2211
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
2254
2212
  "use strict";
2255
- var u = require_universalify().fromCallback;
2256
- var mkdirs = u(require_mkdirs());
2257
- var mkdirsSync = require_mkdirs_sync();
2213
+ var u = require_universalify().fromPromise;
2214
+ var fs5 = require_fs();
2215
+ function pathExists2(path5) {
2216
+ return fs5.access(path5).then(() => true).catch(() => false);
2217
+ }
2258
2218
  module2.exports = {
2259
- mkdirs,
2260
- mkdirsSync,
2261
- // alias
2262
- mkdirp: mkdirs,
2263
- mkdirpSync: mkdirsSync,
2264
- ensureDir: mkdirs,
2265
- ensureDirSync: mkdirsSync
2219
+ pathExists: u(pathExists2),
2220
+ pathExistsSync: fs5.existsSync
2266
2221
  };
2267
2222
  }
2268
2223
  });
2269
2224
 
2270
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/util/utimes.js
2225
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js
2271
2226
  var require_utimes = __commonJS({
2272
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
2227
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
2273
2228
  "use strict";
2274
- var fs5 = require_graceful_fs();
2275
- var os = require("os");
2276
- var path5 = require("path");
2277
- function hasMillisResSync() {
2278
- let tmpfile = path5.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2));
2279
- tmpfile = path5.join(os.tmpdir(), tmpfile);
2280
- const d = /* @__PURE__ */ new Date(1435410243862);
2281
- fs5.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141");
2282
- const fd = fs5.openSync(tmpfile, "r+");
2283
- fs5.futimesSync(fd, d, d);
2284
- fs5.closeSync(fd);
2285
- return fs5.statSync(tmpfile).mtime > 1435410243e3;
2286
- }
2287
- function hasMillisRes(callback) {
2288
- let tmpfile = path5.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2));
2289
- tmpfile = path5.join(os.tmpdir(), tmpfile);
2290
- const d = /* @__PURE__ */ new Date(1435410243862);
2291
- fs5.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
2292
- if (err)
2293
- return callback(err);
2294
- fs5.open(tmpfile, "r+", (err2, fd) => {
2295
- if (err2)
2296
- return callback(err2);
2297
- fs5.futimes(fd, d, d, (err3) => {
2298
- if (err3)
2299
- return callback(err3);
2300
- fs5.close(fd, (err4) => {
2301
- if (err4)
2302
- return callback(err4);
2303
- fs5.stat(tmpfile, (err5, stats) => {
2304
- if (err5)
2305
- return callback(err5);
2306
- callback(null, stats.mtime > 1435410243e3);
2307
- });
2308
- });
2309
- });
2310
- });
2311
- });
2312
- }
2313
- function timeRemoveMillis(timestamp) {
2314
- if (typeof timestamp === "number") {
2315
- return Math.floor(timestamp / 1e3) * 1e3;
2316
- } else if (timestamp instanceof Date) {
2317
- return new Date(Math.floor(timestamp.getTime() / 1e3) * 1e3);
2318
- } else {
2319
- throw new Error("fs-extra: timeRemoveMillis() unknown parameter type");
2229
+ var fs5 = require_fs();
2230
+ var u = require_universalify().fromPromise;
2231
+ async function utimesMillis(path5, atime, mtime) {
2232
+ const fd = await fs5.open(path5, "r+");
2233
+ let closeErr = null;
2234
+ try {
2235
+ await fs5.futimes(fd, atime, mtime);
2236
+ } finally {
2237
+ try {
2238
+ await fs5.close(fd);
2239
+ } catch (e) {
2240
+ closeErr = e;
2241
+ }
2242
+ }
2243
+ if (closeErr) {
2244
+ throw closeErr;
2320
2245
  }
2321
2246
  }
2322
- function utimesMillis(path6, atime, mtime, callback) {
2323
- fs5.open(path6, "r+", (err, fd) => {
2324
- if (err)
2325
- return callback(err);
2326
- fs5.futimes(fd, atime, mtime, (futimesErr) => {
2327
- fs5.close(fd, (closeErr) => {
2328
- if (callback)
2329
- callback(futimesErr || closeErr);
2330
- });
2331
- });
2332
- });
2333
- }
2334
- function utimesMillisSync(path6, atime, mtime) {
2335
- const fd = fs5.openSync(path6, "r+");
2247
+ function utimesMillisSync(path5, atime, mtime) {
2248
+ const fd = fs5.openSync(path5, "r+");
2336
2249
  fs5.futimesSync(fd, atime, mtime);
2337
2250
  return fs5.closeSync(fd);
2338
2251
  }
2339
2252
  module2.exports = {
2340
- hasMillisRes,
2341
- hasMillisResSync,
2342
- timeRemoveMillis,
2343
- utimesMillis,
2253
+ utimesMillis: u(utimesMillis),
2344
2254
  utimesMillisSync
2345
2255
  };
2346
2256
  }
2347
2257
  });
2348
2258
 
2349
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/util/buffer.js
2350
- var require_buffer = __commonJS({
2351
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/util/buffer.js"(exports, module2) {
2259
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js
2260
+ var require_stat = __commonJS({
2261
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js"(exports, module2) {
2352
2262
  "use strict";
2353
- module2.exports = function(size) {
2354
- if (typeof Buffer.allocUnsafe === "function") {
2355
- try {
2356
- return Buffer.allocUnsafe(size);
2357
- } catch (e) {
2358
- return new Buffer(size);
2263
+ var fs5 = require_fs();
2264
+ var path5 = require("path");
2265
+ var u = require_universalify().fromPromise;
2266
+ function getStats(src, dest, opts) {
2267
+ const statFunc = opts.dereference ? (file) => fs5.stat(file, { bigint: true }) : (file) => fs5.lstat(file, { bigint: true });
2268
+ return Promise.all([
2269
+ statFunc(src),
2270
+ statFunc(dest).catch((err) => {
2271
+ if (err.code === "ENOENT")
2272
+ return null;
2273
+ throw err;
2274
+ })
2275
+ ]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
2276
+ }
2277
+ function getStatsSync(src, dest, opts) {
2278
+ let destStat;
2279
+ const statFunc = opts.dereference ? (file) => fs5.statSync(file, { bigint: true }) : (file) => fs5.lstatSync(file, { bigint: true });
2280
+ const srcStat = statFunc(src);
2281
+ try {
2282
+ destStat = statFunc(dest);
2283
+ } catch (err) {
2284
+ if (err.code === "ENOENT")
2285
+ return { srcStat, destStat: null };
2286
+ throw err;
2287
+ }
2288
+ return { srcStat, destStat };
2289
+ }
2290
+ async function checkPaths(src, dest, funcName, opts) {
2291
+ const { srcStat, destStat } = await getStats(src, dest, opts);
2292
+ if (destStat) {
2293
+ if (areIdentical(srcStat, destStat)) {
2294
+ const srcBaseName = path5.basename(src);
2295
+ const destBaseName = path5.basename(dest);
2296
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
2297
+ return { srcStat, destStat, isChangingCase: true };
2298
+ }
2299
+ throw new Error("Source and destination must not be the same.");
2300
+ }
2301
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
2302
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
2303
+ }
2304
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
2305
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
2306
+ }
2307
+ }
2308
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
2309
+ throw new Error(errMsg(src, dest, funcName));
2310
+ }
2311
+ return { srcStat, destStat };
2312
+ }
2313
+ function checkPathsSync(src, dest, funcName, opts) {
2314
+ const { srcStat, destStat } = getStatsSync(src, dest, opts);
2315
+ if (destStat) {
2316
+ if (areIdentical(srcStat, destStat)) {
2317
+ const srcBaseName = path5.basename(src);
2318
+ const destBaseName = path5.basename(dest);
2319
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
2320
+ return { srcStat, destStat, isChangingCase: true };
2321
+ }
2322
+ throw new Error("Source and destination must not be the same.");
2323
+ }
2324
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
2325
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
2359
2326
  }
2327
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
2328
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
2329
+ }
2330
+ }
2331
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
2332
+ throw new Error(errMsg(src, dest, funcName));
2333
+ }
2334
+ return { srcStat, destStat };
2335
+ }
2336
+ async function checkParentPaths(src, srcStat, dest, funcName) {
2337
+ const srcParent = path5.resolve(path5.dirname(src));
2338
+ const destParent = path5.resolve(path5.dirname(dest));
2339
+ if (destParent === srcParent || destParent === path5.parse(destParent).root)
2340
+ return;
2341
+ let destStat;
2342
+ try {
2343
+ destStat = await fs5.stat(destParent, { bigint: true });
2344
+ } catch (err) {
2345
+ if (err.code === "ENOENT")
2346
+ return;
2347
+ throw err;
2348
+ }
2349
+ if (areIdentical(srcStat, destStat)) {
2350
+ throw new Error(errMsg(src, dest, funcName));
2351
+ }
2352
+ return checkParentPaths(src, srcStat, destParent, funcName);
2353
+ }
2354
+ function checkParentPathsSync(src, srcStat, dest, funcName) {
2355
+ const srcParent = path5.resolve(path5.dirname(src));
2356
+ const destParent = path5.resolve(path5.dirname(dest));
2357
+ if (destParent === srcParent || destParent === path5.parse(destParent).root)
2358
+ return;
2359
+ let destStat;
2360
+ try {
2361
+ destStat = fs5.statSync(destParent, { bigint: true });
2362
+ } catch (err) {
2363
+ if (err.code === "ENOENT")
2364
+ return;
2365
+ throw err;
2366
+ }
2367
+ if (areIdentical(srcStat, destStat)) {
2368
+ throw new Error(errMsg(src, dest, funcName));
2360
2369
  }
2361
- return new Buffer(size);
2370
+ return checkParentPathsSync(src, srcStat, destParent, funcName);
2371
+ }
2372
+ function areIdentical(srcStat, destStat) {
2373
+ return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
2374
+ }
2375
+ function isSrcSubdir(src, dest) {
2376
+ const srcArr = path5.resolve(src).split(path5.sep).filter((i) => i);
2377
+ const destArr = path5.resolve(dest).split(path5.sep).filter((i) => i);
2378
+ return srcArr.every((cur, i) => destArr[i] === cur);
2379
+ }
2380
+ function errMsg(src, dest, funcName) {
2381
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
2382
+ }
2383
+ module2.exports = {
2384
+ // checkPaths
2385
+ checkPaths: u(checkPaths),
2386
+ checkPathsSync,
2387
+ // checkParent
2388
+ checkParentPaths: u(checkParentPaths),
2389
+ checkParentPathsSync,
2390
+ // Misc
2391
+ isSrcSubdir,
2392
+ areIdentical
2362
2393
  };
2363
2394
  }
2364
2395
  });
2365
2396
 
2366
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy-sync/copy-sync.js
2397
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js
2398
+ var require_copy = __commonJS({
2399
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
2400
+ "use strict";
2401
+ var fs5 = require_fs();
2402
+ var path5 = require("path");
2403
+ var { mkdirs } = require_mkdirs();
2404
+ var { pathExists: pathExists2 } = require_path_exists2();
2405
+ var { utimesMillis } = require_utimes();
2406
+ var stat2 = require_stat();
2407
+ async function copy(src, dest, opts = {}) {
2408
+ if (typeof opts === "function") {
2409
+ opts = { filter: opts };
2410
+ }
2411
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
2412
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
2413
+ if (opts.preserveTimestamps && process.arch === "ia32") {
2414
+ process.emitWarning(
2415
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
2416
+ "Warning",
2417
+ "fs-extra-WARN0001"
2418
+ );
2419
+ }
2420
+ const { srcStat, destStat } = await stat2.checkPaths(src, dest, "copy", opts);
2421
+ await stat2.checkParentPaths(src, srcStat, dest, "copy");
2422
+ const include = await runFilter(src, dest, opts);
2423
+ if (!include)
2424
+ return;
2425
+ const destParent = path5.dirname(dest);
2426
+ const dirExists = await pathExists2(destParent);
2427
+ if (!dirExists) {
2428
+ await mkdirs(destParent);
2429
+ }
2430
+ await getStatsAndPerformCopy(destStat, src, dest, opts);
2431
+ }
2432
+ async function runFilter(src, dest, opts) {
2433
+ if (!opts.filter)
2434
+ return true;
2435
+ return opts.filter(src, dest);
2436
+ }
2437
+ async function getStatsAndPerformCopy(destStat, src, dest, opts) {
2438
+ const statFn = opts.dereference ? fs5.stat : fs5.lstat;
2439
+ const srcStat = await statFn(src);
2440
+ if (srcStat.isDirectory())
2441
+ return onDir(srcStat, destStat, src, dest, opts);
2442
+ if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
2443
+ return onFile(srcStat, destStat, src, dest, opts);
2444
+ if (srcStat.isSymbolicLink())
2445
+ return onLink(destStat, src, dest, opts);
2446
+ if (srcStat.isSocket())
2447
+ throw new Error(`Cannot copy a socket file: ${src}`);
2448
+ if (srcStat.isFIFO())
2449
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
2450
+ throw new Error(`Unknown file: ${src}`);
2451
+ }
2452
+ async function onFile(srcStat, destStat, src, dest, opts) {
2453
+ if (!destStat)
2454
+ return copyFile(srcStat, src, dest, opts);
2455
+ if (opts.overwrite) {
2456
+ await fs5.unlink(dest);
2457
+ return copyFile(srcStat, src, dest, opts);
2458
+ }
2459
+ if (opts.errorOnExist) {
2460
+ throw new Error(`'${dest}' already exists`);
2461
+ }
2462
+ }
2463
+ async function copyFile(srcStat, src, dest, opts) {
2464
+ await fs5.copyFile(src, dest);
2465
+ if (opts.preserveTimestamps) {
2466
+ if (fileIsNotWritable(srcStat.mode)) {
2467
+ await makeFileWritable(dest, srcStat.mode);
2468
+ }
2469
+ const updatedSrcStat = await fs5.stat(src);
2470
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
2471
+ }
2472
+ return fs5.chmod(dest, srcStat.mode);
2473
+ }
2474
+ function fileIsNotWritable(srcMode) {
2475
+ return (srcMode & 128) === 0;
2476
+ }
2477
+ function makeFileWritable(dest, srcMode) {
2478
+ return fs5.chmod(dest, srcMode | 128);
2479
+ }
2480
+ async function onDir(srcStat, destStat, src, dest, opts) {
2481
+ if (!destStat) {
2482
+ await fs5.mkdir(dest);
2483
+ }
2484
+ const items = await fs5.readdir(src);
2485
+ await Promise.all(items.map(async (item) => {
2486
+ const srcItem = path5.join(src, item);
2487
+ const destItem = path5.join(dest, item);
2488
+ const include = await runFilter(srcItem, destItem, opts);
2489
+ if (!include)
2490
+ return;
2491
+ const { destStat: destStat2 } = await stat2.checkPaths(srcItem, destItem, "copy", opts);
2492
+ return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
2493
+ }));
2494
+ if (!destStat) {
2495
+ await fs5.chmod(dest, srcStat.mode);
2496
+ }
2497
+ }
2498
+ async function onLink(destStat, src, dest, opts) {
2499
+ let resolvedSrc = await fs5.readlink(src);
2500
+ if (opts.dereference) {
2501
+ resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
2502
+ }
2503
+ if (!destStat) {
2504
+ return fs5.symlink(resolvedSrc, dest);
2505
+ }
2506
+ let resolvedDest = null;
2507
+ try {
2508
+ resolvedDest = await fs5.readlink(dest);
2509
+ } catch (e) {
2510
+ if (e.code === "EINVAL" || e.code === "UNKNOWN")
2511
+ return fs5.symlink(resolvedSrc, dest);
2512
+ throw e;
2513
+ }
2514
+ if (opts.dereference) {
2515
+ resolvedDest = path5.resolve(process.cwd(), resolvedDest);
2516
+ }
2517
+ if (stat2.isSrcSubdir(resolvedSrc, resolvedDest)) {
2518
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
2519
+ }
2520
+ if (stat2.isSrcSubdir(resolvedDest, resolvedSrc)) {
2521
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
2522
+ }
2523
+ await fs5.unlink(dest);
2524
+ return fs5.symlink(resolvedSrc, dest);
2525
+ }
2526
+ module2.exports = copy;
2527
+ }
2528
+ });
2529
+
2530
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js
2367
2531
  var require_copy_sync = __commonJS({
2368
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports, module2) {
2532
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module2) {
2369
2533
  "use strict";
2370
2534
  var fs5 = require_graceful_fs();
2371
2535
  var path5 = require("path");
2372
- var mkdirpSync = require_mkdirs2().mkdirsSync;
2373
- var utimesSync = require_utimes().utimesMillisSync;
2374
- var notExist = Symbol("notExist");
2536
+ var mkdirsSync = require_mkdirs().mkdirsSync;
2537
+ var utimesMillisSync = require_utimes().utimesMillisSync;
2538
+ var stat2 = require_stat();
2375
2539
  function copySync(src, dest, opts) {
2376
2540
  if (typeof opts === "function") {
2377
2541
  opts = { filter: opts };
@@ -2380,21 +2544,19 @@ var require_copy_sync = __commonJS({
2380
2544
  opts.clobber = "clobber" in opts ? !!opts.clobber : true;
2381
2545
  opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
2382
2546
  if (opts.preserveTimestamps && process.arch === "ia32") {
2383
- console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
2384
-
2385
- see https://github.com/jprichardson/node-fs-extra/issues/269`);
2547
+ process.emitWarning(
2548
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
2549
+ "Warning",
2550
+ "fs-extra-WARN0002"
2551
+ );
2386
2552
  }
2387
- const destStat = checkPaths(src, dest);
2553
+ const { srcStat, destStat } = stat2.checkPathsSync(src, dest, "copy", opts);
2554
+ stat2.checkParentPathsSync(src, srcStat, dest, "copy");
2388
2555
  if (opts.filter && !opts.filter(src, dest))
2389
2556
  return;
2390
2557
  const destParent = path5.dirname(dest);
2391
2558
  if (!fs5.existsSync(destParent))
2392
- mkdirpSync(destParent);
2393
- return startCopy(destStat, src, dest, opts);
2394
- }
2395
- function startCopy(destStat, src, dest, opts) {
2396
- if (opts.filter && !opts.filter(src, dest))
2397
- return;
2559
+ mkdirsSync(destParent);
2398
2560
  return getStats(destStat, src, dest, opts);
2399
2561
  }
2400
2562
  function getStats(destStat, src, dest, opts) {
@@ -2406,9 +2568,14 @@ var require_copy_sync = __commonJS({
2406
2568
  return onFile(srcStat, destStat, src, dest, opts);
2407
2569
  else if (srcStat.isSymbolicLink())
2408
2570
  return onLink(destStat, src, dest, opts);
2571
+ else if (srcStat.isSocket())
2572
+ throw new Error(`Cannot copy a socket file: ${src}`);
2573
+ else if (srcStat.isFIFO())
2574
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
2575
+ throw new Error(`Unknown file: ${src}`);
2409
2576
  }
2410
2577
  function onFile(srcStat, destStat, src, dest, opts) {
2411
- if (destStat === notExist)
2578
+ if (!destStat)
2412
2579
  return copyFile(srcStat, src, dest, opts);
2413
2580
  return mayCopyFile(srcStat, src, dest, opts);
2414
2581
  }
@@ -2421,44 +2588,38 @@ var require_copy_sync = __commonJS({
2421
2588
  }
2422
2589
  }
2423
2590
  function copyFile(srcStat, src, dest, opts) {
2424
- if (typeof fs5.copyFileSync === "function") {
2425
- fs5.copyFileSync(src, dest);
2426
- fs5.chmodSync(dest, srcStat.mode);
2427
- if (opts.preserveTimestamps) {
2428
- return utimesSync(dest, srcStat.atime, srcStat.mtime);
2429
- }
2430
- return;
2431
- }
2432
- return copyFileFallback(srcStat, src, dest, opts);
2433
- }
2434
- function copyFileFallback(srcStat, src, dest, opts) {
2435
- const BUF_LENGTH = 64 * 1024;
2436
- const _buff = require_buffer()(BUF_LENGTH);
2437
- const fdr = fs5.openSync(src, "r");
2438
- const fdw = fs5.openSync(dest, "w", srcStat.mode);
2439
- let pos = 0;
2440
- while (pos < srcStat.size) {
2441
- const bytesRead = fs5.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
2442
- fs5.writeSync(fdw, _buff, 0, bytesRead);
2443
- pos += bytesRead;
2444
- }
2591
+ fs5.copyFileSync(src, dest);
2445
2592
  if (opts.preserveTimestamps)
2446
- fs5.futimesSync(fdw, srcStat.atime, srcStat.mtime);
2447
- fs5.closeSync(fdr);
2448
- fs5.closeSync(fdw);
2593
+ handleTimestamps(srcStat.mode, src, dest);
2594
+ return setDestMode(dest, srcStat.mode);
2595
+ }
2596
+ function handleTimestamps(srcMode, src, dest) {
2597
+ if (fileIsNotWritable(srcMode))
2598
+ makeFileWritable(dest, srcMode);
2599
+ return setDestTimestamps(src, dest);
2600
+ }
2601
+ function fileIsNotWritable(srcMode) {
2602
+ return (srcMode & 128) === 0;
2603
+ }
2604
+ function makeFileWritable(dest, srcMode) {
2605
+ return setDestMode(dest, srcMode | 128);
2606
+ }
2607
+ function setDestMode(dest, srcMode) {
2608
+ return fs5.chmodSync(dest, srcMode);
2609
+ }
2610
+ function setDestTimestamps(src, dest) {
2611
+ const updatedSrcStat = fs5.statSync(src);
2612
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
2449
2613
  }
2450
2614
  function onDir(srcStat, destStat, src, dest, opts) {
2451
- if (destStat === notExist)
2452
- return mkDirAndCopy(srcStat, src, dest, opts);
2453
- if (destStat && !destStat.isDirectory()) {
2454
- throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
2455
- }
2615
+ if (!destStat)
2616
+ return mkDirAndCopy(srcStat.mode, src, dest, opts);
2456
2617
  return copyDir(src, dest, opts);
2457
2618
  }
2458
- function mkDirAndCopy(srcStat, src, dest, opts) {
2619
+ function mkDirAndCopy(srcMode, src, dest, opts) {
2459
2620
  fs5.mkdirSync(dest);
2460
2621
  copyDir(src, dest, opts);
2461
- return fs5.chmodSync(dest, srcStat.mode);
2622
+ return setDestMode(dest, srcMode);
2462
2623
  }
2463
2624
  function copyDir(src, dest, opts) {
2464
2625
  fs5.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
@@ -2466,15 +2627,17 @@ var require_copy_sync = __commonJS({
2466
2627
  function copyDirItem(item, src, dest, opts) {
2467
2628
  const srcItem = path5.join(src, item);
2468
2629
  const destItem = path5.join(dest, item);
2469
- const destStat = checkPaths(srcItem, destItem);
2470
- return startCopy(destStat, srcItem, destItem, opts);
2630
+ if (opts.filter && !opts.filter(srcItem, destItem))
2631
+ return;
2632
+ const { destStat } = stat2.checkPathsSync(srcItem, destItem, "copy", opts);
2633
+ return getStats(destStat, srcItem, destItem, opts);
2471
2634
  }
2472
2635
  function onLink(destStat, src, dest, opts) {
2473
2636
  let resolvedSrc = fs5.readlinkSync(src);
2474
2637
  if (opts.dereference) {
2475
2638
  resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
2476
2639
  }
2477
- if (destStat === notExist) {
2640
+ if (!destStat) {
2478
2641
  return fs5.symlinkSync(resolvedSrc, dest);
2479
2642
  } else {
2480
2643
  let resolvedDest;
@@ -2488,10 +2651,10 @@ var require_copy_sync = __commonJS({
2488
2651
  if (opts.dereference) {
2489
2652
  resolvedDest = path5.resolve(process.cwd(), resolvedDest);
2490
2653
  }
2491
- if (isSrcSubdir(resolvedSrc, resolvedDest)) {
2654
+ if (stat2.isSrcSubdir(resolvedSrc, resolvedDest)) {
2492
2655
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
2493
2656
  }
2494
- if (fs5.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
2657
+ if (stat2.isSrcSubdir(resolvedDest, resolvedSrc)) {
2495
2658
  throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
2496
2659
  }
2497
2660
  return copyLink(resolvedSrc, dest);
@@ -2501,612 +2664,64 @@ var require_copy_sync = __commonJS({
2501
2664
  fs5.unlinkSync(dest);
2502
2665
  return fs5.symlinkSync(resolvedSrc, dest);
2503
2666
  }
2504
- function isSrcSubdir(src, dest) {
2505
- const srcArray = path5.resolve(src).split(path5.sep);
2506
- const destArray = path5.resolve(dest).split(path5.sep);
2507
- return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
2508
- }
2509
- function checkStats(src, dest) {
2510
- const srcStat = fs5.statSync(src);
2511
- let destStat;
2512
- try {
2513
- destStat = fs5.statSync(dest);
2514
- } catch (err) {
2515
- if (err.code === "ENOENT")
2516
- return { srcStat, destStat: notExist };
2517
- throw err;
2518
- }
2519
- return { srcStat, destStat };
2520
- }
2521
- function checkPaths(src, dest) {
2522
- const { srcStat, destStat } = checkStats(src, dest);
2523
- if (destStat.ino && destStat.ino === srcStat.ino) {
2524
- throw new Error("Source and destination must not be the same.");
2525
- }
2526
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
2527
- throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`);
2528
- }
2529
- return destStat;
2530
- }
2531
2667
  module2.exports = copySync;
2532
2668
  }
2533
2669
  });
2534
2670
 
2535
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy-sync/index.js
2536
- var require_copy_sync2 = __commonJS({
2537
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy-sync/index.js"(exports, module2) {
2671
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js
2672
+ var require_copy2 = __commonJS({
2673
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js"(exports, module2) {
2538
2674
  "use strict";
2675
+ var u = require_universalify().fromPromise;
2539
2676
  module2.exports = {
2677
+ copy: u(require_copy()),
2540
2678
  copySync: require_copy_sync()
2541
2679
  };
2542
2680
  }
2543
2681
  });
2544
2682
 
2545
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/path-exists/index.js
2546
- var require_path_exists2 = __commonJS({
2547
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
2548
- "use strict";
2549
- var u = require_universalify().fromPromise;
2550
- var fs5 = require_fs();
2551
- function pathExists2(path5) {
2552
- return fs5.access(path5).then(() => true).catch(() => false);
2553
- }
2554
- module2.exports = {
2555
- pathExists: u(pathExists2),
2556
- pathExistsSync: fs5.existsSync
2557
- };
2558
- }
2559
- });
2560
-
2561
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy/copy.js
2562
- var require_copy = __commonJS({
2563
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
2683
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js
2684
+ var require_remove = __commonJS({
2685
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js"(exports, module2) {
2564
2686
  "use strict";
2565
2687
  var fs5 = require_graceful_fs();
2566
- var path5 = require("path");
2567
- var mkdirp = require_mkdirs2().mkdirs;
2568
- var pathExists2 = require_path_exists2().pathExists;
2569
- var utimes = require_utimes().utimesMillis;
2570
- var notExist = Symbol("notExist");
2571
- function copy(src, dest, opts, cb) {
2572
- if (typeof opts === "function" && !cb) {
2573
- cb = opts;
2574
- opts = {};
2575
- } else if (typeof opts === "function") {
2576
- opts = { filter: opts };
2577
- }
2578
- cb = cb || function() {
2579
- };
2580
- opts = opts || {};
2581
- opts.clobber = "clobber" in opts ? !!opts.clobber : true;
2582
- opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
2583
- if (opts.preserveTimestamps && process.arch === "ia32") {
2584
- console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
2585
-
2586
- see https://github.com/jprichardson/node-fs-extra/issues/269`);
2587
- }
2588
- checkPaths(src, dest, (err, destStat) => {
2589
- if (err)
2590
- return cb(err);
2591
- if (opts.filter)
2592
- return handleFilter(checkParentDir, destStat, src, dest, opts, cb);
2593
- return checkParentDir(destStat, src, dest, opts, cb);
2594
- });
2595
- }
2596
- function checkParentDir(destStat, src, dest, opts, cb) {
2597
- const destParent = path5.dirname(dest);
2598
- pathExists2(destParent, (err, dirExists) => {
2599
- if (err)
2600
- return cb(err);
2601
- if (dirExists)
2602
- return startCopy(destStat, src, dest, opts, cb);
2603
- mkdirp(destParent, (err2) => {
2604
- if (err2)
2605
- return cb(err2);
2606
- return startCopy(destStat, src, dest, opts, cb);
2607
- });
2608
- });
2609
- }
2610
- function handleFilter(onInclude, destStat, src, dest, opts, cb) {
2611
- Promise.resolve(opts.filter(src, dest)).then((include) => {
2612
- if (include) {
2613
- if (destStat)
2614
- return onInclude(destStat, src, dest, opts, cb);
2615
- return onInclude(src, dest, opts, cb);
2616
- }
2617
- return cb();
2618
- }, (error) => cb(error));
2619
- }
2620
- function startCopy(destStat, src, dest, opts, cb) {
2621
- if (opts.filter)
2622
- return handleFilter(getStats, destStat, src, dest, opts, cb);
2623
- return getStats(destStat, src, dest, opts, cb);
2624
- }
2625
- function getStats(destStat, src, dest, opts, cb) {
2626
- const stat2 = opts.dereference ? fs5.stat : fs5.lstat;
2627
- stat2(src, (err, srcStat) => {
2628
- if (err)
2629
- return cb(err);
2630
- if (srcStat.isDirectory())
2631
- return onDir(srcStat, destStat, src, dest, opts, cb);
2632
- else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
2633
- return onFile(srcStat, destStat, src, dest, opts, cb);
2634
- else if (srcStat.isSymbolicLink())
2635
- return onLink(destStat, src, dest, opts, cb);
2636
- });
2637
- }
2638
- function onFile(srcStat, destStat, src, dest, opts, cb) {
2639
- if (destStat === notExist)
2640
- return copyFile(srcStat, src, dest, opts, cb);
2641
- return mayCopyFile(srcStat, src, dest, opts, cb);
2642
- }
2643
- function mayCopyFile(srcStat, src, dest, opts, cb) {
2644
- if (opts.overwrite) {
2645
- fs5.unlink(dest, (err) => {
2646
- if (err)
2647
- return cb(err);
2648
- return copyFile(srcStat, src, dest, opts, cb);
2649
- });
2650
- } else if (opts.errorOnExist) {
2651
- return cb(new Error(`'${dest}' already exists`));
2652
- } else
2653
- return cb();
2654
- }
2655
- function copyFile(srcStat, src, dest, opts, cb) {
2656
- if (typeof fs5.copyFile === "function") {
2657
- return fs5.copyFile(src, dest, (err) => {
2658
- if (err)
2659
- return cb(err);
2660
- return setDestModeAndTimestamps(srcStat, dest, opts, cb);
2661
- });
2662
- }
2663
- return copyFileFallback(srcStat, src, dest, opts, cb);
2664
- }
2665
- function copyFileFallback(srcStat, src, dest, opts, cb) {
2666
- const rs = fs5.createReadStream(src);
2667
- rs.on("error", (err) => cb(err)).once("open", () => {
2668
- const ws = fs5.createWriteStream(dest, { mode: srcStat.mode });
2669
- ws.on("error", (err) => cb(err)).on("open", () => rs.pipe(ws)).once("close", () => setDestModeAndTimestamps(srcStat, dest, opts, cb));
2670
- });
2671
- }
2672
- function setDestModeAndTimestamps(srcStat, dest, opts, cb) {
2673
- fs5.chmod(dest, srcStat.mode, (err) => {
2674
- if (err)
2675
- return cb(err);
2676
- if (opts.preserveTimestamps) {
2677
- return utimes(dest, srcStat.atime, srcStat.mtime, cb);
2678
- }
2679
- return cb();
2680
- });
2681
- }
2682
- function onDir(srcStat, destStat, src, dest, opts, cb) {
2683
- if (destStat === notExist)
2684
- return mkDirAndCopy(srcStat, src, dest, opts, cb);
2685
- if (destStat && !destStat.isDirectory()) {
2686
- return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
2687
- }
2688
- return copyDir(src, dest, opts, cb);
2689
- }
2690
- function mkDirAndCopy(srcStat, src, dest, opts, cb) {
2691
- fs5.mkdir(dest, (err) => {
2692
- if (err)
2693
- return cb(err);
2694
- copyDir(src, dest, opts, (err2) => {
2695
- if (err2)
2696
- return cb(err2);
2697
- return fs5.chmod(dest, srcStat.mode, cb);
2698
- });
2699
- });
2700
- }
2701
- function copyDir(src, dest, opts, cb) {
2702
- fs5.readdir(src, (err, items) => {
2703
- if (err)
2704
- return cb(err);
2705
- return copyDirItems(items, src, dest, opts, cb);
2706
- });
2707
- }
2708
- function copyDirItems(items, src, dest, opts, cb) {
2709
- const item = items.pop();
2710
- if (!item)
2711
- return cb();
2712
- return copyDirItem(items, item, src, dest, opts, cb);
2713
- }
2714
- function copyDirItem(items, item, src, dest, opts, cb) {
2715
- const srcItem = path5.join(src, item);
2716
- const destItem = path5.join(dest, item);
2717
- checkPaths(srcItem, destItem, (err, destStat) => {
2718
- if (err)
2719
- return cb(err);
2720
- startCopy(destStat, srcItem, destItem, opts, (err2) => {
2721
- if (err2)
2722
- return cb(err2);
2723
- return copyDirItems(items, src, dest, opts, cb);
2724
- });
2725
- });
2726
- }
2727
- function onLink(destStat, src, dest, opts, cb) {
2728
- fs5.readlink(src, (err, resolvedSrc) => {
2729
- if (err)
2730
- return cb(err);
2731
- if (opts.dereference) {
2732
- resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
2733
- }
2734
- if (destStat === notExist) {
2735
- return fs5.symlink(resolvedSrc, dest, cb);
2736
- } else {
2737
- fs5.readlink(dest, (err2, resolvedDest) => {
2738
- if (err2) {
2739
- if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
2740
- return fs5.symlink(resolvedSrc, dest, cb);
2741
- return cb(err2);
2742
- }
2743
- if (opts.dereference) {
2744
- resolvedDest = path5.resolve(process.cwd(), resolvedDest);
2745
- }
2746
- if (isSrcSubdir(resolvedSrc, resolvedDest)) {
2747
- return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
2748
- }
2749
- if (destStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
2750
- return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
2751
- }
2752
- return copyLink(resolvedSrc, dest, cb);
2753
- });
2754
- }
2755
- });
2756
- }
2757
- function copyLink(resolvedSrc, dest, cb) {
2758
- fs5.unlink(dest, (err) => {
2759
- if (err)
2760
- return cb(err);
2761
- return fs5.symlink(resolvedSrc, dest, cb);
2762
- });
2763
- }
2764
- function isSrcSubdir(src, dest) {
2765
- const srcArray = path5.resolve(src).split(path5.sep);
2766
- const destArray = path5.resolve(dest).split(path5.sep);
2767
- return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
2768
- }
2769
- function checkStats(src, dest, cb) {
2770
- fs5.stat(src, (err, srcStat) => {
2771
- if (err)
2772
- return cb(err);
2773
- fs5.stat(dest, (err2, destStat) => {
2774
- if (err2) {
2775
- if (err2.code === "ENOENT")
2776
- return cb(null, { srcStat, destStat: notExist });
2777
- return cb(err2);
2778
- }
2779
- return cb(null, { srcStat, destStat });
2780
- });
2781
- });
2782
- }
2783
- function checkPaths(src, dest, cb) {
2784
- checkStats(src, dest, (err, stats) => {
2785
- if (err)
2786
- return cb(err);
2787
- const { srcStat, destStat } = stats;
2788
- if (destStat.ino && destStat.ino === srcStat.ino) {
2789
- return cb(new Error("Source and destination must not be the same."));
2790
- }
2791
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
2792
- return cb(new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`));
2793
- }
2794
- return cb(null, destStat);
2795
- });
2796
- }
2797
- module2.exports = copy;
2798
- }
2799
- });
2800
-
2801
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy/index.js
2802
- var require_copy2 = __commonJS({
2803
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/copy/index.js"(exports, module2) {
2804
- "use strict";
2805
2688
  var u = require_universalify().fromCallback;
2806
- module2.exports = {
2807
- copy: u(require_copy())
2808
- };
2809
- }
2810
- });
2811
-
2812
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/remove/rimraf.js
2813
- var require_rimraf = __commonJS({
2814
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/remove/rimraf.js"(exports, module2) {
2815
- "use strict";
2816
- var fs5 = require_graceful_fs();
2817
- var path5 = require("path");
2818
- var assert = require("assert");
2819
- var isWindows = process.platform === "win32";
2820
- function defaults(options) {
2821
- const methods = [
2822
- "unlink",
2823
- "chmod",
2824
- "stat",
2825
- "lstat",
2826
- "rmdir",
2827
- "readdir"
2828
- ];
2829
- methods.forEach((m) => {
2830
- options[m] = options[m] || fs5[m];
2831
- m = m + "Sync";
2832
- options[m] = options[m] || fs5[m];
2833
- });
2834
- options.maxBusyTries = options.maxBusyTries || 3;
2835
- }
2836
- function rimraf(p, options, cb) {
2837
- let busyTries = 0;
2838
- if (typeof options === "function") {
2839
- cb = options;
2840
- options = {};
2841
- }
2842
- assert(p, "rimraf: missing path");
2843
- assert.strictEqual(typeof p, "string", "rimraf: path should be a string");
2844
- assert.strictEqual(typeof cb, "function", "rimraf: callback function required");
2845
- assert(options, "rimraf: invalid options argument provided");
2846
- assert.strictEqual(typeof options, "object", "rimraf: options should be object");
2847
- defaults(options);
2848
- rimraf_(p, options, function CB(er) {
2849
- if (er) {
2850
- if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && busyTries < options.maxBusyTries) {
2851
- busyTries++;
2852
- const time = busyTries * 100;
2853
- return setTimeout(() => rimraf_(p, options, CB), time);
2854
- }
2855
- if (er.code === "ENOENT")
2856
- er = null;
2857
- }
2858
- cb(er);
2859
- });
2860
- }
2861
- function rimraf_(p, options, cb) {
2862
- assert(p);
2863
- assert(options);
2864
- assert(typeof cb === "function");
2865
- options.lstat(p, (er, st) => {
2866
- if (er && er.code === "ENOENT") {
2867
- return cb(null);
2868
- }
2869
- if (er && er.code === "EPERM" && isWindows) {
2870
- return fixWinEPERM(p, options, er, cb);
2871
- }
2872
- if (st && st.isDirectory()) {
2873
- return rmdir(p, options, er, cb);
2874
- }
2875
- options.unlink(p, (er2) => {
2876
- if (er2) {
2877
- if (er2.code === "ENOENT") {
2878
- return cb(null);
2879
- }
2880
- if (er2.code === "EPERM") {
2881
- return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
2882
- }
2883
- if (er2.code === "EISDIR") {
2884
- return rmdir(p, options, er2, cb);
2885
- }
2886
- }
2887
- return cb(er2);
2888
- });
2889
- });
2890
- }
2891
- function fixWinEPERM(p, options, er, cb) {
2892
- assert(p);
2893
- assert(options);
2894
- assert(typeof cb === "function");
2895
- if (er) {
2896
- assert(er instanceof Error);
2897
- }
2898
- options.chmod(p, 438, (er2) => {
2899
- if (er2) {
2900
- cb(er2.code === "ENOENT" ? null : er);
2901
- } else {
2902
- options.stat(p, (er3, stats) => {
2903
- if (er3) {
2904
- cb(er3.code === "ENOENT" ? null : er);
2905
- } else if (stats.isDirectory()) {
2906
- rmdir(p, options, er, cb);
2907
- } else {
2908
- options.unlink(p, cb);
2909
- }
2910
- });
2911
- }
2912
- });
2913
- }
2914
- function fixWinEPERMSync(p, options, er) {
2915
- let stats;
2916
- assert(p);
2917
- assert(options);
2918
- if (er) {
2919
- assert(er instanceof Error);
2920
- }
2921
- try {
2922
- options.chmodSync(p, 438);
2923
- } catch (er2) {
2924
- if (er2.code === "ENOENT") {
2925
- return;
2926
- } else {
2927
- throw er;
2928
- }
2929
- }
2930
- try {
2931
- stats = options.statSync(p);
2932
- } catch (er3) {
2933
- if (er3.code === "ENOENT") {
2934
- return;
2935
- } else {
2936
- throw er;
2937
- }
2938
- }
2939
- if (stats.isDirectory()) {
2940
- rmdirSync(p, options, er);
2941
- } else {
2942
- options.unlinkSync(p);
2943
- }
2944
- }
2945
- function rmdir(p, options, originalEr, cb) {
2946
- assert(p);
2947
- assert(options);
2948
- if (originalEr) {
2949
- assert(originalEr instanceof Error);
2950
- }
2951
- assert(typeof cb === "function");
2952
- options.rmdir(p, (er) => {
2953
- if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) {
2954
- rmkids(p, options, cb);
2955
- } else if (er && er.code === "ENOTDIR") {
2956
- cb(originalEr);
2957
- } else {
2958
- cb(er);
2959
- }
2960
- });
2961
- }
2962
- function rmkids(p, options, cb) {
2963
- assert(p);
2964
- assert(options);
2965
- assert(typeof cb === "function");
2966
- options.readdir(p, (er, files) => {
2967
- if (er)
2968
- return cb(er);
2969
- let n = files.length;
2970
- let errState;
2971
- if (n === 0)
2972
- return options.rmdir(p, cb);
2973
- files.forEach((f) => {
2974
- rimraf(path5.join(p, f), options, (er2) => {
2975
- if (errState) {
2976
- return;
2977
- }
2978
- if (er2)
2979
- return cb(errState = er2);
2980
- if (--n === 0) {
2981
- options.rmdir(p, cb);
2982
- }
2983
- });
2984
- });
2985
- });
2986
- }
2987
- function rimrafSync(p, options) {
2988
- let st;
2989
- options = options || {};
2990
- defaults(options);
2991
- assert(p, "rimraf: missing path");
2992
- assert.strictEqual(typeof p, "string", "rimraf: path should be a string");
2993
- assert(options, "rimraf: missing options");
2994
- assert.strictEqual(typeof options, "object", "rimraf: options should be object");
2995
- try {
2996
- st = options.lstatSync(p);
2997
- } catch (er) {
2998
- if (er.code === "ENOENT") {
2999
- return;
3000
- }
3001
- if (er.code === "EPERM" && isWindows) {
3002
- fixWinEPERMSync(p, options, er);
3003
- }
3004
- }
3005
- try {
3006
- if (st && st.isDirectory()) {
3007
- rmdirSync(p, options, null);
3008
- } else {
3009
- options.unlinkSync(p);
3010
- }
3011
- } catch (er) {
3012
- if (er.code === "ENOENT") {
3013
- return;
3014
- } else if (er.code === "EPERM") {
3015
- return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er);
3016
- } else if (er.code !== "EISDIR") {
3017
- throw er;
3018
- }
3019
- rmdirSync(p, options, er);
3020
- }
3021
- }
3022
- function rmdirSync(p, options, originalEr) {
3023
- assert(p);
3024
- assert(options);
3025
- if (originalEr) {
3026
- assert(originalEr instanceof Error);
3027
- }
3028
- try {
3029
- options.rmdirSync(p);
3030
- } catch (er) {
3031
- if (er.code === "ENOTDIR") {
3032
- throw originalEr;
3033
- } else if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") {
3034
- rmkidsSync(p, options);
3035
- } else if (er.code !== "ENOENT") {
3036
- throw er;
3037
- }
3038
- }
2689
+ function remove2(path5, callback) {
2690
+ fs5.rm(path5, { recursive: true, force: true }, callback);
3039
2691
  }
3040
- function rmkidsSync(p, options) {
3041
- assert(p);
3042
- assert(options);
3043
- options.readdirSync(p).forEach((f) => rimrafSync(path5.join(p, f), options));
3044
- const retries = isWindows ? 100 : 1;
3045
- let i = 0;
3046
- do {
3047
- let threw = true;
3048
- try {
3049
- const ret = options.rmdirSync(p, options);
3050
- threw = false;
3051
- return ret;
3052
- } finally {
3053
- if (++i < retries && threw)
3054
- continue;
3055
- }
3056
- } while (true);
2692
+ function removeSync(path5) {
2693
+ fs5.rmSync(path5, { recursive: true, force: true });
3057
2694
  }
3058
- module2.exports = rimraf;
3059
- rimraf.sync = rimrafSync;
3060
- }
3061
- });
3062
-
3063
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/remove/index.js
3064
- var require_remove = __commonJS({
3065
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/remove/index.js"(exports, module2) {
3066
- "use strict";
3067
- var u = require_universalify().fromCallback;
3068
- var rimraf = require_rimraf();
3069
2695
  module2.exports = {
3070
- remove: u(rimraf),
3071
- removeSync: rimraf.sync
2696
+ remove: u(remove2),
2697
+ removeSync
3072
2698
  };
3073
2699
  }
3074
2700
  });
3075
2701
 
3076
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/empty/index.js
2702
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js
3077
2703
  var require_empty = __commonJS({
3078
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
2704
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
3079
2705
  "use strict";
3080
- var u = require_universalify().fromCallback;
3081
- var fs5 = require("fs");
2706
+ var u = require_universalify().fromPromise;
2707
+ var fs5 = require_fs();
3082
2708
  var path5 = require("path");
3083
- var mkdir = require_mkdirs2();
2709
+ var mkdir = require_mkdirs();
3084
2710
  var remove2 = require_remove();
3085
- var emptyDir = u(function emptyDir2(dir, callback) {
3086
- callback = callback || function() {
3087
- };
3088
- fs5.readdir(dir, (err, items) => {
3089
- if (err)
3090
- return mkdir.mkdirs(dir, callback);
3091
- items = items.map((item) => path5.join(dir, item));
3092
- deleteItem();
3093
- function deleteItem() {
3094
- const item = items.pop();
3095
- if (!item)
3096
- return callback();
3097
- remove2.remove(item, (err2) => {
3098
- if (err2)
3099
- return callback(err2);
3100
- deleteItem();
3101
- });
3102
- }
3103
- });
2711
+ var emptyDir = u(async function emptyDir2(dir) {
2712
+ let items;
2713
+ try {
2714
+ items = await fs5.readdir(dir);
2715
+ } catch {
2716
+ return mkdir.mkdirs(dir);
2717
+ }
2718
+ return Promise.all(items.map((item) => remove2.remove(path5.join(dir, item))));
3104
2719
  });
3105
2720
  function emptyDirSync(dir) {
3106
2721
  let items;
3107
2722
  try {
3108
2723
  items = fs5.readdirSync(dir);
3109
- } catch (err) {
2724
+ } catch {
3110
2725
  return mkdir.mkdirsSync(dir);
3111
2726
  }
3112
2727
  items.forEach((item) => {
@@ -3123,51 +2738,59 @@ var require_empty = __commonJS({
3123
2738
  }
3124
2739
  });
3125
2740
 
3126
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/file.js
2741
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js
3127
2742
  var require_file = __commonJS({
3128
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module2) {
2743
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module2) {
3129
2744
  "use strict";
3130
- var u = require_universalify().fromCallback;
2745
+ var u = require_universalify().fromPromise;
3131
2746
  var path5 = require("path");
3132
- var fs5 = require_graceful_fs();
3133
- var mkdir = require_mkdirs2();
3134
- var pathExists2 = require_path_exists2().pathExists;
3135
- function createFile(file, callback) {
3136
- function makeFile() {
3137
- fs5.writeFile(file, "", (err) => {
3138
- if (err)
3139
- return callback(err);
3140
- callback();
3141
- });
2747
+ var fs5 = require_fs();
2748
+ var mkdir = require_mkdirs();
2749
+ async function createFile(file) {
2750
+ let stats;
2751
+ try {
2752
+ stats = await fs5.stat(file);
2753
+ } catch {
2754
+ }
2755
+ if (stats && stats.isFile())
2756
+ return;
2757
+ const dir = path5.dirname(file);
2758
+ let dirStats = null;
2759
+ try {
2760
+ dirStats = await fs5.stat(dir);
2761
+ } catch (err) {
2762
+ if (err.code === "ENOENT") {
2763
+ await mkdir.mkdirs(dir);
2764
+ await fs5.writeFile(file, "");
2765
+ return;
2766
+ } else {
2767
+ throw err;
2768
+ }
2769
+ }
2770
+ if (dirStats.isDirectory()) {
2771
+ await fs5.writeFile(file, "");
2772
+ } else {
2773
+ await fs5.readdir(dir);
3142
2774
  }
3143
- fs5.stat(file, (err, stats) => {
3144
- if (!err && stats.isFile())
3145
- return callback();
3146
- const dir = path5.dirname(file);
3147
- pathExists2(dir, (err2, dirExists) => {
3148
- if (err2)
3149
- return callback(err2);
3150
- if (dirExists)
3151
- return makeFile();
3152
- mkdir.mkdirs(dir, (err3) => {
3153
- if (err3)
3154
- return callback(err3);
3155
- makeFile();
3156
- });
3157
- });
3158
- });
3159
2775
  }
3160
2776
  function createFileSync(file) {
3161
2777
  let stats;
3162
2778
  try {
3163
2779
  stats = fs5.statSync(file);
3164
- } catch (e) {
2780
+ } catch {
3165
2781
  }
3166
2782
  if (stats && stats.isFile())
3167
2783
  return;
3168
2784
  const dir = path5.dirname(file);
3169
- if (!fs5.existsSync(dir)) {
3170
- mkdir.mkdirsSync(dir);
2785
+ try {
2786
+ if (!fs5.statSync(dir).isDirectory()) {
2787
+ fs5.readdirSync(dir);
2788
+ }
2789
+ } catch (err) {
2790
+ if (err && err.code === "ENOENT")
2791
+ mkdir.mkdirsSync(dir);
2792
+ else
2793
+ throw err;
3171
2794
  }
3172
2795
  fs5.writeFileSync(file, "");
3173
2796
  }
@@ -3178,54 +2801,48 @@ var require_file = __commonJS({
3178
2801
  }
3179
2802
  });
3180
2803
 
3181
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/link.js
2804
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js
3182
2805
  var require_link = __commonJS({
3183
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module2) {
2806
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module2) {
3184
2807
  "use strict";
3185
- var u = require_universalify().fromCallback;
2808
+ var u = require_universalify().fromPromise;
3186
2809
  var path5 = require("path");
3187
- var fs5 = require_graceful_fs();
3188
- var mkdir = require_mkdirs2();
3189
- var pathExists2 = require_path_exists2().pathExists;
3190
- function createLink(srcpath, dstpath, callback) {
3191
- function makeLink(srcpath2, dstpath2) {
3192
- fs5.link(srcpath2, dstpath2, (err) => {
3193
- if (err)
3194
- return callback(err);
3195
- callback(null);
3196
- });
2810
+ var fs5 = require_fs();
2811
+ var mkdir = require_mkdirs();
2812
+ var { pathExists: pathExists2 } = require_path_exists2();
2813
+ var { areIdentical } = require_stat();
2814
+ async function createLink(srcpath, dstpath) {
2815
+ let dstStat;
2816
+ try {
2817
+ dstStat = await fs5.lstat(dstpath);
2818
+ } catch {
3197
2819
  }
3198
- pathExists2(dstpath, (err, destinationExists) => {
3199
- if (err)
3200
- return callback(err);
3201
- if (destinationExists)
3202
- return callback(null);
3203
- fs5.lstat(srcpath, (err2) => {
3204
- if (err2) {
3205
- err2.message = err2.message.replace("lstat", "ensureLink");
3206
- return callback(err2);
3207
- }
3208
- const dir = path5.dirname(dstpath);
3209
- pathExists2(dir, (err3, dirExists) => {
3210
- if (err3)
3211
- return callback(err3);
3212
- if (dirExists)
3213
- return makeLink(srcpath, dstpath);
3214
- mkdir.mkdirs(dir, (err4) => {
3215
- if (err4)
3216
- return callback(err4);
3217
- makeLink(srcpath, dstpath);
3218
- });
3219
- });
3220
- });
3221
- });
2820
+ let srcStat;
2821
+ try {
2822
+ srcStat = await fs5.lstat(srcpath);
2823
+ } catch (err) {
2824
+ err.message = err.message.replace("lstat", "ensureLink");
2825
+ throw err;
2826
+ }
2827
+ if (dstStat && areIdentical(srcStat, dstStat))
2828
+ return;
2829
+ const dir = path5.dirname(dstpath);
2830
+ const dirExists = await pathExists2(dir);
2831
+ if (!dirExists) {
2832
+ await mkdir.mkdirs(dir);
2833
+ }
2834
+ await fs5.link(srcpath, dstpath);
3222
2835
  }
3223
2836
  function createLinkSync(srcpath, dstpath) {
3224
- const destinationExists = fs5.existsSync(dstpath);
3225
- if (destinationExists)
3226
- return void 0;
2837
+ let dstStat;
2838
+ try {
2839
+ dstStat = fs5.lstatSync(dstpath);
2840
+ } catch {
2841
+ }
3227
2842
  try {
3228
- fs5.lstatSync(srcpath);
2843
+ const srcStat = fs5.lstatSync(srcpath);
2844
+ if (dstStat && areIdentical(srcStat, dstStat))
2845
+ return;
3229
2846
  } catch (err) {
3230
2847
  err.message = err.message.replace("lstat", "ensureLink");
3231
2848
  throw err;
@@ -3244,1134 +2861,287 @@ var require_link = __commonJS({
3244
2861
  }
3245
2862
  });
3246
2863
 
3247
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
2864
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
3248
2865
  var require_symlink_paths = __commonJS({
3249
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
2866
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
3250
2867
  "use strict";
3251
2868
  var path5 = require("path");
3252
- var fs5 = require_graceful_fs();
3253
- var pathExists2 = require_path_exists2().pathExists;
3254
- function symlinkPaths(srcpath, dstpath, callback) {
2869
+ var fs5 = require_fs();
2870
+ var { pathExists: pathExists2 } = require_path_exists2();
2871
+ var u = require_universalify().fromPromise;
2872
+ async function symlinkPaths(srcpath, dstpath) {
3255
2873
  if (path5.isAbsolute(srcpath)) {
3256
- return fs5.lstat(srcpath, (err) => {
3257
- if (err) {
3258
- err.message = err.message.replace("lstat", "ensureSymlink");
3259
- return callback(err);
3260
- }
3261
- return callback(null, {
3262
- "toCwd": srcpath,
3263
- "toDst": srcpath
3264
- });
3265
- });
3266
- } else {
3267
- const dstdir = path5.dirname(dstpath);
3268
- const relativeToDst = path5.join(dstdir, srcpath);
3269
- return pathExists2(relativeToDst, (err, exists) => {
3270
- if (err)
3271
- return callback(err);
3272
- if (exists) {
3273
- return callback(null, {
3274
- "toCwd": relativeToDst,
3275
- "toDst": srcpath
3276
- });
3277
- } else {
3278
- return fs5.lstat(srcpath, (err2) => {
3279
- if (err2) {
3280
- err2.message = err2.message.replace("lstat", "ensureSymlink");
3281
- return callback(err2);
3282
- }
3283
- return callback(null, {
3284
- "toCwd": srcpath,
3285
- "toDst": path5.relative(dstdir, srcpath)
3286
- });
3287
- });
3288
- }
3289
- });
2874
+ try {
2875
+ await fs5.lstat(srcpath);
2876
+ } catch (err) {
2877
+ err.message = err.message.replace("lstat", "ensureSymlink");
2878
+ throw err;
2879
+ }
2880
+ return {
2881
+ toCwd: srcpath,
2882
+ toDst: srcpath
2883
+ };
3290
2884
  }
2885
+ const dstdir = path5.dirname(dstpath);
2886
+ const relativeToDst = path5.join(dstdir, srcpath);
2887
+ const exists = await pathExists2(relativeToDst);
2888
+ if (exists) {
2889
+ return {
2890
+ toCwd: relativeToDst,
2891
+ toDst: srcpath
2892
+ };
2893
+ }
2894
+ try {
2895
+ await fs5.lstat(srcpath);
2896
+ } catch (err) {
2897
+ err.message = err.message.replace("lstat", "ensureSymlink");
2898
+ throw err;
2899
+ }
2900
+ return {
2901
+ toCwd: srcpath,
2902
+ toDst: path5.relative(dstdir, srcpath)
2903
+ };
3291
2904
  }
3292
2905
  function symlinkPathsSync(srcpath, dstpath) {
3293
- let exists;
3294
2906
  if (path5.isAbsolute(srcpath)) {
3295
- exists = fs5.existsSync(srcpath);
3296
- if (!exists)
2907
+ const exists2 = fs5.existsSync(srcpath);
2908
+ if (!exists2)
3297
2909
  throw new Error("absolute srcpath does not exist");
3298
2910
  return {
3299
- "toCwd": srcpath,
3300
- "toDst": srcpath
2911
+ toCwd: srcpath,
2912
+ toDst: srcpath
3301
2913
  };
3302
- } else {
3303
- const dstdir = path5.dirname(dstpath);
3304
- const relativeToDst = path5.join(dstdir, srcpath);
3305
- exists = fs5.existsSync(relativeToDst);
3306
- if (exists) {
3307
- return {
3308
- "toCwd": relativeToDst,
3309
- "toDst": srcpath
3310
- };
3311
- } else {
3312
- exists = fs5.existsSync(srcpath);
3313
- if (!exists)
3314
- throw new Error("relative srcpath does not exist");
3315
- return {
3316
- "toCwd": srcpath,
3317
- "toDst": path5.relative(dstdir, srcpath)
3318
- };
3319
- }
3320
2914
  }
2915
+ const dstdir = path5.dirname(dstpath);
2916
+ const relativeToDst = path5.join(dstdir, srcpath);
2917
+ const exists = fs5.existsSync(relativeToDst);
2918
+ if (exists) {
2919
+ return {
2920
+ toCwd: relativeToDst,
2921
+ toDst: srcpath
2922
+ };
2923
+ }
2924
+ const srcExists = fs5.existsSync(srcpath);
2925
+ if (!srcExists)
2926
+ throw new Error("relative srcpath does not exist");
2927
+ return {
2928
+ toCwd: srcpath,
2929
+ toDst: path5.relative(dstdir, srcpath)
2930
+ };
3321
2931
  }
3322
2932
  module2.exports = {
3323
- symlinkPaths,
2933
+ symlinkPaths: u(symlinkPaths),
3324
2934
  symlinkPathsSync
3325
2935
  };
3326
2936
  }
3327
2937
  });
3328
2938
 
3329
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/symlink-type.js
2939
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js
3330
2940
  var require_symlink_type = __commonJS({
3331
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
2941
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
3332
2942
  "use strict";
3333
- var fs5 = require_graceful_fs();
3334
- function symlinkType(srcpath, type, callback) {
3335
- callback = typeof type === "function" ? type : callback;
3336
- type = typeof type === "function" ? false : type;
2943
+ var fs5 = require_fs();
2944
+ var u = require_universalify().fromPromise;
2945
+ async function symlinkType(srcpath, type) {
3337
2946
  if (type)
3338
- return callback(null, type);
3339
- fs5.lstat(srcpath, (err, stats) => {
3340
- if (err)
3341
- return callback(null, "file");
3342
- type = stats && stats.isDirectory() ? "dir" : "file";
3343
- callback(null, type);
3344
- });
2947
+ return type;
2948
+ let stats;
2949
+ try {
2950
+ stats = await fs5.lstat(srcpath);
2951
+ } catch {
2952
+ return "file";
2953
+ }
2954
+ return stats && stats.isDirectory() ? "dir" : "file";
3345
2955
  }
3346
2956
  function symlinkTypeSync(srcpath, type) {
3347
- let stats;
3348
2957
  if (type)
3349
2958
  return type;
2959
+ let stats;
3350
2960
  try {
3351
2961
  stats = fs5.lstatSync(srcpath);
3352
- } catch (e) {
2962
+ } catch {
3353
2963
  return "file";
3354
2964
  }
3355
2965
  return stats && stats.isDirectory() ? "dir" : "file";
3356
2966
  }
3357
2967
  module2.exports = {
3358
- symlinkType,
2968
+ symlinkType: u(symlinkType),
3359
2969
  symlinkTypeSync
3360
2970
  };
3361
2971
  }
3362
2972
  });
3363
2973
 
3364
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/symlink.js
2974
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js
3365
2975
  var require_symlink = __commonJS({
3366
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module2) {
2976
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module2) {
3367
2977
  "use strict";
3368
- var u = require_universalify().fromCallback;
2978
+ var u = require_universalify().fromPromise;
3369
2979
  var path5 = require("path");
3370
- var fs5 = require_graceful_fs();
3371
- var _mkdirs = require_mkdirs2();
3372
- var mkdirs = _mkdirs.mkdirs;
3373
- var mkdirsSync = _mkdirs.mkdirsSync;
3374
- var _symlinkPaths = require_symlink_paths();
3375
- var symlinkPaths = _symlinkPaths.symlinkPaths;
3376
- var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
3377
- var _symlinkType = require_symlink_type();
3378
- var symlinkType = _symlinkType.symlinkType;
3379
- var symlinkTypeSync = _symlinkType.symlinkTypeSync;
3380
- var pathExists2 = require_path_exists2().pathExists;
3381
- function createSymlink(srcpath, dstpath, type, callback) {
3382
- callback = typeof type === "function" ? type : callback;
3383
- type = typeof type === "function" ? false : type;
3384
- pathExists2(dstpath, (err, destinationExists) => {
3385
- if (err)
3386
- return callback(err);
3387
- if (destinationExists)
3388
- return callback(null);
3389
- symlinkPaths(srcpath, dstpath, (err2, relative) => {
3390
- if (err2)
3391
- return callback(err2);
3392
- srcpath = relative.toDst;
3393
- symlinkType(relative.toCwd, type, (err3, type2) => {
3394
- if (err3)
3395
- return callback(err3);
3396
- const dir = path5.dirname(dstpath);
3397
- pathExists2(dir, (err4, dirExists) => {
3398
- if (err4)
3399
- return callback(err4);
3400
- if (dirExists)
3401
- return fs5.symlink(srcpath, dstpath, type2, callback);
3402
- mkdirs(dir, (err5) => {
3403
- if (err5)
3404
- return callback(err5);
3405
- fs5.symlink(srcpath, dstpath, type2, callback);
3406
- });
3407
- });
3408
- });
3409
- });
3410
- });
3411
- }
3412
- function createSymlinkSync(srcpath, dstpath, type) {
3413
- const destinationExists = fs5.existsSync(dstpath);
3414
- if (destinationExists)
3415
- return void 0;
3416
- const relative = symlinkPathsSync(srcpath, dstpath);
2980
+ var fs5 = require_fs();
2981
+ var { mkdirs, mkdirsSync } = require_mkdirs();
2982
+ var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
2983
+ var { symlinkType, symlinkTypeSync } = require_symlink_type();
2984
+ var { pathExists: pathExists2 } = require_path_exists2();
2985
+ var { areIdentical } = require_stat();
2986
+ async function createSymlink(srcpath, dstpath, type) {
2987
+ let stats;
2988
+ try {
2989
+ stats = await fs5.lstat(dstpath);
2990
+ } catch {
2991
+ }
2992
+ if (stats && stats.isSymbolicLink()) {
2993
+ const [srcStat, dstStat] = await Promise.all([
2994
+ fs5.stat(srcpath),
2995
+ fs5.stat(dstpath)
2996
+ ]);
2997
+ if (areIdentical(srcStat, dstStat))
2998
+ return;
2999
+ }
3000
+ const relative = await symlinkPaths(srcpath, dstpath);
3417
3001
  srcpath = relative.toDst;
3418
- type = symlinkTypeSync(relative.toCwd, type);
3002
+ const toType = await symlinkType(relative.toCwd, type);
3419
3003
  const dir = path5.dirname(dstpath);
3420
- const exists = fs5.existsSync(dir);
3421
- if (exists)
3422
- return fs5.symlinkSync(srcpath, dstpath, type);
3423
- mkdirsSync(dir);
3424
- return fs5.symlinkSync(srcpath, dstpath, type);
3425
- }
3426
- module2.exports = {
3427
- createSymlink: u(createSymlink),
3428
- createSymlinkSync
3429
- };
3430
- }
3431
- });
3432
-
3433
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/index.js
3434
- var require_ensure = __commonJS({
3435
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/ensure/index.js"(exports, module2) {
3436
- "use strict";
3437
- var file = require_file();
3438
- var link = require_link();
3439
- var symlink = require_symlink();
3440
- module2.exports = {
3441
- // file
3442
- createFile: file.createFile,
3443
- createFileSync: file.createFileSync,
3444
- ensureFile: file.createFile,
3445
- ensureFileSync: file.createFileSync,
3446
- // link
3447
- createLink: link.createLink,
3448
- createLinkSync: link.createLinkSync,
3449
- ensureLink: link.createLink,
3450
- ensureLinkSync: link.createLinkSync,
3451
- // symlink
3452
- createSymlink: symlink.createSymlink,
3453
- createSymlinkSync: symlink.createSymlinkSync,
3454
- ensureSymlink: symlink.createSymlink,
3455
- ensureSymlinkSync: symlink.createSymlinkSync
3456
- };
3457
- }
3458
- });
3459
-
3460
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
3461
- var require_polyfills2 = __commonJS({
3462
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module2) {
3463
- var constants = require("constants");
3464
- var origCwd = process.cwd;
3465
- var cwd = null;
3466
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
3467
- process.cwd = function() {
3468
- if (!cwd)
3469
- cwd = origCwd.call(process);
3470
- return cwd;
3471
- };
3472
- try {
3473
- process.cwd();
3474
- } catch (er) {
3475
- }
3476
- if (typeof process.chdir === "function") {
3477
- chdir = process.chdir;
3478
- process.chdir = function(d) {
3479
- cwd = null;
3480
- chdir.call(process, d);
3481
- };
3482
- if (Object.setPrototypeOf)
3483
- Object.setPrototypeOf(process.chdir, chdir);
3484
- }
3485
- var chdir;
3486
- module2.exports = patch;
3487
- function patch(fs5) {
3488
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
3489
- patchLchmod(fs5);
3490
- }
3491
- if (!fs5.lutimes) {
3492
- patchLutimes(fs5);
3493
- }
3494
- fs5.chown = chownFix(fs5.chown);
3495
- fs5.fchown = chownFix(fs5.fchown);
3496
- fs5.lchown = chownFix(fs5.lchown);
3497
- fs5.chmod = chmodFix(fs5.chmod);
3498
- fs5.fchmod = chmodFix(fs5.fchmod);
3499
- fs5.lchmod = chmodFix(fs5.lchmod);
3500
- fs5.chownSync = chownFixSync(fs5.chownSync);
3501
- fs5.fchownSync = chownFixSync(fs5.fchownSync);
3502
- fs5.lchownSync = chownFixSync(fs5.lchownSync);
3503
- fs5.chmodSync = chmodFixSync(fs5.chmodSync);
3504
- fs5.fchmodSync = chmodFixSync(fs5.fchmodSync);
3505
- fs5.lchmodSync = chmodFixSync(fs5.lchmodSync);
3506
- fs5.stat = statFix(fs5.stat);
3507
- fs5.fstat = statFix(fs5.fstat);
3508
- fs5.lstat = statFix(fs5.lstat);
3509
- fs5.statSync = statFixSync(fs5.statSync);
3510
- fs5.fstatSync = statFixSync(fs5.fstatSync);
3511
- fs5.lstatSync = statFixSync(fs5.lstatSync);
3512
- if (fs5.chmod && !fs5.lchmod) {
3513
- fs5.lchmod = function(path5, mode, cb) {
3514
- if (cb)
3515
- process.nextTick(cb);
3516
- };
3517
- fs5.lchmodSync = function() {
3518
- };
3519
- }
3520
- if (fs5.chown && !fs5.lchown) {
3521
- fs5.lchown = function(path5, uid, gid, cb) {
3522
- if (cb)
3523
- process.nextTick(cb);
3524
- };
3525
- fs5.lchownSync = function() {
3526
- };
3527
- }
3528
- if (platform === "win32") {
3529
- fs5.rename = typeof fs5.rename !== "function" ? fs5.rename : function(fs$rename) {
3530
- function rename(from, to, cb) {
3531
- var start = Date.now();
3532
- var backoff = 0;
3533
- fs$rename(from, to, function CB(er) {
3534
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
3535
- setTimeout(function() {
3536
- fs5.stat(to, function(stater, st) {
3537
- if (stater && stater.code === "ENOENT")
3538
- fs$rename(from, to, CB);
3539
- else
3540
- cb(er);
3541
- });
3542
- }, backoff);
3543
- if (backoff < 100)
3544
- backoff += 10;
3545
- return;
3546
- }
3547
- if (cb)
3548
- cb(er);
3549
- });
3550
- }
3551
- if (Object.setPrototypeOf)
3552
- Object.setPrototypeOf(rename, fs$rename);
3553
- return rename;
3554
- }(fs5.rename);
3555
- }
3556
- fs5.read = typeof fs5.read !== "function" ? fs5.read : function(fs$read) {
3557
- function read(fd, buffer, offset, length, position, callback_) {
3558
- var callback;
3559
- if (callback_ && typeof callback_ === "function") {
3560
- var eagCounter = 0;
3561
- callback = function(er, _, __) {
3562
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
3563
- eagCounter++;
3564
- return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
3565
- }
3566
- callback_.apply(this, arguments);
3567
- };
3568
- }
3569
- return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
3570
- }
3571
- if (Object.setPrototypeOf)
3572
- Object.setPrototypeOf(read, fs$read);
3573
- return read;
3574
- }(fs5.read);
3575
- fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : function(fs$readSync) {
3576
- return function(fd, buffer, offset, length, position) {
3577
- var eagCounter = 0;
3578
- while (true) {
3579
- try {
3580
- return fs$readSync.call(fs5, fd, buffer, offset, length, position);
3581
- } catch (er) {
3582
- if (er.code === "EAGAIN" && eagCounter < 10) {
3583
- eagCounter++;
3584
- continue;
3585
- }
3586
- throw er;
3587
- }
3588
- }
3589
- };
3590
- }(fs5.readSync);
3591
- function patchLchmod(fs6) {
3592
- fs6.lchmod = function(path5, mode, callback) {
3593
- fs6.open(
3594
- path5,
3595
- constants.O_WRONLY | constants.O_SYMLINK,
3596
- mode,
3597
- function(err, fd) {
3598
- if (err) {
3599
- if (callback)
3600
- callback(err);
3601
- return;
3602
- }
3603
- fs6.fchmod(fd, mode, function(err2) {
3604
- fs6.close(fd, function(err22) {
3605
- if (callback)
3606
- callback(err2 || err22);
3607
- });
3608
- });
3609
- }
3610
- );
3611
- };
3612
- fs6.lchmodSync = function(path5, mode) {
3613
- var fd = fs6.openSync(path5, constants.O_WRONLY | constants.O_SYMLINK, mode);
3614
- var threw = true;
3615
- var ret;
3616
- try {
3617
- ret = fs6.fchmodSync(fd, mode);
3618
- threw = false;
3619
- } finally {
3620
- if (threw) {
3621
- try {
3622
- fs6.closeSync(fd);
3623
- } catch (er) {
3624
- }
3625
- } else {
3626
- fs6.closeSync(fd);
3627
- }
3628
- }
3629
- return ret;
3630
- };
3631
- }
3632
- function patchLutimes(fs6) {
3633
- if (constants.hasOwnProperty("O_SYMLINK") && fs6.futimes) {
3634
- fs6.lutimes = function(path5, at, mt, cb) {
3635
- fs6.open(path5, constants.O_SYMLINK, function(er, fd) {
3636
- if (er) {
3637
- if (cb)
3638
- cb(er);
3639
- return;
3640
- }
3641
- fs6.futimes(fd, at, mt, function(er2) {
3642
- fs6.close(fd, function(er22) {
3643
- if (cb)
3644
- cb(er2 || er22);
3645
- });
3646
- });
3647
- });
3648
- };
3649
- fs6.lutimesSync = function(path5, at, mt) {
3650
- var fd = fs6.openSync(path5, constants.O_SYMLINK);
3651
- var ret;
3652
- var threw = true;
3653
- try {
3654
- ret = fs6.futimesSync(fd, at, mt);
3655
- threw = false;
3656
- } finally {
3657
- if (threw) {
3658
- try {
3659
- fs6.closeSync(fd);
3660
- } catch (er) {
3661
- }
3662
- } else {
3663
- fs6.closeSync(fd);
3664
- }
3665
- }
3666
- return ret;
3667
- };
3668
- } else if (fs6.futimes) {
3669
- fs6.lutimes = function(_a, _b, _c, cb) {
3670
- if (cb)
3671
- process.nextTick(cb);
3672
- };
3673
- fs6.lutimesSync = function() {
3674
- };
3675
- }
3676
- }
3677
- function chmodFix(orig) {
3678
- if (!orig)
3679
- return orig;
3680
- return function(target, mode, cb) {
3681
- return orig.call(fs5, target, mode, function(er) {
3682
- if (chownErOk(er))
3683
- er = null;
3684
- if (cb)
3685
- cb.apply(this, arguments);
3686
- });
3687
- };
3688
- }
3689
- function chmodFixSync(orig) {
3690
- if (!orig)
3691
- return orig;
3692
- return function(target, mode) {
3693
- try {
3694
- return orig.call(fs5, target, mode);
3695
- } catch (er) {
3696
- if (!chownErOk(er))
3697
- throw er;
3698
- }
3699
- };
3700
- }
3701
- function chownFix(orig) {
3702
- if (!orig)
3703
- return orig;
3704
- return function(target, uid, gid, cb) {
3705
- return orig.call(fs5, target, uid, gid, function(er) {
3706
- if (chownErOk(er))
3707
- er = null;
3708
- if (cb)
3709
- cb.apply(this, arguments);
3710
- });
3711
- };
3712
- }
3713
- function chownFixSync(orig) {
3714
- if (!orig)
3715
- return orig;
3716
- return function(target, uid, gid) {
3717
- try {
3718
- return orig.call(fs5, target, uid, gid);
3719
- } catch (er) {
3720
- if (!chownErOk(er))
3721
- throw er;
3722
- }
3723
- };
3724
- }
3725
- function statFix(orig) {
3726
- if (!orig)
3727
- return orig;
3728
- return function(target, options, cb) {
3729
- if (typeof options === "function") {
3730
- cb = options;
3731
- options = null;
3732
- }
3733
- function callback(er, stats) {
3734
- if (stats) {
3735
- if (stats.uid < 0)
3736
- stats.uid += 4294967296;
3737
- if (stats.gid < 0)
3738
- stats.gid += 4294967296;
3739
- }
3740
- if (cb)
3741
- cb.apply(this, arguments);
3742
- }
3743
- return options ? orig.call(fs5, target, options, callback) : orig.call(fs5, target, callback);
3744
- };
3745
- }
3746
- function statFixSync(orig) {
3747
- if (!orig)
3748
- return orig;
3749
- return function(target, options) {
3750
- var stats = options ? orig.call(fs5, target, options) : orig.call(fs5, target);
3751
- if (stats) {
3752
- if (stats.uid < 0)
3753
- stats.uid += 4294967296;
3754
- if (stats.gid < 0)
3755
- stats.gid += 4294967296;
3756
- }
3757
- return stats;
3758
- };
3759
- }
3760
- function chownErOk(er) {
3761
- if (!er)
3762
- return true;
3763
- if (er.code === "ENOSYS")
3764
- return true;
3765
- var nonroot = !process.getuid || process.getuid() !== 0;
3766
- if (nonroot) {
3767
- if (er.code === "EINVAL" || er.code === "EPERM")
3768
- return true;
3769
- }
3770
- return false;
3771
- }
3772
- }
3773
- }
3774
- });
3775
-
3776
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
3777
- var require_legacy_streams2 = __commonJS({
3778
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
3779
- var Stream = require("stream").Stream;
3780
- module2.exports = legacy;
3781
- function legacy(fs5) {
3782
- return {
3783
- ReadStream,
3784
- WriteStream
3785
- };
3786
- function ReadStream(path5, options) {
3787
- if (!(this instanceof ReadStream))
3788
- return new ReadStream(path5, options);
3789
- Stream.call(this);
3790
- var self = this;
3791
- this.path = path5;
3792
- this.fd = null;
3793
- this.readable = true;
3794
- this.paused = false;
3795
- this.flags = "r";
3796
- this.mode = 438;
3797
- this.bufferSize = 64 * 1024;
3798
- options = options || {};
3799
- var keys = Object.keys(options);
3800
- for (var index = 0, length = keys.length; index < length; index++) {
3801
- var key = keys[index];
3802
- this[key] = options[key];
3803
- }
3804
- if (this.encoding)
3805
- this.setEncoding(this.encoding);
3806
- if (this.start !== void 0) {
3807
- if ("number" !== typeof this.start) {
3808
- throw TypeError("start must be a Number");
3809
- }
3810
- if (this.end === void 0) {
3811
- this.end = Infinity;
3812
- } else if ("number" !== typeof this.end) {
3813
- throw TypeError("end must be a Number");
3814
- }
3815
- if (this.start > this.end) {
3816
- throw new Error("start must be <= end");
3817
- }
3818
- this.pos = this.start;
3819
- }
3820
- if (this.fd !== null) {
3821
- process.nextTick(function() {
3822
- self._read();
3823
- });
3824
- return;
3825
- }
3826
- fs5.open(this.path, this.flags, this.mode, function(err, fd) {
3827
- if (err) {
3828
- self.emit("error", err);
3829
- self.readable = false;
3830
- return;
3831
- }
3832
- self.fd = fd;
3833
- self.emit("open", fd);
3834
- self._read();
3835
- });
3836
- }
3837
- function WriteStream(path5, options) {
3838
- if (!(this instanceof WriteStream))
3839
- return new WriteStream(path5, options);
3840
- Stream.call(this);
3841
- this.path = path5;
3842
- this.fd = null;
3843
- this.writable = true;
3844
- this.flags = "w";
3845
- this.encoding = "binary";
3846
- this.mode = 438;
3847
- this.bytesWritten = 0;
3848
- options = options || {};
3849
- var keys = Object.keys(options);
3850
- for (var index = 0, length = keys.length; index < length; index++) {
3851
- var key = keys[index];
3852
- this[key] = options[key];
3853
- }
3854
- if (this.start !== void 0) {
3855
- if ("number" !== typeof this.start) {
3856
- throw TypeError("start must be a Number");
3857
- }
3858
- if (this.start < 0) {
3859
- throw new Error("start must be >= zero");
3860
- }
3861
- this.pos = this.start;
3862
- }
3863
- this.busy = false;
3864
- this._queue = [];
3865
- if (this.fd === null) {
3866
- this._open = fs5.open;
3867
- this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
3868
- this.flush();
3869
- }
3870
- }
3871
- }
3872
- }
3873
- });
3874
-
3875
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
3876
- var require_clone2 = __commonJS({
3877
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module2) {
3878
- "use strict";
3879
- module2.exports = clone;
3880
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
3881
- return obj.__proto__;
3882
- };
3883
- function clone(obj) {
3884
- if (obj === null || typeof obj !== "object")
3885
- return obj;
3886
- if (obj instanceof Object)
3887
- var copy = { __proto__: getPrototypeOf(obj) };
3888
- else
3889
- var copy = /* @__PURE__ */ Object.create(null);
3890
- Object.getOwnPropertyNames(obj).forEach(function(key) {
3891
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
3892
- });
3893
- return copy;
3894
- }
3895
- }
3896
- });
3897
-
3898
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
3899
- var require_graceful_fs2 = __commonJS({
3900
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
3901
- var fs5 = require("fs");
3902
- var polyfills = require_polyfills2();
3903
- var legacy = require_legacy_streams2();
3904
- var clone = require_clone2();
3905
- var util = require("util");
3906
- var gracefulQueue;
3907
- var previousSymbol;
3908
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
3909
- gracefulQueue = Symbol.for("graceful-fs.queue");
3910
- previousSymbol = Symbol.for("graceful-fs.previous");
3911
- } else {
3912
- gracefulQueue = "___graceful-fs.queue";
3913
- previousSymbol = "___graceful-fs.previous";
3914
- }
3915
- function noop() {
3916
- }
3917
- function publishQueue(context, queue2) {
3918
- Object.defineProperty(context, gracefulQueue, {
3919
- get: function() {
3920
- return queue2;
3921
- }
3922
- });
3923
- }
3924
- var debug4 = noop;
3925
- if (util.debuglog)
3926
- debug4 = util.debuglog("gfs4");
3927
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
3928
- debug4 = function() {
3929
- var m = util.format.apply(util, arguments);
3930
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
3931
- console.error(m);
3932
- };
3933
- if (!fs5[gracefulQueue]) {
3934
- queue = global[gracefulQueue] || [];
3935
- publishQueue(fs5, queue);
3936
- fs5.close = function(fs$close) {
3937
- function close(fd, cb) {
3938
- return fs$close.call(fs5, fd, function(err) {
3939
- if (!err) {
3940
- resetQueue();
3941
- }
3942
- if (typeof cb === "function")
3943
- cb.apply(this, arguments);
3944
- });
3945
- }
3946
- Object.defineProperty(close, previousSymbol, {
3947
- value: fs$close
3948
- });
3949
- return close;
3950
- }(fs5.close);
3951
- fs5.closeSync = function(fs$closeSync) {
3952
- function closeSync(fd) {
3953
- fs$closeSync.apply(fs5, arguments);
3954
- resetQueue();
3955
- }
3956
- Object.defineProperty(closeSync, previousSymbol, {
3957
- value: fs$closeSync
3958
- });
3959
- return closeSync;
3960
- }(fs5.closeSync);
3961
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
3962
- process.on("exit", function() {
3963
- debug4(fs5[gracefulQueue]);
3964
- require("assert").equal(fs5[gracefulQueue].length, 0);
3965
- });
3966
- }
3967
- }
3968
- var queue;
3969
- if (!global[gracefulQueue]) {
3970
- publishQueue(global, fs5[gracefulQueue]);
3971
- }
3972
- module2.exports = patch(clone(fs5));
3973
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs5.__patched) {
3974
- module2.exports = patch(fs5);
3975
- fs5.__patched = true;
3976
- }
3977
- function patch(fs6) {
3978
- polyfills(fs6);
3979
- fs6.gracefulify = patch;
3980
- fs6.createReadStream = createReadStream;
3981
- fs6.createWriteStream = createWriteStream;
3982
- var fs$readFile = fs6.readFile;
3983
- fs6.readFile = readFile3;
3984
- function readFile3(path5, options, cb) {
3985
- if (typeof options === "function")
3986
- cb = options, options = null;
3987
- return go$readFile(path5, options, cb);
3988
- function go$readFile(path6, options2, cb2, startTime) {
3989
- return fs$readFile(path6, options2, function(err) {
3990
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
3991
- enqueue([go$readFile, [path6, options2, cb2], err, startTime || Date.now(), Date.now()]);
3992
- else {
3993
- if (typeof cb2 === "function")
3994
- cb2.apply(this, arguments);
3995
- }
3996
- });
3997
- }
3998
- }
3999
- var fs$writeFile = fs6.writeFile;
4000
- fs6.writeFile = writeFile2;
4001
- function writeFile2(path5, data, options, cb) {
4002
- if (typeof options === "function")
4003
- cb = options, options = null;
4004
- return go$writeFile(path5, data, options, cb);
4005
- function go$writeFile(path6, data2, options2, cb2, startTime) {
4006
- return fs$writeFile(path6, data2, options2, function(err) {
4007
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
4008
- enqueue([go$writeFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
4009
- else {
4010
- if (typeof cb2 === "function")
4011
- cb2.apply(this, arguments);
4012
- }
4013
- });
4014
- }
4015
- }
4016
- var fs$appendFile = fs6.appendFile;
4017
- if (fs$appendFile)
4018
- fs6.appendFile = appendFile;
4019
- function appendFile(path5, data, options, cb) {
4020
- if (typeof options === "function")
4021
- cb = options, options = null;
4022
- return go$appendFile(path5, data, options, cb);
4023
- function go$appendFile(path6, data2, options2, cb2, startTime) {
4024
- return fs$appendFile(path6, data2, options2, function(err) {
4025
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
4026
- enqueue([go$appendFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
4027
- else {
4028
- if (typeof cb2 === "function")
4029
- cb2.apply(this, arguments);
4030
- }
4031
- });
4032
- }
4033
- }
4034
- var fs$copyFile = fs6.copyFile;
4035
- if (fs$copyFile)
4036
- fs6.copyFile = copyFile;
4037
- function copyFile(src, dest, flags, cb) {
4038
- if (typeof flags === "function") {
4039
- cb = flags;
4040
- flags = 0;
4041
- }
4042
- return go$copyFile(src, dest, flags, cb);
4043
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
4044
- return fs$copyFile(src2, dest2, flags2, function(err) {
4045
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
4046
- enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
4047
- else {
4048
- if (typeof cb2 === "function")
4049
- cb2.apply(this, arguments);
4050
- }
4051
- });
4052
- }
4053
- }
4054
- var fs$readdir = fs6.readdir;
4055
- fs6.readdir = readdir;
4056
- var noReaddirOptionVersions = /^v[0-5]\./;
4057
- function readdir(path5, options, cb) {
4058
- if (typeof options === "function")
4059
- cb = options, options = null;
4060
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path6, options2, cb2, startTime) {
4061
- return fs$readdir(path6, fs$readdirCallback(
4062
- path6,
4063
- options2,
4064
- cb2,
4065
- startTime
4066
- ));
4067
- } : function go$readdir2(path6, options2, cb2, startTime) {
4068
- return fs$readdir(path6, options2, fs$readdirCallback(
4069
- path6,
4070
- options2,
4071
- cb2,
4072
- startTime
4073
- ));
4074
- };
4075
- return go$readdir(path5, options, cb);
4076
- function fs$readdirCallback(path6, options2, cb2, startTime) {
4077
- return function(err, files) {
4078
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
4079
- enqueue([
4080
- go$readdir,
4081
- [path6, options2, cb2],
4082
- err,
4083
- startTime || Date.now(),
4084
- Date.now()
4085
- ]);
4086
- else {
4087
- if (files && files.sort)
4088
- files.sort();
4089
- if (typeof cb2 === "function")
4090
- cb2.call(this, err, files);
4091
- }
4092
- };
4093
- }
4094
- }
4095
- if (process.version.substr(0, 4) === "v0.8") {
4096
- var legStreams = legacy(fs6);
4097
- ReadStream = legStreams.ReadStream;
4098
- WriteStream = legStreams.WriteStream;
4099
- }
4100
- var fs$ReadStream = fs6.ReadStream;
4101
- if (fs$ReadStream) {
4102
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
4103
- ReadStream.prototype.open = ReadStream$open;
4104
- }
4105
- var fs$WriteStream = fs6.WriteStream;
4106
- if (fs$WriteStream) {
4107
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
4108
- WriteStream.prototype.open = WriteStream$open;
4109
- }
4110
- Object.defineProperty(fs6, "ReadStream", {
4111
- get: function() {
4112
- return ReadStream;
4113
- },
4114
- set: function(val) {
4115
- ReadStream = val;
4116
- },
4117
- enumerable: true,
4118
- configurable: true
4119
- });
4120
- Object.defineProperty(fs6, "WriteStream", {
4121
- get: function() {
4122
- return WriteStream;
4123
- },
4124
- set: function(val) {
4125
- WriteStream = val;
4126
- },
4127
- enumerable: true,
4128
- configurable: true
4129
- });
4130
- var FileReadStream = ReadStream;
4131
- Object.defineProperty(fs6, "FileReadStream", {
4132
- get: function() {
4133
- return FileReadStream;
4134
- },
4135
- set: function(val) {
4136
- FileReadStream = val;
4137
- },
4138
- enumerable: true,
4139
- configurable: true
4140
- });
4141
- var FileWriteStream = WriteStream;
4142
- Object.defineProperty(fs6, "FileWriteStream", {
4143
- get: function() {
4144
- return FileWriteStream;
4145
- },
4146
- set: function(val) {
4147
- FileWriteStream = val;
4148
- },
4149
- enumerable: true,
4150
- configurable: true
4151
- });
4152
- function ReadStream(path5, options) {
4153
- if (this instanceof ReadStream)
4154
- return fs$ReadStream.apply(this, arguments), this;
4155
- else
4156
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
4157
- }
4158
- function ReadStream$open() {
4159
- var that = this;
4160
- open(that.path, that.flags, that.mode, function(err, fd) {
4161
- if (err) {
4162
- if (that.autoClose)
4163
- that.destroy();
4164
- that.emit("error", err);
4165
- } else {
4166
- that.fd = fd;
4167
- that.emit("open", fd);
4168
- that.read();
4169
- }
4170
- });
4171
- }
4172
- function WriteStream(path5, options) {
4173
- if (this instanceof WriteStream)
4174
- return fs$WriteStream.apply(this, arguments), this;
4175
- else
4176
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
4177
- }
4178
- function WriteStream$open() {
4179
- var that = this;
4180
- open(that.path, that.flags, that.mode, function(err, fd) {
4181
- if (err) {
4182
- that.destroy();
4183
- that.emit("error", err);
4184
- } else {
4185
- that.fd = fd;
4186
- that.emit("open", fd);
4187
- }
4188
- });
4189
- }
4190
- function createReadStream(path5, options) {
4191
- return new fs6.ReadStream(path5, options);
4192
- }
4193
- function createWriteStream(path5, options) {
4194
- return new fs6.WriteStream(path5, options);
4195
- }
4196
- var fs$open = fs6.open;
4197
- fs6.open = open;
4198
- function open(path5, flags, mode, cb) {
4199
- if (typeof mode === "function")
4200
- cb = mode, mode = null;
4201
- return go$open(path5, flags, mode, cb);
4202
- function go$open(path6, flags2, mode2, cb2, startTime) {
4203
- return fs$open(path6, flags2, mode2, function(err, fd) {
4204
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
4205
- enqueue([go$open, [path6, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
4206
- else {
4207
- if (typeof cb2 === "function")
4208
- cb2.apply(this, arguments);
4209
- }
4210
- });
4211
- }
4212
- }
4213
- return fs6;
4214
- }
4215
- function enqueue(elem) {
4216
- debug4("ENQUEUE", elem[0].name, elem[1]);
4217
- fs5[gracefulQueue].push(elem);
4218
- retry();
4219
- }
4220
- var retryTimer;
4221
- function resetQueue() {
4222
- var now = Date.now();
4223
- for (var i = 0; i < fs5[gracefulQueue].length; ++i) {
4224
- if (fs5[gracefulQueue][i].length > 2) {
4225
- fs5[gracefulQueue][i][3] = now;
4226
- fs5[gracefulQueue][i][4] = now;
4227
- }
3004
+ if (!await pathExists2(dir)) {
3005
+ await mkdirs(dir);
4228
3006
  }
4229
- retry();
3007
+ return fs5.symlink(srcpath, dstpath, toType);
4230
3008
  }
4231
- function retry() {
4232
- clearTimeout(retryTimer);
4233
- retryTimer = void 0;
4234
- if (fs5[gracefulQueue].length === 0)
4235
- return;
4236
- var elem = fs5[gracefulQueue].shift();
4237
- var fn = elem[0];
4238
- var args = elem[1];
4239
- var err = elem[2];
4240
- var startTime = elem[3];
4241
- var lastTime = elem[4];
4242
- if (startTime === void 0) {
4243
- debug4("RETRY", fn.name, args);
4244
- fn.apply(null, args);
4245
- } else if (Date.now() - startTime >= 6e4) {
4246
- debug4("TIMEOUT", fn.name, args);
4247
- var cb = args.pop();
4248
- if (typeof cb === "function")
4249
- cb.call(null, err);
4250
- } else {
4251
- var sinceAttempt = Date.now() - lastTime;
4252
- var sinceStart = Math.max(lastTime - startTime, 1);
4253
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
4254
- if (sinceAttempt >= desiredDelay) {
4255
- debug4("RETRY", fn.name, args);
4256
- fn.apply(null, args.concat([startTime]));
4257
- } else {
4258
- fs5[gracefulQueue].push(elem);
4259
- }
3009
+ function createSymlinkSync(srcpath, dstpath, type) {
3010
+ let stats;
3011
+ try {
3012
+ stats = fs5.lstatSync(dstpath);
3013
+ } catch {
4260
3014
  }
4261
- if (retryTimer === void 0) {
4262
- retryTimer = setTimeout(retry, 0);
3015
+ if (stats && stats.isSymbolicLink()) {
3016
+ const srcStat = fs5.statSync(srcpath);
3017
+ const dstStat = fs5.statSync(dstpath);
3018
+ if (areIdentical(srcStat, dstStat))
3019
+ return;
4263
3020
  }
3021
+ const relative = symlinkPathsSync(srcpath, dstpath);
3022
+ srcpath = relative.toDst;
3023
+ type = symlinkTypeSync(relative.toCwd, type);
3024
+ const dir = path5.dirname(dstpath);
3025
+ const exists = fs5.existsSync(dir);
3026
+ if (exists)
3027
+ return fs5.symlinkSync(srcpath, dstpath, type);
3028
+ mkdirsSync(dir);
3029
+ return fs5.symlinkSync(srcpath, dstpath, type);
3030
+ }
3031
+ module2.exports = {
3032
+ createSymlink: u(createSymlink),
3033
+ createSymlinkSync
3034
+ };
3035
+ }
3036
+ });
3037
+
3038
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js
3039
+ var require_ensure = __commonJS({
3040
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js"(exports, module2) {
3041
+ "use strict";
3042
+ var { createFile, createFileSync } = require_file();
3043
+ var { createLink, createLinkSync } = require_link();
3044
+ var { createSymlink, createSymlinkSync } = require_symlink();
3045
+ module2.exports = {
3046
+ // file
3047
+ createFile,
3048
+ createFileSync,
3049
+ ensureFile: createFile,
3050
+ ensureFileSync: createFileSync,
3051
+ // link
3052
+ createLink,
3053
+ createLinkSync,
3054
+ ensureLink: createLink,
3055
+ ensureLinkSync: createLinkSync,
3056
+ // symlink
3057
+ createSymlink,
3058
+ createSymlinkSync,
3059
+ ensureSymlink: createSymlink,
3060
+ ensureSymlinkSync: createSymlinkSync
3061
+ };
3062
+ }
3063
+ });
3064
+
3065
+ // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js
3066
+ var require_utils2 = __commonJS({
3067
+ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module2) {
3068
+ function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
3069
+ const EOF = finalEOL ? EOL : "";
3070
+ const str = JSON.stringify(obj, replacer, spaces);
3071
+ return str.replace(/\n/g, EOL) + EOF;
3072
+ }
3073
+ function stripBom(content) {
3074
+ if (Buffer.isBuffer(content))
3075
+ content = content.toString("utf8");
3076
+ return content.replace(/^\uFEFF/, "");
4264
3077
  }
3078
+ module2.exports = { stringify, stripBom };
4265
3079
  }
4266
3080
  });
4267
3081
 
4268
- // ../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js
3082
+ // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js
4269
3083
  var require_jsonfile = __commonJS({
4270
- "../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js"(exports, module2) {
3084
+ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module2) {
4271
3085
  var _fs;
4272
3086
  try {
4273
- _fs = require_graceful_fs2();
3087
+ _fs = require_graceful_fs();
4274
3088
  } catch (_) {
4275
3089
  _fs = require("fs");
4276
3090
  }
4277
- function readFile3(file, options, callback) {
4278
- if (callback == null) {
4279
- callback = options;
4280
- options = {};
4281
- }
3091
+ var universalify = require_universalify();
3092
+ var { stringify, stripBom } = require_utils2();
3093
+ async function _readFile(file, options = {}) {
4282
3094
  if (typeof options === "string") {
4283
3095
  options = { encoding: options };
4284
3096
  }
4285
- options = options || {};
4286
- var fs5 = options.fs || _fs;
4287
- var shouldThrow = true;
4288
- if ("throws" in options) {
4289
- shouldThrow = options.throws;
4290
- }
4291
- fs5.readFile(file, options, function(err, data) {
4292
- if (err)
4293
- return callback(err);
4294
- data = stripBom(data);
4295
- var obj;
4296
- try {
4297
- obj = JSON.parse(data, options ? options.reviver : null);
4298
- } catch (err2) {
4299
- if (shouldThrow) {
4300
- err2.message = file + ": " + err2.message;
4301
- return callback(err2);
4302
- } else {
4303
- return callback(null, null);
4304
- }
3097
+ const fs5 = options.fs || _fs;
3098
+ const shouldThrow = "throws" in options ? options.throws : true;
3099
+ let data = await universalify.fromCallback(fs5.readFile)(file, options);
3100
+ data = stripBom(data);
3101
+ let obj;
3102
+ try {
3103
+ obj = JSON.parse(data, options ? options.reviver : null);
3104
+ } catch (err) {
3105
+ if (shouldThrow) {
3106
+ err.message = `${file}: ${err.message}`;
3107
+ throw err;
3108
+ } else {
3109
+ return null;
4305
3110
  }
4306
- callback(null, obj);
4307
- });
3111
+ }
3112
+ return obj;
4308
3113
  }
4309
- function readFileSync(file, options) {
4310
- options = options || {};
3114
+ var readFile3 = universalify.fromPromise(_readFile);
3115
+ function readFileSync(file, options = {}) {
4311
3116
  if (typeof options === "string") {
4312
3117
  options = { encoding: options };
4313
3118
  }
4314
- var fs5 = options.fs || _fs;
4315
- var shouldThrow = true;
4316
- if ("throws" in options) {
4317
- shouldThrow = options.throws;
4318
- }
3119
+ const fs5 = options.fs || _fs;
3120
+ const shouldThrow = "throws" in options ? options.throws : true;
4319
3121
  try {
4320
- var content = fs5.readFileSync(file, options);
3122
+ let content = fs5.readFileSync(file, options);
4321
3123
  content = stripBom(content);
4322
3124
  return JSON.parse(content, options.reviver);
4323
3125
  } catch (err) {
4324
3126
  if (shouldThrow) {
4325
- err.message = file + ": " + err.message;
3127
+ err.message = `${file}: ${err.message}`;
4326
3128
  throw err;
4327
3129
  } else {
4328
3130
  return null;
4329
3131
  }
4330
3132
  }
4331
3133
  }
4332
- function stringify(obj, options) {
4333
- var spaces;
4334
- var EOL = "\n";
4335
- if (typeof options === "object" && options !== null) {
4336
- if (options.spaces) {
4337
- spaces = options.spaces;
4338
- }
4339
- if (options.EOL) {
4340
- EOL = options.EOL;
4341
- }
4342
- }
4343
- var str = JSON.stringify(obj, options ? options.replacer : null, spaces);
4344
- return str.replace(/\n/g, EOL) + EOL;
4345
- }
4346
- function writeFile2(file, obj, options, callback) {
4347
- if (callback == null) {
4348
- callback = options;
4349
- options = {};
4350
- }
4351
- options = options || {};
4352
- var fs5 = options.fs || _fs;
4353
- var str = "";
4354
- try {
4355
- str = stringify(obj, options);
4356
- } catch (err) {
4357
- if (callback)
4358
- callback(err, null);
4359
- return;
4360
- }
4361
- fs5.writeFile(file, str, options, callback);
3134
+ async function _writeFile(file, obj, options = {}) {
3135
+ const fs5 = options.fs || _fs;
3136
+ const str = stringify(obj, options);
3137
+ await universalify.fromCallback(fs5.writeFile)(file, str, options);
4362
3138
  }
4363
- function writeFileSync(file, obj, options) {
4364
- options = options || {};
4365
- var fs5 = options.fs || _fs;
4366
- var str = stringify(obj, options);
3139
+ var writeFile2 = universalify.fromPromise(_writeFile);
3140
+ function writeFileSync(file, obj, options = {}) {
3141
+ const fs5 = options.fs || _fs;
3142
+ const str = stringify(obj, options);
4367
3143
  return fs5.writeFileSync(file, str, options);
4368
3144
  }
4369
- function stripBom(content) {
4370
- if (Buffer.isBuffer(content))
4371
- content = content.toString("utf8");
4372
- content = content.replace(/^\uFEFF/, "");
4373
- return content;
4374
- }
4375
3145
  var jsonfile = {
4376
3146
  readFile: readFile3,
4377
3147
  readFileSync,
@@ -4382,76 +3152,84 @@ var require_jsonfile = __commonJS({
4382
3152
  }
4383
3153
  });
4384
3154
 
4385
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/jsonfile.js
3155
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js
4386
3156
  var require_jsonfile2 = __commonJS({
4387
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module2) {
3157
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module2) {
4388
3158
  "use strict";
4389
- var u = require_universalify().fromCallback;
4390
3159
  var jsonFile = require_jsonfile();
4391
3160
  module2.exports = {
4392
3161
  // jsonfile exports
4393
- readJson: u(jsonFile.readFile),
3162
+ readJson: jsonFile.readFile,
4394
3163
  readJsonSync: jsonFile.readFileSync,
4395
- writeJson: u(jsonFile.writeFile),
3164
+ writeJson: jsonFile.writeFile,
4396
3165
  writeJsonSync: jsonFile.writeFileSync
4397
3166
  };
4398
3167
  }
4399
3168
  });
4400
3169
 
4401
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/output-json.js
4402
- var require_output_json = __commonJS({
4403
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module2) {
3170
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js
3171
+ var require_output_file = __commonJS({
3172
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js"(exports, module2) {
4404
3173
  "use strict";
3174
+ var u = require_universalify().fromPromise;
3175
+ var fs5 = require_fs();
4405
3176
  var path5 = require("path");
4406
- var mkdir = require_mkdirs2();
3177
+ var mkdir = require_mkdirs();
4407
3178
  var pathExists2 = require_path_exists2().pathExists;
4408
- var jsonFile = require_jsonfile2();
4409
- function outputJson(file, data, options, callback) {
4410
- if (typeof options === "function") {
4411
- callback = options;
4412
- options = {};
3179
+ async function outputFile(file, data, encoding = "utf-8") {
3180
+ const dir = path5.dirname(file);
3181
+ if (!await pathExists2(dir)) {
3182
+ await mkdir.mkdirs(dir);
4413
3183
  }
3184
+ return fs5.writeFile(file, data, encoding);
3185
+ }
3186
+ function outputFileSync(file, ...args) {
4414
3187
  const dir = path5.dirname(file);
4415
- pathExists2(dir, (err, itDoes) => {
4416
- if (err)
4417
- return callback(err);
4418
- if (itDoes)
4419
- return jsonFile.writeJson(file, data, options, callback);
4420
- mkdir.mkdirs(dir, (err2) => {
4421
- if (err2)
4422
- return callback(err2);
4423
- jsonFile.writeJson(file, data, options, callback);
4424
- });
4425
- });
3188
+ if (!fs5.existsSync(dir)) {
3189
+ mkdir.mkdirsSync(dir);
3190
+ }
3191
+ fs5.writeFileSync(file, ...args);
3192
+ }
3193
+ module2.exports = {
3194
+ outputFile: u(outputFile),
3195
+ outputFileSync
3196
+ };
3197
+ }
3198
+ });
3199
+
3200
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js
3201
+ var require_output_json = __commonJS({
3202
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module2) {
3203
+ "use strict";
3204
+ var { stringify } = require_utils2();
3205
+ var { outputFile } = require_output_file();
3206
+ async function outputJson(file, data, options = {}) {
3207
+ const str = stringify(data, options);
3208
+ await outputFile(file, str, options);
4426
3209
  }
4427
3210
  module2.exports = outputJson;
4428
3211
  }
4429
3212
  });
4430
3213
 
4431
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/output-json-sync.js
3214
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js
4432
3215
  var require_output_json_sync = __commonJS({
4433
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
3216
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
4434
3217
  "use strict";
4435
- var fs5 = require_graceful_fs();
4436
- var path5 = require("path");
4437
- var mkdir = require_mkdirs2();
4438
- var jsonFile = require_jsonfile2();
3218
+ var { stringify } = require_utils2();
3219
+ var { outputFileSync } = require_output_file();
4439
3220
  function outputJsonSync(file, data, options) {
4440
- const dir = path5.dirname(file);
4441
- if (!fs5.existsSync(dir)) {
4442
- mkdir.mkdirsSync(dir);
4443
- }
4444
- jsonFile.writeJsonSync(file, data, options);
3221
+ const str = stringify(data, options);
3222
+ outputFileSync(file, str, options);
4445
3223
  }
4446
3224
  module2.exports = outputJsonSync;
4447
3225
  }
4448
3226
  });
4449
3227
 
4450
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/index.js
3228
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js
4451
3229
  var require_json = __commonJS({
4452
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/json/index.js"(exports, module2) {
3230
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js"(exports, module2) {
4453
3231
  "use strict";
4454
- var u = require_universalify().fromCallback;
3232
+ var u = require_universalify().fromPromise;
4455
3233
  var jsonFile = require_jsonfile2();
4456
3234
  jsonFile.outputJson = u(require_output_json());
4457
3235
  jsonFile.outputJsonSync = require_output_json_sync();
@@ -4465,261 +3243,145 @@ var require_json = __commonJS({
4465
3243
  }
4466
3244
  });
4467
3245
 
4468
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/move-sync/index.js
4469
- var require_move_sync = __commonJS({
4470
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/move-sync/index.js"(exports, module2) {
3246
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js
3247
+ var require_move = __commonJS({
3248
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js"(exports, module2) {
4471
3249
  "use strict";
4472
- var fs5 = require_graceful_fs();
3250
+ var fs5 = require_fs();
4473
3251
  var path5 = require("path");
4474
- var copySync = require_copy_sync2().copySync;
4475
- var removeSync = require_remove().removeSync;
4476
- var mkdirpSync = require_mkdirs2().mkdirsSync;
4477
- var buffer = require_buffer();
4478
- function moveSync(src, dest, options) {
4479
- options = options || {};
4480
- const overwrite = options.overwrite || options.clobber || false;
4481
- src = path5.resolve(src);
4482
- dest = path5.resolve(dest);
4483
- if (src === dest)
4484
- return fs5.accessSync(src);
4485
- if (isSrcSubdir(src, dest))
4486
- throw new Error(`Cannot move '${src}' into itself '${dest}'.`);
4487
- mkdirpSync(path5.dirname(dest));
4488
- tryRenameSync();
4489
- function tryRenameSync() {
4490
- if (overwrite) {
4491
- try {
4492
- return fs5.renameSync(src, dest);
4493
- } catch (err) {
4494
- if (err.code === "ENOTEMPTY" || err.code === "EEXIST" || err.code === "EPERM") {
4495
- removeSync(dest);
4496
- options.overwrite = false;
4497
- return moveSync(src, dest, options);
4498
- }
4499
- if (err.code !== "EXDEV")
4500
- throw err;
4501
- return moveSyncAcrossDevice(src, dest, overwrite);
4502
- }
4503
- } else {
4504
- try {
4505
- fs5.linkSync(src, dest);
4506
- return fs5.unlinkSync(src);
4507
- } catch (err) {
4508
- if (err.code === "EXDEV" || err.code === "EISDIR" || err.code === "EPERM" || err.code === "ENOTSUP") {
4509
- return moveSyncAcrossDevice(src, dest, overwrite);
4510
- }
4511
- throw err;
4512
- }
4513
- }
3252
+ var { copy } = require_copy2();
3253
+ var { remove: remove2 } = require_remove();
3254
+ var { mkdirp } = require_mkdirs();
3255
+ var { pathExists: pathExists2 } = require_path_exists2();
3256
+ var stat2 = require_stat();
3257
+ async function move(src, dest, opts = {}) {
3258
+ const overwrite = opts.overwrite || opts.clobber || false;
3259
+ const { srcStat, isChangingCase = false } = await stat2.checkPaths(src, dest, "move", opts);
3260
+ await stat2.checkParentPaths(src, srcStat, dest, "move");
3261
+ const destParent = path5.dirname(dest);
3262
+ const parsedParentPath = path5.parse(destParent);
3263
+ if (parsedParentPath.root !== destParent) {
3264
+ await mkdirp(destParent);
4514
3265
  }
3266
+ return doRename(src, dest, overwrite, isChangingCase);
4515
3267
  }
4516
- function moveSyncAcrossDevice(src, dest, overwrite) {
4517
- const stat2 = fs5.statSync(src);
4518
- if (stat2.isDirectory()) {
4519
- return moveDirSyncAcrossDevice(src, dest, overwrite);
4520
- } else {
4521
- return moveFileSyncAcrossDevice(src, dest, overwrite);
4522
- }
4523
- }
4524
- function moveFileSyncAcrossDevice(src, dest, overwrite) {
4525
- const BUF_LENGTH = 64 * 1024;
4526
- const _buff = buffer(BUF_LENGTH);
4527
- const flags = overwrite ? "w" : "wx";
4528
- const fdr = fs5.openSync(src, "r");
4529
- const stat2 = fs5.fstatSync(fdr);
4530
- const fdw = fs5.openSync(dest, flags, stat2.mode);
4531
- let pos = 0;
4532
- while (pos < stat2.size) {
4533
- const bytesRead = fs5.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
4534
- fs5.writeSync(fdw, _buff, 0, bytesRead);
4535
- pos += bytesRead;
4536
- }
4537
- fs5.closeSync(fdr);
4538
- fs5.closeSync(fdw);
4539
- return fs5.unlinkSync(src);
4540
- }
4541
- function moveDirSyncAcrossDevice(src, dest, overwrite) {
4542
- const options = {
4543
- overwrite: false
4544
- };
4545
- if (overwrite) {
4546
- removeSync(dest);
4547
- tryCopySync();
4548
- } else {
4549
- tryCopySync();
4550
- }
4551
- function tryCopySync() {
4552
- copySync(src, dest, options);
4553
- return removeSync(src);
3268
+ async function doRename(src, dest, overwrite, isChangingCase) {
3269
+ if (!isChangingCase) {
3270
+ if (overwrite) {
3271
+ await remove2(dest);
3272
+ } else if (await pathExists2(dest)) {
3273
+ throw new Error("dest already exists.");
3274
+ }
4554
3275
  }
4555
- }
4556
- function isSrcSubdir(src, dest) {
4557
3276
  try {
4558
- return fs5.statSync(src).isDirectory() && src !== dest && dest.indexOf(src) > -1 && dest.split(path5.dirname(src) + path5.sep)[1].split(path5.sep)[0] === path5.basename(src);
4559
- } catch (e) {
4560
- return false;
3277
+ await fs5.rename(src, dest);
3278
+ } catch (err) {
3279
+ if (err.code !== "EXDEV") {
3280
+ throw err;
3281
+ }
3282
+ await moveAcrossDevice(src, dest, overwrite);
4561
3283
  }
4562
3284
  }
4563
- module2.exports = {
4564
- moveSync
4565
- };
3285
+ async function moveAcrossDevice(src, dest, overwrite) {
3286
+ const opts = {
3287
+ overwrite,
3288
+ errorOnExist: true,
3289
+ preserveTimestamps: true
3290
+ };
3291
+ await copy(src, dest, opts);
3292
+ return remove2(src);
3293
+ }
3294
+ module2.exports = move;
4566
3295
  }
4567
3296
  });
4568
3297
 
4569
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/move/index.js
4570
- var require_move = __commonJS({
4571
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
3298
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js
3299
+ var require_move_sync = __commonJS({
3300
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module2) {
4572
3301
  "use strict";
4573
- var u = require_universalify().fromCallback;
4574
3302
  var fs5 = require_graceful_fs();
4575
3303
  var path5 = require("path");
4576
- var copy = require_copy2().copy;
4577
- var remove2 = require_remove().remove;
4578
- var mkdirp = require_mkdirs2().mkdirp;
4579
- var pathExists2 = require_path_exists2().pathExists;
4580
- function move(src, dest, opts, cb) {
4581
- if (typeof opts === "function") {
4582
- cb = opts;
4583
- opts = {};
4584
- }
3304
+ var copySync = require_copy2().copySync;
3305
+ var removeSync = require_remove().removeSync;
3306
+ var mkdirpSync = require_mkdirs().mkdirpSync;
3307
+ var stat2 = require_stat();
3308
+ function moveSync(src, dest, opts) {
3309
+ opts = opts || {};
4585
3310
  const overwrite = opts.overwrite || opts.clobber || false;
4586
- src = path5.resolve(src);
4587
- dest = path5.resolve(dest);
4588
- if (src === dest)
4589
- return fs5.access(src, cb);
4590
- fs5.stat(src, (err, st) => {
4591
- if (err)
4592
- return cb(err);
4593
- if (st.isDirectory() && isSrcSubdir(src, dest)) {
4594
- return cb(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`));
4595
- }
4596
- mkdirp(path5.dirname(dest), (err2) => {
4597
- if (err2)
4598
- return cb(err2);
4599
- return doRename(src, dest, overwrite, cb);
4600
- });
4601
- });
4602
- }
4603
- function doRename(src, dest, overwrite, cb) {
3311
+ const { srcStat, isChangingCase = false } = stat2.checkPathsSync(src, dest, "move", opts);
3312
+ stat2.checkParentPathsSync(src, srcStat, dest, "move");
3313
+ if (!isParentRoot(dest))
3314
+ mkdirpSync(path5.dirname(dest));
3315
+ return doRename(src, dest, overwrite, isChangingCase);
3316
+ }
3317
+ function isParentRoot(dest) {
3318
+ const parent = path5.dirname(dest);
3319
+ const parsedPath = path5.parse(parent);
3320
+ return parsedPath.root === parent;
3321
+ }
3322
+ function doRename(src, dest, overwrite, isChangingCase) {
3323
+ if (isChangingCase)
3324
+ return rename(src, dest, overwrite);
4604
3325
  if (overwrite) {
4605
- return remove2(dest, (err) => {
4606
- if (err)
4607
- return cb(err);
4608
- return rename(src, dest, overwrite, cb);
4609
- });
3326
+ removeSync(dest);
3327
+ return rename(src, dest, overwrite);
4610
3328
  }
4611
- pathExists2(dest, (err, destExists) => {
4612
- if (err)
4613
- return cb(err);
4614
- if (destExists)
4615
- return cb(new Error("dest already exists."));
4616
- return rename(src, dest, overwrite, cb);
4617
- });
3329
+ if (fs5.existsSync(dest))
3330
+ throw new Error("dest already exists.");
3331
+ return rename(src, dest, overwrite);
4618
3332
  }
4619
- function rename(src, dest, overwrite, cb) {
4620
- fs5.rename(src, dest, (err) => {
4621
- if (!err)
4622
- return cb();
3333
+ function rename(src, dest, overwrite) {
3334
+ try {
3335
+ fs5.renameSync(src, dest);
3336
+ } catch (err) {
4623
3337
  if (err.code !== "EXDEV")
4624
- return cb(err);
4625
- return moveAcrossDevice(src, dest, overwrite, cb);
4626
- });
3338
+ throw err;
3339
+ return moveAcrossDevice(src, dest, overwrite);
3340
+ }
4627
3341
  }
4628
- function moveAcrossDevice(src, dest, overwrite, cb) {
3342
+ function moveAcrossDevice(src, dest, overwrite) {
4629
3343
  const opts = {
4630
3344
  overwrite,
4631
- errorOnExist: true
3345
+ errorOnExist: true,
3346
+ preserveTimestamps: true
4632
3347
  };
4633
- copy(src, dest, opts, (err) => {
4634
- if (err)
4635
- return cb(err);
4636
- return remove2(src, cb);
4637
- });
3348
+ copySync(src, dest, opts);
3349
+ return removeSync(src);
4638
3350
  }
4639
- function isSrcSubdir(src, dest) {
4640
- const srcArray = src.split(path5.sep);
4641
- const destArray = dest.split(path5.sep);
4642
- return srcArray.reduce((acc, current, i) => {
4643
- return acc && destArray[i] === current;
4644
- }, true);
4645
- }
4646
- module2.exports = {
4647
- move: u(move)
4648
- };
3351
+ module2.exports = moveSync;
4649
3352
  }
4650
3353
  });
4651
3354
 
4652
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/output/index.js
4653
- var require_output = __commonJS({
4654
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/output/index.js"(exports, module2) {
3355
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js
3356
+ var require_move2 = __commonJS({
3357
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
4655
3358
  "use strict";
4656
- var u = require_universalify().fromCallback;
4657
- var fs5 = require_graceful_fs();
4658
- var path5 = require("path");
4659
- var mkdir = require_mkdirs2();
4660
- var pathExists2 = require_path_exists2().pathExists;
4661
- function outputFile(file, data, encoding, callback) {
4662
- if (typeof encoding === "function") {
4663
- callback = encoding;
4664
- encoding = "utf8";
4665
- }
4666
- const dir = path5.dirname(file);
4667
- pathExists2(dir, (err, itDoes) => {
4668
- if (err)
4669
- return callback(err);
4670
- if (itDoes)
4671
- return fs5.writeFile(file, data, encoding, callback);
4672
- mkdir.mkdirs(dir, (err2) => {
4673
- if (err2)
4674
- return callback(err2);
4675
- fs5.writeFile(file, data, encoding, callback);
4676
- });
4677
- });
4678
- }
4679
- function outputFileSync(file, ...args) {
4680
- const dir = path5.dirname(file);
4681
- if (fs5.existsSync(dir)) {
4682
- return fs5.writeFileSync(file, ...args);
4683
- }
4684
- mkdir.mkdirsSync(dir);
4685
- fs5.writeFileSync(file, ...args);
4686
- }
3359
+ var u = require_universalify().fromPromise;
4687
3360
  module2.exports = {
4688
- outputFile: u(outputFile),
4689
- outputFileSync
3361
+ move: u(require_move()),
3362
+ moveSync: require_move_sync()
4690
3363
  };
4691
3364
  }
4692
3365
  });
4693
3366
 
4694
- // ../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/index.js
3367
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js
4695
3368
  var require_lib2 = __commonJS({
4696
- "../../node_modules/.pnpm/fs-extra@7.0.0/node_modules/fs-extra/lib/index.js"(exports, module2) {
3369
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js"(exports, module2) {
4697
3370
  "use strict";
4698
- module2.exports = Object.assign(
4699
- {},
3371
+ module2.exports = {
4700
3372
  // Export promiseified graceful-fs:
4701
- require_fs(),
3373
+ ...require_fs(),
4702
3374
  // Export extra methods:
4703
- require_copy_sync2(),
4704
- require_copy2(),
4705
- require_empty(),
4706
- require_ensure(),
4707
- require_json(),
4708
- require_mkdirs2(),
4709
- require_move_sync(),
4710
- require_move(),
4711
- require_output(),
4712
- require_path_exists2(),
4713
- require_remove()
4714
- );
4715
- var fs5 = require("fs");
4716
- if (Object.getOwnPropertyDescriptor(fs5, "promises")) {
4717
- Object.defineProperty(module2.exports, "promises", {
4718
- get() {
4719
- return fs5.promises;
4720
- }
4721
- });
4722
- }
3375
+ ...require_copy2(),
3376
+ ...require_empty(),
3377
+ ...require_ensure(),
3378
+ ...require_json(),
3379
+ ...require_mkdirs(),
3380
+ ...require_move2(),
3381
+ ...require_output_file(),
3382
+ ...require_path_exists2(),
3383
+ ...require_remove()
3384
+ };
4723
3385
  }
4724
3386
  });
4725
3387
 
@@ -11698,6 +10360,7 @@ var src_exports = {};
11698
10360
  __export(src_exports, {
11699
10361
  MAX_AGE_ONE_YEAR: () => MAX_AGE_ONE_YEAR,
11700
10362
  build: () => build,
10363
+ diagnostics: () => diagnostics,
11701
10364
  htmlContentType: () => htmlContentType,
11702
10365
  prepareCache: () => prepareCache,
11703
10366
  version: () => version
@@ -12710,7 +11373,8 @@ async function getPageLambdaGroups({
12710
11373
  internalPages,
12711
11374
  pageExtensions,
12712
11375
  inversedAppPathManifest,
12713
- experimentalAllowBundling
11376
+ experimentalAllowBundling,
11377
+ isRouteHandlers
12714
11378
  }) {
12715
11379
  const groups = [];
12716
11380
  for (const page of pages) {
@@ -12764,7 +11428,7 @@ async function getPageLambdaGroups({
12764
11428
  ...opts,
12765
11429
  isPrerenders: isPrerenderRoute,
12766
11430
  isExperimentalPPR,
12767
- isApiLambda: !!isApiPage(page),
11431
+ isApiLambda: !!isApiPage(page) || !!isRouteHandlers,
12768
11432
  pseudoLayerBytes: initialPseudoLayer.pseudoLayerBytes,
12769
11433
  pseudoLayerUncompressedBytes: initialPseudoLayerUncompressed,
12770
11434
  pseudoLayer: Object.assign({}, initialPseudoLayer.pseudoLayer)
@@ -14615,7 +13279,8 @@ async function serverBuild({
14615
13279
  initialFileReasons = /* @__PURE__ */ new Map();
14616
13280
  (0, import_build_utils2.debug)("Using next-server.js.nft.json trace from build");
14617
13281
  } else {
14618
- (0, import_build_utils2.debug)("tracing initial Next.js server files");
13282
+ const serverTraceLabel = `Tracing initial Next.js server files due to missing build trace`;
13283
+ console.time(serverTraceLabel);
14619
13284
  const result = await (0, import_nft.nodeFileTrace)([nextServerFile], {
14620
13285
  base: baseDir,
14621
13286
  cache: {},
@@ -14637,6 +13302,7 @@ async function serverBuild({
14637
13302
  });
14638
13303
  initialFileList = Array.from(result.fileList);
14639
13304
  initialFileReasons = result.reasons;
13305
+ console.timeEnd(serverTraceLabel);
14640
13306
  }
14641
13307
  if (instrumentationHookBuildTrace) {
14642
13308
  initialFileList = initialFileList.concat(
@@ -14849,13 +13515,21 @@ async function serverBuild({
14849
13515
  return pageBuildTraces[page + ".nft.json"] || appBuildTraces[page + ".nft.json"];
14850
13516
  };
14851
13517
  const pathsToTrace = mergedPageKeys.map((page) => {
14852
- if (!getBuildTraceFile(page)) {
13518
+ const originalPagePath = getOriginalPagePath(page);
13519
+ if (!getBuildTraceFile(originalPagePath)) {
14853
13520
  return lambdaPages[page].fsPath;
14854
13521
  }
14855
13522
  }).filter(Boolean);
14856
13523
  let traceResult;
14857
13524
  let parentFilesMap;
14858
13525
  if (pathsToTrace.length > 0) {
13526
+ const traceLabel = `Tracing entries due to missing build traces:
13527
+ ${JSON.stringify(
13528
+ pathsToTrace,
13529
+ null,
13530
+ 2
13531
+ )}`;
13532
+ console.time(traceLabel);
14859
13533
  traceResult = await (0, import_nft.nodeFileTrace)(pathsToTrace, {
14860
13534
  base: baseDir,
14861
13535
  cache: traceCache,
@@ -14866,6 +13540,7 @@ async function serverBuild({
14866
13540
  traceResult.fileList,
14867
13541
  traceResult.reasons
14868
13542
  );
13543
+ console.timeEnd(traceLabel);
14869
13544
  }
14870
13545
  for (const page of mergedPageKeys) {
14871
13546
  const tracedFiles = {};
@@ -14995,7 +13670,8 @@ async function serverBuild({
14995
13670
  initialPseudoLayerUncompressed: uncompressedInitialSize,
14996
13671
  internalPages,
14997
13672
  pageExtensions,
14998
- inversedAppPathManifest
13673
+ inversedAppPathManifest,
13674
+ isRouteHandlers: true
14999
13675
  });
15000
13676
  const appRouterStreamingActionLambdaGroups = [];
15001
13677
  for (const group of appRouterLambdaGroups) {
@@ -15511,10 +14187,6 @@ async function serverBuild({
15511
14187
  if (appPathRoutesManifest) {
15512
14188
  const edgeFunctions = middleware.edgeFunctions;
15513
14189
  for (const route of Object.values(appPathRoutesManifest)) {
15514
- const ogRoute = inversedAppPathManifest[route];
15515
- if (ogRoute.endsWith("/route")) {
15516
- continue;
15517
- }
15518
14190
  const pathname = import_path4.default.posix.join(
15519
14191
  "./",
15520
14192
  entryDirectory,
@@ -16272,14 +14944,15 @@ function isLegacyNext(nextVersion) {
16272
14944
  }
16273
14945
  return true;
16274
14946
  }
16275
- var build = async ({
16276
- files,
16277
- workPath,
16278
- repoRootPath,
16279
- entrypoint,
16280
- config = {},
16281
- meta = {}
16282
- }) => {
14947
+ var build = async (buildOptions) => {
14948
+ let { workPath, repoRootPath } = buildOptions;
14949
+ const {
14950
+ files,
14951
+ entrypoint,
14952
+ config = {},
14953
+ meta = {},
14954
+ buildCallback
14955
+ } = buildOptions;
16283
14956
  validateEntrypoint(entrypoint);
16284
14957
  let entryDirectory = import_path5.default.dirname(entrypoint);
16285
14958
  let entryPath = import_path5.default.join(workPath, entryDirectory);
@@ -16481,6 +15154,9 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16481
15154
  });
16482
15155
  }
16483
15156
  (0, import_build_utils3.debug)("build command exited");
15157
+ if (buildCallback) {
15158
+ await buildCallback(buildOptions);
15159
+ }
16484
15160
  let buildOutputVersion;
16485
15161
  try {
16486
15162
  const data = await (0, import_fs_extra6.readJSON)(
@@ -18187,6 +16863,33 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18187
16863
  framework: { version: nextVersion }
18188
16864
  };
18189
16865
  };
16866
+ var diagnostics = async ({
16867
+ config,
16868
+ entrypoint,
16869
+ workPath,
16870
+ repoRootPath
16871
+ }) => {
16872
+ const entryDirectory = import_path5.default.dirname(entrypoint);
16873
+ const entryPath = import_path5.default.join(workPath, entryDirectory);
16874
+ const outputDirectory = import_path5.default.join("./", config.outputDirectory || ".next");
16875
+ const basePath = repoRootPath || workPath;
16876
+ const diagnosticsEntrypoint = import_path5.default.relative(basePath, entryPath);
16877
+ (0, import_build_utils3.debug)(
16878
+ `Reading diagnostics file in diagnosticsEntrypoint=${diagnosticsEntrypoint}`
16879
+ );
16880
+ return {
16881
+ // Collect output in `.next/diagnostics`
16882
+ ...await (0, import_build_utils3.glob)(
16883
+ "diagnostics/*",
16884
+ import_path5.default.join(basePath, diagnosticsEntrypoint, outputDirectory, "diagnostics")
16885
+ ),
16886
+ // Collect `.next/trace` file
16887
+ ...await (0, import_build_utils3.glob)(
16888
+ "trace",
16889
+ import_path5.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
16890
+ )
16891
+ };
16892
+ };
18190
16893
  var prepareCache = async ({
18191
16894
  workPath,
18192
16895
  repoRootPath,
@@ -18223,6 +16926,7 @@ var prepareCache = async ({
18223
16926
  0 && (module.exports = {
18224
16927
  MAX_AGE_ONE_YEAR,
18225
16928
  build,
16929
+ diagnostics,
18226
16930
  htmlContentType,
18227
16931
  prepareCache,
18228
16932
  version