You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis/plugin-api/hook-filters.md
+16-4Lines changed: 16 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,11 @@ See [`HookFilter`](/reference/Interface.HookFilter) as well.
84
84
85
85
For more complex filtering logic, Rolldown provides composable filter expressions via the [`@rolldown/pluginutils`](https://github.com/rolldown/rolldown/tree/main/packages/pluginutils) package. These allow you to build filters using logical operators like `and`, `or`, and `not`.
86
86
87
+
> [!WARNING]
88
+
> Composable filters are not yet supported in legacy Vite or unplugin. They can be used in Rolldown/Rolldown-Vite/Vite Beta plugins only.
-`id(pattern, params?)` — Filter by id. A `string` pattern is matched by exact equality (not glob); a `RegExp` is tested against the id.
113
+
-`importerId(pattern, params?)` — Filter by importer id. A `string` pattern is matched by exact equality; a `RegExp` is tested against the importer id. Only usable with the `resolveId` hook.
114
+
-`moduleType(type)` — Filter by module type (e.g. 'js', 'tsx', or 'json').
115
+
-`code(pattern)` — Filter by code content.
116
+
-`query(key, pattern)` — Filter by query parameter.
See the [`@rolldown/pluginutils` README](https://github.com/rolldown/rolldown/tree/main/packages/pluginutils#readme) for the full API reference.
105
121
106
122
## Interoperability
@@ -148,7 +164,3 @@ This approach ensures your plugin will:
148
164
### `moduleType` Filter
149
165
150
166
The [Module Type concept](/in-depth/module-types) does not exist in Rollup / Vite 7 and below. For that reason, the `moduleType` filter is not supported by those tools and will be ignored.
151
-
152
-
### Composable Filters
153
-
154
-
Composable filters are currently only supported in Rolldown. They are not yet supported in Vite, Rolldown-Vite, or unplugin.
-`id(pattern, params?)` — Filter by id (string or RegExp).
73
+
-`id(pattern, params?)` — Filter by id. A `string` pattern is matched by exact equality (not glob); a `RegExp` is tested against the id.
74
+
-`importerId(pattern, params?)` — Filter by importer id. A `string` pattern is matched by exact equality; a `RegExp` is tested against the importer id. Only usable with the `resolveId` hook.
74
75
-`moduleType(type)` — Filter by module type (e.g. 'js', 'tsx', or 'json').
75
76
-`code(pattern)` — Filter by code content.
76
77
-`query(key, pattern)` — Filter by query parameter.
0 commit comments