Skip to content

[Bug]: Plugins do not accept composable filters from @rolldown/pluginutils #5254

@TheAlexLichter

Description

@TheAlexLichter

Reproduction link or steps

https://github.com/TheAlexLichter/rolldown-reproductions/tree/rolldown-composable-filter-expr

  1. Clone repro
  2. Install deps (pnpm i)
  3. Check out Rolldown config
  4. See type error

Example code that fails

import { Plugin } from "rolldown";
import { and, id, moduleType, query } from '@rolldown/pluginutils';

// Build a filter expression
const filterExpr = and(
  id(/\.ts$/),
  moduleType('ts'),
  query('foo', true)
);

// Usage in a plugin to define a hook filter
const myPlugin: Plugin = {
 transform: {
    filter: filterExpr, // This should not throw an error
    handler(code, id, options) {
      // Your code here
    },
  },
}

What is expected?

No error

What is actually happening?

Error

System Info

System:
    OS: Linux 6.6 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 10.57 GB / 15.58 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 22.17.0 - ~/.nvm/versions/node/v22.17.0/bin/node
    Yarn: 1.22.19 - /mnt/c/Program Files/nodejs/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.17.0/bin/npm
    pnpm: 10.0.0 - /mnt/c/Program Files/nodejs/pnpm
    bun: 1.1.16 - ~/.bun/bin/bun
  npmPackages:
    rolldown: 1.0.0-beta.26 => 1.0.0-beta.26

Any additional comments?

No response

Metadata

Metadata

Labels

documentationImprovements or additions to documentation

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions