feat(server): use UtilityWebsiteServer for dev server, add domain option, update docs, and bump dependencies

This commit is contained in:
2026-03-10 15:54:55 +00:00
parent b62e380750
commit 07cdee6bff
9 changed files with 1012 additions and 569 deletions

View File

@@ -153,6 +153,7 @@ tswatch uses `npmextra.json` for configuration. Add your config under the `@git.
| `port` | `number` | `3002` | Server port |
| `serveDir` | `string` | `./dist_watch/` | Directory to serve |
| `liveReload` | `boolean` | `true` | Inject live reload script |
| `domain` | `string` | `localhost` | Domain name for the dev server |
#### `IBundleConfig`
@@ -163,6 +164,9 @@ tswatch uses `npmextra.json` for configuration. Add your config under the `@git.
| `to` | `string` | *required* | Output file |
| `watchPatterns` | `string[]` | - | Additional patterns to watch |
| `triggerReload` | `boolean` | `true` | Trigger server reload after bundling |
| `outputMode` | `'bundle' \| 'base64ts'` | `'bundle'` | Output mode for the bundle |
| `bundler` | `'esbuild' \| 'rolldown' \| 'rspack'` | `'esbuild'` | Bundler to use |
| `production` | `boolean` | `false` | Produce a production build |
## 🛠️ CLI Commands
@@ -368,19 +372,22 @@ Config:
## 🌐 Development Server
The built-in development server (enabled in `element` and `website` presets) features:
The built-in development server (powered by `@api.global/typedserver`'s `UtilityWebsiteServer`) is enabled in `element` and `website` presets:
- **Live Reload** - Automatically refreshes browser on changes
- **No Caching** - Prevents browser caching during development (sends `Cache-Control: no-store, no-cache` headers)
- **CORS** - Cross-origin requests enabled
- **Compression** - Gzip compression for faster loading
- **SPA Fallback** - Single-page application routing support
- **Security Headers** - Cross-origin isolation headers
- 🔄 **Live Reload** - WebSocket-based instant browser refresh on changes (via service worker + devtools injection)
- 🚫 **No Caching** - Prevents browser caching during development (`Cache-Control: no-store, no-cache` headers)
- 🌍 **CORS** - Cross-origin requests enabled
- 🗜️ **Compression** - Brotli + gzip compression for faster loading
- 📱 **SPA Fallback** - Single-page application routing support
- 🔒 **Security Headers** - Cross-origin isolation (`COOP`, `COEP`)
- 📦 **PWA Manifest** - Auto-generated Progressive Web App manifest
-**Service Worker** - Built-in service worker version info for cache busting
Default configuration:
- **Port**: 3002
- **Serve Directory**: `./dist_watch/`
- **Live Reload**: Enabled
- **Domain**: `localhost`
## 🔧 Configuration Tips