fix: remove links in clean plugin
This commit is contained in:
parent
ac7bd40526
commit
d55382ed79
|
@ -16,6 +16,7 @@ const processAsyncTree = require("./util/processAsyncTree");
|
|||
/** @typedef {import("./Compiler")} Compiler */
|
||||
/** @typedef {import("./logging/Logger").Logger} Logger */
|
||||
/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */
|
||||
/** @typedef {import("./util/fs").StatsCallback} StatsCallback */
|
||||
|
||||
/** @typedef {(function(string):boolean)|RegExp} IgnoreItem */
|
||||
/** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */
|
||||
|
@ -102,6 +103,20 @@ const getDiffToOldAssets = (currentAssets, oldAssets) => {
|
|||
return diff;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {OutputFileSystem} fs filesystem
|
||||
* @param {string} filename path to file
|
||||
* @param {StatsCallback} callback callback for provided filename
|
||||
* @returns {void}
|
||||
*/
|
||||
const doStat = (fs, filename, callback) => {
|
||||
if ("lstat" in fs) {
|
||||
fs.lstat(filename, callback);
|
||||
} else {
|
||||
fs.stat(filename, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {OutputFileSystem} fs filesystem
|
||||
* @param {string} outputPath output path
|
||||
|
@ -150,7 +165,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
|
|||
log(`${filename} will be kept`);
|
||||
return process.nextTick(callback);
|
||||
}
|
||||
fs.stat(path, (err, stats) => {
|
||||
doStat(fs, path, (err, stats) => {
|
||||
if (err) return handleError(err);
|
||||
if (!stats.isDirectory()) {
|
||||
push({
|
||||
|
|
|
@ -93,6 +93,7 @@ const path = require("path");
|
|||
* @property {function(string, Callback): void=} rmdir
|
||||
* @property {function(string, Callback): void=} unlink
|
||||
* @property {function(string, StatsCallback): void} stat
|
||||
* @property {function(string, StatsCallback): void=} lstat
|
||||
* @property {function(string, BufferOrStringCallback): void} readFile
|
||||
* @property {(function(string, string): string)=} join
|
||||
* @property {(function(string, string): string)=} relative
|
||||
|
|
|
@ -8348,6 +8348,10 @@ declare interface OutputFileSystem {
|
|||
arg0: string,
|
||||
arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
|
||||
) => void;
|
||||
lstat?: (
|
||||
arg0: string,
|
||||
arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
|
||||
) => void;
|
||||
readFile: (
|
||||
arg0: string,
|
||||
arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void
|
||||
|
|
Loading…
Reference in New Issue