Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement fetch transport (POC) #18485

Draft
wants to merge 48 commits into
base: main
Choose a base branch
from

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Oct 28, 2024

Description

base branch: #18362
diff: sapphi-red:refactor/single-transport...hi-ogawa:feat-fetch-transport

On top of #18362 and with a same spirit as #18338, this PR adds a primitives for server and client transports with builtin server middleware. I had initial implementation in hi-ogawa/vite-environment-examples#140 and mostly copied it here. Currently the diff is only the last commit of this PR.

Example (see fetch-transport.spec.ts)

// environment
import { createServerFetchTransport } from "vite"
new DevEnvironment(name, config, {
  hot: true,
  transport: createServerFetchTransport(),
})

// runner
import { createClientFetchTransport } from "vite/module-runner"
const runner = new ModuleRunner(
  {
    root: server.config.root,
    sourcemapInterceptor: false,
    hmr: true,
    transport: createClientFetchTransport('custom', 'http://localhost:5010'),
  },
  new ESModulesEvaluator(),
)

TBD

  • it has the same concern as feat: implement fetchable runner #18338 regarding:
    • how to bootstrap runner (e.g. how to pass server url http://localhost:5010, need wait for server listen, etc...),
    • how to protect /@vite/transport request which can expose arbitrary fetchModule

sapphi-red and others added 30 commits October 16, 2024 13:16
Co-authored-by: Vladimir <[email protected]>
@patak-dev patak-dev added this to the 6.0 milestone Nov 5, 2024
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