The HMR client script was dead in the browser. HMR_CLIENT_JS is a TypeScript template literal, so the regex [ \t\r\n] inside it was expanded into real control characters, producing a regex literal containing a raw newline — a syntax error that took the whole script down with "Invalid regular expression: missing /". It now uses \s, and a test asserts the emitted client parses and holds no control characters inside regex literals; that test fails if the bug is reintroduced. HMR also corrupted CSP nonces. A document's nonce is fixed at load, but morph copied attributes from freshly fetched HTML, overwriting the live nonce with one the browser will not honour. syncAttrs now leaves nonce alone, and nodes moved across are re-stamped with the live nonce. Islands vanished on every HMR update: morph puts the server placeholder back over the mounted island. The island runtime now remounts on wrnexus:hmr-updated. Remounting swaps the container for a bare clone — re-rendering the existing root is a no-op once HMR has wiped the DOM externally, and unmounting throws asynchronously because the nodes React wants to remove are already gone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
10 lines
665 B
TypeScript
10 lines
665 B
TypeScript
export { createSelectorCache, createSnapshotCache } from "./snapshot-cache.ts";
|
|
export type { SnapshotCache, SnapshotSource } from "./snapshot-cache.ts";
|
|
export { setStoreResolver, useWrnActions, useWrnStore } from "./store-bridge.ts";
|
|
export type { BoundStore, IslandStore, StoreResolver } from "./store-bridge.ts";
|
|
export { IslandErrorBoundary } from "./error-boundary.tsx";
|
|
export type { IslandErrorBoundaryProps } from "./error-boundary.tsx";
|
|
export { islandRootCount, mountIslands, unmountIslands } from "./island-runtime.ts";
|
|
export type { MountOptions } from "./island-runtime.ts";
|
|
export { discardDetachedRoots, remountIslands } from "./island-runtime.ts";
|