plugins
plugins copied to clipboard
feat(pluginutils): add `exactRegex` and `prefixRegex`
trafficstars
Rollup Plugin Name: pluginutils
This PR contains:
- [ ] bugfix
- [x] feature
- [ ] refactor
- [ ] documentation
- [ ] other
Are tests included?
- [x] yes (bugfixes and features will not be merged without tests)
- [ ] no
Breaking Changes?
- [ ] yes (breaking changes will not be merged unless absolutely necessary)
- [x] no
If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.
List any relevant issue numbers:
Description
Rollup 4.38.0+ supports plugin hook filters. The id filter for load and transform supports glob (picomatch) patterns when a string is passed.
const transformHandler = {
filter: { id: '**/*.js' },
handler() { /* omit */}
}
This is useful for many cases. However, since no reasonable semantic behavior can be defined for glob patterns against relative paths, resolveId does not support string values for the id filter (it still supports regex filters).
This PR adds exactRegex and prefixRegex so that it is easier to construct regexes that are commonly used for virtual modules.