@plebeiantech/lat.md 0.12.3-fork.13 → 0.12.3-fork.15
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/README.md +24 -0
- package/dist/src/cli/check-context.d.ts +56 -0
- package/dist/src/cli/check-context.js +215 -0
- package/dist/src/cli/check-coverage.js +9 -5
- package/dist/src/cli/check-frontmatter.js +1 -1
- package/dist/src/cli/check-mode.js +1 -1
- package/dist/src/cli/check-status.js +1 -1
- package/dist/src/cli/check.d.ts +19 -12
- package/dist/src/cli/check.js +259 -206
- package/dist/src/cli/context.js +1 -1
- package/dist/src/cli/expand.d.ts +1 -2
- package/dist/src/cli/expand.js +52 -5
- package/dist/src/cli/external.d.ts +11 -0
- package/dist/src/cli/external.js +185 -0
- package/dist/src/cli/fork-instructions.d.ts +1 -0
- package/dist/src/cli/fork-instructions.js +3 -2
- package/dist/src/cli/hook.d.ts +26 -0
- package/dist/src/cli/hook.js +112 -40
- package/dist/src/cli/index.js +55 -3
- package/dist/src/cli/init.d.ts +1 -0
- package/dist/src/cli/init.js +40 -2
- package/dist/src/cli/locate.js +4 -3
- package/dist/src/cli/refs.d.ts +2 -1
- package/dist/src/cli/refs.js +88 -43
- package/dist/src/cli/reindex.js +2 -1
- package/dist/src/cli/search.d.ts +12 -3
- package/dist/src/cli/search.js +45 -49
- package/dist/src/cli/section.d.ts +3 -1
- package/dist/src/cli/section.js +114 -38
- package/dist/src/code-refs.d.ts +17 -5
- package/dist/src/code-refs.js +246 -65
- package/dist/src/context.d.ts +3 -0
- package/dist/src/document-formats.d.ts +7 -0
- package/dist/src/document-formats.js +39 -0
- package/dist/src/extensions/alert-marker.d.ts +25 -0
- package/dist/src/extensions/alert-marker.js +55 -0
- package/dist/src/external-documents.d.ts +56 -0
- package/dist/src/external-documents.js +404 -0
- package/dist/src/external-sources.d.ts +136 -0
- package/dist/src/external-sources.js +1098 -0
- package/dist/src/fork/antigravity-hook.d.ts +47 -0
- package/dist/src/fork/antigravity-hook.js +424 -0
- package/dist/src/fork/antigravity-init.d.ts +17 -0
- package/dist/src/fork/antigravity-init.js +124 -0
- package/dist/src/fork/frontmatter-fields.d.ts +36 -0
- package/dist/src/fork/frontmatter-fields.js +23 -0
- package/dist/src/format.d.ts +5 -2
- package/dist/src/format.js +8 -3
- package/dist/src/graph-export.js +1 -1
- package/dist/src/lattice-model.d.ts +77 -0
- package/dist/src/lattice-model.js +464 -0
- package/dist/src/lattice.d.ts +9 -104
- package/dist/src/lattice.js +69 -516
- package/dist/src/markdown-analysis-cache.d.ts +20 -0
- package/dist/src/markdown-analysis-cache.js +139 -0
- package/dist/src/markdown-analysis-worker.d.ts +16 -0
- package/dist/src/markdown-analysis-worker.js +33 -0
- package/dist/src/markdown-analysis.d.ts +50 -0
- package/dist/src/markdown-analysis.js +139 -0
- package/dist/src/markdown-analyzer-loader.d.ts +4 -0
- package/dist/src/markdown-analyzer-loader.js +13 -0
- package/dist/src/markdown-validation.d.ts +25 -0
- package/dist/src/markdown-validation.js +104 -0
- package/dist/src/mcp/server.js +27 -11
- package/dist/src/parser-cache.d.ts +17 -0
- package/dist/src/parser-cache.js +65 -0
- package/dist/src/parser-import.d.ts +8 -0
- package/dist/src/parser-import.js +1 -0
- package/dist/src/parser.js +80 -5
- package/dist/src/path.d.ts +2 -0
- package/dist/src/path.js +4 -0
- package/dist/src/profiler.d.ts +16 -0
- package/dist/src/profiler.js +81 -0
- package/dist/src/project-analysis.d.ts +59 -0
- package/dist/src/project-analysis.js +233 -0
- package/dist/src/project-discovery.d.ts +6 -0
- package/dist/src/project-discovery.js +30 -0
- package/dist/src/repository-path.d.ts +11 -0
- package/dist/src/repository-path.js +52 -0
- package/dist/src/search/db.d.ts +1 -1
- package/dist/src/search/db.js +2 -2
- package/dist/src/search/embedder.d.ts +2 -1
- package/dist/src/search/embedder.js +6 -5
- package/dist/src/search/index.d.ts +2 -1
- package/dist/src/search/index.js +10 -8
- package/dist/src/search/query.d.ts +20 -0
- package/dist/src/search/query.js +67 -0
- package/dist/src/search/search.d.ts +3 -1
- package/dist/src/search/search.js +5 -2
- package/dist/src/source-formats.d.ts +7 -0
- package/dist/src/source-formats.js +26 -0
- package/dist/src/source-parser.d.ts +44 -4
- package/dist/src/source-parser.js +494 -57
- package/dist/src/view/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/src/view/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/src/view/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/src/view/client/assets/MarkdownEditor-B7quqPb8.js +28 -0
- package/dist/src/view/client/assets/OrbitControls-DwcpQNja.js +1 -0
- package/dist/src/view/client/assets/STLLoader-CLWTKt5i.js +1 -0
- package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-V7-T6qsl.js +1 -0
- package/dist/src/view/client/assets/arc-BnwR8Bu7.js +1 -0
- package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-u97vDna9.js +36 -0
- package/dist/src/view/client/assets/blockDiagram-I7D4REHJ-DETl8e_H.js +129 -0
- package/dist/src/view/client/assets/c4Diagram-7LVT6UL2-DJRAT1Ve.js +38 -0
- package/dist/src/view/client/assets/channel-BwQbnWCN.js +1 -0
- package/dist/src/view/client/assets/chunk-2Q5K7J3B-C0TmOC1Q.js +1 -0
- package/dist/src/view/client/assets/chunk-5VM5RSS4-dfBOrYE6.js +15 -0
- package/dist/src/view/client/assets/chunk-F27PBJKO-DAnks99K.js +1 -0
- package/dist/src/view/client/assets/chunk-IMKFNOWR-CPjB07if.js +231 -0
- package/dist/src/view/client/assets/chunk-JWPE2WC7-VvU_gZI6.js +1 -0
- package/dist/src/view/client/assets/chunk-POPQ4Y6H-DDUbVF55.js +1 -0
- package/dist/src/view/client/assets/chunk-SVP7TREG-BHROkr6D.js +88 -0
- package/dist/src/view/client/assets/chunk-TICWLB2K-95PzGIOg.js +206 -0
- package/dist/src/view/client/assets/chunk-XXDRQBXY-MdmuLhIs.js +1 -0
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-HvQKkIS-.js +1 -0
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-HvQKkIS-.js +1 -0
- package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-CauUf_rN.js +1 -0
- package/dist/src/view/client/assets/cynefin-OW5HDTMX-CeA8IKWo.js +166 -0
- package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-L1rtcT8l.js +62 -0
- package/dist/src/view/client/assets/cytoscape.esm-DzSz-X2X.js +321 -0
- package/dist/src/view/client/assets/dagre-GXQ25YYZ-DLQwTa3H.js +4 -0
- package/dist/src/view/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/src/view/client/assets/diagram-S7CK7UJ4-kbKdIyXG.js +30 -0
- package/dist/src/view/client/assets/diagram-UQ7AKVKN-kmzp92RC.js +41 -0
- package/dist/src/view/client/assets/diagram-VSXAHHWV-EXJTU8qq.js +3 -0
- package/dist/src/view/client/assets/diagram-VX7I27RA-DAiIyMCG.js +24 -0
- package/dist/src/view/client/assets/diagram-Z3DM3KII-G9wz50ZV.js +24 -0
- package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-D2tVRCNA.js +1 -0
- package/dist/src/view/client/assets/erDiagram-RLTQ6QDP-C925J5A3.js +99 -0
- package/dist/src/view/client/assets/flowDiagram-HODETNUW-DzoCa-Nq.js +168 -0
- package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-D2ebbg4p.js +292 -0
- package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-B4QratYy.js +106 -0
- package/dist/src/view/client/assets/index-BnENo9bV.js +1 -0
- package/dist/src/view/client/assets/index-D0ajr_Ja.css +1 -0
- package/dist/src/view/client/assets/index-KZcnpXJH.js +321 -0
- package/dist/src/view/client/assets/infoDiagram-27XIBGKW-DL4mtHkt.js +2 -0
- package/dist/src/view/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/src/view/client/assets/ishikawaDiagram-5VMMS53U-CW4mto2d.js +70 -0
- package/dist/src/view/client/assets/journeyDiagram-3NMN7TZE-8R4eacFW.js +139 -0
- package/dist/src/view/client/assets/kanban-definition-UXKFOSKX-Cy9ioXEJ.js +89 -0
- package/dist/src/view/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/src/view/client/assets/layout-C0MFuhth.js +1 -0
- package/dist/src/view/client/assets/linear-Dv3N4dQR.js +1 -0
- package/dist/src/view/client/assets/logo-small-RR_KBOAT.svg +149 -0
- package/dist/src/view/client/assets/maplibre-gl-DnqZgfUS.js +800 -0
- package/dist/src/view/client/assets/mermaid.core-bds9A7e2.js +310 -0
- package/dist/src/view/client/assets/mindmap-definition-YA3MSWOX-DjmGW355.js +96 -0
- package/dist/src/view/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-BWsZp0ab.js +1 -0
- package/dist/src/view/client/assets/pieDiagram-E7YTZNPT-CCH2gGR-.js +39 -0
- package/dist/src/view/client/assets/quadrantDiagram-AXDQQJYC-CjocPJFz.js +7 -0
- package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-BjLeb2KF.js +1 -0
- package/dist/src/view/client/assets/requirementDiagram-BXWQKSXE-Ct6AoXRr.js +84 -0
- package/dist/src/view/client/assets/sankeyDiagram-P5KCCOFB-CIpgGN_w.js +40 -0
- package/dist/src/view/client/assets/sequenceDiagram-WJ2MYXX4-DrmLFj6w.js +162 -0
- package/dist/src/view/client/assets/sizeCapture-INFHLROL-BdFMe2Lr.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-D77RDMKH-Zd9F1goW.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-ByIKCftl.js +1 -0
- package/dist/src/view/client/assets/swimlanes-42K2YHIH-a7VFwi00.js +1 -0
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-CzxaUHB-.js +8 -0
- package/dist/src/view/client/assets/three.module-PDSP0dbZ.js +4108 -0
- package/dist/src/view/client/assets/timeline-definition-24CTP7MA-BExPu6X5.js +120 -0
- package/dist/src/view/client/assets/vennDiagram-4TSXK5OY-PC1MU3si.js +34 -0
- package/dist/src/view/client/assets/wardleyDiagram-VM6X3IG4-DNWqU3fa.js +78 -0
- package/dist/src/view/client/assets/xychartDiagram-S5SC5T6Z-E1uA28_D.js +7 -0
- package/dist/src/view/client/index.html +2 -2
- package/dist/src/view/client-shell.d.ts +2 -0
- package/dist/src/view/client-shell.js +5 -0
- package/dist/src/view/diagnostics.d.ts +3 -2
- package/dist/src/view/diagnostics.js +49 -58
- package/dist/src/view/document-edit.d.ts +8 -0
- package/dist/src/view/document-edit.js +25 -0
- package/dist/src/view/document-route.d.ts +12 -0
- package/dist/src/view/document-route.js +93 -0
- package/dist/src/view/document-tree.d.ts +18 -0
- package/dist/src/view/document-tree.js +139 -0
- package/dist/src/view/external-document-tree.d.ts +3 -0
- package/dist/src/view/external-document-tree.js +674 -0
- package/dist/src/view/git-diff.js +187 -0
- package/dist/src/view/git.js +1 -1
- package/dist/src/view/graph.d.ts +3 -2
- package/dist/src/view/graph.js +94 -7
- package/dist/src/view/highlight.d.ts +10 -2
- package/dist/src/view/highlight.js +4540 -1360
- package/dist/src/view/markdown.d.ts +3 -2
- package/dist/src/view/markdown.js +214 -53
- package/dist/src/view/protocol.d.ts +59 -6
- package/dist/src/view/references.d.ts +10 -25
- package/dist/src/view/references.js +117 -107
- package/dist/src/view/repository.d.ts +13 -3
- package/dist/src/view/repository.js +234 -15
- package/dist/src/view/search.d.ts +1 -1
- package/dist/src/view/search.js +3 -7
- package/dist/src/view/server.d.ts +11 -2
- package/dist/src/view/server.js +212 -70
- package/dist/src/view/source-target.js +5 -8
- package/dist/src/view/static-build.d.ts +1 -0
- package/dist/src/view/static-build.js +245 -42
- package/dist/src/view/static-protocol.d.ts +19 -2
- package/dist/src/view/store.d.ts +16 -3
- package/dist/src/view/store.js +228 -36
- package/dist/src/view/table-of-contents.d.ts +2 -2
- package/dist/src/view/table-of-contents.js +2 -22
- package/dist/src/walk.d.ts +5 -3
- package/dist/src/walk.js +102 -8
- package/dist/vendor/lat.md-server/cli.d.ts +2 -0
- package/dist/vendor/lat.md-server/cli.js +12 -0
- package/dist/vendor/lat.md-server/index.d.ts +38 -0
- package/dist/vendor/lat.md-server/index.js +128 -0
- package/package.json +52 -12
- package/plugins/lat-md/README.md +61 -0
- package/plugins/lat-md/hooks.json +38 -0
- package/plugins/lat-md/plugin.json +9 -0
- package/plugins/lat-md/rules/AGENTS.md +118 -0
- package/plugins/lat-md/skills/lat-md/SKILL.md +178 -0
- package/plugins/lat-md/skills/lat-md-conventions/SKILL.md +182 -0
- package/templates/AGENTS.md +15 -3
- package/templates/cursor-rules.md +12 -3
- package/templates/skill/SKILL.md +22 -1
- package/dist/src/view/client/assets/index-C3iaZyYT.css +0 -1
- package/dist/src/view/client/assets/index-KWi67IMz.js +0 -334
- package/dist/src/view/client/assets/logo-CNF8zs47.svg +0 -182
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { performance } from 'node:perf_hooks';
|
|
3
|
+
import { flattenSections } from './lattice-model.js';
|
|
4
|
+
import { documentFormat } from './document-formats.js';
|
|
5
|
+
import { loadMarkdownAnalyzer } from './markdown-analyzer-loader.js';
|
|
6
|
+
import { PARSER_CACHE_VERSION, hashParserContent, parsedCachePath, readParsedCache, writeParsedCache, } from './parser-cache.js';
|
|
7
|
+
function unique(values) {
|
|
8
|
+
const seen = new Set();
|
|
9
|
+
const result = [];
|
|
10
|
+
for (const value of values) {
|
|
11
|
+
const trimmed = value?.trim();
|
|
12
|
+
if (!trimmed || seen.has(trimmed.toLowerCase()))
|
|
13
|
+
continue;
|
|
14
|
+
seen.add(trimmed.toLowerCase());
|
|
15
|
+
result.push(trimmed);
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
function closeSections(sections, finalLine) {
|
|
20
|
+
return sections.map((section, index) => {
|
|
21
|
+
const next = sections
|
|
22
|
+
.slice(index + 1)
|
|
23
|
+
.find((candidate) => candidate.depth <= section.depth);
|
|
24
|
+
return {
|
|
25
|
+
...section,
|
|
26
|
+
endLine: next
|
|
27
|
+
? Math.max(section.startLine, next.startLine - 1)
|
|
28
|
+
: finalLine,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function markdownAnalysis(path, content, onParserImport, detail = path) {
|
|
33
|
+
const analyzeMarkdownFile = await loadMarkdownAnalyzer(onParserImport, detail);
|
|
34
|
+
const virtual = `/external/${path}`;
|
|
35
|
+
const analysis = analyzeMarkdownFile(virtual, content, '/', '/');
|
|
36
|
+
const parents = [];
|
|
37
|
+
const sections = flattenSections(analysis.sections).map((section, index) => {
|
|
38
|
+
const title = analysis.headingTitles[index] ?? section.heading;
|
|
39
|
+
while (parents.length > 0 &&
|
|
40
|
+
parents[parents.length - 1].depth >= section.depth) {
|
|
41
|
+
parents.pop();
|
|
42
|
+
}
|
|
43
|
+
const hierarchy = [...parents.map((parent) => parent.title), title];
|
|
44
|
+
const legacyHierarchy = section.id.split('#').slice(1);
|
|
45
|
+
parents.push({ depth: section.depth, title });
|
|
46
|
+
return {
|
|
47
|
+
title,
|
|
48
|
+
depth: section.depth,
|
|
49
|
+
anchor: section.githubSlug ?? '',
|
|
50
|
+
aliases: unique([
|
|
51
|
+
hierarchy.join('#'),
|
|
52
|
+
legacyHierarchy.join('#'),
|
|
53
|
+
title,
|
|
54
|
+
section.heading,
|
|
55
|
+
section.githubSlug,
|
|
56
|
+
]),
|
|
57
|
+
hierarchy,
|
|
58
|
+
startLine: section.startLine,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
format: 'markdown',
|
|
63
|
+
title: analysis.headingTitles[0] ?? posix.basename(path, '.md'),
|
|
64
|
+
sections: closeSections(sections, content.split('\n').length),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async function restructuredTextAnalysis(path, content, onParserImport, detail = path) {
|
|
68
|
+
const importStarted = performance.now();
|
|
69
|
+
const { RstSection, RstToHtmlCompiler } = await import('rst-compiler');
|
|
70
|
+
onParserImport?.({
|
|
71
|
+
parser: 'reStructuredText parser',
|
|
72
|
+
imported: true,
|
|
73
|
+
durationMs: performance.now() - importStarted,
|
|
74
|
+
detail,
|
|
75
|
+
});
|
|
76
|
+
const compiler = new RstToHtmlCompiler();
|
|
77
|
+
const parsed = compiler.parse(content, {
|
|
78
|
+
disableErrors: true,
|
|
79
|
+
disableWarnings: true,
|
|
80
|
+
});
|
|
81
|
+
const nodes = parsed.root
|
|
82
|
+
.findAllChildren('Section')
|
|
83
|
+
.filter((node) => Boolean(node instanceof RstSection));
|
|
84
|
+
const aliasesByNode = new Map();
|
|
85
|
+
for (const [alias, node] of parsed.simpleNameResolver
|
|
86
|
+
.nodesLinkableFromOutside) {
|
|
87
|
+
const aliases = aliasesByNode.get(node) ?? [];
|
|
88
|
+
aliases.push(alias);
|
|
89
|
+
aliasesByNode.set(node, aliases);
|
|
90
|
+
}
|
|
91
|
+
const hierarchy = [];
|
|
92
|
+
const sections = nodes.map((node) => {
|
|
93
|
+
hierarchy.length = node.level - 1;
|
|
94
|
+
hierarchy.push(node.textContent);
|
|
95
|
+
const anchor = parsed.htmlAttrResolver.getNodeHtmlId(node) ?? '';
|
|
96
|
+
return {
|
|
97
|
+
title: node.textContent,
|
|
98
|
+
depth: node.level,
|
|
99
|
+
anchor,
|
|
100
|
+
aliases: unique([
|
|
101
|
+
hierarchy.join('#'),
|
|
102
|
+
node.textContent,
|
|
103
|
+
anchor,
|
|
104
|
+
...(aliasesByNode.get(node) ?? []),
|
|
105
|
+
]),
|
|
106
|
+
hierarchy: [...hierarchy],
|
|
107
|
+
startLine: node.source.startLineIdx + 1,
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
format: 'restructuredtext',
|
|
112
|
+
title: sections[0]?.title ?? posix.basename(path, '.rst'),
|
|
113
|
+
sections: closeSections(sections, content.split('\n').length),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/** Accept legacy AsciiDoc source listings whose delimiter lengths do not match. */
|
|
117
|
+
export function asciidocCompatibleContent(content) {
|
|
118
|
+
const lines = content.split('\n');
|
|
119
|
+
for (let index = 0; index + 1 < lines.length; index++) {
|
|
120
|
+
if (!/^\[(?:source|listing)(?:,|\])/i.test(lines[index].trim()))
|
|
121
|
+
continue;
|
|
122
|
+
if (!/^-{5,}\r?$/.test(lines[index + 1]))
|
|
123
|
+
continue;
|
|
124
|
+
for (let closing = index + 2; closing < lines.length; closing++) {
|
|
125
|
+
if (!/^-{4,}\r?$/.test(lines[closing]))
|
|
126
|
+
continue;
|
|
127
|
+
const openingCr = lines[index + 1].endsWith('\r') ? '\r' : '';
|
|
128
|
+
const closingCr = lines[closing].endsWith('\r') ? '\r' : '';
|
|
129
|
+
lines[index + 1] = `----${openingCr}`;
|
|
130
|
+
lines[closing] = `----${closingCr}`;
|
|
131
|
+
index = closing;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return lines.join('\n');
|
|
136
|
+
}
|
|
137
|
+
async function asciidocAnalysis(path, content, onParserImport, detail = path) {
|
|
138
|
+
const importStarted = performance.now();
|
|
139
|
+
const { load } = await import('@asciidoctor/core');
|
|
140
|
+
onParserImport?.({
|
|
141
|
+
parser: 'AsciiDoc parser',
|
|
142
|
+
imported: true,
|
|
143
|
+
durationMs: performance.now() - importStarted,
|
|
144
|
+
detail,
|
|
145
|
+
});
|
|
146
|
+
const document = await load(asciidocCompatibleContent(content), {
|
|
147
|
+
safe: 'secure',
|
|
148
|
+
sourcemap: true,
|
|
149
|
+
attributes: { showtitle: true },
|
|
150
|
+
});
|
|
151
|
+
const sections = [];
|
|
152
|
+
const documentTitle = document.getTitle();
|
|
153
|
+
const documentId = document.getId() ?? '';
|
|
154
|
+
const rootHierarchy = documentTitle ? [documentTitle] : [];
|
|
155
|
+
if (documentTitle) {
|
|
156
|
+
sections.push({
|
|
157
|
+
title: documentTitle,
|
|
158
|
+
depth: 1,
|
|
159
|
+
anchor: documentId,
|
|
160
|
+
aliases: unique([documentTitle, documentId]),
|
|
161
|
+
hierarchy: rootHierarchy,
|
|
162
|
+
startLine: document.getLineNumber() ?? 1,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const visit = (nodes, parents) => {
|
|
166
|
+
for (const node of nodes) {
|
|
167
|
+
const title = node.getTitle() ?? '';
|
|
168
|
+
const hierarchy = [...parents, title];
|
|
169
|
+
const anchor = node.getId() ?? '';
|
|
170
|
+
const level = node.getLevel();
|
|
171
|
+
sections.push({
|
|
172
|
+
title,
|
|
173
|
+
depth: level == null ? hierarchy.length : level + (documentTitle ? 1 : 0),
|
|
174
|
+
anchor,
|
|
175
|
+
aliases: unique([hierarchy.join('#'), title, anchor]),
|
|
176
|
+
hierarchy,
|
|
177
|
+
startLine: node.getLineNumber() ?? 1,
|
|
178
|
+
});
|
|
179
|
+
visit(node.getSections(), hierarchy);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
visit(document.getSections(), rootHierarchy);
|
|
183
|
+
const extension = path.toLowerCase().endsWith('.asciidoc')
|
|
184
|
+
? '.asciidoc'
|
|
185
|
+
: '.adoc';
|
|
186
|
+
return {
|
|
187
|
+
format: 'asciidoc',
|
|
188
|
+
title: documentTitle ?? sections[0]?.title ?? posix.basename(path, extension),
|
|
189
|
+
sections: closeSections(sections, content.split('\n').length),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export async function analyzeExternalDocument(path, content, onParserImport, importDetail = path) {
|
|
193
|
+
switch (documentFormat(path)) {
|
|
194
|
+
case 'markdown':
|
|
195
|
+
return markdownAnalysis(path, content, onParserImport, importDetail);
|
|
196
|
+
case 'restructuredtext':
|
|
197
|
+
return restructuredTextAnalysis(path, content, onParserImport, importDetail);
|
|
198
|
+
case 'asciidoc':
|
|
199
|
+
return asciidocAnalysis(path, content, onParserImport, importDetail);
|
|
200
|
+
default:
|
|
201
|
+
throw new Error(`unsupported external document format for "${path}"`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function parserImportEvent(format, imported, durationMs, detail) {
|
|
205
|
+
return {
|
|
206
|
+
parser: format === 'markdown'
|
|
207
|
+
? 'Markdown analyzer'
|
|
208
|
+
: format === 'restructuredtext'
|
|
209
|
+
? 'reStructuredText parser'
|
|
210
|
+
: 'AsciiDoc parser',
|
|
211
|
+
imported,
|
|
212
|
+
durationMs,
|
|
213
|
+
detail,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function isRecord(value) {
|
|
217
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
218
|
+
}
|
|
219
|
+
function isStringArray(value) {
|
|
220
|
+
return (Array.isArray(value) && value.every((item) => typeof item === 'string'));
|
|
221
|
+
}
|
|
222
|
+
function isExternalDocumentSection(value) {
|
|
223
|
+
if (!isRecord(value))
|
|
224
|
+
return false;
|
|
225
|
+
return (typeof value.title === 'string' &&
|
|
226
|
+
Number.isInteger(value.depth) &&
|
|
227
|
+
value.depth > 0 &&
|
|
228
|
+
typeof value.anchor === 'string' &&
|
|
229
|
+
isStringArray(value.aliases) &&
|
|
230
|
+
isStringArray(value.hierarchy) &&
|
|
231
|
+
Number.isInteger(value.startLine) &&
|
|
232
|
+
value.startLine > 0 &&
|
|
233
|
+
Number.isInteger(value.endLine) &&
|
|
234
|
+
value.endLine >= value.startLine);
|
|
235
|
+
}
|
|
236
|
+
function cachedExternalDocumentAnalysis(entry, contentHash, identity, timings) {
|
|
237
|
+
if (!entry ||
|
|
238
|
+
entry.version !== PARSER_CACHE_VERSION ||
|
|
239
|
+
entry.contentHash !== contentHash ||
|
|
240
|
+
!isRecord(entry.value) ||
|
|
241
|
+
entry.value.path !== identity ||
|
|
242
|
+
!isRecord(entry.value.document) ||
|
|
243
|
+
!['markdown', 'restructuredtext', 'asciidoc'].includes(String(entry.value.document.format)) ||
|
|
244
|
+
typeof entry.value.document.title !== 'string' ||
|
|
245
|
+
!Array.isArray(entry.value.document.sections) ||
|
|
246
|
+
!entry.value.document.sections.every(isExternalDocumentSection)) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
path: identity,
|
|
251
|
+
document: entry.value.document,
|
|
252
|
+
timings: {
|
|
253
|
+
...timings,
|
|
254
|
+
cacheStatus: 'hit',
|
|
255
|
+
cacheWriteMs: 0,
|
|
256
|
+
parseMs: 0,
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/** Request-scoped owner for external document parser work. */
|
|
261
|
+
export class ExternalDocumentParserRuntime {
|
|
262
|
+
analyses = new Map();
|
|
263
|
+
clear() {
|
|
264
|
+
this.analyses.clear();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const defaultExternalDocumentParserRuntime = new ExternalDocumentParserRuntime();
|
|
268
|
+
/** Return the shared parsed-cache path for one external document identity. */
|
|
269
|
+
export function externalDocumentAnalysisCachePath(latDir, identity) {
|
|
270
|
+
return parsedCachePath(latDir, identity);
|
|
271
|
+
}
|
|
272
|
+
/** Analyze an external document through the shared persistent parser cache. */
|
|
273
|
+
export async function analyzeExternalDocumentCached(path, content, latDir, options = {}) {
|
|
274
|
+
const format = documentFormat(path);
|
|
275
|
+
const identity = (options.identity ?? path)
|
|
276
|
+
.replaceAll('\\', '/')
|
|
277
|
+
.normalize('NFC');
|
|
278
|
+
const hashStarted = performance.now();
|
|
279
|
+
const contentHash = hashParserContent(content);
|
|
280
|
+
const hashMs = performance.now() - hashStarted;
|
|
281
|
+
const cache = options.cache !== false;
|
|
282
|
+
const cachePath = externalDocumentAnalysisCachePath(latDir, identity);
|
|
283
|
+
const promiseKey = `${cache ? 'cache' : 'direct'}\0${cachePath}\0${contentHash}`;
|
|
284
|
+
const runtime = options.runtime ?? defaultExternalDocumentParserRuntime;
|
|
285
|
+
let analysis = runtime.analyses.get(promiseKey);
|
|
286
|
+
const created = !analysis;
|
|
287
|
+
if (!analysis) {
|
|
288
|
+
analysis = (async () => {
|
|
289
|
+
const cacheStarted = performance.now();
|
|
290
|
+
const entry = cache ? await readParsedCache(cachePath) : null;
|
|
291
|
+
const cacheReadMs = cache ? performance.now() - cacheStarted : 0;
|
|
292
|
+
const timings = {
|
|
293
|
+
hashMs,
|
|
294
|
+
cacheReadMs,
|
|
295
|
+
cacheStatus: cache ? 'miss' : 'disabled',
|
|
296
|
+
};
|
|
297
|
+
const cached = cache
|
|
298
|
+
? cachedExternalDocumentAnalysis(entry, contentHash, identity, timings)
|
|
299
|
+
: null;
|
|
300
|
+
if (cached) {
|
|
301
|
+
if (format) {
|
|
302
|
+
options.onParserImport?.(parserImportEvent(format, false, 0, identity));
|
|
303
|
+
}
|
|
304
|
+
return cached;
|
|
305
|
+
}
|
|
306
|
+
const parseStarted = performance.now();
|
|
307
|
+
const document = await analyzeExternalDocument(path, content, options.onParserImport, identity);
|
|
308
|
+
const result = {
|
|
309
|
+
path: identity,
|
|
310
|
+
document,
|
|
311
|
+
timings: {
|
|
312
|
+
...timings,
|
|
313
|
+
cacheWriteMs: 0,
|
|
314
|
+
parseMs: performance.now() - parseStarted,
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
if (!cache)
|
|
318
|
+
return result;
|
|
319
|
+
const writeStarted = performance.now();
|
|
320
|
+
try {
|
|
321
|
+
await writeParsedCache(cachePath, contentHash, result);
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
// Parsed caches are disposable; document resolution must work read-only.
|
|
325
|
+
}
|
|
326
|
+
result.timings.cacheWriteMs = performance.now() - writeStarted;
|
|
327
|
+
return result;
|
|
328
|
+
})();
|
|
329
|
+
runtime.analyses.set(promiseKey, analysis);
|
|
330
|
+
}
|
|
331
|
+
const result = await analysis;
|
|
332
|
+
if (created)
|
|
333
|
+
options.onFileAnalyzed?.(result);
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
export function findExternalDocumentSection(analysis, fragment) {
|
|
337
|
+
const wanted = fragment.toLowerCase();
|
|
338
|
+
return analysis.sections.find((section) => section.aliases.some((alias) => alias.toLowerCase() === wanted));
|
|
339
|
+
}
|
|
340
|
+
/** Project format-neutral document sections into the existing browser TOC model. */
|
|
341
|
+
export function externalDocumentSections(path, analysis) {
|
|
342
|
+
const roots = [];
|
|
343
|
+
const parents = [];
|
|
344
|
+
for (const source of analysis.sections) {
|
|
345
|
+
const section = {
|
|
346
|
+
id: `${path}#${source.hierarchy.join('#')}`,
|
|
347
|
+
heading: source.title,
|
|
348
|
+
depth: source.depth,
|
|
349
|
+
file: path,
|
|
350
|
+
filePath: path,
|
|
351
|
+
children: [],
|
|
352
|
+
startLine: source.startLine,
|
|
353
|
+
endLine: source.endLine,
|
|
354
|
+
firstParagraph: '',
|
|
355
|
+
githubSlug: source.anchor,
|
|
356
|
+
};
|
|
357
|
+
while (parents.length > 0 &&
|
|
358
|
+
parents[parents.length - 1].depth >= section.depth) {
|
|
359
|
+
parents.pop();
|
|
360
|
+
}
|
|
361
|
+
const parent = parents[parents.length - 1];
|
|
362
|
+
if (parent)
|
|
363
|
+
parent.children.push(section);
|
|
364
|
+
else
|
|
365
|
+
roots.push(section);
|
|
366
|
+
parents.push(section);
|
|
367
|
+
}
|
|
368
|
+
return roots;
|
|
369
|
+
}
|
|
370
|
+
/** Add zero-size alias anchors to the normalized external document tree. */
|
|
371
|
+
export function addExternalDocumentAliasAnchors(source, analysis) {
|
|
372
|
+
const tree = structuredClone(source);
|
|
373
|
+
const canonical = new Set(analysis.sections.map((section) => section.anchor).filter(Boolean));
|
|
374
|
+
for (const section of analysis.sections) {
|
|
375
|
+
if (!section.anchor)
|
|
376
|
+
continue;
|
|
377
|
+
const aliases = section.aliases.filter((alias) => alias !== section.anchor && !canonical.has(alias));
|
|
378
|
+
if (aliases.length === 0)
|
|
379
|
+
continue;
|
|
380
|
+
const insert = (children) => {
|
|
381
|
+
for (let index = 0; index < children.length; index++) {
|
|
382
|
+
const node = children[index];
|
|
383
|
+
if (node.type !== 'element')
|
|
384
|
+
continue;
|
|
385
|
+
if (/^h[1-6]$/.test(node.tagName) &&
|
|
386
|
+
node.properties.id === section.anchor) {
|
|
387
|
+
const anchors = aliases.map((alias) => ({
|
|
388
|
+
type: 'element',
|
|
389
|
+
tagName: 'span',
|
|
390
|
+
properties: { id: alias, ariaHidden: 'true' },
|
|
391
|
+
children: [],
|
|
392
|
+
}));
|
|
393
|
+
children.splice(index, 0, ...anchors);
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
if (insert(node.children))
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
return false;
|
|
400
|
+
};
|
|
401
|
+
insert(tree.children);
|
|
402
|
+
}
|
|
403
|
+
return tree;
|
|
404
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type ExternalDocumentAnalysis, type ExternalDocumentFileAnalysis } from './external-documents.js';
|
|
2
|
+
import type { ParserImportObserver } from './parser-import.js';
|
|
3
|
+
/** Version of the external cache metadata and on-disk provider layouts. */
|
|
4
|
+
export declare const EXTERNAL_SOURCES_SCHEMA_VER = 1;
|
|
5
|
+
export type ExternalStrategy = 'fetch' | 'checkout';
|
|
6
|
+
export type EffectiveExternalStrategy = ExternalStrategy | 'local';
|
|
7
|
+
export type CanonicalExternalSource = {
|
|
8
|
+
handle: string;
|
|
9
|
+
repo: string;
|
|
10
|
+
source: string;
|
|
11
|
+
commit: string;
|
|
12
|
+
prefix: string;
|
|
13
|
+
defaultFileExtension?: string;
|
|
14
|
+
strategy: ExternalStrategy;
|
|
15
|
+
fetchUrl?: string;
|
|
16
|
+
};
|
|
17
|
+
export type LocalExternalOverride = {
|
|
18
|
+
localPath?: string;
|
|
19
|
+
commit?: string;
|
|
20
|
+
};
|
|
21
|
+
export type EffectiveExternalSource = CanonicalExternalSource & {
|
|
22
|
+
canonicalCommit: string;
|
|
23
|
+
effectiveStrategy: EffectiveExternalStrategy;
|
|
24
|
+
localPath?: string;
|
|
25
|
+
localError?: string;
|
|
26
|
+
};
|
|
27
|
+
export type ExternalSourcesSnapshot = {
|
|
28
|
+
canonicalPath: string;
|
|
29
|
+
localPath: string;
|
|
30
|
+
sources: Map<string, EffectiveExternalSource>;
|
|
31
|
+
errors: ExternalConfigError[];
|
|
32
|
+
validCanonical: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type ExternalConfigError = {
|
|
35
|
+
file: string;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
export type ExternalTarget = {
|
|
39
|
+
target: string;
|
|
40
|
+
handle: string;
|
|
41
|
+
authoredPath: string;
|
|
42
|
+
resolvedPath: string;
|
|
43
|
+
repositoryPath: string;
|
|
44
|
+
fragment: string;
|
|
45
|
+
identity: string;
|
|
46
|
+
};
|
|
47
|
+
type ResolvedExternalContentBase = {
|
|
48
|
+
target: ExternalTarget;
|
|
49
|
+
source: EffectiveExternalSource;
|
|
50
|
+
provider: EffectiveExternalStrategy;
|
|
51
|
+
content: string;
|
|
52
|
+
fullContent: string;
|
|
53
|
+
startLine: number;
|
|
54
|
+
endLine: number;
|
|
55
|
+
};
|
|
56
|
+
export type ResolvedExternalContent = ResolvedExternalContentBase & ({
|
|
57
|
+
kind: 'document';
|
|
58
|
+
document: ExternalDocumentAnalysis;
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'source';
|
|
61
|
+
signature?: string;
|
|
62
|
+
});
|
|
63
|
+
export type ExternalCacheMetadata = {
|
|
64
|
+
ver: number;
|
|
65
|
+
source: string;
|
|
66
|
+
commit: string;
|
|
67
|
+
strategy: EffectiveExternalStrategy;
|
|
68
|
+
};
|
|
69
|
+
export declare function normalizeExternalDefaultFileExtension(value: string): string;
|
|
70
|
+
export declare function normalizeExternalRepoUrl(value: string): string;
|
|
71
|
+
export declare function inferExternalFetchUrl(repo: string): string | null;
|
|
72
|
+
export declare function loadExternalSources(latDir: string, projectRoot?: string, options?: {
|
|
73
|
+
ignoreLocal?: boolean;
|
|
74
|
+
}): Promise<ExternalSourcesSnapshot>;
|
|
75
|
+
export declare function parseExternalTarget(value: string, snapshot: Pick<ExternalSourcesSnapshot, 'sources'>): ExternalTarget | null;
|
|
76
|
+
export declare function externalCachePaths(latDir: string, handle: string): {
|
|
77
|
+
root: string;
|
|
78
|
+
directory: string;
|
|
79
|
+
metadata: string;
|
|
80
|
+
};
|
|
81
|
+
export declare function readExternalCacheMetadata(latDir: string, handle: string): ExternalCacheMetadata | null;
|
|
82
|
+
export declare class ExternalResolver {
|
|
83
|
+
readonly latDir: string;
|
|
84
|
+
readonly projectRoot: string;
|
|
85
|
+
readonly snapshot: ExternalSourcesSnapshot;
|
|
86
|
+
private readonly ca?;
|
|
87
|
+
private readonly ignoreLocal;
|
|
88
|
+
private readonly onDocumentAnalyzed?;
|
|
89
|
+
private readonly onParserImport?;
|
|
90
|
+
private reconciliationPromise?;
|
|
91
|
+
private readonly externalFilePromises;
|
|
92
|
+
private readonly externalDocumentParserRuntime;
|
|
93
|
+
private readonly sourceParserRuntime;
|
|
94
|
+
constructor(latDir: string, projectRoot: string, snapshot: ExternalSourcesSnapshot, ca?: (string | Buffer) | undefined, ignoreLocal?: boolean, onDocumentAnalyzed?: ((analysis: ExternalDocumentFileAnalysis) => void) | undefined, onParserImport?: ParserImportObserver | undefined);
|
|
95
|
+
parse(target: string): ExternalTarget | null;
|
|
96
|
+
unknownTargetMessage(target: string): string | null;
|
|
97
|
+
reconcile(): Promise<void>;
|
|
98
|
+
private readFile;
|
|
99
|
+
resolve(targetValue: string): Promise<ResolvedExternalContent>;
|
|
100
|
+
}
|
|
101
|
+
export declare function createExternalResolver(latDir: string, projectRoot?: string, options?: {
|
|
102
|
+
ignoreLocal?: boolean;
|
|
103
|
+
ca?: string | Buffer;
|
|
104
|
+
onDocumentAnalyzed?: (analysis: ExternalDocumentFileAnalysis) => void;
|
|
105
|
+
onParserImport?: ParserImportObserver;
|
|
106
|
+
}): Promise<ExternalResolver>;
|
|
107
|
+
export type ExternalSourceDescription = {
|
|
108
|
+
handle: string;
|
|
109
|
+
repo: string;
|
|
110
|
+
canonicalCommit: string;
|
|
111
|
+
effectiveCommit: string;
|
|
112
|
+
prefix: string;
|
|
113
|
+
defaultFileExtension?: string;
|
|
114
|
+
strategy: ExternalStrategy;
|
|
115
|
+
effectiveStrategy: EffectiveExternalStrategy;
|
|
116
|
+
fetchUrl?: string;
|
|
117
|
+
localPath?: string;
|
|
118
|
+
localError?: string;
|
|
119
|
+
cache: ExternalCacheMetadata | null;
|
|
120
|
+
checkout: {
|
|
121
|
+
command: string;
|
|
122
|
+
args: string[];
|
|
123
|
+
}[];
|
|
124
|
+
};
|
|
125
|
+
export declare function describeExternalSources(latDir: string, snapshot: ExternalSourcesSnapshot): ExternalSourceDescription[];
|
|
126
|
+
export declare function resolveExternalCommit(repo: string, ref: string): Promise<string>;
|
|
127
|
+
export declare function addCanonicalExternalSource(latDir: string, input: {
|
|
128
|
+
handle: string;
|
|
129
|
+
repo: string;
|
|
130
|
+
commit: string;
|
|
131
|
+
prefix?: string;
|
|
132
|
+
defaultFileExtension?: string;
|
|
133
|
+
strategy: ExternalStrategy;
|
|
134
|
+
fetchUrl?: string;
|
|
135
|
+
}): Promise<CanonicalExternalSource>;
|
|
136
|
+
export {};
|