release: WRNexusJS 0.6.0

This commit is contained in:
2026-08-01 01:09:58 +05:30
parent 3e565e8d03
commit 687d345882
502 changed files with 33038 additions and 11358 deletions
+23
View File
@@ -0,0 +1,23 @@
export interface ClientModuleScope {
output: Record<string, (payload?: unknown) => void>;
server: Record<string, (...args: unknown[]) => Promise<unknown>>;
props: Readonly<Record<string, unknown>>;
refs: Record<string, Element>;
}
const moduleCache = new Map<string, Promise<any>>();
export async function loadClientFunctions(
url: string,
scope: ClientModuleScope,
): Promise<Record<string, (...args: unknown[]) => unknown>> {
const module = await (moduleCache.get(url) ??
(() => {
const promise = import(/* @vite-ignore */ url);
moduleCache.set(url, promise);
return promise;
})());
if (typeof module.bindClientScope === "function") return module.bindClientScope(scope);
return module.__wrnexusClientFunctions ?? {};
}
export function invalidateClientModule(url: string): void {
moduleCache.delete(url);
}