Repository navigation
fix: resolve the dev manifest bridge after early imports - #416
everton-dgn wants to merge 1 commit into
Conversation
Look up the bridge origin when an isolated runner requests assets instead of permanently selecting the JS-only fallback during early startup. Keep manifest imports independent of the HTTP listening event so hosts can await them from environment startup without deadlocking. Add regression coverage for eager imports, occupied ports, early asset lookups, shutdown, in-process resolution and middleware mode. Fixes solidjs#414
🦋 Changeset detectedLatest commit: 00d6746 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
|
Tested this branch under
One thing to expect once the bridge is reachable: a lazy module's first lookup after a start is asynchronous, so its Versions: (submitted by Claude Opus 5.5 on behalf of rvlzzr) |
Fixes #414
Nitro can import
virtual:solid-manifestbefore Vite opens its HTTP port. At that point the plugin has no bridge URL to embed, so the manifest selects its JS-only fallback for the rest of the session. Lazy-route CSS is then missing from the initial SSR HTML.Defer the bridge URL lookup until assets are requested. A small virtual module reads Vite's resolved origin, including the port chosen when the configured port is occupied. Importing the manifest itself stays nonblocking: Vite awaits environment startup before binding the port, so waiting for
listeninginside the manifest loader would deadlock those hosts.The regression tests cover eager imports, imports awaited by an environment's
listen(), port fallback, in-process resolution, shutdown before listening and middleware mode. They run in CI after the plugin build.Validation:
pnpm buildpassed, including declaration generation.SIGKILLon macOS.Middleware mode retains its existing JS-only fallback because it has no HTTP origin of its own. A caller that requests assets before the port opens also gets JS-only assets; later lookups recover once the bridge URL is available. In that case, the first lookup after listening can still return JS-only assets while the URL is refreshed. Workerd was not exercised.
Related: #415 covers stale CSS after edits. The two fixes touch the same resolver; combining them requires preserving both the generation check and the
!bridgeMissingcache guard. The joint validation below now covers their composition.Joint validation of #416 and #417
Both patches were composed on
nextatec6b58d0c17290d6f474a9ed93bfa03d1dc9b8a0, using #416 at00d67467a693cd702daada088543ffdaf5eb3871and #417 at81555d8f9c9b3681a6e6b2d949023a942a40d018.The composition regression fixture is published separately as a test-only commit. It requires both fixes; that branch alone does not contain their runtime changes.
listen(), recovery on the same resolver, CSS invalidation during a pending fetch, and two runners sharing one server with independent caches.When resolving the overlap, preserve both guards:
The local composition also adds
node test/startup-cache.mjsto the CSS-matrix test script and the CI bridge/startup/cache step. Carry those entries and the fixture into whichever PR lands second, or a follow-up after both fixes land.This joint run used Vite's isolated runner transport. It did not rerun Cypress, exercise Workerd, or test two separate Vite servers.