@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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline/promises';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
function resolveRoot(value, cwd) {
|
|
5
|
+
const entered = value.trim();
|
|
6
|
+
if (!entered)
|
|
7
|
+
return cwd;
|
|
8
|
+
if (entered === '~')
|
|
9
|
+
return homedir();
|
|
10
|
+
if (entered.startsWith(`~${path.sep}`))
|
|
11
|
+
return path.resolve(homedir(), entered.slice(2));
|
|
12
|
+
return path.resolve(cwd, entered);
|
|
13
|
+
}
|
|
14
|
+
export async function promptForOptions(cwd, input = process.stdin, output = process.stdout) {
|
|
15
|
+
const prompt = createInterface({ input, output });
|
|
16
|
+
try {
|
|
17
|
+
output.write('fzv setup\n');
|
|
18
|
+
const root = resolveRoot(await prompt.question(`Project root [${cwd}]: `), cwd);
|
|
19
|
+
let visibility;
|
|
20
|
+
do {
|
|
21
|
+
visibility = (await prompt.question('Access from other devices? [1] This computer only (127.0.0.1) [2] Network (0.0.0.0) [1]: '))
|
|
22
|
+
.trim()
|
|
23
|
+
.toLowerCase();
|
|
24
|
+
if (visibility && visibility !== '1' && visibility !== '2')
|
|
25
|
+
output.write('Enter 1 or 2.\n');
|
|
26
|
+
} while (visibility && visibility !== '1' && visibility !== '2');
|
|
27
|
+
return { root, host: visibility === '2' ? '0.0.0.0' : '127.0.0.1' };
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
prompt.close();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { networkInterfaces } from 'node:os';
|
|
2
|
+
export function viewerUrls(host, port, interfaces = networkInterfaces()) {
|
|
3
|
+
const addresses = new Set();
|
|
4
|
+
if (host === '0.0.0.0' || host === '::') {
|
|
5
|
+
addresses.add('127.0.0.1');
|
|
6
|
+
if (host === '::')
|
|
7
|
+
addresses.add('::1');
|
|
8
|
+
for (const entries of Object.values(interfaces)) {
|
|
9
|
+
for (const entry of entries ?? []) {
|
|
10
|
+
if (entry.family === 'IPv4' && entry.address !== '0.0.0.0')
|
|
11
|
+
addresses.add(entry.address);
|
|
12
|
+
else if (host === '::' &&
|
|
13
|
+
entry.family === 'IPv6' &&
|
|
14
|
+
entry.scopeid === 0 &&
|
|
15
|
+
entry.address !== '::')
|
|
16
|
+
addresses.add(entry.address);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else
|
|
21
|
+
addresses.add(host);
|
|
22
|
+
return [...addresses].map((address) => `http://${address.includes(':') ? `[${address}]` : address}:${port}/`);
|
|
23
|
+
}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
import { networkInterfaces } from 'node:os';
|
|
3
|
+
import { watch as watchFiles } from 'node:fs';
|
|
4
|
+
import { readFile, realpath, stat } from 'node:fs/promises';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { pipeline } from 'node:stream/promises';
|
|
8
|
+
import { Catalog, contentType, FileUnavailable, isVisibleRelative, } from './catalog.js';
|
|
9
|
+
import { installNavigation } from '../navigation.js';
|
|
10
|
+
const UI_ROOT = fileURLToPath(new URL('../client/', import.meta.url));
|
|
11
|
+
const UI_CSP = "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; style-src 'self'; img-src 'self' data: blob:; font-src 'self'; frame-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'none'";
|
|
12
|
+
export const PREVIEW_CSP = "sandbox allow-scripts; default-src 'none'; img-src http: https: data: blob:; style-src http: https: data: 'unsafe-inline'; font-src http: https: data:; media-src http: https: data: blob:; script-src 'unsafe-inline'; connect-src 'none'; object-src 'none'; frame-src 'none'; form-action 'none'; base-uri 'self'; frame-ancestors 'self'";
|
|
13
|
+
export const NETWORK_PREVIEW_CSP = "sandbox allow-scripts; default-src 'none'; img-src http: https: data: blob:; style-src http: https: data: 'unsafe-inline'; font-src http: https: data:; media-src http: https: data: blob:; script-src 'unsafe-inline' http: https:; connect-src http: https:; object-src 'none'; frame-src 'none'; form-action 'none'; base-uri 'self'; frame-ancestors 'self'";
|
|
14
|
+
function reply(req, res, status, type, body) {
|
|
15
|
+
const bytes = Buffer.isBuffer(body) ? body : Buffer.from(body);
|
|
16
|
+
res.writeHead(status, {
|
|
17
|
+
'Content-Type': type,
|
|
18
|
+
'Content-Length': bytes.length,
|
|
19
|
+
});
|
|
20
|
+
res.end(req.method === 'HEAD' ? undefined : bytes);
|
|
21
|
+
}
|
|
22
|
+
export function parseRange(header, size) {
|
|
23
|
+
if (!header)
|
|
24
|
+
return null;
|
|
25
|
+
const match = /^bytes=(\d*)-(\d*)$/.exec(header);
|
|
26
|
+
if (!match || (!match[1] && !match[2]) || size === 0)
|
|
27
|
+
return 'invalid';
|
|
28
|
+
const first = match[1] ? Number(match[1]) : undefined;
|
|
29
|
+
const last = match[2] ? Number(match[2]) : undefined;
|
|
30
|
+
if ((first !== undefined && !Number.isSafeInteger(first)) ||
|
|
31
|
+
(last !== undefined && !Number.isSafeInteger(last)))
|
|
32
|
+
return 'invalid';
|
|
33
|
+
if (first === undefined) {
|
|
34
|
+
if (!last)
|
|
35
|
+
return 'invalid';
|
|
36
|
+
return { start: Math.max(0, size - last), end: size - 1 };
|
|
37
|
+
}
|
|
38
|
+
if (first >= size || (last !== undefined && last < first))
|
|
39
|
+
return 'invalid';
|
|
40
|
+
return { start: first, end: Math.min(last ?? size - 1, size - 1) };
|
|
41
|
+
}
|
|
42
|
+
export function renderHtml(source, relative) {
|
|
43
|
+
const parent = path.posix.dirname(relative);
|
|
44
|
+
const base = '/asset/' +
|
|
45
|
+
(parent === '.'
|
|
46
|
+
? ''
|
|
47
|
+
: parent.split('/').map(encodeURIComponent).join('/') + '/');
|
|
48
|
+
// The first base element wins. Insert ours before any user content, without parsing/replacing HTML with regex.
|
|
49
|
+
// The same self-contained keyboard handler runs inside the opaque sandbox.
|
|
50
|
+
// Only fixed shortcut and focus messages cross to the parent; it validates the sender.
|
|
51
|
+
const navigation = `<script>(${installNavigation.toString()})({
|
|
52
|
+
bridgeWorkspace: true,
|
|
53
|
+
onSearch: () => { if (parent !== window) parent.postMessage({type: 'fzv:shortcut', key: '/'}, '*'); },
|
|
54
|
+
onReload: () => { if (parent !== window) parent.postMessage({type: 'fzv:shortcut', key: 'r'}, '*'); },
|
|
55
|
+
onFocus: () => { if (parent !== window) parent.postMessage({type: 'fzv:focus'}, '*'); }
|
|
56
|
+
});</script>`;
|
|
57
|
+
return (`<!doctype html><base href="${base}">` +
|
|
58
|
+
navigation +
|
|
59
|
+
source.replace(/^\uFEFF/, ''));
|
|
60
|
+
}
|
|
61
|
+
async function sendProjectFile(req, res, file, relative, asset, previewCsp, allowHtmlNetwork) {
|
|
62
|
+
try {
|
|
63
|
+
if (file.kind === 'html' && asset) {
|
|
64
|
+
res.setHeader('Content-Security-Policy', previewCsp);
|
|
65
|
+
const requestedWith = req.headers['x-requested-with'];
|
|
66
|
+
if (allowHtmlNetwork && req.headers.origin === 'null') {
|
|
67
|
+
res.setHeader('Access-Control-Allow-Origin', 'null');
|
|
68
|
+
res.setHeader('Vary', 'Origin');
|
|
69
|
+
}
|
|
70
|
+
const source = await file.handle.readFile({ encoding: 'utf8' });
|
|
71
|
+
reply(req, res, 200, 'text/html; charset=utf-8', allowHtmlNetwork &&
|
|
72
|
+
typeof requestedWith === 'string' &&
|
|
73
|
+
requestedWith.toLowerCase() === 'xmlhttprequest'
|
|
74
|
+
? source
|
|
75
|
+
: renderHtml(source, relative));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// The response header also protects SVG or HTML opened directly in a browser tab.
|
|
79
|
+
res.setHeader('Content-Security-Policy', previewCsp);
|
|
80
|
+
if (allowHtmlNetwork && req.headers.origin === 'null') {
|
|
81
|
+
res.setHeader('Access-Control-Allow-Origin', 'null');
|
|
82
|
+
res.setHeader('Vary', 'Origin');
|
|
83
|
+
}
|
|
84
|
+
res.setHeader('Accept-Ranges', 'bytes');
|
|
85
|
+
res.setHeader('Content-Disposition', 'inline');
|
|
86
|
+
const range = parseRange(req.headers.range, file.size);
|
|
87
|
+
if (range === 'invalid') {
|
|
88
|
+
res.setHeader('Content-Range', `bytes */${file.size}`);
|
|
89
|
+
reply(req, res, 416, 'text/plain; charset=utf-8', 'Range not satisfiable\n');
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const start = range?.start ?? 0;
|
|
93
|
+
const end = range?.end ?? file.size - 1;
|
|
94
|
+
const size = range ? end - start + 1 : file.size;
|
|
95
|
+
res.setHeader('Content-Type', file.kind === 'html'
|
|
96
|
+
? 'text/plain; charset=utf-8'
|
|
97
|
+
: contentType(file.filename, asset));
|
|
98
|
+
res.setHeader('Content-Length', size);
|
|
99
|
+
if (range)
|
|
100
|
+
res.setHeader('Content-Range', `bytes ${start}-${end}/${file.size}`);
|
|
101
|
+
res.writeHead(range ? 206 : 200);
|
|
102
|
+
if (req.method === 'HEAD' || size === 0) {
|
|
103
|
+
res.end();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
await pipeline(file.handle.createReadStream({ start, end, autoClose: false }), res);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
await file.handle.close();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function allowedHosts(host) {
|
|
113
|
+
const values = new Set(['localhost', '127.0.0.1', '[::1]', host]);
|
|
114
|
+
if (host === '0.0.0.0' || host === '::') {
|
|
115
|
+
for (const entries of Object.values(networkInterfaces())) {
|
|
116
|
+
for (const entry of entries ?? [])
|
|
117
|
+
values.add(entry.family === 'IPv6' ? `[${entry.address}]` : entry.address);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return values;
|
|
121
|
+
}
|
|
122
|
+
export async function createViewer(options) {
|
|
123
|
+
const catalog = await Catalog.create(options.root);
|
|
124
|
+
const hosts = allowedHosts(options.host ?? '127.0.0.1');
|
|
125
|
+
const uiRoot = await realpath(options.uiRoot ?? UI_ROOT);
|
|
126
|
+
const allowHtmlNetwork = options.allowHtmlNetwork ?? false;
|
|
127
|
+
const watchEnabled = options.watch ?? false;
|
|
128
|
+
const previewCsp = allowHtmlNetwork ? NETWORK_PREVIEW_CSP : PREVIEW_CSP;
|
|
129
|
+
const eventClients = new Set();
|
|
130
|
+
let reloadTimer;
|
|
131
|
+
// Unknown or excessive changes are sent as null so clients refresh every tab.
|
|
132
|
+
let changedPaths = new Set();
|
|
133
|
+
const watcher = watchEnabled
|
|
134
|
+
? watchFiles(catalog.root, { recursive: true, encoding: 'utf8' }, (_event, filename) => {
|
|
135
|
+
const relative = filename?.split(path.sep).join('/');
|
|
136
|
+
if (relative && !isVisibleRelative(relative))
|
|
137
|
+
return;
|
|
138
|
+
if (!relative || (changedPaths && changedPaths.size >= 256))
|
|
139
|
+
changedPaths = null;
|
|
140
|
+
else
|
|
141
|
+
changedPaths?.add(relative);
|
|
142
|
+
clearTimeout(reloadTimer);
|
|
143
|
+
reloadTimer = setTimeout(() => {
|
|
144
|
+
reloadTimer = undefined;
|
|
145
|
+
const change = {
|
|
146
|
+
paths: changedPaths && [...changedPaths],
|
|
147
|
+
};
|
|
148
|
+
changedPaths = new Set();
|
|
149
|
+
const message = `event: change\ndata: ${JSON.stringify(change)}\n\n`;
|
|
150
|
+
for (const client of eventClients) {
|
|
151
|
+
if (client.destroyed) {
|
|
152
|
+
eventClients.delete(client);
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (!client.write(message)) {
|
|
156
|
+
eventClients.delete(client);
|
|
157
|
+
client.end();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, 100);
|
|
161
|
+
})
|
|
162
|
+
: undefined;
|
|
163
|
+
const server = createServer(async (req, res) => {
|
|
164
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
165
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
166
|
+
res.setHeader('Referrer-Policy', 'no-referrer');
|
|
167
|
+
res.setHeader('Content-Security-Policy', UI_CSP);
|
|
168
|
+
try {
|
|
169
|
+
if (!req.url?.startsWith('/') ||
|
|
170
|
+
req.url.startsWith('//') ||
|
|
171
|
+
!req.headers.host) {
|
|
172
|
+
reply(req, res, 400, 'text/plain', 'Bad request\n');
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const origin = new URL(`http://${req.headers.host}`);
|
|
176
|
+
if (!hosts.has(origin.hostname)) {
|
|
177
|
+
reply(req, res, 403, 'text/plain', 'Host not allowed\n');
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const url = new URL(req.url, origin);
|
|
181
|
+
if (allowHtmlNetwork &&
|
|
182
|
+
req.headers.origin === 'null' &&
|
|
183
|
+
req.method === 'OPTIONS' &&
|
|
184
|
+
url.pathname.startsWith('/asset/')) {
|
|
185
|
+
const requestedHeaders = (req.headers['access-control-request-headers'] ?? '')
|
|
186
|
+
.split(',')
|
|
187
|
+
.map((header) => header.trim().toLowerCase())
|
|
188
|
+
.filter(Boolean);
|
|
189
|
+
const requestedMethod = req.headers['access-control-request-method'];
|
|
190
|
+
if ((requestedMethod !== 'GET' && requestedMethod !== 'HEAD') ||
|
|
191
|
+
requestedHeaders.some((header) => header !== 'x-requested-with')) {
|
|
192
|
+
reply(req, res, 403, 'text/plain', 'CORS headers not allowed\n');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
res.setHeader('Access-Control-Allow-Origin', 'null');
|
|
196
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, HEAD');
|
|
197
|
+
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With');
|
|
198
|
+
res.setHeader('Access-Control-Max-Age', '600');
|
|
199
|
+
res.setHeader('Vary', 'Origin');
|
|
200
|
+
reply(req, res, 204, 'text/plain', '');
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
204
|
+
res.setHeader('Allow', 'GET, HEAD');
|
|
205
|
+
reply(req, res, 405, 'text/plain', 'Method not allowed\n');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (url.pathname === '/api/events') {
|
|
209
|
+
if (!watchEnabled || !watcher) {
|
|
210
|
+
reply(req, res, 404, 'text/plain; charset=utf-8', 'Not found\n');
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (req.method !== 'GET') {
|
|
214
|
+
res.setHeader('Allow', 'GET');
|
|
215
|
+
reply(req, res, 405, 'text/plain; charset=utf-8', 'Method not allowed\n');
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (req.headers.origin && req.headers.origin !== origin.origin) {
|
|
219
|
+
reply(req, res, 403, 'text/plain; charset=utf-8', 'Origin not allowed\n');
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
res.writeHead(200, {
|
|
223
|
+
'Content-Type': 'text/event-stream; charset=utf-8',
|
|
224
|
+
'Cache-Control': 'no-cache, no-transform',
|
|
225
|
+
Connection: 'keep-alive',
|
|
226
|
+
'X-Accel-Buffering': 'no',
|
|
227
|
+
});
|
|
228
|
+
res.write(': connected\n\n');
|
|
229
|
+
eventClients.add(res);
|
|
230
|
+
res.on('close', () => eventClients.delete(res));
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (url.pathname === '/api/project' ||
|
|
234
|
+
url.pathname === '/api/files' ||
|
|
235
|
+
url.pathname === '/api/session-files') {
|
|
236
|
+
if (req.headers.origin && req.headers.origin !== origin.origin) {
|
|
237
|
+
reply(req, res, 403, 'text/plain', 'Origin not allowed\n');
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const paths = url.searchParams.getAll('path');
|
|
241
|
+
if (url.pathname === '/api/session-files' && paths.length > 32) {
|
|
242
|
+
reply(req, res, 400, 'text/plain', 'Too many file paths\n');
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const project = { ...catalog.project, watch: watchEnabled };
|
|
246
|
+
const body = url.pathname === '/api/project'
|
|
247
|
+
? project
|
|
248
|
+
: url.pathname === '/api/session-files'
|
|
249
|
+
? await catalog.filesForPaths(paths)
|
|
250
|
+
: { project, ...(await catalog.list()) };
|
|
251
|
+
reply(req, res, 200, 'application/json; charset=utf-8', JSON.stringify(body));
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (url.pathname === '/preview-html') {
|
|
255
|
+
const relative = url.searchParams.get('path') ?? '';
|
|
256
|
+
const file = await catalog.openFile(relative);
|
|
257
|
+
try {
|
|
258
|
+
if (file.kind !== 'html')
|
|
259
|
+
throw new FileUnavailable();
|
|
260
|
+
const source = await file.handle.readFile({ encoding: 'utf8' });
|
|
261
|
+
res.setHeader('Content-Security-Policy', previewCsp);
|
|
262
|
+
reply(req, res, 200, 'text/html; charset=utf-8', renderHtml(source, relative));
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
await file.handle.close();
|
|
266
|
+
}
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
if (url.pathname === '/file' || url.pathname.startsWith('/asset/')) {
|
|
270
|
+
const asset = url.pathname.startsWith('/asset/');
|
|
271
|
+
const relative = asset
|
|
272
|
+
? decodeURIComponent(url.pathname.slice('/asset/'.length))
|
|
273
|
+
: (url.searchParams.get('path') ?? '');
|
|
274
|
+
const file = await catalog.openFile(relative, asset);
|
|
275
|
+
await sendProjectFile(req, res, file, relative, asset, previewCsp, allowHtmlNetwork);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (url.pathname === '/' || url.pathname.startsWith('/_fzv/')) {
|
|
279
|
+
const relative = url.pathname === '/'
|
|
280
|
+
? 'index.html'
|
|
281
|
+
: decodeURIComponent(url.pathname.slice('/_fzv/'.length));
|
|
282
|
+
if (!relative ||
|
|
283
|
+
relative.split('/').some((part) => part.startsWith('.')) ||
|
|
284
|
+
relative.includes('\\') ||
|
|
285
|
+
relative.includes('\0'))
|
|
286
|
+
throw new FileUnavailable();
|
|
287
|
+
const filename = await realpath(path.join(uiRoot, relative));
|
|
288
|
+
const inside = path.relative(uiRoot, filename);
|
|
289
|
+
if (inside.startsWith('..') ||
|
|
290
|
+
path.isAbsolute(inside) ||
|
|
291
|
+
!(await stat(filename)).isFile())
|
|
292
|
+
throw new FileUnavailable();
|
|
293
|
+
const body = await readFile(filename);
|
|
294
|
+
reply(req, res, 200, contentType(filename, true), body);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
// Project HTML commonly refers to assets from the site root, such as
|
|
298
|
+
// /css/site.css. Keep those URLs in project space and validate them via
|
|
299
|
+
// the same catalog path as /asset/ requests. Viewer files use /_fzv/.
|
|
300
|
+
const relative = decodeURIComponent(url.pathname).slice(1);
|
|
301
|
+
const file = await catalog.openFile(relative, true);
|
|
302
|
+
await sendProjectFile(req, res, file, relative, true, previewCsp, allowHtmlNetwork);
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
if (res.headersSent || res.destroyed) {
|
|
306
|
+
res.destroy();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const status = error instanceof URIError
|
|
310
|
+
? 400
|
|
311
|
+
: error instanceof FileUnavailable ||
|
|
312
|
+
(error instanceof Error &&
|
|
313
|
+
'code' in error &&
|
|
314
|
+
['ENOENT', 'ENOTDIR', 'EACCES'].includes(String(error.code)))
|
|
315
|
+
? 404
|
|
316
|
+
: 500;
|
|
317
|
+
reply(req, res, status, 'text/plain; charset=utf-8', status === 404
|
|
318
|
+
? 'Not found\n'
|
|
319
|
+
: status === 400
|
|
320
|
+
? 'Bad request\n'
|
|
321
|
+
: 'Could not load this resource\n');
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
server.requestTimeout = 30_000;
|
|
325
|
+
server.headersTimeout = 10_000;
|
|
326
|
+
server.on('close', () => {
|
|
327
|
+
watcher?.close();
|
|
328
|
+
clearTimeout(reloadTimer);
|
|
329
|
+
for (const client of eventClients)
|
|
330
|
+
client.end();
|
|
331
|
+
eventClients.clear();
|
|
332
|
+
});
|
|
333
|
+
watcher?.on('error', (error) => {
|
|
334
|
+
watcher.close();
|
|
335
|
+
server.emit('watchError', error);
|
|
336
|
+
});
|
|
337
|
+
return { server, catalog };
|
|
338
|
+
}
|
package/dist/shared.js
ADDED