pub struct ViteDev { /* private fields */ }Expand description
A connection to a Vite dev server running fetchlet/vite, for
development without a build.
artifact reads a development artifact whose server
module runs Vite’s module runner in the engine and loads the app’s server
module from Vite on each call, so a server edit takes effect on the next
request. host_services adds the binding the runner
reaches Vite through, beside the application’s own services and their
FetchPolicys, and proxy serves Vite’s browser modules
in front of the app.
Implementations§
Source§impl ViteDev
impl ViteDev
Sourcepub fn new(url: &str) -> Result<Self, ViteDevError>
pub fn new(url: &str) -> Result<Self, ViteDevError>
A connection to the Vite dev server at url, such as
http://localhost:5173. Nothing is requested until it is used.
The engine’s requests to the dev server go out on the Tokio runtime
new is called on, such as the HTTP server’s. A pooled connection
is a task on the runtime that opened it, and each application worker
runs its own runtime, which stalls while its engine evaluates; a
connection another worker reused would stall with it.
Sourcepub async fn artifact(&self) -> Result<Artifact, ViteDevError>
pub async fn artifact(&self) -> Result<Artifact, ViteDevError>
The development artifact, which the dev server builds for its
configured backend when first requested. It has no client directory;
browser modules come from Vite through proxy.
Sourcepub fn host_services(&self, services: HostServices) -> Result<HostServices>
pub fn host_services(&self, services: HostServices) -> Result<HostServices>
services with the binding the development artifact loads modules
through. The binding accepts only its own origin and forwards to the
dev server; the application’s services and policies are unchanged,
and the binding is hidden from the server module’s env.