Skip to content

Adopt Rolldown hook filters for statically-checkable plugin hooks#346

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/use-filters-in-plugins
Draft

Adopt Rolldown hook filters for statically-checkable plugin hooks#346
Copilot wants to merge 3 commits intomainfrom
copilot/use-filters-in-plugins

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

This PR applies Rolldown/Vite hook filters to plugin hooks that were already gated by static id checks, reducing unnecessary hook invocations while preserving existing behavior. It focuses on hooks where matching can be determined upfront from request shape.

  • Scope of filter adoption

    • Converted eligible resolveId, load, and transform hooks to object-hook form ({ filter, handler }) in:
      • packages/pages/src/pages.ts
      • packages/images/src/images.ts
      • packages/mdx/src/mdx-vite-plugins.ts
      • packages/iles/src/node/plugin/plugin.ts
      • packages/iles/src/node/plugin/documents.ts
  • Behavior-preserving details

    • Kept virtual routes handling compatible with prefixed module IDs (e.g. \0, /@id/) in pages hooks.
    • Removed redundant in-handler guards where filter matching already guarantees hook eligibility.
    • Left non-static/behavior-sensitive paths unchanged (notably in islands entrypoint resolution/loading) where filtering was not safely equivalent.
  • Representative pattern applied

    transform: {
      filter: { id: /vue&type=page/ },
      async handler (_code, _id) {
        return 'export default {};'
      },
    }

Copilot AI and others added 3 commits April 7, 2026 14:17
Agent-Logs-Url: https://github.com/ElMassimo/iles/sessions/2f29b5ee-5bf6-4265-aed8-abd9fd19681f

Co-authored-by: ElMassimo <1158253+ElMassimo@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying iles with  Cloudflare Pages  Cloudflare Pages

Latest commit: 50c6fea
Status: ✅  Deploy successful!
Preview URL: https://cfa4beff.iles.pages.dev
Branch Preview URL: https://copilot-use-filters-in-plugi.iles.pages.dev

View logs

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 7, 2026

View your CI Pipeline Execution ↗ for commit 50c6fea

Command Status Duration Result
nx run-many --target=build --all --exclude docs... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-07 17:34:11 UTC

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 7, 2026

View your CI Pipeline Execution ↗ for commit 50c6fea

Command Status Duration Result
nx run-many --target=build --all --exclude docs... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-07 17:32:35 UTC

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.

2 participants