@aaa_iii/fzv 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +118 -2
- package/THIRD_PARTY_NOTICES.md +98 -0
- package/dist/client/assets/bibtex-Ci_nEsc7.js +1 -0
- package/dist/client/assets/c-pw5cNQ6f.js +1 -0
- package/dist/client/assets/codicon-CMYWzYni.ttf +0 -0
- package/dist/client/assets/cpp-BzP2DU1a.js +1 -0
- package/dist/client/assets/csharp-dmMxLVLW.js +1 -0
- package/dist/client/assets/css-C8fQr_0Q.js +1 -0
- package/dist/client/assets/csv-Dx-8-gkx.js +1 -0
- package/dist/client/assets/cursor-editorTextHighlight-kG3uUOwL.svg +8 -0
- package/dist/client/assets/dockerfile-IyjqRm3v.js +1 -0
- package/dist/client/assets/go-rLFTqkRN.js +1 -0
- package/dist/client/assets/highlight-m6b6lqez.js +154 -0
- package/dist/client/assets/html-DA4kSGiR.js +1 -0
- package/dist/client/assets/index-CmRL0QNk.css +1 -0
- package/dist/client/assets/index-DZRy_kMM.js +69 -0
- package/dist/client/assets/ini-B5eOa1yu.js +1 -0
- package/dist/client/assets/java-D112xljv.js +1 -0
- package/dist/client/assets/javascript-BgS3c2Ky.js +1 -0
- package/dist/client/assets/json-qhed-kSA.js +1 -0
- package/dist/client/assets/jsx-Czjwr3X8.js +1 -0
- package/dist/client/assets/latex-DyPjLw3u.js +1 -0
- package/dist/client/assets/lua-C7IYe9JZ.js +1 -0
- package/dist/client/assets/make-Dixweg8N.js +1 -0
- package/dist/client/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/client/assets/pdf-APdaxgPI.js +598 -0
- package/dist/client/assets/pdf-C_UMrClT.css +1 -0
- package/dist/client/assets/python-gzcpVVnB.js +1 -0
- package/dist/client/assets/r-9GJvLLqN.js +1 -0
- package/dist/client/assets/ruby-BcWFKqsj.js +1 -0
- package/dist/client/assets/rust-DpiIf5JO.js +1 -0
- package/dist/client/assets/scss-CHVQqdPx.js +1 -0
- package/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
- package/dist/client/assets/sql-CEbI0hMM.js +1 -0
- package/dist/client/assets/toml-CcmNWLt0.js +1 -0
- package/dist/client/assets/tsx-COvetw7Z.js +1 -0
- package/dist/client/assets/typescript-D48Br3Og.js +1 -0
- package/dist/client/assets/xml-_pY6RLHw.js +1 -0
- package/dist/client/assets/yaml-rwi0_p6S.js +1 -0
- package/dist/client/index.html +218 -0
- package/dist/client/pdfjs/build/pdf.worker.mjs +64908 -0
- package/dist/client/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/78-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/78-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/dist/client/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/dist/client/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/dist/client/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/LICENSE +36 -0
- package/dist/client/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/Roman.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/V.bcmap +0 -0
- package/dist/client/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/dist/client/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
- package/dist/client/pdfjs/iccs/LICENSE +116 -0
- package/dist/client/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/client/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/client/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/client/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/client/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/client/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/client/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/client/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/client/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/client/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/client/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/client/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/client/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/client/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/client/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
- package/dist/client/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/client/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
- package/dist/client/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/navigation.js +366 -0
- package/dist/server/catalog.js +250 -0
- package/dist/server/cli.js +79 -0
- package/dist/server/interactive.js +32 -0
- package/dist/server/network.js +23 -0
- package/dist/server/server.js +338 -0
- package/dist/shared.js +3 -0
- package/licenses/codicons-CC-BY-4.0.txt +399 -0
- package/licenses/codicons-MIT.txt +21 -0
- package/licenses/dompurify-APACHE-2.0.txt +202 -0
- package/licenses/marked.txt +44 -0
- package/licenses/pdfjs/Apache-2.0.txt +177 -0
- package/licenses/pdfjs/LICENSE_FOXIT +27 -0
- package/licenses/pdfjs/LICENSE_JBIG2 +196 -0
- package/licenses/pdfjs/LICENSE_LIBERATION +363 -0
- package/licenses/pdfjs/LICENSE_OPENJPEG +39 -0
- package/licenses/pdfjs/LICENSE_PDFJS_JBIG2 +13 -0
- package/licenses/pdfjs/LICENSE_PDFJS_OPENJPEG +22 -0
- package/licenses/pdfjs/LICENSE_PDFJS_QCMS +19 -0
- package/licenses/pdfjs/LICENSE_QCMS +21 -0
- package/licenses/pdfjs/cmaps-LICENSE +36 -0
- package/licenses/pdfjs/iccs-LICENSE +116 -0
- package/licenses/shiki/@shikijs-core-LICENSE +22 -0
- package/licenses/shiki/@shikijs-engine-javascript-LICENSE +22 -0
- package/licenses/shiki/@shikijs-engine-oniguruma-LICENSE +22 -0
- package/licenses/shiki/@shikijs-langs-LICENSE +22 -0
- package/licenses/shiki/@shikijs-primitive-LICENSE +22 -0
- package/licenses/shiki/@shikijs-themes-LICENSE +22 -0
- package/licenses/shiki/@shikijs-types-LICENSE +22 -0
- package/licenses/shiki/@shikijs-vscode-textmate-LICENSE.md +21 -0
- package/licenses/shiki/@types-hast-LICENSE +21 -0
- package/licenses/shiki/@types-mdast-LICENSE +21 -0
- package/licenses/shiki/@types-unist-LICENSE +21 -0
- package/licenses/shiki/@ungap-structured-clone-LICENSE +15 -0
- package/licenses/shiki/ccount-license +22 -0
- package/licenses/shiki/character-entities-html4-license +22 -0
- package/licenses/shiki/character-entities-legacy-license +22 -0
- package/licenses/shiki/comma-separated-tokens-license +22 -0
- package/licenses/shiki/dequal-license +21 -0
- package/licenses/shiki/devlop-license +22 -0
- package/licenses/shiki/hast-util-to-html-license +22 -0
- package/licenses/shiki/hast-util-whitespace-license +22 -0
- package/licenses/shiki/html-void-elements-license +22 -0
- package/licenses/shiki/mdast-util-to-hast-license +22 -0
- package/licenses/shiki/micromark-util-character-license +22 -0
- package/licenses/shiki/micromark-util-encode-license +22 -0
- package/licenses/shiki/micromark-util-sanitize-uri-license +22 -0
- package/licenses/shiki/micromark-util-symbol-license +22 -0
- package/licenses/shiki/micromark-util-types-license +22 -0
- package/licenses/shiki/oniguruma-parser-LICENSE +21 -0
- package/licenses/shiki/oniguruma-to-es-LICENSE +21 -0
- package/licenses/shiki/property-information-license +22 -0
- package/licenses/shiki/regex-LICENSE +21 -0
- package/licenses/shiki/regex-recursion-LICENSE +21 -0
- package/licenses/shiki/regex-utilities-LICENSE +21 -0
- package/licenses/shiki/shiki-LICENSE +22 -0
- package/licenses/shiki/space-separated-tokens-license +22 -0
- package/licenses/shiki/stringify-entities-license +22 -0
- package/licenses/shiki/trim-lines-license +22 -0
- package/licenses/shiki/unist-util-is-license +22 -0
- package/licenses/shiki/unist-util-position-license +22 -0
- package/licenses/shiki/unist-util-stringify-position-license +22 -0
- package/licenses/shiki/unist-util-visit-license +22 -0
- package/licenses/shiki/unist-util-visit-parents-license +22 -0
- package/licenses/shiki/vfile-license +21 -0
- package/licenses/shiki/vfile-message-license +22 -0
- package/licenses/shiki/zwitch-license +22 -0
- package/licenses/vscode-MIT.txt +21 -0
- package/package.json +48 -4
|
Binary file
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// Keep this function self-contained: the server also serializes it into sandboxed
|
|
2
|
+
// HTML previews. No parent DOM/storage access or external script is required.
|
|
3
|
+
export function installNavigation(options = {}) {
|
|
4
|
+
const lifecycle = new AbortController();
|
|
5
|
+
const signal = lifecycle.signal;
|
|
6
|
+
const alphabet = 'asdfghjkl';
|
|
7
|
+
let pendingG = 0;
|
|
8
|
+
let overlay = null;
|
|
9
|
+
let hints = [];
|
|
10
|
+
let prefix = '';
|
|
11
|
+
let help = null;
|
|
12
|
+
const cancel = () => {
|
|
13
|
+
overlay?.remove();
|
|
14
|
+
overlay = null;
|
|
15
|
+
hints = [];
|
|
16
|
+
prefix = '';
|
|
17
|
+
pendingG = 0;
|
|
18
|
+
};
|
|
19
|
+
const closeHelp = () => {
|
|
20
|
+
if (!help)
|
|
21
|
+
return;
|
|
22
|
+
const dialog = help;
|
|
23
|
+
help = null;
|
|
24
|
+
if (dialog.open)
|
|
25
|
+
dialog.close();
|
|
26
|
+
dialog.remove();
|
|
27
|
+
};
|
|
28
|
+
const showHelp = () => {
|
|
29
|
+
if (help)
|
|
30
|
+
return;
|
|
31
|
+
cancel();
|
|
32
|
+
const dialog = document.createElement('dialog');
|
|
33
|
+
help = dialog;
|
|
34
|
+
dialog.setAttribute('aria-labelledby', 'fzv-keyboard-help-title');
|
|
35
|
+
Object.assign(dialog.style, {
|
|
36
|
+
position: 'fixed',
|
|
37
|
+
inset: '0',
|
|
38
|
+
margin: 'auto',
|
|
39
|
+
width: 'min(520px, calc(100vw - 28px))',
|
|
40
|
+
maxHeight: 'min(80vh, 640px)',
|
|
41
|
+
overflow: 'auto',
|
|
42
|
+
padding: '20px 22px',
|
|
43
|
+
border: '1px solid #8888',
|
|
44
|
+
borderRadius: '8px',
|
|
45
|
+
background: '#f8f8f8',
|
|
46
|
+
color: '#202020',
|
|
47
|
+
boxShadow: '0 12px 40px #0005',
|
|
48
|
+
font: '13px/1.5 system-ui, sans-serif',
|
|
49
|
+
zIndex: '2147483647',
|
|
50
|
+
});
|
|
51
|
+
const heading = document.createElement('div');
|
|
52
|
+
Object.assign(heading.style, {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
gap: '12px',
|
|
56
|
+
marginBottom: '14px',
|
|
57
|
+
});
|
|
58
|
+
const title = document.createElement('h2');
|
|
59
|
+
title.id = 'fzv-keyboard-help-title';
|
|
60
|
+
title.textContent = 'Keyboard shortcuts';
|
|
61
|
+
Object.assign(title.style, { flex: '1', margin: '0', fontSize: '16px' });
|
|
62
|
+
const close = document.createElement('button');
|
|
63
|
+
close.type = 'button';
|
|
64
|
+
close.textContent = 'Close';
|
|
65
|
+
close.setAttribute('aria-label', 'Close keyboard shortcuts');
|
|
66
|
+
Object.assign(close.style, {
|
|
67
|
+
padding: '5px 9px',
|
|
68
|
+
border: '1px solid #8888',
|
|
69
|
+
borderRadius: '4px',
|
|
70
|
+
background: '#fff',
|
|
71
|
+
color: 'inherit',
|
|
72
|
+
font: 'inherit',
|
|
73
|
+
cursor: 'pointer',
|
|
74
|
+
});
|
|
75
|
+
close.addEventListener('click', closeHelp, { signal });
|
|
76
|
+
heading.append(title, close);
|
|
77
|
+
const bindings = [
|
|
78
|
+
['/', 'Find a file'],
|
|
79
|
+
['r', 'Reload the active preview'],
|
|
80
|
+
[
|
|
81
|
+
'f',
|
|
82
|
+
options.bridgeWorkspace
|
|
83
|
+
? 'Show workspace hints'
|
|
84
|
+
: 'Show hints for links and controls',
|
|
85
|
+
],
|
|
86
|
+
['h j k l', 'Scroll the active preview'],
|
|
87
|
+
['gg', 'Scroll to the top'],
|
|
88
|
+
['G', 'Scroll to the bottom'],
|
|
89
|
+
['?', 'Show this keyboard help'],
|
|
90
|
+
['Escape', 'Cancel hints or close this help'],
|
|
91
|
+
];
|
|
92
|
+
if (!options.bridgeWorkspace) {
|
|
93
|
+
bindings.push(['Ctrl/Cmd + Tab', 'Switch tabs in the focused group'], ['Alt + j / k', 'Switch tabs in the focused group'], ['Ctrl/Cmd + 1–9', 'Focus an editor group'], ['Ctrl/Cmd + \\', 'Split the editor to the right'], ['Ctrl/Cmd + Shift + \\', 'Split the editor below'], ['Ctrl/Cmd + f', 'Find in a PDF'], ['Ctrl/Cmd + + / − / 0', 'Zoom an image or PDF']);
|
|
94
|
+
}
|
|
95
|
+
const list = document.createElement('div');
|
|
96
|
+
Object.assign(list.style, {
|
|
97
|
+
display: 'grid',
|
|
98
|
+
gridTemplateColumns: 'minmax(125px, auto) minmax(0, 1fr)',
|
|
99
|
+
gap: '7px 14px',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
});
|
|
102
|
+
for (const [keys, description] of bindings) {
|
|
103
|
+
const label = document.createElement('kbd');
|
|
104
|
+
label.textContent = keys;
|
|
105
|
+
Object.assign(label.style, {
|
|
106
|
+
justifySelf: 'start',
|
|
107
|
+
padding: '2px 5px',
|
|
108
|
+
border: '1px solid #aaa',
|
|
109
|
+
borderRadius: '3px',
|
|
110
|
+
background: '#eee',
|
|
111
|
+
color: 'inherit',
|
|
112
|
+
font: '11px ui-monospace, monospace',
|
|
113
|
+
whiteSpace: 'nowrap',
|
|
114
|
+
});
|
|
115
|
+
const text = document.createElement('span');
|
|
116
|
+
text.textContent = description;
|
|
117
|
+
list.append(label, text);
|
|
118
|
+
}
|
|
119
|
+
dialog.append(heading, list);
|
|
120
|
+
dialog.addEventListener('cancel', (event) => {
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
closeHelp();
|
|
123
|
+
}, { signal });
|
|
124
|
+
document.body.append(dialog);
|
|
125
|
+
dialog.showModal();
|
|
126
|
+
close.focus();
|
|
127
|
+
};
|
|
128
|
+
const editable = (element) => element instanceof HTMLElement &&
|
|
129
|
+
(element.isContentEditable ||
|
|
130
|
+
Boolean(element.closest('input, textarea, select, [role="textbox"]')));
|
|
131
|
+
const showHints = () => {
|
|
132
|
+
cancel();
|
|
133
|
+
const root = document.querySelector('dialog[open]') ?? document.body;
|
|
134
|
+
const targets = [
|
|
135
|
+
...root.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled), summary, [role="button"], [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"]), iframe'),
|
|
136
|
+
].filter((target) => {
|
|
137
|
+
if (target.matches(':disabled') ||
|
|
138
|
+
target.closest('[hidden], [inert], [aria-disabled="true"]'))
|
|
139
|
+
return false;
|
|
140
|
+
const style = getComputedStyle(target);
|
|
141
|
+
if (style.visibility !== 'visible' ||
|
|
142
|
+
style.display === 'none' ||
|
|
143
|
+
style.opacity === '0')
|
|
144
|
+
return false;
|
|
145
|
+
const rect = target.getBoundingClientRect();
|
|
146
|
+
const left = Math.max(0, rect.left), right = Math.min(innerWidth, rect.right);
|
|
147
|
+
const top = Math.max(0, rect.top), bottom = Math.min(innerHeight, rect.bottom);
|
|
148
|
+
if (left >= right || top >= bottom)
|
|
149
|
+
return false;
|
|
150
|
+
const atPoint = document.elementFromPoint((left + right) / 2, (top + bottom) / 2);
|
|
151
|
+
return atPoint === target || Boolean(atPoint && target.contains(atPoint));
|
|
152
|
+
});
|
|
153
|
+
if (!targets.length)
|
|
154
|
+
return;
|
|
155
|
+
overlay = document.createElement('div');
|
|
156
|
+
overlay.className = 'vim-hints';
|
|
157
|
+
overlay.setAttribute('aria-label', 'Link hints; type a label to jump, Escape to cancel');
|
|
158
|
+
overlay.style.pointerEvents = 'none';
|
|
159
|
+
const length = Math.max(1, Math.ceil(Math.log(targets.length) / Math.log(alphabet.length)));
|
|
160
|
+
hints = targets.map((target, index) => {
|
|
161
|
+
let value = index;
|
|
162
|
+
let label = '';
|
|
163
|
+
for (let digit = 0; digit < length; digit++) {
|
|
164
|
+
label = alphabet[value % alphabet.length] + label;
|
|
165
|
+
value = Math.floor(value / alphabet.length);
|
|
166
|
+
}
|
|
167
|
+
const rect = target.getBoundingClientRect();
|
|
168
|
+
const badge = document.createElement('span');
|
|
169
|
+
badge.className = 'vim-hint';
|
|
170
|
+
badge.dataset.hintTarget =
|
|
171
|
+
target.id ||
|
|
172
|
+
target.getAttribute('aria-label') ||
|
|
173
|
+
target.textContent?.trim() ||
|
|
174
|
+
target.tagName;
|
|
175
|
+
badge.textContent = label.toUpperCase();
|
|
176
|
+
badge.setAttribute('aria-hidden', 'true');
|
|
177
|
+
// Individual style properties also work under the application's strict CSP.
|
|
178
|
+
Object.assign(badge.style, {
|
|
179
|
+
position: 'fixed',
|
|
180
|
+
zIndex: '2147483647',
|
|
181
|
+
pointerEvents: 'none',
|
|
182
|
+
left: `${Math.max(0, Math.min(innerWidth - 32, rect.left))}px`,
|
|
183
|
+
top: `${Math.max(0, Math.min(innerHeight - 20, rect.top))}px`,
|
|
184
|
+
font: 'bold 12px/18px monospace',
|
|
185
|
+
padding: '0 3px',
|
|
186
|
+
color: '#1f1f1f',
|
|
187
|
+
backgroundColor: '#ffdf80',
|
|
188
|
+
border: '1px solid #b78618',
|
|
189
|
+
borderRadius: '2px',
|
|
190
|
+
boxShadow: '0 1px 2px #0003',
|
|
191
|
+
});
|
|
192
|
+
overlay.append(badge);
|
|
193
|
+
return { target, label, badge };
|
|
194
|
+
});
|
|
195
|
+
root.append(overlay);
|
|
196
|
+
};
|
|
197
|
+
const scrollRoot = () => {
|
|
198
|
+
const supplied = options.getScrollRoot?.();
|
|
199
|
+
if (supplied)
|
|
200
|
+
return supplied;
|
|
201
|
+
let element = document.activeElement;
|
|
202
|
+
while (element instanceof HTMLElement && element !== document.body) {
|
|
203
|
+
const style = getComputedStyle(element);
|
|
204
|
+
if (/(auto|scroll)/.test(style.overflowY + style.overflowX) &&
|
|
205
|
+
(element.scrollHeight > element.clientHeight ||
|
|
206
|
+
element.scrollWidth > element.clientWidth))
|
|
207
|
+
return element;
|
|
208
|
+
element = element.parentElement;
|
|
209
|
+
}
|
|
210
|
+
return document.scrollingElement;
|
|
211
|
+
};
|
|
212
|
+
const scroll = (key) => {
|
|
213
|
+
const root = scrollRoot();
|
|
214
|
+
if (!root)
|
|
215
|
+
return;
|
|
216
|
+
if (key === 'top')
|
|
217
|
+
root.scrollTo({ top: 0, behavior: 'instant' });
|
|
218
|
+
else if (key === 'bottom')
|
|
219
|
+
root.scrollTo({ top: root.scrollHeight, behavior: 'instant' });
|
|
220
|
+
else
|
|
221
|
+
root.scrollBy({
|
|
222
|
+
left: key === 'h' ? -64 : key === 'l' ? 64 : 0,
|
|
223
|
+
top: key === 'j' ? 64 : key === 'k' ? -64 : 0,
|
|
224
|
+
behavior: 'instant',
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
window.addEventListener('keydown', (event) => {
|
|
228
|
+
if (event.defaultPrevented ||
|
|
229
|
+
event.isComposing ||
|
|
230
|
+
editable(event.composedPath()[0] ?? event.target)) {
|
|
231
|
+
pendingG = 0;
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
235
|
+
pendingG = 0;
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const consume = () => {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
event.stopImmediatePropagation();
|
|
241
|
+
};
|
|
242
|
+
if (help) {
|
|
243
|
+
if (event.key === 'Escape') {
|
|
244
|
+
closeHelp();
|
|
245
|
+
consume();
|
|
246
|
+
}
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (event.key === 'Escape') {
|
|
250
|
+
if (overlay || pendingG) {
|
|
251
|
+
cancel();
|
|
252
|
+
consume();
|
|
253
|
+
}
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (overlay) {
|
|
257
|
+
consume();
|
|
258
|
+
if (event.key === 'Backspace')
|
|
259
|
+
prefix = prefix.slice(0, -1);
|
|
260
|
+
else if (event.key.length === 1)
|
|
261
|
+
prefix += event.key.toLowerCase();
|
|
262
|
+
else
|
|
263
|
+
return;
|
|
264
|
+
const matches = hints.filter((hint) => hint.label.startsWith(prefix));
|
|
265
|
+
for (const hint of hints)
|
|
266
|
+
hint.badge.hidden = !hint.label.startsWith(prefix);
|
|
267
|
+
if (!matches.length) {
|
|
268
|
+
cancel();
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const match = matches.find((hint) => hint.label === prefix);
|
|
272
|
+
if (match) {
|
|
273
|
+
const target = match.target;
|
|
274
|
+
cancel();
|
|
275
|
+
if (target.isConnected) {
|
|
276
|
+
target.focus();
|
|
277
|
+
if (!options.onHintActivate?.(target))
|
|
278
|
+
target.click();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const wasG = pendingG;
|
|
284
|
+
pendingG = 0;
|
|
285
|
+
if (event.key === '/' && options.onSearch) {
|
|
286
|
+
consume();
|
|
287
|
+
options.onSearch();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (event.key === '?') {
|
|
291
|
+
consume();
|
|
292
|
+
showHelp();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (event.key === 'r' && options.onReload) {
|
|
296
|
+
consume();
|
|
297
|
+
options.onReload();
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (event.key === 'f' && !event.repeat) {
|
|
301
|
+
consume();
|
|
302
|
+
if (options.bridgeWorkspace)
|
|
303
|
+
parent.postMessage({ type: 'fzv:shortcut', key: 'f' }, '*');
|
|
304
|
+
else
|
|
305
|
+
showHints();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (event.key === 'g') {
|
|
309
|
+
consume();
|
|
310
|
+
if (event.repeat)
|
|
311
|
+
return;
|
|
312
|
+
const now = performance.now();
|
|
313
|
+
if (wasG && now - wasG < 800) {
|
|
314
|
+
if (!options.onScroll?.('top'))
|
|
315
|
+
scroll('top');
|
|
316
|
+
}
|
|
317
|
+
else
|
|
318
|
+
pendingG = now;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (!['h', 'j', 'k', 'l', 'G'].includes(event.key))
|
|
322
|
+
return;
|
|
323
|
+
consume();
|
|
324
|
+
const key = event.key === 'G' ? 'bottom' : event.key;
|
|
325
|
+
if (!options.onScroll?.(key))
|
|
326
|
+
scroll(key);
|
|
327
|
+
}, { capture: true, signal });
|
|
328
|
+
window.addEventListener('blur', cancel, { signal });
|
|
329
|
+
window.addEventListener('message', (event) => {
|
|
330
|
+
if (!options.bridgeWorkspace ||
|
|
331
|
+
parent === window ||
|
|
332
|
+
event.source !== parent)
|
|
333
|
+
return;
|
|
334
|
+
if (event.data?.type === 'fzv:show-hints')
|
|
335
|
+
showHints();
|
|
336
|
+
if (event.data?.type === 'fzv:scroll' &&
|
|
337
|
+
['h', 'j', 'k', 'l', 'top', 'bottom'].includes(event.data.key))
|
|
338
|
+
scroll(event.data.key);
|
|
339
|
+
}, { signal });
|
|
340
|
+
window.addEventListener('resize', cancel, { signal });
|
|
341
|
+
document.addEventListener('pointerdown', cancel, { capture: true, signal });
|
|
342
|
+
document.addEventListener('pointerdown', () => options.onFocus?.(), {
|
|
343
|
+
capture: true,
|
|
344
|
+
signal,
|
|
345
|
+
});
|
|
346
|
+
document.addEventListener('focusin', () => options.onFocus?.(), { signal });
|
|
347
|
+
document.addEventListener('scroll', () => {
|
|
348
|
+
if (overlay)
|
|
349
|
+
cancel();
|
|
350
|
+
}, { capture: true, signal });
|
|
351
|
+
document.addEventListener('focusin', (event) => {
|
|
352
|
+
pendingG = 0;
|
|
353
|
+
if (editable(event.target))
|
|
354
|
+
cancel();
|
|
355
|
+
}, { signal });
|
|
356
|
+
return {
|
|
357
|
+
cancel,
|
|
358
|
+
showHints,
|
|
359
|
+
showHelp,
|
|
360
|
+
dispose: () => {
|
|
361
|
+
cancel();
|
|
362
|
+
closeHelp();
|
|
363
|
+
lifecycle.abort();
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { open, readdir, realpath, stat } from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { MAX_FILE_SIZE } from '../shared.js';
|
|
6
|
+
const TEXT = new Set([
|
|
7
|
+
'.bib',
|
|
8
|
+
'.bst',
|
|
9
|
+
'.c',
|
|
10
|
+
'.cc',
|
|
11
|
+
'.cfg',
|
|
12
|
+
'.cpp',
|
|
13
|
+
'.cs',
|
|
14
|
+
'.css',
|
|
15
|
+
'.csv',
|
|
16
|
+
'.go',
|
|
17
|
+
'.h',
|
|
18
|
+
'.hpp',
|
|
19
|
+
'.ini',
|
|
20
|
+
'.java',
|
|
21
|
+
'.js',
|
|
22
|
+
'.json',
|
|
23
|
+
'.jsx',
|
|
24
|
+
'.log',
|
|
25
|
+
'.lua',
|
|
26
|
+
'.md',
|
|
27
|
+
'.mjs',
|
|
28
|
+
'.cjs',
|
|
29
|
+
'.py',
|
|
30
|
+
'.r',
|
|
31
|
+
'.rb',
|
|
32
|
+
'.rs',
|
|
33
|
+
'.scss',
|
|
34
|
+
'.sh',
|
|
35
|
+
'.sql',
|
|
36
|
+
'.sty',
|
|
37
|
+
'.tex',
|
|
38
|
+
'.toml',
|
|
39
|
+
'.ts',
|
|
40
|
+
'.tsx',
|
|
41
|
+
'.txt',
|
|
42
|
+
'.xml',
|
|
43
|
+
'.yaml',
|
|
44
|
+
'.yml',
|
|
45
|
+
]);
|
|
46
|
+
const IMAGE = new Set([
|
|
47
|
+
'.gif',
|
|
48
|
+
'.jpeg',
|
|
49
|
+
'.jpg',
|
|
50
|
+
'.png',
|
|
51
|
+
'.svg',
|
|
52
|
+
'.webp',
|
|
53
|
+
'.avif',
|
|
54
|
+
'.bmp',
|
|
55
|
+
'.ico',
|
|
56
|
+
]);
|
|
57
|
+
const ASSET = new Set(['.eot', '.otf', '.ttf', '.woff', '.woff2']);
|
|
58
|
+
const EXCLUDED = new Set(['node_modules', '__pycache__']);
|
|
59
|
+
const MIME = {
|
|
60
|
+
'.pdf': 'application/pdf',
|
|
61
|
+
'.html': 'text/html; charset=utf-8',
|
|
62
|
+
'.htm': 'text/html; charset=utf-8',
|
|
63
|
+
'.png': 'image/png',
|
|
64
|
+
'.jpg': 'image/jpeg',
|
|
65
|
+
'.jpeg': 'image/jpeg',
|
|
66
|
+
'.gif': 'image/gif',
|
|
67
|
+
'.webp': 'image/webp',
|
|
68
|
+
'.svg': 'image/svg+xml',
|
|
69
|
+
'.avif': 'image/avif',
|
|
70
|
+
'.bmp': 'image/bmp',
|
|
71
|
+
'.ico': 'image/x-icon',
|
|
72
|
+
'.css': 'text/css; charset=utf-8',
|
|
73
|
+
'.js': 'text/javascript; charset=utf-8',
|
|
74
|
+
'.mjs': 'text/javascript; charset=utf-8',
|
|
75
|
+
'.wasm': 'application/wasm',
|
|
76
|
+
'.bcmap': 'application/octet-stream',
|
|
77
|
+
'.pfb': 'application/octet-stream',
|
|
78
|
+
'.icc': 'application/octet-stream',
|
|
79
|
+
'.json': 'application/json; charset=utf-8',
|
|
80
|
+
'.woff': 'font/woff',
|
|
81
|
+
'.woff2': 'font/woff2',
|
|
82
|
+
'.ttf': 'font/ttf',
|
|
83
|
+
'.otf': 'font/otf',
|
|
84
|
+
'.eot': 'application/vnd.ms-fontobject',
|
|
85
|
+
};
|
|
86
|
+
export function previewKind(filename) {
|
|
87
|
+
const ext = path.extname(filename).toLowerCase();
|
|
88
|
+
if (ext === '.pdf')
|
|
89
|
+
return 'pdf';
|
|
90
|
+
if (ext === '.html' || ext === '.htm')
|
|
91
|
+
return 'html';
|
|
92
|
+
if (IMAGE.has(ext))
|
|
93
|
+
return 'image';
|
|
94
|
+
if (TEXT.has(ext) ||
|
|
95
|
+
['Makefile', 'Dockerfile', 'LICENSE', 'LICENCE', 'NOTICE'].includes(path.basename(filename)))
|
|
96
|
+
return 'text';
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
export function contentType(filename, asset = false) {
|
|
100
|
+
if (!asset && previewKind(filename) === 'text')
|
|
101
|
+
return 'text/plain; charset=utf-8';
|
|
102
|
+
return (MIME[path.extname(filename).toLowerCase()] ?? 'text/plain; charset=utf-8');
|
|
103
|
+
}
|
|
104
|
+
export function isVisibleRelative(relative) {
|
|
105
|
+
if (!relative ||
|
|
106
|
+
relative.includes('\0') ||
|
|
107
|
+
relative.includes('\\') ||
|
|
108
|
+
path.isAbsolute(relative) ||
|
|
109
|
+
path.win32.isAbsolute(relative))
|
|
110
|
+
return false;
|
|
111
|
+
return relative
|
|
112
|
+
.split('/')
|
|
113
|
+
.every((part) => part.length > 0 && !part.startsWith('.') && !EXCLUDED.has(part));
|
|
114
|
+
}
|
|
115
|
+
export class FileUnavailable extends Error {
|
|
116
|
+
}
|
|
117
|
+
export class Catalog {
|
|
118
|
+
root;
|
|
119
|
+
project;
|
|
120
|
+
constructor(root, project) {
|
|
121
|
+
this.root = root;
|
|
122
|
+
this.project = project;
|
|
123
|
+
}
|
|
124
|
+
static async create(root) {
|
|
125
|
+
const resolved = await realpath(path.resolve(root));
|
|
126
|
+
if (!(await stat(resolved)).isDirectory())
|
|
127
|
+
throw new Error('The project root must be a directory.');
|
|
128
|
+
return new Catalog(resolved, {
|
|
129
|
+
id: createHash('sha256').update(resolved).digest('hex').slice(0, 24),
|
|
130
|
+
name: path.basename(resolved) || resolved,
|
|
131
|
+
maxFileSize: MAX_FILE_SIZE,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
contained(filename) {
|
|
135
|
+
const relative = path
|
|
136
|
+
.relative(this.root, filename)
|
|
137
|
+
.split(path.sep)
|
|
138
|
+
.join('/');
|
|
139
|
+
return isVisibleRelative(relative);
|
|
140
|
+
}
|
|
141
|
+
async openFile(relative, asset = false) {
|
|
142
|
+
if (!isVisibleRelative(relative))
|
|
143
|
+
throw new FileUnavailable();
|
|
144
|
+
let handle;
|
|
145
|
+
try {
|
|
146
|
+
const filename = await realpath(path.join(this.root, relative));
|
|
147
|
+
if (!this.contained(filename))
|
|
148
|
+
throw new FileUnavailable();
|
|
149
|
+
const kind = previewKind(filename);
|
|
150
|
+
// Alias and target must agree on kind, so a .txt alias cannot expose active HTML/SVG.
|
|
151
|
+
if ((!kind &&
|
|
152
|
+
!(asset && ASSET.has(path.extname(filename).toLowerCase()))) ||
|
|
153
|
+
kind !== previewKind(relative))
|
|
154
|
+
throw new FileUnavailable();
|
|
155
|
+
handle = await open(filename, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
156
|
+
const info = await handle.stat();
|
|
157
|
+
if (!info.isFile() || info.size > MAX_FILE_SIZE)
|
|
158
|
+
throw new FileUnavailable();
|
|
159
|
+
const checkedPath = await realpath(filename);
|
|
160
|
+
if (!this.contained(checkedPath))
|
|
161
|
+
throw new FileUnavailable();
|
|
162
|
+
const checked = await stat(checkedPath);
|
|
163
|
+
if (checked.dev !== info.dev || checked.ino !== info.ino)
|
|
164
|
+
throw new FileUnavailable();
|
|
165
|
+
return { handle, size: info.size, filename, kind };
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
await handle?.close();
|
|
169
|
+
throw new FileUnavailable();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async list() {
|
|
173
|
+
const files = [];
|
|
174
|
+
const directories = [];
|
|
175
|
+
const pending = [''];
|
|
176
|
+
while (pending.length) {
|
|
177
|
+
const directory = pending.pop();
|
|
178
|
+
let entries;
|
|
179
|
+
try {
|
|
180
|
+
const filename = await realpath(path.join(this.root, directory));
|
|
181
|
+
if (directory && !this.contained(filename))
|
|
182
|
+
continue;
|
|
183
|
+
entries = await readdir(filename, {
|
|
184
|
+
withFileTypes: true,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (directory)
|
|
191
|
+
directories.push({
|
|
192
|
+
path: directory,
|
|
193
|
+
name: path.posix.basename(directory),
|
|
194
|
+
kind: 'directory',
|
|
195
|
+
});
|
|
196
|
+
for (const entry of entries) {
|
|
197
|
+
const relative = directory ? `${directory}/${entry.name}` : entry.name;
|
|
198
|
+
if (!isVisibleRelative(relative))
|
|
199
|
+
continue;
|
|
200
|
+
if (entry.isDirectory()) {
|
|
201
|
+
pending.push(relative);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if ((!entry.isFile() && !entry.isSymbolicLink()) ||
|
|
205
|
+
!previewKind(relative))
|
|
206
|
+
continue;
|
|
207
|
+
try {
|
|
208
|
+
const file = await this.openFile(relative);
|
|
209
|
+
files.push({
|
|
210
|
+
path: relative,
|
|
211
|
+
name: entry.name,
|
|
212
|
+
kind: file.kind,
|
|
213
|
+
size: file.size,
|
|
214
|
+
});
|
|
215
|
+
await file.handle.close();
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
/* Files can disappear or become unreadable during a scan. */
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
files: files.sort((a, b) => a.path.localeCompare(b.path)),
|
|
224
|
+
directories: directories.sort((a, b) => a.path.localeCompare(b.path)),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
async filesForPaths(paths) {
|
|
228
|
+
const unique = [...new Set(paths)];
|
|
229
|
+
const files = await Promise.all(unique.map(async (relative) => {
|
|
230
|
+
try {
|
|
231
|
+
const file = await this.openFile(relative);
|
|
232
|
+
try {
|
|
233
|
+
return {
|
|
234
|
+
path: relative,
|
|
235
|
+
name: path.posix.basename(relative),
|
|
236
|
+
kind: file.kind,
|
|
237
|
+
size: file.size,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
await file.handle.close();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
}));
|
|
248
|
+
return files.filter((file) => file !== null);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { createViewer } from './server.js';
|
|
4
|
+
import { PRODUCT_NAME, VERSION } from '../shared.js';
|
|
5
|
+
import { viewerUrls } from './network.js';
|
|
6
|
+
const HELP = `${PRODUCT_NAME} — the file viewer for agent-driven development
|
|
7
|
+
|
|
8
|
+
Usage: ${PRODUCT_NAME} [--root PATH] [--host HOST] [--port PORT] [--watch] [--allow-html-network]
|
|
9
|
+
|
|
10
|
+
--root PATH Project directory (default: current working directory)
|
|
11
|
+
--host HOST Bind address (default: 127.0.0.1)
|
|
12
|
+
--port PORT HTTP port, 0 for a free port (default: 8000)
|
|
13
|
+
--watch Refresh files and previews when project files change
|
|
14
|
+
--allow-html-network Allow HTML previews to run remote scripts and make network requests
|
|
15
|
+
-h, --help Show this help
|
|
16
|
+
-v, --version Show version
|
|
17
|
+
|
|
18
|
+
Find and preview PDF, HTML, images, and text. Files are read-only.
|
|
19
|
+
Use --host 0.0.0.0 explicitly to allow devices on your network.
|
|
20
|
+
`;
|
|
21
|
+
async function main() {
|
|
22
|
+
if (Number(process.versions.node.split('.')[0]) < 24)
|
|
23
|
+
throw new Error('Node.js 24 or newer is required.');
|
|
24
|
+
const { values } = parseArgs({
|
|
25
|
+
options: {
|
|
26
|
+
root: { type: 'string' },
|
|
27
|
+
host: { type: 'string', default: '127.0.0.1' },
|
|
28
|
+
port: { type: 'string', default: '8000' },
|
|
29
|
+
watch: { type: 'boolean', default: false },
|
|
30
|
+
'allow-html-network': { type: 'boolean', default: false },
|
|
31
|
+
help: { type: 'boolean', short: 'h' },
|
|
32
|
+
version: { type: 'boolean', short: 'v' },
|
|
33
|
+
},
|
|
34
|
+
strict: true,
|
|
35
|
+
allowPositionals: false,
|
|
36
|
+
});
|
|
37
|
+
if (values.help) {
|
|
38
|
+
console.log(HELP);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (values.version) {
|
|
42
|
+
console.log(VERSION);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!/^\d+$/.test(values.port) || Number(values.port) > 65535)
|
|
46
|
+
throw new Error('--port must be an integer between 0 and 65535.');
|
|
47
|
+
const { server, catalog } = await createViewer({
|
|
48
|
+
root: values.root ?? process.cwd(),
|
|
49
|
+
host: values.host,
|
|
50
|
+
watch: values.watch,
|
|
51
|
+
allowHtmlNetwork: values['allow-html-network'],
|
|
52
|
+
});
|
|
53
|
+
server.on('watchError', (error) => {
|
|
54
|
+
console.error(`${PRODUCT_NAME}: file watching stopped: ${error.message}`);
|
|
55
|
+
});
|
|
56
|
+
if (values['allow-html-network'])
|
|
57
|
+
console.warn(`${PRODUCT_NAME}: HTML previews can run network-loaded code. Use only with trusted projects.`);
|
|
58
|
+
server.on('error', (error) => {
|
|
59
|
+
console.error(`${PRODUCT_NAME}: ${error.code === 'EADDRINUSE' ? `Port ${values.port} is in use. Choose another with --port.` : error.message}`);
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
});
|
|
62
|
+
server.listen(Number(values.port), values.host, () => {
|
|
63
|
+
const address = server.address();
|
|
64
|
+
if (!address || typeof address === 'string')
|
|
65
|
+
return;
|
|
66
|
+
const urls = viewerUrls(values.host, address.port);
|
|
67
|
+
console.log(`\n ${PRODUCT_NAME} ${VERSION}\n Project ${catalog.root}\n${urls.map((url) => ` Viewer ${url}`).join('\n')}\n\n Press Ctrl+C to stop.\n`);
|
|
68
|
+
});
|
|
69
|
+
const stop = () => {
|
|
70
|
+
server.close();
|
|
71
|
+
server.closeAllConnections();
|
|
72
|
+
};
|
|
73
|
+
process.once('SIGINT', stop);
|
|
74
|
+
process.once('SIGTERM', stop);
|
|
75
|
+
}
|
|
76
|
+
main().catch((error) => {
|
|
77
|
+
console.error(`${PRODUCT_NAME}: ${error instanceof Error ? error.message : String(error)}`);
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
});
|