mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-24 12:36:13 +00:00
Compare commits
5 Commits
4c39979460
...
36e0442980
Author | SHA1 | Date | |
---|---|---|---|
![]() |
36e0442980 | ||
![]() |
003285506f | ||
![]() |
6d3b08d9b6 | ||
![]() |
d20e8b6d1f | ||
![]() |
295e682e03 |
@ -15,10 +15,8 @@ export default defineConfig(
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
"no-empty": "off", // Temporarily disabled until codebase conformant
|
||||
"no-empty-pattern": "off", // Temporarily disabled until codebase conformant
|
||||
"no-undef": "off", // Temporarily disabled until codebase conformant
|
||||
"no-useless-escape": "off", // Temporarily disabled until codebase conformant
|
||||
"prefer-const": "off", // Temporarily disabled until codebase conformant
|
||||
"@typescript-eslint/ban-ts-comment": "off", // Temporarily disabled until codebase conformant
|
||||
"@typescript-eslint/no-empty-object-type": "off", // Temporarily disabled until codebase conformant
|
||||
|
@ -224,7 +224,7 @@ function getLicenseUrl(licenseType) {
|
||||
// Handle complex SPDX expressions like "(MIT AND Zlib)" or "(MIT OR CC0-1.0)"
|
||||
if (licenseType.includes('AND') || licenseType.includes('OR')) {
|
||||
// Extract the first license from compound expressions for URL
|
||||
const match = licenseType.match(/\(?\s*([A-Za-z0-9\-\.]+)/);
|
||||
const match = licenseType.match(/\(?\s*([A-Za-z0-9\-.]+)/);
|
||||
if (match && licenseUrls[match[1]]) {
|
||||
return licenseUrls[match[1]];
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ export function adjustFontSizeToFit(
|
||||
|
||||
return () => {
|
||||
cancelAnimationFrame(raf);
|
||||
try { ro.disconnect(); } catch {}
|
||||
try { mo.disconnect(); } catch {}
|
||||
try { ro.disconnect(); } catch { /* Ignore errors */ }
|
||||
try { mo.disconnect(); } catch { /* Ignore errors */ }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* PDF.js Worker Manager - Centralized worker lifecycle management
|
||||
*
|
||||
*
|
||||
* Prevents infinite worker creation by managing PDF.js workers globally
|
||||
* and ensuring proper cleanup when operations complete.
|
||||
*/
|
||||
@ -86,7 +86,7 @@ class PDFWorkerManager {
|
||||
const pdf = await loadingTask.promise;
|
||||
this.activeDocuments.add(pdf);
|
||||
this.workerCount++;
|
||||
|
||||
|
||||
return pdf;
|
||||
} catch (error) {
|
||||
// If document creation fails, make sure to clean up the loading task
|
||||
@ -94,6 +94,7 @@ class PDFWorkerManager {
|
||||
try {
|
||||
loadingTask.destroy();
|
||||
} catch (destroyError) {
|
||||
// Ignore errors
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
@ -125,7 +126,7 @@ class PDFWorkerManager {
|
||||
documentsToDestroy.forEach(pdf => {
|
||||
this.destroyDocument(pdf);
|
||||
});
|
||||
|
||||
|
||||
this.activeDocuments.clear();
|
||||
this.workerCount = 0;
|
||||
}
|
||||
@ -166,9 +167,10 @@ class PDFWorkerManager {
|
||||
try {
|
||||
pdf.destroy();
|
||||
} catch (error) {
|
||||
// Ignore errors
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.activeDocuments.clear();
|
||||
this.workerCount = 0;
|
||||
}
|
||||
@ -182,4 +184,4 @@ class PDFWorkerManager {
|
||||
}
|
||||
|
||||
// Export singleton instance
|
||||
export const pdfWorkerManager = PDFWorkerManager.getInstance();
|
||||
export const pdfWorkerManager = PDFWorkerManager.getInstance();
|
||||
|
Loading…
x
Reference in New Issue
Block a user