-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
treat paths as glob patterns when glob option set
Fix: #249
- Loading branch information
Showing
11 changed files
with
319 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,5 +77,8 @@ | |
}, | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"dependencies": { | ||
"glob": "^9.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
import { GlobOptions } from 'glob' | ||
import { assertRimrafOptions, RimrafOptions } from './index.js' | ||
export default (opt: RimrafOptions = {}) => { | ||
export default ( | ||
opt: RimrafOptions = {} | ||
): RimrafOptions & { | ||
glob?: GlobOptions & { withFileTypes: false } | ||
} => { | ||
assertRimrafOptions(opt) | ||
return opt | ||
const { glob, ...options } = opt | ||
if (!glob) return options | ||
const globOpt = | ||
glob === true | ||
? opt.signal | ||
? { signal: opt.signal } | ||
: {} | ||
: opt.signal | ||
? { | ||
signal: opt.signal, | ||
...glob, | ||
} | ||
: glob | ||
return { | ||
...options, | ||
glob: { | ||
...globOpt, | ||
// always get absolute paths from glob, to ensure | ||
// that we are referencing the correct thing. | ||
absolute: true, | ||
withFileTypes: false, | ||
}, | ||
} | ||
} |
Oops, something went wrong.