@@ -7894,11 +7894,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
78947894};
78957895var _a;
78967896Object.defineProperty(exports, "__esModule", ({ value: true }));
7897- 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;
7897+ 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;
78987898const fs = __importStar(__nccwpck_require__(9896));
78997899const path = __importStar(__nccwpck_require__(6928));
7900- _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;
7900+ _a = fs.promises
7901+ // export const {open} = 'fs'
7902+ , 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;
7903+ // export const {open} = 'fs'
79017904exports.IS_WINDOWS = process.platform === 'win32';
7905+ // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
7906+ exports.UV_FS_O_EXLOCK = 0x10000000;
7907+ exports.READONLY = fs.constants.O_RDONLY;
79027908function exists(fsPath) {
79037909 return __awaiter(this, void 0, void 0, function* () {
79047910 try {
@@ -8079,12 +8085,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
80798085Object.defineProperty(exports, "__esModule", ({ value: true }));
80808086exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
80818087const assert_1 = __nccwpck_require__(2613);
8082- const childProcess = __importStar(__nccwpck_require__(5317));
80838088const path = __importStar(__nccwpck_require__(6928));
8084- const util_1 = __nccwpck_require__(9023);
80858089const ioUtil = __importStar(__nccwpck_require__(5207));
8086- const exec = util_1.promisify(childProcess.exec);
8087- const execFile = util_1.promisify(childProcess.execFile);
80888090/**
80898091 * Copies a file or folder.
80908092 * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -8165,61 +8167,23 @@ exports.mv = mv;
81658167function rmRF(inputPath) {
81668168 return __awaiter(this, void 0, void 0, function* () {
81678169 if (ioUtil.IS_WINDOWS) {
8168- // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
8169- // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
81708170 // Check for invalid characters
81718171 // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
81728172 if (/[*"<>|]/.test(inputPath)) {
81738173 throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
81748174 }
8175- try {
8176- const cmdPath = ioUtil.getCmdPath();
8177- if (yield ioUtil.isDirectory(inputPath, true)) {
8178- yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
8179- env: { inputPath }
8180- });
8181- }
8182- else {
8183- yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
8184- env: { inputPath }
8185- });
8186- }
8187- }
8188- catch (err) {
8189- // if you try to delete a file that doesn't exist, desired result is achieved
8190- // other errors are valid
8191- if (err.code !== 'ENOENT')
8192- throw err;
8193- }
8194- // Shelling out fails to remove a symlink folder with missing source, this unlink catches that
8195- try {
8196- yield ioUtil.unlink(inputPath);
8197- }
8198- catch (err) {
8199- // if you try to delete a file that doesn't exist, desired result is achieved
8200- // other errors are valid
8201- if (err.code !== 'ENOENT')
8202- throw err;
8203- }
82048175 }
8205- else {
8206- let isDir = false;
8207- try {
8208- isDir = yield ioUtil.isDirectory(inputPath);
8209- }
8210- catch (err) {
8211- // if you try to delete a file that doesn't exist, desired result is achieved
8212- // other errors are valid
8213- if (err.code !== 'ENOENT')
8214- throw err;
8215- return;
8216- }
8217- if (isDir) {
8218- yield execFile(`rm`, [`-rf`, `${inputPath}`]);
8219- }
8220- else {
8221- yield ioUtil.unlink(inputPath);
8222- }
8176+ try {
8177+ // note if path does not exist, error is silent
8178+ yield ioUtil.rm(inputPath, {
8179+ force: true,
8180+ maxRetries: 3,
8181+ recursive: true,
8182+ retryDelay: 300
8183+ });
8184+ }
8185+ catch (err) {
8186+ throw new Error(`File was unable to be removed ${err}`);
82238187 }
82248188 });
82258189}
0 commit comments