Repository navigation
fix(vite-dev-server): apply server.fs check to env transport - #51
Merged
Merged
Conversation
Port vitejs/vite#22159 (f02d9fde0). The server.fs check moves from the Worker transform RPC (allowId) into transformRequest(), still using transformAccess.ts, which also checks the path without its query. The preview MessageChannel server never skips the check, and the client environment rejects fetchModule invocations. Upstream tests cover SSR, module runners and playgrounds that this fork does not port, so unit tests cover the check, the per-transport opt-out, warmup requests, disabled fetchModule and the Worker RPC instead.
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.
Port vitejs/vite#22159, which moves the
server.fscheck for transformed ids intotransformRequest()so that it also applies to env transports:DevEnvironment.transformRequest()checksserver.fsby default.HotChannel.skipFsChecklets transports that are not exposed over the network opt out, andwarmupRequest()skips the check as upstream does.fetchModuleinvocations (disableFetchModule).allowId. The check now runs insidetransformRequest()and still usestransformAccess.ts, which also checks the path without its query.The preview MessageChannel transport does not implement
vite:invoketoday, sofetchModuleis not reachable from preview documents, and preview requests from the Service Worker are checked as before. This change keeps the check in place if invoke support is added later, and alignstransformRequest()with upstream.Upstream tests cover SSR, module runners and playgrounds that this fork does not port, so unit tests cover the check, the per-transport opt-out, warmup requests, disabled
fetchModuleand the Worker RPC.Validated with typecheck, lint,
vp run test:unit:vite:node(649 → 657 tests) and the@vrowzer/vite-dev-serverbuild. Integration and E2E tests were not run locally.