@refrakt-md/editor 0.6.0
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/app/dist/assets/abap-BdImnpbu.js +1 -0
- package/app/dist/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/app/dist/assets/ada-bCR0ucgS.js +1 -0
- package/app/dist/assets/andromeeda-C4gqWexZ.js +1 -0
- package/app/dist/assets/angular-html-CU67Zn6k.js +1 -0
- package/app/dist/assets/angular-ts-BwZT4LLn.js +1 -0
- package/app/dist/assets/apache-Pmp26Uib.js +1 -0
- package/app/dist/assets/apex-D8_7TLub.js +1 -0
- package/app/dist/assets/apl-B4CMkyY2.js +1 -0
- package/app/dist/assets/apl-dKokRX4l.js +1 -0
- package/app/dist/assets/applescript-Co6uUVPk.js +1 -0
- package/app/dist/assets/ara-BRHolxvo.js +1 -0
- package/app/dist/assets/asciiarmor-Df11BRmG.js +1 -0
- package/app/dist/assets/asciidoc-Dv7Oe6Be.js +1 -0
- package/app/dist/assets/asm-D_Q5rh1f.js +1 -0
- package/app/dist/assets/asn1-EdZsLKOL.js +1 -0
- package/app/dist/assets/asterisk-B-8jnY81.js +1 -0
- package/app/dist/assets/astro-CbQHKStN.js +1 -0
- package/app/dist/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/app/dist/assets/awk-DMzUqQB5.js +1 -0
- package/app/dist/assets/ayu-dark-CMjwMIkn.js +1 -0
- package/app/dist/assets/ayu-light-C47S-Tmv.js +1 -0
- package/app/dist/assets/ayu-mirage-CjoLj4QM.js +1 -0
- package/app/dist/assets/ballerina-BFfxhgS-.js +1 -0
- package/app/dist/assets/bat-BkioyH1T.js +1 -0
- package/app/dist/assets/beancount-k_qm7-4y.js +1 -0
- package/app/dist/assets/berry-uYugtg8r.js +1 -0
- package/app/dist/assets/bibtex-CHM0blh-.js +1 -0
- package/app/dist/assets/bicep-Bmn6On1c.js +1 -0
- package/app/dist/assets/blade-D4QpJJKB.js +1 -0
- package/app/dist/assets/brainfuck-C4LP7Hcl.js +1 -0
- package/app/dist/assets/bsl-BO_Y6i37.js +1 -0
- package/app/dist/assets/c-BIGW1oBm.js +1 -0
- package/app/dist/assets/c3-VCDPK7BO.js +1 -0
- package/app/dist/assets/cadence-Bv_4Rxtq.js +1 -0
- package/app/dist/assets/cairo-KRGpt6FW.js +1 -0
- package/app/dist/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/app/dist/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/app/dist/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/app/dist/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/app/dist/assets/clarity-D53aC0YG.js +1 -0
- package/app/dist/assets/clike-B9uivgTg.js +1 -0
- package/app/dist/assets/clojure-BMjYHr_A.js +1 -0
- package/app/dist/assets/clojure-P80f7IUj.js +1 -0
- package/app/dist/assets/cmake-BQqOBYOt.js +1 -0
- package/app/dist/assets/cmake-D1j8_8rp.js +1 -0
- package/app/dist/assets/cobol-CWcv1MsR.js +1 -0
- package/app/dist/assets/cobol-nwyudZeR.js +1 -0
- package/app/dist/assets/codeowners-Bp6g37R7.js +1 -0
- package/app/dist/assets/codeql-DsOJ9woJ.js +1 -0
- package/app/dist/assets/coffee-Ch7k5sss.js +1 -0
- package/app/dist/assets/coffeescript-S37ZYGWr.js +1 -0
- package/app/dist/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/app/dist/assets/commonlisp-DBKNyK5s.js +1 -0
- package/app/dist/assets/coq-DkFqJrB1.js +1 -0
- package/app/dist/assets/cpp-CofmeUqb.js +1 -0
- package/app/dist/assets/crystal-SjHAIU92.js +1 -0
- package/app/dist/assets/crystal-tKQVLTB8.js +1 -0
- package/app/dist/assets/csharp-COcwbKMJ.js +1 -0
- package/app/dist/assets/css-BnMrqG3P.js +1 -0
- package/app/dist/assets/css-DPfMkruS.js +1 -0
- package/app/dist/assets/csv-fuZLfV_i.js +1 -0
- package/app/dist/assets/cue-D82EKSYY.js +1 -0
- package/app/dist/assets/cypher-COkxafJQ.js +1 -0
- package/app/dist/assets/cypher-C_CwsFkJ.js +1 -0
- package/app/dist/assets/d-85-TOEBH.js +1 -0
- package/app/dist/assets/d-pRatUO7H.js +1 -0
- package/app/dist/assets/dark-plus-C3mMm8J8.js +1 -0
- package/app/dist/assets/dart-CF10PKvl.js +1 -0
- package/app/dist/assets/dax-CEL-wOlO.js +1 -0
- package/app/dist/assets/desktop-BmXAJ9_W.js +1 -0
- package/app/dist/assets/diff-D97Zzqfu.js +1 -0
- package/app/dist/assets/diff-DbItnlRl.js +1 -0
- package/app/dist/assets/docker-BcOcwvcX.js +1 -0
- package/app/dist/assets/dockerfile-BKs6k2Af.js +1 -0
- package/app/dist/assets/dotenv-Da5cRb03.js +1 -0
- package/app/dist/assets/dracula-BzJJZx-M.js +1 -0
- package/app/dist/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/app/dist/assets/dream-maker-BtqSS_iP.js +1 -0
- package/app/dist/assets/dtd-DF_7sFjM.js +1 -0
- package/app/dist/assets/dylan-DwRh75JA.js +1 -0
- package/app/dist/assets/ebnf-CDyGwa7X.js +1 -0
- package/app/dist/assets/ecl-Cabwm37j.js +1 -0
- package/app/dist/assets/edge-BkV0erSs.js +1 -0
- package/app/dist/assets/eiffel-CnydiIhH.js +1 -0
- package/app/dist/assets/elixir-CDX3lj18.js +1 -0
- package/app/dist/assets/elm-DbKCFpqz.js +1 -0
- package/app/dist/assets/elm-vLlmbW-K.js +1 -0
- package/app/dist/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/app/dist/assets/erb-CgJxNhIT.js +1 -0
- package/app/dist/assets/erlang-BNw1qcRV.js +1 -0
- package/app/dist/assets/erlang-DsQrWhSR.js +1 -0
- package/app/dist/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/app/dist/assets/everforest-light-C8M2exoo.js +1 -0
- package/app/dist/assets/factor-kuTfRLto.js +1 -0
- package/app/dist/assets/fcl-Kvtd6kyn.js +1 -0
- package/app/dist/assets/fennel-BYunw83y.js +1 -0
- package/app/dist/assets/fish-BvzEVeQv.js +1 -0
- package/app/dist/assets/fluent-C4IJs8-o.js +1 -0
- package/app/dist/assets/forth-Ffai-XNe.js +1 -0
- package/app/dist/assets/fortran-DYz_wnZ1.js +1 -0
- package/app/dist/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/app/dist/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/app/dist/assets/fsharp-CXgrBDvD.js +1 -0
- package/app/dist/assets/gas-Bneqetm1.js +1 -0
- package/app/dist/assets/gdresource-BOOCDP_w.js +1 -0
- package/app/dist/assets/gdscript-C5YyOfLZ.js +1 -0
- package/app/dist/assets/gdshader-DkwncUOv.js +1 -0
- package/app/dist/assets/genie-D0YGMca9.js +1 -0
- package/app/dist/assets/gherkin-DyxjwDmM.js +1 -0
- package/app/dist/assets/gherkin-heZmZLOM.js +1 -0
- package/app/dist/assets/git-commit-F4YmCXRG.js +1 -0
- package/app/dist/assets/git-rebase-r7XF79zn.js +1 -0
- package/app/dist/assets/github-dark-DHJKELXO.js +1 -0
- package/app/dist/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/app/dist/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/app/dist/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/app/dist/assets/github-light-DAi9KRSo.js +1 -0
- package/app/dist/assets/github-light-default-D7oLnXFd.js +1 -0
- package/app/dist/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/app/dist/assets/gleam-BspZqrRM.js +1 -0
- package/app/dist/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/app/dist/assets/glimmer-ts-U6CK756n.js +1 -0
- package/app/dist/assets/glsl-DplSGwfg.js +1 -0
- package/app/dist/assets/gn-n2N0HUVH.js +1 -0
- package/app/dist/assets/gnuplot-DdkO51Og.js +1 -0
- package/app/dist/assets/go-CxLEBnE3.js +1 -0
- package/app/dist/assets/graphql-ChdNCCLP.js +1 -0
- package/app/dist/assets/groovy-D9Dt4D0W.js +1 -0
- package/app/dist/assets/groovy-gcz8RCvz.js +1 -0
- package/app/dist/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/app/dist/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/app/dist/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/app/dist/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/app/dist/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/app/dist/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/app/dist/assets/hack-CaT9iCJl.js +1 -0
- package/app/dist/assets/haml-B8DHNrY2.js +1 -0
- package/app/dist/assets/handlebars-BL8al0AC.js +1 -0
- package/app/dist/assets/haskell-Cw1EW3IL.js +1 -0
- package/app/dist/assets/haskell-Df6bDoY_.js +1 -0
- package/app/dist/assets/haxe-CzTSHFRz.js +1 -0
- package/app/dist/assets/haxe-H-WmDvRZ.js +1 -0
- package/app/dist/assets/hcl-BWvSN4gD.js +1 -0
- package/app/dist/assets/hjson-D5-asLiD.js +1 -0
- package/app/dist/assets/hlsl-D3lLCCz7.js +1 -0
- package/app/dist/assets/horizon-BUw7H-hv.js +1 -0
- package/app/dist/assets/houston-DnULxvSX.js +1 -0
- package/app/dist/assets/html-GMplVEZG.js +1 -0
- package/app/dist/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/app/dist/assets/http-DBlCnlav.js +1 -0
- package/app/dist/assets/http-jrhK8wxY.js +1 -0
- package/app/dist/assets/hurl-irOxFIW8.js +1 -0
- package/app/dist/assets/hxml-Bvhsp5Yf.js +1 -0
- package/app/dist/assets/hy-DFXneXwc.js +1 -0
- package/app/dist/assets/idl-BEugSyMb.js +1 -0
- package/app/dist/assets/imba-DGztddWO.js +1 -0
- package/app/dist/assets/index-5zX9_mJn.js +1 -0
- package/app/dist/assets/index-B4OhG7R9.js +1 -0
- package/app/dist/assets/index-B4kat0j1.js +7 -0
- package/app/dist/assets/index-BbFg11BX.js +1 -0
- package/app/dist/assets/index-BeI31aOW.js +48 -0
- package/app/dist/assets/index-C07W8XY7.js +1 -0
- package/app/dist/assets/index-CLCqkEcA.js +1 -0
- package/app/dist/assets/index-COgEItgI.js +1 -0
- package/app/dist/assets/index-Caa-a1PE.js +2 -0
- package/app/dist/assets/index-CvAaUCm5.js +1 -0
- package/app/dist/assets/index-DDqgfG5o.js +1 -0
- package/app/dist/assets/index-DLjiZx9h.js +1 -0
- package/app/dist/assets/index-DcnZ8L6Y.js +3 -0
- package/app/dist/assets/index-DksBloEA.js +1 -0
- package/app/dist/assets/index-DlrXwdpb.css +1 -0
- package/app/dist/assets/index-FVD-6MCq.js +1 -0
- package/app/dist/assets/index-IZk0Eanm.js +334 -0
- package/app/dist/assets/index-aSkmrFGo.js +1 -0
- package/app/dist/assets/index-iTcD8pV7.js +1 -0
- package/app/dist/assets/index-wQuJ1T-l.js +1 -0
- package/app/dist/assets/ini-BEwlwnbL.js +1 -0
- package/app/dist/assets/java-CylS5w8V.js +1 -0
- package/app/dist/assets/javascript-iXu5QeM3.js +1 -0
- package/app/dist/assets/javascript-wDzz0qaB.js +1 -0
- package/app/dist/assets/jinja-4LBKfQ-Z.js +1 -0
- package/app/dist/assets/jison-wvAkD_A8.js +1 -0
- package/app/dist/assets/json-Cp-IABpG.js +1 -0
- package/app/dist/assets/json5-C9tS-k6U.js +1 -0
- package/app/dist/assets/jsonc-Des-eS-w.js +1 -0
- package/app/dist/assets/jsonl-DcaNXYhu.js +1 -0
- package/app/dist/assets/jsonnet-DFQXde-d.js +1 -0
- package/app/dist/assets/jssm-C2t-YnRu.js +1 -0
- package/app/dist/assets/jsx-g9-lgVsj.js +1 -0
- package/app/dist/assets/julia-CxzCAyBv.js +1 -0
- package/app/dist/assets/julia-DuME0IfC.js +1 -0
- package/app/dist/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/app/dist/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/app/dist/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/app/dist/assets/kdl-DV7GczEv.js +1 -0
- package/app/dist/assets/kotlin-BdnUsdx6.js +1 -0
- package/app/dist/assets/kusto-DZf3V79B.js +1 -0
- package/app/dist/assets/laserwave-DUszq2jm.js +1 -0
- package/app/dist/assets/latex-DGMBWnxU.js +1 -0
- package/app/dist/assets/lean-BZvkOJ9d.js +1 -0
- package/app/dist/assets/less-B1dDrJ26.js +1 -0
- package/app/dist/assets/light-plus-B7mTdjB0.js +1 -0
- package/app/dist/assets/liquid-DYVedYrR.js +1 -0
- package/app/dist/assets/livescript-BwQOo05w.js +1 -0
- package/app/dist/assets/llvm-BtvRca6l.js +1 -0
- package/app/dist/assets/log-2UxHyX5q.js +1 -0
- package/app/dist/assets/logo-BtOb2qkB.js +1 -0
- package/app/dist/assets/lua-BaeVxFsk.js +1 -0
- package/app/dist/assets/lua-BgMRiT3U.js +1 -0
- package/app/dist/assets/luau-C-HG3fhB.js +1 -0
- package/app/dist/assets/make-CHLpvVh8.js +1 -0
- package/app/dist/assets/markdown-Cvjx9yec.js +1 -0
- package/app/dist/assets/marko-DZsq8hO1.js +1 -0
- package/app/dist/assets/material-theme-D5KoaKCx.js +1 -0
- package/app/dist/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/app/dist/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/app/dist/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/app/dist/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/app/dist/assets/mathematica-DTrFuWx2.js +1 -0
- package/app/dist/assets/matlab-D7o27uSR.js +1 -0
- package/app/dist/assets/mbox-CNhZ1qSd.js +1 -0
- package/app/dist/assets/mdc-DUICxH0z.js +1 -0
- package/app/dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/app/dist/assets/mermaid-mWjccvbQ.js +1 -0
- package/app/dist/assets/min-dark-CafNBF8u.js +1 -0
- package/app/dist/assets/min-light-CTRr51gU.js +1 -0
- package/app/dist/assets/mipsasm-CKIfxQSi.js +1 -0
- package/app/dist/assets/mirc-CjQqDB4T.js +1 -0
- package/app/dist/assets/mllike-CXdrOF99.js +1 -0
- package/app/dist/assets/modelica-Dc1JOy9r.js +1 -0
- package/app/dist/assets/mojo-B93PlW-d.js +1 -0
- package/app/dist/assets/monokai-D4h5O-jR.js +1 -0
- package/app/dist/assets/moonbit-Ba13S78F.js +1 -0
- package/app/dist/assets/move-IF9eRakj.js +1 -0
- package/app/dist/assets/mscgen-BA5vi2Kp.js +1 -0
- package/app/dist/assets/mumps-BT43cFF4.js +1 -0
- package/app/dist/assets/narrat-DRg8JJMk.js +1 -0
- package/app/dist/assets/nextflow-BrzmwbiE.js +1 -0
- package/app/dist/assets/nginx-BpAMiNFr.js +1 -0
- package/app/dist/assets/nginx-DdIZxoE0.js +1 -0
- package/app/dist/assets/night-owl-C39BiMTA.js +1 -0
- package/app/dist/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/app/dist/assets/nim-CVrawwO9.js +1 -0
- package/app/dist/assets/nix-CwoSXNpI.js +1 -0
- package/app/dist/assets/nord-Ddv68eIx.js +1 -0
- package/app/dist/assets/nsis-LdVXkNf5.js +1 -0
- package/app/dist/assets/ntriples-BfvgReVJ.js +1 -0
- package/app/dist/assets/nushell-C-sUppwS.js +1 -0
- package/app/dist/assets/objective-c-DXmwc3jG.js +1 -0
- package/app/dist/assets/objective-cpp-CLxacb5B.js +1 -0
- package/app/dist/assets/ocaml-C0hk2d4L.js +1 -0
- package/app/dist/assets/octave-Ck1zUtKM.js +1 -0
- package/app/dist/assets/odin-BBf5iR-q.js +1 -0
- package/app/dist/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/app/dist/assets/one-light-C3Wv6jpd.js +1 -0
- package/app/dist/assets/openscad-C4EeE6gA.js +1 -0
- package/app/dist/assets/oz-BzwKVEFT.js +1 -0
- package/app/dist/assets/pascal--L3eBynH.js +1 -0
- package/app/dist/assets/pascal-D93ZcfNL.js +1 -0
- package/app/dist/assets/perl-C0TMdlhV.js +1 -0
- package/app/dist/assets/perl-CdXCOZ3F.js +1 -0
- package/app/dist/assets/php-Dhbhpdrm.js +1 -0
- package/app/dist/assets/pig-CevX1Tat.js +1 -0
- package/app/dist/assets/pkl-u5AG7uiY.js +1 -0
- package/app/dist/assets/plastic-3e1v2bzS.js +1 -0
- package/app/dist/assets/plsql-ChMvpjG-.js +1 -0
- package/app/dist/assets/po-BTJTHyun.js +1 -0
- package/app/dist/assets/poimandres-CS3Unz2-.js +1 -0
- package/app/dist/assets/polar-C0HS_06l.js +1 -0
- package/app/dist/assets/postcss-CXtECtnM.js +1 -0
- package/app/dist/assets/powerquery-CEu0bR-o.js +1 -0
- package/app/dist/assets/powershell-CFHJl5sT.js +1 -0
- package/app/dist/assets/powershell-Dpen1YoG.js +1 -0
- package/app/dist/assets/prisma-Dd19v3D-.js +1 -0
- package/app/dist/assets/prolog-CbFg5uaA.js +1 -0
- package/app/dist/assets/properties-C78fOPTZ.js +1 -0
- package/app/dist/assets/proto-C7zT0LnQ.js +1 -0
- package/app/dist/assets/protobuf-ChK-085T.js +1 -0
- package/app/dist/assets/pug-CGlum2m_.js +1 -0
- package/app/dist/assets/pug-DeIclll2.js +1 -0
- package/app/dist/assets/puppet-BMWR74SV.js +1 -0
- package/app/dist/assets/puppet-DMA9R1ak.js +1 -0
- package/app/dist/assets/purescript-CklMAg4u.js +1 -0
- package/app/dist/assets/python-B6aJPvgy.js +1 -0
- package/app/dist/assets/python-BuPzkPfP.js +1 -0
- package/app/dist/assets/q-pXgVlZs6.js +1 -0
- package/app/dist/assets/qml-3beO22l8.js +1 -0
- package/app/dist/assets/qmldir-C8lEn-DE.js +1 -0
- package/app/dist/assets/qss-IeuSbFQv.js +1 -0
- package/app/dist/assets/r-B6wPVr8A.js +1 -0
- package/app/dist/assets/r-Dspwwk_N.js +1 -0
- package/app/dist/assets/racket-BqYA7rlc.js +1 -0
- package/app/dist/assets/raku-DXvB9xmW.js +1 -0
- package/app/dist/assets/razor-Uh8Bk_45.js +1 -0
- package/app/dist/assets/red-bN70gL4F.js +1 -0
- package/app/dist/assets/reg-C-SQnVFl.js +1 -0
- package/app/dist/assets/regexp-CDVJQ6XC.js +1 -0
- package/app/dist/assets/rel-C3B-1QV4.js +1 -0
- package/app/dist/assets/riscv-BM1_JUlF.js +1 -0
- package/app/dist/assets/ron-BhRPY-oY.js +1 -0
- package/app/dist/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/app/dist/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/app/dist/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/app/dist/assets/rosmsg-BJDFO7_C.js +1 -0
- package/app/dist/assets/rpm-CTu-6PCP.js +1 -0
- package/app/dist/assets/rst-D5oM4XIm.js +1 -0
- package/app/dist/assets/ruby-B2Rjki9n.js +1 -0
- package/app/dist/assets/ruby-Cw6WdidG.js +1 -0
- package/app/dist/assets/rust-B1yitclQ.js +1 -0
- package/app/dist/assets/sas-B4kiWyti.js +1 -0
- package/app/dist/assets/sas-cz2c8ADy.js +1 -0
- package/app/dist/assets/sass-Cj5Yp3dK.js +1 -0
- package/app/dist/assets/scala-C151Ov-r.js +1 -0
- package/app/dist/assets/scheme-C41bIUwD.js +1 -0
- package/app/dist/assets/scheme-C98Dy4si.js +1 -0
- package/app/dist/assets/scss-OYdSNvt2.js +1 -0
- package/app/dist/assets/sdbl-DVxCFoDh.js +1 -0
- package/app/dist/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/app/dist/assets/shell-CjFT_Tl9.js +1 -0
- package/app/dist/assets/shellscript-Yzrsuije.js +1 -0
- package/app/dist/assets/shellsession-BADoaaVG.js +1 -0
- package/app/dist/assets/sieve-C3Gn_uJK.js +1 -0
- package/app/dist/assets/simple-mode-GW_nhZxv.js +1 -0
- package/app/dist/assets/slack-dark-BthQWCQV.js +1 -0
- package/app/dist/assets/slack-ochin-DqwNpetd.js +1 -0
- package/app/dist/assets/smalltalk-BERRCDM3.js +1 -0
- package/app/dist/assets/smalltalk-CnHTOXQT.js +1 -0
- package/app/dist/assets/snazzy-light-Bw305WKR.js +1 -0
- package/app/dist/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/app/dist/assets/solarized-light-L9t79GZl.js +1 -0
- package/app/dist/assets/solidity-rGO070M0.js +1 -0
- package/app/dist/assets/solr-DehyRSwq.js +1 -0
- package/app/dist/assets/soy-Brmx7dQM.js +1 -0
- package/app/dist/assets/sparql-DkYu6x3z.js +1 -0
- package/app/dist/assets/sparql-rVzFXLq3.js +1 -0
- package/app/dist/assets/splunk-BtCnVYZw.js +1 -0
- package/app/dist/assets/spreadsheet-BCZA_wO0.js +1 -0
- package/app/dist/assets/sql-BLtJtn59.js +1 -0
- package/app/dist/assets/sql-D0XecflT.js +1 -0
- package/app/dist/assets/ssh-config-_ykCGR6B.js +1 -0
- package/app/dist/assets/stata-BH5u7GGu.js +1 -0
- package/app/dist/assets/stex-C3f8Ysf7.js +1 -0
- package/app/dist/assets/stylus-B533Al4x.js +1 -0
- package/app/dist/assets/stylus-BEDo0Tqx.js +1 -0
- package/app/dist/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/app/dist/assets/svelte-zxCyuUbr.js +1 -0
- package/app/dist/assets/swift-BzpIVaGY.js +1 -0
- package/app/dist/assets/swift-Dg5xB15N.js +1 -0
- package/app/dist/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/app/dist/assets/system-verilog-CnnmHF94.js +1 -0
- package/app/dist/assets/systemd-4A_iFExJ.js +1 -0
- package/app/dist/assets/talonscript-CkByrt1z.js +1 -0
- package/app/dist/assets/tasl-QIJgUcNo.js +1 -0
- package/app/dist/assets/tcl-DVfN8rqt.js +1 -0
- package/app/dist/assets/tcl-dwOrl1Do.js +1 -0
- package/app/dist/assets/templ-P3uqSqPl.js +1 -0
- package/app/dist/assets/terraform-BETggiCN.js +1 -0
- package/app/dist/assets/tex-CvyZ59Mk.js +1 -0
- package/app/dist/assets/textile-CnDTJFAw.js +1 -0
- package/app/dist/assets/tiddlywiki-DO-Gjzrf.js +1 -0
- package/app/dist/assets/tiki-DGYXhP31.js +1 -0
- package/app/dist/assets/tokyo-night-hegEt444.js +1 -0
- package/app/dist/assets/toml-Bm5Em-hy.js +1 -0
- package/app/dist/assets/toml-vGWfd6FD.js +1 -0
- package/app/dist/assets/troff-wAsdV37c.js +1 -0
- package/app/dist/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/app/dist/assets/tsv-B_m7g4N7.js +1 -0
- package/app/dist/assets/tsx-COt5Ahok.js +1 -0
- package/app/dist/assets/ttcn-CfJYG6tj.js +1 -0
- package/app/dist/assets/ttcn-cfg-B9xdYoR4.js +1 -0
- package/app/dist/assets/turtle-B1tBg_DP.js +1 -0
- package/app/dist/assets/turtle-BsS91CYL.js +1 -0
- package/app/dist/assets/twig-ChbOoGGc.js +1 -0
- package/app/dist/assets/typescript-BPQ3VLAy.js +1 -0
- package/app/dist/assets/typespec-BGHnOYBU.js +1 -0
- package/app/dist/assets/typst-DHCkPAjA.js +1 -0
- package/app/dist/assets/v-BcVCzyr7.js +1 -0
- package/app/dist/assets/vala-CsfeWuGM.js +1 -0
- package/app/dist/assets/vb-CmGdzxic.js +1 -0
- package/app/dist/assets/vb-D17OF-Vu.js +1 -0
- package/app/dist/assets/vbscript-BuJXcnF6.js +1 -0
- package/app/dist/assets/velocity-D8B20fx6.js +1 -0
- package/app/dist/assets/verilog-BQ8w6xss.js +1 -0
- package/app/dist/assets/verilog-C6RDOZhf.js +1 -0
- package/app/dist/assets/vesper-DU1UobuO.js +1 -0
- package/app/dist/assets/vhdl-CeAyd5Ju.js +1 -0
- package/app/dist/assets/vhdl-lSbBsy5d.js +1 -0
- package/app/dist/assets/viml-CJc9bBzg.js +1 -0
- package/app/dist/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/app/dist/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/app/dist/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/app/dist/assets/vue-DN_0RTcg.js +1 -0
- package/app/dist/assets/vue-html-AaS7Mt5G.js +1 -0
- package/app/dist/assets/vue-vine-CQOfvN7w.js +1 -0
- package/app/dist/assets/vyper-CDx5xZoG.js +1 -0
- package/app/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/app/dist/assets/wasm-MzD3tlZU.js +1 -0
- package/app/dist/assets/webidl-ZXfAyPTL.js +1 -0
- package/app/dist/assets/wenyan-BV7otONQ.js +1 -0
- package/app/dist/assets/wgsl-Dx-B1_4e.js +1 -0
- package/app/dist/assets/wikitext-BhOHFoWU.js +1 -0
- package/app/dist/assets/wit-5i3qLPDT.js +1 -0
- package/app/dist/assets/wolfram-lXgVvXCa.js +1 -0
- package/app/dist/assets/xml-sdJ4AIDG.js +1 -0
- package/app/dist/assets/xquery-DzFWVndE.js +1 -0
- package/app/dist/assets/xsl-CtQFsRM5.js +1 -0
- package/app/dist/assets/yacas-BJ4BC0dw.js +1 -0
- package/app/dist/assets/yaml-Buea-lGh.js +1 -0
- package/app/dist/assets/z80-Hz9HOZM7.js +1 -0
- package/app/dist/assets/zenscript-DVFEvuxE.js +1 -0
- package/app/dist/assets/zig-VOosw3JB.js +1 -0
- package/app/dist/index.html +13 -0
- package/app/src/lib/api/client.ts +234 -0
- package/app/src/lib/components/BlockCard.svelte +175 -0
- package/app/src/lib/components/BlockEditPanel.svelte +403 -0
- package/app/src/lib/components/BlockEditor.svelte +967 -0
- package/app/src/lib/components/CategoryNav.svelte +344 -0
- package/app/src/lib/components/ConfirmDialog.svelte +118 -0
- package/app/src/lib/components/ContextMenu.svelte +149 -0
- package/app/src/lib/components/CreateCategoryModal.svelte +171 -0
- package/app/src/lib/components/CreateDirectoryModal.svelte +212 -0
- package/app/src/lib/components/CreatePageModal.svelte +273 -0
- package/app/src/lib/components/EditorLayout.svelte +122 -0
- package/app/src/lib/components/ExternalChangeBanner.svelte +72 -0
- package/app/src/lib/components/FileTree.svelte +135 -0
- package/app/src/lib/components/FileTreeNode.svelte +253 -0
- package/app/src/lib/components/FrontmatterEditPanel.svelte +435 -0
- package/app/src/lib/components/FrontmatterEditor.svelte +549 -0
- package/app/src/lib/components/HeaderBar.svelte +322 -0
- package/app/src/lib/components/InlineEditor.svelte +234 -0
- package/app/src/lib/components/LayoutEditor.svelte +228 -0
- package/app/src/lib/components/MarkdownEditor.svelte +123 -0
- package/app/src/lib/components/NavEditor.svelte +359 -0
- package/app/src/lib/components/NavItemRow.svelte +165 -0
- package/app/src/lib/components/PageCard.svelte +45 -0
- package/app/src/lib/components/Popover.svelte +86 -0
- package/app/src/lib/components/PreviewPane.svelte +186 -0
- package/app/src/lib/components/RawYamlEditor.svelte +89 -0
- package/app/src/lib/components/RegionCard.svelte +258 -0
- package/app/src/lib/components/RenameDialog.svelte +143 -0
- package/app/src/lib/components/ResizeHandle.svelte +100 -0
- package/app/src/lib/components/RuneAttributes.svelte +197 -0
- package/app/src/lib/components/TagsInput.svelte +109 -0
- package/app/src/lib/editor/block-parser.ts +437 -0
- package/app/src/lib/preview/block-renderer.ts +74 -0
- package/dist/css.d.ts +6 -0
- package/dist/css.d.ts.map +1 -0
- package/dist/css.js +25 -0
- package/dist/css.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/layout-resolver.d.ts +59 -0
- package/dist/layout-resolver.d.ts.map +1 -0
- package/dist/layout-resolver.js +166 -0
- package/dist/layout-resolver.js.map +1 -0
- package/dist/preview-builder.d.ts +16 -0
- package/dist/preview-builder.d.ts.map +1 -0
- package/dist/preview-builder.js +77 -0
- package/dist/preview-builder.js.map +1 -0
- package/dist/preview.d.ts +12 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +70 -0
- package/dist/preview.js.map +1 -0
- package/dist/server.d.ts +26 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +694 -0
- package/dist/server.js.map +1 -0
- package/package.json +76 -0
- package/preview-runtime/App.svelte +59 -0
- package/preview-runtime/index.html +17 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync, rmSync, statSync, renameSync, watch } from 'node:fs';
|
|
3
|
+
import { basename, dirname } from 'node:path';
|
|
4
|
+
import { join, resolve, normalize, extname, relative } from 'node:path';
|
|
5
|
+
import { exec } from 'node:child_process';
|
|
6
|
+
import { ContentTree } from '@refrakt-md/content';
|
|
7
|
+
import { parseFrontmatter, serializeFrontmatter } from '@refrakt-md/content';
|
|
8
|
+
import { runes as allRunes, RUNE_EXAMPLES } from '@refrakt-md/runes';
|
|
9
|
+
import { createTransform } from '@refrakt-md/transform';
|
|
10
|
+
import { bundleCss } from './css.js';
|
|
11
|
+
import { renderPreviewPage, renderPreviewContent } from './preview.js';
|
|
12
|
+
import { createHighlightTransform } from '@refrakt-md/highlight';
|
|
13
|
+
import { buildPreviewRuntime } from './preview-builder.js';
|
|
14
|
+
import { LayoutResolver } from './layout-resolver.js';
|
|
15
|
+
const MIME_TYPES = {
|
|
16
|
+
'.html': 'text/html; charset=utf-8',
|
|
17
|
+
'.js': 'text/javascript; charset=utf-8',
|
|
18
|
+
'.css': 'text/css; charset=utf-8',
|
|
19
|
+
'.json': 'application/json',
|
|
20
|
+
'.svg': 'image/svg+xml',
|
|
21
|
+
'.png': 'image/png',
|
|
22
|
+
'.jpg': 'image/jpeg',
|
|
23
|
+
'.jpeg': 'image/jpeg',
|
|
24
|
+
'.gif': 'image/gif',
|
|
25
|
+
'.webp': 'image/webp',
|
|
26
|
+
'.avif': 'image/avif',
|
|
27
|
+
'.ico': 'image/x-icon',
|
|
28
|
+
'.woff': 'font/woff',
|
|
29
|
+
'.woff2': 'font/woff2',
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the path to the built frontend (app/dist).
|
|
33
|
+
* Works from both the compiled dist/ directory and the source src/ directory.
|
|
34
|
+
*/
|
|
35
|
+
function resolveAppDist() {
|
|
36
|
+
// import.meta.dirname gives us the directory of THIS file.
|
|
37
|
+
// In compiled form: packages/editor/dist/
|
|
38
|
+
// We need: packages/editor/app/dist/
|
|
39
|
+
const thisDir = import.meta.dirname;
|
|
40
|
+
const appDist = resolve(thisDir, '..', 'app', 'dist');
|
|
41
|
+
return appDist;
|
|
42
|
+
}
|
|
43
|
+
export async function startEditor(options) {
|
|
44
|
+
const { contentDir, port = 4800, themeConfig, themeCssPath, themeSveltePath, staticDir, devServer, open = true, configPath, } = options;
|
|
45
|
+
let routeRules = options.routeRules ?? [];
|
|
46
|
+
const absContentDir = resolve(contentDir);
|
|
47
|
+
const appDistDir = resolveAppDist();
|
|
48
|
+
// ── Own-write suppression ────────────────────────────────────
|
|
49
|
+
// When the server writes a file, record the path so the watcher
|
|
50
|
+
// can skip the resulting fs event. Entries expire after 2 seconds.
|
|
51
|
+
const ownWrites = new Map();
|
|
52
|
+
function markOwnWrite(relPath) {
|
|
53
|
+
ownWrites.set(relPath, Date.now() + 2000);
|
|
54
|
+
}
|
|
55
|
+
function isOwnWrite(relPath) {
|
|
56
|
+
const deadline = ownWrites.get(relPath);
|
|
57
|
+
if (!deadline)
|
|
58
|
+
return false;
|
|
59
|
+
if (Date.now() > deadline) {
|
|
60
|
+
ownWrites.delete(relPath);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
ownWrites.delete(relPath);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
const sseClients = new Set();
|
|
67
|
+
function broadcastSSE(event, data) {
|
|
68
|
+
const payload = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
|
|
69
|
+
for (const client of sseClients) {
|
|
70
|
+
client.write(payload);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Bundle theme CSS once on startup
|
|
74
|
+
let themeCss = '';
|
|
75
|
+
if (themeCssPath && existsSync(themeCssPath)) {
|
|
76
|
+
themeCss = bundleCss(themeCssPath);
|
|
77
|
+
}
|
|
78
|
+
// Initialize syntax highlighting (Shiki)
|
|
79
|
+
const highlightTransform = await createHighlightTransform();
|
|
80
|
+
if (highlightTransform.css) {
|
|
81
|
+
themeCss += '\n' + highlightTransform.css;
|
|
82
|
+
}
|
|
83
|
+
// Build Svelte preview runtime if theme has a Svelte entry
|
|
84
|
+
let previewRuntimeDir = null;
|
|
85
|
+
if (themeSveltePath) {
|
|
86
|
+
const result = await buildPreviewRuntime(themeSveltePath);
|
|
87
|
+
if (result.success) {
|
|
88
|
+
previewRuntimeDir = result.outputDir;
|
|
89
|
+
console.log(' Preview runtime: built \u2713');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Initialize layout resolver for full-page preview with layouts
|
|
93
|
+
const layoutResolver = new LayoutResolver(absContentDir, themeConfig);
|
|
94
|
+
await layoutResolver.refresh();
|
|
95
|
+
// Create identity transform once (reused across preview requests)
|
|
96
|
+
const identityTransform = createTransform(themeConfig);
|
|
97
|
+
const server = createServer(async (req, res) => {
|
|
98
|
+
try {
|
|
99
|
+
const url = new URL(req.url, `http://localhost:${port}`);
|
|
100
|
+
const method = req.method ?? 'GET';
|
|
101
|
+
// CORS headers for development
|
|
102
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
103
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS');
|
|
104
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
105
|
+
if (method === 'OPTIONS') {
|
|
106
|
+
res.writeHead(204);
|
|
107
|
+
res.end();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
// API routes
|
|
111
|
+
if (method === 'GET' && url.pathname === '/api/tree') {
|
|
112
|
+
await handleGetTree(res, absContentDir);
|
|
113
|
+
}
|
|
114
|
+
else if (method === 'GET' && url.pathname.startsWith('/api/files/')) {
|
|
115
|
+
const filePath = decodeURIComponent(url.pathname.slice('/api/files/'.length));
|
|
116
|
+
handleGetFile(res, absContentDir, filePath);
|
|
117
|
+
}
|
|
118
|
+
else if (method === 'PUT' && url.pathname.startsWith('/api/files/')) {
|
|
119
|
+
const filePath = decodeURIComponent(url.pathname.slice('/api/files/'.length));
|
|
120
|
+
markOwnWrite(filePath);
|
|
121
|
+
await handlePutFile(req, res, absContentDir, filePath);
|
|
122
|
+
// Refresh layout resolver so layout changes propagate to preview
|
|
123
|
+
layoutResolver.refresh().catch(() => { });
|
|
124
|
+
}
|
|
125
|
+
else if (method === 'GET' && url.pathname.startsWith('/api/preview/')) {
|
|
126
|
+
const filePath = decodeURIComponent(url.pathname.slice('/api/preview/'.length));
|
|
127
|
+
handlePreview(res, absContentDir, filePath, themeConfig, themeCss, highlightTransform);
|
|
128
|
+
}
|
|
129
|
+
else if (method === 'POST' && url.pathname === '/api/preview') {
|
|
130
|
+
await handlePreviewContent(req, res, themeConfig, themeCss, highlightTransform);
|
|
131
|
+
}
|
|
132
|
+
else if (method === 'POST' && url.pathname === '/api/pages') {
|
|
133
|
+
await handleCreatePage(req, res, absContentDir, markOwnWrite);
|
|
134
|
+
}
|
|
135
|
+
else if (method === 'POST' && url.pathname === '/api/directories') {
|
|
136
|
+
await handleCreateDirectory(req, res, absContentDir, markOwnWrite);
|
|
137
|
+
}
|
|
138
|
+
else if (method === 'POST' && url.pathname === '/api/rename') {
|
|
139
|
+
await handleRename(req, res, absContentDir, markOwnWrite);
|
|
140
|
+
}
|
|
141
|
+
else if (method === 'POST' && url.pathname === '/api/duplicate') {
|
|
142
|
+
await handleDuplicate(req, res, absContentDir, markOwnWrite);
|
|
143
|
+
}
|
|
144
|
+
else if (method === 'DELETE' && url.pathname.startsWith('/api/files/')) {
|
|
145
|
+
const filePath = decodeURIComponent(url.pathname.slice('/api/files/'.length));
|
|
146
|
+
markOwnWrite(filePath);
|
|
147
|
+
handleDelete(res, absContentDir, filePath);
|
|
148
|
+
}
|
|
149
|
+
else if (method === 'POST' && url.pathname === '/api/toggle-draft') {
|
|
150
|
+
await handleToggleDraft(req, res, absContentDir, markOwnWrite);
|
|
151
|
+
}
|
|
152
|
+
else if (method === 'GET' && url.pathname === '/api/pages-list') {
|
|
153
|
+
await handlePagesList(res, absContentDir);
|
|
154
|
+
}
|
|
155
|
+
else if (method === 'GET' && url.pathname === '/api/runes') {
|
|
156
|
+
handleGetRunes(res);
|
|
157
|
+
}
|
|
158
|
+
else if (method === 'GET' && url.pathname === '/api/config') {
|
|
159
|
+
serveJson(res, {
|
|
160
|
+
previewRuntime: previewRuntimeDir !== null,
|
|
161
|
+
devServerUrl: devServer ?? null,
|
|
162
|
+
themeCss,
|
|
163
|
+
themeConfig: stripFunctions(themeConfig),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
else if (method === 'GET' && url.pathname === '/api/route-rules') {
|
|
167
|
+
serveJson(res, { routeRules });
|
|
168
|
+
}
|
|
169
|
+
else if (method === 'PUT' && url.pathname === '/api/route-rules') {
|
|
170
|
+
if (!configPath) {
|
|
171
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
172
|
+
res.end(JSON.stringify({ error: 'No config file path available' }));
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
const body = await readBody(req);
|
|
176
|
+
const { routeRules: newRules } = JSON.parse(body);
|
|
177
|
+
// Update in-memory rules
|
|
178
|
+
routeRules = newRules;
|
|
179
|
+
// Read existing config, update routeRules field, write back
|
|
180
|
+
const configRaw = readFileSync(configPath, 'utf-8');
|
|
181
|
+
const config = JSON.parse(configRaw);
|
|
182
|
+
config.routeRules = newRules;
|
|
183
|
+
writeFileSync(configPath, JSON.stringify(config, null, '\t') + '\n', 'utf-8');
|
|
184
|
+
serveJson(res, { ok: true });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (method === 'POST' && url.pathname === '/api/preview-data') {
|
|
188
|
+
await handlePreviewData(req, res, layoutResolver, identityTransform, highlightTransform);
|
|
189
|
+
}
|
|
190
|
+
else if (method === 'GET' && url.pathname === '/api/events') {
|
|
191
|
+
// SSE endpoint — keep connection open for file-change push events
|
|
192
|
+
res.writeHead(200, {
|
|
193
|
+
'Content-Type': 'text/event-stream',
|
|
194
|
+
'Cache-Control': 'no-cache',
|
|
195
|
+
'Connection': 'keep-alive',
|
|
196
|
+
'Access-Control-Allow-Origin': '*',
|
|
197
|
+
});
|
|
198
|
+
res.write(': connected\n\n');
|
|
199
|
+
sseClients.add(res);
|
|
200
|
+
req.on('close', () => { sseClients.delete(res); });
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
else if (previewRuntimeDir && method === 'GET' && url.pathname === '/preview/theme.css') {
|
|
204
|
+
res.writeHead(200, { 'Content-Type': 'text/css; charset=utf-8' });
|
|
205
|
+
res.end(themeCss);
|
|
206
|
+
}
|
|
207
|
+
else if (previewRuntimeDir && method === 'GET' && url.pathname.startsWith('/preview/')) {
|
|
208
|
+
const file = url.pathname.slice('/preview/'.length) || 'index.html';
|
|
209
|
+
serveStatic(res, previewRuntimeDir, '/' + file);
|
|
210
|
+
}
|
|
211
|
+
else if (staticDir && method === 'GET' && !url.pathname.startsWith('/api/')) {
|
|
212
|
+
// Try project static dir first (images, fonts, etc.), then SPA fallback
|
|
213
|
+
const staticFile = join(staticDir, url.pathname);
|
|
214
|
+
if (staticFile.startsWith(staticDir) && existsSync(staticFile) && statSync(staticFile).isFile()) {
|
|
215
|
+
const ext = extname(staticFile);
|
|
216
|
+
const contentType = MIME_TYPES[ext] ?? 'application/octet-stream';
|
|
217
|
+
const content = readFileSync(staticFile);
|
|
218
|
+
res.writeHead(200, { 'Content-Type': contentType });
|
|
219
|
+
res.end(content);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
serveStatic(res, appDistDir, url.pathname);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else if (method === 'GET') {
|
|
226
|
+
// Serve static frontend (SPA fallback to index.html)
|
|
227
|
+
serveStatic(res, appDistDir, url.pathname);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
231
|
+
res.end(JSON.stringify({ error: 'Not Found' }));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
console.error('Server error:', err);
|
|
236
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
237
|
+
res.end(JSON.stringify({ error: 'Internal Server Error' }));
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
server.listen(port, '127.0.0.1', () => {
|
|
241
|
+
const url = `http://localhost:${port}`;
|
|
242
|
+
console.log(`\n refrakt editor running at ${url}\n`);
|
|
243
|
+
console.log(` Content directory: ${absContentDir}`);
|
|
244
|
+
if (staticDir)
|
|
245
|
+
console.log(` Static directory: ${staticDir}`);
|
|
246
|
+
if (devServer)
|
|
247
|
+
console.log(` Dev server: ${devServer}`);
|
|
248
|
+
console.log('');
|
|
249
|
+
if (open) {
|
|
250
|
+
const cmd = process.platform === 'darwin'
|
|
251
|
+
? 'open'
|
|
252
|
+
: process.platform === 'win32'
|
|
253
|
+
? 'start'
|
|
254
|
+
: 'xdg-open';
|
|
255
|
+
exec(`${cmd} ${url}`);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
// ── File watcher ─────────────────────────────────────────────
|
|
259
|
+
// Watch content directory for external changes (other editors, git, etc.)
|
|
260
|
+
const watchDebounce = new Map();
|
|
261
|
+
watch(absContentDir, { recursive: true }, (eventType, filename) => {
|
|
262
|
+
if (!filename)
|
|
263
|
+
return;
|
|
264
|
+
// Skip hidden files and directories (.DS_Store, .git, etc.)
|
|
265
|
+
if (filename.split('/').some(part => part.startsWith('.')))
|
|
266
|
+
return;
|
|
267
|
+
// Only care about markdown files
|
|
268
|
+
if (!filename.endsWith('.md'))
|
|
269
|
+
return;
|
|
270
|
+
const relPath = filename;
|
|
271
|
+
// Skip our own writes
|
|
272
|
+
if (isOwnWrite(relPath))
|
|
273
|
+
return;
|
|
274
|
+
// Debounce: coalesce rapid events for the same file (300ms)
|
|
275
|
+
clearTimeout(watchDebounce.get(relPath));
|
|
276
|
+
watchDebounce.set(relPath, setTimeout(() => {
|
|
277
|
+
watchDebounce.delete(relPath);
|
|
278
|
+
const fullPath = join(absContentDir, relPath);
|
|
279
|
+
let event;
|
|
280
|
+
if (eventType === 'rename') {
|
|
281
|
+
event = existsSync(fullPath) ? 'file-created' : 'file-deleted';
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
event = 'file-changed';
|
|
285
|
+
}
|
|
286
|
+
broadcastSSE(event, { path: relPath });
|
|
287
|
+
// Refresh layout resolver so layout changes propagate
|
|
288
|
+
layoutResolver.refresh().catch(() => { });
|
|
289
|
+
}, 300));
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
// ── Static file serving ──────────────────────────────────────────────────
|
|
293
|
+
function serveStatic(res, appDistDir, pathname) {
|
|
294
|
+
// Try exact file first, then fall back to index.html (SPA routing)
|
|
295
|
+
let filePath = join(appDistDir, pathname === '/' ? 'index.html' : pathname);
|
|
296
|
+
if (!existsSync(filePath) || !filePath.startsWith(appDistDir)) {
|
|
297
|
+
// SPA fallback
|
|
298
|
+
filePath = join(appDistDir, 'index.html');
|
|
299
|
+
}
|
|
300
|
+
if (!existsSync(filePath)) {
|
|
301
|
+
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
302
|
+
res.end('Editor frontend not built. Run: npm run build -w packages/editor');
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const ext = extname(filePath);
|
|
306
|
+
const contentType = MIME_TYPES[ext] ?? 'application/octet-stream';
|
|
307
|
+
const content = readFileSync(filePath);
|
|
308
|
+
res.writeHead(200, { 'Content-Type': contentType });
|
|
309
|
+
res.end(content);
|
|
310
|
+
}
|
|
311
|
+
// ── Route handlers ──────────────────────────────────────────────────────
|
|
312
|
+
async function handleGetTree(res, contentDir) {
|
|
313
|
+
const tree = await ContentTree.fromDirectory(contentDir);
|
|
314
|
+
serveJson(res, directoryToJson(tree.root, contentDir));
|
|
315
|
+
}
|
|
316
|
+
function handleGetFile(res, contentDir, filePath) {
|
|
317
|
+
const fullPath = safePath(contentDir, filePath);
|
|
318
|
+
if (!fullPath) {
|
|
319
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
320
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (!existsSync(fullPath)) {
|
|
324
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
325
|
+
res.end(JSON.stringify({ error: 'File not found' }));
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const raw = readFileSync(fullPath, 'utf-8');
|
|
329
|
+
const { frontmatter, content } = parseFrontmatter(raw);
|
|
330
|
+
serveJson(res, { path: filePath, frontmatter, content, raw });
|
|
331
|
+
}
|
|
332
|
+
async function handlePutFile(req, res, contentDir, filePath) {
|
|
333
|
+
const fullPath = safePath(contentDir, filePath);
|
|
334
|
+
if (!fullPath) {
|
|
335
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
336
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const body = await readBody(req);
|
|
340
|
+
const { content } = JSON.parse(body);
|
|
341
|
+
writeFileSync(fullPath, content, 'utf-8');
|
|
342
|
+
serveJson(res, { ok: true, path: filePath });
|
|
343
|
+
}
|
|
344
|
+
function handlePreview(res, contentDir, filePath, themeConfig, themeCss, highlight) {
|
|
345
|
+
const fullPath = safePath(contentDir, filePath);
|
|
346
|
+
if (!fullPath) {
|
|
347
|
+
res.writeHead(403, { 'Content-Type': 'text/plain' });
|
|
348
|
+
res.end('Forbidden');
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (!existsSync(fullPath)) {
|
|
352
|
+
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
353
|
+
res.end('File not found');
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const html = renderPreviewPage(contentDir, filePath, themeConfig, themeCss, highlight);
|
|
357
|
+
serveHtml(res, html);
|
|
358
|
+
}
|
|
359
|
+
async function handlePreviewContent(req, res, themeConfig, themeCss, highlight) {
|
|
360
|
+
const body = await readBody(req);
|
|
361
|
+
const { content } = JSON.parse(body);
|
|
362
|
+
const html = renderPreviewContent(content, themeConfig, themeCss, highlight);
|
|
363
|
+
serveHtml(res, html);
|
|
364
|
+
}
|
|
365
|
+
async function handlePreviewData(req, res, resolver, transform, highlight) {
|
|
366
|
+
const body = await readBody(req);
|
|
367
|
+
const { path, content } = JSON.parse(body);
|
|
368
|
+
const isLayout = path.endsWith('_layout.md');
|
|
369
|
+
const data = isLayout
|
|
370
|
+
? resolver.buildLayoutPreviewData(path, content, transform, highlight)
|
|
371
|
+
: resolver.buildPreviewData(path, content, transform, highlight);
|
|
372
|
+
serveJson(res, data);
|
|
373
|
+
}
|
|
374
|
+
// ── File operation handlers ──────────────────────────────────────────────
|
|
375
|
+
const SLUG_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
376
|
+
const PAGE_TEMPLATES = {
|
|
377
|
+
blank: (title) => ({ title }),
|
|
378
|
+
blog: (title) => ({ title, date: new Date().toISOString().slice(0, 10), tags: [] }),
|
|
379
|
+
docs: (title) => ({ title, order: 0 }),
|
|
380
|
+
};
|
|
381
|
+
async function handleCreatePage(req, res, contentDir, markOwnWrite) {
|
|
382
|
+
const body = await readBody(req);
|
|
383
|
+
const { directory = '', slug, title, template = 'blank', draft } = JSON.parse(body);
|
|
384
|
+
if (!slug || !SLUG_RE.test(slug)) {
|
|
385
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
386
|
+
res.end(JSON.stringify({ error: 'Invalid slug. Use lowercase alphanumeric and hyphens.' }));
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
const dirPath = safePath(contentDir, directory);
|
|
390
|
+
if (!dirPath) {
|
|
391
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
392
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const fileName = `${slug}.md`;
|
|
396
|
+
const fullPath = join(dirPath, fileName);
|
|
397
|
+
if (existsSync(fullPath)) {
|
|
398
|
+
res.writeHead(409, { 'Content-Type': 'application/json' });
|
|
399
|
+
res.end(JSON.stringify({ error: 'File already exists' }));
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const templateFn = PAGE_TEMPLATES[template] ?? PAGE_TEMPLATES.blank;
|
|
403
|
+
const fm = templateFn(title);
|
|
404
|
+
if (draft)
|
|
405
|
+
fm.draft = true;
|
|
406
|
+
const content = serializeFrontmatter(fm, '\n');
|
|
407
|
+
writeFileSync(fullPath, content, 'utf-8');
|
|
408
|
+
const relativePath = directory ? `${directory}/${fileName}` : fileName;
|
|
409
|
+
markOwnWrite(relativePath);
|
|
410
|
+
serveJson(res, { ok: true, path: relativePath });
|
|
411
|
+
}
|
|
412
|
+
async function handleCreateDirectory(req, res, contentDir, markOwnWrite) {
|
|
413
|
+
const body = await readBody(req);
|
|
414
|
+
const { parent = '', name, createLayout } = JSON.parse(body);
|
|
415
|
+
if (!name || !SLUG_RE.test(name)) {
|
|
416
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
417
|
+
res.end(JSON.stringify({ error: 'Invalid directory name. Use lowercase alphanumeric and hyphens.' }));
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const parentPath = safePath(contentDir, parent);
|
|
421
|
+
if (!parentPath) {
|
|
422
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
423
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const dirPath = join(parentPath, name);
|
|
427
|
+
if (existsSync(dirPath)) {
|
|
428
|
+
res.writeHead(409, { 'Content-Type': 'application/json' });
|
|
429
|
+
res.end(JSON.stringify({ error: 'Directory already exists' }));
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
mkdirSync(dirPath, { recursive: true });
|
|
433
|
+
if (createLayout) {
|
|
434
|
+
const layoutContent = serializeFrontmatter({ title: name }, '\n');
|
|
435
|
+
const layoutRelPath = parent ? `${parent}/${name}/_layout.md` : `${name}/_layout.md`;
|
|
436
|
+
markOwnWrite(layoutRelPath);
|
|
437
|
+
writeFileSync(join(dirPath, '_layout.md'), layoutContent, 'utf-8');
|
|
438
|
+
}
|
|
439
|
+
const relativePath = parent ? `${parent}/${name}` : name;
|
|
440
|
+
serveJson(res, { ok: true, path: relativePath });
|
|
441
|
+
}
|
|
442
|
+
async function handleRename(req, res, contentDir, markOwnWrite) {
|
|
443
|
+
const body = await readBody(req);
|
|
444
|
+
const { oldPath, newName } = JSON.parse(body);
|
|
445
|
+
const fullOld = safePath(contentDir, oldPath);
|
|
446
|
+
if (!fullOld) {
|
|
447
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
448
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (!existsSync(fullOld)) {
|
|
452
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
453
|
+
res.end(JSON.stringify({ error: 'File not found' }));
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
const dir = dirname(fullOld);
|
|
457
|
+
const fullNew = join(dir, newName);
|
|
458
|
+
if (!fullNew.startsWith(contentDir)) {
|
|
459
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
460
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (existsSync(fullNew)) {
|
|
464
|
+
res.writeHead(409, { 'Content-Type': 'application/json' });
|
|
465
|
+
res.end(JSON.stringify({ error: 'Target name already exists' }));
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
renameSync(fullOld, fullNew);
|
|
469
|
+
const parentRelative = dirname(oldPath);
|
|
470
|
+
const newPath = parentRelative === '.' ? newName : `${parentRelative}/${newName}`;
|
|
471
|
+
markOwnWrite(oldPath);
|
|
472
|
+
markOwnWrite(newPath);
|
|
473
|
+
serveJson(res, { ok: true, oldPath, newPath });
|
|
474
|
+
}
|
|
475
|
+
async function handleDuplicate(req, res, contentDir, markOwnWrite) {
|
|
476
|
+
const body = await readBody(req);
|
|
477
|
+
const { path: filePath } = JSON.parse(body);
|
|
478
|
+
const fullPath = safePath(contentDir, filePath);
|
|
479
|
+
if (!fullPath) {
|
|
480
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
481
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
if (!existsSync(fullPath)) {
|
|
485
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
486
|
+
res.end(JSON.stringify({ error: 'File not found' }));
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const dir = dirname(fullPath);
|
|
490
|
+
const name = basename(fullPath);
|
|
491
|
+
const ext = extname(name);
|
|
492
|
+
const base = name.slice(0, -ext.length);
|
|
493
|
+
let copyName = `${base}-copy${ext}`;
|
|
494
|
+
let counter = 2;
|
|
495
|
+
while (existsSync(join(dir, copyName))) {
|
|
496
|
+
copyName = `${base}-copy-${counter}${ext}`;
|
|
497
|
+
counter++;
|
|
498
|
+
}
|
|
499
|
+
copyFileSync(fullPath, join(dir, copyName));
|
|
500
|
+
const parentRelative = dirname(filePath);
|
|
501
|
+
const newPath = parentRelative === '.' ? copyName : `${parentRelative}/${copyName}`;
|
|
502
|
+
markOwnWrite(newPath);
|
|
503
|
+
serveJson(res, { ok: true, path: newPath });
|
|
504
|
+
}
|
|
505
|
+
function handleDelete(res, contentDir, filePath) {
|
|
506
|
+
const fullPath = safePath(contentDir, filePath);
|
|
507
|
+
if (!fullPath) {
|
|
508
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
509
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
if (!existsSync(fullPath)) {
|
|
513
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
514
|
+
res.end(JSON.stringify({ error: 'Not found' }));
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
const stat = statSync(fullPath);
|
|
518
|
+
rmSync(fullPath, { recursive: stat.isDirectory() });
|
|
519
|
+
serveJson(res, { ok: true });
|
|
520
|
+
}
|
|
521
|
+
async function handleToggleDraft(req, res, contentDir, markOwnWrite) {
|
|
522
|
+
const body = await readBody(req);
|
|
523
|
+
const { path: filePath } = JSON.parse(body);
|
|
524
|
+
const fullPath = safePath(contentDir, filePath);
|
|
525
|
+
if (!fullPath) {
|
|
526
|
+
res.writeHead(403, { 'Content-Type': 'application/json' });
|
|
527
|
+
res.end(JSON.stringify({ error: 'Forbidden' }));
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
if (!existsSync(fullPath)) {
|
|
531
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
532
|
+
res.end(JSON.stringify({ error: 'File not found' }));
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
const raw = readFileSync(fullPath, 'utf-8');
|
|
536
|
+
const { frontmatter, content } = parseFrontmatter(raw);
|
|
537
|
+
if (frontmatter.draft) {
|
|
538
|
+
delete frontmatter.draft;
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
frontmatter.draft = true;
|
|
542
|
+
}
|
|
543
|
+
const newRaw = serializeFrontmatter(frontmatter, content);
|
|
544
|
+
markOwnWrite(filePath);
|
|
545
|
+
writeFileSync(fullPath, newRaw, 'utf-8');
|
|
546
|
+
serveJson(res, { ok: true, draft: frontmatter.draft ?? false });
|
|
547
|
+
}
|
|
548
|
+
async function handlePagesList(res, contentDir) {
|
|
549
|
+
const tree = await ContentTree.fromDirectory(contentDir);
|
|
550
|
+
const pages = [];
|
|
551
|
+
function walk(dir) {
|
|
552
|
+
for (const page of dir.pages) {
|
|
553
|
+
const name = page.relativePath.split('/').pop();
|
|
554
|
+
const slug = name.replace(/\.md$/, '');
|
|
555
|
+
const { frontmatter } = parseFrontmatter(page.raw);
|
|
556
|
+
pages.push({
|
|
557
|
+
slug,
|
|
558
|
+
path: page.relativePath,
|
|
559
|
+
title: frontmatter.title || slug,
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
for (const child of dir.children) {
|
|
563
|
+
walk(child);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
walk(tree.root);
|
|
567
|
+
serveJson(res, { pages });
|
|
568
|
+
}
|
|
569
|
+
// ── Rune metadata ────────────────────────────────────────────────────────
|
|
570
|
+
const CHILD_RUNES = new Set([
|
|
571
|
+
'tab', 'step', 'tier', 'accordion-item', 'timeline-entry', 'changelog-release',
|
|
572
|
+
'cast-member', 'conversation-message', 'reveal-step', 'bento-cell',
|
|
573
|
+
'storyboard-panel', 'note', 'form-field', 'comparison-column', 'comparison-row',
|
|
574
|
+
'symbol-group', 'symbol-member', 'map-pin', 'definition', 'region',
|
|
575
|
+
]);
|
|
576
|
+
const RUNE_CATEGORIES = {
|
|
577
|
+
hero: 'Section', cta: 'Section', feature: 'Section', pricing: 'Section',
|
|
578
|
+
comparison: 'Section', testimonial: 'Section',
|
|
579
|
+
hint: 'Content', steps: 'Content', sidenote: 'Content', figure: 'Content',
|
|
580
|
+
details: 'Content', embed: 'Content', icon: 'Content', form: 'Content',
|
|
581
|
+
grid: 'Layout', tabs: 'Layout', accordion: 'Layout', bento: 'Layout',
|
|
582
|
+
reveal: 'Layout', annotate: 'Layout',
|
|
583
|
+
codegroup: 'Code & Data', compare: 'Code & Data', diff: 'Code & Data',
|
|
584
|
+
api: 'Code & Data', symbol: 'Code & Data', datatable: 'Code & Data',
|
|
585
|
+
chart: 'Code & Data', diagram: 'Code & Data', preview: 'Code & Data',
|
|
586
|
+
sandbox: 'Code & Data',
|
|
587
|
+
recipe: 'Semantic', howto: 'Semantic', event: 'Semantic', cast: 'Semantic',
|
|
588
|
+
organization: 'Semantic', timeline: 'Semantic', changelog: 'Semantic',
|
|
589
|
+
conversation: 'Semantic', storyboard: 'Semantic', map: 'Semantic',
|
|
590
|
+
'music-playlist': 'Semantic', 'music-recording': 'Semantic', error: 'Semantic',
|
|
591
|
+
swatch: 'Design', palette: 'Design', typography: 'Design',
|
|
592
|
+
spacing: 'Design', 'design-context': 'Design',
|
|
593
|
+
nav: 'Site', layout: 'Site', toc: 'Site', breadcrumb: 'Site',
|
|
594
|
+
};
|
|
595
|
+
let cachedRuneData = null;
|
|
596
|
+
function handleGetRunes(res) {
|
|
597
|
+
if (!cachedRuneData) {
|
|
598
|
+
cachedRuneData = [];
|
|
599
|
+
for (const rune of Object.values(allRunes)) {
|
|
600
|
+
if (CHILD_RUNES.has(rune.name))
|
|
601
|
+
continue;
|
|
602
|
+
const attrs = {};
|
|
603
|
+
if (rune.schema.attributes) {
|
|
604
|
+
for (const [name, attr] of Object.entries(rune.schema.attributes)) {
|
|
605
|
+
const typeName = typeof attr.type === 'function'
|
|
606
|
+
? attr.type.name
|
|
607
|
+
: Array.isArray(attr.type)
|
|
608
|
+
? attr.type.map((t) => t.name ?? 'unknown').join(' | ')
|
|
609
|
+
: 'String';
|
|
610
|
+
attrs[name] = {
|
|
611
|
+
type: typeName,
|
|
612
|
+
required: attr.required ?? false,
|
|
613
|
+
...(Array.isArray(attr.matches) ? { values: attr.matches.map(String) } : {}),
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
cachedRuneData.push({
|
|
618
|
+
name: rune.name,
|
|
619
|
+
aliases: rune.aliases,
|
|
620
|
+
description: rune.description,
|
|
621
|
+
selfClosing: rune.schema.selfClosing ?? false,
|
|
622
|
+
category: RUNE_CATEGORIES[rune.name] ?? 'Other',
|
|
623
|
+
attributes: attrs,
|
|
624
|
+
example: RUNE_EXAMPLES[rune.name],
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
serveJson(res, { runes: cachedRuneData });
|
|
629
|
+
}
|
|
630
|
+
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
631
|
+
/** Resolve a user-provided path within contentDir, returning null if it escapes */
|
|
632
|
+
function safePath(contentDir, filePath) {
|
|
633
|
+
const full = normalize(join(contentDir, filePath));
|
|
634
|
+
if (!full.startsWith(contentDir))
|
|
635
|
+
return null;
|
|
636
|
+
return full;
|
|
637
|
+
}
|
|
638
|
+
function readBody(req) {
|
|
639
|
+
return new Promise((resolve, reject) => {
|
|
640
|
+
let data = '';
|
|
641
|
+
req.on('data', chunk => { data += chunk; });
|
|
642
|
+
req.on('end', () => resolve(data));
|
|
643
|
+
req.on('error', reject);
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function directoryToJson(dir, rootDir) {
|
|
647
|
+
const dirRelPath = relative(rootDir, dir.dirPath);
|
|
648
|
+
const node = {
|
|
649
|
+
name: dir.name,
|
|
650
|
+
type: 'directory',
|
|
651
|
+
path: dirRelPath || '',
|
|
652
|
+
children: [],
|
|
653
|
+
};
|
|
654
|
+
if (dir.layout) {
|
|
655
|
+
const { frontmatter } = parseFrontmatter(dir.layout.raw);
|
|
656
|
+
node.layout = {
|
|
657
|
+
name: '_layout.md',
|
|
658
|
+
type: 'layout',
|
|
659
|
+
path: dir.layout.relativePath,
|
|
660
|
+
draft: frontmatter.draft,
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
for (const page of dir.pages) {
|
|
664
|
+
const { frontmatter } = parseFrontmatter(page.raw);
|
|
665
|
+
node.children.push({
|
|
666
|
+
name: page.relativePath.split('/').pop(),
|
|
667
|
+
type: 'page',
|
|
668
|
+
path: page.relativePath,
|
|
669
|
+
draft: frontmatter.draft,
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
for (const child of dir.children) {
|
|
673
|
+
node.children.push(directoryToJson(child, rootDir));
|
|
674
|
+
}
|
|
675
|
+
return node;
|
|
676
|
+
}
|
|
677
|
+
function serveJson(res, data) {
|
|
678
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
679
|
+
res.end(JSON.stringify(data, null, 2));
|
|
680
|
+
}
|
|
681
|
+
function serveHtml(res, html) {
|
|
682
|
+
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
683
|
+
res.end(html);
|
|
684
|
+
}
|
|
685
|
+
/** Strip non-serializable function values (postTransform) from ThemeConfig for JSON transport */
|
|
686
|
+
function stripFunctions(config) {
|
|
687
|
+
const runes = {};
|
|
688
|
+
for (const [name, rune] of Object.entries(config.runes)) {
|
|
689
|
+
const { postTransform, ...rest } = rune;
|
|
690
|
+
runes[name] = rest;
|
|
691
|
+
}
|
|
692
|
+
return { ...config, runes };
|
|
693
|
+
}
|
|
694
|
+
//# sourceMappingURL=server.js.map
|