@driftsys/markspec 0.10.2 → 0.11.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 +2 -2
- 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 +16 -7
- package/esm/config/markspec.d.ts +38 -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 +20 -0
- package/esm/decl/mod.d.ts.map +1 -0
- package/esm/decl/mod.js +15 -0
- package/esm/decl/resolve.d.ts +104 -0
- package/esm/decl/resolve.d.ts.map +1 -0
- package/esm/decl/resolve.js +66 -0
- package/esm/decl/surfaces.d.ts +118 -0
- package/esm/decl/surfaces.d.ts.map +1 -0
- package/esm/decl/surfaces.js +135 -0
- package/esm/decl/table.d.ts +50 -0
- package/esm/decl/table.d.ts.map +1 -0
- package/esm/decl/table.js +124 -0
- package/esm/gates/mod.d.ts +13 -2
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +38 -11
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +3 -1
- 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 +41 -3
- 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 +10 -3
- package/esm/lock/mod.d.ts.map +1 -1
- package/esm/lock/mod.js +7 -1
- 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 +16 -8
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +15 -5
- package/esm/model/mod.d.ts +93 -28
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +66 -13
- package/esm/model/profile.d.ts +13 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/directives.d.ts +6 -0
- package/esm/parser/directives.d.ts.map +1 -1
- package/esm/parser/directives.js +17 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +16 -51
- 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/reporter/mod.d.ts +11 -0
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +19 -8
- 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 +16 -24
- package/esm/typl/bullet.d.ts.map +1 -1
- package/esm/typl/bullet.js +9 -41
- 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/fence.d.ts +12 -21
- package/esm/typl/fence.d.ts.map +1 -1
- package/esm/typl/fence.js +5 -20
- package/esm/typl/grammar.d.ts.map +1 -1
- package/esm/typl/grammar.js +6 -0
- package/esm/typl/inline.d.ts +15 -24
- package/esm/typl/inline.d.ts.map +1 -1
- package/esm/typl/inline.js +6 -44
- 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.d.ts +14 -0
- package/esm/typl/recognize.d.ts.map +1 -0
- package/esm/typl/recognize.js +19 -0
- 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/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.map +1 -1
- package/esm/validator/body_blocks.js +3 -9
- 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.map +1 -1
- package/esm/validator/corpus.js +40 -17
- 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.map +1 -1
- package/esm/validator/mod.js +28 -15
- package/esm/validator/pipeline.d.ts +11 -1
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +68 -18
- 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/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 +15 -6
- package/script/config/markspec.d.ts +38 -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 +20 -0
- package/script/decl/mod.d.ts.map +1 -0
- package/script/decl/mod.js +26 -0
- package/script/decl/resolve.d.ts +104 -0
- package/script/decl/resolve.d.ts.map +1 -0
- package/script/decl/resolve.js +70 -0
- package/script/decl/surfaces.d.ts +118 -0
- package/script/decl/surfaces.d.ts.map +1 -0
- package/script/decl/surfaces.js +141 -0
- package/script/decl/table.d.ts +50 -0
- package/script/decl/table.d.ts.map +1 -0
- package/script/decl/table.js +127 -0
- package/script/gates/mod.d.ts +13 -2
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +37 -10
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +3 -1
- 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 +41 -3
- 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 +10 -3
- package/script/lock/mod.d.ts.map +1 -1
- package/script/lock/mod.js +16 -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 +16 -8
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +40 -7
- package/script/model/mod.d.ts +93 -28
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +70 -14
- package/script/model/profile.d.ts +13 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/directives.d.ts +6 -0
- package/script/parser/directives.d.ts.map +1 -1
- package/script/parser/directives.js +18 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +15 -50
- 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/reporter/mod.d.ts +11 -0
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +18 -7
- 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 +16 -24
- package/script/typl/bullet.d.ts.map +1 -1
- package/script/typl/bullet.js +10 -42
- 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/fence.d.ts +12 -21
- package/script/typl/fence.d.ts.map +1 -1
- package/script/typl/fence.js +5 -20
- package/script/typl/grammar.d.ts.map +1 -1
- package/script/typl/grammar.js +6 -0
- package/script/typl/inline.d.ts +15 -24
- package/script/typl/inline.d.ts.map +1 -1
- package/script/typl/inline.js +6 -44
- 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.d.ts +14 -0
- package/script/typl/recognize.d.ts.map +1 -0
- package/script/typl/recognize.js +22 -0
- 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/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.map +1 -1
- package/script/validator/body_blocks.js +3 -9
- 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.map +1 -1
- package/script/validator/corpus.js +39 -16
- 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.map +1 -1
- package/script/validator/mod.js +27 -14
- package/script/validator/pipeline.d.ts +11 -1
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +67 -17
- 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
|
@@ -25,7 +25,7 @@ export interface RegistryTypedef {
|
|
|
25
25
|
/**
|
|
26
26
|
* Corpus-wide index. Each $Name (and each typedef name) maps to ALL
|
|
27
27
|
* declarations found — collisions are NOT collapsed; the validator
|
|
28
|
-
* surfaces
|
|
28
|
+
* surfaces dotted-name (published) collisions via TYPL-009 (#723).
|
|
29
29
|
*/
|
|
30
30
|
export interface TypeRegistry {
|
|
31
31
|
/** Keyed by $Name (including leading `$`). */
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module typl/resolve
|
|
3
|
+
*
|
|
4
|
+
* typl instantiation of the DSL-agnostic base-resolution engine
|
|
5
|
+
* (core/decl/resolve, #722). Published typl symbols are dotted paths
|
|
6
|
+
* (`$powertrain.brake.pedal_position`, ≥2 segments); relative refs keep
|
|
7
|
+
* the sigil and mark relativity with a leading dot (`$.pedal_position`).
|
|
8
|
+
* `$` is a *sigil* (part of the token), not a URI scheme — unlike uxil's
|
|
9
|
+
* `ux:`, it stays on relative forms. See the S5 design spec
|
|
10
|
+
* (docs/wip/2026-07-04-typl-published-tier-design.md, D2–D5).
|
|
11
|
+
*/
|
|
12
|
+
import type { RefOps } from "../decl/mod.js";
|
|
13
|
+
/**
|
|
14
|
+
* True for `$.x` / `$.a.b` — a relative published ref. The first segment
|
|
15
|
+
* must start with a letter/underscore (matching `BINDING_RE` in
|
|
16
|
+
* recognize.ts and {@linkcode isPublishedTyplName}'s first-segment rule);
|
|
17
|
+
* a digit-leading first segment would be citable here but never
|
|
18
|
+
* declarable, a permanent dead end (#754).
|
|
19
|
+
*/
|
|
20
|
+
export declare function isRelativeTyplName(name: string): boolean;
|
|
21
|
+
/** True for `$a.b` / `$a.b.c` — an absolute published name (≥2 segments). */
|
|
22
|
+
export declare function isPublishedTyplName(name: string): boolean;
|
|
23
|
+
/** Strip the `$` sigil: `$powertrain.brake` → `powertrain.brake`. */
|
|
24
|
+
export declare function typlPathOf(name: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Engine parameterization for typl: absolute = the sigil is followed by
|
|
27
|
+
* an identifier character; join = base path + relative segments with the
|
|
28
|
+
* sigil restored (`join("powertrain.brake", "$.x")` → `$powertrain.brake.x`).
|
|
29
|
+
*/
|
|
30
|
+
export declare const TYPL_REF_OPS: RefOps;
|
|
31
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/typl/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,MAG1B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TYPL_REF_OPS = void 0;
|
|
4
|
+
exports.isRelativeTyplName = isRelativeTyplName;
|
|
5
|
+
exports.isPublishedTyplName = isPublishedTyplName;
|
|
6
|
+
exports.typlPathOf = typlPathOf;
|
|
7
|
+
/**
|
|
8
|
+
* True for `$.x` / `$.a.b` — a relative published ref. The first segment
|
|
9
|
+
* must start with a letter/underscore (matching `BINDING_RE` in
|
|
10
|
+
* recognize.ts and {@linkcode isPublishedTyplName}'s first-segment rule);
|
|
11
|
+
* a digit-leading first segment would be citable here but never
|
|
12
|
+
* declarable, a permanent dead end (#754).
|
|
13
|
+
*/
|
|
14
|
+
function isRelativeTyplName(name) {
|
|
15
|
+
return /^\$\.[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)*$/.test(name);
|
|
16
|
+
}
|
|
17
|
+
/** True for `$a.b` / `$a.b.c` — an absolute published name (≥2 segments). */
|
|
18
|
+
function isPublishedTyplName(name) {
|
|
19
|
+
return /^\$[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)+$/.test(name);
|
|
20
|
+
}
|
|
21
|
+
/** Strip the `$` sigil: `$powertrain.brake` → `powertrain.brake`. */
|
|
22
|
+
function typlPathOf(name) {
|
|
23
|
+
return name.startsWith("$") ? name.slice(1) : name;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Engine parameterization for typl: absolute = the sigil is followed by
|
|
27
|
+
* an identifier character; join = base path + relative segments with the
|
|
28
|
+
* sigil restored (`join("powertrain.brake", "$.x")` → `$powertrain.brake.x`).
|
|
29
|
+
*/
|
|
30
|
+
exports.TYPL_REF_OPS = {
|
|
31
|
+
isAbsolute: (ref) => /^\$[A-Za-z_]/.test(ref),
|
|
32
|
+
join: (base, ref) => `$${base}.${ref.slice(2)}`,
|
|
33
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module typl/table
|
|
3
|
+
*
|
|
4
|
+
* Table surface adapter (#724 / S6) — recognises typl declarations authored
|
|
5
|
+
* as GFM table data rows. A thin wrapper over the shared declaration-surface
|
|
6
|
+
* machinery (core/decl): each data row `$name | kind shape | description` is
|
|
7
|
+
* reduced to the declaration source `$name : kind shape` (the `description`
|
|
8
|
+
* column is human documentation and is dropped, since a typl binding carries
|
|
9
|
+
* no description), then parsed like any other surface. Rows whose first cell
|
|
10
|
+
* is not a typl name — or whose shape cell is empty — are skipped, so mixed
|
|
11
|
+
* tables and malformed rows contribute nothing.
|
|
12
|
+
*
|
|
13
|
+
* A table's `Table:` caption may carry a base: {@linkcode typlTableCaptionBase}
|
|
14
|
+
* reads an absolute typl name out of the caption text, which
|
|
15
|
+
* {@linkcode extractTyplTable}'s caller (assemble) hands to the entry-local
|
|
16
|
+
* resolver (S4) so relative rows (`$.x`) resolve against it. Only bindings are
|
|
17
|
+
* expressed in tables; typedefs (`type X = …`) keep their fence / bullet /
|
|
18
|
+
* inline surfaces.
|
|
19
|
+
*
|
|
20
|
+
* See ADR-019.
|
|
21
|
+
*/
|
|
22
|
+
import type { BodyBlock } from "../ast/nodes.js";
|
|
23
|
+
import { type RowRecognizer, type TableRowDeclaration } from "../decl/mod.js";
|
|
24
|
+
/** A single typl table-row declaration: `{ source, range, captionText? }`. */
|
|
25
|
+
export type TyplTableExtraction = TableRowDeclaration;
|
|
26
|
+
/**
|
|
27
|
+
* Reduce a table data row to a typl declaration source, or `undefined` to
|
|
28
|
+
* skip the row. The first cell supplies the binding name (`$name`), the
|
|
29
|
+
* second the kind + shape; the remaining cells (a description) are dropped.
|
|
30
|
+
* Returns `undefined` when the reconstructed `$name : kind shape` is not a
|
|
31
|
+
* typl declaration (non-typl row) or when either required cell is empty
|
|
32
|
+
* (malformed row).
|
|
33
|
+
*/
|
|
34
|
+
export declare const typlTableRowRecognizer: RowRecognizer;
|
|
35
|
+
/**
|
|
36
|
+
* Parse a base path out of a `Table:` caption's text, or `undefined` when
|
|
37
|
+
* the caption carries no typl base. The base is the caption's leading
|
|
38
|
+
* whitespace-delimited token when it is an absolute typl name; a trailing
|
|
39
|
+
* description (`$powertrain.brake — brake signals`) is ignored. Relative
|
|
40
|
+
* names (`$.x`) are not bases — they would need a base themselves — and a
|
|
41
|
+
* non-typl caption yields no base. The `$` sigil is stripped, matching the
|
|
42
|
+
* base paths the entry-local resolver joins against.
|
|
43
|
+
*/
|
|
44
|
+
export declare function typlTableCaptionBase(captionText: string): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Walk a body AST and return a declaration for every table data row that is
|
|
47
|
+
* a typl binding, in source order (recursing into list-nested tables).
|
|
48
|
+
* Delegates traversal to {@linkcode extractTableDeclarations}; each result
|
|
49
|
+
* carries the enclosing table's `captionText` when present.
|
|
50
|
+
*/
|
|
51
|
+
export declare function extractTyplTable(blocks: readonly BodyBlock[]): readonly TyplTableExtraction[];
|
|
52
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/typl/table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAIxB,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAUtD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAMpC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAGpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,SAAS,EAAE,GAC3B,SAAS,mBAAmB,EAAE,CAEhC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module typl/table
|
|
4
|
+
*
|
|
5
|
+
* Table surface adapter (#724 / S6) — recognises typl declarations authored
|
|
6
|
+
* as GFM table data rows. A thin wrapper over the shared declaration-surface
|
|
7
|
+
* machinery (core/decl): each data row `$name | kind shape | description` is
|
|
8
|
+
* reduced to the declaration source `$name : kind shape` (the `description`
|
|
9
|
+
* column is human documentation and is dropped, since a typl binding carries
|
|
10
|
+
* no description), then parsed like any other surface. Rows whose first cell
|
|
11
|
+
* is not a typl name — or whose shape cell is empty — are skipped, so mixed
|
|
12
|
+
* tables and malformed rows contribute nothing.
|
|
13
|
+
*
|
|
14
|
+
* A table's `Table:` caption may carry a base: {@linkcode typlTableCaptionBase}
|
|
15
|
+
* reads an absolute typl name out of the caption text, which
|
|
16
|
+
* {@linkcode extractTyplTable}'s caller (assemble) hands to the entry-local
|
|
17
|
+
* resolver (S4) so relative rows (`$.x`) resolve against it. Only bindings are
|
|
18
|
+
* expressed in tables; typedefs (`type X = …`) keep their fence / bullet /
|
|
19
|
+
* inline surfaces.
|
|
20
|
+
*
|
|
21
|
+
* See ADR-019.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.typlTableRowRecognizer = void 0;
|
|
25
|
+
exports.typlTableCaptionBase = typlTableCaptionBase;
|
|
26
|
+
exports.extractTyplTable = extractTyplTable;
|
|
27
|
+
const mod_js_1 = require("../decl/mod.js");
|
|
28
|
+
const recognize_js_1 = require("./recognize.js");
|
|
29
|
+
const resolve_js_1 = require("./resolve.js");
|
|
30
|
+
/**
|
|
31
|
+
* An absolute typl name (sigil + ≥1 dotted segments, no leading dot): the
|
|
32
|
+
* only shape a `Table:` caption base may take. Mirrors `isPublishedTyplName`
|
|
33
|
+
* but also admits a single-segment name (`$vehicle`) — a caption base need
|
|
34
|
+
* not be dotted.
|
|
35
|
+
*/
|
|
36
|
+
const ABSOLUTE_TYPL_NAME_RE = /^\$[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)*$/;
|
|
37
|
+
/**
|
|
38
|
+
* Reduce a table data row to a typl declaration source, or `undefined` to
|
|
39
|
+
* skip the row. The first cell supplies the binding name (`$name`), the
|
|
40
|
+
* second the kind + shape; the remaining cells (a description) are dropped.
|
|
41
|
+
* Returns `undefined` when the reconstructed `$name : kind shape` is not a
|
|
42
|
+
* typl declaration (non-typl row) or when either required cell is empty
|
|
43
|
+
* (malformed row).
|
|
44
|
+
*/
|
|
45
|
+
const typlTableRowRecognizer = (cells) => {
|
|
46
|
+
const name = cells[0]?.trim() ?? "";
|
|
47
|
+
const decl = cells[1]?.trim() ?? "";
|
|
48
|
+
if (name === "" || decl === "")
|
|
49
|
+
return undefined;
|
|
50
|
+
const source = `${name} : ${decl}`;
|
|
51
|
+
return (0, recognize_js_1.isTyplDeclarationText)(source) ? source : undefined;
|
|
52
|
+
};
|
|
53
|
+
exports.typlTableRowRecognizer = typlTableRowRecognizer;
|
|
54
|
+
/**
|
|
55
|
+
* Parse a base path out of a `Table:` caption's text, or `undefined` when
|
|
56
|
+
* the caption carries no typl base. The base is the caption's leading
|
|
57
|
+
* whitespace-delimited token when it is an absolute typl name; a trailing
|
|
58
|
+
* description (`$powertrain.brake — brake signals`) is ignored. Relative
|
|
59
|
+
* names (`$.x`) are not bases — they would need a base themselves — and a
|
|
60
|
+
* non-typl caption yields no base. The `$` sigil is stripped, matching the
|
|
61
|
+
* base paths the entry-local resolver joins against.
|
|
62
|
+
*/
|
|
63
|
+
function typlTableCaptionBase(captionText) {
|
|
64
|
+
const first = captionText.trim().split(/\s+/)[0] ?? "";
|
|
65
|
+
return ABSOLUTE_TYPL_NAME_RE.test(first) ? (0, resolve_js_1.typlPathOf)(first) : undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Walk a body AST and return a declaration for every table data row that is
|
|
69
|
+
* a typl binding, in source order (recursing into list-nested tables).
|
|
70
|
+
* Delegates traversal to {@linkcode extractTableDeclarations}; each result
|
|
71
|
+
* carries the enclosing table's `captionText` when present.
|
|
72
|
+
*/
|
|
73
|
+
function extractTyplTable(blocks) {
|
|
74
|
+
return (0, mod_js_1.extractTableDeclarations)(blocks, exports.typlTableRowRecognizer);
|
|
75
|
+
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module typl/validator
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Published tier (#723): corpus-wide declared-once enforcement for dotted
|
|
5
|
+
* ($published) names (TYPL-009) and citation resolution for bare
|
|
6
|
+
* published-shaped code spans (TYPL-010 relative-with-no-root, TYPL-011
|
|
7
|
+
* undeclared symbol) — plus intra-entry undefined-typedef-reference checks
|
|
6
8
|
* (TYPL-005).
|
|
7
9
|
*
|
|
10
|
+
* TYPL-002 (kind mismatch) and TYPL-003 (shape mismatch) are retired: the
|
|
11
|
+
* v1 cross-entry collision rule they implemented applied to plain (entry-
|
|
12
|
+
* local) names, which the published tier deliberately leaves unchecked
|
|
13
|
+
* across entries — only dotted, corpus-wide names are declared exactly
|
|
14
|
+
* once. The codes remain in the catalogue (deprecated) but this validator
|
|
15
|
+
* never emits them.
|
|
16
|
+
*
|
|
8
17
|
* Per the v1 entry-local scope rule, typedef references are resolved
|
|
9
18
|
* within the binding's own entry — references to typedefs declared in
|
|
10
19
|
* other entries are TYPL-005 errors.
|
|
@@ -17,9 +26,19 @@ import { type TypeRegistry } from "./registry.js";
|
|
|
17
26
|
/**
|
|
18
27
|
* Validate the typl declarations across all entries.
|
|
19
28
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
29
|
+
* Upstream entries (federated-upstream epic) are typl-inert: they are
|
|
30
|
+
* excluded from the working set before the registry is built, so their
|
|
31
|
+
* declarations neither emit their own TYPL diagnostics nor count toward
|
|
32
|
+
* the corpus-wide declared-once (TYPL-009) accounting — a project entry
|
|
33
|
+
* re-declaring a dotted name an upstream also publishes is not a
|
|
34
|
+
* collision. Cross-repo typl resolution is out of scope for this slice
|
|
35
|
+
* (see ADR-019 / federated-upstream design §4.7); this is the same #771
|
|
36
|
+
* `emittableEntries` partition the validator orchestrators apply.
|
|
37
|
+
*
|
|
38
|
+
* Returns the built corpus registry (scoped to non-upstream entries)
|
|
39
|
+
* plus any diagnostics. The registry is returned even when diagnostics
|
|
40
|
+
* are present so callers (compiler, LSP) can use it for navigation and
|
|
41
|
+
* emission.
|
|
23
42
|
*/
|
|
24
43
|
export declare function validateTypl(entries: readonly Entry[]): {
|
|
25
44
|
registry: TypeRegistry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/typl/validator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/typl/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,UAAU,CAAC;AAI/C,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGrE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAoGhE;AA0CD,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
package/script/typl/validator.js
CHANGED
|
@@ -1,57 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateTypl = validateTypl;
|
|
4
|
+
const mod_js_1 = require("../model/mod.js");
|
|
5
|
+
const citations_js_1 = require("./citations.js");
|
|
6
|
+
const mod_js_2 = require("../decl/mod.js");
|
|
4
7
|
const diagnostics_js_1 = require("./diagnostics.js");
|
|
5
8
|
const registry_js_1 = require("./registry.js");
|
|
9
|
+
const resolve_js_1 = require("./resolve.js");
|
|
6
10
|
/**
|
|
7
11
|
* Validate the typl declarations across all entries.
|
|
8
12
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* Upstream entries (federated-upstream epic) are typl-inert: they are
|
|
14
|
+
* excluded from the working set before the registry is built, so their
|
|
15
|
+
* declarations neither emit their own TYPL diagnostics nor count toward
|
|
16
|
+
* the corpus-wide declared-once (TYPL-009) accounting — a project entry
|
|
17
|
+
* re-declaring a dotted name an upstream also publishes is not a
|
|
18
|
+
* collision. Cross-repo typl resolution is out of scope for this slice
|
|
19
|
+
* (see ADR-019 / federated-upstream design §4.7); this is the same #771
|
|
20
|
+
* `emittableEntries` partition the validator orchestrators apply.
|
|
21
|
+
*
|
|
22
|
+
* Returns the built corpus registry (scoped to non-upstream entries)
|
|
23
|
+
* plus any diagnostics. The registry is returned even when diagnostics
|
|
24
|
+
* are present so callers (compiler, LSP) can use it for navigation and
|
|
25
|
+
* emission.
|
|
12
26
|
*/
|
|
13
27
|
function validateTypl(entries) {
|
|
14
|
-
const
|
|
28
|
+
const localEntries = (0, mod_js_1.emittableEntries)(entries);
|
|
29
|
+
const registry = (0, registry_js_1.buildTypeRegistry)(localEntries);
|
|
15
30
|
const diagnostics = [];
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
31
|
+
// Published tier (#723): dotted names are declared exactly once
|
|
32
|
+
// corpus-wide — every declaration after the first is TYPL-009. Plain
|
|
33
|
+
// (entry-local) names have no cross-entry rule: TYPL-002/003 are
|
|
34
|
+
// retired (deprecated, never emitted — see diagnostics.ts).
|
|
35
|
+
for (const { name, first, duplicates } of (0, mod_js_2.findDuplicateDeclarations)(registry.bindings, (name) => name.includes("."))) {
|
|
36
|
+
for (const dup of duplicates) {
|
|
37
|
+
const td = (0, diagnostics_js_1.typlDiagnostic)("TYPL-009", {
|
|
38
|
+
name,
|
|
39
|
+
otherFile: first.entryFile,
|
|
40
|
+
otherLine: first.binding.position.line,
|
|
41
|
+
}, dup.binding.position);
|
|
42
|
+
diagnostics.push({
|
|
43
|
+
code: td.code,
|
|
44
|
+
severity: td.severity,
|
|
45
|
+
message: td.message,
|
|
46
|
+
location: { file: dup.entryFile, line: 1, column: 1 },
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Citation validation (#723): bare published-shaped code spans must
|
|
51
|
+
// resolve (relative → entry root namespace) to a declared symbol.
|
|
52
|
+
for (const entry of localEntries) {
|
|
53
|
+
const citations = (0, citations_js_1.extractTyplCitations)(entry.bodyTokens);
|
|
54
|
+
if (citations.length === 0)
|
|
19
55
|
continue;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
kindA: dup.binding.kind,
|
|
27
|
-
kindB: first.binding.kind,
|
|
28
|
-
otherFile: first.entryFile,
|
|
29
|
-
otherLine: first.binding.position.line,
|
|
30
|
-
}, dup.binding.position);
|
|
56
|
+
const root = entry.types?.rootNamespace;
|
|
57
|
+
const scope = root !== undefined ? { base: root } : undefined;
|
|
58
|
+
for (const citation of citations) {
|
|
59
|
+
const res = (0, mod_js_2.resolveRef)(citation.name, scope, resolve_js_1.TYPL_REF_OPS);
|
|
60
|
+
if (!res.ok) {
|
|
61
|
+
const td = (0, diagnostics_js_1.typlDiagnostic)("TYPL-010", { name: citation.name }, { line: citation.location.line, column: citation.location.column });
|
|
31
62
|
diagnostics.push({
|
|
32
63
|
code: td.code,
|
|
33
64
|
severity: td.severity,
|
|
34
65
|
message: td.message,
|
|
35
|
-
location:
|
|
66
|
+
location: citation.location,
|
|
36
67
|
});
|
|
68
|
+
continue;
|
|
37
69
|
}
|
|
38
|
-
|
|
39
|
-
const td = (0, diagnostics_js_1.typlDiagnostic)("TYPL-
|
|
40
|
-
name,
|
|
41
|
-
otherFile: first.entryFile,
|
|
42
|
-
otherLine: first.binding.position.line,
|
|
43
|
-
}, dup.binding.position);
|
|
70
|
+
if (!registry.bindings.has(res.ref)) {
|
|
71
|
+
const td = (0, diagnostics_js_1.typlDiagnostic)("TYPL-011", { name: res.ref }, { line: citation.location.line, column: citation.location.column });
|
|
44
72
|
diagnostics.push({
|
|
45
73
|
code: td.code,
|
|
46
74
|
severity: td.severity,
|
|
47
75
|
message: td.message,
|
|
48
|
-
location:
|
|
76
|
+
location: citation.location,
|
|
49
77
|
});
|
|
50
78
|
}
|
|
51
79
|
}
|
|
52
80
|
}
|
|
53
81
|
// Intra-entry undefined typedef ref (TYPL-005)
|
|
54
|
-
for (const entry of
|
|
82
|
+
for (const entry of localEntries) {
|
|
55
83
|
if (!entry.types)
|
|
56
84
|
continue;
|
|
57
85
|
const localTypedefs = new Set(entry.types.typedefs.map((t) => t.name));
|
|
@@ -94,51 +122,3 @@ function collectRefDiagnostics(shape, localTypedefs, entry, line, out) {
|
|
|
94
122
|
// are leaves with no nested shape — nothing to recurse into.
|
|
95
123
|
}
|
|
96
124
|
}
|
|
97
|
-
function shapesEqual(a, b) {
|
|
98
|
-
if (a === b)
|
|
99
|
-
return true;
|
|
100
|
-
if (!a || !b)
|
|
101
|
-
return false;
|
|
102
|
-
if (a.kind !== b.kind)
|
|
103
|
-
return false;
|
|
104
|
-
switch (a.kind) {
|
|
105
|
-
case "primitive":
|
|
106
|
-
return a.type === b.type;
|
|
107
|
-
case "range":
|
|
108
|
-
return a.type === b.type &&
|
|
109
|
-
a.exact === b.exact &&
|
|
110
|
-
a.min === b.min &&
|
|
111
|
-
a.max === b.max;
|
|
112
|
-
case "length":
|
|
113
|
-
return a.type === b.type &&
|
|
114
|
-
a.exact === b.exact &&
|
|
115
|
-
a.min === b.min &&
|
|
116
|
-
a.max === b.max;
|
|
117
|
-
case "pattern":
|
|
118
|
-
return a.regex === b.regex &&
|
|
119
|
-
a.flags === b.flags;
|
|
120
|
-
case "literal":
|
|
121
|
-
return a.value === b.value;
|
|
122
|
-
case "enum":
|
|
123
|
-
return a.values.length === b.values.length &&
|
|
124
|
-
a.values.every((v, i) => v === b.values[i]);
|
|
125
|
-
case "array":
|
|
126
|
-
return a.exact === b.exact &&
|
|
127
|
-
a.min === b.min &&
|
|
128
|
-
a.max === b.max &&
|
|
129
|
-
shapesEqual(a.element, b.element);
|
|
130
|
-
case "optional":
|
|
131
|
-
return shapesEqual(a.inner, b.inner);
|
|
132
|
-
case "record": {
|
|
133
|
-
const aKeys = Object.keys(a.fields).sort();
|
|
134
|
-
const bKeys = Object.keys(b.fields).sort();
|
|
135
|
-
if (aKeys.length !== bKeys.length)
|
|
136
|
-
return false;
|
|
137
|
-
return aKeys.every((k, i) => k === bKeys[i] && shapesEqual(a.fields[k], b.fields[k]));
|
|
138
|
-
}
|
|
139
|
-
case "ref":
|
|
140
|
-
return a.name === b.name;
|
|
141
|
-
default:
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
@@ -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,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module upstream
|
|
4
|
+
*
|
|
5
|
+
* Upstream corpus loader — hydrates the cached compiled-JSON snapshots
|
|
6
|
+
* that `markspec lock` writes under `.markspec/cache/upstreams/<id>/`
|
|
7
|
+
* into read-only graph citizens carrying an `upstream` origin.
|
|
8
|
+
*
|
|
9
|
+
* Design: ADR-031 (docs/architecture/adr-031-federated-upstream-resolution.md).
|
|
10
|
+
* Sibling of `core/profile/delivered.ts` (`loadDeliveredCorpus`), same
|
|
11
|
+
* purity rules: no I/O of its own — file access via the injected
|
|
12
|
+
* {@linkcode ReadFile}.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.loadUpstreamCorpus = loadUpstreamCorpus;
|
|
16
|
+
const path_1 = require("@std/path");
|
|
17
|
+
const deserialize_js_1 = require("../compiler/deserialize.js");
|
|
18
|
+
const paths_js_1 = require("../util/paths.js");
|
|
19
|
+
/**
|
|
20
|
+
* Hydrate every locked upstream's cached snapshot into `Entry[]`.
|
|
21
|
+
*
|
|
22
|
+
* Per upstream: read `<dir>/manifest.json`, reject schema skew
|
|
23
|
+
* (UPSTREAM-SNAPSHOT-001), extract the serialized entries, and stamp each
|
|
24
|
+
* with `origin = { kind: "upstream", upstreamId, version }`.
|
|
25
|
+
*
|
|
26
|
+
* Authoritative-source rule (design §4.5): a snapshot entry that already
|
|
27
|
+
* carries an `origin` is a re-export of some other source's entry (the
|
|
28
|
+
* upstream's own corpus or its upstreams) and is skipped — every entry
|
|
29
|
+
* joins an aggregate only from its authoring project. A failing upstream
|
|
30
|
+
* contributes diagnostics but never aborts the others.
|
|
31
|
+
*/
|
|
32
|
+
async function loadUpstreamCorpus(upstreams, readFile) {
|
|
33
|
+
const entries = [];
|
|
34
|
+
const diagnostics = [];
|
|
35
|
+
for (const up of upstreams) {
|
|
36
|
+
const manifestPath = (0, path_1.join)(up.dir, "manifest.json");
|
|
37
|
+
const manifestRaw = await readFile(manifestPath);
|
|
38
|
+
if (manifestRaw === undefined) {
|
|
39
|
+
diagnostics.push({
|
|
40
|
+
code: "UPSTREAM-SNAPSHOT-002",
|
|
41
|
+
severity: "error",
|
|
42
|
+
message: `upstream '${up.id}' snapshot manifest is missing or unreadable; ` +
|
|
43
|
+
`run 'markspec lock' to restore the cache`,
|
|
44
|
+
location: { file: manifestPath, line: 1, column: 1 },
|
|
45
|
+
});
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
let manifest;
|
|
49
|
+
try {
|
|
50
|
+
manifest = JSON.parse(manifestRaw);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
diagnostics.push({
|
|
54
|
+
code: "UPSTREAM-SNAPSHOT-003",
|
|
55
|
+
severity: "error",
|
|
56
|
+
message: `malformed upstream snapshot: manifest is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,
|
|
57
|
+
location: { file: manifestPath, line: 1, column: 1 },
|
|
58
|
+
});
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const skew = (0, deserialize_js_1.checkSnapshotSchema)(manifest, manifestPath);
|
|
62
|
+
if (skew) {
|
|
63
|
+
diagnostics.push(skew);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
// Snapshot files are read relative to the upstream's cache dir. The
|
|
67
|
+
// extractor is sync; pre-read the single file the manifest points at.
|
|
68
|
+
const block = manifest.entries;
|
|
69
|
+
const relFile = block?.file;
|
|
70
|
+
// The manifest is untrusted input (a hostile or corrupted upstream) —
|
|
71
|
+
// reject a data-file path that could escape the cache directory
|
|
72
|
+
// before ever joining it into a read. Latent today (fixtures only);
|
|
73
|
+
// becomes live once slice 2 populates caches from remote sites (repo
|
|
74
|
+
// precedent #699 treated the analogous symlink case as a security
|
|
75
|
+
// blocker).
|
|
76
|
+
if (relFile !== undefined && (0, paths_js_1.isUnsafeRelPath)(relFile)) {
|
|
77
|
+
diagnostics.push({
|
|
78
|
+
code: "UPSTREAM-SNAPSHOT-003",
|
|
79
|
+
severity: "error",
|
|
80
|
+
message: "malformed upstream snapshot: snapshot data-file path escapes the cache directory",
|
|
81
|
+
location: { file: manifestPath, line: 1, column: 1 },
|
|
82
|
+
});
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const snapshotContent = relFile !== undefined
|
|
86
|
+
? await readFile((0, path_1.join)(up.dir, relFile))
|
|
87
|
+
: undefined;
|
|
88
|
+
const extracted = (0, deserialize_js_1.extractSerializedEntries)(manifest, (rel) => (rel === relFile ? snapshotContent : undefined), manifestPath);
|
|
89
|
+
diagnostics.push(...extracted.diagnostics);
|
|
90
|
+
for (const s of extracted.entries) {
|
|
91
|
+
if (s.origin !== undefined)
|
|
92
|
+
continue; // authoritative-source rule
|
|
93
|
+
const entry = (0, deserialize_js_1.deserializeEntry)(s);
|
|
94
|
+
entries.push({
|
|
95
|
+
...entry,
|
|
96
|
+
origin: { kind: "upstream", upstreamId: up.id, version: up.version },
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { entries, diagnostics };
|
|
101
|
+
}
|
|
@@ -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"}
|