Compare commits

...

7 Commits

Author SHA1 Message Date
c5c45f668f v8.4.0
Some checks failed
Default (tags) / security (push) Failing after 2s
Default (tags) / test (push) Failing after 2s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-02-24 22:26:45 +00:00
aa748e0d82 feat(utilityservers): add injectReload and noCache options and enable dev features by default 2026-02-24 22:26:45 +00:00
14c8d83ab5 v8.3.1
Some checks failed
Default (tags) / security (push) Failing after 2s
Default (tags) / test (push) Failing after 2s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-02-24 16:49:44 +00:00
d66b7648a8 fix(typedserver): no changes detected — no version bump needed 2026-02-24 16:49:44 +00:00
657bdfb403 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.
2026-02-24 16:48:56 +00:00
e1b2a13395 v8.3.0
Some checks failed
Default (tags) / security (push) Failing after 1s
Default (tags) / test (push) Failing after 1s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-23 22:42:04 +00:00
c753206456 feat(typedserver): add noCache option to disable client-side caching and set no-cache headers on responses 2026-01-23 22:42:04 +00:00
5 changed files with 48 additions and 7 deletions

View File

@@ -1,5 +1,25 @@
# Changelog
## 2026-02-24 - 8.4.0 - feat(utilityservers)
add injectReload and noCache options and enable dev features by default
- Adds optional configuration properties 'injectReload' and 'noCache' to the website server options interface.
- Dev features (injectReload and noCache) are no longer only enabled when serveDir is set; they now default to true when not explicitly provided.
- This changes default runtime behavior: live-reload injection and disabled browser caching may be enabled for servers that previously did not have them — consumers should set options explicitly to preserve previous behavior.
## 2026-02-24 - 8.3.1 - fix(typedserver)
no changes detected — no version bump needed
- No files changed in the diff
- Current package version: 8.3.0
## 2026-01-23 - 8.3.0 - feat(typedserver)
add noCache option to disable client-side caching and set no-cache headers on responses
- Introduces an optional noCache?: boolean in the server options interface
- applyResponseHeaders now sets Cache-Control, Pragma, and Expires headers when noCache is true
- Existing CORS and security header behavior unchanged when noCache is not set or false
## 2026-01-23 - 8.2.0 - feat(typedserver)
serve bundled in-memory content with caching and reload injection

View File

@@ -1,6 +1,6 @@
{
"name": "@api.global/typedserver",
"version": "8.2.0",
"version": "8.4.0",
"description": "A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.",
"type": "module",
"exports": {

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedserver',
version: '8.2.0',
version: '8.4.0',
description: 'A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.'
}

View File

@@ -157,6 +157,12 @@ export interface IServerOptions {
* Set to true for defaults (brotli + gzip), false to disable, or provide detailed config
*/
compression?: plugins.smartserve.ICompressionConfig | boolean;
/**
* Disable all client-side caching by setting appropriate headers
* Useful for development or when content changes frequently
*/
noCache?: boolean;
}
export type THttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'ALL';
@@ -635,11 +641,18 @@ export class TypedServer {
}
/**
* Apply all configured headers (CORS, security) to a response
* Apply all configured headers (CORS, security, cache control) to a response
*/
private applyResponseHeaders(response: Response): Response {
const headers = new Headers(response.headers);
// No-cache headers
if (this.options.noCache) {
headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0');
headers.set('Pragma', 'no-cache');
headers.set('Expires', '0');
}
// CORS headers
if (this.options.cors) {
headers.set('Access-Control-Allow-Origin', '*');

View File

@@ -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) */
@@ -27,6 +29,10 @@ export interface IUtilityWebsiteServerConstructorOptions {
adsTxt?: string[];
/** Response compression configuration (default: enabled with brotli + gzip) */
compression?: plugins.smartserve.ICompressionConfig | boolean;
/** Disable browser caching (default: true when serveDir is set) */
noCache?: boolean;
/** Inject live-reload devtools script into HTML (default: true when serveDir is set) */
injectReload?: boolean;
}
/**
@@ -55,12 +61,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,
injectReload: this.options.injectReload ?? true,
watch: !!this.options.serveDir,
noCache: this.options.noCache ?? true,
// SPA support (enabled by default for modern web apps)
spaFallback: this.options.spaFallback ?? true,