From 1b0f3ac87983edf6c7aec954f412998677ab6f6e Mon Sep 17 00:00:00 2001 From: octocorvus Date: Sun, 30 Mar 2025 14:29:25 +0000 Subject: [PATCH 1/7] bump pdf.js version to 5.1.91 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index b517c919a..1fb50d2f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "@stylistic/eslint-plugin": "^4.2.0", "esbuild": "^0.25.1", "eslint": "^9.23.0", - "pdfjs-dist": "^5.0.375" + "pdfjs-dist": "^5.1.91" } }, "node_modules/@esbuild/aix-ppc64": { @@ -1944,9 +1944,9 @@ } }, "node_modules/pdfjs-dist": { - "version": "5.0.375", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.0.375.tgz", - "integrity": "sha512-QDRlEVldf/cX88CElGAyRhjqNOO69kmB3HZlalDAfqJ/IvmqJNkipomhBZy4cWATfLVlkQTXE3H4yFvMF2uPsg==", + "version": "5.1.91", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.1.91.tgz", + "integrity": "sha512-qSIADdagooJB4wWCBnrBJjRvASevmxL0BwafvOuKJG5uTQdYoFBrhrRYnucKNiSc9qS6JIk0hC5y1yktFljXkA==", "dev": true, "license": "Apache-2.0", "engines": { diff --git a/package.json b/package.json index 76fea62a0..0cdc69bbe 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,6 @@ "@stylistic/eslint-plugin": "^4.2.0", "esbuild": "^0.25.1", "eslint": "^9.23.0", - "pdfjs-dist": "^5.0.375" + "pdfjs-dist": "^5.1.91" } } From e1af5bf1526a9da39b4601f7142b3c5d9c513fbb Mon Sep 17 00:00:00 2001 From: octocorvus Date: Sun, 30 Mar 2025 14:46:19 +0000 Subject: [PATCH 2/7] typescript support --- package-lock.json | 115 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 5 +- 2 files changed, 117 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1fb50d2f5..50aaf69a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,10 +5,13 @@ "packages": { "": { "devDependencies": { + "@eslint/js": "^9.23.0", "@stylistic/eslint-plugin": "^4.2.0", "esbuild": "^0.25.1", "eslint": "^9.23.0", - "pdfjs-dist": "^5.1.91" + "pdfjs-dist": "^5.1.91", + "typescript": "^5.8.2", + "typescript-eslint": "^8.28.0" } }, "node_modules/@esbuild/aix-ppc64": { @@ -953,6 +956,61 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.28.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.28.0.tgz", + "integrity": "sha512-lvFK3TCGAHsItNdWZ/1FkvpzCxTHUVuFrdnOGLMa0GGCFIbCgQWVk3CzCGdA7kM3qGVc+dfW9tr0Z/sHnGDFyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.28.0", + "@typescript-eslint/type-utils": "8.28.0", + "@typescript-eslint/utils": "8.28.0", + "@typescript-eslint/visitor-keys": "8.28.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.28.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.28.0.tgz", + "integrity": "sha512-LPcw1yHD3ToaDEoljFEfQ9j2xShY367h7FZ1sq5NJT9I3yj4LHer1Xd1yRSOdYy9BpsrxU7R+eoDokChYM53lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.28.0", + "@typescript-eslint/types": "8.28.0", + "@typescript-eslint/typescript-estree": "8.28.0", + "@typescript-eslint/visitor-keys": "8.28.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "8.28.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.28.0.tgz", @@ -971,6 +1029,30 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.28.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.28.0.tgz", + "integrity": "sha512-oRoXu2v0Rsy/VoOGhtWrOKDiIehvI+YNrDk5Oqj40Mwm0Yt01FC/Q7nFqg088d3yAsR1ZcZFVfPCTTFCe/KPwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "8.28.0", + "@typescript-eslint/utils": "8.28.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, "node_modules/@typescript-eslint/types": { "version": "8.28.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.28.0.tgz", @@ -1625,6 +1707,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2162,7 +2251,6 @@ "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -2171,6 +2259,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.28.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.28.0.tgz", + "integrity": "sha512-jfZtxJoHm59bvoCMYCe2BM0/baMswRhMmYhy+w6VfcyHrjxZ0OJe0tGasydCpIpA+A/WIJhTyZfb3EtwNC/kHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.28.0", + "@typescript-eslint/parser": "8.28.0", + "@typescript-eslint/utils": "8.28.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 0cdc69bbe..141b3ff12 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,12 @@ { "type": "module", "devDependencies": { + "@eslint/js": "^9.23.0", "@stylistic/eslint-plugin": "^4.2.0", "esbuild": "^0.25.1", "eslint": "^9.23.0", - "pdfjs-dist": "^5.1.91" + "pdfjs-dist": "^5.1.91", + "typescript": "^5.8.2", + "typescript-eslint": "^8.28.0" } } From 075fc0f5e85038b977a7d49ef6849553874fae60 Mon Sep 17 00:00:00 2001 From: octocorvus Date: Sun, 19 Jan 2025 10:58:31 +0000 Subject: [PATCH 3/7] add initial tsconfig --- tsconfig.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tsconfig.json diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..9d132572a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es2022", + "module": "es2022", + "moduleResolution": "node", + "rootDir": "./viewer/js", + "esModuleInterop": true, + "isolatedModules": true, + "noEmit": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + }, + "include": [ + "viewer/js/index.ts", + "viewer/js/worker.ts" + ] +} From 4bd21eb80ba55f43b30399f140df91ac95c4cde8 Mon Sep 17 00:00:00 2001 From: octocorvus Date: Sun, 19 Jan 2025 11:07:54 +0000 Subject: [PATCH 4/7] process-static: run tsc before bundling --- process_static.js | 1 + 1 file changed, 1 insertion(+) diff --git a/process_static.js b/process_static.js index a32e970d7..ca9e7fad6 100644 --- a/process_static.js +++ b/process_static.js @@ -17,6 +17,7 @@ async function processStatic() { const outDirDebug = "app/src/debug/assets/viewer"; await commandLine(getCommand("node_modules/.bin/eslint"), "."); + await commandLine(getCommand("node_modules/.bin/tsc")); await processScripts({ rootDir, From 92f05cca29b1563da1739854cf1e549e495ec7b8 Mon Sep 17 00:00:00 2001 From: octocorvus Date: Thu, 6 Mar 2025 11:47:08 +0000 Subject: [PATCH 5/7] refactor: worker.js -> worker.ts --- process_static.js | 4 ++-- viewer/js/{worker.js => worker.ts} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename viewer/js/{worker.js => worker.ts} (100%) diff --git a/process_static.js b/process_static.js index ca9e7fad6..4bc459960 100644 --- a/process_static.js +++ b/process_static.js @@ -21,13 +21,13 @@ async function processStatic() { await processScripts({ rootDir, - entryPoints: ["js/index.js", "js/worker.js"], + entryPoints: ["js/index.js", "js/worker.ts"], outDir, production: true, }); await processScripts({ rootDir, - entryPoints: ["js/index.js", "js/worker.js"], + entryPoints: ["js/index.js", "js/worker.ts"], outDir: outDirDebug, production: false, }); diff --git a/viewer/js/worker.js b/viewer/js/worker.ts similarity index 100% rename from viewer/js/worker.js rename to viewer/js/worker.ts From c6e144f977d6261cdf05b764b5f4806256043a2f Mon Sep 17 00:00:00 2001 From: octocorvus Date: Sun, 19 Jan 2025 12:48:19 +0000 Subject: [PATCH 6/7] eslint: use typescript-eslint --- eslint.config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 833c40795..276521a80 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,9 +1,11 @@ import js from "@eslint/js"; import globals from "globals"; import stylistic from "@stylistic/eslint-plugin"; +import tseslint from "typescript-eslint"; -export default [ +export default tseslint.config( js.configs.recommended, + tseslint.configs.recommended, { plugins: { "@stylistic": stylistic @@ -34,4 +36,4 @@ export default [ "releases/" ] } -]; +); From d954548967be3008f6245759db7020ea29d37a1c Mon Sep 17 00:00:00 2001 From: octocorvus Date: Sat, 29 Mar 2025 23:03:13 +0000 Subject: [PATCH 7/7] add stub index.ts --- gradle/verification-metadata.xml | 2805 ------------------------------ process_static.js | 4 +- viewer/js/index.ts | 1 + 3 files changed, 3 insertions(+), 2807 deletions(-) delete mode 100644 gradle/verification-metadata.xml create mode 100644 viewer/js/index.ts diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml deleted file mode 100644 index 4c88affaa..000000000 --- a/gradle/verification-metadata.xml +++ /dev/null @@ -1,2805 +0,0 @@ - - - - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/process_static.js b/process_static.js index 4bc459960..48f48c2f7 100644 --- a/process_static.js +++ b/process_static.js @@ -21,13 +21,13 @@ async function processStatic() { await processScripts({ rootDir, - entryPoints: ["js/index.js", "js/worker.ts"], + entryPoints: ["js/index.ts", "js/worker.ts"], outDir, production: true, }); await processScripts({ rootDir, - entryPoints: ["js/index.js", "js/worker.ts"], + entryPoints: ["js/index.ts", "js/worker.ts"], outDir: outDirDebug, production: false, }); diff --git a/viewer/js/index.ts b/viewer/js/index.ts new file mode 100644 index 000000000..b9027fc9d --- /dev/null +++ b/viewer/js/index.ts @@ -0,0 +1 @@ +import "./index.js";