Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
e32e7272ba | |||
3f317fffd5 | |||
a49309566c | |||
0fb1d54e06 | |||
f31ca98b2c | |||
dfcda87196 | |||
108bcb41bf | |||
1b18961539 | |||
4fcfd0f52c | |||
8f1464c97e | |||
96a88911a7 | |||
1d5af30e78 | |||
8fe5b6985c | |||
72e02bd611 | |||
fb7c1242a9 | |||
360766d8b4 | |||
9968dda0fa | |||
77b9e41bdb | |||
8bea58b434 | |||
bd9397eb13 | |||
6e7316d2b1 | |||
cba65bfb81 | |||
f06f25b4db | |||
316625c41b |
30
package.json
30
package.json
@ -1,19 +1,19 @@
|
||||
{
|
||||
"name": "@api.global/typedserver",
|
||||
"version": "3.0.36",
|
||||
"version": "3.0.48",
|
||||
"description": "A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./dist_ts/index.js",
|
||||
"./ts": "./dist_ts/index.js",
|
||||
"./ts_edgeworker": "./dist_ts_edgeworker",
|
||||
"./ts_web_inject": "./dist_ts_web_inject/index.js",
|
||||
"./ts_web_serviceworker": "./dist_ts_web_serviceworker",
|
||||
"./ts_web_serviceworker_client": "./dist_ts_web_serviceworker_client"
|
||||
"./backend": "./dist_ts/index.js",
|
||||
"./edgeworker": "./dist_ts_edgeworker/index.js",
|
||||
"./web_inject": "./dist_ts_web_inject/index.js",
|
||||
"./web_serviceworker": "./dist_ts_web_serviceworker/index.js",
|
||||
"./web_serviceworker_client": "./dist_ts_web_serviceworker_client/index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run build && tstest test/",
|
||||
"build": "tsbuild tsfolders --web --allowimplicitany --skiplibcheck && npm run bundle",
|
||||
"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",
|
||||
"interfaces": "tsbuild interfaces --web --allowimplicitany --skiplibcheck",
|
||||
"docs": "tsdoc aidoc"
|
||||
@ -57,24 +57,24 @@
|
||||
],
|
||||
"homepage": "https://github.com/pushrocks/easyserve",
|
||||
"dependencies": {
|
||||
"@api.global/typedrequest": "^3.0.23",
|
||||
"@api.global/typedrequest": "^3.0.25",
|
||||
"@api.global/typedrequest-interfaces": "^3.0.19",
|
||||
"@api.global/typedsocket": "^3.0.1",
|
||||
"@cloudflare/workers-types": "^4.20240512.0",
|
||||
"@design.estate/dees-comms": "^1.0.24",
|
||||
"@design.estate/dees-comms": "^1.0.27",
|
||||
"@push.rocks/lik": "^6.0.15",
|
||||
"@push.rocks/smartchok": "^1.0.34",
|
||||
"@push.rocks/smartdelay": "^3.0.5",
|
||||
"@push.rocks/smartenv": "^5.0.12",
|
||||
"@push.rocks/smartfeed": "^1.0.11",
|
||||
"@push.rocks/smartfile": "^11.0.14",
|
||||
"@push.rocks/smartfile": "^11.0.15",
|
||||
"@push.rocks/smartjson": "^5.0.19",
|
||||
"@push.rocks/smartlog": "^3.0.3",
|
||||
"@push.rocks/smartlog": "^3.0.6",
|
||||
"@push.rocks/smartlog-destination-devtools": "^1.0.10",
|
||||
"@push.rocks/smartlog-interfaces": "^3.0.0",
|
||||
"@push.rocks/smartmanifest": "^2.0.2",
|
||||
"@push.rocks/smartmatch": "^2.0.0",
|
||||
"@push.rocks/smartmime": "^1.0.5",
|
||||
"@push.rocks/smartmime": "^2.0.0",
|
||||
"@push.rocks/smartntml": "^2.0.4",
|
||||
"@push.rocks/smartopen": "^2.0.0",
|
||||
"@push.rocks/smartpath": "^5.0.18",
|
||||
@ -82,11 +82,11 @@
|
||||
"@push.rocks/smartrequest": "^2.0.22",
|
||||
"@push.rocks/smartrx": "^3.0.7",
|
||||
"@push.rocks/smartsitemap": "^2.0.3",
|
||||
"@push.rocks/smartstream": "^3.0.35",
|
||||
"@push.rocks/smartstream": "^3.0.38",
|
||||
"@push.rocks/smarttime": "^4.0.6",
|
||||
"@push.rocks/taskbuffer": "^3.1.7",
|
||||
"@push.rocks/webrequest": "^3.0.37",
|
||||
"@push.rocks/webstore": "^2.0.14",
|
||||
"@push.rocks/webstore": "^2.0.19",
|
||||
"@tsclass/tsclass": "^4.0.54",
|
||||
"@types/express": "^4.17.21",
|
||||
"body-parser": "^1.20.2",
|
||||
@ -96,7 +96,7 @@
|
||||
"lit": "^3.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.76",
|
||||
"@git.zone/tsbuild": "^2.1.80",
|
||||
"@git.zone/tsbundle": "^2.0.15",
|
||||
"@git.zone/tsrun": "^1.2.44",
|
||||
"@git.zone/tstest": "^1.0.90",
|
||||
|
491
pnpm-lock.yaml
generated
491
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedserver',
|
||||
version: '3.0.36',
|
||||
version: '3.0.48',
|
||||
description: 'A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.'
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ export interface ILoleServiceServerConstructorOptions {
|
||||
}
|
||||
|
||||
// the main service server
|
||||
export class ServiceServer {
|
||||
export class UtilityServiceServer {
|
||||
public options: ILoleServiceServerConstructorOptions;
|
||||
public typedServer: TypedServer;
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
export * from './classes.serviceserver.js';
|
||||
export * from './classes.websiteserver.js';
|
||||
|
@ -1,16 +1,16 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as interfaces from './env.js';
|
||||
import { logger } from './serviceworker.logging.js';
|
||||
import { LosslessServiceWorker } from './serviceworker.classes.serviceworker.js';
|
||||
import { logger } from './logging.js';
|
||||
import { ServiceWorker } from './classes.serviceworker.js';
|
||||
|
||||
export class CacheManager {
|
||||
public losslessServiceWorkerRef: LosslessServiceWorker;
|
||||
public losslessServiceWorkerRef: ServiceWorker;
|
||||
|
||||
public usedCacheNames = {
|
||||
runtimeCacheName: 'runtime'
|
||||
};
|
||||
|
||||
constructor(losslessServiceWorkerRefArg: LosslessServiceWorker) {
|
||||
constructor(losslessServiceWorkerRefArg: ServiceWorker) {
|
||||
this.losslessServiceWorkerRef = losslessServiceWorkerRefArg;
|
||||
this._setupCache();
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import { LosslessServiceWorker } from './serviceworker.classes.serviceworker.js';
|
||||
import { ServiceWorker } from './classes.serviceworker.js';
|
||||
|
||||
export class NetworkManager {
|
||||
public serviceWorkerRef: LosslessServiceWorker;
|
||||
public serviceWorkerRef: ServiceWorker;
|
||||
public webRequest: plugins.webrequest.WebRequest;
|
||||
|
||||
public previousState: string;
|
||||
|
||||
constructor(serviceWorkerRefArg: LosslessServiceWorker) {
|
||||
constructor(serviceWorkerRefArg: ServiceWorker) {
|
||||
this.serviceWorkerRef = serviceWorkerRefArg;
|
||||
this.webRequest = new plugins.webrequest.WebRequest();
|
||||
this.getConnection()?.addEventListener('change', () => {
|
@ -2,18 +2,18 @@ import * as plugins from './plugins.js';
|
||||
import * as interfaces from './env.js';
|
||||
|
||||
// imports
|
||||
import { CacheManager } from './serviceworker.classes.cachemanager.js';
|
||||
import { CacheManager } from './classes.cachemanager.js';
|
||||
import { Deferred } from '@push.rocks/smartpromise';
|
||||
|
||||
import { logger } from './serviceworker.logging.js';
|
||||
import { logger } from './logging.js';
|
||||
|
||||
// imported classes
|
||||
import { UpdateManager } from './serviceworker.classes.updatemanager.js';
|
||||
import { NetworkManager } from './serviceworker.classes.networkmanager.js';
|
||||
import { TaskManager } from './serviceworker.classes.taskmanager.js';
|
||||
import { UpdateManager } from './classes.updatemanager.js';
|
||||
import { NetworkManager } from './classes.networkmanager.js';
|
||||
import { TaskManager } from './classes.taskmanager.js';
|
||||
import { ServiceworkerBackend } from './classes.backend.js';
|
||||
|
||||
export class LosslessServiceWorker {
|
||||
export class ServiceWorker {
|
||||
// STATIC
|
||||
|
||||
// INSTANCE
|
15
ts_web_serviceworker/classes.taskmanager.ts
Normal file
15
ts_web_serviceworker/classes.taskmanager.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import { ServiceWorker } from './classes.serviceworker.js';
|
||||
|
||||
/**
|
||||
* Taskmanager
|
||||
* should use times allocated by browser
|
||||
*/
|
||||
export class TaskManager {
|
||||
public serviceworkerRef: ServiceWorker;
|
||||
|
||||
constructor(serviceWorkerRefArg: ServiceWorker) {
|
||||
this.serviceworkerRef = serviceWorkerRefArg;
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as interfaces from '../dist_ts_interfaces/index.js';
|
||||
import { LosslessServiceWorker } from './serviceworker.classes.serviceworker.js';
|
||||
import { logger } from './serviceworker.logging.js';
|
||||
import { CacheManager } from './serviceworker.classes.cachemanager.js';
|
||||
import { ServiceWorker } from './classes.serviceworker.js';
|
||||
import { logger } from './logging.js';
|
||||
import { CacheManager } from './classes.cachemanager.js';
|
||||
|
||||
export class UpdateManager {
|
||||
public lastUpdateCheck: number = 0;
|
||||
public lastVersionInfo: interfaces.serviceworker.IRequest_Serviceworker_Backend_VersionInfo['response'];
|
||||
|
||||
public serviceworkerRef: LosslessServiceWorker;
|
||||
public serviceworkerRef: ServiceWorker;
|
||||
|
||||
constructor(serviceWorkerRefArg: LosslessServiceWorker) {
|
||||
constructor(serviceWorkerRefArg: ServiceWorker) {
|
||||
this.serviceworkerRef = serviceWorkerRefArg;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
import * as env from './env.js';
|
||||
declare var self: env.ServiceWindow;
|
||||
|
||||
import { LosslessServiceWorker } from './serviceworker.classes.serviceworker.js';
|
||||
|
||||
const losslessServiceWorkerInstance = new LosslessServiceWorker(self);
|
||||
import { ServiceWorker } from './classes.serviceworker.js';
|
||||
|
||||
const sw = new ServiceWorker(self);
|
||||
|
@ -1,15 +0,0 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import { LosslessServiceWorker } from './serviceworker.classes.serviceworker.js';
|
||||
|
||||
/**
|
||||
* Taskmanager
|
||||
* should use times allocated by browser
|
||||
*/
|
||||
export class TaskManager {
|
||||
public serviceworkerRef: LosslessServiceWorker;
|
||||
|
||||
constructor(serviceWorkerRefArg: LosslessServiceWorker) {
|
||||
this.serviceworkerRef = serviceWorkerRefArg;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './lele-serviceworker.plugins.js';
|
||||
import * as plugins from './plugins.js';
|
||||
import * as interfaces from '../dist_ts_interfaces/index.js';
|
||||
import { logger } from './serviceworker.logging.js';
|
||||
import { logger } from './logging.js';
|
||||
|
||||
/**
|
||||
* MessageManager implements two ways of serviceworker communication
|
@ -1,9 +1,9 @@
|
||||
import * as plugins from './lele-serviceworker.plugins.js';
|
||||
import { LosslessServiceworker } from './lele-serviceworker.classes.serviceworker.js';
|
||||
import * as plugins from './plugins.js';
|
||||
import { ServiceworkerClient } from './classes.serviceworkerclient.js';
|
||||
|
||||
export class GlobalSW {
|
||||
losslessSw: LosslessServiceworker;
|
||||
constructor(losslessServiceWorkerInstanceArg: LosslessServiceworker) {
|
||||
losslessSw: ServiceworkerClient;
|
||||
constructor(losslessServiceWorkerInstanceArg: ServiceworkerClient) {
|
||||
this.losslessSw = losslessServiceWorkerInstanceArg;
|
||||
globalThis.globalSw = this;
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './lele-serviceworker.plugins.js';
|
||||
import * as plugins from './plugins.js';
|
||||
import * as interfaces from '../dist_ts_interfaces/index.js';
|
||||
import { logger } from "./serviceworker.logging.js";
|
||||
import { logger } from "./logging.js";
|
||||
|
||||
export class NotificationManager {
|
||||
|
@ -1,19 +1,19 @@
|
||||
import * as plugins from './lele-serviceworker.plugins.js';
|
||||
import * as plugins from './plugins.js';
|
||||
import * as interfaces from '../dist_ts_interfaces/index.js';
|
||||
import { logger } from "./serviceworker.logging.js";
|
||||
import { NotificationManager } from './lele-serviceworker.classes.notificationmanager.js';
|
||||
import { ActionManager } from './lele-serviceworker.classes.actionmanager.js';
|
||||
import { GlobalSW } from './lele-serviceworker.classes.globalsw.js'
|
||||
import { logger } from "./logging.js";
|
||||
import { NotificationManager } from './classes.notificationmanager.js';
|
||||
import { ActionManager } from './classes.actionmanager.js';
|
||||
import { GlobalSW } from './classes.globalsw.js'
|
||||
|
||||
export class LosslessServiceworker {
|
||||
export class ServiceworkerClient {
|
||||
// STATIC
|
||||
public static async createServiceWorker(): Promise<LosslessServiceworker> {
|
||||
public static async createServiceWorker(): Promise<ServiceworkerClient> {
|
||||
if ('serviceWorker' in navigator) {
|
||||
try {
|
||||
logger.log('info', 'trying to register serviceworker');
|
||||
// this is some magic for Parcel to not pick up the serviceworker
|
||||
const serviceworkerInNavigator: ServiceWorkerContainer = navigator.serviceWorker;
|
||||
const swRegistration: ServiceWorkerRegistration = await serviceworkerInNavigator.register('/lsw.js', {
|
||||
const swRegistration: ServiceWorkerRegistration = await serviceworkerInNavigator.register('/serviceworker.js', {
|
||||
scope: '/',
|
||||
updateViaCache: 'none'
|
||||
});
|
||||
@ -31,7 +31,7 @@ export class LosslessServiceworker {
|
||||
await navigator.serviceWorker.ready;
|
||||
logger.log('ok', 'serviceworker is ready!');
|
||||
await this.waitForController();
|
||||
const losslessServiceWorkerInstance = new LosslessServiceworker();
|
||||
const losslessServiceWorkerInstance = new ServiceworkerClient();
|
||||
return losslessServiceWorkerInstance;
|
||||
} catch (err) {
|
||||
// sentry integration here
|
@ -8,17 +8,17 @@ export type {
|
||||
// imports
|
||||
// ====================================
|
||||
|
||||
import { logger } from './serviceworker.logging.js';
|
||||
import { logger } from './logging.js';
|
||||
logger.log('note', 'mainthread console initialized!');
|
||||
|
||||
import { LosslessServiceworker } from './lele-serviceworker.classes.serviceworker.js';
|
||||
import { ServiceworkerClient } from './classes.serviceworkerclient.js';
|
||||
|
||||
export type {
|
||||
LosslessServiceworker
|
||||
ServiceworkerClient
|
||||
}
|
||||
|
||||
export const getServiceWorker = async () => {
|
||||
const losslessServiceWorkerInstance = await LosslessServiceworker.createServiceWorker(); // lets setup the service worker
|
||||
export const getServiceworkerClient = async () => {
|
||||
const swClient = await ServiceworkerClient.createServiceWorker(); // lets setup the service worker
|
||||
logger.log('ok', 'service worker ready!'); // and wait for it to be ready
|
||||
return losslessServiceWorkerInstance;
|
||||
return swClient;
|
||||
};
|
||||
|
Reference in New Issue
Block a user