From 657bdfb403a25d0f528a712494d9947fb557523d Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Tue, 24 Feb 2026 16:48:56 +0000 Subject: [PATCH] feat(websiteserver): add bundledContent pass-through and make serveDir optional UtilityWebsiteServer now forwards bundledContent to TypedServer for in-memory serving. serveDir is optional; dev features (injectReload, watch, noCache) only activate with serveDir. --- ts/utilityservers/classes.websiteserver.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ts/utilityservers/classes.websiteserver.ts b/ts/utilityservers/classes.websiteserver.ts index 4c3c3fc..cd6f36a 100644 --- a/ts/utilityservers/classes.websiteserver.ts +++ b/ts/utilityservers/classes.websiteserver.ts @@ -1,5 +1,5 @@ import * as interfaces from '../../dist_ts_interfaces/index.js'; -import { type IServerOptions, type ISecurityHeaders, TypedServer } from '../classes.typedserver.js'; +import { type IServerOptions, type ISecurityHeaders, type IBundledContentItem, TypedServer } from '../classes.typedserver.js'; import * as plugins from '../plugins.js'; export interface IUtilityWebsiteServerConstructorOptions { @@ -10,7 +10,9 @@ export interface IUtilityWebsiteServerConstructorOptions { /** Domain name for the website */ domain: string; /** Directory to serve static files from */ - serveDir: string; + serveDir?: string; + /** Bundled content to serve from memory (base64-encoded files from tsbundle) */ + bundledContent?: IBundledContentItem[]; /** RSS feed metadata */ feedMetadata?: IServerOptions['feedMetadata']; /** Enable/disable CORS (default: true) */ @@ -55,12 +57,14 @@ export class UtilityWebsiteServer { // Core settings cors: this.options.cors ?? true, serveDir: this.options.serveDir, + bundledContent: this.options.bundledContent, domain: this.options.domain, port, - // Development features - injectReload: true, - watch: true, + // Development features (only when serving from filesystem) + injectReload: !!this.options.serveDir, + watch: !!this.options.serveDir, + noCache: !!this.options.serveDir, // SPA support (enabled by default for modern web apps) spaFallback: this.options.spaFallback ?? true,