Skip to content

feat(vite): add cache for rpc functions#458

Merged
antfu merged 2 commits into
mainfrom
feat/vite-rpc-cache
Jul 23, 2026
Merged

feat(vite): add cache for rpc functions#458
antfu merged 2 commits into
mainfrom
feat/vite-rpc-cache

Conversation

@webfansplz

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 22, 2026 11:30
@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@458

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@458

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@458

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@458

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@458

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@458

commit: 2ef9e80

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds client-side caching for the Vite inspect RPC layer and introduces a shared-state–based invalidation signal so the UI can clear cached RPC results when the Vite module graph/transform data changes.

Changes:

  • Marked multiple Vite inspect RPC query functions as cacheable so the client can cache them.
  • Added a vite:inspect:module-updated shared state helper and emitters to notify clients after module changes / clear operations.
  • Enabled and configured the RPC cache manager on the Vite DevTools UI client, with tests covering notifications and clear-module-transform behavior.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/vite/src/node/rpc/inspect-module-updated.ts New shared-state key/types and helper functions for module-update notifications.
packages/vite/src/node/rpc/index.ts Re-exports the shared-state key/type and wires the state type into devframe/types augmentation.
packages/vite/src/node/rpc/functions/vite-resolve-id.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-meta-info.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-get-server-metrics.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-get-plugin-metrics.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-get-plugin-details.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-get-modules-list.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-get-module-transform-info.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-get-metadata.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-env-info.ts Marks RPC query as cacheable.
packages/vite/src/node/rpc/functions/vite-clear-module-transform.ts Emits module-updated notifications after clearing a module transform.
packages/vite/src/node/rpc/functions/vite-clear-module-transform.test.ts New test ensuring clear-module-transform triggers shared-state notifications.
packages/vite/src/node/inspect/plugin.ts Uses the shared-state helpers and adds watcher/request-triggered notifications.
packages/vite/src/node/tests/inspect-plugin-notify.test.ts New test validating watcher/request notifications (needs cleanup fixes per comments).
packages/vite/src/app/composables/rpc.ts Enables cache options, clears cache on module-update events, and configures cacheable functions from the server list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/vite/src/node/__tests__/inspect-plugin-notify.test.ts
Comment thread packages/vite/src/node/__tests__/inspect-plugin-notify.test.ts
@antfu
antfu merged commit c2898a8 into main Jul 23, 2026
10 checks passed
@antfu
antfu deleted the feat/vite-rpc-cache branch July 23, 2026 04:14
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.

3 participants