release: WRNexusJS 0.4.0

This commit is contained in:
2026-07-27 12:42:18 +05:30
parent 8b728a3e5d
commit 30e5721e84
250 changed files with 10065 additions and 3923 deletions
+18 -2
View File
@@ -24,6 +24,7 @@ import { UPLOAD_RUNTIME, UPLOAD_JS_HREF, UPLOADS_PREFIX, serveStoredFile } from
import type { Mode } from "@wrnexus/core";
import type { AssetServer } from "./runtime.ts";
import { servePublicAsset } from "./public.ts";
import { servePluginAsset, type ServedPluginAsset } from "./plugin-assets.ts";
/** Style inputs the dev asset server needs to build `/__wrnexus/styles.css`. */
export interface DevStyles {
@@ -31,6 +32,8 @@ export interface DevStyles {
config?: StylesConfig;
appRoot: string;
publicDir?: string;
sources?: string[];
entries?: string[];
}
/** A dev asset server also supports invalidating its caches in-process. */
@@ -64,6 +67,7 @@ export function createDevAssetServer(
theme?: ResolvedTheme,
uiCss?: string,
schemasJs?: string,
pluginAssets: readonly ServedPluginAsset[] = [],
): DevAssetServer {
let cssCache: string | null = null;
let schemasCode = schemasJs ?? "window.__wireSchemas={};";
@@ -107,16 +111,28 @@ export function createDevAssetServer(
}
if (pathname === "/__wrnexus/styles.css") {
if (!styles?.entry) return new Response("Not Found", { status: 404 });
if (!styles?.entry && !styles?.entries?.length) {
return new Response("Not Found", { status: 404 });
}
if (cssCache === null) {
cssCache = await renderStyles(
{ entryPath: styles.entry, appDir, appRoot: styles.appRoot, mode },
{
entryPath: styles.entry,
appDir,
appRoot: styles.appRoot,
mode,
sources: styles.sources,
entries: styles.entries,
},
styles.config,
);
}
return cssResponse(cssCache);
}
const pluginAsset = await servePluginAsset(pluginAssets, pathname, mode);
if (pluginAsset) return pluginAsset;
return servePublicAsset(styles?.publicDir, pathname, mode);
},
};