mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-24 12:36:13 +00:00
Compare commits
4 Commits
c774a1b2a6
...
c540cabbec
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c540cabbec | ||
![]() |
003285506f | ||
![]() |
6d3b08d9b6 | ||
![]() |
295e682e03 |
@ -24,7 +24,7 @@ indent_size = 2
|
|||||||
insert_final_newline = false
|
insert_final_newline = false
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[{*.js,*.jsx,*.ts,*.tsx}]
|
[{*.js,*.jsx,*.mjs,*.ts,*.tsx}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[*.css]
|
[*.css]
|
||||||
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -147,6 +147,8 @@ jobs:
|
|||||||
cache-dependency-path: frontend/package-lock.json
|
cache-dependency-path: frontend/package-lock.json
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: cd frontend && npm ci
|
run: cd frontend && npm ci
|
||||||
|
- name: Lint frontend
|
||||||
|
run: cd frontend && npm run lint
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
run: cd frontend && npm run build
|
run: cd frontend && npm run build
|
||||||
- name: Run frontend tests
|
- name: Run frontend tests
|
||||||
|
1
.vscode/extensions.json
vendored
1
.vscode/extensions.json
vendored
@ -19,5 +19,6 @@
|
|||||||
"yzhang.markdown-all-in-one", // Markdown All-in-One extension for enhanced Markdown editing
|
"yzhang.markdown-all-in-one", // Markdown All-in-One extension for enhanced Markdown editing
|
||||||
"stylelint.vscode-stylelint", // Stylelint extension for CSS and SCSS linting
|
"stylelint.vscode-stylelint", // Stylelint extension for CSS and SCSS linting
|
||||||
"redhat.vscode-yaml", // YAML extension for Visual Studio Code
|
"redhat.vscode-yaml", // YAML extension for Visual Studio Code
|
||||||
|
"dbaeumer.vscode-eslint", // ESLint extension for TypeScript linting
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
30
frontend/eslint.config.mjs
Normal file
30
frontend/eslint.config.mjs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import eslint from '@eslint/js';
|
||||||
|
import { defineConfig } from 'eslint/config';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
|
export default defineConfig(
|
||||||
|
eslint.configs.recommended,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
"dist", // Contains 3rd party code
|
||||||
|
"public", // Contains 3rd party code
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
"no-empty-pattern": "off", // Temporarily disabled until codebase conformant
|
||||||
|
"no-undef": "off", // Temporarily disabled until codebase conformant
|
||||||
|
"no-case-declarations": "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
|
||||||
|
"@typescript-eslint/no-explicit-any": "off", // Temporarily disabled until codebase conformant
|
||||||
|
"@typescript-eslint/no-require-imports": "off", // Temporarily disabled until codebase conformant
|
||||||
|
"@typescript-eslint/no-unused-expressions": "off", // Temporarily disabled until codebase conformant
|
||||||
|
"@typescript-eslint/no-unused-vars": "off", // Temporarily disabled until codebase conformant
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
934
frontend/package-lock.json
generated
934
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,7 @@
|
|||||||
"predev": "npm run generate-icons",
|
"predev": "npm run generate-icons",
|
||||||
"dev": "npx tsc --noEmit && vite",
|
"dev": "npx tsc --noEmit && vite",
|
||||||
"prebuild": "npm run generate-icons",
|
"prebuild": "npm run generate-icons",
|
||||||
|
"lint": "npx eslint",
|
||||||
"build": "npx tsc --noEmit && vite build",
|
"build": "npx tsc --noEmit && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
@ -72,6 +73,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.34.0",
|
||||||
"@iconify-json/material-symbols": "^1.2.33",
|
"@iconify-json/material-symbols": "^1.2.33",
|
||||||
"@iconify/utils": "^3.0.1",
|
"@iconify/utils": "^3.0.1",
|
||||||
"@playwright/test": "^1.40.0",
|
"@playwright/test": "^1.40.0",
|
||||||
@ -80,6 +82,7 @@
|
|||||||
"@types/react-dom": "^19.1.5",
|
"@types/react-dom": "^19.1.5",
|
||||||
"@vitejs/plugin-react": "^4.5.0",
|
"@vitejs/plugin-react": "^4.5.0",
|
||||||
"@vitest/coverage-v8": "^1.0.0",
|
"@vitest/coverage-v8": "^1.0.0",
|
||||||
|
"eslint": "^9.34.0",
|
||||||
"jsdom": "^23.0.0",
|
"jsdom": "^23.0.0",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
"madge": "^8.0.0",
|
"madge": "^8.0.0",
|
||||||
@ -87,7 +90,8 @@
|
|||||||
"postcss-cli": "^11.0.1",
|
"postcss-cli": "^11.0.1",
|
||||||
"postcss-preset-mantine": "^1.17.0",
|
"postcss-preset-mantine": "^1.17.0",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.9.2",
|
||||||
|
"typescript-eslint": "^8.42.0",
|
||||||
"vite": "^6.3.5",
|
"vite": "^6.3.5",
|
||||||
"vitest": "^1.0.0"
|
"vitest": "^1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ function getLicenseUrl(licenseType) {
|
|||||||
// Handle complex SPDX expressions like "(MIT AND Zlib)" or "(MIT OR CC0-1.0)"
|
// Handle complex SPDX expressions like "(MIT AND Zlib)" or "(MIT OR CC0-1.0)"
|
||||||
if (licenseType.includes('AND') || licenseType.includes('OR')) {
|
if (licenseType.includes('AND') || licenseType.includes('OR')) {
|
||||||
// Extract the first license from compound expressions for URL
|
// 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]]) {
|
if (match && licenseUrls[match[1]]) {
|
||||||
return licenseUrls[match[1]];
|
return licenseUrls[match[1]];
|
||||||
}
|
}
|
||||||
|
@ -385,6 +385,13 @@
|
|||||||
"moduleLicense": "MIT",
|
"moduleLicense": "MIT",
|
||||||
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": "@posthog/core",
|
||||||
|
"moduleUrl": "https://github.com/PostHog/posthog-js",
|
||||||
|
"moduleVersion": "1.0.2",
|
||||||
|
"moduleLicense": "MIT",
|
||||||
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "@tailwindcss/node",
|
"moduleName": "@tailwindcss/node",
|
||||||
"moduleUrl": "https://github.com/tailwindlabs/tailwindcss",
|
"moduleUrl": "https://github.com/tailwindlabs/tailwindcss",
|
||||||
@ -742,6 +749,13 @@
|
|||||||
"moduleLicense": "MIT",
|
"moduleLicense": "MIT",
|
||||||
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": "core-js",
|
||||||
|
"moduleUrl": "https://github.com/zloirock/core-js",
|
||||||
|
"moduleVersion": "3.45.1",
|
||||||
|
"moduleLicense": "MIT",
|
||||||
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "core-util-is",
|
"moduleName": "core-util-is",
|
||||||
"moduleUrl": "https://github.com/isaacs/core-util-is",
|
"moduleUrl": "https://github.com/isaacs/core-util-is",
|
||||||
@ -924,6 +938,13 @@
|
|||||||
"moduleLicense": "MIT",
|
"moduleLicense": "MIT",
|
||||||
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": "fflate",
|
||||||
|
"moduleUrl": "https://github.com/101arrowz/fflate",
|
||||||
|
"moduleVersion": "0.4.8",
|
||||||
|
"moduleLicense": "MIT",
|
||||||
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "file-selector",
|
"moduleName": "file-selector",
|
||||||
"moduleUrl": "https://github.com/react-dropzone/file-selector",
|
"moduleUrl": "https://github.com/react-dropzone/file-selector",
|
||||||
@ -1533,6 +1554,20 @@
|
|||||||
"moduleLicense": "MIT",
|
"moduleLicense": "MIT",
|
||||||
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": "posthog-js",
|
||||||
|
"moduleUrl": "https://github.com/PostHog/posthog-js",
|
||||||
|
"moduleVersion": "1.261.0",
|
||||||
|
"moduleLicense": "MIT*",
|
||||||
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"moduleName": "preact",
|
||||||
|
"moduleUrl": "https://github.com/preactjs/preact",
|
||||||
|
"moduleVersion": "10.27.1",
|
||||||
|
"moduleLicense": "MIT",
|
||||||
|
"moduleLicenseUrl": "https://opensource.org/licenses/MIT"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "pretty-format",
|
"moduleName": "pretty-format",
|
||||||
"moduleUrl": "https://github.com/facebook/jest",
|
"moduleUrl": "https://github.com/facebook/jest",
|
||||||
@ -1928,7 +1963,7 @@
|
|||||||
{
|
{
|
||||||
"moduleName": "typescript",
|
"moduleName": "typescript",
|
||||||
"moduleUrl": "https://github.com/microsoft/TypeScript",
|
"moduleUrl": "https://github.com/microsoft/TypeScript",
|
||||||
"moduleVersion": "5.8.3",
|
"moduleVersion": "5.9.2",
|
||||||
"moduleLicense": "Apache-2.0",
|
"moduleLicense": "Apache-2.0",
|
||||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||||
},
|
},
|
||||||
@ -1995,6 +2030,13 @@
|
|||||||
"moduleLicense": "Apache-2.0",
|
"moduleLicense": "Apache-2.0",
|
||||||
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": "web-vitals",
|
||||||
|
"moduleUrl": "https://github.com/GoogleChrome/web-vitals",
|
||||||
|
"moduleVersion": "4.2.4",
|
||||||
|
"moduleLicense": "Apache-2.0",
|
||||||
|
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "webidl-conversions",
|
"moduleName": "webidl-conversions",
|
||||||
"moduleUrl": "https://github.com/jsdom/webidl-conversions",
|
"moduleUrl": "https://github.com/jsdom/webidl-conversions",
|
||||||
|
@ -82,8 +82,8 @@ export function adjustFontSizeToFit(
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
cancelAnimationFrame(raf);
|
cancelAnimationFrame(raf);
|
||||||
try { ro.disconnect(); } catch {}
|
try { ro.disconnect(); } catch { /* Ignore errors */ }
|
||||||
try { mo.disconnect(); } catch {}
|
try { mo.disconnect(); } catch { /* Ignore errors */ }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ export class PDFExportService {
|
|||||||
newDoc.setModificationDate(new Date());
|
newDoc.setModificationDate(new Date());
|
||||||
|
|
||||||
const pdfBytes = await newDoc.save();
|
const pdfBytes = await newDoc.save();
|
||||||
return new Blob([pdfBytes], { type: 'application/pdf' });
|
return new Blob([pdfBytes as BlobPart], { type: 'application/pdf' });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,7 +176,7 @@ export class PDFExportService {
|
|||||||
newDoc.setModificationDate(new Date());
|
newDoc.setModificationDate(new Date());
|
||||||
|
|
||||||
const pdfBytes = await newDoc.save();
|
const pdfBytes = await newDoc.save();
|
||||||
return new Blob([pdfBytes], { type: 'application/pdf' });
|
return new Blob([pdfBytes as BlobPart], { type: 'application/pdf' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* PDF.js Worker Manager - Centralized worker lifecycle management
|
* PDF.js Worker Manager - Centralized worker lifecycle management
|
||||||
*
|
*
|
||||||
* Prevents infinite worker creation by managing PDF.js workers globally
|
* Prevents infinite worker creation by managing PDF.js workers globally
|
||||||
* and ensuring proper cleanup when operations complete.
|
* and ensuring proper cleanup when operations complete.
|
||||||
*/
|
*/
|
||||||
@ -86,7 +86,7 @@ class PDFWorkerManager {
|
|||||||
const pdf = await loadingTask.promise;
|
const pdf = await loadingTask.promise;
|
||||||
this.activeDocuments.add(pdf);
|
this.activeDocuments.add(pdf);
|
||||||
this.workerCount++;
|
this.workerCount++;
|
||||||
|
|
||||||
return pdf;
|
return pdf;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If document creation fails, make sure to clean up the loading task
|
// If document creation fails, make sure to clean up the loading task
|
||||||
@ -94,6 +94,7 @@ class PDFWorkerManager {
|
|||||||
try {
|
try {
|
||||||
loadingTask.destroy();
|
loadingTask.destroy();
|
||||||
} catch (destroyError) {
|
} catch (destroyError) {
|
||||||
|
// Ignore errors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
@ -125,7 +126,7 @@ class PDFWorkerManager {
|
|||||||
documentsToDestroy.forEach(pdf => {
|
documentsToDestroy.forEach(pdf => {
|
||||||
this.destroyDocument(pdf);
|
this.destroyDocument(pdf);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.activeDocuments.clear();
|
this.activeDocuments.clear();
|
||||||
this.workerCount = 0;
|
this.workerCount = 0;
|
||||||
}
|
}
|
||||||
@ -166,9 +167,10 @@ class PDFWorkerManager {
|
|||||||
try {
|
try {
|
||||||
pdf.destroy();
|
pdf.destroy();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// Ignore errors
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.activeDocuments.clear();
|
this.activeDocuments.clear();
|
||||||
this.workerCount = 0;
|
this.workerCount = 0;
|
||||||
}
|
}
|
||||||
@ -182,4 +184,4 @@ class PDFWorkerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export singleton instance
|
// Export singleton instance
|
||||||
export const pdfWorkerManager = PDFWorkerManager.getInstance();
|
export const pdfWorkerManager = PDFWorkerManager.getInstance();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user