fix(build): migrate build tooling to tsbuild v4 and tsbundle config while updating sitemap integration

This commit is contained in:
2026-03-23 11:49:55 +00:00
parent d4c4e0971f
commit 292fb824fd
23 changed files with 3601 additions and 4401 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## 2026-03-23 - 8.4.5 - fix(build)
migrate build tooling to tsbuild v4 and tsbundle config while updating sitemap integration
- move tsbundle bundle definitions into npmextra.json and simplify build scripts for tsbuild v4
- replace cross-folder imports from dist_ts_interfaces with ts_interfaces source paths to match automatic path rewriting
- update sitemap generation to the smartsitemap v4 builder API for standard and news sitemaps
- refresh package dependencies and documentation for the new build flow and server capabilities
## 2026-03-23 - 8.4.4 - fix(utilityservers)
enable file watching whenever a static serve directory is configured

View File

@@ -36,5 +36,27 @@
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@ship.zone/szci": {}
"@ship.zone/szci": {},
"@git.zone/tsbundle": {
"bundles": [
{
"from": "./ts_web_inject/index.ts",
"to": "./dist_ts_web_inject/bundle.js",
"outputMode": "bundle",
"bundler": "esbuild"
},
{
"from": "./ts_web_serviceworker/index.ts",
"to": "./dist_ts_web_serviceworker/serviceworker.bundle.js",
"outputMode": "bundle",
"bundler": "esbuild"
},
{
"from": "./ts_swdash/index.ts",
"to": "./dist_ts_swdash/bundle.js",
"outputMode": "bundle",
"bundler": "esbuild"
}
]
}
}

View File

