Comparing version 4.3.1 to 4.4.0
{ | ||
"name": "rimraf", | ||
"version": "4.3.1", | ||
"version": "4.4.0", | ||
"main": "./dist/cjs/src/index-cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/mjs/index.js", |
@@ -66,6 +66,6 @@ #!/usr/bin/env node | ||
}; | ||
const oneAtATime = (fn) => async (s) => { | ||
const oneAtATime = (fn) => async (s, e) => { | ||
const p = new Promise(res => { | ||
queue.push(async () => { | ||
const result = await fn(s); | ||
const result = await fn(s, e); | ||
res(result); | ||
@@ -82,3 +82,3 @@ return result; | ||
}); | ||
opt.filter = oneAtATime(async (path) => { | ||
opt.filter = oneAtATime(async (path, ent) => { | ||
if (noneRemaining) { | ||
@@ -107,3 +107,3 @@ return false; | ||
} | ||
return existingFilter(path); | ||
return existingFilter(path, ent); | ||
}); | ||
@@ -110,0 +110,0 @@ await impl(paths, opt); |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { GlobOptions } from 'glob'; | ||
@@ -11,6 +12,6 @@ export interface RimrafAsyncOptions { | ||
glob?: boolean | GlobOptions; | ||
filter?: ((path: string) => boolean) | ((path: string) => Promise<boolean>); | ||
filter?: ((path: string, ent: Dirent | Stats) => boolean) | ((path: string, ent: Dirent | Stats) => Promise<boolean>); | ||
} | ||
export interface RimrafSyncOptions extends RimrafAsyncOptions { | ||
filter?: (path: string) => boolean; | ||
filter?: (path: string, ent: Dirent | Stats) => boolean; | ||
} | ||
@@ -20,2 +21,3 @@ export type RimrafOptions = RimrafSyncOptions | RimrafAsyncOptions; | ||
export declare const assertRimrafOptions: (o: any) => void; | ||
import { Dirent, Stats } from 'fs'; | ||
export declare const nativeSync: (path: string | string[], opt?: RimrafSyncOptions) => boolean; | ||
@@ -22,0 +24,0 @@ export declare const native: ((path: string | string[], opt?: RimrafAsyncOptions) => Promise<boolean>) & { |
@@ -98,3 +98,3 @@ "use strict"; | ||
/* c8 ignore stop */ | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -115,3 +115,3 @@ } | ||
} | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -166,3 +166,3 @@ } | ||
/* c8 ignore stop */ | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -184,3 +184,3 @@ } | ||
} | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -187,0 +187,0 @@ } |
@@ -60,3 +60,3 @@ "use strict"; | ||
/* c8 ignore stop */ | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -77,3 +77,3 @@ } | ||
} | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -102,3 +102,3 @@ } | ||
/* c8 ignore stop */ | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -120,3 +120,3 @@ } | ||
} | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -123,0 +123,0 @@ } |
@@ -109,3 +109,3 @@ "use strict"; | ||
/* c8 ignore stop */ | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -129,3 +129,3 @@ } | ||
} | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -152,3 +152,3 @@ } | ||
/* c8 ignore stop */ | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -176,3 +176,3 @@ } | ||
} | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -179,0 +179,0 @@ } |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { GlobOptions } from 'glob'; | ||
@@ -11,6 +12,6 @@ export interface RimrafAsyncOptions { | ||
glob?: boolean | GlobOptions; | ||
filter?: ((path: string) => boolean) | ((path: string) => Promise<boolean>); | ||
filter?: ((path: string, ent: Dirent | Stats) => boolean) | ((path: string, ent: Dirent | Stats) => Promise<boolean>); | ||
} | ||
export interface RimrafSyncOptions extends RimrafAsyncOptions { | ||
filter?: (path: string) => boolean; | ||
filter?: (path: string, ent: Dirent | Stats) => boolean; | ||
} | ||
@@ -20,2 +21,3 @@ export type RimrafOptions = RimrafSyncOptions | RimrafAsyncOptions; | ||
export declare const assertRimrafOptions: (o: any) => void; | ||
import { Dirent, Stats } from 'fs'; | ||
export declare const nativeSync: (path: string | string[], opt?: RimrafSyncOptions) => boolean; | ||
@@ -22,0 +24,0 @@ export declare const native: ((path: string | string[], opt?: RimrafAsyncOptions) => Promise<boolean>) & { |
{ | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"type": "module" | ||
} |
@@ -94,3 +94,3 @@ // https://youtu.be/uhRWMGBjlO8?t=537 | ||
/* c8 ignore stop */ | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -111,3 +111,3 @@ } | ||
} | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -161,3 +161,3 @@ } | ||
/* c8 ignore stop */ | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -179,3 +179,3 @@ } | ||
} | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -182,0 +182,0 @@ } |
@@ -55,3 +55,3 @@ // the simple recursive removal, where unlink and rmdir are atomic | ||
/* c8 ignore stop */ | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -72,3 +72,3 @@ } | ||
} | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -97,3 +97,3 @@ } | ||
/* c8 ignore stop */ | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -115,3 +115,3 @@ } | ||
} | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -118,0 +118,0 @@ } |
@@ -104,3 +104,3 @@ // This is the same as rimrafPosix, with the following changes: | ||
/* c8 ignore stop */ | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -124,3 +124,3 @@ } | ||
} | ||
if (opt.filter && !(await opt.filter(path))) { | ||
if (opt.filter && !(await opt.filter(path, ent))) { | ||
return false; | ||
@@ -147,3 +147,3 @@ } | ||
/* c8 ignore stop */ | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -171,3 +171,3 @@ } | ||
} | ||
if (opt.filter && !opt.filter(path)) { | ||
if (opt.filter && !opt.filter(path, ent)) { | ||
return false; | ||
@@ -174,0 +174,0 @@ } |
{ | ||
"name": "rimraf", | ||
"version": "4.3.1", | ||
"version": "4.4.0", | ||
"main": "./dist/cjs/src/index-cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/mjs/index.js", |
@@ -80,9 +80,13 @@ The [UNIX command](<http://en.wikipedia.org/wiki/Rm_(Unix)>) `rm -rf` for node. | ||
- `filter` Method that receives a path string as an argument, and | ||
returns a boolean indicating whether that path should be | ||
deleted. With async rimraf methods, this may return a Promise | ||
that resolves to a boolean. (Since Promises are truthy, | ||
returning a Promise from a sync filter is the same as just not | ||
filtering anything.) | ||
- `filter` Method that returns a boolean indicating whether that | ||
path should be deleted. With async rimraf methods, this may | ||
return a Promise that resolves to a boolean. (Since Promises | ||
are truthy, returning a Promise from a sync filter is the same | ||
as just not filtering anything.) | ||
The first argument to the filter is the path string. The | ||
second argument is either a `Dirent` or `Stats` object for that | ||
path. (The first path explored will be a `Stats`, the rest | ||
will be `Dirent`.) | ||
If a filter method is provided, it will _only_ remove entries | ||
@@ -89,0 +93,0 @@ if the filter returns (or resolves to) a truthy value. Omitting |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207415
2504
215