release: WRNexusJS 0.2.75

This commit is contained in:
2026-07-21 12:30:46 +05:30
parent 2ca2d02b22
commit 69b6cd431f
100 changed files with 2313 additions and 116 deletions
+9
View File
@@ -11,11 +11,13 @@
import { watch, type FSWatcher } from "node:fs";
import type { HmrHub } from "./hmr.ts";
import type { DevAssetServer } from "./assets.ts";
import type { DevToolbarCollector } from "@wrnexus/dev-toolbar/server";
export interface WatchOptions {
appDir: string;
hub: HmrHub;
assets: DevAssetServer;
devToolbarCollector?: DevToolbarCollector;
/** Called with changed app-relative files that need an in-process hot update. */
onHotChange: (files: string[]) => void | Promise<void>;
}
@@ -50,6 +52,7 @@ export function startWatcher(opts: WatchOptions): FSWatcher | undefined {
pending.clear();
const files = [...pendingFiles];
pendingFiles.clear();
for (const file of files) opts.devToolbarCollector?.clear(file);
void Promise.resolve(opts.onHotChange(files)).catch((error) => {
console.error("[wrnexus] hot update failed", error);
});
@@ -58,6 +61,12 @@ export function startWatcher(opts: WatchOptions): FSWatcher | undefined {
if (pending.has("css")) {
assets.invalidateCss();
hub.css();
hub.broadcastJson({
channel: "toolbar",
type: "toolbar:scan",
reason: "styles-change",
files: [...pendingFiles],
});
}
pending.clear();
pendingFiles.clear();