@driftsys/markspec 0.10.3 → 0.12.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/README.md +11 -2
- package/esm/ast/normalize.d.ts +4 -5
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +6 -37
- package/esm/collect/mod.d.ts +29 -9
- package/esm/collect/mod.d.ts.map +1 -1
- package/esm/collect/mod.js +36 -10
- package/esm/compiler/deserialize.d.ts +49 -0
- package/esm/compiler/deserialize.d.ts.map +1 -0
- package/esm/compiler/deserialize.js +139 -0
- package/esm/compiler/manifest.d.ts +3 -0
- package/esm/compiler/manifest.d.ts.map +1 -1
- package/esm/compiler/manifest.js +9 -3
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +18 -13
- package/esm/config/markspec.d.ts +40 -1
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +127 -2
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +143 -147
- package/esm/decl/duplicates.d.ts +29 -0
- package/esm/decl/duplicates.d.ts.map +1 -0
- package/esm/decl/duplicates.js +28 -0
- package/esm/decl/mod.d.ts +4 -2
- package/esm/decl/mod.d.ts.map +1 -1
- package/esm/decl/mod.js +2 -1
- package/esm/decl/surfaces.d.ts +29 -7
- package/esm/decl/surfaces.d.ts.map +1 -1
- package/esm/decl/surfaces.js +31 -18
- package/esm/discovery/mod.d.ts +24 -8
- package/esm/discovery/mod.d.ts.map +1 -1
- package/esm/discovery/mod.js +57 -21
- package/esm/discovery/projects.d.ts +109 -0
- package/esm/discovery/projects.d.ts.map +1 -0
- package/esm/discovery/projects.js +232 -0
- package/esm/formatter/entry_body.d.ts +86 -0
- package/esm/formatter/entry_body.d.ts.map +1 -0
- package/esm/formatter/entry_body.js +287 -0
- package/esm/formatter/mod.d.ts +13 -9
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +126 -50
- package/esm/gates/mod.d.ts +13 -2
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +41 -13
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +7 -5
- package/esm/lock/acquire_compile.d.ts +31 -0
- package/esm/lock/acquire_compile.d.ts.map +1 -0
- package/esm/lock/acquire_compile.js +83 -0
- package/esm/lock/cache_check.d.ts +28 -0
- package/esm/lock/cache_check.d.ts.map +1 -0
- package/esm/lock/cache_check.js +51 -0
- package/esm/lock/check.d.ts +14 -3
- package/esm/lock/check.d.ts.map +1 -1
- package/esm/lock/check.js +43 -4
- package/esm/lock/edge_drift.d.ts +2 -0
- package/esm/lock/edge_drift.d.ts.map +1 -1
- package/esm/lock/edge_drift.js +4 -0
- package/esm/lock/git_intent.d.ts +46 -0
- package/esm/lock/git_intent.d.ts.map +1 -0
- package/esm/lock/git_intent.js +111 -0
- package/esm/lock/mod.d.ts +11 -4
- package/esm/lock/mod.d.ts.map +1 -1
- package/esm/lock/mod.js +8 -2
- package/esm/lock/model.d.ts +24 -1
- package/esm/lock/model.d.ts.map +1 -1
- package/esm/lock/parser.d.ts.map +1 -1
- package/esm/lock/parser.js +32 -0
- package/esm/lock/pin_assurance.d.ts +20 -0
- package/esm/lock/pin_assurance.d.ts.map +1 -0
- package/esm/lock/pin_assurance.js +34 -0
- package/esm/lock/resolve.d.ts +8 -17
- package/esm/lock/resolve.d.ts.map +1 -1
- package/esm/lock/resolve.js +7 -67
- package/esm/lock/serializer.d.ts.map +1 -1
- package/esm/lock/serializer.js +23 -0
- package/esm/lock/upstream_common.d.ts +29 -0
- package/esm/lock/upstream_common.d.ts.map +1 -0
- package/esm/lock/upstream_common.js +38 -0
- package/esm/lock/upstream_deps.d.ts +63 -0
- package/esm/lock/upstream_deps.d.ts.map +1 -0
- package/esm/lock/upstream_deps.js +172 -0
- package/esm/lock/upstream_refs.d.ts +69 -0
- package/esm/lock/upstream_refs.d.ts.map +1 -0
- package/esm/lock/upstream_refs.js +238 -0
- package/esm/mod.d.ts +23 -11
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +20 -8
- package/esm/model/mod.d.ts +114 -28
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +76 -13
- package/esm/model/profile.d.ts +13 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/code_regions.d.ts +29 -0
- package/esm/parser/code_regions.d.ts.map +1 -0
- package/esm/parser/code_regions.js +38 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +110 -91
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +7 -1
- package/esm/parser/translate.d.ts.map +1 -1
- package/esm/parser/translate.js +5 -0
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +20 -3
- package/esm/profile/merge.js +7 -0
- package/esm/refs/mod.d.ts.map +1 -1
- package/esm/refs/mod.js +8 -19
- package/esm/reporter/mod.d.ts +11 -0
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +20 -9
- package/esm/typl/assemble.d.ts +53 -0
- package/esm/typl/assemble.d.ts.map +1 -0
- package/esm/typl/assemble.js +238 -0
- package/esm/typl/ast.d.ts +7 -1
- package/esm/typl/ast.d.ts.map +1 -1
- package/esm/typl/ast.js +3 -0
- package/esm/typl/bullet.d.ts +9 -7
- package/esm/typl/bullet.d.ts.map +1 -1
- package/esm/typl/bullet.js +6 -4
- package/esm/typl/citations.d.ts +27 -0
- package/esm/typl/citations.d.ts.map +1 -0
- package/esm/typl/citations.js +16 -0
- package/esm/typl/diagnostics.d.ts +2 -2
- package/esm/typl/diagnostics.d.ts.map +1 -1
- package/esm/typl/diagnostics.js +18 -0
- package/esm/typl/grammar.d.ts.map +1 -1
- package/esm/typl/grammar.js +6 -0
- package/esm/typl/lexer.d.ts.map +1 -1
- package/esm/typl/lexer.js +25 -4
- package/esm/typl/mod.d.ts +8 -2
- package/esm/typl/mod.d.ts.map +1 -1
- package/esm/typl/mod.js +5 -1
- package/esm/typl/recognize.js +2 -2
- package/esm/typl/registry.d.ts +1 -1
- package/esm/typl/resolve.d.ts +31 -0
- package/esm/typl/resolve.d.ts.map +1 -0
- package/esm/typl/resolve.js +27 -0
- package/esm/typl/table.d.ts +52 -0
- package/esm/typl/table.d.ts.map +1 -0
- package/esm/typl/table.js +69 -0
- package/esm/typl/validator.d.ts +24 -5
- package/esm/typl/validator.d.ts.map +1 -1
- package/esm/typl/validator.js +55 -75
- package/esm/upstream/mod.d.ts +45 -0
- package/esm/upstream/mod.d.ts.map +1 -0
- package/esm/upstream/mod.js +98 -0
- package/esm/upstream/project.d.ts +33 -0
- package/esm/upstream/project.d.ts.map +1 -0
- package/esm/upstream/project.js +38 -0
- package/esm/upstream/refs.d.ts +23 -0
- package/esm/upstream/refs.d.ts.map +1 -0
- package/esm/upstream/refs.js +71 -0
- package/esm/util/fence.d.ts +20 -29
- package/esm/util/fence.d.ts.map +1 -1
- package/esm/util/fence.js +42 -50
- package/esm/util/modals.d.ts +6 -0
- package/esm/util/modals.d.ts.map +1 -1
- package/esm/util/modals.js +37 -0
- package/esm/util/paths.d.ts +14 -0
- package/esm/util/paths.d.ts.map +1 -0
- package/esm/util/paths.js +22 -0
- package/esm/uxil/assemble.d.ts +38 -0
- package/esm/uxil/assemble.d.ts.map +1 -0
- package/esm/uxil/assemble.js +268 -0
- package/esm/uxil/ast.d.ts +63 -0
- package/esm/uxil/ast.d.ts.map +1 -0
- package/esm/uxil/ast.js +9 -0
- package/esm/uxil/citations.d.ts +27 -0
- package/esm/uxil/citations.d.ts.map +1 -0
- package/esm/uxil/citations.js +25 -0
- package/esm/uxil/diagnostics.d.ts +39 -0
- package/esm/uxil/diagnostics.d.ts.map +1 -0
- package/esm/uxil/diagnostics.js +135 -0
- package/esm/uxil/grammar.d.ts +72 -0
- package/esm/uxil/grammar.d.ts.map +1 -0
- package/esm/uxil/grammar.js +505 -0
- package/esm/uxil/lexer.d.ts +23 -0
- package/esm/uxil/lexer.d.ts.map +1 -0
- package/esm/uxil/lexer.js +58 -0
- package/esm/uxil/mod.d.ts +32 -0
- package/esm/uxil/mod.d.ts.map +1 -0
- package/esm/uxil/mod.js +11 -0
- package/esm/uxil/projection.d.ts +40 -0
- package/esm/uxil/projection.d.ts.map +1 -0
- package/esm/uxil/projection.js +41 -0
- package/esm/uxil/recognize.d.ts +16 -0
- package/esm/uxil/recognize.d.ts.map +1 -0
- package/esm/uxil/recognize.js +28 -0
- package/esm/uxil/registry.d.ts +37 -0
- package/esm/uxil/registry.d.ts.map +1 -0
- package/esm/uxil/registry.js +29 -0
- package/esm/uxil/surfaces.d.ts +36 -0
- package/esm/uxil/surfaces.d.ts.map +1 -0
- package/esm/uxil/surfaces.js +34 -0
- package/esm/uxil/validator.d.ts +36 -0
- package/esm/uxil/validator.d.ts.map +1 -0
- package/esm/uxil/validator.js +139 -0
- package/esm/uxil/vocab.d.ts +33 -0
- package/esm/uxil/vocab.d.ts.map +1 -0
- package/esm/uxil/vocab.js +36 -0
- package/esm/validator/body_blocks.d.ts +2 -1
- package/esm/validator/body_blocks.d.ts.map +1 -1
- package/esm/validator/body_blocks.js +80 -2
- package/esm/validator/caption_convention.d.ts +2 -1
- package/esm/validator/caption_convention.d.ts.map +1 -1
- package/esm/validator/caption_convention.js +2 -1
- package/esm/validator/corpus.d.ts +6 -0
- package/esm/validator/corpus.d.ts.map +1 -1
- package/esm/validator/corpus.js +55 -20
- package/esm/validator/discipline.d.ts +6 -4
- package/esm/validator/discipline.d.ts.map +1 -1
- package/esm/validator/discipline.js +6 -4
- package/esm/validator/mod.d.ts +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +29 -16
- package/esm/validator/pipeline.d.ts +11 -1
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +76 -23
- package/esm/validator/trace_types.d.ts +9 -2
- package/esm/validator/trace_types.d.ts.map +1 -1
- package/esm/validator/trace_types.js +21 -5
- package/esm/validator/traceability.d.ts +15 -3
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +39 -4
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +11 -1
- package/esm/validator/uxil_family.d.ts +43 -0
- package/esm/validator/uxil_family.d.ts.map +1 -0
- package/esm/validator/uxil_family.js +52 -0
- package/package.json +1 -1
- package/script/ast/normalize.d.ts +4 -5
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +5 -36
- package/script/collect/mod.d.ts +29 -9
- package/script/collect/mod.d.ts.map +1 -1
- package/script/collect/mod.js +38 -10
- package/script/compiler/deserialize.d.ts +49 -0
- package/script/compiler/deserialize.d.ts.map +1 -0
- package/script/compiler/deserialize.js +144 -0
- package/script/compiler/manifest.d.ts +3 -0
- package/script/compiler/manifest.d.ts.map +1 -1
- package/script/compiler/manifest.js +10 -3
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +16 -11
- package/script/config/markspec.d.ts +40 -1
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +129 -3
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +143 -147
- package/script/decl/duplicates.d.ts +29 -0
- package/script/decl/duplicates.d.ts.map +1 -0
- package/script/decl/duplicates.js +31 -0
- package/script/decl/mod.d.ts +4 -2
- package/script/decl/mod.d.ts.map +1 -1
- package/script/decl/mod.js +4 -2
- package/script/decl/surfaces.d.ts +29 -7
- package/script/decl/surfaces.d.ts.map +1 -1
- package/script/decl/surfaces.js +32 -19
- package/script/discovery/mod.d.ts +24 -8
- package/script/discovery/mod.d.ts.map +1 -1
- package/script/discovery/mod.js +56 -20
- package/script/discovery/projects.d.ts +109 -0
- package/script/discovery/projects.d.ts.map +1 -0
- package/script/discovery/projects.js +240 -0
- package/script/formatter/entry_body.d.ts +86 -0
- package/script/formatter/entry_body.d.ts.map +1 -0
- package/script/formatter/entry_body.js +292 -0
- package/script/formatter/mod.d.ts +13 -9
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +124 -48
- package/script/gates/mod.d.ts +13 -2
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +50 -22
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +6 -4
- package/script/lock/acquire_compile.d.ts +31 -0
- package/script/lock/acquire_compile.d.ts.map +1 -0
- package/script/lock/acquire_compile.js +86 -0
- package/script/lock/cache_check.d.ts +28 -0
- package/script/lock/cache_check.d.ts.map +1 -0
- package/script/lock/cache_check.js +54 -0
- package/script/lock/check.d.ts +14 -3
- package/script/lock/check.d.ts.map +1 -1
- package/script/lock/check.js +43 -4
- package/script/lock/edge_drift.d.ts +2 -0
- package/script/lock/edge_drift.d.ts.map +1 -1
- package/script/lock/edge_drift.js +5 -0
- package/script/lock/git_intent.d.ts +46 -0
- package/script/lock/git_intent.d.ts.map +1 -0
- package/script/lock/git_intent.js +115 -0
- package/script/lock/mod.d.ts +11 -4
- package/script/lock/mod.d.ts.map +1 -1
- package/script/lock/mod.js +17 -2
- package/script/lock/model.d.ts +24 -1
- package/script/lock/model.d.ts.map +1 -1
- package/script/lock/parser.d.ts.map +1 -1
- package/script/lock/parser.js +32 -0
- package/script/lock/pin_assurance.d.ts +20 -0
- package/script/lock/pin_assurance.d.ts.map +1 -0
- package/script/lock/pin_assurance.js +37 -0
- package/script/lock/resolve.d.ts +8 -17
- package/script/lock/resolve.d.ts.map +1 -1
- package/script/lock/resolve.js +7 -68
- package/script/lock/serializer.d.ts.map +1 -1
- package/script/lock/serializer.js +23 -0
- package/script/lock/upstream_common.d.ts +29 -0
- package/script/lock/upstream_common.d.ts.map +1 -0
- package/script/lock/upstream_common.js +42 -0
- package/script/lock/upstream_deps.d.ts +63 -0
- package/script/lock/upstream_deps.d.ts.map +1 -0
- package/script/lock/upstream_deps.js +175 -0
- package/script/lock/upstream_refs.d.ts +69 -0
- package/script/lock/upstream_refs.d.ts.map +1 -0
- package/script/lock/upstream_refs.js +244 -0
- package/script/mod.d.ts +23 -11
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +55 -7
- package/script/model/mod.d.ts +114 -28
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +81 -14
- package/script/model/profile.d.ts +13 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/code_regions.d.ts +29 -0
- package/script/parser/code_regions.d.ts.map +1 -0
- package/script/parser/code_regions.js +41 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +108 -89
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +7 -1
- package/script/parser/translate.d.ts.map +1 -1
- package/script/parser/translate.js +5 -0
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +20 -3
- package/script/profile/merge.js +7 -0
- package/script/refs/mod.d.ts.map +1 -1
- package/script/refs/mod.js +7 -18
- package/script/reporter/mod.d.ts +11 -0
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +19 -8
- package/script/typl/assemble.d.ts +53 -0
- package/script/typl/assemble.d.ts.map +1 -0
- package/script/typl/assemble.js +241 -0
- package/script/typl/ast.d.ts +7 -1
- package/script/typl/ast.d.ts.map +1 -1
- package/script/typl/ast.js +3 -0
- package/script/typl/bullet.d.ts +9 -7
- package/script/typl/bullet.d.ts.map +1 -1
- package/script/typl/bullet.js +6 -4
- package/script/typl/citations.d.ts +27 -0
- package/script/typl/citations.d.ts.map +1 -0
- package/script/typl/citations.js +20 -0
- package/script/typl/diagnostics.d.ts +2 -2
- package/script/typl/diagnostics.d.ts.map +1 -1
- package/script/typl/diagnostics.js +18 -0
- package/script/typl/grammar.d.ts.map +1 -1
- package/script/typl/grammar.js +6 -0
- package/script/typl/lexer.d.ts.map +1 -1
- package/script/typl/lexer.js +25 -4
- package/script/typl/mod.d.ts +8 -2
- package/script/typl/mod.d.ts.map +1 -1
- package/script/typl/mod.js +14 -2
- package/script/typl/recognize.js +2 -2
- package/script/typl/registry.d.ts +1 -1
- package/script/typl/resolve.d.ts +31 -0
- package/script/typl/resolve.d.ts.map +1 -0
- package/script/typl/resolve.js +33 -0
- package/script/typl/table.d.ts +52 -0
- package/script/typl/table.d.ts.map +1 -0
- package/script/typl/table.js +75 -0
- package/script/typl/validator.d.ts +24 -5
- package/script/typl/validator.d.ts.map +1 -1
- package/script/typl/validator.js +55 -75
- package/script/upstream/mod.d.ts +45 -0
- package/script/upstream/mod.d.ts.map +1 -0
- package/script/upstream/mod.js +101 -0
- package/script/upstream/project.d.ts +33 -0
- package/script/upstream/project.d.ts.map +1 -0
- package/script/upstream/project.js +41 -0
- package/script/upstream/refs.d.ts +23 -0
- package/script/upstream/refs.d.ts.map +1 -0
- package/script/upstream/refs.js +74 -0
- package/script/util/fence.d.ts +20 -29
- package/script/util/fence.d.ts.map +1 -1
- package/script/util/fence.js +47 -54
- package/script/util/modals.d.ts +6 -0
- package/script/util/modals.d.ts.map +1 -1
- package/script/util/modals.js +38 -0
- package/script/util/paths.d.ts +14 -0
- package/script/util/paths.d.ts.map +1 -0
- package/script/util/paths.js +25 -0
- package/script/uxil/assemble.d.ts +38 -0
- package/script/uxil/assemble.d.ts.map +1 -0
- package/script/uxil/assemble.js +272 -0
- package/script/uxil/ast.d.ts +63 -0
- package/script/uxil/ast.d.ts.map +1 -0
- package/script/uxil/ast.js +10 -0
- package/script/uxil/citations.d.ts +27 -0
- package/script/uxil/citations.d.ts.map +1 -0
- package/script/uxil/citations.js +29 -0
- package/script/uxil/diagnostics.d.ts +39 -0
- package/script/uxil/diagnostics.d.ts.map +1 -0
- package/script/uxil/diagnostics.js +140 -0
- package/script/uxil/grammar.d.ts +72 -0
- package/script/uxil/grammar.d.ts.map +1 -0
- package/script/uxil/grammar.js +511 -0
- package/script/uxil/lexer.d.ts +23 -0
- package/script/uxil/lexer.d.ts.map +1 -0
- package/script/uxil/lexer.js +61 -0
- package/script/uxil/mod.d.ts +32 -0
- package/script/uxil/mod.d.ts.map +1 -0
- package/script/uxil/mod.js +37 -0
- package/script/uxil/projection.d.ts +40 -0
- package/script/uxil/projection.d.ts.map +1 -0
- package/script/uxil/projection.js +44 -0
- package/script/uxil/recognize.d.ts +16 -0
- package/script/uxil/recognize.d.ts.map +1 -0
- package/script/uxil/recognize.js +31 -0
- package/script/uxil/registry.d.ts +37 -0
- package/script/uxil/registry.d.ts.map +1 -0
- package/script/uxil/registry.js +32 -0
- package/script/uxil/surfaces.d.ts +36 -0
- package/script/uxil/surfaces.d.ts.map +1 -0
- package/script/uxil/surfaces.js +39 -0
- package/script/uxil/validator.d.ts +36 -0
- package/script/uxil/validator.d.ts.map +1 -0
- package/script/uxil/validator.js +142 -0
- package/script/uxil/vocab.d.ts +33 -0
- package/script/uxil/vocab.d.ts.map +1 -0
- package/script/uxil/vocab.js +41 -0
- package/script/validator/body_blocks.d.ts +2 -1
- package/script/validator/body_blocks.d.ts.map +1 -1
- package/script/validator/body_blocks.js +80 -2
- package/script/validator/caption_convention.d.ts +2 -1
- package/script/validator/caption_convention.d.ts.map +1 -1
- package/script/validator/caption_convention.js +2 -1
- package/script/validator/corpus.d.ts +6 -0
- package/script/validator/corpus.d.ts.map +1 -1
- package/script/validator/corpus.js +55 -19
- package/script/validator/discipline.d.ts +6 -4
- package/script/validator/discipline.d.ts.map +1 -1
- package/script/validator/discipline.js +6 -4
- package/script/validator/mod.d.ts +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +29 -15
- package/script/validator/pipeline.d.ts +11 -1
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +75 -22
- package/script/validator/trace_types.d.ts +9 -2
- package/script/validator/trace_types.d.ts.map +1 -1
- package/script/validator/trace_types.js +20 -4
- package/script/validator/traceability.d.ts +15 -3
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +38 -3
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +10 -0
- package/script/validator/uxil_family.d.ts +43 -0
- package/script/validator/uxil_family.d.ts.map +1 -0
- package/script/validator/uxil_family.js +56 -0
package/esm/decl/mod.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* against the base an enclosing declaration establishes. typl consumes
|
|
10
10
|
* these today; uxil (§B) rides on the same substrate.
|
|
11
11
|
*/
|
|
12
|
-
export {
|
|
12
|
+
export { extractFenceDeclarations, extractInlineDeclarations, extractNestedBulletDeclarations, stripCodeSpanDelimiters, } from "./surfaces.js";
|
|
13
13
|
export { extractTableDeclarations } from "./table.js";
|
|
14
14
|
export { checkSingleRoot, resolveRef } from "./resolve.js";
|
|
15
|
+
export { findDuplicateDeclarations } from "./duplicates.js";
|
package/esm/decl/surfaces.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - **fence** — a fenced code block whose info-string a DSL claims
|
|
9
9
|
* (e.g. ```typl). {@linkcode extractFenceDeclarations}
|
|
10
10
|
* - **bullet** — a list item whose first paragraph is a declaration.
|
|
11
|
-
* {@linkcode
|
|
11
|
+
* {@linkcode extractNestedBulletDeclarations}
|
|
12
12
|
* - **inline** — a CommonMark code span whose text is a declaration.
|
|
13
13
|
* {@linkcode extractInlineDeclarations}
|
|
14
14
|
*
|
|
@@ -47,6 +47,15 @@ export interface InlineDeclaration {
|
|
|
47
47
|
readonly source: string;
|
|
48
48
|
/** File-relative location of the code span. */
|
|
49
49
|
readonly location: SourceLocation;
|
|
50
|
+
/**
|
|
51
|
+
* Column of the span's inner text: `location.column` plus the opening
|
|
52
|
+
* delimiter width. A DSL host composes span-relative parse-diagnostic
|
|
53
|
+
* columns against this, not `location.column` (#727). Note the token
|
|
54
|
+
* model canonicalises `text` to single-backtick delimiters, so the
|
|
55
|
+
* width is 1 in practice — a double-backtick original anchors one
|
|
56
|
+
* column left (accepted wart, same class as the typl indent wart).
|
|
57
|
+
*/
|
|
58
|
+
readonly innerColumn: number;
|
|
50
59
|
}
|
|
51
60
|
/** Recognizer for the fence surface: does this info-string host the DSL? */
|
|
52
61
|
export type FenceRecognizer = (lang: string | undefined) => boolean;
|
|
@@ -62,15 +71,28 @@ export type TextRecognizer = (text: string) => boolean;
|
|
|
62
71
|
* source order (depth-first traversal).
|
|
63
72
|
*/
|
|
64
73
|
export declare function extractFenceDeclarations(blocks: readonly BodyBlock[], matchLang: FenceRecognizer): readonly BlockDeclaration[];
|
|
74
|
+
/**
|
|
75
|
+
* A bullet declaration with its structural parent: the index (into the
|
|
76
|
+
* returned array) of the nearest enclosing extracted declaration, or
|
|
77
|
+
* `undefined` at top level. Parents always precede children in the
|
|
78
|
+
* depth-first output order, so `parent < index` holds for every link.
|
|
79
|
+
* The base-resolution engine (resolve.ts) consumes these links to build
|
|
80
|
+
* its innermost-wins scope chains (#723).
|
|
81
|
+
*/
|
|
82
|
+
export interface NestedBlockDeclaration extends BlockDeclaration {
|
|
83
|
+
readonly parent?: number;
|
|
84
|
+
}
|
|
65
85
|
/**
|
|
66
86
|
* Walk a body AST and return every bullet-list item whose first paragraph
|
|
67
|
-
* satisfies `matchText
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
87
|
+
* satisfies `matchText`, in depth-first source order, each with a `parent`
|
|
88
|
+
* link to its nearest enclosing extracted declaration (or `undefined` at
|
|
89
|
+
* top level). Recurses through ListNode → ListItemNode.blocks for nested
|
|
90
|
+
* lists. Mixed lists are supported: items whose first paragraph matches
|
|
91
|
+
* are extracted; non-matching bullets are left alone. A DSL host walks
|
|
92
|
+
* the `parent` links to build the {@linkcode BaseScope} chain a nested
|
|
93
|
+
* declaration resolves against.
|
|
72
94
|
*/
|
|
73
|
-
export declare function
|
|
95
|
+
export declare function extractNestedBulletDeclarations(blocks: readonly BodyBlock[], matchText: TextRecognizer): readonly NestedBlockDeclaration[];
|
|
74
96
|
/**
|
|
75
97
|
* Strip the surrounding backtick delimiter(s) from an inline-code token's
|
|
76
98
|
* `text` field. `body_tokens.ts` stores inline-code text as `` `value` ``
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../src/decl/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../src/decl/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC;AAEpE,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,eAAe,GACzB,SAAS,gBAAgB,EAAE,CAY7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,SAAS,sBAAsB,EAAE,CA8BnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,SAAS,EAAE,cAAc,GACxB,SAAS,iBAAiB,EAAE,CAc9B"}
|
package/esm/decl/surfaces.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - **fence** — a fenced code block whose info-string a DSL claims
|
|
9
9
|
* (e.g. ```typl). {@linkcode extractFenceDeclarations}
|
|
10
10
|
* - **bullet** — a list item whose first paragraph is a declaration.
|
|
11
|
-
* {@linkcode
|
|
11
|
+
* {@linkcode extractNestedBulletDeclarations}
|
|
12
12
|
* - **inline** — a CommonMark code span whose text is a declaration.
|
|
13
13
|
* {@linkcode extractInlineDeclarations}
|
|
14
14
|
*
|
|
@@ -48,35 +48,43 @@ export function extractFenceDeclarations(blocks, matchLang) {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Walk a body AST and return every bullet-list item whose first paragraph
|
|
51
|
-
* satisfies `matchText
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
51
|
+
* satisfies `matchText`, in depth-first source order, each with a `parent`
|
|
52
|
+
* link to its nearest enclosing extracted declaration (or `undefined` at
|
|
53
|
+
* top level). Recurses through ListNode → ListItemNode.blocks for nested
|
|
54
|
+
* lists. Mixed lists are supported: items whose first paragraph matches
|
|
55
|
+
* are extracted; non-matching bullets are left alone. A DSL host walks
|
|
56
|
+
* the `parent` links to build the {@linkcode BaseScope} chain a nested
|
|
57
|
+
* declaration resolves against.
|
|
56
58
|
*/
|
|
57
|
-
export function
|
|
59
|
+
export function extractNestedBulletDeclarations(blocks, matchText) {
|
|
58
60
|
const results = [];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
const walk = (blocks, parent) => {
|
|
62
|
+
for (const block of blocks) {
|
|
63
|
+
if (block.kind !== "list")
|
|
64
|
+
continue;
|
|
61
65
|
for (const item of block.items) {
|
|
62
66
|
if (item.blocks.length === 0)
|
|
63
67
|
continue;
|
|
64
68
|
const first = item.blocks[0];
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
let itemParent = parent;
|
|
70
|
+
if (first.kind === "paragraph" && matchText(first.content.text)) {
|
|
71
|
+
results.push({
|
|
72
|
+
source: first.content.text,
|
|
73
|
+
range: first.range,
|
|
74
|
+
parent,
|
|
75
|
+
});
|
|
76
|
+
itemParent = results.length - 1;
|
|
69
77
|
}
|
|
70
|
-
// Recurse into nested blocks (the item may itself contain a list).
|
|
71
78
|
if (item.blocks.length > 1) {
|
|
72
|
-
|
|
79
|
+
walk(item.blocks.slice(1), itemParent);
|
|
73
80
|
}
|
|
74
81
|
else if (first.kind === "list") {
|
|
75
|
-
|
|
82
|
+
walk([first], itemParent);
|
|
76
83
|
}
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
|
-
}
|
|
86
|
+
};
|
|
87
|
+
walk(blocks, undefined);
|
|
80
88
|
return results;
|
|
81
89
|
}
|
|
82
90
|
/**
|
|
@@ -116,7 +124,12 @@ export function extractInlineDeclarations(bodyTokens, matchText) {
|
|
|
116
124
|
const inner = stripCodeSpanDelimiters(token.text);
|
|
117
125
|
if (!matchText(inner))
|
|
118
126
|
continue;
|
|
119
|
-
|
|
127
|
+
const delim = token.text.startsWith("``") ? 2 : 1;
|
|
128
|
+
results.push({
|
|
129
|
+
source: inner,
|
|
130
|
+
location: token.location,
|
|
131
|
+
innerColumn: token.location.column + delim,
|
|
132
|
+
});
|
|
120
133
|
}
|
|
121
134
|
return results;
|
|
122
135
|
}
|
package/esm/discovery/mod.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module core/discovery
|
|
3
3
|
*
|
|
4
|
-
* Gitignore-aware project file discovery
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* root, honoring (in
|
|
4
|
+
* Gitignore-aware project file discovery shared by CLI scope resolution,
|
|
5
|
+
* LSP indexing, lockfile entry collection and nested-project discovery.
|
|
6
|
+
* Yields absolute paths of MarkSpec-relevant files under a
|
|
7
|
+
* root, unconditionally skipping hidden directories and honoring (in
|
|
8
|
+
* precedence order):
|
|
8
9
|
*
|
|
9
|
-
* 1. built-in skips —
|
|
10
|
-
* 2. `.gitignore` files (root + nested, standard semantics)
|
|
11
|
-
*
|
|
10
|
+
* 1. built-in skips — common build-output directories
|
|
11
|
+
* 2. `.gitignore` files (root + nested, standard semantics), plus, when
|
|
12
|
+
* the caller names an enclosing folder, the `.gitignore` files of the
|
|
13
|
+
* folders from that folder down to the root's parent
|
|
14
|
+
* 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored),
|
|
15
|
+
* applied last at every directory level, including for negations
|
|
12
16
|
*
|
|
13
17
|
* I/O is injected via {@linkcode DiscoveryIO} so the module stays
|
|
14
18
|
* Node-compatible; entry points supply the Deno implementation.
|
|
@@ -42,8 +46,20 @@ export interface DiscoverOptions {
|
|
|
42
46
|
/** Extension filter; defaults to {@linkcode RELEVANT_EXTENSIONS}. */
|
|
43
47
|
readonly extensions?: ReadonlySet<string>;
|
|
44
48
|
/** Extra gitignore-syntax patterns, anchored at `root` (e.g. from
|
|
45
|
-
*
|
|
49
|
+
* `.markspec.yaml` `exclude:`). Applied after built-in build-output skips and
|
|
50
|
+
* `.gitignore` rules at every directory level. Negations can re-include
|
|
51
|
+
* non-hidden directories; an ignored parent must also be re-included. */
|
|
46
52
|
readonly exclude?: readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* An enclosing folder of `root`, such as the root of the project that a
|
|
55
|
+
* nested project lies in. The `.gitignore` files of the folders from it
|
|
56
|
+
* down to the parent of `root` also apply, each anchored to its own
|
|
57
|
+
* folder, so the walk of a nested project skips the files that those
|
|
58
|
+
* `.gitignore` files ignore. Only `.gitignore` files are inherited, not
|
|
59
|
+
* the enclosing folder's `exclude` patterns. No `.gitignore` above this
|
|
60
|
+
* folder is read. Ignored when it is not a strict ancestor of `root`.
|
|
61
|
+
*/
|
|
62
|
+
readonly inheritGitignoreFrom?: string;
|
|
47
63
|
}
|
|
48
64
|
/**
|
|
49
65
|
* Walk `root` recursively, yielding absolute paths of relevant files.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discovery/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discovery/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAmBhD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAoB,CAAC;AAEzE,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH;mDACmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACxD,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACrD;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C;;;6EAGyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AA8BD;;;;GAIG;AACH,wBAAuB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAAC,MAAM,CAAC,CAsBxB"}
|
package/esm/discovery/mod.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module core/discovery
|
|
3
3
|
*
|
|
4
|
-
* Gitignore-aware project file discovery
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* root, honoring (in
|
|
4
|
+
* Gitignore-aware project file discovery shared by CLI scope resolution,
|
|
5
|
+
* LSP indexing, lockfile entry collection and nested-project discovery.
|
|
6
|
+
* Yields absolute paths of MarkSpec-relevant files under a
|
|
7
|
+
* root, unconditionally skipping hidden directories and honoring (in
|
|
8
|
+
* precedence order):
|
|
8
9
|
*
|
|
9
|
-
* 1. built-in skips —
|
|
10
|
-
* 2. `.gitignore` files (root + nested, standard semantics)
|
|
11
|
-
*
|
|
10
|
+
* 1. built-in skips — common build-output directories
|
|
11
|
+
* 2. `.gitignore` files (root + nested, standard semantics), plus, when
|
|
12
|
+
* the caller names an enclosing folder, the `.gitignore` files of the
|
|
13
|
+
* folders from that folder down to the root's parent
|
|
14
|
+
* 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored),
|
|
15
|
+
* applied last at every directory level, including for negations
|
|
12
16
|
*
|
|
13
17
|
* I/O is injected via {@linkcode DiscoveryIO} so the module stays
|
|
14
18
|
* Node-compatible; entry points supply the Deno implementation.
|
|
15
19
|
*/
|
|
16
|
-
import { extname, join } from "@std/path";
|
|
20
|
+
import { extname, join, relative, resolve, SEPARATOR } from "@std/path";
|
|
17
21
|
import { isIgnored, parseGitignore } from "./gitignore.js";
|
|
18
22
|
export { isIgnored, parseGitignore } from "./gitignore.js";
|
|
19
23
|
/**
|
|
@@ -58,9 +62,9 @@ export const RELEVANT_EXTENSIONS = new Set([
|
|
|
58
62
|
* indexing, spurious `MSL-L212` edge-hash entries).
|
|
59
63
|
*
|
|
60
64
|
* Unlike the hidden-dir skip these are overridable: they are applied as the
|
|
61
|
-
*
|
|
62
|
-
* negated `!target/` entry in either re-includes
|
|
63
|
-
* last-match-wins.
|
|
65
|
+
* lowest-precedence rule layer (before `.gitignore` and `exclude:`), so a
|
|
66
|
+
* negated `!target/` entry in either re-includes that directory under
|
|
67
|
+
* gitignore last-match-wins.
|
|
64
68
|
*/
|
|
65
69
|
const BUILTIN_SKIP_DIRS = [
|
|
66
70
|
"node_modules",
|
|
@@ -78,19 +82,51 @@ const BUILTIN_SKIP_RULES = parseGitignore(BUILTIN_SKIP_DIRS.map((d) => `${d}/`).
|
|
|
78
82
|
*/
|
|
79
83
|
export async function* discoverFiles(root, io, options = {}) {
|
|
80
84
|
const extensions = options.extensions ?? RELEVANT_EXTENSIONS;
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
|
|
85
|
+
const inherited = options.inheritGitignoreFrom === undefined
|
|
86
|
+
? { rules: [], prefix: "" }
|
|
87
|
+
: await inheritedGitignoreRules(options.inheritGitignoreFrom, root, io);
|
|
88
|
+
// With inherited rules, every rule is matched against paths relative to
|
|
89
|
+
// the enclosing folder, so `prefix` is the path from it down to `root`.
|
|
90
|
+
const prefix = inherited.prefix;
|
|
91
|
+
const excludeRules = parseGitignore((options.exclude ?? []).join("\n"), prefix);
|
|
92
|
+
// Carry excludes separately: they must stay after every `.gitignore`,
|
|
93
|
+
// including ones loaded deeper in the walk.
|
|
94
|
+
yield* walk(root, prefix, [...BUILTIN_SKIP_RULES, ...inherited.rules], excludeRules, io, extensions);
|
|
86
95
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Collect the `.gitignore` rules of the folders from `from` down to the
|
|
98
|
+
* parent of `root`, outermost first, each anchored to its own folder.
|
|
99
|
+
* Returns them with the POSIX path from `from` down to `root`. Returns no
|
|
100
|
+
* rules and an empty path when `from` is not a strict ancestor of `root`.
|
|
101
|
+
*/
|
|
102
|
+
async function inheritedGitignoreRules(from, root, io) {
|
|
103
|
+
const rel = relative(resolve(from), resolve(root));
|
|
104
|
+
if (rel === "" || rel === ".." || rel.startsWith(`..${SEPARATOR}`)) {
|
|
105
|
+
return { rules: [], prefix: "" };
|
|
106
|
+
}
|
|
107
|
+
const segments = rel.split(SEPARATOR);
|
|
108
|
+
const rules = [];
|
|
109
|
+
for (let i = 0; i < segments.length; i++) {
|
|
110
|
+
const raw = await io.readFile(join(from, ...segments.slice(0, i), ".gitignore"));
|
|
111
|
+
if (raw === undefined || raw.length === 0)
|
|
112
|
+
continue;
|
|
113
|
+
rules.push(...parseGitignore(raw, segments.slice(0, i).join("/")));
|
|
114
|
+
}
|
|
115
|
+
return { rules, prefix: segments.join("/") };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Walk `absDir`. `relDir` is the POSIX path of `absDir` relative to the
|
|
119
|
+
* folder the rules are anchored at (the enclosing folder when rules are
|
|
120
|
+
* inherited, else the walk root); `""` for that folder itself.
|
|
121
|
+
*/
|
|
122
|
+
async function* walk(absDir, relDir, rules, excludeRules, io, extensions) {
|
|
123
|
+
// Deeper `.gitignore` rules win over inherited ones. Excludes stay last
|
|
124
|
+
// for this directory's decisions, but are not inherited as gitignore rules.
|
|
90
125
|
const raw = await io.readFile(join(absDir, ".gitignore"));
|
|
91
|
-
const
|
|
126
|
+
const gitignoreRules = raw !== undefined && raw.length > 0
|
|
92
127
|
? [...rules, ...parseGitignore(raw, relDir)]
|
|
93
128
|
: rules;
|
|
129
|
+
const active = [...gitignoreRules, ...excludeRules];
|
|
94
130
|
const entries = [];
|
|
95
131
|
try {
|
|
96
132
|
for await (const e of io.readDir(absDir))
|
|
@@ -109,7 +145,7 @@ async function* walk(absDir, relDir, rules, io, extensions) {
|
|
|
109
145
|
// re-included, so pruning here is correct (and fast).
|
|
110
146
|
if (isIgnored(rel, true, active))
|
|
111
147
|
continue;
|
|
112
|
-
yield* walk(join(absDir, entry.name), rel,
|
|
148
|
+
yield* walk(join(absDir, entry.name), rel, gitignoreRules, excludeRules, io, extensions);
|
|
113
149
|
}
|
|
114
150
|
else if (entry.isFile) {
|
|
115
151
|
if (!extensions.has(extname(entry.name).toLowerCase()))
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/discovery/projects
|
|
3
|
+
*
|
|
4
|
+
* Project-root discovery shared by the CLI, the LSP and the MCP server.
|
|
5
|
+
*
|
|
6
|
+
* A "project root" is a directory that holds a `project.yaml` or a
|
|
7
|
+
* `.markspec.yaml`. {@linkcode discoverProjectRoots} finds the primary
|
|
8
|
+
* root by walking up from a start folder, then every nested root below
|
|
9
|
+
* it with the gitignore-aware file walk.
|
|
10
|
+
*/
|
|
11
|
+
import { type DiscoveryIO } from "./mod.js";
|
|
12
|
+
/** `true` when `path` is `root` itself or lies below it. */
|
|
13
|
+
export declare function isWithin(root: string, path: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Return the deepest root in `roots` that is `dir` itself or an ancestor
|
|
16
|
+
* of `dir`, or `undefined` when none is.
|
|
17
|
+
*/
|
|
18
|
+
export declare function nearestRoot(dir: string, roots: Iterable<string>): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Walk up from `startDir` to the nearest `project.yaml`, else the nearest
|
|
21
|
+
* `.markspec.yaml`. Returns `undefined` when neither exists.
|
|
22
|
+
*
|
|
23
|
+
* The LSP server and the MCP server use this order to find the root
|
|
24
|
+
* above their workspace. The CLI (`check`, `fmt`, `lint`) uses
|
|
25
|
+
* {@linkcode createProjectRootResolver}, which starts from this nearest
|
|
26
|
+
* config root but skips a config that an enclosing project hides (#845).
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveConfigRoot(startDir: string, readFile: (path: string) => Promise<string | undefined>): Promise<string | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Directories strictly below `root` that a document walk-up would
|
|
31
|
+
* resolve to, found with the gitignore-aware project walk (honouring
|
|
32
|
+
* `exclude`). Each discovered `project.yaml` or `.markspec.yaml` is
|
|
33
|
+
* resolved with {@linkcode resolveConfigRoot} from its own directory, so a
|
|
34
|
+
* `.markspec.yaml` below a `project.yaml` is not a root of its own — the
|
|
35
|
+
* same answer the CLI gives for a file there. A found root is dropped when
|
|
36
|
+
* the `.markspec.yaml` `exclude:` list of another found root above it
|
|
37
|
+
* covers it: each project's exclude list applies to its own subtree, with
|
|
38
|
+
* patterns relative to that project. The result is sorted.
|
|
39
|
+
*/
|
|
40
|
+
export declare function findNestedProjectRoots(root: string, io: DiscoveryIO, exclude?: readonly string[]): Promise<string[]>;
|
|
41
|
+
/** Options for {@linkcode discoverProjectRoots}. */
|
|
42
|
+
export interface ProjectDiscoveryOptions {
|
|
43
|
+
/** The user's home folder. When the primary root equals this folder, no
|
|
44
|
+
* downward scan runs from it. */
|
|
45
|
+
readonly homeDir?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Find every MarkSpec project reachable from `startDir`.
|
|
49
|
+
*
|
|
50
|
+
* `primaryRoot` is the nearest config root found by walking up from
|
|
51
|
+
* `startDir` (see {@linkcode resolveConfigRoot}), or `startDir` itself
|
|
52
|
+
* when there is none. `roots` holds the primary root (only when it has a
|
|
53
|
+
* config) plus every nested root below it, sorted. The nested scan honours
|
|
54
|
+
* the primary project's `.markspec.yaml` `exclude:` list, and each nested
|
|
55
|
+
* project's own list for the folders below it.
|
|
56
|
+
*
|
|
57
|
+
* When the primary root is a filesystem root or `options.homeDir`, no
|
|
58
|
+
* downward scan runs, even when that folder holds a config: `roots` then
|
|
59
|
+
* holds only the primary root when it has a config, and is empty
|
|
60
|
+
* otherwise.
|
|
61
|
+
*/
|
|
62
|
+
export declare function discoverProjectRoots(startDir: string, io: DiscoveryIO, options?: ProjectDiscoveryOptions): Promise<{
|
|
63
|
+
primaryRoot: string;
|
|
64
|
+
roots: string[];
|
|
65
|
+
}>;
|
|
66
|
+
/** Answers which project root owns a folder; see
|
|
67
|
+
* {@linkcode createProjectRootResolver}. */
|
|
68
|
+
export interface ProjectRootResolver {
|
|
69
|
+
/**
|
|
70
|
+
* The project root that owns files in `dir`, or `undefined` when no
|
|
71
|
+
* `project.yaml` or `.markspec.yaml` is at or above `dir`.
|
|
72
|
+
*/
|
|
73
|
+
ownerOf(dir: string): Promise<string | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* The nested project roots below `root`
|
|
76
|
+
* ({@linkcode findNestedProjectRoots} with the `.markspec.yaml`
|
|
77
|
+
* `exclude:` list of `root`). Cached per root.
|
|
78
|
+
*/
|
|
79
|
+
nestedRoots(root: string): Promise<string[]>;
|
|
80
|
+
/**
|
|
81
|
+
* The outermost project root at or above `dir`: the root from which the
|
|
82
|
+
* LSP would index `dir` when its workspace is the outermost project. A
|
|
83
|
+
* nested project's walk inherits the `.gitignore` files from this root
|
|
84
|
+
* down (`discoverFiles` option `inheritGitignoreFrom`). `undefined` when
|
|
85
|
+
* no `project.yaml` or `.markspec.yaml` is at or above `dir`.
|
|
86
|
+
*/
|
|
87
|
+
outermostOf(dir: string): Promise<string | undefined>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a resolver that gives, for any folder, the project root the LSP
|
|
91
|
+
* would give a document in that folder when the editor workspace is the
|
|
92
|
+
* outermost project root above it (#845).
|
|
93
|
+
*
|
|
94
|
+
* The nearest config root {@linkcode resolveConfigRoot} finds is not
|
|
95
|
+
* always the owner: when an enclosing project hides that config (an
|
|
96
|
+
* `exclude:` entry, a `.gitignore` entry, a hidden folder), the LSP and
|
|
97
|
+
* the MCP server never treat it as a root, and its files belong to the
|
|
98
|
+
* enclosing project. So the resolver walks up from the nearest config
|
|
99
|
+
* root to the outermost enclosing one, finds the nested roots below that
|
|
100
|
+
* outermost root the way the LSP does, and returns the deepest of them
|
|
101
|
+
* that contains `dir`.
|
|
102
|
+
*
|
|
103
|
+
* The walk up stops before a filesystem root and before
|
|
104
|
+
* `options.homeDir`: {@linkcode discoverProjectRoots} never scans down
|
|
105
|
+
* from those folders, so a stray config there must not claim every
|
|
106
|
+
* project below it. Results are cached per folder.
|
|
107
|
+
*/
|
|
108
|
+
export declare function createProjectRootResolver(io: DiscoveryIO, options?: ProjectDiscoveryOptions): ProjectRootResolver;
|
|
109
|
+
//# sourceMappingURL=projects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/discovery/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAS3D,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GACtB,MAAM,GAAG,SAAS,CAOpB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GACtD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG7B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,CAqCnB;AAgBD,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC;qCACiC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoBnD;AAED;4CAC4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClD;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C;;;;;;OAMG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,uBAA4B,GACpC,mBAAmB,CAqErB"}
|