Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
chore(deps): bump pdfjs-dist from 5.7.284 to 6.2.108 in /public/open-knowledge (#3348)
dependabot[bot]50b39965bd49
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.mdindex 55c65c484..42367a72c 100644--- a/THIRD_PARTY_NOTICES.md+++ b/THIRD_PARTY_NOTICES.md@@ -883,7 +883,7 @@ Homepage: https://github.com/dcodeIO/long.js_(LICENSE template present but no copyright line filled in; refer to the package source for canonical attribution.)_-### `[email protected]`+### `[email protected]`Homepage: https://mozilla.github.io/pdf.js/_(LICENSE template present but no copyright line filled in; refer to the package source for canonical attribution.)_@@ -1541,7 +1541,7 @@ Homepage: https://modelcontextprotocol.ioCopyright (c) 2024 Anthropic, PBC-### `@napi-rs/[email protected]`+### `@napi-rs/[email protected]`Homepage: https://github.com/Brooooooklyn/canvasCopyright (c) 2020 [email protected]diff --git a/packages/app/package.json b/packages/app/package.jsonindex 9cd09c2cc..d2ffa45c9 100644--- a/packages/app/package.json+++ b/packages/app/package.json@@ -147,7 +147,7 @@"lucide-react": "^1.7.0","mermaid": "^11.14.0","next-themes": "^0.4.6",- "pdfjs-dist": "^5.7.284",+ "pdfjs-dist": "^6.2.108","radix-ui": "^1.4.3","react": "^19.2.5","react-day-picker": "^9.14.0",diff --git a/packages/app/src/editor/components/Pdf.tsx b/packages/app/src/editor/components/Pdf.tsxindex a3c8f8d8b..51c554aa8 100644--- a/packages/app/src/editor/components/Pdf.tsx+++ b/packages/app/src/editor/components/Pdf.tsx@@ -134,6 +134,7 @@ interface PageInfo {}type PdfDoc = import('pdfjs-dist').PDFDocumentProxy;+type PdfLoadingTask = import('pdfjs-dist').PDFDocumentLoadingTask;/** Recognise pdfjs-dist's `RenderingCancelledException` so cleanup-driven* cancellations don't surface as unhandled rejections / console errors.@@ -198,29 +199,27 @@ export function Pdf(props: PdfProps) {// a server-absolute src onto `apiOrigin` (no-op in web/CLI builds).const docUrl = toDesktopAssetHref(props.src);let cancelled = false;- let activeDoc: PdfDoc | null = null;+ let loadingTask: PdfLoadingTask | null = null;setLoading(true);setError(null);(async () => {try {const pdfjs = await loadPdfjs();- // `isEvalSupported: false` — defense-in-depth for hosts deployed- // under a CSP without `unsafe-eval`. The default lets PDF.js use- // `new Function()` for optimized CMap processing; the `false` path- // is functionally equivalent at slightly higher CPU cost. Every- // other media canonical avoids eval-adjacent code paths; PDF- // should match. The `as` cast widens past pdfjs's overload- // ambiguity (`{url}` matches the URL-shorthand overload first).- const doc = await pdfjs.getDocument({- url: docUrl,- isEvalSupported: false,- } as Parameters<typeof pdfjs.getDocument>[0]).promise;+ // No `isEvalSupported: false` here: pdf.js removed the `new Function`+ // font/operator-compilation path — and the option that opted out of it+ // — in mozilla/pdf.js#18015, so there is no eval left to harden.+ const task = pdfjs.getDocument({ url: docUrl });+ // Hold the loading task, not just its promise. `destroy()` lives on the+ // task, and it aborts in-flight network requests as well as terminating+ // the worker, so it covers the window before `.promise` settles — which+ // a handle on the resolved document cannot reach.+ loadingTask = task;+ const doc = await task.promise;if (cancelled) {- await doc.destroy();+ await task.destroy();return;}- activeDoc = doc;docRef.current = doc;const meta: PageInfo[] = [];@@ -233,6 +232,9 @@ export function Pdf(props: PdfProps) {if (cancelled) return;setPages(meta);} catch (err) {+ // Tearing down mid-load rejects the promise being awaited above, so+ // this guard is what keeps an unmounting viewer from painting a load+ // error. It has to stay first in the block.if (cancelled) return;setError(err instanceof Error ? err.message : t`Failed to load PDF`);setLoading(false);@@ -241,13 +243,13 @@ export function Pdf(props: PdfProps) {return () => {cancelled = true;- // Release worker state + decoded page trees + font caches.- // `destroy()` returns a Promise, but we don't await it — React's- // cleanup function is sync, and the destroy is fire-and-forget.- if (activeDoc) {- void activeDoc.destroy();- activeDoc = null;- }+ // Releases worker state + decoded page trees + font caches, and aborts+ // the fetch when the load is still in flight. Not awaited — React's+ // cleanup is sync and the destroy is fire-and-forget — so a teardown+ // that rejects has nowhere to surface and nothing to recover; swallow+ // it rather than emit an unhandled rejection from an unmounting view.+ void loadingTask?.destroy().catch(() => {});+ loadingTask = null;docRef.current = null;};}, [props.src, t]);diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 0dd726c9f..9a3658453 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -555,8 +555,8 @@ importers:specifier: ^0.4.6pdfjs-dist:- specifier: ^5.7.284- version: 5.7.284+ specifier: ^6.2.108+ version: 6.2.108radix-ui:specifier: 1.4.3version: 1.4.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -3119,79 +3119,79 @@ packages:resolution: {integrity: sha512-mQ2s0pYYiav+tzCDR05Zptem8Ey2v8s11lri5RKGhTtL4COVCvVCk5vtyRYNT+9L8qSfyOqqefF9UtnW8mC5jA==}engines: {node: '>= 20.19.0'}- '@napi-rs/[email protected]':- resolution: {integrity: sha512-hjhCKhntPv9+t4ckHymdx0phYNcVW+GKQR6Lzw2zE+pOVjOplSmtx9nNNknTjbEDLcuLZqA1y8ufKg1XfgftzQ==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-7kSCdUhoXiO+AaIMXdBGdtp6EctZNkmF62Rea/BmVQlwKaM3bBhOzyGUzxyxz9dv5vdBfpyAaxhSRSJF4kqK4A==}engines: {node: '>= 10'}cpu: [arm64]os: [android]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-2PcswRaC7Ly645DGt88///zuFDhJxJYdKAs1uU3mfk1atYkXufgcgLfBpk6Tm12nCQBaNt1wpybuPZ4qOhTo8A==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-ds14V1BPagLszQyaDTeggny5fNeTCqsUQ5QhFj9VDxSEfzrVxXtdbR0LoFyKa0Siaaw8KvqSk4t7k/WoZJwvbg==}engines: {node: '>= 10'}cpu: [arm64]os: [darwin]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-ePNZtj7pNIva/siZMg+HmbeozkIjqUIYdoymH8HaA3qK7LfzFN4WMBM8G6HQ9ZC+H3+Dnn5pqtiXpgLykaPOhw==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-qof3LRAAycmkV2I1izZo9RoSHF8kCQr5O05sFwv0jK8rSdYV6KHVwimo6Qb7RxZj40WHKbLHm5JDaUF0o5XUAA==}engines: {node: '>= 10'}cpu: [x64]os: [darwin]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-d5cDB48oWFGU8/XPhUOFAlySgb/VAu7D+s8fi55K1Pcfg8aPplHWqMgibhVLU8ky7Pyg/fuiVLz4Nf3JrSTuUA==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-FU2kKZLmolHA9+KcUA+l1+xH3WTLUUTQDU/kLv9SEUr2TrRPu94aytOeizFJDHPs/QBcw4QL1mCQhetQXYBbag==}engines: {node: '>= 10'}cpu: [arm]os: [linux]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-rDxgxRu69RvDlX/bh9o22DxLsGr8EqsNgotL9+RwQE1S0b0cqeatqsw6aW45mukm0B42DIAaAacKaYQ8cqS1nw==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-GVSjntxKeA+/y/ZKf1F+cmUw1WeIkE5aMRPqnZUlBTBvBcrvgWccJAWuYCKPX4QJQwZILIIwhgdAbl51yj6fpA==}engines: {node: '>= 10'}cpu: [arm64]os: [linux]libc: [glibc]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-K3mDW66N+xT2/V439u1alFANiBUjdEx2gLiNYnCmUsva5jZMxWTjafBYwTzYK+EMFMHrUoabuU+T1BIP5CgbYQ==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-J51oK/axyZ13kxycumSMfLiDZMdWdOVvqDFI28BpuViZHE3A0bQfr8B5vg8YnPEnqLD3BSn1hkdlh2buspEcNQ==}engines: {node: '>= 10'}cpu: [arm64]os: [linux]libc: [musl]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-mooqUBTIsccZpnoQC4NgrC1v6C1vof39etLNMnBwCY+p0gajWJvAHLGQ6g/gGyS5YrpDW+GefSN4+Cvcr08UWw==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-CtQgQjoVTX67jS9XuCTtJ40Sl7wRLMguoFnnGnfDmCWf7kzKFZVwj5ynqUOIGKFMSB61ZCuQlwPvVNxYTTseaw==}engines: {node: '>= 10'}cpu: [riscv64]os: [linux]libc: [glibc]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-1eCvkDCazm7FFhsT7DfGOdSaHgZVK3bt/dSBl5EWHOWmnz+I7j8tPseJqqD81NF+MH21jKUK4wQSDjN0mdhnTg==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-jtfzAHFp+FRaR7zGT4jyCe6wUgAG/dVb5A4Apd8FY9jKarntDfUAlJXscugiH7ZF5kKnu7/lHFk9LaDPcrGEVQ==}engines: {node: '>= 10'}cpu: [x64]os: [linux]libc: [glibc]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-20arT6lnI19S68qNlii73TSEDbECNgzMz2EpldC1V3mZFuRkeujXkcebRk0LRJe9SEUAooYiLokfMViY8IX7yA==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-xTzaUCKUHTY4bCGadeeRZggbRVbGUT1petg7Z8r9AJR2+D9Bqu6nQAgqBGC6D47tA70LjaaaLTrJ7wNY1T74dg==}engines: {node: '>= 10'}cpu: [x64]os: [linux]libc: [musl]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-DZFFT1wIAg37LJw37yhMRFfjATd3vTQzjZ1Yki8u2vhO6Hi5VE6BVaGQ1aaDu7xb4iMErz+9EOwjpS7xcxFeBw==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-ktVLuBkI6QVOm5BwO/WbdGwxgeetAMJa7TTmR8qBarXF0OU2NKjvjUtPJAl2y8t+zBRczJl/1VOl9gua6WcK2g==}engines: {node: '>= 10'}cpu: [arm64]os: [win32]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-MyT1j3mHC2+Lu4pBi9mKyMJhtP6U7k7EldY7sj/uS5gJA65gTXt8MefJQXLJo5d/vZbuWmfxzkEUNc/urV3pHA==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-SGhlQ8bDjL1Cz2KnsKMasr/5sTcwG/SZkB6WCJxLsmSm/3aS2C+3p39bA7iZ2/94+NkVDySZfbiGoaSZSFHYxA==}engines: {node: '>= 10'}cpu: [x64]os: [win32]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-xglYA6q3XO5P3BNJYxVZ1IV7DLVjp1Py6nwag88YntrS+3vKHyYcMqXVS4ZztJmwz2uGvz1FWhI/4LgbR5uQDA==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-OlI657a5XXvKGFX7kNeIzJ8rO7IXt87Mqu2H8rXE46viAuOfum/JA7ysX7+eBhxNKznT+RCZh418mndlcFX3+w==}engines: {node: '>= 10'}'@napi-rs/[email protected]':@@ -9772,8 +9772,8 @@ packages:resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}- resolution: {integrity: sha512-h4EdYQczmGhbOlqc3PPZwxevn7ApdWPbovAuWXOB/DjIyigSnwfy2oze7c6mRcSr9XgLp3eN3EeL4DyySTPMFw==}+ resolution: {integrity: sha512-YxFb+SQcodN2rnX9Tn3dHYlqfb7NjlzzfONPpJd+AKoKtUjEdevTfbC07d5TcczzOK6261auRkP/M8OBHs9vFQ==}engines: {node: '>=22.13.0 || >=24'}@@ -13718,52 +13718,52 @@ snapshots:prebuild-install: 7.1.3optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':optionalDependencies:- '@napi-rs/canvas-android-arm64': 0.1.100- '@napi-rs/canvas-darwin-arm64': 0.1.100- '@napi-rs/canvas-darwin-x64': 0.1.100- '@napi-rs/canvas-linux-arm-gnueabihf': 0.1.100- '@napi-rs/canvas-linux-arm64-gnu': 0.1.100- '@napi-rs/canvas-linux-arm64-musl': 0.1.100- '@napi-rs/canvas-linux-riscv64-gnu': 0.1.100- '@napi-rs/canvas-linux-x64-gnu': 0.1.100- '@napi-rs/canvas-linux-x64-musl': 0.1.100- '@napi-rs/canvas-win32-arm64-msvc': 0.1.100- '@napi-rs/canvas-win32-x64-msvc': 0.1.100+ '@napi-rs/canvas-android-arm64': 1.0.3+ '@napi-rs/canvas-darwin-arm64': 1.0.3+ '@napi-rs/canvas-darwin-x64': 1.0.3+ '@napi-rs/canvas-linux-arm-gnueabihf': 1.0.3+ '@napi-rs/canvas-linux-arm64-gnu': 1.0.3+ '@napi-rs/canvas-linux-arm64-musl': 1.0.3+ '@napi-rs/canvas-linux-riscv64-gnu': 1.0.3+ '@napi-rs/canvas-linux-x64-gnu': 1.0.3+ '@napi-rs/canvas-linux-x64-musl': 1.0.3+ '@napi-rs/canvas-win32-arm64-msvc': 1.0.3+ '@napi-rs/canvas-win32-x64-msvc': 1.0.3optional: true'@napi-rs/[email protected](@emnapi/[email protected])(@emnapi/[email protected])(@types/[email protected])([email protected])':@@ -20772,9 +20772,9 @@ snapshots:optionalDependencies:- '@napi-rs/canvas': 0.1.100+ '@napi-rs/canvas': 1.0.3