feat(vite): add cache for rpc functions#458
Merged
Merged
Conversation
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
Contributor
There was a problem hiding this comment.
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
queryfunctions ascacheableso the client can cache them. - Added a
vite:inspect:module-updatedshared 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.