@sanurb/ringi 0.2.0 → 0.3.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/dist/cli.mjs +2132 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/mcp.mjs +1057 -0
- package/dist/mcp.mjs.map +1 -0
- package/dist/runtime.mjs +3116 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +15 -14
- package/server/nitro.json +17 -0
- package/server/public/assets/ClientOnly-QdfAxyFs.js +1 -0
- package/server/public/assets/_reviewId-CmXHvWLn.js +1 -0
- package/server/public/assets/_reviewId-DdOpDx4U.js +1 -0
- package/server/public/assets/abap-B1dkBSPn.js +1 -0
- package/server/public/assets/action-bar-DLRNvLjj.js +45 -0
- package/server/public/assets/actionscript-3-BT4ibYlP.js +1 -0
- package/server/public/assets/ada-CD92zeps.js +1 -0
- package/server/public/assets/andromeeda-DqSmgxi0.js +1 -0
- package/server/public/assets/angular-html-BDC0PfKr.js +1 -0
- package/server/public/assets/angular-ts-B9yoQMtj.js +1 -0
- package/server/public/assets/apache-D5suuoa_.js +1 -0
- package/server/public/assets/apex-BL-m4VHy.js +1 -0
- package/server/public/assets/apl-CldhY0Pn.js +1 -0
- package/server/public/assets/applescript-CLiBqvKT.js +1 -0
- package/server/public/assets/ara-LdDF8cmv.js +1 -0
- package/server/public/assets/asciidoc-2DZ9hC2N.js +1 -0
- package/server/public/assets/asm-0ZPGRSUy.js +1 -0
- package/server/public/assets/astro-DR6labZJ.js +1 -0
- package/server/public/assets/aurora-x-Da7Zfvbg.js +1 -0
- package/server/public/assets/awk-Bn0gn_B_.js +1 -0
- package/server/public/assets/ayu-dark-bqYKoqpM.js +1 -0
- package/server/public/assets/ayu-light-C45jTIzZ.js +1 -0
- package/server/public/assets/ayu-mirage-BV_FCTQi.js +1 -0
- package/server/public/assets/ballerina-D2nw_w8Q.js +1 -0
- package/server/public/assets/bat-ByUBN5gS.js +1 -0
- package/server/public/assets/beancount-BTb2W6Mp.js +1 -0
- package/server/public/assets/berry-5SO2uITG.js +1 -0
- package/server/public/assets/bibtex-CDBTNfUI.js +1 -0
- package/server/public/assets/bicep-fgxG_4rP.js +1 -0
- package/server/public/assets/bird2-BCwzDhwX.js +1 -0
- package/server/public/assets/blade-BBTRu2-g.js +1 -0
- package/server/public/assets/bsl-CG-fq4sc.js +1 -0
- package/server/public/assets/c-CEvNj7xl.js +1 -0
- package/server/public/assets/c3-Dlaci63_.js +1 -0
- package/server/public/assets/cadence-DHbRuEmm.js +1 -0
- package/server/public/assets/cairo-Ds0kTeYT.js +1 -0
- package/server/public/assets/catppuccin-frappe-DrL1fUuH.js +1 -0
- package/server/public/assets/catppuccin-latte-C0REgVjl.js +1 -0
- package/server/public/assets/catppuccin-macchiato-ChQpylWO.js +1 -0
- package/server/public/assets/catppuccin-mocha-Dd0JU1T0.js +1 -0
- package/server/public/assets/clarity-DMoTOm4G.js +1 -0
- package/server/public/assets/clojure-DBhE3PpS.js +1 -0
- package/server/public/assets/cmake-DwMc40Or.js +1 -0
- package/server/public/assets/cobol-BdNJSMRt.js +1 -0
- package/server/public/assets/codeowners-1lVr8wqV.js +1 -0
- package/server/public/assets/codeql-DWflolvo.js +1 -0
- package/server/public/assets/coffee-RA4xA24H.js +1 -0
- package/server/public/assets/common-lisp-CrVQ5xT-.js +1 -0
- package/server/public/assets/compiler-runtime-DZXZ41-q.js +1 -0
- package/server/public/assets/coq-CjfoyYSh.js +1 -0
- package/server/public/assets/cpp-BoW7e2Ow.js +1 -0
- package/server/public/assets/createServerFn-DTk395iP.js +9 -0
- package/server/public/assets/crystal-CYKRo3F9.js +1 -0
- package/server/public/assets/csharp-C7bIWP5y.js +1 -0
- package/server/public/assets/css-Ck2tii2d.js +1 -0
- package/server/public/assets/csv-DsAkDVtA.js +1 -0
- package/server/public/assets/cue-BWmQgbOB.js +1 -0
- package/server/public/assets/cypher-D-jVC50Q.js +1 -0
- package/server/public/assets/d-CaviyOrm.js +1 -0
- package/server/public/assets/dark-plus-DIrnwZt9.js +1 -0
- package/server/public/assets/dart-CZEi7JgC.js +1 -0
- package/server/public/assets/dax-BK-8zffy.js +1 -0
- package/server/public/assets/desktop-D3cjbL4D.js +1 -0
- package/server/public/assets/diff-sHAzLvlp.js +1 -0
- package/server/public/assets/docker--xs2Ng3w.js +1 -0
- package/server/public/assets/dotenv-Cm4nwcJ7.js +1 -0
- package/server/public/assets/dracula-CAUSusef.js +1 -0
- package/server/public/assets/dracula-soft-cjNkMFza.js +1 -0
- package/server/public/assets/dream-maker-fjmWTFCO.js +1 -0
- package/server/public/assets/edge-DxycC9wl.js +1 -0
- package/server/public/assets/elixir-B-50Er3p.js +1 -0
- package/server/public/assets/elm-B4-ygIVo.js +1 -0
- package/server/public/assets/emacs-lisp-CJzqStIa.js +1 -0
- package/server/public/assets/erb-DJvYE1L1.js +1 -0
- package/server/public/assets/erlang-C-m_88FN.js +1 -0
- package/server/public/assets/everforest-dark-DBpaSMx1.js +1 -0
- package/server/public/assets/everforest-light-CiGrXwia.js +1 -0
- package/server/public/assets/fennel-DRaXF7k8.js +1 -0
- package/server/public/assets/file-tree-CI3Xwwid.js +1907 -0
- package/server/public/assets/fish-Bn-Yh3Jj.js +1 -0
- package/server/public/assets/fluent-DF5F8Ks_.js +1 -0
- package/server/public/assets/fortran-fixed-form-Cx1lv7HN.js +1 -0
- package/server/public/assets/fortran-free-form-hCQHRqew.js +1 -0
- package/server/public/assets/fsharp-DC5k9sy2.js +1 -0
- package/server/public/assets/gdresource-D0EsKdgH.js +1 -0
- package/server/public/assets/gdscript-_C9_Hi_w.js +1 -0
- package/server/public/assets/gdshader-BW7b1X1Y.js +1 -0
- package/server/public/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/server/public/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/server/public/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/server/public/assets/genie-Ch_6TCHd.js +1 -0
- package/server/public/assets/gherkin-CaNUsmTq.js +1 -0
- package/server/public/assets/git-commit-BcFsuO5E.js +1 -0
- package/server/public/assets/git-rebase-ChGA-z50.js +1 -0
- package/server/public/assets/github-dark-B9ygjgg6.js +1 -0
- package/server/public/assets/github-dark-default-Br2bgYSx.js +1 -0
- package/server/public/assets/github-dark-dimmed-CmtqpPJ-.js +1 -0
- package/server/public/assets/github-dark-high-contrast-fSfmrZcC.js +1 -0
- package/server/public/assets/github-light-BZjUqfZl.js +1 -0
- package/server/public/assets/github-light-default-lIytXXhR.js +1 -0
- package/server/public/assets/github-light-high-contrast-BRrjFb7n.js +1 -0
- package/server/public/assets/gleam-DALMDpNs.js +1 -0
- package/server/public/assets/glimmer-js-maLb6ysA.js +1 -0
- package/server/public/assets/glimmer-ts-DGNr-OBA.js +1 -0
- package/server/public/assets/glsl-CmplqyQ1.js +1 -0
- package/server/public/assets/gn-DGjqrYN9.js +1 -0
- package/server/public/assets/gnuplot-BYckvgQI.js +1 -0
- package/server/public/assets/go-JycvP538.js +1 -0
- package/server/public/assets/graphql-VhP7n4--.js +1 -0
- package/server/public/assets/groovy-D5qMRONT.js +1 -0
- package/server/public/assets/gruvbox-dark-hard-M1dj1e6V.js +1 -0
- package/server/public/assets/gruvbox-dark-medium-cqq_ncQu.js +1 -0
- package/server/public/assets/gruvbox-dark-soft-B4QwL2a9.js +1 -0
- package/server/public/assets/gruvbox-light-hard-DLayMKOQ.js +1 -0
- package/server/public/assets/gruvbox-light-medium-D52XgPKf.js +1 -0
- package/server/public/assets/gruvbox-light-soft-Dola3KdD.js +1 -0
- package/server/public/assets/hack-BVSQ2bxM.js +1 -0
- package/server/public/assets/haml-CwTtRHoj.js +1 -0
- package/server/public/assets/handlebars-CcO01SVo.js +1 -0
- package/server/public/assets/haskell-ys7wPPEd.js +1 -0
- package/server/public/assets/haxe-94kiChn7.js +1 -0
- package/server/public/assets/hcl-DmHt_-wq.js +1 -0
- package/server/public/assets/hjson-xMmoJ0Gx.js +1 -0
- package/server/public/assets/hlsl-b-Pskdze.js +1 -0
- package/server/public/assets/horizon-BKMqttiR.js +1 -0
- package/server/public/assets/horizon-bright-HNkBlnm5.js +1 -0
- package/server/public/assets/houston-BkBSBSOQ.js +1 -0
- package/server/public/assets/html-derivative-Cz-cKMi2.js +1 -0
- package/server/public/assets/html-zQbUS8Is.js +1 -0
- package/server/public/assets/http-CaGQ9BgA.js +1 -0
- package/server/public/assets/hurl-BBoki9bg.js +1 -0
- package/server/public/assets/hxml-iQTOTWpM.js +1 -0
- package/server/public/assets/hy-DKl1XhBq.js +1 -0
- package/server/public/assets/imba-DPxkOTAg.js +1 -0
- package/server/public/assets/ini-lkLGq_1x.js +1 -0
- package/server/public/assets/java-LAx6oszV.js +1 -0
- package/server/public/assets/javascript-COqx-gKX.js +1 -0
- package/server/public/assets/jinja-x-G_qSCP.js +1 -0
- package/server/public/assets/jison-7oSeVkKJ.js +1 -0
- package/server/public/assets/json-sTLOVXhc.js +1 -0
- package/server/public/assets/json5-Cy6ypJuJ.js +1 -0
- package/server/public/assets/jsonc-Cw2ugYAK.js +1 -0
- package/server/public/assets/jsonl-Dp5_qBVH.js +1 -0
- package/server/public/assets/jsonnet-BTbmg_-u.js +1 -0
- package/server/public/assets/jssm-CnT7nPea.js +1 -0
- package/server/public/assets/jsx-zXeIBQLI.js +1 -0
- package/server/public/assets/julia-E-6Xm9nd.js +1 -0
- package/server/public/assets/just-D9n74gZy.js +1 -0
- package/server/public/assets/kanagawa-dragon-CxsBnuhV.js +1 -0
- package/server/public/assets/kanagawa-lotus-vHdxDDOS.js +1 -0
- package/server/public/assets/kanagawa-wave-CIkfTKWk.js +1 -0
- package/server/public/assets/kdl-BwK60g80.js +1 -0
- package/server/public/assets/kotlin-Dbd9Vi-v.js +1 -0
- package/server/public/assets/kusto-BuTk9usc.js +1 -0
- package/server/public/assets/laserwave-C0wf_d3o.js +1 -0
- package/server/public/assets/latex-D0t4RtEU.js +1 -0
- package/server/public/assets/lean-CYAW8bRN.js +1 -0
- package/server/public/assets/less-D4uen21c.js +1 -0
- package/server/public/assets/light-plus-oqYyWKEE.js +1 -0
- package/server/public/assets/liquid-BzXN12F6.js +1 -0
- package/server/public/assets/llvm-Z1xJzteV.js +1 -0
- package/server/public/assets/log-BGUxlsk3.js +1 -0
- package/server/public/assets/logo-wVUhvQ1b.js +1 -0
- package/server/public/assets/lua-B0Cg8RP4.js +1 -0
- package/server/public/assets/luau-rPFZzCmq.js +1 -0
- package/server/public/assets/main-FvxVz-kD.js +15 -0
- package/server/public/assets/make-BmPf6m0P.js +1 -0
- package/server/public/assets/markdown-AseU6zcW.js +1 -0
- package/server/public/assets/marko-BlRPXWOe.js +1 -0
- package/server/public/assets/material-theme-6_W6rQhR.js +1 -0
- package/server/public/assets/material-theme-darker-VPEo3Sem.js +1 -0
- package/server/public/assets/material-theme-lighter-CUhzCcZ9.js +1 -0
- package/server/public/assets/material-theme-ocean-B2JdsaGb.js +1 -0
- package/server/public/assets/material-theme-palenight-DhY-sklA.js +1 -0
- package/server/public/assets/matlab-BOj_BDQv.js +1 -0
- package/server/public/assets/mdc-FiVDZSZ4.js +1 -0
- package/server/public/assets/mdx-Cm6cDkDI.js +1 -0
- package/server/public/assets/mermaid-DLO-R4hv.js +1 -0
- package/server/public/assets/min-dark-D34a_pX7.js +1 -0
- package/server/public/assets/min-light-Cdd4KORE.js +1 -0
- package/server/public/assets/mipsasm-DYpHF-GA.js +1 -0
- package/server/public/assets/mojo-DqYVFv_G.js +1 -0
- package/server/public/assets/monokai-CDR4sQ2n.js +1 -0
- package/server/public/assets/moonbit-DRKee9wk.js +1 -0
- package/server/public/assets/move-DbRk6Vn9.js +1 -0
- package/server/public/assets/narrat-IOfmaXfb.js +1 -0
- package/server/public/assets/new-DOyplRwM.js +1 -0
- package/server/public/assets/nextflow-D-Ec_bsY.js +1 -0
- package/server/public/assets/nextflow-groovy-EYl0c2BQ.js +1 -0
- package/server/public/assets/nginx-3JLAqmJa.js +1 -0
- package/server/public/assets/night-owl-light-Bedht9b4.js +1 -0
- package/server/public/assets/night-owl-yQJ3-I0I.js +1 -0
- package/server/public/assets/nim-DyjFVMzT.js +1 -0
- package/server/public/assets/nix-C2IovEl2.js +1 -0
- package/server/public/assets/nord-BjZ63GNL.js +1 -0
- package/server/public/assets/nushell-BflTrRB5.js +1 -0
- package/server/public/assets/objective-c-GRClK1S7.js +1 -0
- package/server/public/assets/objective-cpp-l3qYw-v5.js +1 -0
- package/server/public/assets/ocaml-BBDyhyMH.js +1 -0
- package/server/public/assets/odin-jCJ7Js99.js +1 -0
- package/server/public/assets/one-dark-pro-PIx2Diul.js +1 -0
- package/server/public/assets/one-light-BFMEz49S.js +1 -0
- package/server/public/assets/openscad-Drf0LgCX.js +1 -0
- package/server/public/assets/pascal-BT2XAUTl.js +1 -0
- package/server/public/assets/perl-Dr47G_2Q.js +1 -0
- package/server/public/assets/php-BhBDWTJe.js +1 -0
- package/server/public/assets/pierre-dark-CTXzTLfO.js +1 -0
- package/server/public/assets/pierre-light-C_5rlJRo.js +1 -0
- package/server/public/assets/pkl-ML-dWShO.js +1 -0
- package/server/public/assets/plastic-BFI-Z5Z2.js +1 -0
- package/server/public/assets/plsql-0vd5cLro.js +1 -0
- package/server/public/assets/po-CbZ_uqQA.js +1 -0
- package/server/public/assets/poimandres-Cayhd01L.js +1 -0
- package/server/public/assets/polar-C4hfV8Nc.js +1 -0
- package/server/public/assets/postcss-osFUbTLw.js +1 -0
- package/server/public/assets/powerquery-CTlGUQPj.js +1 -0
- package/server/public/assets/powershell-DyZsOmuq.js +1 -0
- package/server/public/assets/preload-helper-D7oT-Xwl.js +20 -0
- package/server/public/assets/prisma-SS92PO_I.js +1 -0
- package/server/public/assets/prolog-B1O1NNVC.js +1 -0
- package/server/public/assets/proto-BWu3eZTs.js +1 -0
- package/server/public/assets/pug-Dij_IK5w.js +1 -0
- package/server/public/assets/puppet-tvtRVdr6.js +1 -0
- package/server/public/assets/purescript-Dtbpb7D-.js +1 -0
- package/server/public/assets/python-Dlk0Acio.js +1 -0
- package/server/public/assets/qml-qUwk3nhh.js +1 -0
- package/server/public/assets/qmldir-B-iEOngH.js +1 -0
- package/server/public/assets/qss-Ba0p-aHw.js +1 -0
- package/server/public/assets/r-WmtNicKM.js +1 -0
- package/server/public/assets/racket-BXDsxf2U.js +1 -0
- package/server/public/assets/raku-Dw1WWFXK.js +1 -0
- package/server/public/assets/razor-DaqiVx3Q.js +1 -0
- package/server/public/assets/red-BC3Ds49b.js +1 -0
- package/server/public/assets/reg-DXFHGaM4.js +1 -0
- package/server/public/assets/regexp-CiSWN5Ne.js +1 -0
- package/server/public/assets/rel-Dc5_Ytx2.js +1 -0
- package/server/public/assets/reviews-CJvVXRLH.js +1 -0
- package/server/public/assets/reviews-CfbuF6ib.js +1 -0
- package/server/public/assets/riscv-ZgswiWij.js +1 -0
- package/server/public/assets/ron-YghabWAH.js +1 -0
- package/server/public/assets/rose-pine-ByWLnVr3.js +1 -0
- package/server/public/assets/rose-pine-dawn-DBmeySrz.js +1 -0
- package/server/public/assets/rose-pine-moon-B9J-N3nK.js +1 -0
- package/server/public/assets/rosmsg-DTKmAsVH.js +1 -0
- package/server/public/assets/routes-DNxq1Fba.js +1 -0
- package/server/public/assets/routes-Dp0ODZ55.js +2 -0
- package/server/public/assets/rst-CP6xOYlY.js +1 -0
- package/server/public/assets/ruby-BXYLc1CM.js +1 -0
- package/server/public/assets/rust-nfXwuE6F.js +1 -0
- package/server/public/assets/sas-CFdtZutF.js +1 -0
- package/server/public/assets/sass-CbRjkld3.js +1 -0
- package/server/public/assets/scala-BzD3eypx.js +1 -0
- package/server/public/assets/scheme-D4d1PV1y.js +1 -0
- package/server/public/assets/scss-D8KhdObH.js +1 -0
- package/server/public/assets/sdbl-Cf-Ydnvx.js +1 -0
- package/server/public/assets/shaderlab-DGohHMiF.js +1 -0
- package/server/public/assets/shellscript-BHdEbumI.js +1 -0
- package/server/public/assets/shellsession-Dh-bxrap.js +1 -0
- package/server/public/assets/slack-dark-MszIyPZ2.js +1 -0
- package/server/public/assets/slack-ochin-tQ3Q0gE9.js +1 -0
- package/server/public/assets/smalltalk-_uWoArwn.js +1 -0
- package/server/public/assets/snazzy-light-9sniMEk5.js +1 -0
- package/server/public/assets/solarized-dark-CdD0Hxzv.js +1 -0
- package/server/public/assets/solarized-light-C-nsEdqF.js +1 -0
- package/server/public/assets/solidity-D6uC-xwP.js +1 -0
- package/server/public/assets/soy-cDuODfbT.js +1 -0
- package/server/public/assets/sparql-BgU2QITA.js +1 -0
- package/server/public/assets/splunk-LQYHRu14.js +1 -0
- package/server/public/assets/sql-CKZpK620.js +1 -0
- package/server/public/assets/ssh-config-B7BUl8Rd.js +1 -0
- package/server/public/assets/stata-BLJTbKOO.js +1 -0
- package/server/public/assets/styles-UDowwF7S.css +2 -0
- package/server/public/assets/stylus-Byjxdx_q.js +1 -0
- package/server/public/assets/surrealql-C96KvYaj.js +1 -0
- package/server/public/assets/svelte-Qnbj2GWx.js +1 -0
- package/server/public/assets/swift-BexLlMrU.js +1 -0
- package/server/public/assets/synthwave-84-BxMBwQMS.js +1 -0
- package/server/public/assets/system-verilog-DVGwm0mw.js +1 -0
- package/server/public/assets/systemd-H2IT3-p5.js +1 -0
- package/server/public/assets/talonscript-mKZIGM8n.js +1 -0
- package/server/public/assets/tasl-B7he_Ugr.js +1 -0
- package/server/public/assets/tcl-5mT3RxHH.js +1 -0
- package/server/public/assets/templ-CQPDll3D.js +1 -0
- package/server/public/assets/terraform-BZP0GLsT.js +1 -0
- package/server/public/assets/test-D7JRfog1.js +1 -0
- package/server/public/assets/tex-97QNLoBJ.js +1 -0
- package/server/public/assets/tokyo-night-CTPVdZt9.js +1 -0
- package/server/public/assets/toml-CTFA98he.js +1 -0
- package/server/public/assets/ts-tags-B8zlXe2n.js +1 -0
- package/server/public/assets/tsv-BayJtYdY.js +1 -0
- package/server/public/assets/tsx-VqRU8NCz.js +1 -0
- package/server/public/assets/turtle-TVCBh_kY.js +1 -0
- package/server/public/assets/twig-FTTF8rVk.js +1 -0
- package/server/public/assets/typescript-CuX0hIVY.js +1 -0
- package/server/public/assets/typespec-BUvaJDLF.js +1 -0
- package/server/public/assets/typst-8NBaY7Ec.js +1 -0
- package/server/public/assets/useStore-M3H8PB1v.js +1 -0
- package/server/public/assets/utils-DElCu2hq.js +1 -0
- package/server/public/assets/v-VihyTigi.js +1 -0
- package/server/public/assets/vala-DyFAPyX6.js +1 -0
- package/server/public/assets/vb-Dg1Iqi4J.js +1 -0
- package/server/public/assets/verilog-D2Xc-vhD.js +1 -0
- package/server/public/assets/vesper-DJbtqYNr.js +1 -0
- package/server/public/assets/vhdl-CU3BVeE7.js +1 -0
- package/server/public/assets/viml-hG2shuOW.js +1 -0
- package/server/public/assets/vitesse-black-DbG2gsc0.js +1 -0
- package/server/public/assets/vitesse-dark-B6WV4xXH.js +1 -0
- package/server/public/assets/vitesse-light-DC1pdD02.js +1 -0
- package/server/public/assets/vue-DXwaEU0U.js +1 -0
- package/server/public/assets/vue-html-QD7AJ6JJ.js +1 -0
- package/server/public/assets/vue-vine-Bh2m1D2Z.js +1 -0
- package/server/public/assets/vyper-C1wojIuk.js +1 -0
- package/server/public/assets/wasm-C6Y0s02M.js +1 -0
- package/server/public/assets/wasm-qTvCOSHz.js +1 -0
- package/server/public/assets/wenyan-BG5vPQF0.js +1 -0
- package/server/public/assets/wgsl-DrVb-Cub.js +1 -0
- package/server/public/assets/wikitext-PRC4s8sH.js +1 -0
- package/server/public/assets/wit-ChW5qvg_.js +1 -0
- package/server/public/assets/wolfram-B8mKuZSQ.js +1 -0
- package/server/public/assets/xml-BK-rcb5a.js +1 -0
- package/server/public/assets/xsl-dt-d2R7p.js +1 -0
- package/server/public/assets/yaml-UiXU3hGj.js +1 -0
- package/server/public/assets/zenscript-C-jEPC9j.js +1 -0
- package/server/public/assets/zig-EbnRGjcz.js +1 -0
- package/server/public/favicon.ico +0 -0
- package/server/public/logo192.png +0 -0
- package/server/public/logo512.png +0 -0
- package/server/public/manifest.json +25 -0
- package/server/public/robots.txt +3 -0
- package/server/public/tanstack-circle-logo.png +0 -0
- package/server/public/tanstack-word-logo-white.svg +1 -0
- package/server/server/_chunks/ssr-renderer.mjs +15 -0
- package/server/server/_libs/@floating-ui/core+[...].mjs +698 -0
- package/server/server/_libs/@floating-ui/dom+[...].mjs +644 -0
- package/server/server/_libs/@floating-ui/react-dom+[...].mjs +839 -0
- package/server/server/_libs/@pierre/diffs+[...].mjs +18578 -0
- package/server/server/_libs/@radix-ui/react-arrow+[...].mjs +174 -0
- package/server/server/_libs/@radix-ui/react-collection+[...].mjs +162 -0
- package/server/server/_libs/@radix-ui/react-dialog+[...].mjs +1666 -0
- package/server/server/_libs/@radix-ui/react-popper+[...].mjs +289 -0
- package/server/server/_libs/@radix-ui/react-radio-group+[...].mjs +420 -0
- package/server/server/_libs/@radix-ui/react-select+[...].mjs +990 -0
- package/server/server/_libs/@tanstack/react-router+[...].mjs +14113 -0
- package/server/server/_libs/_.mjs +2 -0
- package/server/server/_libs/chokidar+readdirp.mjs +1599 -0
- package/server/server/_libs/class-variance-authority+clsx.mjs +69 -0
- package/server/server/_libs/effect+[...].mjs +34047 -0
- package/server/server/_libs/h3+rou3+srvx.mjs +1195 -0
- package/server/server/_libs/hookable.mjs +41 -0
- package/server/server/_libs/lucide-react.mjs +298 -0
- package/server/server/_libs/pierre__theme.mjs +2668 -0
- package/server/server/_libs/radix-ui__number.mjs +6 -0
- package/server/server/_libs/radix-ui__primitive.mjs +9 -0
- package/server/server/_libs/radix-ui__react-direction.mjs +11 -0
- package/server/server/_libs/shiki.mjs +16 -0
- package/server/server/_libs/shikijs__langs.mjs +1355 -0
- package/server/server/_libs/shikijs__themes.mjs +262 -0
- package/server/server/_libs/tailwind-merge.mjs +1962 -0
- package/server/server/_libs/tanstack__history.mjs +342 -0
- package/server/server/_libs/tanstack__router-core.mjs +6 -0
- package/server/server/_libs/ufo.mjs +64 -0
- package/server/server/_reviewId-AWnOGz5k.mjs +33 -0
- package/server/server/_reviewId-Com4yOlc.mjs +29 -0
- package/server/server/_reviewId-DAhmekJ2.mjs +277 -0
- package/server/server/_reviewId-p9mhYVwa.mjs +18 -0
- package/server/server/_runtime.mjs +35 -0
- package/server/server/_ssr/action-bar-C68xGnWW.mjs +592 -0
- package/server/server/_ssr/api-handler-CstW2n82.mjs +189 -0
- package/server/server/_ssr/client-runtime-BoPuAEoA.mjs +245 -0
- package/server/server/_ssr/createServerRpc--0mcGlWK.mjs +12 -0
- package/server/server/_ssr/createSsrRpc-AwdiLXmF.mjs +16 -0
- package/server/server/_ssr/domain-rpc-3Ds9DPr0.mjs +287 -0
- package/server/server/_ssr/file-tree-CQ5w2GHh.mjs +1951 -0
- package/server/server/_ssr/load-scoped-diff-NL2XAcdz.mjs +45 -0
- package/server/server/_ssr/new-BKl_G2Ks.mjs +37 -0
- package/server/server/_ssr/new-BREdMFAM.mjs +12 -0
- package/server/server/_ssr/new-DCz5eHkb.mjs +137 -0
- package/server/server/_ssr/reviews-BL5Nsgst.mjs +7 -0
- package/server/server/_ssr/reviews-BoaEgGKs.mjs +100 -0
- package/server/server/_ssr/reviews-C7_NIhY8.mjs +19 -0
- package/server/server/_ssr/reviews-Dd69YBDa.mjs +12 -0
- package/server/server/_ssr/router-DLxN8FOm.mjs +415 -0
- package/server/server/_ssr/routes-D25G8OuS.mjs +80 -0
- package/server/server/_ssr/routes-lz0AN75A.mjs +929 -0
- package/server/server/_ssr/runtime-D9IbnMlF.mjs +1401 -0
- package/server/server/_ssr/server-runtime-D99qpmma.mjs +12 -0
- package/server/server/_ssr/ssr.mjs +5318 -0
- package/server/server/_ssr/start-BIQfOZtj.mjs +4 -0
- package/server/server/_ssr/test-CQdMYlqa.mjs +6 -0
- package/server/server/_ssr/todo-m_uUvxca.mjs +88 -0
- package/server/server/_ssr/use-keyboard-shortcuts-D5b1Mxpq.mjs +25 -0
- package/server/server/_ssr/utils-BuOt9_LA.mjs +8 -0
- package/server/server/_tanstack-start-manifest_v-CnL10NRH.mjs +71 -0
- package/server/server/index.mjs +2615 -0
- package/server/server/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/server/server/node_modules/detect-libc/lib/elf.js +39 -0
- package/server/server/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/server/server/node_modules/detect-libc/lib/process.js +24 -0
- package/server/server/node_modules/detect-libc/package.json +44 -0
- package/server/server/node_modules/msgpackr-extract/index.js +1 -0
- package/server/server/node_modules/msgpackr-extract/package.json +50 -0
- package/server/server/node_modules/node-gyp-build-optional-packages/index.js +6 -0
- package/server/server/node_modules/node-gyp-build-optional-packages/node-gyp-build.js +236 -0
- package/server/server/node_modules/node-gyp-build-optional-packages/package.json +32 -0
- package/server/server/node_modules/tslib/modules/index.js +70 -0
- package/server/server/node_modules/tslib/modules/package.json +3 -0
- package/server/server/node_modules/tslib/package.json +47 -0
- package/server/server/node_modules/tslib/tslib.js +484 -0
- package/server/server/package.json +12 -0
- package/dist/chunk-KMYSGMD3.js +0 -3526
- package/dist/chunk-KMYSGMD3.js.map +0 -1
- package/dist/cli.js +0 -1839
- package/dist/cli.js.map +0 -1
- package/dist/mcp.js +0 -1228
- package/dist/mcp.js.map +0 -1
|
@@ -0,0 +1,1599 @@
|
|
|
1
|
+
import { Readable } from "node:stream";
|
|
2
|
+
import { stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
3
|
+
import * as sp from "node:path";
|
|
4
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { lstat, open, readdir, realpath, stat as stat$1 } from "node:fs/promises";
|
|
6
|
+
import { type } from "node:os";
|
|
7
|
+
import { EventEmitter } from "node:events";
|
|
8
|
+
//#region ../../node_modules/.pnpm/readdirp@5.0.0/node_modules/readdirp/index.js
|
|
9
|
+
var EntryTypes = {
|
|
10
|
+
FILE_TYPE: "files",
|
|
11
|
+
DIR_TYPE: "directories",
|
|
12
|
+
FILE_DIR_TYPE: "files_directories",
|
|
13
|
+
EVERYTHING_TYPE: "all"
|
|
14
|
+
};
|
|
15
|
+
var defaultOptions = {
|
|
16
|
+
root: ".",
|
|
17
|
+
fileFilter: (_entryInfo) => true,
|
|
18
|
+
directoryFilter: (_entryInfo) => true,
|
|
19
|
+
type: EntryTypes.FILE_TYPE,
|
|
20
|
+
lstat: false,
|
|
21
|
+
depth: 2147483648,
|
|
22
|
+
alwaysStat: false,
|
|
23
|
+
highWaterMark: 4096
|
|
24
|
+
};
|
|
25
|
+
Object.freeze(defaultOptions);
|
|
26
|
+
var RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
|
|
27
|
+
var NORMAL_FLOW_ERRORS = new Set([
|
|
28
|
+
"ENOENT",
|
|
29
|
+
"EPERM",
|
|
30
|
+
"EACCES",
|
|
31
|
+
"ELOOP",
|
|
32
|
+
RECURSIVE_ERROR_CODE
|
|
33
|
+
]);
|
|
34
|
+
var ALL_TYPES = [
|
|
35
|
+
EntryTypes.DIR_TYPE,
|
|
36
|
+
EntryTypes.EVERYTHING_TYPE,
|
|
37
|
+
EntryTypes.FILE_DIR_TYPE,
|
|
38
|
+
EntryTypes.FILE_TYPE
|
|
39
|
+
];
|
|
40
|
+
var DIR_TYPES = new Set([
|
|
41
|
+
EntryTypes.DIR_TYPE,
|
|
42
|
+
EntryTypes.EVERYTHING_TYPE,
|
|
43
|
+
EntryTypes.FILE_DIR_TYPE
|
|
44
|
+
]);
|
|
45
|
+
var FILE_TYPES = new Set([
|
|
46
|
+
EntryTypes.EVERYTHING_TYPE,
|
|
47
|
+
EntryTypes.FILE_DIR_TYPE,
|
|
48
|
+
EntryTypes.FILE_TYPE
|
|
49
|
+
]);
|
|
50
|
+
var isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);
|
|
51
|
+
var wantBigintFsStats = process.platform === "win32";
|
|
52
|
+
var emptyFn = (_entryInfo) => true;
|
|
53
|
+
var normalizeFilter = (filter) => {
|
|
54
|
+
if (filter === void 0) return emptyFn;
|
|
55
|
+
if (typeof filter === "function") return filter;
|
|
56
|
+
if (typeof filter === "string") {
|
|
57
|
+
const fl = filter.trim();
|
|
58
|
+
return (entry) => entry.basename === fl;
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(filter)) {
|
|
61
|
+
const trItems = filter.map((item) => item.trim());
|
|
62
|
+
return (entry) => trItems.some((f) => entry.basename === f);
|
|
63
|
+
}
|
|
64
|
+
return emptyFn;
|
|
65
|
+
};
|
|
66
|
+
/** Readable readdir stream, emitting new files as they're being listed. */
|
|
67
|
+
var ReaddirpStream = class extends Readable {
|
|
68
|
+
parents;
|
|
69
|
+
reading;
|
|
70
|
+
parent;
|
|
71
|
+
_stat;
|
|
72
|
+
_maxDepth;
|
|
73
|
+
_wantsDir;
|
|
74
|
+
_wantsFile;
|
|
75
|
+
_wantsEverything;
|
|
76
|
+
_root;
|
|
77
|
+
_isDirent;
|
|
78
|
+
_statsProp;
|
|
79
|
+
_rdOptions;
|
|
80
|
+
_fileFilter;
|
|
81
|
+
_directoryFilter;
|
|
82
|
+
constructor(options = {}) {
|
|
83
|
+
super({
|
|
84
|
+
objectMode: true,
|
|
85
|
+
autoDestroy: true,
|
|
86
|
+
highWaterMark: options.highWaterMark
|
|
87
|
+
});
|
|
88
|
+
const opts = {
|
|
89
|
+
...defaultOptions,
|
|
90
|
+
...options
|
|
91
|
+
};
|
|
92
|
+
const { root, type } = opts;
|
|
93
|
+
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
94
|
+
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
95
|
+
const statMethod = opts.lstat ? lstat : stat$1;
|
|
96
|
+
if (wantBigintFsStats) this._stat = (path) => statMethod(path, { bigint: true });
|
|
97
|
+
else this._stat = statMethod;
|
|
98
|
+
this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
|
|
99
|
+
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
100
|
+
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
101
|
+
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
102
|
+
this._root = resolve(root);
|
|
103
|
+
this._isDirent = !opts.alwaysStat;
|
|
104
|
+
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
105
|
+
this._rdOptions = {
|
|
106
|
+
encoding: "utf8",
|
|
107
|
+
withFileTypes: this._isDirent
|
|
108
|
+
};
|
|
109
|
+
this.parents = [this._exploreDir(root, 1)];
|
|
110
|
+
this.reading = false;
|
|
111
|
+
this.parent = void 0;
|
|
112
|
+
}
|
|
113
|
+
async _read(batch) {
|
|
114
|
+
if (this.reading) return;
|
|
115
|
+
this.reading = true;
|
|
116
|
+
try {
|
|
117
|
+
while (!this.destroyed && batch > 0) {
|
|
118
|
+
const par = this.parent;
|
|
119
|
+
const fil = par && par.files;
|
|
120
|
+
if (fil && fil.length > 0) {
|
|
121
|
+
const { path, depth } = par;
|
|
122
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path));
|
|
123
|
+
const awaited = await Promise.all(slice);
|
|
124
|
+
for (const entry of awaited) {
|
|
125
|
+
if (!entry) continue;
|
|
126
|
+
if (this.destroyed) return;
|
|
127
|
+
const entryType = await this._getEntryType(entry);
|
|
128
|
+
if (entryType === "directory" && this._directoryFilter(entry)) {
|
|
129
|
+
if (depth <= this._maxDepth) this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
|
|
130
|
+
if (this._wantsDir) {
|
|
131
|
+
this.push(entry);
|
|
132
|
+
batch--;
|
|
133
|
+
}
|
|
134
|
+
} else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
|
|
135
|
+
if (this._wantsFile) {
|
|
136
|
+
this.push(entry);
|
|
137
|
+
batch--;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
const parent = this.parents.pop();
|
|
143
|
+
if (!parent) {
|
|
144
|
+
this.push(null);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
this.parent = await parent;
|
|
148
|
+
if (this.destroyed) return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} catch (error) {
|
|
152
|
+
this.destroy(error);
|
|
153
|
+
} finally {
|
|
154
|
+
this.reading = false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async _exploreDir(path, depth) {
|
|
158
|
+
let files;
|
|
159
|
+
try {
|
|
160
|
+
files = await readdir(path, this._rdOptions);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
this._onError(error);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
files,
|
|
166
|
+
depth,
|
|
167
|
+
path
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
async _formatEntry(dirent, path) {
|
|
171
|
+
let entry;
|
|
172
|
+
const basename = this._isDirent ? dirent.name : dirent;
|
|
173
|
+
try {
|
|
174
|
+
const fullPath = resolve(join(path, basename));
|
|
175
|
+
entry = {
|
|
176
|
+
path: relative(this._root, fullPath),
|
|
177
|
+
fullPath,
|
|
178
|
+
basename
|
|
179
|
+
};
|
|
180
|
+
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
181
|
+
} catch (err) {
|
|
182
|
+
this._onError(err);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
return entry;
|
|
186
|
+
}
|
|
187
|
+
_onError(err) {
|
|
188
|
+
if (isNormalFlowError(err) && !this.destroyed) this.emit("warn", err);
|
|
189
|
+
else this.destroy(err);
|
|
190
|
+
}
|
|
191
|
+
async _getEntryType(entry) {
|
|
192
|
+
if (!entry && this._statsProp in entry) return "";
|
|
193
|
+
const stats = entry[this._statsProp];
|
|
194
|
+
if (stats.isFile()) return "file";
|
|
195
|
+
if (stats.isDirectory()) return "directory";
|
|
196
|
+
if (stats && stats.isSymbolicLink()) {
|
|
197
|
+
const full = entry.fullPath;
|
|
198
|
+
try {
|
|
199
|
+
const entryRealPath = await realpath(full);
|
|
200
|
+
const entryRealPathStats = await lstat(entryRealPath);
|
|
201
|
+
if (entryRealPathStats.isFile()) return "file";
|
|
202
|
+
if (entryRealPathStats.isDirectory()) {
|
|
203
|
+
const len = entryRealPath.length;
|
|
204
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === sep) {
|
|
205
|
+
const recursiveError = /* @__PURE__ */ new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
206
|
+
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
207
|
+
return this._onError(recursiveError);
|
|
208
|
+
}
|
|
209
|
+
return "directory";
|
|
210
|
+
}
|
|
211
|
+
} catch (error) {
|
|
212
|
+
this._onError(error);
|
|
213
|
+
return "";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
_includeAsFile(entry) {
|
|
218
|
+
const stats = entry && entry[this._statsProp];
|
|
219
|
+
return stats && this._wantsEverything && !stats.isDirectory();
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Streaming version: Reads all files and directories in given root recursively.
|
|
224
|
+
* Consumes ~constant small amount of RAM.
|
|
225
|
+
* @param root Root directory
|
|
226
|
+
* @param options Options to specify root (start directory), filters and recursion depth
|
|
227
|
+
*/
|
|
228
|
+
function readdirp(root, options = {}) {
|
|
229
|
+
let type = options.entryType || options.type;
|
|
230
|
+
if (type === "both") type = EntryTypes.FILE_DIR_TYPE;
|
|
231
|
+
if (type) options.type = type;
|
|
232
|
+
if (!root) throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
|
|
233
|
+
else if (typeof root !== "string") throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
|
|
234
|
+
else if (type && !ALL_TYPES.includes(type)) throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
|
|
235
|
+
options.root = root;
|
|
236
|
+
return new ReaddirpStream(options);
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region ../../node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/handler.js
|
|
240
|
+
var STR_DATA = "data";
|
|
241
|
+
var STR_CLOSE = "close";
|
|
242
|
+
var EMPTY_FN = () => {};
|
|
243
|
+
var pl = process.platform;
|
|
244
|
+
var isWindows = pl === "win32";
|
|
245
|
+
var isMacos = pl === "darwin";
|
|
246
|
+
var isLinux = pl === "linux";
|
|
247
|
+
var isFreeBSD = pl === "freebsd";
|
|
248
|
+
var isIBMi = type() === "OS400";
|
|
249
|
+
var EVENTS = {
|
|
250
|
+
ALL: "all",
|
|
251
|
+
READY: "ready",
|
|
252
|
+
ADD: "add",
|
|
253
|
+
CHANGE: "change",
|
|
254
|
+
ADD_DIR: "addDir",
|
|
255
|
+
UNLINK: "unlink",
|
|
256
|
+
UNLINK_DIR: "unlinkDir",
|
|
257
|
+
RAW: "raw",
|
|
258
|
+
ERROR: "error"
|
|
259
|
+
};
|
|
260
|
+
var EV = EVENTS;
|
|
261
|
+
var THROTTLE_MODE_WATCH = "watch";
|
|
262
|
+
var statMethods = {
|
|
263
|
+
lstat,
|
|
264
|
+
stat: stat$1
|
|
265
|
+
};
|
|
266
|
+
var KEY_LISTENERS = "listeners";
|
|
267
|
+
var KEY_ERR = "errHandlers";
|
|
268
|
+
var KEY_RAW = "rawEmitters";
|
|
269
|
+
var HANDLER_KEYS = [
|
|
270
|
+
KEY_LISTENERS,
|
|
271
|
+
KEY_ERR,
|
|
272
|
+
KEY_RAW
|
|
273
|
+
];
|
|
274
|
+
var binaryExtensions = new Set([
|
|
275
|
+
"3dm",
|
|
276
|
+
"3ds",
|
|
277
|
+
"3g2",
|
|
278
|
+
"3gp",
|
|
279
|
+
"7z",
|
|
280
|
+
"a",
|
|
281
|
+
"aac",
|
|
282
|
+
"adp",
|
|
283
|
+
"afdesign",
|
|
284
|
+
"afphoto",
|
|
285
|
+
"afpub",
|
|
286
|
+
"ai",
|
|
287
|
+
"aif",
|
|
288
|
+
"aiff",
|
|
289
|
+
"alz",
|
|
290
|
+
"ape",
|
|
291
|
+
"apk",
|
|
292
|
+
"appimage",
|
|
293
|
+
"ar",
|
|
294
|
+
"arj",
|
|
295
|
+
"asf",
|
|
296
|
+
"au",
|
|
297
|
+
"avi",
|
|
298
|
+
"bak",
|
|
299
|
+
"baml",
|
|
300
|
+
"bh",
|
|
301
|
+
"bin",
|
|
302
|
+
"bk",
|
|
303
|
+
"bmp",
|
|
304
|
+
"btif",
|
|
305
|
+
"bz2",
|
|
306
|
+
"bzip2",
|
|
307
|
+
"cab",
|
|
308
|
+
"caf",
|
|
309
|
+
"cgm",
|
|
310
|
+
"class",
|
|
311
|
+
"cmx",
|
|
312
|
+
"cpio",
|
|
313
|
+
"cr2",
|
|
314
|
+
"cur",
|
|
315
|
+
"dat",
|
|
316
|
+
"dcm",
|
|
317
|
+
"deb",
|
|
318
|
+
"dex",
|
|
319
|
+
"djvu",
|
|
320
|
+
"dll",
|
|
321
|
+
"dmg",
|
|
322
|
+
"dng",
|
|
323
|
+
"doc",
|
|
324
|
+
"docm",
|
|
325
|
+
"docx",
|
|
326
|
+
"dot",
|
|
327
|
+
"dotm",
|
|
328
|
+
"dra",
|
|
329
|
+
"DS_Store",
|
|
330
|
+
"dsk",
|
|
331
|
+
"dts",
|
|
332
|
+
"dtshd",
|
|
333
|
+
"dvb",
|
|
334
|
+
"dwg",
|
|
335
|
+
"dxf",
|
|
336
|
+
"ecelp4800",
|
|
337
|
+
"ecelp7470",
|
|
338
|
+
"ecelp9600",
|
|
339
|
+
"egg",
|
|
340
|
+
"eol",
|
|
341
|
+
"eot",
|
|
342
|
+
"epub",
|
|
343
|
+
"exe",
|
|
344
|
+
"f4v",
|
|
345
|
+
"fbs",
|
|
346
|
+
"fh",
|
|
347
|
+
"fla",
|
|
348
|
+
"flac",
|
|
349
|
+
"flatpak",
|
|
350
|
+
"fli",
|
|
351
|
+
"flv",
|
|
352
|
+
"fpx",
|
|
353
|
+
"fst",
|
|
354
|
+
"fvt",
|
|
355
|
+
"g3",
|
|
356
|
+
"gh",
|
|
357
|
+
"gif",
|
|
358
|
+
"graffle",
|
|
359
|
+
"gz",
|
|
360
|
+
"gzip",
|
|
361
|
+
"h261",
|
|
362
|
+
"h263",
|
|
363
|
+
"h264",
|
|
364
|
+
"icns",
|
|
365
|
+
"ico",
|
|
366
|
+
"ief",
|
|
367
|
+
"img",
|
|
368
|
+
"ipa",
|
|
369
|
+
"iso",
|
|
370
|
+
"jar",
|
|
371
|
+
"jpeg",
|
|
372
|
+
"jpg",
|
|
373
|
+
"jpgv",
|
|
374
|
+
"jpm",
|
|
375
|
+
"jxr",
|
|
376
|
+
"key",
|
|
377
|
+
"ktx",
|
|
378
|
+
"lha",
|
|
379
|
+
"lib",
|
|
380
|
+
"lvp",
|
|
381
|
+
"lz",
|
|
382
|
+
"lzh",
|
|
383
|
+
"lzma",
|
|
384
|
+
"lzo",
|
|
385
|
+
"m3u",
|
|
386
|
+
"m4a",
|
|
387
|
+
"m4v",
|
|
388
|
+
"mar",
|
|
389
|
+
"mdi",
|
|
390
|
+
"mht",
|
|
391
|
+
"mid",
|
|
392
|
+
"midi",
|
|
393
|
+
"mj2",
|
|
394
|
+
"mka",
|
|
395
|
+
"mkv",
|
|
396
|
+
"mmr",
|
|
397
|
+
"mng",
|
|
398
|
+
"mobi",
|
|
399
|
+
"mov",
|
|
400
|
+
"movie",
|
|
401
|
+
"mp3",
|
|
402
|
+
"mp4",
|
|
403
|
+
"mp4a",
|
|
404
|
+
"mpeg",
|
|
405
|
+
"mpg",
|
|
406
|
+
"mpga",
|
|
407
|
+
"mxu",
|
|
408
|
+
"nef",
|
|
409
|
+
"npx",
|
|
410
|
+
"numbers",
|
|
411
|
+
"nupkg",
|
|
412
|
+
"o",
|
|
413
|
+
"odp",
|
|
414
|
+
"ods",
|
|
415
|
+
"odt",
|
|
416
|
+
"oga",
|
|
417
|
+
"ogg",
|
|
418
|
+
"ogv",
|
|
419
|
+
"otf",
|
|
420
|
+
"ott",
|
|
421
|
+
"pages",
|
|
422
|
+
"pbm",
|
|
423
|
+
"pcx",
|
|
424
|
+
"pdb",
|
|
425
|
+
"pdf",
|
|
426
|
+
"pea",
|
|
427
|
+
"pgm",
|
|
428
|
+
"pic",
|
|
429
|
+
"png",
|
|
430
|
+
"pnm",
|
|
431
|
+
"pot",
|
|
432
|
+
"potm",
|
|
433
|
+
"potx",
|
|
434
|
+
"ppa",
|
|
435
|
+
"ppam",
|
|
436
|
+
"ppm",
|
|
437
|
+
"pps",
|
|
438
|
+
"ppsm",
|
|
439
|
+
"ppsx",
|
|
440
|
+
"ppt",
|
|
441
|
+
"pptm",
|
|
442
|
+
"pptx",
|
|
443
|
+
"psd",
|
|
444
|
+
"pya",
|
|
445
|
+
"pyc",
|
|
446
|
+
"pyo",
|
|
447
|
+
"pyv",
|
|
448
|
+
"qt",
|
|
449
|
+
"rar",
|
|
450
|
+
"ras",
|
|
451
|
+
"raw",
|
|
452
|
+
"resources",
|
|
453
|
+
"rgb",
|
|
454
|
+
"rip",
|
|
455
|
+
"rlc",
|
|
456
|
+
"rmf",
|
|
457
|
+
"rmvb",
|
|
458
|
+
"rpm",
|
|
459
|
+
"rtf",
|
|
460
|
+
"rz",
|
|
461
|
+
"s3m",
|
|
462
|
+
"s7z",
|
|
463
|
+
"scpt",
|
|
464
|
+
"sgi",
|
|
465
|
+
"shar",
|
|
466
|
+
"snap",
|
|
467
|
+
"sil",
|
|
468
|
+
"sketch",
|
|
469
|
+
"slk",
|
|
470
|
+
"smv",
|
|
471
|
+
"snk",
|
|
472
|
+
"so",
|
|
473
|
+
"stl",
|
|
474
|
+
"suo",
|
|
475
|
+
"sub",
|
|
476
|
+
"swf",
|
|
477
|
+
"tar",
|
|
478
|
+
"tbz",
|
|
479
|
+
"tbz2",
|
|
480
|
+
"tga",
|
|
481
|
+
"tgz",
|
|
482
|
+
"thmx",
|
|
483
|
+
"tif",
|
|
484
|
+
"tiff",
|
|
485
|
+
"tlz",
|
|
486
|
+
"ttc",
|
|
487
|
+
"ttf",
|
|
488
|
+
"txz",
|
|
489
|
+
"udf",
|
|
490
|
+
"uvh",
|
|
491
|
+
"uvi",
|
|
492
|
+
"uvm",
|
|
493
|
+
"uvp",
|
|
494
|
+
"uvs",
|
|
495
|
+
"uvu",
|
|
496
|
+
"viv",
|
|
497
|
+
"vob",
|
|
498
|
+
"war",
|
|
499
|
+
"wav",
|
|
500
|
+
"wax",
|
|
501
|
+
"wbmp",
|
|
502
|
+
"wdp",
|
|
503
|
+
"weba",
|
|
504
|
+
"webm",
|
|
505
|
+
"webp",
|
|
506
|
+
"whl",
|
|
507
|
+
"wim",
|
|
508
|
+
"wm",
|
|
509
|
+
"wma",
|
|
510
|
+
"wmv",
|
|
511
|
+
"wmx",
|
|
512
|
+
"woff",
|
|
513
|
+
"woff2",
|
|
514
|
+
"wrm",
|
|
515
|
+
"wvx",
|
|
516
|
+
"xbm",
|
|
517
|
+
"xif",
|
|
518
|
+
"xla",
|
|
519
|
+
"xlam",
|
|
520
|
+
"xls",
|
|
521
|
+
"xlsb",
|
|
522
|
+
"xlsm",
|
|
523
|
+
"xlsx",
|
|
524
|
+
"xlt",
|
|
525
|
+
"xltm",
|
|
526
|
+
"xltx",
|
|
527
|
+
"xm",
|
|
528
|
+
"xmind",
|
|
529
|
+
"xpi",
|
|
530
|
+
"xpm",
|
|
531
|
+
"xwd",
|
|
532
|
+
"xz",
|
|
533
|
+
"z",
|
|
534
|
+
"zip",
|
|
535
|
+
"zipx"
|
|
536
|
+
]);
|
|
537
|
+
var isBinaryPath = (filePath) => binaryExtensions.has(sp.extname(filePath).slice(1).toLowerCase());
|
|
538
|
+
var foreach = (val, fn) => {
|
|
539
|
+
if (val instanceof Set) val.forEach(fn);
|
|
540
|
+
else fn(val);
|
|
541
|
+
};
|
|
542
|
+
var addAndConvert = (main, prop, item) => {
|
|
543
|
+
let container = main[prop];
|
|
544
|
+
if (!(container instanceof Set)) main[prop] = container = new Set([container]);
|
|
545
|
+
container.add(item);
|
|
546
|
+
};
|
|
547
|
+
var clearItem = (cont) => (key) => {
|
|
548
|
+
const set = cont[key];
|
|
549
|
+
if (set instanceof Set) set.clear();
|
|
550
|
+
else delete cont[key];
|
|
551
|
+
};
|
|
552
|
+
var delFromSet = (main, prop, item) => {
|
|
553
|
+
const container = main[prop];
|
|
554
|
+
if (container instanceof Set) container.delete(item);
|
|
555
|
+
else if (container === item) delete main[prop];
|
|
556
|
+
};
|
|
557
|
+
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
558
|
+
var FsWatchInstances = /* @__PURE__ */ new Map();
|
|
559
|
+
/**
|
|
560
|
+
* Instantiates the fs_watch interface
|
|
561
|
+
* @param path to be watched
|
|
562
|
+
* @param options to be passed to fs_watch
|
|
563
|
+
* @param listener main event handler
|
|
564
|
+
* @param errHandler emits info about errors
|
|
565
|
+
* @param emitRaw emits raw event data
|
|
566
|
+
* @returns {NativeFsWatcher}
|
|
567
|
+
*/
|
|
568
|
+
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
569
|
+
const handleEvent = (rawEvent, evPath) => {
|
|
570
|
+
listener(path);
|
|
571
|
+
emitRaw(rawEvent, evPath, { watchedPath: path });
|
|
572
|
+
if (evPath && path !== evPath) fsWatchBroadcast(sp.resolve(path, evPath), KEY_LISTENERS, sp.join(path, evPath));
|
|
573
|
+
};
|
|
574
|
+
try {
|
|
575
|
+
return watch(path, { persistent: options.persistent }, handleEvent);
|
|
576
|
+
} catch (error) {
|
|
577
|
+
errHandler(error);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Helper for passing fs_watch event data to a collection of listeners
|
|
583
|
+
* @param fullPath absolute path bound to fs_watch instance
|
|
584
|
+
*/
|
|
585
|
+
var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
|
586
|
+
const cont = FsWatchInstances.get(fullPath);
|
|
587
|
+
if (!cont) return;
|
|
588
|
+
foreach(cont[listenerType], (listener) => {
|
|
589
|
+
listener(val1, val2, val3);
|
|
590
|
+
});
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Instantiates the fs_watch interface or binds listeners
|
|
594
|
+
* to an existing one covering the same file system entry
|
|
595
|
+
* @param path
|
|
596
|
+
* @param fullPath absolute path
|
|
597
|
+
* @param options to be passed to fs_watch
|
|
598
|
+
* @param handlers container for event listener functions
|
|
599
|
+
*/
|
|
600
|
+
var setFsWatchListener = (path, fullPath, options, handlers) => {
|
|
601
|
+
const { listener, errHandler, rawEmitter } = handlers;
|
|
602
|
+
let cont = FsWatchInstances.get(fullPath);
|
|
603
|
+
let watcher;
|
|
604
|
+
if (!options.persistent) {
|
|
605
|
+
watcher = createFsWatchInstance(path, options, listener, errHandler, rawEmitter);
|
|
606
|
+
if (!watcher) return;
|
|
607
|
+
return watcher.close.bind(watcher);
|
|
608
|
+
}
|
|
609
|
+
if (cont) {
|
|
610
|
+
addAndConvert(cont, KEY_LISTENERS, listener);
|
|
611
|
+
addAndConvert(cont, KEY_ERR, errHandler);
|
|
612
|
+
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
613
|
+
} else {
|
|
614
|
+
watcher = createFsWatchInstance(path, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
|
|
615
|
+
if (!watcher) return;
|
|
616
|
+
watcher.on(EV.ERROR, async (error) => {
|
|
617
|
+
const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
|
|
618
|
+
if (cont) cont.watcherUnusable = true;
|
|
619
|
+
if (isWindows && error.code === "EPERM") try {
|
|
620
|
+
await (await open(path, "r")).close();
|
|
621
|
+
broadcastErr(error);
|
|
622
|
+
} catch (err) {}
|
|
623
|
+
else broadcastErr(error);
|
|
624
|
+
});
|
|
625
|
+
cont = {
|
|
626
|
+
listeners: listener,
|
|
627
|
+
errHandlers: errHandler,
|
|
628
|
+
rawEmitters: rawEmitter,
|
|
629
|
+
watcher
|
|
630
|
+
};
|
|
631
|
+
FsWatchInstances.set(fullPath, cont);
|
|
632
|
+
}
|
|
633
|
+
return () => {
|
|
634
|
+
delFromSet(cont, KEY_LISTENERS, listener);
|
|
635
|
+
delFromSet(cont, KEY_ERR, errHandler);
|
|
636
|
+
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
637
|
+
if (isEmptySet(cont.listeners)) {
|
|
638
|
+
cont.watcher.close();
|
|
639
|
+
FsWatchInstances.delete(fullPath);
|
|
640
|
+
HANDLER_KEYS.forEach(clearItem(cont));
|
|
641
|
+
cont.watcher = void 0;
|
|
642
|
+
Object.freeze(cont);
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
var FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
647
|
+
/**
|
|
648
|
+
* Instantiates the fs_watchFile interface or binds listeners
|
|
649
|
+
* to an existing one covering the same file system entry
|
|
650
|
+
* @param path to be watched
|
|
651
|
+
* @param fullPath absolute path
|
|
652
|
+
* @param options options to be passed to fs_watchFile
|
|
653
|
+
* @param handlers container for event listener functions
|
|
654
|
+
* @returns closer
|
|
655
|
+
*/
|
|
656
|
+
var setFsWatchFileListener = (path, fullPath, options, handlers) => {
|
|
657
|
+
const { listener, rawEmitter } = handlers;
|
|
658
|
+
let cont = FsWatchFileInstances.get(fullPath);
|
|
659
|
+
const copts = cont && cont.options;
|
|
660
|
+
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
661
|
+
unwatchFile(fullPath);
|
|
662
|
+
cont = void 0;
|
|
663
|
+
}
|
|
664
|
+
if (cont) {
|
|
665
|
+
addAndConvert(cont, KEY_LISTENERS, listener);
|
|
666
|
+
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
667
|
+
} else {
|
|
668
|
+
cont = {
|
|
669
|
+
listeners: listener,
|
|
670
|
+
rawEmitters: rawEmitter,
|
|
671
|
+
options,
|
|
672
|
+
watcher: watchFile(fullPath, options, (curr, prev) => {
|
|
673
|
+
foreach(cont.rawEmitters, (rawEmitter) => {
|
|
674
|
+
rawEmitter(EV.CHANGE, fullPath, {
|
|
675
|
+
curr,
|
|
676
|
+
prev
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
const currmtime = curr.mtimeMs;
|
|
680
|
+
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach(cont.listeners, (listener) => listener(path, curr));
|
|
681
|
+
})
|
|
682
|
+
};
|
|
683
|
+
FsWatchFileInstances.set(fullPath, cont);
|
|
684
|
+
}
|
|
685
|
+
return () => {
|
|
686
|
+
delFromSet(cont, KEY_LISTENERS, listener);
|
|
687
|
+
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
688
|
+
if (isEmptySet(cont.listeners)) {
|
|
689
|
+
FsWatchFileInstances.delete(fullPath);
|
|
690
|
+
unwatchFile(fullPath);
|
|
691
|
+
cont.options = cont.watcher = void 0;
|
|
692
|
+
Object.freeze(cont);
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
};
|
|
696
|
+
/**
|
|
697
|
+
* @mixin
|
|
698
|
+
*/
|
|
699
|
+
var NodeFsHandler = class {
|
|
700
|
+
fsw;
|
|
701
|
+
_boundHandleError;
|
|
702
|
+
constructor(fsW) {
|
|
703
|
+
this.fsw = fsW;
|
|
704
|
+
this._boundHandleError = (error) => fsW._handleError(error);
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Watch file for changes with fs_watchFile or fs_watch.
|
|
708
|
+
* @param path to file or dir
|
|
709
|
+
* @param listener on fs change
|
|
710
|
+
* @returns closer for the watcher instance
|
|
711
|
+
*/
|
|
712
|
+
_watchWithNodeFs(path, listener) {
|
|
713
|
+
const opts = this.fsw.options;
|
|
714
|
+
const directory = sp.dirname(path);
|
|
715
|
+
const basename = sp.basename(path);
|
|
716
|
+
this.fsw._getWatchedDir(directory).add(basename);
|
|
717
|
+
const absolutePath = sp.resolve(path);
|
|
718
|
+
const options = { persistent: opts.persistent };
|
|
719
|
+
if (!listener) listener = EMPTY_FN;
|
|
720
|
+
let closer;
|
|
721
|
+
if (opts.usePolling) {
|
|
722
|
+
options.interval = opts.interval !== opts.binaryInterval && isBinaryPath(basename) ? opts.binaryInterval : opts.interval;
|
|
723
|
+
closer = setFsWatchFileListener(path, absolutePath, options, {
|
|
724
|
+
listener,
|
|
725
|
+
rawEmitter: this.fsw._emitRaw
|
|
726
|
+
});
|
|
727
|
+
} else closer = setFsWatchListener(path, absolutePath, options, {
|
|
728
|
+
listener,
|
|
729
|
+
errHandler: this._boundHandleError,
|
|
730
|
+
rawEmitter: this.fsw._emitRaw
|
|
731
|
+
});
|
|
732
|
+
return closer;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Watch a file and emit add event if warranted.
|
|
736
|
+
* @returns closer for the watcher instance
|
|
737
|
+
*/
|
|
738
|
+
_handleFile(file, stats, initialAdd) {
|
|
739
|
+
if (this.fsw.closed) return;
|
|
740
|
+
const dirname = sp.dirname(file);
|
|
741
|
+
const basename = sp.basename(file);
|
|
742
|
+
const parent = this.fsw._getWatchedDir(dirname);
|
|
743
|
+
let prevStats = stats;
|
|
744
|
+
if (parent.has(basename)) return;
|
|
745
|
+
const listener = async (path, newStats) => {
|
|
746
|
+
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
|
|
747
|
+
if (!newStats || newStats.mtimeMs === 0) try {
|
|
748
|
+
const newStats = await stat$1(file);
|
|
749
|
+
if (this.fsw.closed) return;
|
|
750
|
+
const at = newStats.atimeMs;
|
|
751
|
+
const mt = newStats.mtimeMs;
|
|
752
|
+
if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV.CHANGE, file, newStats);
|
|
753
|
+
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats.ino) {
|
|
754
|
+
this.fsw._closeFile(path);
|
|
755
|
+
prevStats = newStats;
|
|
756
|
+
const closer = this._watchWithNodeFs(file, listener);
|
|
757
|
+
if (closer) this.fsw._addPathCloser(path, closer);
|
|
758
|
+
} else prevStats = newStats;
|
|
759
|
+
} catch (error) {
|
|
760
|
+
this.fsw._remove(dirname, basename);
|
|
761
|
+
}
|
|
762
|
+
else if (parent.has(basename)) {
|
|
763
|
+
const at = newStats.atimeMs;
|
|
764
|
+
const mt = newStats.mtimeMs;
|
|
765
|
+
if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV.CHANGE, file, newStats);
|
|
766
|
+
prevStats = newStats;
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
const closer = this._watchWithNodeFs(file, listener);
|
|
770
|
+
if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
|
|
771
|
+
if (!this.fsw._throttle(EV.ADD, file, 0)) return;
|
|
772
|
+
this.fsw._emit(EV.ADD, file, stats);
|
|
773
|
+
}
|
|
774
|
+
return closer;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Handle symlinks encountered while reading a dir.
|
|
778
|
+
* @param entry returned by readdirp
|
|
779
|
+
* @param directory path of dir being read
|
|
780
|
+
* @param path of this item
|
|
781
|
+
* @param item basename of this item
|
|
782
|
+
* @returns true if no more processing is needed for this entry.
|
|
783
|
+
*/
|
|
784
|
+
async _handleSymlink(entry, directory, path, item) {
|
|
785
|
+
if (this.fsw.closed) return;
|
|
786
|
+
const full = entry.fullPath;
|
|
787
|
+
const dir = this.fsw._getWatchedDir(directory);
|
|
788
|
+
if (!this.fsw.options.followSymlinks) {
|
|
789
|
+
this.fsw._incrReadyCount();
|
|
790
|
+
let linkPath;
|
|
791
|
+
try {
|
|
792
|
+
linkPath = await realpath(path);
|
|
793
|
+
} catch (e) {
|
|
794
|
+
this.fsw._emitReady();
|
|
795
|
+
return true;
|
|
796
|
+
}
|
|
797
|
+
if (this.fsw.closed) return;
|
|
798
|
+
if (dir.has(item)) {
|
|
799
|
+
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
800
|
+
this.fsw._symlinkPaths.set(full, linkPath);
|
|
801
|
+
this.fsw._emit(EV.CHANGE, path, entry.stats);
|
|
802
|
+
}
|
|
803
|
+
} else {
|
|
804
|
+
dir.add(item);
|
|
805
|
+
this.fsw._symlinkPaths.set(full, linkPath);
|
|
806
|
+
this.fsw._emit(EV.ADD, path, entry.stats);
|
|
807
|
+
}
|
|
808
|
+
this.fsw._emitReady();
|
|
809
|
+
return true;
|
|
810
|
+
}
|
|
811
|
+
if (this.fsw._symlinkPaths.has(full)) return true;
|
|
812
|
+
this.fsw._symlinkPaths.set(full, true);
|
|
813
|
+
}
|
|
814
|
+
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
815
|
+
directory = sp.join(directory, "");
|
|
816
|
+
const throttleKey = target ? `${directory}:${target}` : directory;
|
|
817
|
+
throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
|
|
818
|
+
if (!throttler) return;
|
|
819
|
+
const previous = this.fsw._getWatchedDir(wh.path);
|
|
820
|
+
const current = /* @__PURE__ */ new Set();
|
|
821
|
+
let stream = this.fsw._readdirp(directory, {
|
|
822
|
+
fileFilter: (entry) => wh.filterPath(entry),
|
|
823
|
+
directoryFilter: (entry) => wh.filterDir(entry)
|
|
824
|
+
});
|
|
825
|
+
if (!stream) return;
|
|
826
|
+
stream.on(STR_DATA, async (entry) => {
|
|
827
|
+
if (this.fsw.closed) {
|
|
828
|
+
stream = void 0;
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
const item = entry.path;
|
|
832
|
+
let path = sp.join(directory, item);
|
|
833
|
+
current.add(item);
|
|
834
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) return;
|
|
835
|
+
if (this.fsw.closed) {
|
|
836
|
+
stream = void 0;
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
if (item === target || !target && !previous.has(item)) {
|
|
840
|
+
this.fsw._incrReadyCount();
|
|
841
|
+
path = sp.join(dir, sp.relative(dir, path));
|
|
842
|
+
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
843
|
+
}
|
|
844
|
+
}).on(EV.ERROR, this._boundHandleError);
|
|
845
|
+
return new Promise((resolve, reject) => {
|
|
846
|
+
if (!stream) return reject();
|
|
847
|
+
stream.once("end", () => {
|
|
848
|
+
if (this.fsw.closed) {
|
|
849
|
+
stream = void 0;
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
const wasThrottled = throttler ? throttler.clear() : false;
|
|
853
|
+
resolve(void 0);
|
|
854
|
+
previous.getChildren().filter((item) => {
|
|
855
|
+
return item !== directory && !current.has(item);
|
|
856
|
+
}).forEach((item) => {
|
|
857
|
+
this.fsw._remove(directory, item);
|
|
858
|
+
});
|
|
859
|
+
stream = void 0;
|
|
860
|
+
if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler);
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Read directory to add / remove files from `@watched` list and re-read it on change.
|
|
866
|
+
* @param dir fs path
|
|
867
|
+
* @param stats
|
|
868
|
+
* @param initialAdd
|
|
869
|
+
* @param depth relative to user-supplied path
|
|
870
|
+
* @param target child path targeted for watch
|
|
871
|
+
* @param wh Common watch helpers for this path
|
|
872
|
+
* @param realpath
|
|
873
|
+
* @returns closer for the watcher instance.
|
|
874
|
+
*/
|
|
875
|
+
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
|
876
|
+
const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
|
|
877
|
+
const tracked = parentDir.has(sp.basename(dir));
|
|
878
|
+
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
879
|
+
parentDir.add(sp.basename(dir));
|
|
880
|
+
this.fsw._getWatchedDir(dir);
|
|
881
|
+
let throttler;
|
|
882
|
+
let closer;
|
|
883
|
+
const oDepth = this.fsw.options.depth;
|
|
884
|
+
if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
|
|
885
|
+
if (!target) {
|
|
886
|
+
await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
|
|
887
|
+
if (this.fsw.closed) return;
|
|
888
|
+
}
|
|
889
|
+
closer = this._watchWithNodeFs(dir, (dirPath, stats) => {
|
|
890
|
+
if (stats && stats.mtimeMs === 0) return;
|
|
891
|
+
this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
return closer;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Handle added file, directory, or glob pattern.
|
|
898
|
+
* Delegates call to _handleFile / _handleDir after checks.
|
|
899
|
+
* @param path to file or ir
|
|
900
|
+
* @param initialAdd was the file added at watch instantiation?
|
|
901
|
+
* @param priorWh depth relative to user-supplied path
|
|
902
|
+
* @param depth Child path actually targeted for watch
|
|
903
|
+
* @param target Child path actually targeted for watch
|
|
904
|
+
*/
|
|
905
|
+
async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
|
|
906
|
+
const ready = this.fsw._emitReady;
|
|
907
|
+
if (this.fsw._isIgnored(path) || this.fsw.closed) {
|
|
908
|
+
ready();
|
|
909
|
+
return false;
|
|
910
|
+
}
|
|
911
|
+
const wh = this.fsw._getWatchHelpers(path);
|
|
912
|
+
if (priorWh) {
|
|
913
|
+
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
914
|
+
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
915
|
+
}
|
|
916
|
+
try {
|
|
917
|
+
const stats = await statMethods[wh.statMethod](wh.watchPath);
|
|
918
|
+
if (this.fsw.closed) return;
|
|
919
|
+
if (this.fsw._isIgnored(wh.watchPath, stats)) {
|
|
920
|
+
ready();
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
const follow = this.fsw.options.followSymlinks;
|
|
924
|
+
let closer;
|
|
925
|
+
if (stats.isDirectory()) {
|
|
926
|
+
const absPath = sp.resolve(path);
|
|
927
|
+
const targetPath = follow ? await realpath(path) : path;
|
|
928
|
+
if (this.fsw.closed) return;
|
|
929
|
+
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
930
|
+
if (this.fsw.closed) return;
|
|
931
|
+
if (absPath !== targetPath && targetPath !== void 0) this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
932
|
+
} else if (stats.isSymbolicLink()) {
|
|
933
|
+
const targetPath = follow ? await realpath(path) : path;
|
|
934
|
+
if (this.fsw.closed) return;
|
|
935
|
+
const parent = sp.dirname(wh.watchPath);
|
|
936
|
+
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
937
|
+
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
938
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
|
|
939
|
+
if (this.fsw.closed) return;
|
|
940
|
+
if (targetPath !== void 0) this.fsw._symlinkPaths.set(sp.resolve(path), targetPath);
|
|
941
|
+
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
942
|
+
ready();
|
|
943
|
+
if (closer) this.fsw._addPathCloser(path, closer);
|
|
944
|
+
return false;
|
|
945
|
+
} catch (error) {
|
|
946
|
+
if (this.fsw._handleError(error)) {
|
|
947
|
+
ready();
|
|
948
|
+
return path;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
//#endregion
|
|
954
|
+
//#region ../../node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
|
|
955
|
+
/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
|
|
956
|
+
var SLASH = "/";
|
|
957
|
+
var SLASH_SLASH = "//";
|
|
958
|
+
var ONE_DOT = ".";
|
|
959
|
+
var TWO_DOTS = "..";
|
|
960
|
+
var STRING_TYPE = "string";
|
|
961
|
+
var BACK_SLASH_RE = /\\/g;
|
|
962
|
+
var DOUBLE_SLASH_RE = /\/\//g;
|
|
963
|
+
var DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
|
|
964
|
+
var REPLACER_RE = /^\.[/\\]/;
|
|
965
|
+
function arrify(item) {
|
|
966
|
+
return Array.isArray(item) ? item : [item];
|
|
967
|
+
}
|
|
968
|
+
var isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
|
|
969
|
+
function createPattern(matcher) {
|
|
970
|
+
if (typeof matcher === "function") return matcher;
|
|
971
|
+
if (typeof matcher === "string") return (string) => matcher === string;
|
|
972
|
+
if (matcher instanceof RegExp) return (string) => matcher.test(string);
|
|
973
|
+
if (typeof matcher === "object" && matcher !== null) return (string) => {
|
|
974
|
+
if (matcher.path === string) return true;
|
|
975
|
+
if (matcher.recursive) {
|
|
976
|
+
const relative = sp.relative(matcher.path, string);
|
|
977
|
+
if (!relative) return false;
|
|
978
|
+
return !relative.startsWith("..") && !sp.isAbsolute(relative);
|
|
979
|
+
}
|
|
980
|
+
return false;
|
|
981
|
+
};
|
|
982
|
+
return () => false;
|
|
983
|
+
}
|
|
984
|
+
function normalizePath(path) {
|
|
985
|
+
if (typeof path !== "string") throw new Error("string expected");
|
|
986
|
+
path = sp.normalize(path);
|
|
987
|
+
path = path.replace(/\\/g, "/");
|
|
988
|
+
let prepend = false;
|
|
989
|
+
if (path.startsWith("//")) prepend = true;
|
|
990
|
+
path = path.replace(DOUBLE_SLASH_RE, "/");
|
|
991
|
+
if (prepend) path = "/" + path;
|
|
992
|
+
return path;
|
|
993
|
+
}
|
|
994
|
+
function matchPatterns(patterns, testString, stats) {
|
|
995
|
+
const path = normalizePath(testString);
|
|
996
|
+
for (let index = 0; index < patterns.length; index++) {
|
|
997
|
+
const pattern = patterns[index];
|
|
998
|
+
if (pattern(path, stats)) return true;
|
|
999
|
+
}
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
function anymatch(matchers, testString) {
|
|
1003
|
+
if (matchers == null) throw new TypeError("anymatch: specify first argument");
|
|
1004
|
+
const patterns = arrify(matchers).map((matcher) => createPattern(matcher));
|
|
1005
|
+
if (testString == null) return (testString, stats) => {
|
|
1006
|
+
return matchPatterns(patterns, testString, stats);
|
|
1007
|
+
};
|
|
1008
|
+
return matchPatterns(patterns, testString);
|
|
1009
|
+
}
|
|
1010
|
+
var unifyPaths = (paths_) => {
|
|
1011
|
+
const paths = arrify(paths_).flat();
|
|
1012
|
+
if (!paths.every((p) => typeof p === STRING_TYPE)) throw new TypeError(`Non-string provided as watch path: ${paths}`);
|
|
1013
|
+
return paths.map(normalizePathToUnix);
|
|
1014
|
+
};
|
|
1015
|
+
var toUnix = (string) => {
|
|
1016
|
+
let str = string.replace(BACK_SLASH_RE, SLASH);
|
|
1017
|
+
let prepend = false;
|
|
1018
|
+
if (str.startsWith(SLASH_SLASH)) prepend = true;
|
|
1019
|
+
str = str.replace(DOUBLE_SLASH_RE, SLASH);
|
|
1020
|
+
if (prepend) str = SLASH + str;
|
|
1021
|
+
return str;
|
|
1022
|
+
};
|
|
1023
|
+
var normalizePathToUnix = (path) => toUnix(sp.normalize(toUnix(path)));
|
|
1024
|
+
var normalizeIgnored = (cwd = "") => (path) => {
|
|
1025
|
+
if (typeof path === "string") return normalizePathToUnix(sp.isAbsolute(path) ? path : sp.join(cwd, path));
|
|
1026
|
+
else return path;
|
|
1027
|
+
};
|
|
1028
|
+
var getAbsolutePath = (path, cwd) => {
|
|
1029
|
+
if (sp.isAbsolute(path)) return path;
|
|
1030
|
+
return sp.join(cwd, path);
|
|
1031
|
+
};
|
|
1032
|
+
var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
1033
|
+
/**
|
|
1034
|
+
* Directory entry.
|
|
1035
|
+
*/
|
|
1036
|
+
var DirEntry = class {
|
|
1037
|
+
path;
|
|
1038
|
+
_removeWatcher;
|
|
1039
|
+
items;
|
|
1040
|
+
constructor(dir, removeWatcher) {
|
|
1041
|
+
this.path = dir;
|
|
1042
|
+
this._removeWatcher = removeWatcher;
|
|
1043
|
+
this.items = /* @__PURE__ */ new Set();
|
|
1044
|
+
}
|
|
1045
|
+
add(item) {
|
|
1046
|
+
const { items } = this;
|
|
1047
|
+
if (!items) return;
|
|
1048
|
+
if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item);
|
|
1049
|
+
}
|
|
1050
|
+
async remove(item) {
|
|
1051
|
+
const { items } = this;
|
|
1052
|
+
if (!items) return;
|
|
1053
|
+
items.delete(item);
|
|
1054
|
+
if (items.size > 0) return;
|
|
1055
|
+
const dir = this.path;
|
|
1056
|
+
try {
|
|
1057
|
+
await readdir(dir);
|
|
1058
|
+
} catch (err) {
|
|
1059
|
+
if (this._removeWatcher) this._removeWatcher(sp.dirname(dir), sp.basename(dir));
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
has(item) {
|
|
1063
|
+
const { items } = this;
|
|
1064
|
+
if (!items) return;
|
|
1065
|
+
return items.has(item);
|
|
1066
|
+
}
|
|
1067
|
+
getChildren() {
|
|
1068
|
+
const { items } = this;
|
|
1069
|
+
if (!items) return [];
|
|
1070
|
+
return [...items.values()];
|
|
1071
|
+
}
|
|
1072
|
+
dispose() {
|
|
1073
|
+
this.items.clear();
|
|
1074
|
+
this.path = "";
|
|
1075
|
+
this._removeWatcher = EMPTY_FN;
|
|
1076
|
+
this.items = EMPTY_SET;
|
|
1077
|
+
Object.freeze(this);
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
var STAT_METHOD_F = "stat";
|
|
1081
|
+
var STAT_METHOD_L = "lstat";
|
|
1082
|
+
var WatchHelper = class {
|
|
1083
|
+
fsw;
|
|
1084
|
+
path;
|
|
1085
|
+
watchPath;
|
|
1086
|
+
fullWatchPath;
|
|
1087
|
+
dirParts;
|
|
1088
|
+
followSymlinks;
|
|
1089
|
+
statMethod;
|
|
1090
|
+
constructor(path, follow, fsw) {
|
|
1091
|
+
this.fsw = fsw;
|
|
1092
|
+
const watchPath = path;
|
|
1093
|
+
this.path = path = path.replace(REPLACER_RE, "");
|
|
1094
|
+
this.watchPath = watchPath;
|
|
1095
|
+
this.fullWatchPath = sp.resolve(watchPath);
|
|
1096
|
+
this.dirParts = [];
|
|
1097
|
+
this.dirParts.forEach((parts) => {
|
|
1098
|
+
if (parts.length > 1) parts.pop();
|
|
1099
|
+
});
|
|
1100
|
+
this.followSymlinks = follow;
|
|
1101
|
+
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
1102
|
+
}
|
|
1103
|
+
entryPath(entry) {
|
|
1104
|
+
return sp.join(this.watchPath, sp.relative(this.watchPath, entry.fullPath));
|
|
1105
|
+
}
|
|
1106
|
+
filterPath(entry) {
|
|
1107
|
+
const { stats } = entry;
|
|
1108
|
+
if (stats && stats.isSymbolicLink()) return this.filterDir(entry);
|
|
1109
|
+
const resolvedPath = this.entryPath(entry);
|
|
1110
|
+
return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
|
|
1111
|
+
}
|
|
1112
|
+
filterDir(entry) {
|
|
1113
|
+
return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
/**
|
|
1117
|
+
* Watches files & directories for changes. Emitted events:
|
|
1118
|
+
* `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
|
|
1119
|
+
*
|
|
1120
|
+
* new FSWatcher()
|
|
1121
|
+
* .add(directories)
|
|
1122
|
+
* .on('add', path => log('File', path, 'was added'))
|
|
1123
|
+
*/
|
|
1124
|
+
var FSWatcher = class extends EventEmitter {
|
|
1125
|
+
closed;
|
|
1126
|
+
options;
|
|
1127
|
+
_closers;
|
|
1128
|
+
_ignoredPaths;
|
|
1129
|
+
_throttled;
|
|
1130
|
+
_streams;
|
|
1131
|
+
_symlinkPaths;
|
|
1132
|
+
_watched;
|
|
1133
|
+
_pendingWrites;
|
|
1134
|
+
_pendingUnlinks;
|
|
1135
|
+
_readyCount;
|
|
1136
|
+
_emitReady;
|
|
1137
|
+
_closePromise;
|
|
1138
|
+
_userIgnored;
|
|
1139
|
+
_readyEmitted;
|
|
1140
|
+
_emitRaw;
|
|
1141
|
+
_boundRemove;
|
|
1142
|
+
_nodeFsHandler;
|
|
1143
|
+
constructor(_opts = {}) {
|
|
1144
|
+
super();
|
|
1145
|
+
this.closed = false;
|
|
1146
|
+
this._closers = /* @__PURE__ */ new Map();
|
|
1147
|
+
this._ignoredPaths = /* @__PURE__ */ new Set();
|
|
1148
|
+
this._throttled = /* @__PURE__ */ new Map();
|
|
1149
|
+
this._streams = /* @__PURE__ */ new Set();
|
|
1150
|
+
this._symlinkPaths = /* @__PURE__ */ new Map();
|
|
1151
|
+
this._watched = /* @__PURE__ */ new Map();
|
|
1152
|
+
this._pendingWrites = /* @__PURE__ */ new Map();
|
|
1153
|
+
this._pendingUnlinks = /* @__PURE__ */ new Map();
|
|
1154
|
+
this._readyCount = 0;
|
|
1155
|
+
this._readyEmitted = false;
|
|
1156
|
+
const awf = _opts.awaitWriteFinish;
|
|
1157
|
+
const DEF_AWF = {
|
|
1158
|
+
stabilityThreshold: 2e3,
|
|
1159
|
+
pollInterval: 100
|
|
1160
|
+
};
|
|
1161
|
+
const opts = {
|
|
1162
|
+
persistent: true,
|
|
1163
|
+
ignoreInitial: false,
|
|
1164
|
+
ignorePermissionErrors: false,
|
|
1165
|
+
interval: 100,
|
|
1166
|
+
binaryInterval: 300,
|
|
1167
|
+
followSymlinks: true,
|
|
1168
|
+
usePolling: false,
|
|
1169
|
+
atomic: true,
|
|
1170
|
+
..._opts,
|
|
1171
|
+
ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]),
|
|
1172
|
+
awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === "object" ? {
|
|
1173
|
+
...DEF_AWF,
|
|
1174
|
+
...awf
|
|
1175
|
+
} : false
|
|
1176
|
+
};
|
|
1177
|
+
if (isIBMi) opts.usePolling = true;
|
|
1178
|
+
if (opts.atomic === void 0) opts.atomic = !opts.usePolling;
|
|
1179
|
+
const envPoll = process.env.CHOKIDAR_USEPOLLING;
|
|
1180
|
+
if (envPoll !== void 0) {
|
|
1181
|
+
const envLower = envPoll.toLowerCase();
|
|
1182
|
+
if (envLower === "false" || envLower === "0") opts.usePolling = false;
|
|
1183
|
+
else if (envLower === "true" || envLower === "1") opts.usePolling = true;
|
|
1184
|
+
else opts.usePolling = !!envLower;
|
|
1185
|
+
}
|
|
1186
|
+
const envInterval = process.env.CHOKIDAR_INTERVAL;
|
|
1187
|
+
if (envInterval) opts.interval = Number.parseInt(envInterval, 10);
|
|
1188
|
+
let readyCalls = 0;
|
|
1189
|
+
this._emitReady = () => {
|
|
1190
|
+
readyCalls++;
|
|
1191
|
+
if (readyCalls >= this._readyCount) {
|
|
1192
|
+
this._emitReady = EMPTY_FN;
|
|
1193
|
+
this._readyEmitted = true;
|
|
1194
|
+
process.nextTick(() => this.emit(EVENTS.READY));
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
this._emitRaw = (...args) => this.emit(EVENTS.RAW, ...args);
|
|
1198
|
+
this._boundRemove = this._remove.bind(this);
|
|
1199
|
+
this.options = opts;
|
|
1200
|
+
this._nodeFsHandler = new NodeFsHandler(this);
|
|
1201
|
+
Object.freeze(opts);
|
|
1202
|
+
}
|
|
1203
|
+
_addIgnoredPath(matcher) {
|
|
1204
|
+
if (isMatcherObject(matcher)) {
|
|
1205
|
+
for (const ignored of this._ignoredPaths) if (isMatcherObject(ignored) && ignored.path === matcher.path && ignored.recursive === matcher.recursive) return;
|
|
1206
|
+
}
|
|
1207
|
+
this._ignoredPaths.add(matcher);
|
|
1208
|
+
}
|
|
1209
|
+
_removeIgnoredPath(matcher) {
|
|
1210
|
+
this._ignoredPaths.delete(matcher);
|
|
1211
|
+
if (typeof matcher === "string") {
|
|
1212
|
+
for (const ignored of this._ignoredPaths) if (isMatcherObject(ignored) && ignored.path === matcher) this._ignoredPaths.delete(ignored);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Adds paths to be watched on an existing FSWatcher instance.
|
|
1217
|
+
* @param paths_ file or file list. Other arguments are unused
|
|
1218
|
+
*/
|
|
1219
|
+
add(paths_, _origAdd, _internal) {
|
|
1220
|
+
const { cwd } = this.options;
|
|
1221
|
+
this.closed = false;
|
|
1222
|
+
this._closePromise = void 0;
|
|
1223
|
+
let paths = unifyPaths(paths_);
|
|
1224
|
+
if (cwd) paths = paths.map((path) => {
|
|
1225
|
+
return getAbsolutePath(path, cwd);
|
|
1226
|
+
});
|
|
1227
|
+
paths.forEach((path) => {
|
|
1228
|
+
this._removeIgnoredPath(path);
|
|
1229
|
+
});
|
|
1230
|
+
this._userIgnored = void 0;
|
|
1231
|
+
if (!this._readyCount) this._readyCount = 0;
|
|
1232
|
+
this._readyCount += paths.length;
|
|
1233
|
+
Promise.all(paths.map(async (path) => {
|
|
1234
|
+
const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, void 0, 0, _origAdd);
|
|
1235
|
+
if (res) this._emitReady();
|
|
1236
|
+
return res;
|
|
1237
|
+
})).then((results) => {
|
|
1238
|
+
if (this.closed) return;
|
|
1239
|
+
results.forEach((item) => {
|
|
1240
|
+
if (item) this.add(sp.dirname(item), sp.basename(_origAdd || item));
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
return this;
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Close watchers or start ignoring events from specified paths.
|
|
1247
|
+
*/
|
|
1248
|
+
unwatch(paths_) {
|
|
1249
|
+
if (this.closed) return this;
|
|
1250
|
+
const paths = unifyPaths(paths_);
|
|
1251
|
+
const { cwd } = this.options;
|
|
1252
|
+
paths.forEach((path) => {
|
|
1253
|
+
if (!sp.isAbsolute(path) && !this._closers.has(path)) {
|
|
1254
|
+
if (cwd) path = sp.join(cwd, path);
|
|
1255
|
+
path = sp.resolve(path);
|
|
1256
|
+
}
|
|
1257
|
+
this._closePath(path);
|
|
1258
|
+
this._addIgnoredPath(path);
|
|
1259
|
+
if (this._watched.has(path)) this._addIgnoredPath({
|
|
1260
|
+
path,
|
|
1261
|
+
recursive: true
|
|
1262
|
+
});
|
|
1263
|
+
this._userIgnored = void 0;
|
|
1264
|
+
});
|
|
1265
|
+
return this;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Close watchers and remove all listeners from watched paths.
|
|
1269
|
+
*/
|
|
1270
|
+
close() {
|
|
1271
|
+
if (this._closePromise) return this._closePromise;
|
|
1272
|
+
this.closed = true;
|
|
1273
|
+
this.removeAllListeners();
|
|
1274
|
+
const closers = [];
|
|
1275
|
+
this._closers.forEach((closerList) => closerList.forEach((closer) => {
|
|
1276
|
+
const promise = closer();
|
|
1277
|
+
if (promise instanceof Promise) closers.push(promise);
|
|
1278
|
+
}));
|
|
1279
|
+
this._streams.forEach((stream) => stream.destroy());
|
|
1280
|
+
this._userIgnored = void 0;
|
|
1281
|
+
this._readyCount = 0;
|
|
1282
|
+
this._readyEmitted = false;
|
|
1283
|
+
this._watched.forEach((dirent) => dirent.dispose());
|
|
1284
|
+
this._closers.clear();
|
|
1285
|
+
this._watched.clear();
|
|
1286
|
+
this._streams.clear();
|
|
1287
|
+
this._symlinkPaths.clear();
|
|
1288
|
+
this._throttled.clear();
|
|
1289
|
+
this._closePromise = closers.length ? Promise.all(closers).then(() => void 0) : Promise.resolve();
|
|
1290
|
+
return this._closePromise;
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Expose list of watched paths
|
|
1294
|
+
* @returns for chaining
|
|
1295
|
+
*/
|
|
1296
|
+
getWatched() {
|
|
1297
|
+
const watchList = {};
|
|
1298
|
+
this._watched.forEach((entry, dir) => {
|
|
1299
|
+
const index = (this.options.cwd ? sp.relative(this.options.cwd, dir) : dir) || ONE_DOT;
|
|
1300
|
+
watchList[index] = entry.getChildren().sort();
|
|
1301
|
+
});
|
|
1302
|
+
return watchList;
|
|
1303
|
+
}
|
|
1304
|
+
emitWithAll(event, args) {
|
|
1305
|
+
this.emit(event, ...args);
|
|
1306
|
+
if (event !== EVENTS.ERROR) this.emit(EVENTS.ALL, event, ...args);
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Normalize and emit events.
|
|
1310
|
+
* Calling _emit DOES NOT MEAN emit() would be called!
|
|
1311
|
+
* @param event Type of event
|
|
1312
|
+
* @param path File or directory path
|
|
1313
|
+
* @param stats arguments to be passed with event
|
|
1314
|
+
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
1315
|
+
*/
|
|
1316
|
+
async _emit(event, path, stats) {
|
|
1317
|
+
if (this.closed) return;
|
|
1318
|
+
const opts = this.options;
|
|
1319
|
+
if (isWindows) path = sp.normalize(path);
|
|
1320
|
+
if (opts.cwd) path = sp.relative(opts.cwd, path);
|
|
1321
|
+
const args = [path];
|
|
1322
|
+
if (stats != null) args.push(stats);
|
|
1323
|
+
const awf = opts.awaitWriteFinish;
|
|
1324
|
+
let pw;
|
|
1325
|
+
if (awf && (pw = this._pendingWrites.get(path))) {
|
|
1326
|
+
pw.lastChange = /* @__PURE__ */ new Date();
|
|
1327
|
+
return this;
|
|
1328
|
+
}
|
|
1329
|
+
if (opts.atomic) {
|
|
1330
|
+
if (event === EVENTS.UNLINK) {
|
|
1331
|
+
this._pendingUnlinks.set(path, [event, ...args]);
|
|
1332
|
+
setTimeout(() => {
|
|
1333
|
+
this._pendingUnlinks.forEach((entry, path) => {
|
|
1334
|
+
this.emit(...entry);
|
|
1335
|
+
this.emit(EVENTS.ALL, ...entry);
|
|
1336
|
+
this._pendingUnlinks.delete(path);
|
|
1337
|
+
});
|
|
1338
|
+
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
1339
|
+
return this;
|
|
1340
|
+
}
|
|
1341
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path)) {
|
|
1342
|
+
event = EVENTS.CHANGE;
|
|
1343
|
+
this._pendingUnlinks.delete(path);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
1347
|
+
const awfEmit = (err, stats) => {
|
|
1348
|
+
if (err) {
|
|
1349
|
+
event = EVENTS.ERROR;
|
|
1350
|
+
args[0] = err;
|
|
1351
|
+
this.emitWithAll(event, args);
|
|
1352
|
+
} else if (stats) {
|
|
1353
|
+
if (args.length > 1) args[1] = stats;
|
|
1354
|
+
else args.push(stats);
|
|
1355
|
+
this.emitWithAll(event, args);
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
1358
|
+
this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit);
|
|
1359
|
+
return this;
|
|
1360
|
+
}
|
|
1361
|
+
if (event === EVENTS.CHANGE) {
|
|
1362
|
+
if (!this._throttle(EVENTS.CHANGE, path, 50)) return this;
|
|
1363
|
+
}
|
|
1364
|
+
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
1365
|
+
const fullPath = opts.cwd ? sp.join(opts.cwd, path) : path;
|
|
1366
|
+
let stats;
|
|
1367
|
+
try {
|
|
1368
|
+
stats = await stat$1(fullPath);
|
|
1369
|
+
} catch (err) {}
|
|
1370
|
+
if (!stats || this.closed) return;
|
|
1371
|
+
args.push(stats);
|
|
1372
|
+
}
|
|
1373
|
+
this.emitWithAll(event, args);
|
|
1374
|
+
return this;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Common handler for errors
|
|
1378
|
+
* @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
1379
|
+
*/
|
|
1380
|
+
_handleError(error) {
|
|
1381
|
+
const code = error && error.code;
|
|
1382
|
+
if (error && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) this.emit(EVENTS.ERROR, error);
|
|
1383
|
+
return error || this.closed;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Helper utility for throttling
|
|
1387
|
+
* @param actionType type being throttled
|
|
1388
|
+
* @param path being acted upon
|
|
1389
|
+
* @param timeout duration of time to suppress duplicate actions
|
|
1390
|
+
* @returns tracking object or false if action should be suppressed
|
|
1391
|
+
*/
|
|
1392
|
+
_throttle(actionType, path, timeout) {
|
|
1393
|
+
if (!this._throttled.has(actionType)) this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
1394
|
+
const action = this._throttled.get(actionType);
|
|
1395
|
+
if (!action) throw new Error("invalid throttle");
|
|
1396
|
+
const actionPath = action.get(path);
|
|
1397
|
+
if (actionPath) {
|
|
1398
|
+
actionPath.count++;
|
|
1399
|
+
return false;
|
|
1400
|
+
}
|
|
1401
|
+
let timeoutObject;
|
|
1402
|
+
const clear = () => {
|
|
1403
|
+
const item = action.get(path);
|
|
1404
|
+
const count = item ? item.count : 0;
|
|
1405
|
+
action.delete(path);
|
|
1406
|
+
clearTimeout(timeoutObject);
|
|
1407
|
+
if (item) clearTimeout(item.timeoutObject);
|
|
1408
|
+
return count;
|
|
1409
|
+
};
|
|
1410
|
+
timeoutObject = setTimeout(clear, timeout);
|
|
1411
|
+
const thr = {
|
|
1412
|
+
timeoutObject,
|
|
1413
|
+
clear,
|
|
1414
|
+
count: 0
|
|
1415
|
+
};
|
|
1416
|
+
action.set(path, thr);
|
|
1417
|
+
return thr;
|
|
1418
|
+
}
|
|
1419
|
+
_incrReadyCount() {
|
|
1420
|
+
return this._readyCount++;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Awaits write operation to finish.
|
|
1424
|
+
* Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
|
|
1425
|
+
* @param path being acted upon
|
|
1426
|
+
* @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
|
|
1427
|
+
* @param event
|
|
1428
|
+
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
1429
|
+
*/
|
|
1430
|
+
_awaitWriteFinish(path, threshold, event, awfEmit) {
|
|
1431
|
+
const awf = this.options.awaitWriteFinish;
|
|
1432
|
+
if (typeof awf !== "object") return;
|
|
1433
|
+
const pollInterval = awf.pollInterval;
|
|
1434
|
+
let timeoutHandler;
|
|
1435
|
+
let fullPath = path;
|
|
1436
|
+
if (this.options.cwd && !sp.isAbsolute(path)) fullPath = sp.join(this.options.cwd, path);
|
|
1437
|
+
const now = /* @__PURE__ */ new Date();
|
|
1438
|
+
const writes = this._pendingWrites;
|
|
1439
|
+
function awaitWriteFinishFn(prevStat) {
|
|
1440
|
+
stat(fullPath, (err, curStat) => {
|
|
1441
|
+
if (err || !writes.has(path)) {
|
|
1442
|
+
if (err && err.code !== "ENOENT") awfEmit(err);
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
const now = Number(/* @__PURE__ */ new Date());
|
|
1446
|
+
if (prevStat && curStat.size !== prevStat.size) writes.get(path).lastChange = now;
|
|
1447
|
+
if (now - writes.get(path).lastChange >= threshold) {
|
|
1448
|
+
writes.delete(path);
|
|
1449
|
+
awfEmit(void 0, curStat);
|
|
1450
|
+
} else timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
if (!writes.has(path)) {
|
|
1454
|
+
writes.set(path, {
|
|
1455
|
+
lastChange: now,
|
|
1456
|
+
cancelWait: () => {
|
|
1457
|
+
writes.delete(path);
|
|
1458
|
+
clearTimeout(timeoutHandler);
|
|
1459
|
+
return event;
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Determines whether user has asked to ignore this path.
|
|
1467
|
+
*/
|
|
1468
|
+
_isIgnored(path, stats) {
|
|
1469
|
+
if (this.options.atomic && DOT_RE.test(path)) return true;
|
|
1470
|
+
if (!this._userIgnored) {
|
|
1471
|
+
const { cwd } = this.options;
|
|
1472
|
+
const ignored = (this.options.ignored || []).map(normalizeIgnored(cwd));
|
|
1473
|
+
this._userIgnored = anymatch([...[...this._ignoredPaths].map(normalizeIgnored(cwd)), ...ignored], void 0);
|
|
1474
|
+
}
|
|
1475
|
+
return this._userIgnored(path, stats);
|
|
1476
|
+
}
|
|
1477
|
+
_isntIgnored(path, stat) {
|
|
1478
|
+
return !this._isIgnored(path, stat);
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Provides a set of common helpers and properties relating to symlink handling.
|
|
1482
|
+
* @param path file or directory pattern being watched
|
|
1483
|
+
*/
|
|
1484
|
+
_getWatchHelpers(path) {
|
|
1485
|
+
return new WatchHelper(path, this.options.followSymlinks, this);
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Provides directory tracking objects
|
|
1489
|
+
* @param directory path of the directory
|
|
1490
|
+
*/
|
|
1491
|
+
_getWatchedDir(directory) {
|
|
1492
|
+
const dir = sp.resolve(directory);
|
|
1493
|
+
if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
1494
|
+
return this._watched.get(dir);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Check for read permissions: https://stackoverflow.com/a/11781404/1358405
|
|
1498
|
+
*/
|
|
1499
|
+
_hasReadPermissions(stats) {
|
|
1500
|
+
if (this.options.ignorePermissionErrors) return true;
|
|
1501
|
+
return Boolean(Number(stats.mode) & 256);
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Handles emitting unlink events for
|
|
1505
|
+
* files and directories, and via recursion, for
|
|
1506
|
+
* files and directories within directories that are unlinked
|
|
1507
|
+
* @param directory within which the following item is located
|
|
1508
|
+
* @param item base path of item/directory
|
|
1509
|
+
*/
|
|
1510
|
+
_remove(directory, item, isDirectory) {
|
|
1511
|
+
const path = sp.join(directory, item);
|
|
1512
|
+
const fullPath = sp.resolve(path);
|
|
1513
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
|
|
1514
|
+
if (!this._throttle("remove", path, 100)) return;
|
|
1515
|
+
if (!isDirectory && this._watched.size === 1) this.add(directory, item, true);
|
|
1516
|
+
this._getWatchedDir(path).getChildren().forEach((nested) => this._remove(path, nested));
|
|
1517
|
+
const parent = this._getWatchedDir(directory);
|
|
1518
|
+
const wasTracked = parent.has(item);
|
|
1519
|
+
parent.remove(item);
|
|
1520
|
+
if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
|
|
1521
|
+
let relPath = path;
|
|
1522
|
+
if (this.options.cwd) relPath = sp.relative(this.options.cwd, path);
|
|
1523
|
+
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
1524
|
+
if (this._pendingWrites.get(relPath).cancelWait() === EVENTS.ADD) return;
|
|
1525
|
+
}
|
|
1526
|
+
this._watched.delete(path);
|
|
1527
|
+
this._watched.delete(fullPath);
|
|
1528
|
+
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
1529
|
+
if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path);
|
|
1530
|
+
this._closePath(path);
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Closes all watchers for a path
|
|
1534
|
+
*/
|
|
1535
|
+
_closePath(path) {
|
|
1536
|
+
this._closeFile(path);
|
|
1537
|
+
const dir = sp.dirname(path);
|
|
1538
|
+
this._getWatchedDir(dir).remove(sp.basename(path));
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Closes only file-specific watchers
|
|
1542
|
+
*/
|
|
1543
|
+
_closeFile(path) {
|
|
1544
|
+
const closers = this._closers.get(path);
|
|
1545
|
+
if (!closers) return;
|
|
1546
|
+
closers.forEach((closer) => closer());
|
|
1547
|
+
this._closers.delete(path);
|
|
1548
|
+
}
|
|
1549
|
+
_addPathCloser(path, closer) {
|
|
1550
|
+
if (!closer) return;
|
|
1551
|
+
let list = this._closers.get(path);
|
|
1552
|
+
if (!list) {
|
|
1553
|
+
list = [];
|
|
1554
|
+
this._closers.set(path, list);
|
|
1555
|
+
}
|
|
1556
|
+
list.push(closer);
|
|
1557
|
+
}
|
|
1558
|
+
_readdirp(root, opts) {
|
|
1559
|
+
if (this.closed) return;
|
|
1560
|
+
let stream = readdirp(root, {
|
|
1561
|
+
type: EVENTS.ALL,
|
|
1562
|
+
alwaysStat: true,
|
|
1563
|
+
lstat: true,
|
|
1564
|
+
...opts,
|
|
1565
|
+
depth: 0
|
|
1566
|
+
});
|
|
1567
|
+
this._streams.add(stream);
|
|
1568
|
+
stream.once(STR_CLOSE, () => {
|
|
1569
|
+
stream = void 0;
|
|
1570
|
+
});
|
|
1571
|
+
stream.once("end", () => {
|
|
1572
|
+
if (stream) {
|
|
1573
|
+
this._streams.delete(stream);
|
|
1574
|
+
stream = void 0;
|
|
1575
|
+
}
|
|
1576
|
+
});
|
|
1577
|
+
return stream;
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
/**
|
|
1581
|
+
* Instantiates watcher with paths to be tracked.
|
|
1582
|
+
* @param paths file / directory paths
|
|
1583
|
+
* @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
|
|
1584
|
+
* @returns an instance of FSWatcher for chaining.
|
|
1585
|
+
* @example
|
|
1586
|
+
* const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
|
|
1587
|
+
* watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
|
|
1588
|
+
*/
|
|
1589
|
+
function watch$1(paths, options = {}) {
|
|
1590
|
+
const watcher = new FSWatcher(options);
|
|
1591
|
+
watcher.add(paths);
|
|
1592
|
+
return watcher;
|
|
1593
|
+
}
|
|
1594
|
+
var chokidar_default = {
|
|
1595
|
+
watch: watch$1,
|
|
1596
|
+
FSWatcher
|
|
1597
|
+
};
|
|
1598
|
+
//#endregion
|
|
1599
|
+
export { chokidar_default as t };
|