Function: makeIdFiltersToMatchWithQuery()
Call Signature
- Exported from:
rolldown/filter - Type: (
input:T) =>WidenString<T>
Converts a id filter to match with an id with a query.
Type Parameters
T
T extends string | RegExp
Parameters
input
T
the id filters to convert.
Returns
WidenString<T>
Example
ts
import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
const plugin = {
name: 'plugin',
transform: {
filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
// The handler will be called for IDs like:
// - foo.js
// - foo.js?foo
// - foo.txt?foo.js
// - foo.ts
// - foo.ts?foo
// - foo.txt?foo.ts
handler(code, id) {}
}
}Call Signature
- Exported from:
rolldown/filter - Type: (
input: readonlyT[]) =>WidenString<T>[]
Converts a id filter to match with an id with a query.
Type Parameters
T
T extends string | RegExp
Parameters
input
readonly T[]
the id filters to convert.
Returns
WidenString<T>[]
Example
ts
import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
const plugin = {
name: 'plugin',
transform: {
filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
// The handler will be called for IDs like:
// - foo.js
// - foo.js?foo
// - foo.txt?foo.js
// - foo.ts
// - foo.ts?foo
// - foo.txt?foo.ts
handler(code, id) {}
}
}Call Signature
- Exported from:
rolldown/filter - Type: (
input:string|RegExp| readonly (string|RegExp)[]) =>string|RegExp| (string|RegExp)[]
Converts a id filter to match with an id with a query.
Parameters
input
string | RegExp | readonly (string | RegExp)[]
the id filters to convert.
Returns
string | RegExp | (string | RegExp)[]
Example
ts
import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
const plugin = {
name: 'plugin',
transform: {
filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
// The handler will be called for IDs like:
// - foo.js
// - foo.js?foo
// - foo.txt?foo.js
// - foo.ts
// - foo.ts?foo
// - foo.txt?foo.ts
handler(code, id) {}
}
}