Compare commits

..

2 Commits

Author SHA1 Message Date
5f015380be v6.8.1
Some checks failed
Default (tags) / security (push) Failing after 16s
Default (tags) / test (push) Failing after 13s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-12-04 13:29:43 +00:00
ba12ba561b fix(web_serviceworker): Move service worker initialization to init.ts and remove exports from service worker entrypoint to avoid ESM bundle output 2025-12-04 13:29:43 +00:00
6 changed files with 24 additions and 13 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2025-12-04 - 6.8.1 - fix(web_serviceworker)
Move service worker initialization to init.ts and remove exports from service worker entrypoint to avoid ESM bundle output
- Remove exports from ts_web_serviceworker/index.ts so the service worker entrypoint does not export symbols (prevents tsbundle from producing ESM output).
- Add ts_web_serviceworker/init.ts which initializes the ServiceWorker instance and exports getServiceWorkerInstance() for internal imports.
- Update ts_web_serviceworker/classes.dashboard.ts to import getServiceWorkerInstance from init.ts instead of index.ts.
## 2025-12-04 - 6.8.0 - feat(swdash)
Add SW-Dash (Lit-based service worker dashboard), bundle & serve it; improve servertools and static handlers

View File

@@ -1,6 +1,6 @@
{
"name": "@api.global/typedserver",
"version": "6.8.0",
"version": "6.8.1",
"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: '6.8.0',
version: '6.8.1',
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 { getMetricsCollector } from './classes.metrics.js';
import { getServiceWorkerInstance } from './index.js';
import { getServiceWorkerInstance } from './init.js';
import * as interfaces from './env.js';
/**

View File

@@ -1,10 +1,4 @@
// TypeScript declatations
import * as env from './env.js';
declare var self: env.ServiceWindow;
import { ServiceWorker } from './classes.serviceworker.js';
const sw = new ServiceWorker(self);
// Export getter for service worker instance (used by dashboard for TypedSocket access)
export const getServiceWorkerInstance = (): ServiceWorker => sw;
// Service worker entry point - NO EXPORTS here!
// Exports at entry point cause tsbundle to output ESM format which service workers can't use.
// The actual initialization happens in init.ts which other modules can import from.
import './init.js';

View File

@@ -0,0 +1,10 @@
// Service worker initialization - creates and exports the SW instance
// Other modules in the bundle can import from here
import * as env from './env.js';
declare var self: env.ServiceWindow;
import { ServiceWorker } from './classes.serviceworker.js';
const sw = new ServiceWorker(self);
export const getServiceWorkerInstance = (): ServiceWorker => sw;