@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/typl/validator.js
CHANGED
|
@@ -1,54 +1,82 @@
|
|
|
1
|
+
import { emittableEntries } from "../model/mod.js";
|
|
2
|
+
import { extractTyplCitations } from "./citations.js";
|
|
3
|
+
import { findDuplicateDeclarations, resolveRef } from "../decl/mod.js";
|
|
1
4
|
import { typlDiagnostic } from "./diagnostics.js";
|
|
2
5
|
import { buildTypeRegistry } from "./registry.js";
|
|
6
|
+
import { TYPL_REF_OPS } from "./resolve.js";
|
|
3
7
|
/**
|
|
4
8
|
* Validate the typl declarations across all entries.
|
|
5
9
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
10
|
+
* Upstream entries (federated-upstream epic) are typl-inert: they are
|
|
11
|
+
* excluded from the working set before the registry is built, so their
|
|
12
|
+
* declarations neither emit their own TYPL diagnostics nor count toward
|
|
13
|
+
* the corpus-wide declared-once (TYPL-009) accounting — a project entry
|
|
14
|
+
* re-declaring a dotted name an upstream also publishes is not a
|
|
15
|
+
* collision. Cross-repo typl resolution is out of scope for this slice
|
|
16
|
+
* (see ADR-019 / federated-upstream design §4.7); this is the same #771
|
|
17
|
+
* `emittableEntries` partition the validator orchestrators apply.
|
|
18
|
+
*
|
|
19
|
+
* Returns the built corpus registry (scoped to non-upstream entries)
|
|
20
|
+
* plus any diagnostics. The registry is returned even when diagnostics
|
|
21
|
+
* are present so callers (compiler, LSP) can use it for navigation and
|
|
22
|
+
* emission.
|
|
9
23
|
*/
|
|
10
24
|
export function validateTypl(entries) {
|
|
11
|
-
const
|
|
25
|
+
const localEntries = emittableEntries(entries);
|
|
26
|
+
const registry = buildTypeRegistry(localEntries);
|
|
12
27
|
const diagnostics = [];
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
// Published tier (#723): dotted names are declared exactly once
|
|
29
|
+
// corpus-wide — every declaration after the first is TYPL-009. Plain
|
|
30
|
+
// (entry-local) names have no cross-entry rule: TYPL-002/003 are
|
|
31
|
+
// retired (deprecated, never emitted — see diagnostics.ts).
|
|
32
|
+
for (const { name, first, duplicates } of findDuplicateDeclarations(registry.bindings, (name) => name.includes("."))) {
|
|
33
|
+
for (const dup of duplicates) {
|
|
34
|
+
const td = typlDiagnostic("TYPL-009", {
|
|
35
|
+
name,
|
|
36
|
+
otherFile: first.entryFile,
|
|
37
|
+
otherLine: first.binding.position.line,
|
|
38
|
+
}, dup.binding.position);
|
|
39
|
+
diagnostics.push({
|
|
40
|
+
code: td.code,
|
|
41
|
+
severity: td.severity,
|
|
42
|
+
message: td.message,
|
|
43
|
+
location: { file: dup.entryFile, line: 1, column: 1 },
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Citation validation (#723): bare published-shaped code spans must
|
|
48
|
+
// resolve (relative → entry root namespace) to a declared symbol.
|
|
49
|
+
for (const entry of localEntries) {
|
|
50
|
+
const citations = extractTyplCitations(entry.bodyTokens);
|
|
51
|
+
if (citations.length === 0)
|
|
16
52
|
continue;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
kindA: dup.binding.kind,
|
|
24
|
-
kindB: first.binding.kind,
|
|
25
|
-
otherFile: first.entryFile,
|
|
26
|
-
otherLine: first.binding.position.line,
|
|
27
|
-
}, dup.binding.position);
|
|
53
|
+
const root = entry.types?.rootNamespace;
|
|
54
|
+
const scope = root !== undefined ? { base: root } : undefined;
|
|
55
|
+
for (const citation of citations) {
|
|
56
|
+
const res = resolveRef(citation.name, scope, TYPL_REF_OPS);
|
|
57
|
+
if (!res.ok) {
|
|
58
|
+
const td = typlDiagnostic("TYPL-010", { name: citation.name }, { line: citation.location.line, column: citation.location.column });
|
|
28
59
|
diagnostics.push({
|
|
29
60
|
code: td.code,
|
|
30
61
|
severity: td.severity,
|
|
31
62
|
message: td.message,
|
|
32
|
-
location:
|
|
63
|
+
location: citation.location,
|
|
33
64
|
});
|
|
65
|
+
continue;
|
|
34
66
|
}
|
|
35
|
-
|
|
36
|
-
const td = typlDiagnostic("TYPL-
|
|
37
|
-
name,
|
|
38
|
-
otherFile: first.entryFile,
|
|
39
|
-
otherLine: first.binding.position.line,
|
|
40
|
-
}, dup.binding.position);
|
|
67
|
+
if (!registry.bindings.has(res.ref)) {
|
|
68
|
+
const td = typlDiagnostic("TYPL-011", { name: res.ref }, { line: citation.location.line, column: citation.location.column });
|
|
41
69
|
diagnostics.push({
|
|
42
70
|
code: td.code,
|
|
43
71
|
severity: td.severity,
|
|
44
72
|
message: td.message,
|
|
45
|
-
location:
|
|
73
|
+
location: citation.location,
|
|
46
74
|
});
|
|
47
75
|
}
|
|
48
76
|
}
|
|
49
77
|
}
|
|
50
78
|
// Intra-entry undefined typedef ref (TYPL-005)
|
|
51
|
-
for (const entry of
|
|
79
|
+
for (const entry of localEntries) {
|
|
52
80
|
if (!entry.types)
|
|
53
81
|
continue;
|
|
54
82
|
const localTypedefs = new Set(entry.types.typedefs.map((t) => t.name));
|
|
@@ -91,51 +119,3 @@ function collectRefDiagnostics(shape, localTypedefs, entry, line, out) {
|
|
|
91
119
|
// are leaves with no nested shape — nothing to recurse into.
|
|
92
120
|
}
|
|
93
121
|
}
|
|
94
|
-
function shapesEqual(a, b) {
|
|
95
|
-
if (a === b)
|
|
96
|
-
return true;
|
|
97
|
-
if (!a || !b)
|
|
98
|
-
return false;
|
|
99
|
-
if (a.kind !== b.kind)
|
|
100
|
-
return false;
|
|
101
|
-
switch (a.kind) {
|
|
102
|
-
case "primitive":
|
|
103
|
-
return a.type === b.type;
|
|
104
|
-
case "range":
|
|
105
|
-
return a.type === b.type &&
|
|
106
|
-
a.exact === b.exact &&
|
|
107
|
-
a.min === b.min &&
|
|
108
|
-
a.max === b.max;
|
|
109
|
-
case "length":
|
|
110
|
-
return a.type === b.type &&
|
|
111
|
-
a.exact === b.exact &&
|
|
112
|
-
a.min === b.min &&
|
|
113
|
-
a.max === b.max;
|
|
114
|
-
case "pattern":
|
|
115
|
-
return a.regex === b.regex &&
|
|
116
|
-
a.flags === b.flags;
|
|
117
|
-
case "literal":
|
|
118
|
-
return a.value === b.value;
|
|
119
|
-
case "enum":
|
|
120
|
-
return a.values.length === b.values.length &&
|
|
121
|
-
a.values.every((v, i) => v === b.values[i]);
|
|
122
|
-
case "array":
|
|
123
|
-
return a.exact === b.exact &&
|
|
124
|
-
a.min === b.min &&
|
|
125
|
-
a.max === b.max &&
|
|
126
|
-
shapesEqual(a.element, b.element);
|
|
127
|
-
case "optional":
|
|
128
|
-
return shapesEqual(a.inner, b.inner);
|
|
129
|
-
case "record": {
|
|
130
|
-
const aKeys = Object.keys(a.fields).sort();
|
|
131
|
-
const bKeys = Object.keys(b.fields).sort();
|
|
132
|
-
if (aKeys.length !== bKeys.length)
|
|
133
|
-
return false;
|
|
134
|
-
return aKeys.every((k, i) => k === bKeys[i] && shapesEqual(a.fields[k], b.fields[k]));
|
|
135
|
-
}
|
|
136
|
-
case "ref":
|
|
137
|
-
return a.name === b.name;
|
|
138
|
-
default:
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module upstream
|
|
3
|
+
*
|
|
4
|
+
* Upstream corpus loader — hydrates the cached compiled-JSON snapshots
|
|
5
|
+
* that `markspec lock` writes under `.markspec/cache/upstreams/<id>/`
|
|
6
|
+
* into read-only graph citizens carrying an `upstream` origin.
|
|
7
|
+
*
|
|
8
|
+
* Design: ADR-031 (docs/architecture/adr-031-federated-upstream-resolution.md).
|
|
9
|
+
* Sibling of `core/profile/delivered.ts` (`loadDeliveredCorpus`), same
|
|
10
|
+
* purity rules: no I/O of its own — file access via the injected
|
|
11
|
+
* {@linkcode ReadFile}.
|
|
12
|
+
*/
|
|
13
|
+
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
14
|
+
import type { ReadFile } from "../config/mod.js";
|
|
15
|
+
/** One locked upstream's cached snapshot (dir written by `markspec lock`). */
|
|
16
|
+
export interface UpstreamSnapshotRef {
|
|
17
|
+
/** projectRef `name` — cache directory, lockfile rows, origin badges. */
|
|
18
|
+
readonly id: string;
|
|
19
|
+
/** Resolved version label recorded by the lockfile (e.g. `v2.1.0`). */
|
|
20
|
+
readonly version: string;
|
|
21
|
+
/** Absolute path to `.markspec/cache/upstreams/<id>`. */
|
|
22
|
+
readonly dir: string;
|
|
23
|
+
}
|
|
24
|
+
/** Result of {@linkcode loadUpstreamCorpus}. */
|
|
25
|
+
export interface LoadUpstreamCorpusResult {
|
|
26
|
+
readonly entries: Entry[];
|
|
27
|
+
readonly diagnostics: Diagnostic[];
|
|
28
|
+
}
|
|
29
|
+
/** File reader injected by the caller (CLI/LSP own the I/O). */
|
|
30
|
+
export type { ReadFile };
|
|
31
|
+
/**
|
|
32
|
+
* Hydrate every locked upstream's cached snapshot into `Entry[]`.
|
|
33
|
+
*
|
|
34
|
+
* Per upstream: read `<dir>/manifest.json`, reject schema skew
|
|
35
|
+
* (UPSTREAM-SNAPSHOT-001), extract the serialized entries, and stamp each
|
|
36
|
+
* with `origin = { kind: "upstream", upstreamId, version }`.
|
|
37
|
+
*
|
|
38
|
+
* Authoritative-source rule (design §4.5): a snapshot entry that already
|
|
39
|
+
* carries an `origin` is a re-export of some other source's entry (the
|
|
40
|
+
* upstream's own corpus or its upstreams) and is skipped — every entry
|
|
41
|
+
* joins an aggregate only from its authoring project. A failing upstream
|
|
42
|
+
* contributes diagnostics but never aborts the others.
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadUpstreamCorpus(upstreams: readonly UpstreamSnapshotRef[], readFile: ReadFile): Promise<LoadUpstreamCorpusResult>;
|
|
45
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/upstream/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAMzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,8EAA8E;AAC9E,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,gDAAgD;AAChD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC;CACpC;AAED,gEAAgE;AAChE,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,SAAS,mBAAmB,EAAE,EACzC,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,wBAAwB,CAAC,CA2EnC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module upstream
|
|
3
|
+
*
|
|
4
|
+
* Upstream corpus loader — hydrates the cached compiled-JSON snapshots
|
|
5
|
+
* that `markspec lock` writes under `.markspec/cache/upstreams/<id>/`
|
|
6
|
+
* into read-only graph citizens carrying an `upstream` origin.
|
|
7
|
+
*
|
|
8
|
+
* Design: ADR-031 (docs/architecture/adr-031-federated-upstream-resolution.md).
|
|
9
|
+
* Sibling of `core/profile/delivered.ts` (`loadDeliveredCorpus`), same
|
|
10
|
+
* purity rules: no I/O of its own — file access via the injected
|
|
11
|
+
* {@linkcode ReadFile}.
|
|
12
|
+
*/
|
|
13
|
+
import { join } from "@std/path";
|
|
14
|
+
import { checkSnapshotSchema, deserializeEntry, extractSerializedEntries, } from "../compiler/deserialize.js";
|
|
15
|
+
import { isUnsafeRelPath } from "../util/paths.js";
|
|
16
|
+
/**
|
|
17
|
+
* Hydrate every locked upstream's cached snapshot into `Entry[]`.
|
|
18
|
+
*
|
|
19
|
+
* Per upstream: read `<dir>/manifest.json`, reject schema skew
|
|
20
|
+
* (UPSTREAM-SNAPSHOT-001), extract the serialized entries, and stamp each
|
|
21
|
+
* with `origin = { kind: "upstream", upstreamId, version }`.
|
|
22
|
+
*
|
|
23
|
+
* Authoritative-source rule (design §4.5): a snapshot entry that already
|
|
24
|
+
* carries an `origin` is a re-export of some other source's entry (the
|
|
25
|
+
* upstream's own corpus or its upstreams) and is skipped — every entry
|
|
26
|
+
* joins an aggregate only from its authoring project. A failing upstream
|
|
27
|
+
* contributes diagnostics but never aborts the others.
|
|
28
|
+
*/
|
|
29
|
+
export async function loadUpstreamCorpus(upstreams, readFile) {
|
|
30
|
+
const entries = [];
|
|
31
|
+
const diagnostics = [];
|
|
32
|
+
for (const up of upstreams) {
|
|
33
|
+
const manifestPath = join(up.dir, "manifest.json");
|
|
34
|
+
const manifestRaw = await readFile(manifestPath);
|
|
35
|
+
if (manifestRaw === undefined) {
|
|
36
|
+
diagnostics.push({
|
|
37
|
+
code: "UPSTREAM-SNAPSHOT-002",
|
|
38
|
+
severity: "error",
|
|
39
|
+
message: `upstream '${up.id}' snapshot manifest is missing or unreadable; ` +
|
|
40
|
+
`run 'markspec lock' to restore the cache`,
|
|
41
|
+
location: { file: manifestPath, line: 1, column: 1 },
|
|
42
|
+
});
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
let manifest;
|
|
46
|
+
try {
|
|
47
|
+
manifest = JSON.parse(manifestRaw);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
diagnostics.push({
|
|
51
|
+
code: "UPSTREAM-SNAPSHOT-003",
|
|
52
|
+
severity: "error",
|
|
53
|
+
message: `malformed upstream snapshot: manifest is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,
|
|
54
|
+
location: { file: manifestPath, line: 1, column: 1 },
|
|
55
|
+
});
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const skew = checkSnapshotSchema(manifest, manifestPath);
|
|
59
|
+
if (skew) {
|
|
60
|
+
diagnostics.push(skew);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
// Snapshot files are read relative to the upstream's cache dir. The
|
|
64
|
+
// extractor is sync; pre-read the single file the manifest points at.
|
|
65
|
+
const block = manifest.entries;
|
|
66
|
+
const relFile = block?.file;
|
|
67
|
+
// The manifest is untrusted input (a hostile or corrupted upstream) —
|
|
68
|
+
// reject a data-file path that could escape the cache directory
|
|
69
|
+
// before ever joining it into a read. Latent today (fixtures only);
|
|
70
|
+
// becomes live once slice 2 populates caches from remote sites (repo
|
|
71
|
+
// precedent #699 treated the analogous symlink case as a security
|
|
72
|
+
// blocker).
|
|
73
|
+
if (relFile !== undefined && isUnsafeRelPath(relFile)) {
|
|
74
|
+
diagnostics.push({
|
|
75
|
+
code: "UPSTREAM-SNAPSHOT-003",
|
|
76
|
+
severity: "error",
|
|
77
|
+
message: "malformed upstream snapshot: snapshot data-file path escapes the cache directory",
|
|
78
|
+
location: { file: manifestPath, line: 1, column: 1 },
|
|
79
|
+
});
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const snapshotContent = relFile !== undefined
|
|
83
|
+
? await readFile(join(up.dir, relFile))
|
|
84
|
+
: undefined;
|
|
85
|
+
const extracted = extractSerializedEntries(manifest, (rel) => (rel === relFile ? snapshotContent : undefined), manifestPath);
|
|
86
|
+
diagnostics.push(...extracted.diagnostics);
|
|
87
|
+
for (const s of extracted.entries) {
|
|
88
|
+
if (s.origin !== undefined)
|
|
89
|
+
continue; // authoritative-source rule
|
|
90
|
+
const entry = deserializeEntry(s);
|
|
91
|
+
entries.push({
|
|
92
|
+
...entry,
|
|
93
|
+
origin: { kind: "upstream", upstreamId: up.id, version: up.version },
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return { entries, diagnostics };
|
|
98
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module upstream/project
|
|
3
|
+
*
|
|
4
|
+
* Shared lockfile→upstream hydration (#771): the one function every
|
|
5
|
+
* surface that feeds locked upstream snapshots into the graph goes
|
|
6
|
+
* through — the CLI compiler (`compileProject`), `check`, the LSP
|
|
7
|
+
* (`seedUpstreamCorpus`), and the MCP server (`loadLockedUpstreams`).
|
|
8
|
+
* Composes {@linkcode upstreamRefsFromLockfile} +
|
|
9
|
+
* {@linkcode loadUpstreamCorpus} with the shared no-lockfile /
|
|
10
|
+
* empty-refs short-circuit so the four surfaces' HYDRATION soft-fail
|
|
11
|
+
* and diagnostic semantics cannot drift. Pure — file access via the
|
|
12
|
+
* injected {@linkcode ReadFile}, same rule as `loadUpstreamCorpus`;
|
|
13
|
+
* never throws on a missing or cold cache (failures surface as
|
|
14
|
+
* UPSTREAM-SNAPSHOT-00x diagnostics).
|
|
15
|
+
*
|
|
16
|
+
* Deliberate seam (#771): the `markspec.lock` READ + PARSE stays at the
|
|
17
|
+
* call sites, and their parse-diagnostic handling differs by design —
|
|
18
|
+
* `check` needs the full parse result for its MSL-L212 gate and edge
|
|
19
|
+
* ledger, the LSP keeps a module-scoped `Lockfile` for the
|
|
20
|
+
* `markspec/version` notification and watcher-driven reloads, and the
|
|
21
|
+
* MCP server pairs the read with the file mtime for `isStale()`. Do not
|
|
22
|
+
* fold the read into this function without re-homing those contracts.
|
|
23
|
+
*/
|
|
24
|
+
import type { Lockfile } from "../lock/model.js";
|
|
25
|
+
import type { ReadFile } from "../config/mod.js";
|
|
26
|
+
import { type LoadUpstreamCorpusResult } from "./mod.js";
|
|
27
|
+
/**
|
|
28
|
+
* Hydrate a project's locked upstream snapshots into read-only
|
|
29
|
+
* `Entry[]`. Returns empty when there is no lockfile or no
|
|
30
|
+
* snapshot-carrying upstream rows (without touching `readFile`).
|
|
31
|
+
*/
|
|
32
|
+
export declare function loadProjectUpstreams(projectRoot: string, lockfile: Lockfile | undefined, readFile: ReadFile): Promise<LoadUpstreamCorpusResult>;
|
|
33
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/upstream/project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAsB,KAAK,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAG7E;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,wBAAwB,CAAC,CAKnC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module upstream/project
|
|
3
|
+
*
|
|
4
|
+
* Shared lockfile→upstream hydration (#771): the one function every
|
|
5
|
+
* surface that feeds locked upstream snapshots into the graph goes
|
|
6
|
+
* through — the CLI compiler (`compileProject`), `check`, the LSP
|
|
7
|
+
* (`seedUpstreamCorpus`), and the MCP server (`loadLockedUpstreams`).
|
|
8
|
+
* Composes {@linkcode upstreamRefsFromLockfile} +
|
|
9
|
+
* {@linkcode loadUpstreamCorpus} with the shared no-lockfile /
|
|
10
|
+
* empty-refs short-circuit so the four surfaces' HYDRATION soft-fail
|
|
11
|
+
* and diagnostic semantics cannot drift. Pure — file access via the
|
|
12
|
+
* injected {@linkcode ReadFile}, same rule as `loadUpstreamCorpus`;
|
|
13
|
+
* never throws on a missing or cold cache (failures surface as
|
|
14
|
+
* UPSTREAM-SNAPSHOT-00x diagnostics).
|
|
15
|
+
*
|
|
16
|
+
* Deliberate seam (#771): the `markspec.lock` READ + PARSE stays at the
|
|
17
|
+
* call sites, and their parse-diagnostic handling differs by design —
|
|
18
|
+
* `check` needs the full parse result for its MSL-L212 gate and edge
|
|
19
|
+
* ledger, the LSP keeps a module-scoped `Lockfile` for the
|
|
20
|
+
* `markspec/version` notification and watcher-driven reloads, and the
|
|
21
|
+
* MCP server pairs the read with the file mtime for `isStale()`. Do not
|
|
22
|
+
* fold the read into this function without re-homing those contracts.
|
|
23
|
+
*/
|
|
24
|
+
import { loadUpstreamCorpus } from "./mod.js";
|
|
25
|
+
import { upstreamRefsFromLockfile } from "./refs.js";
|
|
26
|
+
/**
|
|
27
|
+
* Hydrate a project's locked upstream snapshots into read-only
|
|
28
|
+
* `Entry[]`. Returns empty when there is no lockfile or no
|
|
29
|
+
* snapshot-carrying upstream rows (without touching `readFile`).
|
|
30
|
+
*/
|
|
31
|
+
export async function loadProjectUpstreams(projectRoot, lockfile, readFile) {
|
|
32
|
+
if (!lockfile)
|
|
33
|
+
return { entries: [], diagnostics: [] };
|
|
34
|
+
const refs = upstreamRefsFromLockfile(lockfile, projectRoot);
|
|
35
|
+
if (refs.length === 0)
|
|
36
|
+
return { entries: [], diagnostics: [] };
|
|
37
|
+
return await loadUpstreamCorpus(refs, readFile);
|
|
38
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module upstream/refs
|
|
3
|
+
*
|
|
4
|
+
* Map a parsed markspec.lock's snapshot-carrying upstream rows to the
|
|
5
|
+
* UpstreamSnapshotRef[] loadUpstreamCorpus consumes. Pure — no I/O.
|
|
6
|
+
*/
|
|
7
|
+
import type { Lockfile } from "../lock/model.js";
|
|
8
|
+
import type { UpstreamSnapshotRef } from "./mod.js";
|
|
9
|
+
/**
|
|
10
|
+
* Map a parsed lockfile's snapshot-carrying upstream rows to
|
|
11
|
+
* UpstreamSnapshotRef[] for loadUpstreamCorpus. Registry + dependency
|
|
12
|
+
* rows with a `snapshot` are included; rows without a snapshot (legacy
|
|
13
|
+
* pin-only) are skipped.
|
|
14
|
+
*
|
|
15
|
+
* The `version` field feeds the origin badge (`<id>@<version>`).
|
|
16
|
+
* Registry rows use their published `project.version`, falling back to
|
|
17
|
+
* `UNVERSIONED` when unpublished. Dependency rows carry no `version`, so
|
|
18
|
+
* the label is derived from the `resolved` pin via
|
|
19
|
+
* {@linkcode versionFromResolved} (#800) — previously every git
|
|
20
|
+
* dependency rendered as `<id>@unversioned` despite carrying a precise pin.
|
|
21
|
+
*/
|
|
22
|
+
export declare function upstreamRefsFromLockfile(lockfile: Lockfile, projectRoot: string): UpstreamSnapshotRef[];
|
|
23
|
+
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/upstream/refs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAwBpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,GAClB,mBAAmB,EAAE,CAqBvB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module upstream/refs
|
|
3
|
+
*
|
|
4
|
+
* Map a parsed markspec.lock's snapshot-carrying upstream rows to the
|
|
5
|
+
* UpstreamSnapshotRef[] loadUpstreamCorpus consumes. Pure — no I/O.
|
|
6
|
+
*/
|
|
7
|
+
import { join } from "@std/path";
|
|
8
|
+
import { upstreamCacheRoot } from "../lock/upstream_refs.js";
|
|
9
|
+
/** Fallback badge label when an upstream row carries neither a `version`
|
|
10
|
+
* field nor a `resolved` pin to derive one from. */
|
|
11
|
+
const UNVERSIONED = "unversioned";
|
|
12
|
+
/**
|
|
13
|
+
* Derive a human-readable badge label from a git dependency's `resolved`
|
|
14
|
+
* pin (`"tag:<t>"` | `"branch:<b>"` | `"sha:<s>"`). A tag or branch pin
|
|
15
|
+
* renders bare (`v2.1.0`, `main`); a sha pin renders as its 7-char short
|
|
16
|
+
* hash (`abcdef0`). A pin with an unrecognised scheme renders verbatim,
|
|
17
|
+
* and an empty pin falls back to `UNVERSIONED` (#800).
|
|
18
|
+
*/
|
|
19
|
+
function versionFromResolved(resolved) {
|
|
20
|
+
const colon = resolved.indexOf(":");
|
|
21
|
+
if (colon < 0)
|
|
22
|
+
return resolved || UNVERSIONED;
|
|
23
|
+
const scheme = resolved.slice(0, colon);
|
|
24
|
+
const rest = resolved.slice(colon + 1);
|
|
25
|
+
if (rest.length === 0)
|
|
26
|
+
return UNVERSIONED;
|
|
27
|
+
if (scheme === "sha")
|
|
28
|
+
return rest.slice(0, 7);
|
|
29
|
+
if (scheme === "tag" || scheme === "branch")
|
|
30
|
+
return rest;
|
|
31
|
+
return resolved;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Map a parsed lockfile's snapshot-carrying upstream rows to
|
|
35
|
+
* UpstreamSnapshotRef[] for loadUpstreamCorpus. Registry + dependency
|
|
36
|
+
* rows with a `snapshot` are included; rows without a snapshot (legacy
|
|
37
|
+
* pin-only) are skipped.
|
|
38
|
+
*
|
|
39
|
+
* The `version` field feeds the origin badge (`<id>@<version>`).
|
|
40
|
+
* Registry rows use their published `project.version`, falling back to
|
|
41
|
+
* `UNVERSIONED` when unpublished. Dependency rows carry no `version`, so
|
|
42
|
+
* the label is derived from the `resolved` pin via
|
|
43
|
+
* {@linkcode versionFromResolved} (#800) — previously every git
|
|
44
|
+
* dependency rendered as `<id>@unversioned` despite carrying a precise pin.
|
|
45
|
+
*/
|
|
46
|
+
export function upstreamRefsFromLockfile(lockfile, projectRoot) {
|
|
47
|
+
const cacheRoot = upstreamCacheRoot(projectRoot);
|
|
48
|
+
const refs = [];
|
|
49
|
+
for (const u of lockfile.upstreams) {
|
|
50
|
+
if (u.kind !== "registry" && u.kind !== "dependency")
|
|
51
|
+
continue;
|
|
52
|
+
if (u.snapshot === undefined)
|
|
53
|
+
continue;
|
|
54
|
+
let version;
|
|
55
|
+
if ("version" in u && u.version) {
|
|
56
|
+
version = u.version;
|
|
57
|
+
}
|
|
58
|
+
else if (u.kind === "dependency") {
|
|
59
|
+
version = versionFromResolved(u.resolved);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
version = UNVERSIONED;
|
|
63
|
+
}
|
|
64
|
+
refs.push({
|
|
65
|
+
id: u.id,
|
|
66
|
+
version,
|
|
67
|
+
dir: join(cacheRoot, u.id),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return refs;
|
|
71
|
+
}
|
package/esm/util/fence.d.ts
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Prose-line walker that skips lines inside fenced code blocks.
|
|
5
|
-
* Several validator and formatter passes (body-block exclusions,
|
|
6
|
-
* caption adjacency, `$Identifier` extraction, modal-keyword
|
|
7
|
-
* normalisation) all needed to walk an entry body line-by-line while
|
|
8
|
-
* treating fenced code as verbatim. This helper centralises that
|
|
9
|
-
* pattern so the fence-toggle semantics stay consistent.
|
|
10
|
-
*
|
|
11
|
-
* Fence detection follows CommonMark §4.5 — a line whose first
|
|
12
|
-
* non-whitespace content is three or more backticks or tildes opens
|
|
13
|
-
* (or closes) a fenced block. The language tag that may follow the
|
|
14
|
-
* opening fence does not affect detection: we toggle on every fence
|
|
15
|
-
* marker regardless. (Mismatched marker types — ``` opener / ~~~
|
|
16
|
-
* closer — are accepted by the walker because real Markdown parsers
|
|
17
|
-
* already reject those upstream.)
|
|
2
|
+
* Legacy fence-prefix candidate used by the LSP source-file scanner.
|
|
3
|
+
* Markdown fence membership uses the AST-backed helpers below.
|
|
18
4
|
*/
|
|
19
|
-
/** Three or more backticks or tildes at the start of a line. */
|
|
20
5
|
export declare const FENCE_RE: RegExp;
|
|
21
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Compute zero-based fenced-code lines, including opening and closing lines.
|
|
8
|
+
* Cache the sets for the 64 most recently queried exact document texts. Each
|
|
9
|
+
* call returns a new copy, so a caller that changes it cannot alter the cache.
|
|
10
|
+
* Callers making multiple membership queries should compute this set once and
|
|
11
|
+
* pass it to {@linkcode isLineFenced} or {@linkcode walkProseLines}.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fencedCodeLines(body: string): ReadonlySet<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Callback for {@linkcode walkProseLines}. Receives a line and its 0-based index.
|
|
16
|
+
* The LF delimiter is excluded; a CR from a CRLF delimiter is preserved.
|
|
17
|
+
*/
|
|
22
18
|
export type ProseLineCallback = (line: string, index: number) => void;
|
|
23
19
|
/**
|
|
24
|
-
* Walk
|
|
25
|
-
*
|
|
26
|
-
* the next closes it. The fence-marker lines themselves are also
|
|
27
|
-
* skipped (they're structural, not prose).
|
|
20
|
+
* Walk lines outside fenced code, using the cached CommonMark line set unless
|
|
21
|
+
* a precomputed set for this exact text is supplied. Indented code is yielded.
|
|
28
22
|
*/
|
|
29
|
-
export declare function walkProseLines(body: string, cb: ProseLineCallback): void;
|
|
23
|
+
export declare function walkProseLines(body: string, cb: ProseLineCallback, fencedLines?: ReadonlySet<number>): void;
|
|
30
24
|
/**
|
|
31
|
-
* Return whether
|
|
32
|
-
*
|
|
33
|
-
* fenced block. Single-line-membership counterpart to `walkProseLines`'s
|
|
34
|
-
* full-body callback walk, for callers that only need a yes/no answer for
|
|
35
|
-
* one position (e.g. an LSP request gating a cursor position, #680).
|
|
25
|
+
* Return whether a zero-based document line belongs to the fenced-line set.
|
|
26
|
+
* Supply the set for this exact text when querying multiple positions.
|
|
36
27
|
*/
|
|
37
|
-
export declare function isLineFenced(body: string, lineIndex: number): boolean;
|
|
28
|
+
export declare function isLineFenced(body: string, lineIndex: number, fencedLines?: ReadonlySet<number>): boolean;
|
|
38
29
|
//# sourceMappingURL=fence.d.ts.map
|
package/esm/util/fence.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../src/util/fence.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../src/util/fence.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAAkB,CAAC;AAKxC;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAajE;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEtE;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,iBAAiB,EACrB,WAAW,GAAE,WAAW,CAAC,MAAM,CAAyB,GACvD,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,WAAW,CAAC,MAAM,CAAyB,GACvD,OAAO,CAET"}
|