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
+21
View File
@@ -41,6 +41,7 @@ import {
import { realtimeBusFromConfig } from "./realtime-bus.ts";
import { createHandlers, type AssetServer, type WsData } from "./runtime.ts";
import { servePublicAsset } from "./public.ts";
import type { ClientRuntimeDefinition } from "@wrnexus/plugin";
type RouteModule = Record<string, unknown>;
@@ -62,6 +63,12 @@ export interface ProdManifest {
layouts: { name: string; mod: RouteModule }[];
}
export interface ProductionPluginAsset {
path: string;
contentType: string;
immutable?: boolean;
}
export interface ProdOptions {
/** Absolute path to the pre-built global stylesheet, if any. */
stylesPath?: string;
@@ -108,6 +115,10 @@ export interface ProdOptions {
storage?: StorageConfig;
/** Cache-busting version appended to framework asset URLs. */
assetVersion?: string;
/** Package browser runtimes already emitted by the production build. */
clientRuntimes?: ClientRuntimeDefinition[];
/** Public URL to emitted package asset metadata. */
pluginAssets?: Record<string, ProductionPluginAsset>;
/** Absolute path to copied public assets, if any. */
publicDir?: string;
/** Raw HTML appended to every page head. */
@@ -238,6 +249,15 @@ function createProdAssetServer(opts: ProdOptions): AssetServer {
if (pathname === "/__wrnexus/framework.css")
return serveFile(opts.frameworkCssPath, CSS_HEADERS);
if (pathname === "/__wrnexus/styles.css") return serveFile(opts.stylesPath, CSS_HEADERS);
const pluginAsset = opts.pluginAssets?.[pathname];
if (pluginAsset) {
return serveFile(pluginAsset.path, {
"content-type": pluginAsset.contentType,
"cache-control":
pluginAsset.immutable === false ? "no-cache" : "public, max-age=31536000, immutable",
"x-content-type-options": "nosniff",
});
}
return servePublicAsset(opts.publicDir, pathname, MODE);
},
};
@@ -306,6 +326,7 @@ export function createProductionHandlers(
inlineStyles: opts.inlineStyles,
stylesIncludeFramework: opts.stylesIncludeFramework,
assetVersion: opts.assetVersion,
clientRuntimes: opts.clientRuntimes,
head: opts.head,
seo: opts.seo,
mobile: opts.mobile,