Skip to content

feat(pluginutils): add exactRegex and prefixRegex #1865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sapphi-red
Copy link
Contributor

Rollup Plugin Name: {name}

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • 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.

@sapphi-red sapphi-red requested a review from shellscape as a code owner April 18, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant