@driftsys/markspec 0.5.0 → 0.6.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 +74 -20
- package/esm/ast/build.d.ts +11 -21
- package/esm/ast/build.d.ts.map +1 -1
- package/esm/ast/build.js +50 -139
- package/esm/ast/nodes.d.ts +11 -43
- package/esm/ast/nodes.d.ts.map +1 -1
- package/esm/ast/nodes.js +6 -1
- package/esm/ast/normalize.d.ts +8 -17
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +14 -72
- package/esm/compiler/constants.d.ts +16 -0
- package/esm/compiler/constants.d.ts.map +1 -0
- package/esm/compiler/constants.js +26 -0
- package/esm/compiler/discipline_classifier.d.ts +55 -0
- package/esm/compiler/discipline_classifier.d.ts.map +1 -0
- package/esm/compiler/discipline_classifier.js +191 -0
- package/esm/compiler/inverses.d.ts +7 -0
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +1 -18
- package/esm/compiler/mod.d.ts +30 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +198 -65
- package/esm/compiler/schema.d.ts +15 -0
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +12 -0
- package/esm/config/markspec.d.ts +5 -0
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +17 -2
- package/esm/formatter/mod.d.ts +9 -3
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +97 -49
- package/esm/lexicons/loader.d.ts +35 -0
- package/esm/lexicons/loader.d.ts.map +1 -0
- package/esm/lexicons/loader.js +51 -0
- package/esm/lexicons/mod.d.ts +13 -0
- package/esm/lexicons/mod.d.ts.map +1 -0
- package/esm/lexicons/mod.js +12 -0
- package/esm/lint/glossary.d.ts +45 -0
- package/esm/lint/glossary.d.ts.map +1 -0
- package/esm/lint/glossary.js +85 -0
- package/esm/lint/mod.d.ts +4 -0
- package/esm/lint/mod.d.ts.map +1 -1
- package/esm/lint/mod.js +2 -0
- package/esm/lint/range_util.d.ts +25 -0
- package/esm/lint/range_util.d.ts.map +1 -0
- package/esm/lint/range_util.js +50 -0
- package/esm/lint/rules/ears.d.ts +39 -0
- package/esm/lint/rules/ears.d.ts.map +1 -0
- package/esm/lint/rules/ears.js +316 -0
- package/esm/lint/rules/incose_sentence.d.ts +46 -0
- package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
- package/esm/lint/rules/incose_sentence.js +417 -0
- package/esm/lint/rules/modal_sentence.d.ts +46 -0
- package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
- package/esm/lint/rules/modal_sentence.js +146 -0
- package/esm/lint/rules/passive.d.ts +64 -0
- package/esm/lint/rules/passive.d.ts.map +1 -0
- package/esm/lint/rules/passive.js +282 -0
- package/esm/lint/rules/suppression.d.ts +38 -3
- package/esm/lint/rules/suppression.d.ts.map +1 -1
- package/esm/lint/rules/suppression.js +58 -4
- package/esm/lint/rules/xref.d.ts +19 -0
- package/esm/lint/rules/xref.d.ts.map +1 -0
- package/esm/lint/rules/xref.js +248 -0
- package/esm/lint/runner.d.ts +31 -11
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +67 -26
- package/esm/lint/score.d.ts +64 -0
- package/esm/lint/score.d.ts.map +1 -0
- package/esm/lint/score.js +163 -0
- package/esm/lint/segmenter.d.ts +32 -0
- package/esm/lint/segmenter.d.ts.map +1 -0
- package/esm/lint/segmenter.js +79 -0
- package/esm/lint/types.d.ts +12 -0
- package/esm/lint/types.d.ts.map +1 -1
- package/esm/lock/canonical_edges.d.ts +31 -0
- package/esm/lock/canonical_edges.d.ts.map +1 -0
- package/esm/lock/canonical_edges.js +57 -0
- package/esm/lock/check.d.ts +24 -0
- package/esm/lock/check.d.ts.map +1 -0
- package/esm/lock/check.js +127 -0
- package/esm/lock/hash.d.ts +12 -0
- package/esm/lock/hash.d.ts.map +1 -0
- package/esm/lock/hash.js +32 -0
- package/esm/lock/mod.d.ts +19 -0
- package/esm/lock/mod.d.ts.map +1 -0
- package/esm/lock/mod.js +14 -0
- package/esm/lock/model.d.ts +81 -0
- package/esm/lock/model.d.ts.map +1 -0
- package/esm/lock/model.js +7 -0
- package/esm/lock/parser.d.ts +26 -0
- package/esm/lock/parser.d.ts.map +1 -0
- package/esm/lock/parser.js +195 -0
- package/esm/lock/resolve.d.ts +142 -0
- package/esm/lock/resolve.d.ts.map +1 -0
- package/esm/lock/resolve.js +389 -0
- package/esm/lock/serializer.d.ts +14 -0
- package/esm/lock/serializer.d.ts.map +1 -0
- package/esm/lock/serializer.js +104 -0
- package/esm/mod.d.ts +16 -9
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +12 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +37 -0
- package/esm/model/discipline.d.ts +53 -0
- package/esm/model/discipline.d.ts.map +1 -0
- package/esm/model/discipline.js +50 -0
- package/esm/model/mod.d.ts +188 -30
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +42 -1
- package/esm/model/profile.d.ts +69 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +1 -10
- package/esm/parser/body_tokens.d.ts +35 -0
- package/esm/parser/body_tokens.d.ts.map +1 -0
- package/esm/parser/body_tokens.js +232 -0
- package/esm/parser/glossary.d.ts +8 -0
- package/esm/parser/glossary.d.ts.map +1 -1
- package/esm/parser/glossary.js +6 -4
- package/esm/parser/grammars.d.ts +5 -3
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +12 -4
- package/esm/parser/language_spec.d.ts +55 -0
- package/esm/parser/language_spec.d.ts.map +1 -0
- package/esm/parser/language_spec.js +419 -0
- package/esm/parser/line_map.d.ts +60 -0
- package/esm/parser/line_map.d.ts.map +1 -0
- package/esm/parser/line_map.js +41 -0
- package/esm/parser/markdown.d.ts +9 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +107 -31
- package/esm/parser/mod.d.ts +4 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +30 -8
- package/esm/parser/source.d.ts +39 -8
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +155 -65
- package/esm/parser/translate.d.ts +24 -0
- package/esm/parser/translate.d.ts.map +1 -0
- package/esm/parser/translate.js +99 -0
- package/esm/profile/chain.d.ts +8 -0
- package/esm/profile/chain.d.ts.map +1 -1
- package/esm/profile/chain.js +29 -1
- package/esm/profile/default_profile.d.ts +25 -0
- package/esm/profile/default_profile.d.ts.map +1 -0
- package/esm/profile/default_profile.js +43 -0
- package/esm/profile/discipline_mode.d.ts +64 -0
- package/esm/profile/discipline_mode.d.ts.map +1 -0
- package/esm/profile/discipline_mode.js +133 -0
- package/esm/profile/discipline_registry.d.ts +41 -0
- package/esm/profile/discipline_registry.d.ts.map +1 -0
- package/esm/profile/discipline_registry.js +67 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +24 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +253 -20
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +112 -0
- package/esm/profile/mod.d.ts +2 -0
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +2 -0
- package/esm/sync/locked_attributes.d.ts +19 -0
- package/esm/sync/locked_attributes.d.ts.map +1 -0
- package/esm/sync/locked_attributes.js +27 -0
- package/esm/sync/log.d.ts +34 -0
- package/esm/sync/log.d.ts.map +1 -0
- package/esm/sync/log.js +48 -0
- package/esm/sync/mapping.d.ts +66 -0
- package/esm/sync/mapping.d.ts.map +1 -0
- package/esm/sync/mapping.js +165 -0
- package/esm/sync/mod.d.ts +16 -0
- package/esm/sync/mod.d.ts.map +1 -0
- package/esm/sync/mod.js +12 -0
- package/esm/sync/status.d.ts +23 -0
- package/esm/sync/status.d.ts.map +1 -0
- package/esm/sync/status.js +21 -0
- package/esm/typl/ast.d.ts +87 -0
- package/esm/typl/ast.d.ts.map +1 -0
- package/esm/typl/ast.js +21 -0
- package/esm/typl/bridge.d.ts +32 -0
- package/esm/typl/bridge.d.ts.map +1 -0
- package/esm/typl/bridge.js +27 -0
- package/esm/typl/bullet.d.ts +34 -0
- package/esm/typl/bullet.d.ts.map +1 -0
- package/esm/typl/bullet.js +44 -0
- package/esm/typl/diagnostics.d.ts +43 -0
- package/esm/typl/diagnostics.d.ts.map +1 -0
- package/esm/typl/diagnostics.js +61 -0
- package/esm/typl/fence.d.ts +31 -0
- package/esm/typl/fence.d.ts.map +1 -0
- package/esm/typl/fence.js +24 -0
- package/esm/typl/grammar.d.ts +20 -0
- package/esm/typl/grammar.d.ts.map +1 -0
- package/esm/typl/grammar.js +471 -0
- package/esm/typl/inline.d.ts +34 -0
- package/esm/typl/inline.d.ts.map +1 -0
- package/esm/typl/inline.js +48 -0
- package/esm/typl/lexer.d.ts +37 -0
- package/esm/typl/lexer.d.ts.map +1 -0
- package/esm/typl/lexer.js +234 -0
- package/esm/typl/mod.d.ts +23 -0
- package/esm/typl/mod.d.ts.map +1 -0
- package/esm/typl/mod.js +16 -0
- package/esm/typl/registry.d.ts +42 -0
- package/esm/typl/registry.d.ts.map +1 -0
- package/esm/typl/registry.js +26 -0
- package/esm/typl/validator.d.ts +29 -0
- package/esm/typl/validator.d.ts.map +1 -0
- package/esm/typl/validator.js +141 -0
- package/esm/util/line_endings.d.ts +33 -0
- package/esm/util/line_endings.d.ts.map +1 -0
- package/esm/util/line_endings.js +53 -0
- package/esm/util/modals.d.ts +29 -0
- package/esm/util/modals.d.ts.map +1 -0
- package/esm/util/modals.js +38 -0
- package/esm/validator/discipline.d.ts +35 -0
- package/esm/validator/discipline.d.ts.map +1 -0
- package/esm/validator/discipline.js +204 -0
- package/esm/validator/mod.d.ts +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +23 -2
- package/esm/validator/modal_keywords.d.ts +15 -13
- package/esm/validator/modal_keywords.d.ts.map +1 -1
- package/esm/validator/modal_keywords.js +26 -109
- package/esm/validator/pattern.d.ts +15 -8
- package/esm/validator/pattern.d.ts.map +1 -1
- package/esm/validator/pattern.js +42 -19
- package/esm/validator/per_type_attrs.d.ts +2 -2
- package/esm/validator/per_type_attrs.d.ts.map +1 -1
- package/esm/validator/per_type_attrs.js +2 -2
- package/esm/validator/pipeline.d.ts +11 -0
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +37 -15
- package/esm/validator/type_resolution.d.ts +3 -3
- package/esm/validator/type_resolution.d.ts.map +1 -1
- package/esm/validator/type_resolution.js +31 -9
- package/package.json +2 -2
- package/script/ast/build.d.ts +11 -21
- package/script/ast/build.d.ts.map +1 -1
- package/script/ast/build.js +51 -140
- package/script/ast/nodes.d.ts +11 -43
- package/script/ast/nodes.d.ts.map +1 -1
- package/script/ast/nodes.js +6 -1
- package/script/ast/normalize.d.ts +8 -17
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +16 -74
- package/script/compiler/constants.d.ts +16 -0
- package/script/compiler/constants.d.ts.map +1 -0
- package/script/compiler/constants.js +29 -0
- package/script/compiler/discipline_classifier.d.ts +55 -0
- package/script/compiler/discipline_classifier.d.ts.map +1 -0
- package/script/compiler/discipline_classifier.js +196 -0
- package/script/compiler/inverses.d.ts +7 -0
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +2 -19
- package/script/compiler/mod.d.ts +30 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +202 -69
- package/script/compiler/schema.d.ts +15 -0
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +12 -0
- package/script/config/markspec.d.ts +5 -0
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +17 -2
- package/script/formatter/mod.d.ts +9 -3
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +99 -51
- package/script/lexicons/loader.d.ts +35 -0
- package/script/lexicons/loader.d.ts.map +1 -0
- package/script/lexicons/loader.js +55 -0
- package/script/lexicons/mod.d.ts +13 -0
- package/script/lexicons/mod.d.ts.map +1 -0
- package/script/lexicons/mod.js +17 -0
- package/script/lint/glossary.d.ts +45 -0
- package/script/lint/glossary.d.ts.map +1 -0
- package/script/lint/glossary.js +88 -0
- package/script/lint/mod.d.ts +4 -0
- package/script/lint/mod.d.ts.map +1 -1
- package/script/lint/mod.js +6 -1
- package/script/lint/range_util.d.ts +25 -0
- package/script/lint/range_util.d.ts.map +1 -0
- package/script/lint/range_util.js +53 -0
- package/script/lint/rules/ears.d.ts +39 -0
- package/script/lint/rules/ears.d.ts.map +1 -0
- package/script/lint/rules/ears.js +320 -0
- package/script/lint/rules/incose_sentence.d.ts +46 -0
- package/script/lint/rules/incose_sentence.d.ts.map +1 -0
- package/script/lint/rules/incose_sentence.js +421 -0
- package/script/lint/rules/modal_sentence.d.ts +46 -0
- package/script/lint/rules/modal_sentence.d.ts.map +1 -0
- package/script/lint/rules/modal_sentence.js +150 -0
- package/script/lint/rules/passive.d.ts +64 -0
- package/script/lint/rules/passive.d.ts.map +1 -0
- package/script/lint/rules/passive.js +286 -0
- package/script/lint/rules/suppression.d.ts +38 -3
- package/script/lint/rules/suppression.d.ts.map +1 -1
- package/script/lint/rules/suppression.js +59 -3
- package/script/lint/rules/xref.d.ts +19 -0
- package/script/lint/rules/xref.d.ts.map +1 -0
- package/script/lint/rules/xref.js +251 -0
- package/script/lint/runner.d.ts +31 -11
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +67 -26
- package/script/lint/score.d.ts +64 -0
- package/script/lint/score.d.ts.map +1 -0
- package/script/lint/score.js +167 -0
- package/script/lint/segmenter.d.ts +32 -0
- package/script/lint/segmenter.d.ts.map +1 -0
- package/script/lint/segmenter.js +82 -0
- package/script/lint/types.d.ts +12 -0
- package/script/lint/types.d.ts.map +1 -1
- package/script/lock/canonical_edges.d.ts +31 -0
- package/script/lock/canonical_edges.d.ts.map +1 -0
- package/script/lock/canonical_edges.js +61 -0
- package/script/lock/check.d.ts +24 -0
- package/script/lock/check.d.ts.map +1 -0
- package/script/lock/check.js +130 -0
- package/script/lock/hash.d.ts +12 -0
- package/script/lock/hash.d.ts.map +1 -0
- package/script/lock/hash.js +36 -0
- package/script/lock/mod.d.ts +19 -0
- package/script/lock/mod.d.ts.map +1 -0
- package/script/lock/mod.js +31 -0
- package/script/lock/model.d.ts +81 -0
- package/script/lock/model.d.ts.map +1 -0
- package/script/lock/model.js +10 -0
- package/script/lock/parser.d.ts +26 -0
- package/script/lock/parser.d.ts.map +1 -0
- package/script/lock/parser.js +198 -0
- package/script/lock/resolve.d.ts +142 -0
- package/script/lock/resolve.d.ts.map +1 -0
- package/script/lock/resolve.js +397 -0
- package/script/lock/serializer.d.ts +14 -0
- package/script/lock/serializer.d.ts.map +1 -0
- package/script/lock/serializer.js +107 -0
- package/script/mod.d.ts +16 -9
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +111 -38
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +38 -1
- package/script/model/discipline.d.ts +53 -0
- package/script/model/discipline.d.ts.map +1 -0
- package/script/model/discipline.js +53 -0
- package/script/model/mod.d.ts +188 -30
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +48 -1
- package/script/model/profile.d.ts +69 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +1 -10
- package/script/parser/body_tokens.d.ts +35 -0
- package/script/parser/body_tokens.d.ts.map +1 -0
- package/script/parser/body_tokens.js +235 -0
- package/script/parser/glossary.d.ts +8 -0
- package/script/parser/glossary.d.ts.map +1 -1
- package/script/parser/glossary.js +7 -4
- package/script/parser/grammars.d.ts +5 -3
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +15 -8
- package/script/parser/language_spec.d.ts +55 -0
- package/script/parser/language_spec.d.ts.map +1 -0
- package/script/parser/language_spec.js +423 -0
- package/script/parser/line_map.d.ts +60 -0
- package/script/parser/line_map.d.ts.map +1 -0
- package/script/parser/line_map.js +44 -0
- package/script/parser/markdown.d.ts +9 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +105 -29
- package/script/parser/mod.d.ts +4 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +32 -7
- package/script/parser/source.d.ts +39 -8
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +156 -69
- package/script/parser/translate.d.ts +24 -0
- package/script/parser/translate.d.ts.map +1 -0
- package/script/parser/translate.js +102 -0
- package/script/profile/chain.d.ts +8 -0
- package/script/profile/chain.d.ts.map +1 -1
- package/script/profile/chain.js +29 -1
- package/script/profile/default_profile.d.ts +25 -0
- package/script/profile/default_profile.d.ts.map +1 -0
- package/script/profile/default_profile.js +46 -0
- package/script/profile/discipline_mode.d.ts +64 -0
- package/script/profile/discipline_mode.d.ts.map +1 -0
- package/script/profile/discipline_mode.js +138 -0
- package/script/profile/discipline_registry.d.ts +41 -0
- package/script/profile/discipline_registry.d.ts.map +1 -0
- package/script/profile/discipline_registry.js +70 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +24 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +252 -19
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +112 -0
- package/script/profile/mod.d.ts +2 -0
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +6 -1
- package/script/sync/locked_attributes.d.ts +19 -0
- package/script/sync/locked_attributes.d.ts.map +1 -0
- package/script/sync/locked_attributes.js +30 -0
- package/script/sync/log.d.ts +34 -0
- package/script/sync/log.d.ts.map +1 -0
- package/script/sync/log.js +52 -0
- package/script/sync/mapping.d.ts +66 -0
- package/script/sync/mapping.d.ts.map +1 -0
- package/script/sync/mapping.js +169 -0
- package/script/sync/mod.d.ts +16 -0
- package/script/sync/mod.d.ts.map +1 -0
- package/script/sync/mod.js +21 -0
- package/script/sync/status.d.ts +23 -0
- package/script/sync/status.d.ts.map +1 -0
- package/script/sync/status.js +24 -0
- package/script/typl/ast.d.ts +87 -0
- package/script/typl/ast.d.ts.map +1 -0
- package/script/typl/ast.js +24 -0
- package/script/typl/bridge.d.ts +32 -0
- package/script/typl/bridge.d.ts.map +1 -0
- package/script/typl/bridge.js +30 -0
- package/script/typl/bullet.d.ts +34 -0
- package/script/typl/bullet.d.ts.map +1 -0
- package/script/typl/bullet.js +47 -0
- package/script/typl/diagnostics.d.ts +43 -0
- package/script/typl/diagnostics.d.ts.map +1 -0
- package/script/typl/diagnostics.js +65 -0
- package/script/typl/fence.d.ts +31 -0
- package/script/typl/fence.d.ts.map +1 -0
- package/script/typl/fence.js +27 -0
- package/script/typl/grammar.d.ts +20 -0
- package/script/typl/grammar.d.ts.map +1 -0
- package/script/typl/grammar.js +474 -0
- package/script/typl/inline.d.ts +34 -0
- package/script/typl/inline.d.ts.map +1 -0
- package/script/typl/inline.js +51 -0
- package/script/typl/lexer.d.ts +37 -0
- package/script/typl/lexer.d.ts.map +1 -0
- package/script/typl/lexer.js +237 -0
- package/script/typl/mod.d.ts +23 -0
- package/script/typl/mod.d.ts.map +1 -0
- package/script/typl/mod.js +29 -0
- package/script/typl/registry.d.ts +42 -0
- package/script/typl/registry.d.ts.map +1 -0
- package/script/typl/registry.js +29 -0
- package/script/typl/validator.d.ts +29 -0
- package/script/typl/validator.d.ts.map +1 -0
- package/script/typl/validator.js +144 -0
- package/script/util/line_endings.d.ts +33 -0
- package/script/util/line_endings.d.ts.map +1 -0
- package/script/util/line_endings.js +58 -0
- package/script/util/modals.d.ts +29 -0
- package/script/util/modals.d.ts.map +1 -0
- package/script/util/modals.js +42 -0
- package/script/validator/discipline.d.ts +35 -0
- package/script/validator/discipline.d.ts.map +1 -0
- package/script/validator/discipline.js +207 -0
- package/script/validator/mod.d.ts +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +23 -1
- package/script/validator/modal_keywords.d.ts +15 -13
- package/script/validator/modal_keywords.d.ts.map +1 -1
- package/script/validator/modal_keywords.js +26 -109
- package/script/validator/pattern.d.ts +15 -8
- package/script/validator/pattern.d.ts.map +1 -1
- package/script/validator/pattern.js +42 -19
- package/script/validator/per_type_attrs.d.ts +2 -2
- package/script/validator/per_type_attrs.d.ts.map +1 -1
- package/script/validator/per_type_attrs.js +2 -2
- package/script/validator/pipeline.d.ts +11 -0
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +40 -17
- package/script/validator/type_resolution.d.ts +3 -3
- package/script/validator/type_resolution.d.ts.map +1 -1
- package/script/validator/type_resolution.js +31 -9
- package/esm/parser/entity_refs.d.ts +0 -53
- package/esm/parser/entity_refs.d.ts.map +0 -1
- package/esm/parser/entity_refs.js +0 -151
- package/script/parser/entity_refs.d.ts +0 -53
- package/script/parser/entity_refs.d.ts.map +0 -1
- package/script/parser/entity_refs.js +0 -155
package/esm/parser/source.js
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* comments in Rust, Kotlin, C, C++, and Java source files. Delegates parsed
|
|
6
6
|
* content to the markdown parser for entry extraction.
|
|
7
7
|
*/
|
|
8
|
-
import Parser from "web-tree-sitter";
|
|
8
|
+
import { Parser } from "web-tree-sitter";
|
|
9
9
|
import { parseMarkdown } from "./markdown.js";
|
|
10
|
+
import { buildBlockLineMap } from "./line_map.js";
|
|
11
|
+
import { LANGUAGE_SPECS } from "./language_spec.js";
|
|
10
12
|
/**
|
|
11
13
|
* Parse a source file and return entries extracted from doc comments.
|
|
12
14
|
*
|
|
@@ -19,30 +21,41 @@ import { parseMarkdown } from "./markdown.js";
|
|
|
19
21
|
*/
|
|
20
22
|
export function parseSource(content, options) {
|
|
21
23
|
const file = options.file ?? "<unknown>";
|
|
24
|
+
const spec = LANGUAGE_SPECS[options.languageId];
|
|
22
25
|
const parser = new Parser();
|
|
23
26
|
parser.setLanguage(options.language);
|
|
24
27
|
const tree = parser.parse(content);
|
|
28
|
+
if (!tree)
|
|
29
|
+
return { entries: [] };
|
|
25
30
|
const blocks = [];
|
|
26
|
-
walkForDocComments(tree.rootNode, blocks);
|
|
31
|
+
walkForDocComments(tree.rootNode, blocks, spec);
|
|
27
32
|
const entries = [];
|
|
28
33
|
for (const block of blocks) {
|
|
29
34
|
const markdown = wrapAsListItem(block.lines);
|
|
30
|
-
const
|
|
35
|
+
const lineMap = buildBlockLineMap({
|
|
36
|
+
startLine: block.startLine,
|
|
37
|
+
startColumn: block.startColumn,
|
|
38
|
+
prefixWidths: block.prefixWidths,
|
|
39
|
+
});
|
|
40
|
+
const { entries: parsed } = parseMarkdown(markdown, { file, lineMap });
|
|
31
41
|
for (const entry of parsed) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
42
|
+
// entry.location, bodyAst ranges, and bodyTokens are already
|
|
43
|
+
// file-relative thanks to the lineMap post-pass inside parseMarkdown.
|
|
44
|
+
// Source files have no front matter; properties.file is derived from
|
|
45
|
+
// the translated entry.location.
|
|
37
46
|
entries.push({
|
|
38
47
|
...entry,
|
|
39
|
-
source:
|
|
40
|
-
|
|
48
|
+
source: {
|
|
49
|
+
kind: "doc-comment",
|
|
50
|
+
language: options.languageId,
|
|
51
|
+
function: block.itemName,
|
|
52
|
+
rule: block.rule,
|
|
53
|
+
},
|
|
41
54
|
properties: {
|
|
42
55
|
file: {
|
|
43
56
|
path: file,
|
|
44
|
-
line:
|
|
45
|
-
column:
|
|
57
|
+
line: entry.location.line,
|
|
58
|
+
column: entry.location.column,
|
|
46
59
|
},
|
|
47
60
|
},
|
|
48
61
|
});
|
|
@@ -52,74 +65,109 @@ export function parseSource(content, options) {
|
|
|
52
65
|
parser.delete();
|
|
53
66
|
return { entries };
|
|
54
67
|
}
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
/** Maximum sibling-walk length before giving up. Generous for typical
|
|
69
|
+
* attribute stacks; bounds pathological inputs. */
|
|
70
|
+
const ENCLOSING_ITEM_LOOKAHEAD = 10;
|
|
71
|
+
/** Search the doc-comment's siblings for an enclosing item, skipping
|
|
72
|
+
* attribute/annotation/comment nodes per the language spec. Returns
|
|
73
|
+
* the item-name string or undefined. */
|
|
74
|
+
function findItemName(commentNode, spec) {
|
|
75
|
+
let sibling = commentNode.nextSibling;
|
|
76
|
+
let examined = 0;
|
|
77
|
+
while (sibling !== null && examined < ENCLOSING_ITEM_LOOKAHEAD) {
|
|
78
|
+
examined++;
|
|
79
|
+
if (spec.enclosingItemTypes.includes(sibling.type)) {
|
|
80
|
+
return spec.itemName(sibling);
|
|
81
|
+
}
|
|
82
|
+
if (!spec.attributeSkipTypes.includes(sibling.type)) {
|
|
83
|
+
// Hit something that isn't an item AND isn't a skippable attribute —
|
|
84
|
+
// structural surprise. Give up rather than walk forever.
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
sibling = sibling.nextSibling;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
function walkForDocComments(node, blocks, spec) {
|
|
65
92
|
let currentLines = [];
|
|
93
|
+
let currentPrefixWidths = [];
|
|
66
94
|
let currentStartLine = 0;
|
|
67
95
|
let currentStartColumn = 0;
|
|
96
|
+
let currentRule = "outer-doc-comment";
|
|
68
97
|
let lastRow = -2;
|
|
98
|
+
let currentLastCommentNode = null;
|
|
69
99
|
function flushLineBlock() {
|
|
70
100
|
if (currentLines.length > 0) {
|
|
101
|
+
const itemName = currentLastCommentNode
|
|
102
|
+
? findItemName(currentLastCommentNode, spec)
|
|
103
|
+
: undefined;
|
|
71
104
|
blocks.push({
|
|
72
105
|
lines: currentLines,
|
|
73
106
|
startLine: currentStartLine,
|
|
74
107
|
startColumn: currentStartColumn,
|
|
108
|
+
prefixWidths: currentPrefixWidths,
|
|
109
|
+
rule: currentRule,
|
|
110
|
+
itemName,
|
|
75
111
|
});
|
|
76
112
|
currentLines = [];
|
|
113
|
+
currentPrefixWidths = [];
|
|
114
|
+
currentRule = "outer-doc-comment";
|
|
115
|
+
currentLastCommentNode = null;
|
|
77
116
|
lastRow = -2;
|
|
78
117
|
}
|
|
79
118
|
}
|
|
80
119
|
for (let i = 0; i < node.childCount; i++) {
|
|
81
120
|
const child = node.child(i);
|
|
82
|
-
|
|
121
|
+
const isLineComment = spec.lineCommentTypes.includes(child.type) &&
|
|
122
|
+
spec.isDocLine(child.text);
|
|
123
|
+
if (isLineComment) {
|
|
83
124
|
const row = child.startPosition.row;
|
|
84
|
-
// Not consecutive — flush previous block
|
|
85
125
|
if (currentLines.length > 0 && row !== lastRow + 1) {
|
|
86
126
|
flushLineBlock();
|
|
87
127
|
}
|
|
88
128
|
if (currentLines.length === 0) {
|
|
89
|
-
currentStartLine = row + 1;
|
|
90
|
-
currentStartColumn = child.startPosition.column + 1;
|
|
129
|
+
currentStartLine = row + 1;
|
|
130
|
+
currentStartColumn = child.startPosition.column + 1;
|
|
91
131
|
}
|
|
92
|
-
|
|
132
|
+
const { text, prefixWidth, rule } = stripLineCommentPrefix(child);
|
|
133
|
+
if (currentLines.length === 0) {
|
|
134
|
+
currentRule = rule;
|
|
135
|
+
}
|
|
136
|
+
currentLines.push(text);
|
|
137
|
+
currentPrefixWidths.push(prefixWidth);
|
|
138
|
+
currentLastCommentNode = child;
|
|
93
139
|
lastRow = row;
|
|
94
140
|
continue;
|
|
95
141
|
}
|
|
96
|
-
|
|
142
|
+
const isBlockComment = spec.blockCommentTypes.includes(child.type) &&
|
|
143
|
+
spec.isDocBlock(child.text);
|
|
144
|
+
if (isBlockComment) {
|
|
97
145
|
flushLineBlock();
|
|
146
|
+
const { lines, prefixWidths, openerSkipped } = stripBlockCommentPrefix(child.text);
|
|
147
|
+
if (lines.length === 0)
|
|
148
|
+
continue;
|
|
149
|
+
const startRow = child.startPosition.row + (openerSkipped ? 1 : 0);
|
|
150
|
+
const itemName = findItemName(child, spec);
|
|
98
151
|
blocks.push({
|
|
99
|
-
lines
|
|
100
|
-
startLine:
|
|
152
|
+
lines,
|
|
153
|
+
startLine: startRow + 1,
|
|
101
154
|
startColumn: child.startPosition.column + 1,
|
|
155
|
+
prefixWidths,
|
|
156
|
+
rule: "block-doc-comment",
|
|
157
|
+
itemName,
|
|
102
158
|
});
|
|
103
159
|
continue;
|
|
104
160
|
}
|
|
105
161
|
// Non-comment node — flush pending line comments, then recurse.
|
|
106
162
|
flushLineBlock();
|
|
107
163
|
if (child.childCount > 0) {
|
|
108
|
-
walkForDocComments(child, blocks);
|
|
164
|
+
walkForDocComments(child, blocks, spec);
|
|
109
165
|
}
|
|
110
166
|
}
|
|
111
167
|
flushLineBlock();
|
|
112
168
|
}
|
|
113
|
-
/** Check if a line_comment node is a `///` outer doc comment. */
|
|
114
|
-
function isOuterDocComment(node) {
|
|
115
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
116
|
-
if (node.child(i).type === "outer_doc_comment_marker")
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
169
|
/**
|
|
122
|
-
* Strip the `///` prefix from a line comment node.
|
|
170
|
+
* Strip the `///` or `//!` prefix from a line comment node.
|
|
123
171
|
* Uses the `doc_comment` child if available, otherwise strips manually.
|
|
124
172
|
*/
|
|
125
173
|
export function stripLineCommentPrefix(node) {
|
|
@@ -127,53 +175,95 @@ export function stripLineCommentPrefix(node) {
|
|
|
127
175
|
const child = node.child(i);
|
|
128
176
|
if (child.type === "doc_comment") {
|
|
129
177
|
let text = child.text.replace(/\n$/, "");
|
|
130
|
-
//
|
|
131
|
-
|
|
178
|
+
// The line_comment node's text starts with `///` (or `//!`); the
|
|
179
|
+
// doc_comment child is the substring after the marker. Compute
|
|
180
|
+
// prefixWidth as (line_comment_text_length - doc_comment_text_length)
|
|
181
|
+
// before stripping the conventional leading space.
|
|
182
|
+
const rawDoc = child.text.replace(/\n$/, "");
|
|
183
|
+
let prefixWidth = node.text.replace(/\n$/, "").length - rawDoc.length;
|
|
184
|
+
if (text.startsWith(" ")) {
|
|
132
185
|
text = text.slice(1);
|
|
133
|
-
|
|
186
|
+
prefixWidth += 1;
|
|
187
|
+
}
|
|
188
|
+
const rule = node.text.startsWith("//!") ? "inner-doc-comment" : "outer-doc-comment";
|
|
189
|
+
return { text, prefixWidth, rule };
|
|
134
190
|
}
|
|
135
191
|
}
|
|
136
192
|
// Fallback: manual prefix stripping
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
return text.slice(4);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
193
|
+
const raw = node.text.replace(/\n$/, "");
|
|
194
|
+
if (raw.startsWith("/// ")) {
|
|
195
|
+
return { text: raw.slice(4), prefixWidth: 4, rule: "outer-doc-comment" };
|
|
196
|
+
}
|
|
197
|
+
if (raw.startsWith("///")) {
|
|
198
|
+
return { text: raw.slice(3), prefixWidth: 3, rule: "outer-doc-comment" };
|
|
199
|
+
}
|
|
200
|
+
if (raw.startsWith("//! ")) {
|
|
201
|
+
return { text: raw.slice(4), prefixWidth: 4, rule: "inner-doc-comment" };
|
|
202
|
+
}
|
|
203
|
+
if (raw.startsWith("//!")) {
|
|
204
|
+
return { text: raw.slice(3), prefixWidth: 3, rule: "inner-doc-comment" };
|
|
205
|
+
}
|
|
206
|
+
return { text: raw, prefixWidth: 0, rule: "outer-doc-comment" };
|
|
143
207
|
}
|
|
144
208
|
/**
|
|
145
|
-
* Strip block
|
|
146
|
-
* Returns cleaned lines
|
|
209
|
+
* Strip block-comment delimiters and leading ` * ` prefixes.
|
|
210
|
+
* Returns cleaned lines, per-line prefix widths, and a flag indicating
|
|
211
|
+
* whether the opener was skipped (bare `/**\n`).
|
|
147
212
|
*/
|
|
148
213
|
export function stripBlockCommentPrefix(text) {
|
|
149
214
|
const rawLines = text.split("\n");
|
|
150
|
-
const
|
|
215
|
+
const lines = [];
|
|
216
|
+
const prefixWidths = [];
|
|
217
|
+
let openerSkipped = false;
|
|
151
218
|
for (let i = 0; i < rawLines.length; i++) {
|
|
152
|
-
const
|
|
153
|
-
|
|
219
|
+
const raw = rawLines[i];
|
|
220
|
+
const trimmed = raw.trim();
|
|
221
|
+
// Opening `/**` line. May have content after it.
|
|
154
222
|
if (i === 0) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
223
|
+
// Locate the `/**` marker; for canonical javadoc it's at the line
|
|
224
|
+
// start, but be defensive.
|
|
225
|
+
const markerIdx = raw.indexOf("/**");
|
|
226
|
+
const afterMarker = markerIdx >= 0
|
|
227
|
+
? raw.slice(markerIdx + 3).replace(/^\s+/, "")
|
|
228
|
+
: "";
|
|
229
|
+
if (afterMarker && afterMarker !== "/") {
|
|
230
|
+
// Compute prefixWidth so that for "/** Title", afterMarker="Title"
|
|
231
|
+
// and prefixWidth = (raw.length - afterMarker.length) = 4 if
|
|
232
|
+
// raw="/** Title", which matches the spec table.
|
|
233
|
+
const prefixWidth = raw.length - afterMarker.length;
|
|
234
|
+
lines.push(afterMarker);
|
|
235
|
+
prefixWidths.push(prefixWidth);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
openerSkipped = true;
|
|
158
239
|
}
|
|
159
240
|
continue;
|
|
160
241
|
}
|
|
161
|
-
//
|
|
162
|
-
if (i === rawLines.length - 1 && trimmed === "*/")
|
|
242
|
+
// Closing `*/` line — skip.
|
|
243
|
+
if (i === rawLines.length - 1 && trimmed === "*/")
|
|
163
244
|
continue;
|
|
164
|
-
|
|
165
|
-
// Strip leading ` * ` or ` *`
|
|
245
|
+
// Strip leading ` * ` or ` *` or bare prose.
|
|
166
246
|
if (trimmed.startsWith("* ")) {
|
|
167
|
-
|
|
247
|
+
// Strip up through "* " — find leading-whitespace + "* "
|
|
248
|
+
const starIdx = raw.indexOf("* ");
|
|
249
|
+
const stripped = raw.slice(starIdx + 2);
|
|
250
|
+
lines.push(stripped);
|
|
251
|
+
prefixWidths.push(starIdx + 2);
|
|
168
252
|
}
|
|
169
253
|
else if (trimmed === "*") {
|
|
170
|
-
|
|
254
|
+
lines.push("");
|
|
255
|
+
prefixWidths.push(raw.indexOf("*") + 1);
|
|
256
|
+
}
|
|
257
|
+
else if (trimmed === "") {
|
|
258
|
+
lines.push("");
|
|
259
|
+
prefixWidths.push(0);
|
|
171
260
|
}
|
|
172
261
|
else {
|
|
173
|
-
|
|
262
|
+
lines.push(trimmed);
|
|
263
|
+
prefixWidths.push(raw.length - trimmed.length);
|
|
174
264
|
}
|
|
175
265
|
}
|
|
176
|
-
return
|
|
266
|
+
return { lines, prefixWidths, openerSkipped };
|
|
177
267
|
}
|
|
178
268
|
/**
|
|
179
269
|
* Wrap cleaned doc comment lines as a Markdown list item so the
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module parser/translate
|
|
3
|
+
*
|
|
4
|
+
* Post-pass that walks parsed `Entry[]` and applies a `LineMap` to every
|
|
5
|
+
* coordinate field — entry locations, body-AST node ranges (which carry
|
|
6
|
+
* `{line, column}` points without `file`), body tokens. Returns a fresh
|
|
7
|
+
* entries array; originals are not mutated.
|
|
8
|
+
*
|
|
9
|
+
* This is the **one translation point** required by ADR-016 §6. The
|
|
10
|
+
* upstream parser produces buffer-relative locations; this pass converts
|
|
11
|
+
* them to file-relative coordinates. When `LineMap.translate` returns
|
|
12
|
+
* `undefined` (over-run past the block's last line), the affected
|
|
13
|
+
* location safe-falls to the entry's own translated `location` with
|
|
14
|
+
* column reset to 1, and a single `console.warn` per entries-batch
|
|
15
|
+
* flags the drift.
|
|
16
|
+
*/
|
|
17
|
+
import type { Entry } from "../model/mod.js";
|
|
18
|
+
import type { LineMap } from "./line_map.js";
|
|
19
|
+
/**
|
|
20
|
+
* Translate every coordinate inside `entries` through `lineMap`.
|
|
21
|
+
* Returns a new array of new entries; input is not mutated.
|
|
22
|
+
*/
|
|
23
|
+
export declare function translateEntryLocations(entries: readonly Entry[], lineMap: LineMap): Entry[];
|
|
24
|
+
//# sourceMappingURL=translate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/parser/translate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,OAAO,GACf,KAAK,EAAE,CAoDT"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module parser/translate
|
|
3
|
+
*
|
|
4
|
+
* Post-pass that walks parsed `Entry[]` and applies a `LineMap` to every
|
|
5
|
+
* coordinate field — entry locations, body-AST node ranges (which carry
|
|
6
|
+
* `{line, column}` points without `file`), body tokens. Returns a fresh
|
|
7
|
+
* entries array; originals are not mutated.
|
|
8
|
+
*
|
|
9
|
+
* This is the **one translation point** required by ADR-016 §6. The
|
|
10
|
+
* upstream parser produces buffer-relative locations; this pass converts
|
|
11
|
+
* them to file-relative coordinates. When `LineMap.translate` returns
|
|
12
|
+
* `undefined` (over-run past the block's last line), the affected
|
|
13
|
+
* location safe-falls to the entry's own translated `location` with
|
|
14
|
+
* column reset to 1, and a single `console.warn` per entries-batch
|
|
15
|
+
* flags the drift.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Translate every coordinate inside `entries` through `lineMap`.
|
|
19
|
+
* Returns a new array of new entries; input is not mutated.
|
|
20
|
+
*/
|
|
21
|
+
export function translateEntryLocations(entries, lineMap) {
|
|
22
|
+
let warned = false;
|
|
23
|
+
const warn = () => {
|
|
24
|
+
if (warned)
|
|
25
|
+
return;
|
|
26
|
+
warned = true;
|
|
27
|
+
console.warn("translateEntryLocations: LineMap.translate returned undefined " +
|
|
28
|
+
"for at least one location; falling back to entry start. " +
|
|
29
|
+
"This indicates a coordinate-translation drift.");
|
|
30
|
+
};
|
|
31
|
+
return entries.map((entry) => {
|
|
32
|
+
const translatedEntryLoc = translateLocation(entry.location, lineMap, entry.location, warn);
|
|
33
|
+
const fallbackPoint = {
|
|
34
|
+
line: translatedEntryLoc.line,
|
|
35
|
+
column: 1,
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
...entry,
|
|
39
|
+
location: translatedEntryLoc,
|
|
40
|
+
bodyAst: entry.bodyAst
|
|
41
|
+
? entry.bodyAst.map((block) => translateBlock(block, lineMap, fallbackPoint, warn))
|
|
42
|
+
: entry.bodyAst,
|
|
43
|
+
bodyTokens: entry.bodyTokens.map((token) => ({
|
|
44
|
+
...token,
|
|
45
|
+
location: translateLocation(token.location, lineMap, translatedEntryLoc, warn),
|
|
46
|
+
})),
|
|
47
|
+
properties: entry.properties?.file
|
|
48
|
+
? {
|
|
49
|
+
...entry.properties,
|
|
50
|
+
file: {
|
|
51
|
+
...entry.properties.file,
|
|
52
|
+
line: translatedEntryLoc.line,
|
|
53
|
+
column: translatedEntryLoc.column,
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
: entry.properties,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Translate a SourceLocation (preserves `file` field). */
|
|
61
|
+
function translateLocation(loc, lineMap, fallback, warn) {
|
|
62
|
+
const t = lineMap.translate(loc.line, loc.column);
|
|
63
|
+
if (!t) {
|
|
64
|
+
warn();
|
|
65
|
+
return { file: loc.file, line: fallback.line, column: 1 };
|
|
66
|
+
}
|
|
67
|
+
return { file: loc.file, line: t.line, column: t.column };
|
|
68
|
+
}
|
|
69
|
+
/** Translate a SourceRange point (no `file` field). */
|
|
70
|
+
function translatePoint(pt, lineMap, fallback, warn) {
|
|
71
|
+
const t = lineMap.translate(pt.line, pt.column);
|
|
72
|
+
if (!t) {
|
|
73
|
+
warn();
|
|
74
|
+
return { line: fallback.line, column: fallback.column };
|
|
75
|
+
}
|
|
76
|
+
return { line: t.line, column: t.column };
|
|
77
|
+
}
|
|
78
|
+
function translateBlock(block, lineMap, fallbackPoint, warn) {
|
|
79
|
+
const range = {
|
|
80
|
+
start: translatePoint(block.range.start, lineMap, fallbackPoint, warn),
|
|
81
|
+
end: translatePoint(block.range.end, lineMap, fallbackPoint, warn),
|
|
82
|
+
};
|
|
83
|
+
if (block.kind === "list") {
|
|
84
|
+
const list = block;
|
|
85
|
+
return {
|
|
86
|
+
...list,
|
|
87
|
+
range,
|
|
88
|
+
items: list.items.map((item) => ({
|
|
89
|
+
...item,
|
|
90
|
+
range: {
|
|
91
|
+
start: translatePoint(item.range.start, lineMap, fallbackPoint, warn),
|
|
92
|
+
end: translatePoint(item.range.end, lineMap, fallbackPoint, warn),
|
|
93
|
+
},
|
|
94
|
+
blocks: item.blocks.map((b) => translateBlock(b, lineMap, fallbackPoint, warn)),
|
|
95
|
+
})),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return { ...block, range };
|
|
99
|
+
}
|
package/esm/profile/chain.d.ts
CHANGED
|
@@ -23,6 +23,14 @@ export interface LoadChainResult {
|
|
|
23
23
|
export interface LoadChainOptions {
|
|
24
24
|
readonly runGit?: RunGit;
|
|
25
25
|
readonly appendFile?: AppendFile;
|
|
26
|
+
/**
|
|
27
|
+
* When true, the bundled default profile is spliced as the implicit
|
|
28
|
+
* root of the chain (the ultimate `extends:` parent of any tier that
|
|
29
|
+
* declares none). Default false — only `loadProfileForCommand` enables
|
|
30
|
+
* it, so direct `loadChain` callers (e.g. `profile add` validation)
|
|
31
|
+
* keep core-only behaviour.
|
|
32
|
+
*/
|
|
33
|
+
readonly bundledDefault?: boolean;
|
|
26
34
|
}
|
|
27
35
|
/**
|
|
28
36
|
* Load a profile chain from a specifier, walking the `extends:` pointer up
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/profile/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,UAAU,EAGV,YAAY,EACZ,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/profile/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,UAAU,EAGV,YAAY,EACZ,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAiBzD,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,gBAAgB,EAC3B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,eAAe,CAAC,CA0H1B"}
|
package/esm/profile/chain.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { resolve as resolvePath } from "@std/path";
|
|
15
15
|
import { parseManifest } from "./manifest.js";
|
|
16
16
|
import { mergeChain } from "./merge.js";
|
|
17
|
+
import { BUILTIN_DEFAULT_SOURCE_PATH, BUILTIN_DEFAULT_SPECIFIER, DEFAULT_PROFILE_MANIFEST, } from "./default_profile.js";
|
|
17
18
|
import { resolveGitSpecifier, resolveLocalSpecifier, } from "./resolver.js";
|
|
18
19
|
/** Maximum number of tiers allowed in an `extends:` chain. */
|
|
19
20
|
const MAX_CHAIN_DEPTH = 20;
|
|
@@ -72,6 +73,13 @@ export async function loadChain(specifier, contextDir, projectRoot, readFile, op
|
|
|
72
73
|
readFile,
|
|
73
74
|
});
|
|
74
75
|
}
|
|
76
|
+
else if (cursorSpec.kind === "builtin") {
|
|
77
|
+
resolved = {
|
|
78
|
+
rawYaml: DEFAULT_PROFILE_MANIFEST,
|
|
79
|
+
sourcePath: BUILTIN_DEFAULT_SOURCE_PATH,
|
|
80
|
+
baseDir: BUILTIN_DEFAULT_SOURCE_PATH,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
75
83
|
else {
|
|
76
84
|
resolved = await resolveLocalSpecifier(cursorSpec, cursorDir, readFile, diagnostics);
|
|
77
85
|
}
|
|
@@ -92,11 +100,17 @@ export async function loadChain(specifier, contextDir, projectRoot, readFile, op
|
|
|
92
100
|
baseDir: resolved.baseDir,
|
|
93
101
|
};
|
|
94
102
|
tiersLeafFirst.push(tier);
|
|
95
|
-
// Advance cursor to the parent, if any.
|
|
103
|
+
// Advance cursor to the parent, if any. When the tier declares no
|
|
104
|
+
// explicit parent, splice the bundled default as the implicit root
|
|
105
|
+
// (once — never below the builtin itself).
|
|
96
106
|
if (parsed.manifest.extends !== undefined) {
|
|
97
107
|
cursorSpec = parsed.manifest.extends;
|
|
98
108
|
cursorDir = resolved.baseDir;
|
|
99
109
|
}
|
|
110
|
+
else if (opts.bundledDefault && cursorSpec.kind !== "builtin") {
|
|
111
|
+
cursorSpec = BUILTIN_DEFAULT_SPECIFIER;
|
|
112
|
+
cursorDir = resolved.baseDir;
|
|
113
|
+
}
|
|
100
114
|
else {
|
|
101
115
|
cursorSpec = undefined;
|
|
102
116
|
}
|
|
@@ -146,6 +160,9 @@ function specifierKey(spec, contextDir) {
|
|
|
146
160
|
const pkg = spec.scope ? `${spec.scope}/${spec.name}` : spec.name;
|
|
147
161
|
return `npm:${pkg}@${spec.range}`;
|
|
148
162
|
}
|
|
163
|
+
if (spec.kind === "builtin") {
|
|
164
|
+
return "builtin:@markspec/profile-default";
|
|
165
|
+
}
|
|
149
166
|
const _exhaustive = spec;
|
|
150
167
|
throw new Error(`Unknown specifier kind`);
|
|
151
168
|
}
|
|
@@ -161,6 +178,9 @@ function stringifySpec(spec) {
|
|
|
161
178
|
const pkg = spec.scope ? `${spec.scope}/${spec.name}` : spec.name;
|
|
162
179
|
return `npm:${pkg}@${spec.range}`;
|
|
163
180
|
}
|
|
181
|
+
if (spec.kind === "builtin") {
|
|
182
|
+
return "@markspec/profile-default (bundled)";
|
|
183
|
+
}
|
|
164
184
|
const _exhaustive = spec;
|
|
165
185
|
throw new Error(`Unknown specifier kind`);
|
|
166
186
|
}
|
|
@@ -179,5 +199,13 @@ function buildPlaceholderEffective(tiers) {
|
|
|
179
199
|
colors: new Map(),
|
|
180
200
|
types: new Map(),
|
|
181
201
|
documents: { types: new Map(), frontMatter: new Map() },
|
|
202
|
+
kinds: new Map(),
|
|
203
|
+
prose: {
|
|
204
|
+
lexicons: {
|
|
205
|
+
"capitalized-allow": { value: [], origin: "" },
|
|
206
|
+
"sentence-abbrev": { value: [], origin: "" },
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
disciplineMode: { value: "none", origin: "inferred" },
|
|
182
210
|
};
|
|
183
211
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/default_profile
|
|
3
|
+
*
|
|
4
|
+
* The bundled default profile (profile-schema §7 / §2.2). It ships as an
|
|
5
|
+
* embedded string constant — never a file on disk — so it survives
|
|
6
|
+
* `deno compile` and runs under Node without I/O. It is auto-registered as
|
|
7
|
+
* the implicit root of the `extends:` chain unless `default-profile: false`
|
|
8
|
+
* is set in `.markspec.yaml`.
|
|
9
|
+
*
|
|
10
|
+
* Scope (mechanism only): a minimal identity profile — stable id + the
|
|
11
|
+
* default colour roles, no types, no rules. The profile-schema §7.1
|
|
12
|
+
* display-ID pattern bindings, RFC 2119 hygiene, and `{{def.}}` glossary
|
|
13
|
+
* are deferred (they need a core-type-binding schema construct).
|
|
14
|
+
*/
|
|
15
|
+
import type { ProfileSpecifier } from "../model/mod.js";
|
|
16
|
+
/** Specifier that resolves to the embedded default profile. */
|
|
17
|
+
export declare const BUILTIN_DEFAULT_SPECIFIER: ProfileSpecifier;
|
|
18
|
+
/**
|
|
19
|
+
* Synthetic source path used for the embedded manifest in diagnostics and
|
|
20
|
+
* tier bookkeeping. Not a real filesystem path.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BUILTIN_DEFAULT_SOURCE_PATH = "<bundled:@markspec/profile-default>";
|
|
23
|
+
/** The embedded default-profile manifest, authored as YAML. */
|
|
24
|
+
export declare const DEFAULT_PROFILE_MANIFEST = "id: \"@markspec/profile-default\"\nversion: 1.0.0\nmarkspec-schema: \"1\"\ndescription: Baseline MarkSpec profile\nlicense: MIT\nprofile:\n attributes: []\n labels: []\n colors:\n primary: blue\n secondary: teal\n tertiary: cyan\n accent: purple\n muted: grey\n warning: orange\n danger: red\n types: {}\n documents:\n types: []\n frontMatter: []\n";
|
|
25
|
+
//# sourceMappingURL=default_profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default_profile.d.ts","sourceRoot":"","sources":["../../src/profile/default_profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,EAAE,gBAAsC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,wCACD,CAAC;AAExC,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,iYAoBpC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/default_profile
|
|
3
|
+
*
|
|
4
|
+
* The bundled default profile (profile-schema §7 / §2.2). It ships as an
|
|
5
|
+
* embedded string constant — never a file on disk — so it survives
|
|
6
|
+
* `deno compile` and runs under Node without I/O. It is auto-registered as
|
|
7
|
+
* the implicit root of the `extends:` chain unless `default-profile: false`
|
|
8
|
+
* is set in `.markspec.yaml`.
|
|
9
|
+
*
|
|
10
|
+
* Scope (mechanism only): a minimal identity profile — stable id + the
|
|
11
|
+
* default colour roles, no types, no rules. The profile-schema §7.1
|
|
12
|
+
* display-ID pattern bindings, RFC 2119 hygiene, and `{{def.}}` glossary
|
|
13
|
+
* are deferred (they need a core-type-binding schema construct).
|
|
14
|
+
*/
|
|
15
|
+
/** Specifier that resolves to the embedded default profile. */
|
|
16
|
+
export const BUILTIN_DEFAULT_SPECIFIER = { kind: "builtin" };
|
|
17
|
+
/**
|
|
18
|
+
* Synthetic source path used for the embedded manifest in diagnostics and
|
|
19
|
+
* tier bookkeeping. Not a real filesystem path.
|
|
20
|
+
*/
|
|
21
|
+
export const BUILTIN_DEFAULT_SOURCE_PATH = "<bundled:@markspec/profile-default>";
|
|
22
|
+
/** The embedded default-profile manifest, authored as YAML. */
|
|
23
|
+
export const DEFAULT_PROFILE_MANIFEST = `id: "@markspec/profile-default"
|
|
24
|
+
version: 1.0.0
|
|
25
|
+
markspec-schema: "1"
|
|
26
|
+
description: Baseline MarkSpec profile
|
|
27
|
+
license: MIT
|
|
28
|
+
profile:
|
|
29
|
+
attributes: []
|
|
30
|
+
labels: []
|
|
31
|
+
colors:
|
|
32
|
+
primary: blue
|
|
33
|
+
secondary: teal
|
|
34
|
+
tertiary: cyan
|
|
35
|
+
accent: purple
|
|
36
|
+
muted: grey
|
|
37
|
+
warning: orange
|
|
38
|
+
danger: red
|
|
39
|
+
types: {}
|
|
40
|
+
documents:
|
|
41
|
+
types: []
|
|
42
|
+
frontMatter: []
|
|
43
|
+
`;
|