@@ -6552,11 +6552,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
65526552};
65536553var _a;
65546554Object.defineProperty(exports, "__esModule", ({ value: true }));
6555- exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
6555+ exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports. IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports. rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
65566556const fs = __importStar(__nccwpck_require__(7147));
65576557const path = __importStar(__nccwpck_require__(1017));
6558- _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
6558+ _a = fs.promises
6559+ // export const {open} = 'fs'
6560+ , exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
6561+ // export const {open} = 'fs'
65596562exports.IS_WINDOWS = process.platform === 'win32';
6563+ // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
6564+ exports.UV_FS_O_EXLOCK = 0x10000000;
6565+ exports.READONLY = fs.constants.O_RDONLY;
65606566function exists(fsPath) {
65616567 return __awaiter(this, void 0, void 0, function* () {
65626568 try {
@@ -6737,12 +6743,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
67376743Object.defineProperty(exports, "__esModule", ({ value: true }));
67386744exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
67396745const assert_1 = __nccwpck_require__(9491);
6740- const childProcess = __importStar(__nccwpck_require__(2081));
67416746const path = __importStar(__nccwpck_require__(1017));
6742- const util_1 = __nccwpck_require__(3837);
67436747const ioUtil = __importStar(__nccwpck_require__(1962));
6744- const exec = util_1.promisify(childProcess.exec);
6745- const execFile = util_1.promisify(childProcess.execFile);
67466748/**
67476749 * Copies a file or folder.
67486750 * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -6823,61 +6825,23 @@ exports.mv = mv;
68236825function rmRF(inputPath) {
68246826 return __awaiter(this, void 0, void 0, function* () {
68256827 if (ioUtil.IS_WINDOWS) {
6826- // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
6827- // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
68286828 // Check for invalid characters
68296829 // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
68306830 if (/[*"<>|]/.test(inputPath)) {
68316831 throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
68326832 }
6833- try {
6834- const cmdPath = ioUtil.getCmdPath();
6835- if (yield ioUtil.isDirectory(inputPath, true)) {
6836- yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
6837- env: { inputPath }
6838- });
6839- }
6840- else {
6841- yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
6842- env: { inputPath }
6843- });
6844- }
6845- }
6846- catch (err) {
6847- // if you try to delete a file that doesn't exist, desired result is achieved
6848- // other errors are valid
6849- if (err.code !== 'ENOENT')
6850- throw err;
6851- }
6852- // Shelling out fails to remove a symlink folder with missing source, this unlink catches that
6853- try {
6854- yield ioUtil.unlink(inputPath);
6855- }
6856- catch (err) {
6857- // if you try to delete a file that doesn't exist, desired result is achieved
6858- // other errors are valid
6859- if (err.code !== 'ENOENT')
6860- throw err;
6861- }
68626833 }
6863- else {
6864- let isDir = false;
6865- try {
6866- isDir = yield ioUtil.isDirectory(inputPath);
6867- }
6868- catch (err) {
6869- // if you try to delete a file that doesn't exist, desired result is achieved
6870- // other errors are valid
6871- if (err.code !== 'ENOENT')
6872- throw err;
6873- return;
6874- }
6875- if (isDir) {
6876- yield execFile(`rm`, [`-rf`, `${inputPath}`]);
6877- }
6878- else {
6879- yield ioUtil.unlink(inputPath);
6880- }
6834+ try {
6835+ // note if path does not exist, error is silent
6836+ yield ioUtil.rm(inputPath, {
6837+ force: true,
6838+ maxRetries: 3,
6839+ recursive: true,
6840+ retryDelay: 300
6841+ });
6842+ }
6843+ catch (err) {
6844+ throw new Error(`File was unable to be removed ${err}`);
68816845 }
68826846 });
68836847}
0 commit comments