@@ -14,9 +14,8 @@
},
"scripts": {
"test": "npm run build && tstest test/ --verbose --logfile --timeout 60",
"build": "tsbuild tsfolders --web --allowimplicitany && npm run bundle",
"bundle": "tsbundle --from ./ts_web_inject/index.ts --to ./dist_ts_web_inject/bundle.js && tsbundle --from ./ts_web_serviceworker/index.ts --to ./dist_ts_web_serviceworker/serviceworker.bundle.js && tsbundle --from ./ts_swdash/index.ts --to ./dist_ts_swdash/bundle.js",
"interfaces": "tsbuild interfaces --web --allowimplicitany --skiplibcheck",
"build": "tsbuild tsfolders && tsbundle",
"interfaces": "tsbuild interfaces --skiplibcheck",
"docs": "tsdoc aidoc"
},
"repository": {
@@ -58,20 +57,20 @@
],
"homepage": "https://code.foss.global/api.global/typedserver",
"dependencies": {
"@api.global/typedrequest": "^3.2.5",
"@api.global/typedrequest": "^3.3.0",
"@api.global/typedrequest-interfaces": "^3.0.19",
"@api.global/typedsocket": "^4.1.0",
"@cloudflare/workers-types": "^4.20251205.0",
"@design.estate/dees-catalog": "^3.1.1",
"@api.global/typedsocket": "^4.1.2",
"@cloudflare/workers-types": "^4.20260317.1",
"@design.estate/dees-catalog": "^3.49.0",
"@design.estate/dees-comms": "^1.0.30",
"@push.rocks/lik": "^6.2.2",
"@push.rocks/lik": "^6.4.0",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartenv": "^6.0.0",
"@push.rocks/smartfeed": "^1.4.0",
"@push.rocks/smartfile": "^13.1.0",
"@push.rocks/smartfs": "^1.2.0",
"@push.rocks/smartjson": "^5.2.0",
"@push.rocks/smartlog": "^3.1.10",
"@push.rocks/smartfile": "^13.1.2",
"@push.rocks/smartfs": "^1.5.0",
"@push.rocks/smartjson": "^6.0.0",
"@push.rocks/smartlog": "^3.2.1",
"@push.rocks/smartlog-destination-devtools": "^1.0.12",
"@push.rocks/smartlog-interfaces": "^3.0.2",
"@push.rocks/smartmanifest": "^2.0.2",
@@ -83,23 +82,23 @@
"@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartrequest": "^5.0.1",
"@push.rocks/smartrx": "^3.0.10",
"@push.rocks/smartserve": "^2.0.1",
"@push.rocks/smartsitemap": "^2.0.4",
"@push.rocks/smartstream": "^3.2.5",
"@push.rocks/smarttime": "^4.1.1",
"@push.rocks/smartwatch": "^6.0.0",
"@push.rocks/taskbuffer": "^3.5.0",
"@push.rocks/webrequest": "^4.0.1",
"@push.rocks/smartserve": "^2.0.3",
"@push.rocks/smartsitemap": "^4.0.1",
"@push.rocks/smartstream": "^3.4.0",
"@push.rocks/smarttime": "^4.2.3",
"@push.rocks/smartwatch": "^6.3.1",
"@push.rocks/taskbuffer": "^8.0.0",
"@push.rocks/webrequest": "^4.0.5",
"@push.rocks/webstore": "^2.0.20",
"@tsclass/tsclass": "^9.3.0",
"lit": "^3.3.1"
"@tsclass/tsclass": "^9.5.0",
"lit": "^3.3.2"
},
"devDependencies": {
"@git.zone/tsbuild": "^3.1.2",
"@git.zone/tsbundle": "^2.6.3",
"@git.zone/tsrun": "^2.0.0",
"@git.zone/tstest": "^3.1.3",
"@types/node": "^24.10.1"
"@git.zone/tsbuild": "^4.3.0",
"@git.zone/tsbundle": "^2.9.1",
"@git.zone/tsrun": "^2.0.1",
"@git.zone/tstest": "^3.5.0",
"@types/node": "^25.5.0"
},
"private": false,
"browserslist": [

7625
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,59 +1,42 @@
# Project Hints - @api.global/typedserver
## Recent Changes (December 2025)
## Recent Changes (March 2026)
### Dependency Updates
- `@push.rocks/smartwatch` upgraded to v6.0.0 (cross-runtime, native fs.watch)
- `@design.estate/dees-catalog` upgraded to v3.1.1 (new icons, components)
- `@push.rocks/smartchok` replaced with `@push.rocks/smartwatch` (renamed package)
- `@push.rocks/smartfile` upgraded from v11 to v13 (major API change - `fs` module removed)
- `@push.rocks/smartfs` added for filesystem operations (v1.2.0+)
- `@push.rocks/smartenv` upgraded to v6.0.0
- `@push.rocks/smartrequest` upgraded to v5.0.1
- `@push.rocks/webrequest` upgraded to v4.0.1 (`WebRequest` renamed to `WebrequestClient`)
- Express upgraded to v5.2.1
- All `@git.zone/*` dev dependencies updated to latest
- `@git.zone/tsbuild` upgraded to v4.3.0 (major: auto path rewriting, folder clearing)
- `@git.zone/tsbundle` upgraded to v2.9.1 (uses npmextra.json config)
- `@git.zone/tstest` upgraded to v3.5.0
- `@push.rocks/smartsitemap` upgraded to v4.0.1 (major: builder pattern API)
- `@push.rocks/taskbuffer` upgraded to v8.0.0 (backward compatible for existing usage)
- `@push.rocks/smartjson` upgraded to v6.0.0 (backward compatible)
- `@tsclass/tsclass` upgraded to v9.5.0
- `@types/node` upgraded to v25.5.0
- All other dependencies updated to latest patch/minor versions
### Code Migration Notes
#### smartwatch v6.0.0
- Cross-runtime support: Node.js 20+, Deno, Bun
- Uses native `fs.watch({ recursive: true })` for performance
- Minimal dependencies (no chokidar, no FSEvents bindings)
- API unchanged: `new Smartwatch([patterns])`, `.start()`, `.stop()`, `.getObservableFor(event)`
- Events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `error`, `ready`
- Dynamic watching: `.add(patterns)`, `.remove(pattern)`
- Status property: `'idle' | 'starting' | 'watching'`
#### tsbuild v4 Migration
- **Cross-folder imports**: Use `../ts_interfaces/index.js` instead of `../dist_ts_interfaces/index.js`
- tsbuild v4 automatically rewrites import paths from `ts_*` to `dist_ts_*` in output
- CLI flags `--web` and `--allowimplicitany` removed (defaults already handle these)
- Build script simplified to `tsbuild tsfolders && tsbundle`
#### dees-catalog v3.0.0+ Migration
- **DeesIcon**: New unified `icon` property with library prefixes:
- FontAwesome: `icon="fa:check"` (prefix `fa:`)
- Lucide: `icon="lucide:menu"` (prefix `lucide:`)
- Legacy `iconFA` property deprecated but still supported
- **DeesToast**: New convenience methods and positioning:
- `DeesToast.info()`, `.success()`, `.warning()`, `.error()`
- Position options: `top-right`, `top-left`, `bottom-right`, `bottom-left`, `top-center`, `bottom-center`
- New components: DeesInputTags, DeesInputDatepicker, DeesStatsGrid, DeesPagination, DeesAppuiBase
- DeesAppuiAppbar: Hierarchical menus with keyboard navigation
#### tsbundle npmextra.json Config
- Bundle configuration moved from CLI args to `npmextra.json` under `"@git.zone/tsbundle"` key
- Three bundles configured: web_inject, web_serviceworker, swdash
#### smartfile v13 Migration
- Old: `plugins.smartfile.fs.toStringSync(path)` / `plugins.smartfile.fs.toBufferSync(path)`
- New: Use `plugins.fsInstance` (SmartFs instance with Node provider)
- String: `await plugins.fsInstance.file(path).encoding('utf8').read() as string`
- Buffer: `await plugins.fsInstance.file(path).read() as Buffer`
#### smartfs treeHash
- Old: `plugins.smartfile.fs.fileTreeToHash(dir, pattern)`
- New: `await plugins.fsInstance.directory(dir).recursive().treeHash()`
#### webrequest v4
- Class renamed: `WebRequest``WebrequestClient`
#### smartsitemap v4 Migration
- Complete API rewrite using builder pattern
- Old: `new SmartSitemap().createSitemapFromUrlInfoArray(urls)`
- New: `SmartSitemap.create().addUrls(urls).toXml()`
- Old: `new SmartSitemap().createSitemapNewsFromArticleArray(articles)`
- New: `SmartSitemap.fromArticles(articles, { publicationName: '...' }).toXml()`
- `IUrlInfo` renamed to `ISitemapUrl` with different properties:
- `url``loc`
- `timestamp``lastmod` (accepts Date | string | number)
- `frequency``changefreq`
### Architecture
- `plugins.fsInstance` is a pre-configured SmartFs instance with SmartFsProviderNode
- All file operations should be async using smartfs
- Sync file operations have been removed
### Express 5 Notes
- Wildcard routes use `/{*splat}` notation
- `req.params.splat` can be an array, use `Array.isArray()` check
- Cross-folder imports reference source `ts_*` folders, tsbuild handles path rewriting

160
readme.md
View File

@@ -8,16 +8,18 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
## ✨ Features
- 🔒 **Type-Safe API** - Full TypeScript support with `@api.global/typedrequest` and `@api.global/typedsocket`
- 🎯 **Decorator Routing** - Clean, expressive routing with `@Route`, `@Get`, `@Post` decorators via smartserve
- 🛡️ **Security Headers** - Built-in CSP, HSTS, X-Frame-Options, and comprehensive security configuration
-**Live Reload** - Automatic browser refresh on file changes during development
- 🛠️ **Service Worker** - Advanced caching, offline support, and background sync
- ☁️ **Edge Workers** - Cloudflare Workers compatible edge computing with domain routing
- 📡 **WebSocket** - Real-time bidirectional communication via TypedSocket
- 🗺️ **SEO Tools** - Built-in sitemap, RSS feed, and robots.txt generation
- 🎯 **SPA Support** - Single-page application fallback routing
- 📱 **PWA Ready** - Web App Manifest generation for progressive web apps
- 🔒 **Type-Safe API** Full TypeScript support with `@api.global/typedrequest` and `@api.global/typedsocket`
- 🎯 **Decorator Routing** Clean, expressive routing with `@Route`, `@Get`, `@Post` decorators via smartserve
- 🛡️ **Security Headers** Built-in CSP, HSTS, X-Frame-Options, and comprehensive security configuration
-**Live Reload** Automatic browser refresh on file changes during development
- 🛠️ **Service Worker** Advanced caching, offline support, and background sync
- ☁️ **Edge Workers** Cloudflare Workers compatible edge computing with domain routing
- 📡 **WebSocket** Real-time bidirectional communication via TypedSocket
- 🗺️ **SEO Tools** Built-in sitemap, RSS feed, and robots.txt generation
- 🎯 **SPA Support** Single-page application fallback routing
- 📱 **PWA Ready** Web App Manifest generation for progressive web apps
- 🗜️ **Compression** — Automatic Brotli + Gzip response compression
- 📦 **Bundled Content** — Serve pre-bundled content from memory for zero-filesystem deployments
## 📦 Installation
@@ -60,10 +62,11 @@ const server = new TypedServer({
// Development
watch: true,
injectReload: true,
noCache: true, // Disable browser caching
// Production
forceSsl: true,
spaFallback: true, // Serve index.html for client-side routes
spaFallback: true, // Serve index.html for client-side routes
// SEO
sitemap: true,
@@ -82,6 +85,13 @@ const server = new TypedServer({
background_color: '#ffffff',
theme_color: '#000000',
},
// Compression
compression: {
enabled: true,
algorithms: ['br', 'gzip'],
threshold: 1024,
},
});
await server.start();
@@ -142,24 +152,23 @@ import { TypedServer } from '@api.global/typedserver';
const server = new TypedServer({ serveDir: './public', cors: true });
// Simple route
server.addRoute('/api/health', 'GET', async (request) => {
server.addRoute('/api/health', 'GET', async (ctx) => {
return new Response(JSON.stringify({ status: 'ok' }), {
headers: { 'Content-Type': 'application/json' },
});
});
// Route with parameters (Express-style :param syntax)
server.addRoute('/api/items/:id', 'GET', async (request) => {
const itemId = (request as any).params.id;
server.addRoute('/api/items/:id', 'GET', async (ctx) => {
const itemId = ctx.params.id;
return new Response(JSON.stringify({ id: itemId }), {
headers: { 'Content-Type': 'application/json' },
});
});
// Wildcard routes
server.addRoute('/files/*path', 'GET', async (request) => {
const filePath = (request as any).params.path;
// Handle file serving logic
server.addRoute('/files/*path', 'GET', async (ctx) => {
const filePath = ctx.params.path;
return new Response(`Requested: ${filePath}`);
});
@@ -274,6 +283,33 @@ const swClient = await getServiceworkerClient({
// - Version updates
```
## 📦 Bundled Content
Serve pre-bundled content directly from memory — useful for single-binary deployments or embedding assets in server-side code:
```typescript
import { TypedServer } from '@api.global/typedserver';
const server = new TypedServer({
cors: true,
bundledContent: [
{
path: '/index.html',
contentBase64: Buffer.from('<html><body>Hello!</body></html>').toString('base64'),
},
{
path: '/app.js',
contentBase64: Buffer.from('console.log("loaded")').toString('base64'),
},
],
spaFallback: true,
});
await server.start();
```
Bundled content takes priority over filesystem serving and supports ETag-based conditional requests with immutable caching.
## 🛡️ Security Headers
Configure comprehensive security headers including CSP, HSTS, and more:
@@ -345,7 +381,7 @@ await server.start();
TypedServer supports automatic response compression using Brotli and Gzip. Compression is powered by smartserve and enabled by default.
### Global Configuration
### Configuration
```typescript
import { TypedServer } from '@api.global/typedserver';
@@ -358,47 +394,19 @@ const server = new TypedServer({
compression: true,
// Or disable completely
compression: false,
// compression: false,
// Or configure in detail
compression: {
enabled: true,
algorithms: ['br', 'gzip'], // Preferred order
threshold: 1024, // Min size to compress (bytes)
level: 4, // Compression level (1-11 for brotli, 1-9 for gzip)
exclude: ['/api/stream/*'], // Skip these paths
},
// compression: {
// enabled: true,
// algorithms: ['br', 'gzip'], // Preferred order
// threshold: 1024, // Min size to compress (bytes)
// level: 4, // Compression level (1-11 for brotli, 1-9 for gzip)
// exclude: ['/api/stream/*'], // Skip these paths
// },
});
```
### Per-Route Control with Decorators
Use `@Compress` and `@NoCompress` decorators for fine-grained control:
```typescript
import * as smartserve from '@push.rocks/smartserve';
@smartserve.Route('/api')
class ApiController {
// Force maximum compression for this endpoint
@smartserve.Get('/large-data')
@smartserve.Compress({ level: 11 })
async getLargeData(ctx: smartserve.IRequestContext): Promise<Response> {
return new Response(JSON.stringify(largeDataset));
}
// Disable compression for streaming endpoint
@smartserve.Get('/events')
@smartserve.NoCompress()
async streamEvents(ctx: smartserve.IRequestContext): Promise<Response> {
// Server-Sent Events shouldn't be compressed
return new Response(eventStream, {
headers: { 'Content-Type': 'text/event-stream' },
});
}
}
```
### Compression Options Reference
| Option | Type | Default | Description |
@@ -416,37 +424,40 @@ class ApiController {
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `serveDir` | `string` | - | Directory to serve static files from |
| `serveDir` | `string` | | Directory to serve static files from |
| `bundledContent` | `IBundledContentItem[]` | — | Base64-encoded files to serve from memory |
| `port` | `number \| string` | `3000` | Port to listen on |
| `cors` | `boolean` | `true` | Enable CORS headers |
| `watch` | `boolean` | `false` | Watch files for changes |
| `injectReload` | `boolean` | `false` | Inject live reload script into HTML |
| `noCache` | `boolean` | `false` | Disable browser caching via response headers |
| `forceSsl` | `boolean` | `false` | Redirect HTTP to HTTPS |
| `spaFallback` | `boolean` | `false` | Serve index.html for non-file routes |
| `sitemap` | `boolean` | `false` | Generate sitemap at `/sitemap` |
| `feed` | `boolean` | `false` | Generate RSS feed at `/feed` |
| `robots` | `boolean` | `false` | Serve robots.txt |
| `domain` | `string` | - | Domain name for sitemap/feeds |
| `appVersion` | `string` | - | Application version string |
| `manifest` | `object` | - | Web App Manifest configuration |
| `publicKey` | `string` | - | SSL certificate |
| `privateKey` | `string` | - | SSL private key |
| `defaultAnswer` | `function` | - | Custom default response handler |
| `feedMetadata` | `object` | - | RSS feed metadata options |
| `domain` | `string` | | Domain name for sitemap/feeds |
| `appVersion` | `string` | | Application version string |
| `manifest` | `object` | | Web App Manifest configuration |
| `publicKey` | `string` | | SSL certificate |
| `privateKey` | `string` | | SSL private key |
| `defaultAnswer` | `function` | | Custom default response handler |
| `feedMetadata` | `object` | | RSS feed metadata options |
| `blockWaybackMachine` | `boolean` | `false` | Block Wayback Machine archiving |
| `securityHeaders` | `ISecurityHeaders` | - | Security headers configuration |
| `securityHeaders` | `ISecurityHeaders` | | Security headers configuration |
| `compression` | `ICompressionConfig \| boolean` | `true` | Response compression configuration |
## 🏗️ Package Exports
```
@api.global/typedserver
├── . - Main server (TypedServer)
├── /backend - Alias for main server
├── /edgeworker - Cloudflare Workers edge computing
├── /web_inject - Live reload script injection
├── /web_serviceworker - Service Worker implementation
── /web_serviceworker_client - Service Worker client utilities
├── . Main server (TypedServer)
├── /backend Alias for main server
├── /infohtml — Info HTML page generator
├── /edgeworker — Cloudflare Workers edge computing
├── /web_inject — Live reload script injection
── /web_serviceworker Service Worker implementation
└── /web_serviceworker_client — Service Worker client utilities
```
## 🔄 Utility Servers
@@ -455,7 +466,7 @@ Pre-configured server templates with best practices built-in.
### UtilityWebsiteServer
Optimized for modern web applications with SPA support enabled by default:
Optimized for modern web applications with SPA support, live reload, and caching disabled by default during development:
```typescript
import { utilityservers } from '@api.global/typedserver';
@@ -479,7 +490,7 @@ const websiteServer = new utilityservers.UtilityWebsiteServer({
},
// Compression (enabled by default)
compression: true, // or { level: 6, threshold: 512 }
compression: true,
// Other options
cors: true, // default: true
@@ -551,9 +562,10 @@ await serviceServer.start();
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Request Handler Pipeline │ │
│ │ 1. Controller Registry (Decorated Routes) │ │
│ │ 2. TypedRequest/TypedSocket handlers │ │
│ │ 3. Static File Serving │ │
│ │ 4. SPA Fallback │ │
│ │ 2. Bundled Content (in-memory) │ │
│ │ 3. HTML Injection (live reload) │ │
│ │ 4. Static File Serving (filesystem) │ │
│ │ 5. SPA Fallback │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
```

View File

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

View File

@@ -1,5 +1,5 @@
import * as plugins from './plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
import { DevToolsController } from './controllers/controller.devtools.js';
import { TypedRequestController } from './controllers/controller.typedrequest.js';
import { BuiltInRoutesController } from './controllers/controller.builtin.js';
@@ -1056,32 +1056,31 @@ export class TypedServer {
* Sitemap helper class
*/
class SitemapHelper {
private smartSitemap = new plugins.smartsitemap.SmartSitemap();
public urls: plugins.smartsitemap.IUrlInfo[] = [];
public urls: plugins.smartsitemap.ISitemapUrl[] = [];
constructor(domain?: string) {
if (domain) {
this.urls.push({
url: `https://${domain}/`,
timestamp: Date.now(),
frequency: 'daily',
loc: `https://${domain}/`,
lastmod: new Date(),
changefreq: 'daily',
});
}
}
async createSitemap(): Promise<string> {
return this.smartSitemap.createSitemapFromUrlInfoArray(this.urls);
return plugins.smartsitemap.SmartSitemap.create().addUrls(this.urls).toXml();
}
async createSitemapNews(articles: plugins.tsclass.content.IArticle[]): Promise<string> {
return this.smartSitemap.createSitemapNewsFromArticleArray(articles);
return plugins.smartsitemap.SmartSitemap.fromArticles(articles, { publicationName: 'News' }).toXml();
}
replaceUrls(urlsArg: plugins.smartsitemap.IUrlInfo[]) {
replaceUrls(urlsArg: plugins.smartsitemap.ISitemapUrl[]) {
this.urls = urlsArg;
}
addUrls(urlsArg: plugins.smartsitemap.IUrlInfo[]) {
addUrls(urlsArg: plugins.smartsitemap.ISitemapUrl[]) {
this.urls = this.urls.concat(urlsArg);
}
}

View File

@@ -17,7 +17,7 @@ export class BuiltInRoutesController {
feedMetadata?: plugins.smartfeed.IFeedOptions;
articleGetterFunction?: () => Promise<plugins.tsclass.content.IArticle[]>;
blockWaybackMachine?: boolean;
getSitemapUrls: () => plugins.smartsitemap.IUrlInfo[];
getSitemapUrls: () => plugins.smartsitemap.ISitemapUrl[];
};
constructor(options: typeof BuiltInRoutesController.prototype.options) {
@@ -64,9 +64,8 @@ export class BuiltInRoutesController {
throw new plugins.smartserve.RouteNotFoundError(ctx.path, ctx.method);
}
const smartsitemap = new plugins.smartsitemap.SmartSitemap();
const urls = this.options.getSitemapUrls();
const sitemapXml = await smartsitemap.createSitemapFromUrlInfoArray(urls);
const sitemapXml = plugins.smartsitemap.SmartSitemap.create().addUrls(urls).toXml();
return new Response(sitemapXml, {
status: 200,
@@ -80,9 +79,8 @@ export class BuiltInRoutesController {
throw new plugins.smartserve.RouteNotFoundError(ctx.path, ctx.method);
}
const smartsitemap = new plugins.smartsitemap.SmartSitemap();
const articles = await this.options.articleGetterFunction();
const sitemapNewsXml = await smartsitemap.createSitemapNewsFromArticleArray(articles);
const sitemapNewsXml = plugins.smartsitemap.SmartSitemap.fromArticles(articles, { publicationName: this.options.domain || 'News' }).toXml();
return new Response(sitemapNewsXml, {
status: 200,
@@ -127,7 +125,7 @@ export class BuiltInRoutesController {
@plugins.smartserve.Get('/sw-dash')
async getSwDash(ctx: plugins.smartserve.IRequestContext): Promise<Response> {
// Import shared HTML from interfaces
const { SW_DASH_HTML } = await import('../../dist_ts_interfaces/serviceworker.js');
const { SW_DASH_HTML } = await import('../../ts_interfaces/serviceworker.js');
return new Response(SW_DASH_HTML, {
status: 200,
headers: { 'Content-Type': 'text/html' },

View File

@@ -1,4 +1,4 @@
import * as interfaces from '../../dist_ts_interfaces/index.js';
import * as interfaces from '../../ts_interfaces/index.js';
import { type IServerOptions, type ISecurityHeaders, type IBundledContentItem, TypedServer } from '../classes.typedserver.js';
import * as plugins from '../plugins.js';

View File

@@ -5,7 +5,7 @@ import type { IMetricsData } from './sw-dash-overview.js';
import type { ICachedResource } from './sw-dash-urls.js';
import type { IDomainStats } from './sw-dash-domains.js';
import type { IContentTypeStats } from './sw-dash-types.js';
import type { serviceworker } from '../dist_ts_interfaces/index.js';
import type { serviceworker } from '../ts_interfaces/index.js';
// Import components to register them
import './sw-dash-overview.js';

View File

@@ -1,5 +1,5 @@
import * as plugins from './typedserver_web.plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
import { logger } from './typedserver_web.logger.js';
// TypedServer-Devtools loaded

View File

@@ -1,5 +1,5 @@
import * as plugins from './plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
import { logger } from './logging.js';
import { getMetricsCollector } from './classes.metrics.js';
import { getEventBus, ServiceWorkerEvent } from './classes.eventbus.js';

View File

@@ -3,7 +3,7 @@ import { getServiceWorkerInstance } from './init.js';
import { getPersistentStore } from './classes.persistentstore.js';
import { getRequestLogStore } from './classes.requestlogstore.js';
import * as interfaces from './env.js';
import type { serviceworker } from '../dist_ts_interfaces/index.js';
import type { serviceworker } from '../ts_interfaces/index.js';
type TEventType = serviceworker.TEventType;

View File

@@ -1,6 +1,6 @@
import * as plugins from './plugins.js';
import { logger } from './logging.js';
import type { serviceworker } from '../dist_ts_interfaces/index.js';
import type { serviceworker } from '../ts_interfaces/index.js';
import { getServiceWorkerBackend } from './init.js';
type ICumulativeMetrics = serviceworker.ICumulativeMetrics;

View File

@@ -1,5 +1,5 @@
import { logger } from './logging.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
/**
* Store for TypedRequest traffic logs

View File

@@ -1,5 +1,5 @@
import * as plugins from './plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
import { ServiceWorker } from './classes.serviceworker.js';
import { logger } from './logging.js';
import { CacheManager } from './classes.cachemanager.js';

View File

@@ -1,4 +1,4 @@
export * from '../dist_ts_interfaces/index.js';
export * from '../ts_interfaces/index.js';
// =============================
// Interfaces for the service worker

View File

@@ -1,5 +1,5 @@
// @losslessone_private scope
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
export { interfaces };

View File

@@ -1,5 +1,5 @@
import * as plugins from './plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
import { logger } from './logging.js';
/**

View File

@@ -1,5 +1,5 @@
import * as plugins from './plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
import { logger } from "./logging.js";
export class NotificationManager {

View File

@@ -1,5 +1,5 @@
import * as plugins from './plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
import * as interfaces from '../ts_interfaces/index.js';
import { logger } from "./logging.js";
import { NotificationManager } from './classes.notificationmanager.js';
import { ActionManager } from './classes.actionmanager.js';

View File

@@ -1,5 +1,5 @@
// types
import type * as interfaces from '../dist_ts_interfaces/index.js';
import type * as interfaces from '../ts_interfaces/index.js';
export type {
interfaces
}