create-rspress 1.18.2 → 1.18.4

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 +393 -576
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -5936,9 +5936,9 @@ var require_graceful_fs = __commonJS({
5936
5936
  }
5937
5937
  });
5938
5938
 
5939
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/fs/index.js
5939
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js
5940
5940
  var require_fs = __commonJS({
5941
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/fs/index.js"(exports) {
5941
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js"(exports) {
5942
5942
  "use strict";
5943
5943
  var u = require_universalify().fromCallback;
5944
5944
  var fs3 = require_graceful_fs();
@@ -6052,9 +6052,9 @@ var require_fs = __commonJS({
6052
6052
  }
6053
6053
  });
6054
6054
 
6055
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/utils.js
6055
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js
6056
6056
  var require_utils = __commonJS({
6057
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module2) {
6057
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module2) {
6058
6058
  "use strict";
6059
6059
  var path3 = require("path");
6060
6060
  module2.exports.checkPath = function checkPath(pth) {
@@ -6070,9 +6070,9 @@ var require_utils = __commonJS({
6070
6070
  }
6071
6071
  });
6072
6072
 
6073
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/make-dir.js
6073
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js
6074
6074
  var require_make_dir = __commonJS({
6075
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module2) {
6075
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module2) {
6076
6076
  "use strict";
6077
6077
  var fs3 = require_fs();
6078
6078
  var { checkPath } = require_utils();
@@ -6099,9 +6099,9 @@ var require_make_dir = __commonJS({
6099
6099
  }
6100
6100
  });
6101
6101
 
6102
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/index.js
6102
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js
6103
6103
  var require_mkdirs = __commonJS({
6104
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module2) {
6104
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module2) {
6105
6105
  "use strict";
6106
6106
  var u = require_universalify().fromPromise;
6107
6107
  var { makeDir: _makeDir, makeDirSync } = require_make_dir();
@@ -6118,9 +6118,9 @@ var require_mkdirs = __commonJS({
6118
6118
  }
6119
6119
  });
6120
6120
 
6121
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/path-exists/index.js
6121
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js
6122
6122
  var require_path_exists = __commonJS({
6123
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
6123
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
6124
6124
  "use strict";
6125
6125
  var u = require_universalify().fromPromise;
6126
6126
  var fs3 = require_fs();
@@ -6134,22 +6134,27 @@ var require_path_exists = __commonJS({
6134
6134
  }
6135
6135
  });
6136
6136
 
6137
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/utimes.js
6137
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js
6138
6138
  var require_utimes = __commonJS({
6139
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
6139
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
6140
6140
  "use strict";
6141
- var fs3 = require_graceful_fs();
6142
- function utimesMillis(path3, atime, mtime, callback) {
6143
- fs3.open(path3, "r+", (err, fd) => {
6144
- if (err)
6145
- return callback(err);
6146
- fs3.futimes(fd, atime, mtime, (futimesErr) => {
6147
- fs3.close(fd, (closeErr) => {
6148
- if (callback)
6149
- callback(futimesErr || closeErr);
6150
- });
6151
- });
6152
- });
6141
+ var fs3 = require_fs();
6142
+ var u = require_universalify().fromPromise;
6143
+ async function utimesMillis(path3, atime, mtime) {
6144
+ const fd = await fs3.open(path3, "r+");
6145
+ let closeErr = null;
6146
+ try {
6147
+ await fs3.futimes(fd, atime, mtime);
6148
+ } finally {
6149
+ try {
6150
+ await fs3.close(fd);
6151
+ } catch (e) {
6152
+ closeErr = e;
6153
+ }
6154
+ }
6155
+ if (closeErr) {
6156
+ throw closeErr;
6157
+ }
6153
6158
  }
6154
6159
  function utimesMillisSync(path3, atime, mtime) {
6155
6160
  const fd = fs3.openSync(path3, "r+");
@@ -6157,19 +6162,19 @@ var require_utimes = __commonJS({
6157
6162
  return fs3.closeSync(fd);
6158
6163
  }
6159
6164
  module2.exports = {
6160
- utimesMillis,
6165
+ utimesMillis: u(utimesMillis),
6161
6166
  utimesMillisSync
6162
6167
  };
6163
6168
  }
6164
6169
  });
6165
6170
 
6166
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/stat.js
6171
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js
6167
6172
  var require_stat = __commonJS({
6168
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/stat.js"(exports, module2) {
6173
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js"(exports, module2) {
6169
6174
  "use strict";
6170
6175
  var fs3 = require_fs();
6171
6176
  var path3 = require("path");
6172
- var util = require("util");
6177
+ var u = require_universalify().fromPromise;
6173
6178
  function getStats(src, dest, opts) {
6174
6179
  const statFunc = opts.dereference ? (file) => fs3.stat(file, { bigint: true }) : (file) => fs3.lstat(file, { bigint: true });
6175
6180
  return Promise.all([
@@ -6194,32 +6199,28 @@ var require_stat = __commonJS({
6194
6199
  }
6195
6200
  return { srcStat, destStat };
6196
6201
  }
6197
- function checkPaths(src, dest, funcName, opts, cb) {
6198
- util.callbackify(getStats)(src, dest, opts, (err, stats) => {
6199
- if (err)
6200
- return cb(err);
6201
- const { srcStat, destStat } = stats;
6202
- if (destStat) {
6203
- if (areIdentical(srcStat, destStat)) {
6204
- const srcBaseName = path3.basename(src);
6205
- const destBaseName = path3.basename(dest);
6206
- if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
6207
- return cb(null, { srcStat, destStat, isChangingCase: true });
6208
- }
6209
- return cb(new Error("Source and destination must not be the same."));
6210
- }
6211
- if (srcStat.isDirectory() && !destStat.isDirectory()) {
6212
- return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
6213
- }
6214
- if (!srcStat.isDirectory() && destStat.isDirectory()) {
6215
- return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`));
6202
+ async function checkPaths(src, dest, funcName, opts) {
6203
+ const { srcStat, destStat } = await getStats(src, dest, opts);
6204
+ if (destStat) {
6205
+ if (areIdentical(srcStat, destStat)) {
6206
+ const srcBaseName = path3.basename(src);
6207
+ const destBaseName = path3.basename(dest);
6208
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
6209
+ return { srcStat, destStat, isChangingCase: true };
6216
6210
  }
6211
+ throw new Error("Source and destination must not be the same.");
6212
+ }
6213
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
6214
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
6217
6215
  }
6218
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
6219
- return cb(new Error(errMsg(src, dest, funcName)));
6216
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
6217
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
6220
6218
  }
6221
- return cb(null, { srcStat, destStat });
6222
- });
6219
+ }
6220
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
6221
+ throw new Error(errMsg(src, dest, funcName));
6222
+ }
6223
+ return { srcStat, destStat };
6223
6224
  }
6224
6225
  function checkPathsSync(src, dest, funcName, opts) {
6225
6226
  const { srcStat, destStat } = getStatsSync(src, dest, opts);
@@ -6244,22 +6245,23 @@ var require_stat = __commonJS({
6244
6245
  }
6245
6246
  return { srcStat, destStat };
6246
6247
  }
6247
- function checkParentPaths(src, srcStat, dest, funcName, cb) {
6248
+ async function checkParentPaths(src, srcStat, dest, funcName) {
6248
6249
  const srcParent = path3.resolve(path3.dirname(src));
6249
6250
  const destParent = path3.resolve(path3.dirname(dest));
6250
6251
  if (destParent === srcParent || destParent === path3.parse(destParent).root)
6251
- return cb();
6252
- fs3.stat(destParent, { bigint: true }, (err, destStat) => {
6253
- if (err) {
6254
- if (err.code === "ENOENT")
6255
- return cb();
6256
- return cb(err);
6257
- }
6258
- if (areIdentical(srcStat, destStat)) {
6259
- return cb(new Error(errMsg(src, dest, funcName)));
6260
- }
6261
- return checkParentPaths(src, srcStat, destParent, funcName, cb);
6262
- });
6252
+ return;
6253
+ let destStat;
6254
+ try {
6255
+ destStat = await fs3.stat(destParent, { bigint: true });
6256
+ } catch (err) {
6257
+ if (err.code === "ENOENT")
6258
+ return;
6259
+ throw err;
6260
+ }
6261
+ if (areIdentical(srcStat, destStat)) {
6262
+ throw new Error(errMsg(src, dest, funcName));
6263
+ }
6264
+ return checkParentPaths(src, srcStat, destParent, funcName);
6263
6265
  }
6264
6266
  function checkParentPathsSync(src, srcStat, dest, funcName) {
6265
6267
  const srcParent = path3.resolve(path3.dirname(src));
@@ -6285,42 +6287,39 @@ var require_stat = __commonJS({
6285
6287
  function isSrcSubdir(src, dest) {
6286
6288
  const srcArr = path3.resolve(src).split(path3.sep).filter((i) => i);
6287
6289
  const destArr = path3.resolve(dest).split(path3.sep).filter((i) => i);
6288
- return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true);
6290
+ return srcArr.every((cur, i) => destArr[i] === cur);
6289
6291
  }
6290
6292
  function errMsg(src, dest, funcName) {
6291
6293
  return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
6292
6294
  }
6293
6295
  module2.exports = {
6294
- checkPaths,
6296
+ // checkPaths
6297
+ checkPaths: u(checkPaths),
6295
6298
  checkPathsSync,
6296
- checkParentPaths,
6299
+ // checkParent
6300
+ checkParentPaths: u(checkParentPaths),
6297
6301
  checkParentPathsSync,
6302
+ // Misc
6298
6303
  isSrcSubdir,
6299
6304
  areIdentical
6300
6305
  };
6301
6306
  }
6302
6307
  });
6303
6308
 
6304
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy.js
6309
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js
6305
6310
  var require_copy = __commonJS({
6306
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
6311
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
6307
6312
  "use strict";
6308
- var fs3 = require_graceful_fs();
6313
+ var fs3 = require_fs();
6309
6314
  var path3 = require("path");
6310
- var mkdirs = require_mkdirs().mkdirs;
6311
- var pathExists = require_path_exists().pathExists;
6312
- var utimesMillis = require_utimes().utimesMillis;
6315
+ var { mkdirs } = require_mkdirs();
6316
+ var { pathExists } = require_path_exists();
6317
+ var { utimesMillis } = require_utimes();
6313
6318
  var stat = require_stat();
6314
- function copy(src, dest, opts, cb) {
6315
- if (typeof opts === "function" && !cb) {
6316
- cb = opts;
6317
- opts = {};
6318
- } else if (typeof opts === "function") {
6319
+ async function copy(src, dest, opts = {}) {
6320
+ if (typeof opts === "function") {
6319
6321
  opts = { filter: opts };
6320
6322
  }
6321
- cb = cb || function() {
6322
- };
6323
- opts = opts || {};
6324
6323
  opts.clobber = "clobber" in opts ? !!opts.clobber : true;
6325
6324
  opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
6326
6325
  if (opts.preserveTimestamps && process.arch === "ia32") {
@@ -6330,212 +6329,119 @@ var require_copy = __commonJS({
6330
6329
  "fs-extra-WARN0001"
6331
6330
  );
6332
6331
  }
6333
- stat.checkPaths(src, dest, "copy", opts, (err, stats) => {
6334
- if (err)
6335
- return cb(err);
6336
- const { srcStat, destStat } = stats;
6337
- stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => {
6338
- if (err2)
6339
- return cb(err2);
6340
- runFilter(src, dest, opts, (err3, include) => {
6341
- if (err3)
6342
- return cb(err3);
6343
- if (!include)
6344
- return cb();
6345
- checkParentDir(destStat, src, dest, opts, cb);
6346
- });
6347
- });
6348
- });
6349
- }
6350
- function checkParentDir(destStat, src, dest, opts, cb) {
6332
+ const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
6333
+ await stat.checkParentPaths(src, srcStat, dest, "copy");
6334
+ const include = await runFilter(src, dest, opts);
6335
+ if (!include)
6336
+ return;
6351
6337
  const destParent = path3.dirname(dest);
6352
- pathExists(destParent, (err, dirExists) => {
6353
- if (err)
6354
- return cb(err);
6355
- if (dirExists)
6356
- return getStats(destStat, src, dest, opts, cb);
6357
- mkdirs(destParent, (err2) => {
6358
- if (err2)
6359
- return cb(err2);
6360
- return getStats(destStat, src, dest, opts, cb);
6361
- });
6362
- });
6338
+ const dirExists = await pathExists(destParent);
6339
+ if (!dirExists) {
6340
+ await mkdirs(destParent);
6341
+ }
6342
+ await getStatsAndPerformCopy(destStat, src, dest, opts);
6363
6343
  }
6364
- function runFilter(src, dest, opts, cb) {
6344
+ async function runFilter(src, dest, opts) {
6365
6345
  if (!opts.filter)
6366
- return cb(null, true);
6367
- Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error));
6368
- }
6369
- function getStats(destStat, src, dest, opts, cb) {
6370
- const stat2 = opts.dereference ? fs3.stat : fs3.lstat;
6371
- stat2(src, (err, srcStat) => {
6372
- if (err)
6373
- return cb(err);
6374
- if (srcStat.isDirectory())
6375
- return onDir(srcStat, destStat, src, dest, opts, cb);
6376
- else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
6377
- return onFile(srcStat, destStat, src, dest, opts, cb);
6378
- else if (srcStat.isSymbolicLink())
6379
- return onLink(destStat, src, dest, opts, cb);
6380
- else if (srcStat.isSocket())
6381
- return cb(new Error(`Cannot copy a socket file: ${src}`));
6382
- else if (srcStat.isFIFO())
6383
- return cb(new Error(`Cannot copy a FIFO pipe: ${src}`));
6384
- return cb(new Error(`Unknown file: ${src}`));
6385
- });
6346
+ return true;
6347
+ return opts.filter(src, dest);
6386
6348
  }
6387
- function onFile(srcStat, destStat, src, dest, opts, cb) {
6388
- if (!destStat)
6389
- return copyFile(srcStat, src, dest, opts, cb);
6390
- return mayCopyFile(srcStat, src, dest, opts, cb);
6349
+ async function getStatsAndPerformCopy(destStat, src, dest, opts) {
6350
+ const statFn = opts.dereference ? fs3.stat : fs3.lstat;
6351
+ const srcStat = await statFn(src);
6352
+ if (srcStat.isDirectory())
6353
+ return onDir(srcStat, destStat, src, dest, opts);
6354
+ if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
6355
+ return onFile(srcStat, destStat, src, dest, opts);
6356
+ if (srcStat.isSymbolicLink())
6357
+ return onLink(destStat, src, dest, opts);
6358
+ if (srcStat.isSocket())
6359
+ throw new Error(`Cannot copy a socket file: ${src}`);
6360
+ if (srcStat.isFIFO())
6361
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
6362
+ throw new Error(`Unknown file: ${src}`);
6391
6363
  }
6392
- function mayCopyFile(srcStat, src, dest, opts, cb) {
6364
+ async function onFile(srcStat, destStat, src, dest, opts) {
6365
+ if (!destStat)
6366
+ return copyFile(srcStat, src, dest, opts);
6393
6367
  if (opts.overwrite) {
6394
- fs3.unlink(dest, (err) => {
6395
- if (err)
6396
- return cb(err);
6397
- return copyFile(srcStat, src, dest, opts, cb);
6398
- });
6399
- } else if (opts.errorOnExist) {
6400
- return cb(new Error(`'${dest}' already exists`));
6401
- } else
6402
- return cb();
6403
- }
6404
- function copyFile(srcStat, src, dest, opts, cb) {
6405
- fs3.copyFile(src, dest, (err) => {
6406
- if (err)
6407
- return cb(err);
6408
- if (opts.preserveTimestamps)
6409
- return handleTimestampsAndMode(srcStat.mode, src, dest, cb);
6410
- return setDestMode(dest, srcStat.mode, cb);
6411
- });
6368
+ await fs3.unlink(dest);
6369
+ return copyFile(srcStat, src, dest, opts);
6370
+ }
6371
+ if (opts.errorOnExist) {
6372
+ throw new Error(`'${dest}' already exists`);
6373
+ }
6412
6374
  }
6413
- function handleTimestampsAndMode(srcMode, src, dest, cb) {
6414
- if (fileIsNotWritable(srcMode)) {
6415
- return makeFileWritable(dest, srcMode, (err) => {
6416
- if (err)
6417
- return cb(err);
6418
- return setDestTimestampsAndMode(srcMode, src, dest, cb);
6419
- });
6375
+ async function copyFile(srcStat, src, dest, opts) {
6376
+ await fs3.copyFile(src, dest);
6377
+ if (opts.preserveTimestamps) {
6378
+ if (fileIsNotWritable(srcStat.mode)) {
6379
+ await makeFileWritable(dest, srcStat.mode);
6380
+ }
6381
+ const updatedSrcStat = await fs3.stat(src);
6382
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
6420
6383
  }
6421
- return setDestTimestampsAndMode(srcMode, src, dest, cb);
6384
+ return fs3.chmod(dest, srcStat.mode);
6422
6385
  }
6423
6386
  function fileIsNotWritable(srcMode) {
6424
6387
  return (srcMode & 128) === 0;
6425
6388
  }
6426
- function makeFileWritable(dest, srcMode, cb) {
6427
- return setDestMode(dest, srcMode | 128, cb);
6428
- }
6429
- function setDestTimestampsAndMode(srcMode, src, dest, cb) {
6430
- setDestTimestamps(src, dest, (err) => {
6431
- if (err)
6432
- return cb(err);
6433
- return setDestMode(dest, srcMode, cb);
6434
- });
6435
- }
6436
- function setDestMode(dest, srcMode, cb) {
6437
- return fs3.chmod(dest, srcMode, cb);
6438
- }
6439
- function setDestTimestamps(src, dest, cb) {
6440
- fs3.stat(src, (err, updatedSrcStat) => {
6441
- if (err)
6442
- return cb(err);
6443
- return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb);
6444
- });
6445
- }
6446
- function onDir(srcStat, destStat, src, dest, opts, cb) {
6447
- if (!destStat)
6448
- return mkDirAndCopy(srcStat.mode, src, dest, opts, cb);
6449
- return copyDir(src, dest, opts, cb);
6450
- }
6451
- function mkDirAndCopy(srcMode, src, dest, opts, cb) {
6452
- fs3.mkdir(dest, (err) => {
6453
- if (err)
6454
- return cb(err);
6455
- copyDir(src, dest, opts, (err2) => {
6456
- if (err2)
6457
- return cb(err2);
6458
- return setDestMode(dest, srcMode, cb);
6459
- });
6460
- });
6461
- }
6462
- function copyDir(src, dest, opts, cb) {
6463
- fs3.readdir(src, (err, items) => {
6464
- if (err)
6465
- return cb(err);
6466
- return copyDirItems(items, src, dest, opts, cb);
6467
- });
6468
- }
6469
- function copyDirItems(items, src, dest, opts, cb) {
6470
- const item = items.pop();
6471
- if (!item)
6472
- return cb();
6473
- return copyDirItem(items, item, src, dest, opts, cb);
6389
+ function makeFileWritable(dest, srcMode) {
6390
+ return fs3.chmod(dest, srcMode | 128);
6474
6391
  }
6475
- function copyDirItem(items, item, src, dest, opts, cb) {
6476
- const srcItem = path3.join(src, item);
6477
- const destItem = path3.join(dest, item);
6478
- runFilter(srcItem, destItem, opts, (err, include) => {
6479
- if (err)
6480
- return cb(err);
6392
+ async function onDir(srcStat, destStat, src, dest, opts) {
6393
+ if (!destStat) {
6394
+ await fs3.mkdir(dest);
6395
+ }
6396
+ const items = await fs3.readdir(src);
6397
+ await Promise.all(items.map(async (item) => {
6398
+ const srcItem = path3.join(src, item);
6399
+ const destItem = path3.join(dest, item);
6400
+ const include = await runFilter(srcItem, destItem, opts);
6481
6401
  if (!include)
6482
- return copyDirItems(items, src, dest, opts, cb);
6483
- stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => {
6484
- if (err2)
6485
- return cb(err2);
6486
- const { destStat } = stats;
6487
- getStats(destStat, srcItem, destItem, opts, (err3) => {
6488
- if (err3)
6489
- return cb(err3);
6490
- return copyDirItems(items, src, dest, opts, cb);
6491
- });
6492
- });
6493
- });
6494
- }
6495
- function onLink(destStat, src, dest, opts, cb) {
6496
- fs3.readlink(src, (err, resolvedSrc) => {
6497
- if (err)
6498
- return cb(err);
6499
- if (opts.dereference) {
6500
- resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
6501
- }
6502
- if (!destStat) {
6503
- return fs3.symlink(resolvedSrc, dest, cb);
6504
- } else {
6505
- fs3.readlink(dest, (err2, resolvedDest) => {
6506
- if (err2) {
6507
- if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
6508
- return fs3.symlink(resolvedSrc, dest, cb);
6509
- return cb(err2);
6510
- }
6511
- if (opts.dereference) {
6512
- resolvedDest = path3.resolve(process.cwd(), resolvedDest);
6513
- }
6514
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
6515
- return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
6516
- }
6517
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
6518
- return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
6519
- }
6520
- return copyLink(resolvedSrc, dest, cb);
6521
- });
6522
- }
6523
- });
6402
+ return;
6403
+ const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
6404
+ return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
6405
+ }));
6406
+ if (!destStat) {
6407
+ await fs3.chmod(dest, srcStat.mode);
6408
+ }
6524
6409
  }
6525
- function copyLink(resolvedSrc, dest, cb) {
6526
- fs3.unlink(dest, (err) => {
6527
- if (err)
6528
- return cb(err);
6529
- return fs3.symlink(resolvedSrc, dest, cb);
6530
- });
6410
+ async function onLink(destStat, src, dest, opts) {
6411
+ let resolvedSrc = await fs3.readlink(src);
6412
+ if (opts.dereference) {
6413
+ resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
6414
+ }
6415
+ if (!destStat) {
6416
+ return fs3.symlink(resolvedSrc, dest);
6417
+ }
6418
+ let resolvedDest = null;
6419
+ try {
6420
+ resolvedDest = await fs3.readlink(dest);
6421
+ } catch (e) {
6422
+ if (e.code === "EINVAL" || e.code === "UNKNOWN")
6423
+ return fs3.symlink(resolvedSrc, dest);
6424
+ throw e;
6425
+ }
6426
+ if (opts.dereference) {
6427
+ resolvedDest = path3.resolve(process.cwd(), resolvedDest);
6428
+ }
6429
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
6430
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
6431
+ }
6432
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
6433
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
6434
+ }
6435
+ await fs3.unlink(dest);
6436
+ return fs3.symlink(resolvedSrc, dest);
6531
6437
  }
6532
6438
  module2.exports = copy;
6533
6439
  }
6534
6440
  });
6535
6441
 
6536
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy-sync.js
6442
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js
6537
6443
  var require_copy_sync = __commonJS({
6538
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module2) {
6444
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module2) {
6539
6445
  "use strict";
6540
6446
  var fs3 = require_graceful_fs();
6541
6447
  var path3 = require("path");
@@ -6674,11 +6580,11 @@ var require_copy_sync = __commonJS({
6674
6580
  }
6675
6581
  });
6676
6582
 
6677
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/index.js
6583
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js
6678
6584
  var require_copy2 = __commonJS({
6679
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/index.js"(exports, module2) {
6585
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js"(exports, module2) {
6680
6586
  "use strict";
6681
- var u = require_universalify().fromCallback;
6587
+ var u = require_universalify().fromPromise;
6682
6588
  module2.exports = {
6683
6589
  copy: u(require_copy()),
6684
6590
  copySync: require_copy_sync()
@@ -6686,9 +6592,9 @@ var require_copy2 = __commonJS({
6686
6592
  }
6687
6593
  });
6688
6594
 
6689
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/remove/index.js
6595
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js
6690
6596
  var require_remove = __commonJS({
6691
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/remove/index.js"(exports, module2) {
6597
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js"(exports, module2) {
6692
6598
  "use strict";
6693
6599
  var fs3 = require_graceful_fs();
6694
6600
  var u = require_universalify().fromCallback;
@@ -6705,9 +6611,9 @@ var require_remove = __commonJS({
6705
6611
  }
6706
6612
  });
6707
6613
 
6708
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/empty/index.js
6614
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js
6709
6615
  var require_empty = __commonJS({
6710
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
6616
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
6711
6617
  "use strict";
6712
6618
  var u = require_universalify().fromPromise;
6713
6619
  var fs3 = require_fs();
@@ -6744,47 +6650,40 @@ var require_empty = __commonJS({
6744
6650
  }
6745
6651
  });
6746
6652
 
6747
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/file.js
6653
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js
6748
6654
  var require_file = __commonJS({
6749
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/file.js"(exports, module2) {
6655
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module2) {
6750
6656
  "use strict";
6751
- var u = require_universalify().fromCallback;
6657
+ var u = require_universalify().fromPromise;
6752
6658
  var path3 = require("path");
6753
- var fs3 = require_graceful_fs();
6659
+ var fs3 = require_fs();
6754
6660
  var mkdir = require_mkdirs();
6755
- function createFile(file, callback) {
6756
- function makeFile() {
6757
- fs3.writeFile(file, "", (err) => {
6758
- if (err)
6759
- return callback(err);
6760
- callback();
6761
- });
6661
+ async function createFile(file) {
6662
+ let stats;
6663
+ try {
6664
+ stats = await fs3.stat(file);
6665
+ } catch {
6666
+ }
6667
+ if (stats && stats.isFile())
6668
+ return;
6669
+ const dir = path3.dirname(file);
6670
+ let dirStats = null;
6671
+ try {
6672
+ dirStats = await fs3.stat(dir);
6673
+ } catch (err) {
6674
+ if (err.code === "ENOENT") {
6675
+ await mkdir.mkdirs(dir);
6676
+ await fs3.writeFile(file, "");
6677
+ return;
6678
+ } else {
6679
+ throw err;
6680
+ }
6681
+ }
6682
+ if (dirStats.isDirectory()) {
6683
+ await fs3.writeFile(file, "");
6684
+ } else {
6685
+ await fs3.readdir(dir);
6762
6686
  }
6763
- fs3.stat(file, (err, stats) => {
6764
- if (!err && stats.isFile())
6765
- return callback();
6766
- const dir = path3.dirname(file);
6767
- fs3.stat(dir, (err2, stats2) => {
6768
- if (err2) {
6769
- if (err2.code === "ENOENT") {
6770
- return mkdir.mkdirs(dir, (err3) => {
6771
- if (err3)
6772
- return callback(err3);
6773
- makeFile();
6774
- });
6775
- }
6776
- return callback(err2);
6777
- }
6778
- if (stats2.isDirectory())
6779
- makeFile();
6780
- else {
6781
- fs3.readdir(dir, (err3) => {
6782
- if (err3)
6783
- return callback(err3);
6784
- });
6785
- }
6786
- });
6787
- });
6788
6687
  }
6789
6688
  function createFileSync(file) {
6790
6689
  let stats;
@@ -6814,46 +6713,37 @@ var require_file = __commonJS({
6814
6713
  }
6815
6714
  });
6816
6715
 
6817
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/link.js
6716
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js
6818
6717
  var require_link = __commonJS({
6819
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/link.js"(exports, module2) {
6718
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module2) {
6820
6719
  "use strict";
6821
- var u = require_universalify().fromCallback;
6720
+ var u = require_universalify().fromPromise;
6822
6721
  var path3 = require("path");
6823
- var fs3 = require_graceful_fs();
6722
+ var fs3 = require_fs();
6824
6723
  var mkdir = require_mkdirs();
6825
- var pathExists = require_path_exists().pathExists;
6724
+ var { pathExists } = require_path_exists();
6826
6725
  var { areIdentical } = require_stat();
6827
- function createLink(srcpath, dstpath, callback) {
6828
- function makeLink(srcpath2, dstpath2) {
6829
- fs3.link(srcpath2, dstpath2, (err) => {
6830
- if (err)
6831
- return callback(err);
6832
- callback(null);
6833
- });
6726
+ async function createLink(srcpath, dstpath) {
6727
+ let dstStat;
6728
+ try {
6729
+ dstStat = await fs3.lstat(dstpath);
6730
+ } catch {
6834
6731
  }
6835
- fs3.lstat(dstpath, (_, dstStat) => {
6836
- fs3.lstat(srcpath, (err, srcStat) => {
6837
- if (err) {
6838
- err.message = err.message.replace("lstat", "ensureLink");
6839
- return callback(err);
6840
- }
6841
- if (dstStat && areIdentical(srcStat, dstStat))
6842
- return callback(null);
6843
- const dir = path3.dirname(dstpath);
6844
- pathExists(dir, (err2, dirExists) => {
6845
- if (err2)
6846
- return callback(err2);
6847
- if (dirExists)
6848
- return makeLink(srcpath, dstpath);
6849
- mkdir.mkdirs(dir, (err3) => {
6850
- if (err3)
6851
- return callback(err3);
6852
- makeLink(srcpath, dstpath);
6853
- });
6854
- });
6855
- });
6856
- });
6732
+ let srcStat;
6733
+ try {
6734
+ srcStat = await fs3.lstat(srcpath);
6735
+ } catch (err) {
6736
+ err.message = err.message.replace("lstat", "ensureLink");
6737
+ throw err;
6738
+ }
6739
+ if (dstStat && areIdentical(srcStat, dstStat))
6740
+ return;
6741
+ const dir = path3.dirname(dstpath);
6742
+ const dirExists = await pathExists(dir);
6743
+ if (!dirExists) {
6744
+ await mkdir.mkdirs(dir);
6745
+ }
6746
+ await fs3.link(srcpath, dstpath);
6857
6747
  }
6858
6748
  function createLinkSync(srcpath, dstpath) {
6859
6749
  let dstStat;
@@ -6883,109 +6773,102 @@ var require_link = __commonJS({
6883
6773
  }
6884
6774
  });
6885
6775
 
6886
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-paths.js
6776
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
6887
6777
  var require_symlink_paths = __commonJS({
6888
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
6778
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
6889
6779
  "use strict";
6890
6780
  var path3 = require("path");
6891
- var fs3 = require_graceful_fs();
6892
- var pathExists = require_path_exists().pathExists;
6893
- function symlinkPaths(srcpath, dstpath, callback) {
6781
+ var fs3 = require_fs();
6782
+ var { pathExists } = require_path_exists();
6783
+ var u = require_universalify().fromPromise;
6784
+ async function symlinkPaths(srcpath, dstpath) {
6894
6785
  if (path3.isAbsolute(srcpath)) {
6895
- return fs3.lstat(srcpath, (err) => {
6896
- if (err) {
6897
- err.message = err.message.replace("lstat", "ensureSymlink");
6898
- return callback(err);
6899
- }
6900
- return callback(null, {
6901
- toCwd: srcpath,
6902
- toDst: srcpath
6903
- });
6904
- });
6905
- } else {
6906
- const dstdir = path3.dirname(dstpath);
6907
- const relativeToDst = path3.join(dstdir, srcpath);
6908
- return pathExists(relativeToDst, (err, exists) => {
6909
- if (err)
6910
- return callback(err);
6911
- if (exists) {
6912
- return callback(null, {
6913
- toCwd: relativeToDst,
6914
- toDst: srcpath
6915
- });
6916
- } else {
6917
- return fs3.lstat(srcpath, (err2) => {
6918
- if (err2) {
6919
- err2.message = err2.message.replace("lstat", "ensureSymlink");
6920
- return callback(err2);
6921
- }
6922
- return callback(null, {
6923
- toCwd: srcpath,
6924
- toDst: path3.relative(dstdir, srcpath)
6925
- });
6926
- });
6927
- }
6928
- });
6786
+ try {
6787
+ await fs3.lstat(srcpath);
6788
+ } catch (err) {
6789
+ err.message = err.message.replace("lstat", "ensureSymlink");
6790
+ throw err;
6791
+ }
6792
+ return {
6793
+ toCwd: srcpath,
6794
+ toDst: srcpath
6795
+ };
6796
+ }
6797
+ const dstdir = path3.dirname(dstpath);
6798
+ const relativeToDst = path3.join(dstdir, srcpath);
6799
+ const exists = await pathExists(relativeToDst);
6800
+ if (exists) {
6801
+ return {
6802
+ toCwd: relativeToDst,
6803
+ toDst: srcpath
6804
+ };
6929
6805
  }
6806
+ try {
6807
+ await fs3.lstat(srcpath);
6808
+ } catch (err) {
6809
+ err.message = err.message.replace("lstat", "ensureSymlink");
6810
+ throw err;
6811
+ }
6812
+ return {
6813
+ toCwd: srcpath,
6814
+ toDst: path3.relative(dstdir, srcpath)
6815
+ };
6930
6816
  }
6931
6817
  function symlinkPathsSync(srcpath, dstpath) {
6932
- let exists;
6933
6818
  if (path3.isAbsolute(srcpath)) {
6934
- exists = fs3.existsSync(srcpath);
6935
- if (!exists)
6819
+ const exists2 = fs3.existsSync(srcpath);
6820
+ if (!exists2)
6936
6821
  throw new Error("absolute srcpath does not exist");
6937
6822
  return {
6938
6823
  toCwd: srcpath,
6939
6824
  toDst: srcpath
6940
6825
  };
6941
- } else {
6942
- const dstdir = path3.dirname(dstpath);
6943
- const relativeToDst = path3.join(dstdir, srcpath);
6944
- exists = fs3.existsSync(relativeToDst);
6945
- if (exists) {
6946
- return {
6947
- toCwd: relativeToDst,
6948
- toDst: srcpath
6949
- };
6950
- } else {
6951
- exists = fs3.existsSync(srcpath);
6952
- if (!exists)
6953
- throw new Error("relative srcpath does not exist");
6954
- return {
6955
- toCwd: srcpath,
6956
- toDst: path3.relative(dstdir, srcpath)
6957
- };
6958
- }
6959
6826
  }
6827
+ const dstdir = path3.dirname(dstpath);
6828
+ const relativeToDst = path3.join(dstdir, srcpath);
6829
+ const exists = fs3.existsSync(relativeToDst);
6830
+ if (exists) {
6831
+ return {
6832
+ toCwd: relativeToDst,
6833
+ toDst: srcpath
6834
+ };
6835
+ }
6836
+ const srcExists = fs3.existsSync(srcpath);
6837
+ if (!srcExists)
6838
+ throw new Error("relative srcpath does not exist");
6839
+ return {
6840
+ toCwd: srcpath,
6841
+ toDst: path3.relative(dstdir, srcpath)
6842
+ };
6960
6843
  }
6961
6844
  module2.exports = {
6962
- symlinkPaths,
6845
+ symlinkPaths: u(symlinkPaths),
6963
6846
  symlinkPathsSync
6964
6847
  };
6965
6848
  }
6966
6849
  });
6967
6850
 
6968
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-type.js
6851
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js
6969
6852
  var require_symlink_type = __commonJS({
6970
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
6853
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
6971
6854
  "use strict";
6972
- var fs3 = require_graceful_fs();
6973
- function symlinkType(srcpath, type, callback) {
6974
- callback = typeof type === "function" ? type : callback;
6975
- type = typeof type === "function" ? false : type;
6855
+ var fs3 = require_fs();
6856
+ var u = require_universalify().fromPromise;
6857
+ async function symlinkType(srcpath, type) {
6976
6858
  if (type)
6977
- return callback(null, type);
6978
- fs3.lstat(srcpath, (err, stats) => {
6979
- if (err)
6980
- return callback(null, "file");
6981
- type = stats && stats.isDirectory() ? "dir" : "file";
6982
- callback(null, type);
6983
- });
6859
+ return type;
6860
+ let stats;
6861
+ try {
6862
+ stats = await fs3.lstat(srcpath);
6863
+ } catch {
6864
+ return "file";
6865
+ }
6866
+ return stats && stats.isDirectory() ? "dir" : "file";
6984
6867
  }
6985
6868
  function symlinkTypeSync(srcpath, type) {
6986
- let stats;
6987
6869
  if (type)
6988
6870
  return type;
6871
+ let stats;
6989
6872
  try {
6990
6873
  stats = fs3.lstatSync(srcpath);
6991
6874
  } catch {
@@ -6994,69 +6877,46 @@ var require_symlink_type = __commonJS({
6994
6877
  return stats && stats.isDirectory() ? "dir" : "file";
6995
6878
  }
6996
6879
  module2.exports = {
6997
- symlinkType,
6880
+ symlinkType: u(symlinkType),
6998
6881
  symlinkTypeSync
6999
6882
  };
7000
6883
  }
7001
6884
  });
7002
6885
 
7003
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink.js
6886
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js
7004
6887
  var require_symlink = __commonJS({
7005
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module2) {
6888
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module2) {
7006
6889
  "use strict";
7007
- var u = require_universalify().fromCallback;
6890
+ var u = require_universalify().fromPromise;
7008
6891
  var path3 = require("path");
7009
6892
  var fs3 = require_fs();
7010
- var _mkdirs = require_mkdirs();
7011
- var mkdirs = _mkdirs.mkdirs;
7012
- var mkdirsSync = _mkdirs.mkdirsSync;
7013
- var _symlinkPaths = require_symlink_paths();
7014
- var symlinkPaths = _symlinkPaths.symlinkPaths;
7015
- var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
7016
- var _symlinkType = require_symlink_type();
7017
- var symlinkType = _symlinkType.symlinkType;
7018
- var symlinkTypeSync = _symlinkType.symlinkTypeSync;
7019
- var pathExists = require_path_exists().pathExists;
6893
+ var { mkdirs, mkdirsSync } = require_mkdirs();
6894
+ var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
6895
+ var { symlinkType, symlinkTypeSync } = require_symlink_type();
6896
+ var { pathExists } = require_path_exists();
7020
6897
  var { areIdentical } = require_stat();
7021
- function createSymlink(srcpath, dstpath, type, callback) {
7022
- callback = typeof type === "function" ? type : callback;
7023
- type = typeof type === "function" ? false : type;
7024
- fs3.lstat(dstpath, (err, stats) => {
7025
- if (!err && stats.isSymbolicLink()) {
7026
- Promise.all([
7027
- fs3.stat(srcpath),
7028
- fs3.stat(dstpath)
7029
- ]).then(([srcStat, dstStat]) => {
7030
- if (areIdentical(srcStat, dstStat))
7031
- return callback(null);
7032
- _createSymlink(srcpath, dstpath, type, callback);
7033
- });
7034
- } else
7035
- _createSymlink(srcpath, dstpath, type, callback);
7036
- });
7037
- }
7038
- function _createSymlink(srcpath, dstpath, type, callback) {
7039
- symlinkPaths(srcpath, dstpath, (err, relative) => {
7040
- if (err)
7041
- return callback(err);
7042
- srcpath = relative.toDst;
7043
- symlinkType(relative.toCwd, type, (err2, type2) => {
7044
- if (err2)
7045
- return callback(err2);
7046
- const dir = path3.dirname(dstpath);
7047
- pathExists(dir, (err3, dirExists) => {
7048
- if (err3)
7049
- return callback(err3);
7050
- if (dirExists)
7051
- return fs3.symlink(srcpath, dstpath, type2, callback);
7052
- mkdirs(dir, (err4) => {
7053
- if (err4)
7054
- return callback(err4);
7055
- fs3.symlink(srcpath, dstpath, type2, callback);
7056
- });
7057
- });
7058
- });
7059
- });
6898
+ async function createSymlink(srcpath, dstpath, type) {
6899
+ let stats;
6900
+ try {
6901
+ stats = await fs3.lstat(dstpath);
6902
+ } catch {
6903
+ }
6904
+ if (stats && stats.isSymbolicLink()) {
6905
+ const [srcStat, dstStat] = await Promise.all([
6906
+ fs3.stat(srcpath),
6907
+ fs3.stat(dstpath)
6908
+ ]);
6909
+ if (areIdentical(srcStat, dstStat))
6910
+ return;
6911
+ }
6912
+ const relative = await symlinkPaths(srcpath, dstpath);
6913
+ srcpath = relative.toDst;
6914
+ const toType = await symlinkType(relative.toCwd, type);
6915
+ const dir = path3.dirname(dstpath);
6916
+ if (!await pathExists(dir)) {
6917
+ await mkdirs(dir);
6918
+ }
6919
+ return fs3.symlink(srcpath, dstpath, toType);
7060
6920
  }
7061
6921
  function createSymlinkSync(srcpath, dstpath, type) {
7062
6922
  let stats;
@@ -7087,9 +6947,9 @@ var require_symlink = __commonJS({
7087
6947
  }
7088
6948
  });
7089
6949
 
7090
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/index.js
6950
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js
7091
6951
  var require_ensure = __commonJS({
7092
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/index.js"(exports, module2) {
6952
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js"(exports, module2) {
7093
6953
  "use strict";
7094
6954
  var { createFile, createFileSync } = require_file();
7095
6955
  var { createLink, createLinkSync } = require_link();
@@ -7206,9 +7066,9 @@ var require_jsonfile = __commonJS({
7206
7066
  }
7207
7067
  });
7208
7068
 
7209
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/jsonfile.js
7069
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js
7210
7070
  var require_jsonfile2 = __commonJS({
7211
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module2) {
7071
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module2) {
7212
7072
  "use strict";
7213
7073
  var jsonFile = require_jsonfile();
7214
7074
  module2.exports = {
@@ -7221,39 +7081,27 @@ var require_jsonfile2 = __commonJS({
7221
7081
  }
7222
7082
  });
7223
7083
 
7224
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/output-file/index.js
7084
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js
7225
7085
  var require_output_file = __commonJS({
7226
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/output-file/index.js"(exports, module2) {
7086
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js"(exports, module2) {
7227
7087
  "use strict";
7228
- var u = require_universalify().fromCallback;
7229
- var fs3 = require_graceful_fs();
7088
+ var u = require_universalify().fromPromise;
7089
+ var fs3 = require_fs();
7230
7090
  var path3 = require("path");
7231
7091
  var mkdir = require_mkdirs();
7232
7092
  var pathExists = require_path_exists().pathExists;
7233
- function outputFile(file, data, encoding, callback) {
7234
- if (typeof encoding === "function") {
7235
- callback = encoding;
7236
- encoding = "utf8";
7237
- }
7093
+ async function outputFile(file, data, encoding = "utf-8") {
7238
7094
  const dir = path3.dirname(file);
7239
- pathExists(dir, (err, itDoes) => {
7240
- if (err)
7241
- return callback(err);
7242
- if (itDoes)
7243
- return fs3.writeFile(file, data, encoding, callback);
7244
- mkdir.mkdirs(dir, (err2) => {
7245
- if (err2)
7246
- return callback(err2);
7247
- fs3.writeFile(file, data, encoding, callback);
7248
- });
7249
- });
7095
+ if (!await pathExists(dir)) {
7096
+ await mkdir.mkdirs(dir);
7097
+ }
7098
+ return fs3.writeFile(file, data, encoding);
7250
7099
  }
7251
7100
  function outputFileSync(file, ...args) {
7252
7101
  const dir = path3.dirname(file);
7253
- if (fs3.existsSync(dir)) {
7254
- return fs3.writeFileSync(file, ...args);
7102
+ if (!fs3.existsSync(dir)) {
7103
+ mkdir.mkdirsSync(dir);
7255
7104
  }
7256
- mkdir.mkdirsSync(dir);
7257
7105
  fs3.writeFileSync(file, ...args);
7258
7106
  }
7259
7107
  module2.exports = {
@@ -7263,9 +7111,9 @@ var require_output_file = __commonJS({
7263
7111
  }
7264
7112
  });
7265
7113
 
7266
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json.js
7114
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js
7267
7115
  var require_output_json = __commonJS({
7268
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json.js"(exports, module2) {
7116
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module2) {
7269
7117
  "use strict";
7270
7118
  var { stringify } = require_utils2();
7271
7119
  var { outputFile } = require_output_file();
@@ -7277,9 +7125,9 @@ var require_output_json = __commonJS({
7277
7125
  }
7278
7126
  });
7279
7127
 
7280
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json-sync.js
7128
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js
7281
7129
  var require_output_json_sync = __commonJS({
7282
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
7130
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
7283
7131
  "use strict";
7284
7132
  var { stringify } = require_utils2();
7285
7133
  var { outputFileSync } = require_output_file();
@@ -7291,9 +7139,9 @@ var require_output_json_sync = __commonJS({
7291
7139
  }
7292
7140
  });
7293
7141
 
7294
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/index.js
7142
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js
7295
7143
  var require_json = __commonJS({
7296
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/index.js"(exports, module2) {
7144
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js"(exports, module2) {
7297
7145
  "use strict";
7298
7146
  var u = require_universalify().fromPromise;
7299
7147
  var jsonFile = require_jsonfile2();
@@ -7309,92 +7157,61 @@ var require_json = __commonJS({
7309
7157
  }
7310
7158
  });
7311
7159
 
7312
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move.js
7160
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js
7313
7161
  var require_move = __commonJS({
7314
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move.js"(exports, module2) {
7162
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js"(exports, module2) {
7315
7163
  "use strict";
7316
- var fs3 = require_graceful_fs();
7164
+ var fs3 = require_fs();
7317
7165
  var path3 = require("path");
7318
- var copy = require_copy2().copy;
7319
- var remove = require_remove().remove;
7320
- var mkdirp = require_mkdirs().mkdirp;
7321
- var pathExists = require_path_exists().pathExists;
7166
+ var { copy } = require_copy2();
7167
+ var { remove } = require_remove();
7168
+ var { mkdirp } = require_mkdirs();
7169
+ var { pathExists } = require_path_exists();
7322
7170
  var stat = require_stat();
7323
- function move(src, dest, opts, cb) {
7324
- if (typeof opts === "function") {
7325
- cb = opts;
7326
- opts = {};
7327
- }
7328
- opts = opts || {};
7171
+ async function move(src, dest, opts = {}) {
7329
7172
  const overwrite = opts.overwrite || opts.clobber || false;
7330
- stat.checkPaths(src, dest, "move", opts, (err, stats) => {
7331
- if (err)
7332
- return cb(err);
7333
- const { srcStat, isChangingCase = false } = stats;
7334
- stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
7335
- if (err2)
7336
- return cb(err2);
7337
- if (isParentRoot(dest))
7338
- return doRename(src, dest, overwrite, isChangingCase, cb);
7339
- mkdirp(path3.dirname(dest), (err3) => {
7340
- if (err3)
7341
- return cb(err3);
7342
- return doRename(src, dest, overwrite, isChangingCase, cb);
7343
- });
7344
- });
7345
- });
7346
- }
7347
- function isParentRoot(dest) {
7348
- const parent = path3.dirname(dest);
7349
- const parsedPath = path3.parse(parent);
7350
- return parsedPath.root === parent;
7351
- }
7352
- function doRename(src, dest, overwrite, isChangingCase, cb) {
7353
- if (isChangingCase)
7354
- return rename(src, dest, overwrite, cb);
7355
- if (overwrite) {
7356
- return remove(dest, (err) => {
7357
- if (err)
7358
- return cb(err);
7359
- return rename(src, dest, overwrite, cb);
7360
- });
7173
+ const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
7174
+ await stat.checkParentPaths(src, srcStat, dest, "move");
7175
+ const destParent = path3.dirname(dest);
7176
+ const parsedParentPath = path3.parse(destParent);
7177
+ if (parsedParentPath.root !== destParent) {
7178
+ await mkdirp(destParent);
7361
7179
  }
7362
- pathExists(dest, (err, destExists) => {
7363
- if (err)
7364
- return cb(err);
7365
- if (destExists)
7366
- return cb(new Error("dest already exists."));
7367
- return rename(src, dest, overwrite, cb);
7368
- });
7180
+ return doRename(src, dest, overwrite, isChangingCase);
7369
7181
  }
7370
- function rename(src, dest, overwrite, cb) {
7371
- fs3.rename(src, dest, (err) => {
7372
- if (!err)
7373
- return cb();
7374
- if (err.code !== "EXDEV")
7375
- return cb(err);
7376
- return moveAcrossDevice(src, dest, overwrite, cb);
7377
- });
7182
+ async function doRename(src, dest, overwrite, isChangingCase) {
7183
+ if (!isChangingCase) {
7184
+ if (overwrite) {
7185
+ await remove(dest);
7186
+ } else if (await pathExists(dest)) {
7187
+ throw new Error("dest already exists.");
7188
+ }
7189
+ }
7190
+ try {
7191
+ await fs3.rename(src, dest);
7192
+ } catch (err) {
7193
+ if (err.code !== "EXDEV") {
7194
+ throw err;
7195
+ }
7196
+ await moveAcrossDevice(src, dest, overwrite);
7197
+ }
7378
7198
  }
7379
- function moveAcrossDevice(src, dest, overwrite, cb) {
7199
+ async function moveAcrossDevice(src, dest, overwrite) {
7380
7200
  const opts = {
7381
7201
  overwrite,
7382
7202
  errorOnExist: true,
7383
7203
  preserveTimestamps: true
7384
7204
  };
7385
- copy(src, dest, opts, (err) => {
7386
- if (err)
7387
- return cb(err);
7388
- return remove(src, cb);
7389
- });
7205
+ await copy(src, dest, opts);
7206
+ return remove(src);
7390
7207
  }
7391
7208
  module2.exports = move;
7392
7209
  }
7393
7210
  });
7394
7211
 
7395
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move-sync.js
7212
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js
7396
7213
  var require_move_sync = __commonJS({
7397
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move-sync.js"(exports, module2) {
7214
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module2) {
7398
7215
  "use strict";
7399
7216
  var fs3 = require_graceful_fs();
7400
7217
  var path3 = require("path");
@@ -7449,11 +7266,11 @@ var require_move_sync = __commonJS({
7449
7266
  }
7450
7267
  });
7451
7268
 
7452
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/index.js
7269
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js
7453
7270
  var require_move2 = __commonJS({
7454
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
7271
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
7455
7272
  "use strict";
7456
- var u = require_universalify().fromCallback;
7273
+ var u = require_universalify().fromPromise;
7457
7274
  module2.exports = {
7458
7275
  move: u(require_move()),
7459
7276
  moveSync: require_move_sync()
@@ -7461,9 +7278,9 @@ var require_move2 = __commonJS({
7461
7278
  }
7462
7279
  });
7463
7280
 
7464
- // ../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/index.js
7281
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js
7465
7282
  var require_lib2 = __commonJS({
7466
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/index.js"(exports, module2) {
7283
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js"(exports, module2) {
7467
7284
  "use strict";
7468
7285
  module2.exports = {
7469
7286
  // Export promiseified graceful-fs: