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 1 commit 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

@hi-ogawa hi-ogawa force-pushed the feat-fetch-transport branch 3 times, most recently from 83d3004 to 01cf7e1 Compare November 1, 2024 01:38
@patak-dev patak-dev added this to the 6.0 milestone Nov 5, 2024
@hi-ogawa hi-ogawa force-pushed the feat-fetch-transport branch from 01cf7e1 to 35fc229 Compare November 7, 2024 00:22
@hi-ogawa hi-ogawa force-pushed the feat-fetch-transport branch from 35fc229 to e15813d Compare November 8, 2024 03:33
@sapphi-red sapphi-red modified the milestones: 6.0, 6.1 Nov 13, 2024
@sapphi-red sapphi-red removed this from the 6.1 milestone Jan 8, 2025
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