Skip to content

perf(vite): add static hook filters for Slidev modules - #2803

Open
OKAN-SOFTWARE wants to merge 2 commits into
slidevjs:mainfrom
OKAN-SOFTWARE:perf/vite-hook-filters-2284
Open

OKAN-SOFTWARE wants to merge 2 commits into
slidevjs:mainfrom
OKAN-SOFTWARE:perf/vite-hook-filters-2284

Conversation

@OKAN-SOFTWARE

@OKAN-SOFTWARE OKAN-SOFTWARE commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary

Add static Vite/Rolldown hook filters for four Slidev hooks with stable, well-defined module-ID predicates, reducing unnecessary JavaScript hook invocations while preserving fallback checks.

Partially addresses #2284 (does not close the issue).

Changes

  • contextInjection.ts: add transform ID filter for user .vue files, excluding Slidev client components.
  • monacoTypes.ts: add a shared prefix filter to the resolveId and load hooks.
  • loaders.ts: filter resolveId to /@slidev/ virtual modules and __slidev_ IDs.
  • test/plugin-hook-filters.test.ts: add filter-selection regression cases and fallback handler assertions.

The existing in-handler guards remain for compatibility with older Vite/Rollup versions.

Scope and overlapping work

  • hmrPatch.ts and layoutWrapper.ts already have filters on current main.
  • compilerFlagsVue.ts is intentionally excluded because open PR fix: apply dev define flags to JS/TS client modules #2714 already adds a filter while fixing a separate client JS/TS issue.
  • loaders.ts's dynamic load hook is unchanged. It handles generated templates and data-dependent Markdown files; a restrictive static filter requires careful consideration of dynamically added modules and HMR, and a catch-all filter provides no invocation savings.

Validation

  • Compared against upstream main at a42aff28dd75f26eb5abbf3d616ea022c3d08924; four intended files, two focused commits.
  • Checked current open PR listing for competing changes and avoided fix: apply dev define flags to JS/TS client modules #2714.
  • Dependency-free Node parity checks: 2 suites pass for representative and generated module IDs.
  • TypeScript test-file syntax parses without errors.
  • Windows / pnpm 12.15.0: dependency installation and pnpm build completed successfully.
  • vue-tsc --noEmit passed.
  • Focused ESLint passed for the four changed files.
  • pnpm exec vitest run test/plugin-hook-filters.test.ts — 3 tests passed.
  • pnpm test — 35 test files / 382 tests passed (local run, 2026-10-27).
  • pnpm verify — not fully green: build and typechecking passed, then the earlier repository-wide ESLint run stopped on 138 errors; the 3 issues in the added test have since been fixed and focused lint passed. The remaining reported errors concern unrelated repository files (mostly Windows CRLF expectations and YAML formatting). Repository-wide lint has not been re-run after that fix.
  • GitHub Actions: upstream workflows currently report action_required for this fork PR; CI success is not yet established.

The local unit-test suite is green. Browser-level Vite/Rolldown integration and maintainer CI remain unverified.

Additional notes

This is deliberately a focused partial contribution to #2284; it does not mark the issue resolved or change runtime behavior for dynamic load IDs.

@netlify

netlify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for slidev ready!

Name Link
🔨 Latest commit fda320a
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6ae0929d19fd2d2d9257732d
😎 Deploy Preview https://deploy-preview-2803--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@OKAN-SOFTWARE
OKAN-SOFTWARE marked this pull request as ready for review October 27, 2026 12:11

This branch has not been deployed

No deployments
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