refactor: centralize CDN config and fix service worker fallback

- Centralize CDN versions/URLs in cdn-version.ts
- Switch LibreOffice to @bentopdf/libreoffice-wasm package
- Fix service worker fallback to support all WASM packages
- Remove dead code and silence production logs
This commit is contained in:
abdullahalam123
2025-12-30 22:58:25 +05:30
parent 659a4b1a32
commit 2f8086ad59
30 changed files with 560 additions and 338 deletions

View File

@@ -6,6 +6,7 @@
*/
import { WorkerBrowserConverter } from '@matbee/libreoffice-converter/browser';
import { getWasmBaseUrl } from '../config/wasm-cdn-config.js';
export interface LoadProgress {
phase: 'loading' | 'initializing' | 'converting' | 'complete' | 'ready';
@@ -24,8 +25,9 @@ export class LibreOfficeConverter {
private initializing = false;
private basePath: string;
constructor(basePath: string = import.meta.env.BASE_URL + 'libreoffice-wasm/') {
this.basePath = basePath;
constructor(basePath?: string) {
// Use CDN if available, otherwise use provided basePath or default local path
this.basePath = basePath || getWasmBaseUrl('libreoffice');
}
async initialize(onProgress?: ProgressCallback): Promise<void> {