@driftsys/markspec 0.3.0 → 0.5.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/esm/ast/build.d.ts +70 -0
- package/esm/ast/build.d.ts.map +1 -0
- package/esm/ast/build.js +605 -0
- package/esm/ast/equivalence.d.ts +18 -0
- package/esm/ast/equivalence.d.ts.map +1 -0
- package/esm/ast/equivalence.js +56 -0
- package/esm/ast/nodes.d.ts +221 -0
- package/esm/ast/nodes.d.ts.map +1 -0
- package/esm/ast/nodes.js +12 -0
- package/esm/ast/normalize.d.ts +67 -0
- package/esm/ast/normalize.d.ts.map +1 -0
- package/esm/ast/normalize.js +255 -0
- package/esm/ast/render.d.ts +34 -0
- package/esm/ast/render.d.ts.map +1 -0
- package/esm/ast/render.js +215 -0
- package/esm/compiler/inverses.d.ts +2 -8
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +50 -14
- package/esm/compiler/manifest.d.ts +59 -0
- package/esm/compiler/manifest.d.ts.map +1 -0
- package/esm/compiler/manifest.js +48 -0
- package/esm/compiler/mod.d.ts +9 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +21 -2
- package/esm/compiler/ndjson_writer.d.ts +50 -0
- package/esm/compiler/ndjson_writer.d.ts.map +1 -0
- package/esm/compiler/ndjson_writer.js +73 -0
- package/esm/compiler/schema.d.ts +18 -1
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +18 -9
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +54 -0
- package/esm/formatter/mod.d.ts +56 -6
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +372 -41
- package/esm/formatter/synth_ulid.d.ts +21 -0
- package/esm/formatter/synth_ulid.d.ts.map +1 -0
- package/esm/formatter/synth_ulid.js +64 -0
- package/esm/lint/mod.d.ts +10 -0
- package/esm/lint/mod.d.ts.map +1 -0
- package/esm/lint/mod.js +7 -0
- package/esm/lint/rules/lexicon.d.ts +24 -0
- package/esm/lint/rules/lexicon.d.ts.map +1 -0
- package/esm/lint/rules/lexicon.js +236 -0
- package/esm/lint/rules/struct.d.ts +17 -0
- package/esm/lint/rules/struct.d.ts.map +1 -0
- package/esm/lint/rules/struct.js +55 -0
- package/esm/lint/rules/suppression.d.ts +19 -0
- package/esm/lint/rules/suppression.d.ts.map +1 -0
- package/esm/lint/rules/suppression.js +75 -0
- package/esm/lint/runner.d.ts +39 -0
- package/esm/lint/runner.d.ts.map +1 -0
- package/esm/lint/runner.js +112 -0
- package/esm/lint/types.d.ts +19 -0
- package/esm/lint/types.d.ts.map +1 -0
- package/esm/lint/types.js +9 -0
- package/esm/mod.d.ts +21 -8
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +16 -5
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +163 -2
- package/esm/model/discriminating_attr.d.ts +33 -0
- package/esm/model/discriminating_attr.d.ts.map +1 -0
- package/esm/model/discriminating_attr.js +74 -0
- package/esm/model/mod.d.ts +100 -3
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +58 -2
- package/esm/model/palette.d.ts +18 -0
- package/esm/model/palette.d.ts.map +1 -0
- package/esm/model/palette.js +23 -0
- package/esm/model/profile.d.ts +33 -27
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/model/source_introspection.d.ts +26 -0
- package/esm/model/source_introspection.d.ts.map +1 -0
- package/esm/model/source_introspection.js +77 -0
- package/esm/model/type_hierarchy.d.ts +51 -0
- package/esm/model/type_hierarchy.d.ts.map +1 -0
- package/esm/model/type_hierarchy.js +126 -0
- package/esm/model/uri_scheme_map.d.ts +21 -0
- package/esm/model/uri_scheme_map.d.ts.map +1 -0
- package/esm/model/uri_scheme_map.js +66 -0
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +9 -6
- package/esm/parser/entity_refs.d.ts +53 -0
- package/esm/parser/entity_refs.d.ts.map +1 -0
- package/esm/parser/entity_refs.js +151 -0
- package/esm/parser/glossary.d.ts +43 -0
- package/esm/parser/glossary.d.ts.map +1 -0
- package/esm/parser/glossary.js +217 -0
- package/esm/parser/markdown.d.ts +10 -3
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +241 -11
- package/esm/parser/mod.d.ts +1 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +4 -3
- package/esm/parser/source.d.ts +20 -0
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +4 -4
- package/esm/profile/chain.js +3 -13
- package/esm/profile/colors.d.ts +26 -0
- package/esm/profile/colors.d.ts.map +1 -0
- package/esm/profile/colors.js +46 -0
- package/esm/profile/introspect.d.ts +135 -0
- package/esm/profile/introspect.d.ts.map +1 -0
- package/esm/profile/introspect.js +378 -0
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +67 -0
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +278 -104
- package/esm/profile/merge.js +139 -39
- package/esm/profile/mod.d.ts +3 -4
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +6 -2
- package/esm/reporter/mod.js +4 -4
- package/esm/util/fence.d.ts +30 -0
- package/esm/util/fence.d.ts.map +1 -0
- package/esm/util/fence.js +40 -0
- package/esm/validator/attributes.d.ts +3 -3
- package/esm/validator/attributes.d.ts.map +1 -1
- package/esm/validator/attributes.js +1 -18
- package/esm/validator/body_blocks.d.ts +38 -0
- package/esm/validator/body_blocks.d.ts.map +1 -0
- package/esm/validator/body_blocks.js +218 -0
- package/esm/validator/caption_convention.d.ts +29 -0
- package/esm/validator/caption_convention.d.ts.map +1 -0
- package/esm/validator/caption_convention.js +58 -0
- package/esm/validator/captions.d.ts +22 -0
- package/esm/validator/captions.d.ts.map +1 -0
- package/esm/validator/captions.js +137 -0
- package/esm/validator/component_schemes.d.ts +73 -0
- package/esm/validator/component_schemes.d.ts.map +1 -0
- package/esm/validator/component_schemes.js +375 -0
- package/esm/validator/feature_ac.d.ts +28 -0
- package/esm/validator/feature_ac.d.ts.map +1 -0
- package/esm/validator/feature_ac.js +102 -0
- package/esm/validator/listing.d.ts +42 -0
- package/esm/validator/listing.d.ts.map +1 -0
- package/esm/validator/listing.js +295 -0
- package/esm/validator/mod.d.ts +2 -0
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +253 -12
- package/esm/validator/modal_keywords.d.ts +23 -0
- package/esm/validator/modal_keywords.d.ts.map +1 -0
- package/esm/validator/modal_keywords.js +137 -0
- package/esm/validator/per_type_attrs.d.ts +29 -0
- package/esm/validator/per_type_attrs.d.ts.map +1 -0
- package/esm/validator/per_type_attrs.js +75 -0
- package/esm/validator/pipeline.d.ts +7 -2
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +40 -7
- package/esm/validator/trace_types.d.ts +26 -0
- package/esm/validator/trace_types.d.ts.map +1 -0
- package/esm/validator/trace_types.js +232 -0
- package/esm/validator/traceability.d.ts +3 -4
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +5 -10
- package/esm/validator/type_resolution.d.ts +67 -0
- package/esm/validator/type_resolution.d.ts.map +1 -0
- package/esm/validator/type_resolution.js +140 -0
- package/esm/validator/types.d.ts +45 -0
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +128 -16
- package/esm/validator/value_types.d.ts +8 -0
- package/esm/validator/value_types.d.ts.map +1 -1
- package/esm/validator/value_types.js +8 -1
- package/package.json +1 -1
- package/script/ast/build.d.ts +70 -0
- package/script/ast/build.d.ts.map +1 -0
- package/script/ast/build.js +610 -0
- package/script/ast/equivalence.d.ts +18 -0
- package/script/ast/equivalence.d.ts.map +1 -0
- package/script/ast/equivalence.js +59 -0
- package/script/ast/nodes.d.ts +221 -0
- package/script/ast/nodes.d.ts.map +1 -0
- package/script/ast/nodes.js +13 -0
- package/script/ast/normalize.d.ts +67 -0
- package/script/ast/normalize.d.ts.map +1 -0
- package/script/ast/normalize.js +258 -0
- package/script/ast/render.d.ts +34 -0
- package/script/ast/render.d.ts.map +1 -0
- package/script/ast/render.js +218 -0
- package/script/compiler/inverses.d.ts +2 -8
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +50 -14
- package/script/compiler/manifest.d.ts +59 -0
- package/script/compiler/manifest.d.ts.map +1 -0
- package/script/compiler/manifest.js +51 -0
- package/script/compiler/mod.d.ts +9 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +21 -2
- package/script/compiler/ndjson_writer.d.ts +50 -0
- package/script/compiler/ndjson_writer.d.ts.map +1 -0
- package/script/compiler/ndjson_writer.js +78 -0
- package/script/compiler/schema.d.ts +18 -1
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +18 -8
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +54 -0
- package/script/formatter/mod.d.ts +56 -6
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +375 -41
- package/script/formatter/synth_ulid.d.ts +21 -0
- package/script/formatter/synth_ulid.d.ts.map +1 -0
- package/script/formatter/synth_ulid.js +67 -0
- package/script/lint/mod.d.ts +10 -0
- package/script/lint/mod.d.ts.map +1 -0
- package/script/lint/mod.js +12 -0
- package/script/lint/rules/lexicon.d.ts +24 -0
- package/script/lint/rules/lexicon.d.ts.map +1 -0
- package/script/lint/rules/lexicon.js +240 -0
- package/script/lint/rules/struct.d.ts +17 -0
- package/script/lint/rules/struct.d.ts.map +1 -0
- package/script/lint/rules/struct.js +59 -0
- package/script/lint/rules/suppression.d.ts +19 -0
- package/script/lint/rules/suppression.d.ts.map +1 -0
- package/script/lint/rules/suppression.js +80 -0
- package/script/lint/runner.d.ts +39 -0
- package/script/lint/runner.d.ts.map +1 -0
- package/script/lint/runner.js +116 -0
- package/script/lint/types.d.ts +19 -0
- package/script/lint/types.d.ts.map +1 -0
- package/script/lint/types.js +10 -0
- package/script/mod.d.ts +21 -8
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +58 -32
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +163 -2
- package/script/model/discriminating_attr.d.ts +33 -0
- package/script/model/discriminating_attr.d.ts.map +1 -0
- package/script/model/discriminating_attr.js +77 -0
- package/script/model/mod.d.ts +100 -3
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +67 -3
- package/script/model/palette.d.ts +18 -0
- package/script/model/palette.d.ts.map +1 -0
- package/script/model/palette.js +26 -0
- package/script/model/profile.d.ts +33 -27
- package/script/model/profile.d.ts.map +1 -1
- package/script/model/source_introspection.d.ts +26 -0
- package/script/model/source_introspection.d.ts.map +1 -0
- package/script/model/source_introspection.js +80 -0
- package/script/model/type_hierarchy.d.ts +51 -0
- package/script/model/type_hierarchy.d.ts.map +1 -0
- package/script/model/type_hierarchy.js +130 -0
- package/script/model/uri_scheme_map.d.ts +21 -0
- package/script/model/uri_scheme_map.d.ts.map +1 -0
- package/script/model/uri_scheme_map.js +69 -0
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +9 -6
- package/script/parser/entity_refs.d.ts +53 -0
- package/script/parser/entity_refs.d.ts.map +1 -0
- package/script/parser/entity_refs.js +155 -0
- package/script/parser/glossary.d.ts +43 -0
- package/script/parser/glossary.d.ts.map +1 -0
- package/script/parser/glossary.js +221 -0
- package/script/parser/markdown.d.ts +10 -3
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +240 -10
- package/script/parser/mod.d.ts +1 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +8 -4
- package/script/parser/source.d.ts +20 -0
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +4 -1
- package/script/profile/chain.js +3 -13
- package/script/profile/colors.d.ts +26 -0
- package/script/profile/colors.d.ts.map +1 -0
- package/script/profile/colors.js +49 -0
- package/script/profile/introspect.d.ts +135 -0
- package/script/profile/introspect.d.ts.map +1 -0
- package/script/profile/introspect.js +381 -0
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +67 -0
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +280 -106
- package/script/profile/merge.js +139 -39
- package/script/profile/mod.d.ts +3 -4
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +9 -6
- package/script/reporter/mod.js +4 -4
- package/script/util/fence.d.ts +30 -0
- package/script/util/fence.d.ts.map +1 -0
- package/script/util/fence.js +44 -0
- package/script/validator/attributes.d.ts +3 -3
- package/script/validator/attributes.d.ts.map +1 -1
- package/script/validator/attributes.js +1 -18
- package/script/validator/body_blocks.d.ts +38 -0
- package/script/validator/body_blocks.d.ts.map +1 -0
- package/script/validator/body_blocks.js +221 -0
- package/script/validator/caption_convention.d.ts +29 -0
- package/script/validator/caption_convention.d.ts.map +1 -0
- package/script/validator/caption_convention.js +61 -0
- package/script/validator/captions.d.ts +22 -0
- package/script/validator/captions.d.ts.map +1 -0
- package/script/validator/captions.js +140 -0
- package/script/validator/component_schemes.d.ts +73 -0
- package/script/validator/component_schemes.d.ts.map +1 -0
- package/script/validator/component_schemes.js +384 -0
- package/script/validator/feature_ac.d.ts +28 -0
- package/script/validator/feature_ac.d.ts.map +1 -0
- package/script/validator/feature_ac.js +105 -0
- package/script/validator/listing.d.ts +42 -0
- package/script/validator/listing.d.ts.map +1 -0
- package/script/validator/listing.js +298 -0
- package/script/validator/mod.d.ts +2 -0
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +256 -14
- package/script/validator/modal_keywords.d.ts +23 -0
- package/script/validator/modal_keywords.d.ts.map +1 -0
- package/script/validator/modal_keywords.js +140 -0
- package/script/validator/per_type_attrs.d.ts +29 -0
- package/script/validator/per_type_attrs.d.ts.map +1 -0
- package/script/validator/per_type_attrs.js +78 -0
- package/script/validator/pipeline.d.ts +7 -2
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +39 -6
- package/script/validator/trace_types.d.ts +26 -0
- package/script/validator/trace_types.d.ts.map +1 -0
- package/script/validator/trace_types.js +235 -0
- package/script/validator/traceability.d.ts +3 -4
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +5 -10
- package/script/validator/type_resolution.d.ts +67 -0
- package/script/validator/type_resolution.d.ts.map +1 -0
- package/script/validator/type_resolution.js +146 -0
- package/script/validator/types.d.ts +45 -0
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +131 -16
- package/script/validator/value_types.d.ts +8 -0
- package/script/validator/value_types.d.ts.map +1 -1
- package/script/validator/value_types.js +10 -2
package/esm/profile/merge.js
CHANGED
|
@@ -63,22 +63,11 @@ function foldTier(base, tier, diagnostics) {
|
|
|
63
63
|
const origin = tier.id;
|
|
64
64
|
const m = tier.manifest;
|
|
65
65
|
// Universal additive.
|
|
66
|
-
const
|
|
67
|
-
const
|
|
66
|
+
const labels = unionLabelMap(base.labels, m.labels, origin, diagnostics);
|
|
67
|
+
const conventions = unionConventionsMap(base.conventions, m.conventions, origin);
|
|
68
68
|
const attributes = unionAttrMap(base.attributes, m.universalAttributes, origin, diagnostics);
|
|
69
69
|
// Colors map: last-write-wins per key, additive across tiers.
|
|
70
70
|
const colors = unionColorsMap(base.colors, m.colors, origin);
|
|
71
|
-
// Shape scopes — same additive pattern.
|
|
72
|
-
const identified = {
|
|
73
|
-
required: unionList(base.identified.required, m.identified.required, origin),
|
|
74
|
-
attributes: unionAttrMap(base.identified.attributes, m.identified.attributes, origin, diagnostics),
|
|
75
|
-
traceability: unionTraceMap(base.identified.traceability, m.identified.traceability, origin, diagnostics),
|
|
76
|
-
};
|
|
77
|
-
const referenced = {
|
|
78
|
-
required: unionList(base.referenced.required, m.referenced.required, origin),
|
|
79
|
-
attributes: unionAttrMap(base.referenced.attributes, m.referenced.attributes, origin, diagnostics),
|
|
80
|
-
traceability: base.referenced.traceability, // always empty
|
|
81
|
-
};
|
|
82
71
|
// Types — add new types, fold existing ones.
|
|
83
72
|
const types = new Map(base.types);
|
|
84
73
|
for (const [name, td] of m.types) {
|
|
@@ -87,7 +76,7 @@ function foldTier(base, tier, diagnostics) {
|
|
|
87
76
|
// Fresh type contributed by this tier.
|
|
88
77
|
const eff = {
|
|
89
78
|
name,
|
|
90
|
-
|
|
79
|
+
extends: td.extends,
|
|
91
80
|
displayIdPattern: { value: td.displayIdPattern, origin },
|
|
92
81
|
displayIdPatternEnforcement: {
|
|
93
82
|
value: td.displayIdPatternEnforcement,
|
|
@@ -97,6 +86,9 @@ function foldTier(base, tier, diagnostics) {
|
|
|
97
86
|
required: { value: td.required, origin },
|
|
98
87
|
attributes: mapFromAttrList(td.attributes, origin),
|
|
99
88
|
traceability: mapFromTrace(td.traceability, origin),
|
|
89
|
+
description: { value: td.description, origin },
|
|
90
|
+
attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
|
|
91
|
+
relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
|
|
100
92
|
};
|
|
101
93
|
types.set(name, { value: eff, origin });
|
|
102
94
|
}
|
|
@@ -118,12 +110,10 @@ function foldTier(base, tier, diagnostics) {
|
|
|
118
110
|
}
|
|
119
111
|
const frontMatter = unionAttrMap(base.documents.frontMatter, m.documents.frontMatter, origin, diagnostics);
|
|
120
112
|
const result = {
|
|
121
|
-
required,
|
|
122
113
|
attributes,
|
|
123
114
|
labels,
|
|
115
|
+
conventions,
|
|
124
116
|
colors,
|
|
125
|
-
identified,
|
|
126
|
-
referenced,
|
|
127
117
|
types,
|
|
128
118
|
documents: {
|
|
129
119
|
types: docTypes,
|
|
@@ -229,7 +219,7 @@ function tightenAttr(existing, child, childOrigin, diagnostics) {
|
|
|
229
219
|
const parent = existing.value;
|
|
230
220
|
// Value-type must match exactly.
|
|
231
221
|
if (parent.type !== child.type) {
|
|
232
|
-
diagnostics.push(mergeRelaxation(`attribute '${parent.name}'`, "type", `${parent.type} (${existing.origin})`, `${child.type} (${childOrigin})
|
|
222
|
+
diagnostics.push(mergeRelaxation(`attribute '${parent.name}'`, "type", `${parent.type} (${existing.origin})`, `${child.type} (${childOrigin})`, "PROFILE-MERGE-011"));
|
|
233
223
|
return undefined;
|
|
234
224
|
}
|
|
235
225
|
// Cardinality: child lower ≥ parent lower AND child upper ≤ parent upper.
|
|
@@ -265,6 +255,9 @@ function tightenAttr(existing, child, childOrigin, diagnostics) {
|
|
|
265
255
|
cardinality: child.cardinality,
|
|
266
256
|
values: parent.type === "enum" ? child.values : parent.values,
|
|
267
257
|
inverse: child.inverse ?? parent.inverse,
|
|
258
|
+
description: child.description !== undefined
|
|
259
|
+
? child.description
|
|
260
|
+
: parent.description,
|
|
268
261
|
};
|
|
269
262
|
const overrides = [
|
|
270
263
|
...(existing.overrides ?? []),
|
|
@@ -281,9 +274,9 @@ const ENFORCEMENT_ORDER = { off: 0, warn: 1, error: 2 };
|
|
|
281
274
|
function tightenType(existing, child, childOrigin, diagnostics) {
|
|
282
275
|
const name = child.name;
|
|
283
276
|
const effExisting = existing.value;
|
|
284
|
-
//
|
|
285
|
-
if (effExisting.
|
|
286
|
-
diagnostics.push(mergeRelaxation(`type '${name}'`, "
|
|
277
|
+
// extends: must match — conflicting core-type targets is a merge error.
|
|
278
|
+
if (effExisting.extends !== child.extends) {
|
|
279
|
+
diagnostics.push(mergeRelaxation(`type '${name}'`, "extends", `${effExisting.extends} (${existing.origin})`, `${child.extends} (${childOrigin})`, "PROFILE-MERGE-012"));
|
|
287
280
|
return undefined;
|
|
288
281
|
}
|
|
289
282
|
// Display-ID pattern: if parent set one, child cannot change it. If parent
|
|
@@ -323,15 +316,27 @@ function tightenType(existing, child, childOrigin, diagnostics) {
|
|
|
323
316
|
const color = child.color !== undefined
|
|
324
317
|
? { value: child.color, origin: childOrigin }
|
|
325
318
|
: effExisting.color;
|
|
319
|
+
// Description: child wins when set; else inherit parent provenance unchanged.
|
|
320
|
+
const description = child.description !== undefined
|
|
321
|
+
? { value: child.description, origin: childOrigin }
|
|
322
|
+
: effExisting.description;
|
|
323
|
+
const attrDescriptions = mergeDescriptionMap(effExisting.attrDescriptions, child.attributes.map((a) => ({ name: a.name, desc: a.description })), childOrigin);
|
|
324
|
+
const relationDescriptions = mergeDescriptionMap(effExisting.relationDescriptions, [...child.traceability.entries()].map(([name, r]) => ({
|
|
325
|
+
name,
|
|
326
|
+
desc: r.description,
|
|
327
|
+
})), childOrigin);
|
|
326
328
|
const merged = {
|
|
327
329
|
name,
|
|
328
|
-
|
|
330
|
+
extends: effExisting.extends,
|
|
329
331
|
displayIdPattern,
|
|
330
332
|
displayIdPatternEnforcement: enforcement,
|
|
331
333
|
color,
|
|
332
334
|
required,
|
|
333
335
|
attributes,
|
|
334
336
|
traceability,
|
|
337
|
+
description,
|
|
338
|
+
attrDescriptions,
|
|
339
|
+
relationDescriptions,
|
|
335
340
|
};
|
|
336
341
|
const overrides = [
|
|
337
342
|
...(existing.overrides ?? []),
|
|
@@ -339,9 +344,9 @@ function tightenType(existing, child, childOrigin, diagnostics) {
|
|
|
339
344
|
];
|
|
340
345
|
return { value: merged, origin: childOrigin, overrides };
|
|
341
346
|
}
|
|
342
|
-
function mergeRelaxation(subject, field, parentView, childView) {
|
|
347
|
+
function mergeRelaxation(subject, field, parentView, childView, code = "PROFILE-MERGE-010") {
|
|
343
348
|
return {
|
|
344
|
-
code
|
|
349
|
+
code,
|
|
345
350
|
severity: "error",
|
|
346
351
|
message: `${subject}: field '${field}' relaxed by child (parent: ${parentView}, child: ${childView})`,
|
|
347
352
|
location: { file: "<merge>", line: 1, column: 1 },
|
|
@@ -444,16 +449,10 @@ function seedFromTier(tier) {
|
|
|
444
449
|
const origin = tier.id;
|
|
445
450
|
const m = tier.manifest;
|
|
446
451
|
return {
|
|
447
|
-
required: { value: m.universalRequired, origin },
|
|
448
452
|
attributes: mapFromAttrList(m.universalAttributes, origin),
|
|
449
|
-
labels:
|
|
453
|
+
labels: mapFromLabelConcerns(m.labels, origin),
|
|
454
|
+
conventions: mapFromConventions(m.conventions, origin),
|
|
450
455
|
colors: mapFromColors(m.colors, origin),
|
|
451
|
-
identified: buildShapeScope(m.identified, origin),
|
|
452
|
-
referenced: {
|
|
453
|
-
required: { value: m.referenced.required, origin },
|
|
454
|
-
attributes: mapFromAttrList(m.referenced.attributes, origin),
|
|
455
|
-
traceability: new Map(),
|
|
456
|
-
},
|
|
457
456
|
types: mapFromTypes(m.types, origin),
|
|
458
457
|
documents: {
|
|
459
458
|
types: mapFromDocTypes(m.documents.types, origin),
|
|
@@ -468,12 +467,76 @@ function mapFromColors(colors, origin) {
|
|
|
468
467
|
}
|
|
469
468
|
return out;
|
|
470
469
|
}
|
|
471
|
-
function
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
470
|
+
function mapFromLabelConcerns(concerns, origin) {
|
|
471
|
+
const out = new Map();
|
|
472
|
+
for (const c of concerns) {
|
|
473
|
+
out.set(c.name, { value: c, origin });
|
|
474
|
+
}
|
|
475
|
+
return out;
|
|
476
|
+
}
|
|
477
|
+
function mapFromConventions(conventions, origin) {
|
|
478
|
+
const out = new Map();
|
|
479
|
+
for (const c of conventions) {
|
|
480
|
+
out.set(c.name, { value: c, origin });
|
|
481
|
+
}
|
|
482
|
+
return out;
|
|
483
|
+
}
|
|
484
|
+
function unionLabelMap(parent, childConcerns, childOrigin, diagnostics) {
|
|
485
|
+
if (childConcerns.length === 0)
|
|
486
|
+
return parent;
|
|
487
|
+
const out = new Map(parent);
|
|
488
|
+
for (const c of childConcerns) {
|
|
489
|
+
const existing = out.get(c.name);
|
|
490
|
+
if (!existing) {
|
|
491
|
+
out.set(c.name, { value: c, origin: childOrigin });
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
if (existing.value.kind !== c.kind) {
|
|
495
|
+
diagnostics.push({
|
|
496
|
+
code: "PROFILE-LOAD-003",
|
|
497
|
+
severity: "error",
|
|
498
|
+
message: `label concern '${c.name}': kind '${c.kind}' (${childOrigin}) conflicts with '${existing.value.kind}' (${existing.origin})`,
|
|
499
|
+
location: { file: "<merge>", line: 1, column: 1 },
|
|
500
|
+
});
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
// Union values; child description wins when set.
|
|
504
|
+
const parentValueNames = new Set(existing.value.values.map((v) => v.name));
|
|
505
|
+
const mergedValues = [
|
|
506
|
+
...existing.value.values,
|
|
507
|
+
...c.values.filter((v) => !parentValueNames.has(v.name)),
|
|
508
|
+
];
|
|
509
|
+
const merged = {
|
|
510
|
+
name: c.name,
|
|
511
|
+
kind: c.kind,
|
|
512
|
+
description: c.description !== undefined
|
|
513
|
+
? c.description
|
|
514
|
+
: existing.value.description,
|
|
515
|
+
values: mergedValues,
|
|
516
|
+
};
|
|
517
|
+
out.set(c.name, {
|
|
518
|
+
value: merged,
|
|
519
|
+
origin: childOrigin,
|
|
520
|
+
overrides: [...(existing.overrides ?? []), existing.origin],
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
return out;
|
|
524
|
+
}
|
|
525
|
+
function unionConventionsMap(parent, childConventions, childOrigin) {
|
|
526
|
+
if (childConventions.length === 0)
|
|
527
|
+
return parent;
|
|
528
|
+
const out = new Map(parent);
|
|
529
|
+
for (const c of childConventions) {
|
|
530
|
+
const existing = out.get(c.name);
|
|
531
|
+
out.set(c.name, {
|
|
532
|
+
value: c,
|
|
533
|
+
origin: childOrigin,
|
|
534
|
+
overrides: existing
|
|
535
|
+
? [...(existing.overrides ?? []), existing.origin]
|
|
536
|
+
: undefined,
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
return out;
|
|
477
540
|
}
|
|
478
541
|
function mapFromAttrList(attrs, origin) {
|
|
479
542
|
const out = new Map();
|
|
@@ -489,12 +552,46 @@ function mapFromTrace(trace, origin) {
|
|
|
489
552
|
}
|
|
490
553
|
return out;
|
|
491
554
|
}
|
|
555
|
+
function mapFromAttrDescriptions(attrs, origin) {
|
|
556
|
+
const out = new Map();
|
|
557
|
+
for (const a of attrs) {
|
|
558
|
+
if (a.description !== undefined) {
|
|
559
|
+
out.set(a.name, { value: a.description, origin });
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return out;
|
|
563
|
+
}
|
|
564
|
+
function mapFromTraceDescriptions(trace, origin) {
|
|
565
|
+
const out = new Map();
|
|
566
|
+
for (const [name, rule] of trace) {
|
|
567
|
+
if (rule.description !== undefined) {
|
|
568
|
+
out.set(name, { value: rule.description, origin });
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return out;
|
|
572
|
+
}
|
|
573
|
+
function mergeDescriptionMap(parent, childItems, childOrigin) {
|
|
574
|
+
const out = new Map(parent);
|
|
575
|
+
for (const { name, desc } of childItems) {
|
|
576
|
+
if (desc !== undefined) {
|
|
577
|
+
const existing = out.get(name);
|
|
578
|
+
out.set(name, {
|
|
579
|
+
value: desc,
|
|
580
|
+
origin: childOrigin,
|
|
581
|
+
overrides: existing
|
|
582
|
+
? [...(existing.overrides ?? []), existing.origin]
|
|
583
|
+
: undefined,
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return out;
|
|
588
|
+
}
|
|
492
589
|
function mapFromTypes(types, origin) {
|
|
493
590
|
const out = new Map();
|
|
494
591
|
for (const [name, td] of types) {
|
|
495
592
|
const eff = {
|
|
496
593
|
name,
|
|
497
|
-
|
|
594
|
+
extends: td.extends,
|
|
498
595
|
displayIdPattern: { value: td.displayIdPattern, origin },
|
|
499
596
|
displayIdPatternEnforcement: {
|
|
500
597
|
value: td.displayIdPatternEnforcement,
|
|
@@ -504,6 +601,9 @@ function mapFromTypes(types, origin) {
|
|
|
504
601
|
required: { value: td.required, origin },
|
|
505
602
|
attributes: mapFromAttrList(td.attributes, origin),
|
|
506
603
|
traceability: mapFromTrace(td.traceability, origin),
|
|
604
|
+
description: { value: td.description, origin },
|
|
605
|
+
attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
|
|
606
|
+
relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
|
|
507
607
|
};
|
|
508
608
|
out.set(name, { value: eff, origin });
|
|
509
609
|
}
|
package/esm/profile/mod.d.ts
CHANGED
|
@@ -16,8 +16,7 @@ export { loadProfileForCommand } from "./load.js";
|
|
|
16
16
|
export type { LoadProfileForCommandResult } from "./load.js";
|
|
17
17
|
export { mergeChain } from "./merge.js";
|
|
18
18
|
export type { MergeResult } from "./merge.js";
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
21
|
-
export {
|
|
22
|
-
export type { ResolveNpmOptions, RunNpm } from "./npm.js";
|
|
19
|
+
export { resolveEntryColor } from "./colors.js";
|
|
20
|
+
export { buildProfileIntrospection } from "./introspect.js";
|
|
21
|
+
export type { AttributeDetail, ConventionDetail, LabelConcernDetail, ProfileElementDetail, ProfileElementKind, ProfileElementRef, ProfileIntrospection, ProfileOverview, ProvenancedDescription, RelationDetail, TypeDetail, } from "./introspect.js";
|
|
23
22
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/profile/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
|
package/esm/profile/mod.js
CHANGED
|
@@ -10,5 +10,9 @@ export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit
|
|
|
10
10
|
export { loadChain } from "./chain.js";
|
|
11
11
|
export { loadProfileForCommand } from "./load.js";
|
|
12
12
|
export { mergeChain } from "./merge.js";
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// cacheDir, CacheEnv, defaultRunNpm, resolveNpmSpecifier, ResolveNpmOptions,
|
|
14
|
+
// and RunNpm are internal implementation details of the NPM resolver — they
|
|
15
|
+
// are not part of the public profile API and are not re-exported from
|
|
16
|
+
// core/mod.ts. Consumers use loadChain / loadProfileForCommand instead.
|
|
17
|
+
export { resolveEntryColor } from "./colors.js";
|
|
18
|
+
export { buildProfileIntrospection } from "./introspect.js";
|
package/esm/reporter/mod.js
CHANGED
|
@@ -27,8 +27,8 @@ function filterEntries(result, scope, label) {
|
|
|
27
27
|
if (scope) {
|
|
28
28
|
const scopeUpper = scope.toUpperCase();
|
|
29
29
|
entries = entries.filter((e) => {
|
|
30
|
-
const parts = e.displayId.split(
|
|
31
|
-
return parts.
|
|
30
|
+
const parts = e.displayId.split(/[_-]/);
|
|
31
|
+
return parts.some((p) => p === scopeUpper);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
if (label) {
|
|
@@ -91,7 +91,7 @@ function computeCoverage(result, entries) {
|
|
|
91
91
|
let withoutSatisfies = 0;
|
|
92
92
|
for (const entry of entries) {
|
|
93
93
|
// Bucket by profile-declared type when available, fall back to shape.
|
|
94
|
-
const t = entry.type ?? (entry.shape === "
|
|
94
|
+
const t = entry.type ?? (entry.shape === "Reference" ? "ref" : "untyped");
|
|
95
95
|
byType[t] = (byType[t] ?? 0) + 1;
|
|
96
96
|
const fwd = result.forward.get(entry.displayId) ?? [];
|
|
97
97
|
const rev = result.reverse.get(entry.displayId) ?? [];
|
|
@@ -99,7 +99,7 @@ function computeCoverage(result, entries) {
|
|
|
99
99
|
if (hasSatisfies) {
|
|
100
100
|
withSatisfies++;
|
|
101
101
|
}
|
|
102
|
-
else if (entry.shape === "
|
|
102
|
+
else if (entry.shape === "Authored") {
|
|
103
103
|
withoutSatisfies++;
|
|
104
104
|
orphans.push(entry.displayId);
|
|
105
105
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/fence
|
|
3
|
+
*
|
|
4
|
+
* Prose-line walker that skips lines inside fenced code blocks.
|
|
5
|
+
* Several validator and formatter passes (body-block exclusions,
|
|
6
|
+
* caption adjacency, `$Identifier` extraction, modal-keyword
|
|
7
|
+
* normalisation) all needed to walk an entry body line-by-line while
|
|
8
|
+
* treating fenced code as verbatim. This helper centralises that
|
|
9
|
+
* pattern so the fence-toggle semantics stay consistent.
|
|
10
|
+
*
|
|
11
|
+
* Fence detection follows CommonMark §4.5 — a line whose first
|
|
12
|
+
* non-whitespace content is three or more backticks or tildes opens
|
|
13
|
+
* (or closes) a fenced block. The language tag that may follow the
|
|
14
|
+
* opening fence does not affect detection: we toggle on every fence
|
|
15
|
+
* marker regardless. (Mismatched marker types — ``` opener / ~~~
|
|
16
|
+
* closer — are accepted by the walker because real Markdown parsers
|
|
17
|
+
* already reject those upstream.)
|
|
18
|
+
*/
|
|
19
|
+
/** Three or more backticks or tildes at the start of a line. */
|
|
20
|
+
export declare const FENCE_RE: RegExp;
|
|
21
|
+
/** Callback for {@linkcode walkProseLines}. Receives one line + its 0-based index. */
|
|
22
|
+
export type ProseLineCallback = (line: string, index: number) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Walk `body` line by line, invoking `cb` for every line that's NOT
|
|
25
|
+
* inside a fenced code block. The first fence marker opens the block;
|
|
26
|
+
* the next closes it. The fence-marker lines themselves are also
|
|
27
|
+
* skipped (they're structural, not prose).
|
|
28
|
+
*/
|
|
29
|
+
export declare function walkProseLines(body: string, cb: ProseLineCallback): void;
|
|
30
|
+
//# sourceMappingURL=fence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../src/util/fence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,gEAAgE;AAChE,eAAO,MAAM,QAAQ,QAAkB,CAAC;AAExC,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEtE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,iBAAiB,GAAG,IAAI,CAYxE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/fence
|
|
3
|
+
*
|
|
4
|
+
* Prose-line walker that skips lines inside fenced code blocks.
|
|
5
|
+
* Several validator and formatter passes (body-block exclusions,
|
|
6
|
+
* caption adjacency, `$Identifier` extraction, modal-keyword
|
|
7
|
+
* normalisation) all needed to walk an entry body line-by-line while
|
|
8
|
+
* treating fenced code as verbatim. This helper centralises that
|
|
9
|
+
* pattern so the fence-toggle semantics stay consistent.
|
|
10
|
+
*
|
|
11
|
+
* Fence detection follows CommonMark §4.5 — a line whose first
|
|
12
|
+
* non-whitespace content is three or more backticks or tildes opens
|
|
13
|
+
* (or closes) a fenced block. The language tag that may follow the
|
|
14
|
+
* opening fence does not affect detection: we toggle on every fence
|
|
15
|
+
* marker regardless. (Mismatched marker types — ``` opener / ~~~
|
|
16
|
+
* closer — are accepted by the walker because real Markdown parsers
|
|
17
|
+
* already reject those upstream.)
|
|
18
|
+
*/
|
|
19
|
+
/** Three or more backticks or tildes at the start of a line. */
|
|
20
|
+
export const FENCE_RE = /^\s*(```|~~~)/;
|
|
21
|
+
/**
|
|
22
|
+
* Walk `body` line by line, invoking `cb` for every line that's NOT
|
|
23
|
+
* inside a fenced code block. The first fence marker opens the block;
|
|
24
|
+
* the next closes it. The fence-marker lines themselves are also
|
|
25
|
+
* skipped (they're structural, not prose).
|
|
26
|
+
*/
|
|
27
|
+
export function walkProseLines(body, cb) {
|
|
28
|
+
const lines = body.split("\n");
|
|
29
|
+
let inFence = false;
|
|
30
|
+
for (let i = 0; i < lines.length; i++) {
|
|
31
|
+
const line = lines[i];
|
|
32
|
+
if (FENCE_RE.test(line)) {
|
|
33
|
+
inFence = !inFence;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (inFence)
|
|
37
|
+
continue;
|
|
38
|
+
cb(line, i);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
import type { AttrDecl, Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
14
14
|
/**
|
|
15
15
|
* Effective attribute declarations and required list for an entry, derived
|
|
16
|
-
* from the profile's universal
|
|
16
|
+
* from the profile's universal and (when classified) type scopes.
|
|
17
17
|
*
|
|
18
18
|
* Scope layering (outer → inner):
|
|
19
|
-
* universal →
|
|
19
|
+
* universal → types.<T>
|
|
20
20
|
*
|
|
21
21
|
* Name collisions: inner scope wins. Required lists are concatenated in
|
|
22
22
|
* scope order (universal first, type last) preserving duplicates across
|
|
@@ -28,7 +28,7 @@ export interface EffectiveAttrScope {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Compute the effective attribute scope for a given entry against the
|
|
31
|
-
* profile. Uses universal
|
|
31
|
+
* profile. Uses universal scope always; adds type scope only when
|
|
32
32
|
* `entry.type` is set and the type is declared in the profile.
|
|
33
33
|
*/
|
|
34
34
|
export declare function effectiveScope(entry: Entry, profile: EffectiveProfile): EffectiveAttrScope;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/validator/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAWzB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/validator/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAWzB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,kBAAkB,CAoCpB;AAqBD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,UAAU,EAAE,CA4Ed"}
|
|
@@ -20,25 +20,16 @@ const CORE_RESERVED_KEYS = new Set([
|
|
|
20
20
|
]);
|
|
21
21
|
/**
|
|
22
22
|
* Compute the effective attribute scope for a given entry against the
|
|
23
|
-
* profile. Uses universal
|
|
23
|
+
* profile. Uses universal scope always; adds type scope only when
|
|
24
24
|
* `entry.type` is set and the type is declared in the profile.
|
|
25
25
|
*/
|
|
26
26
|
export function effectiveScope(entry, profile) {
|
|
27
27
|
const required = [];
|
|
28
28
|
const attributes = new Map();
|
|
29
29
|
// Universal scope.
|
|
30
|
-
required.push(...profile.required.value);
|
|
31
30
|
for (const [name, attrEntry] of profile.attributes) {
|
|
32
31
|
attributes.set(name, attrEntry.value);
|
|
33
32
|
}
|
|
34
|
-
// Shape scope.
|
|
35
|
-
const shapeScope = entry.shape === "identified"
|
|
36
|
-
? profile.identified
|
|
37
|
-
: profile.referenced;
|
|
38
|
-
required.push(...shapeScope.required.value);
|
|
39
|
-
for (const [name, e] of shapeScope.attributes) {
|
|
40
|
-
attributes.set(name, e.value);
|
|
41
|
-
}
|
|
42
33
|
// Type scope (only when classified).
|
|
43
34
|
if (entry.type !== undefined) {
|
|
44
35
|
const typeEntry = profile.types.get(entry.type);
|
|
@@ -53,14 +44,6 @@ export function effectiveScope(entry, profile) {
|
|
|
53
44
|
// names that aren't explicitly declared as attributes. A trace rule IS an
|
|
54
45
|
// id-list attribute by definition — profile authors shouldn't have to
|
|
55
46
|
// declare it in both places.
|
|
56
|
-
const shapeTrace = entry.shape === "identified"
|
|
57
|
-
? profile.identified.traceability
|
|
58
|
-
: profile.referenced.traceability;
|
|
59
|
-
for (const [name] of shapeTrace) {
|
|
60
|
-
if (!attributes.has(name)) {
|
|
61
|
-
attributes.set(name, synthesizedLinkAttr(name));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
47
|
if (entry.type !== undefined) {
|
|
65
48
|
const typeEntry = profile.types.get(entry.type);
|
|
66
49
|
if (typeEntry !== undefined) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/body_blocks
|
|
3
|
+
*
|
|
4
|
+
* Body-block exclusion validator (spec §2.4.1). Detects constructs
|
|
5
|
+
* forbidden inside entry bodies:
|
|
6
|
+
*
|
|
7
|
+
* - MSL-B040 — headings
|
|
8
|
+
* - MSL-B041 — horizontal rules
|
|
9
|
+
* - MSL-B042 — task lists
|
|
10
|
+
* - MSL-B043 — raw HTML other than `<!-- markspec:* -->` directive
|
|
11
|
+
* comments
|
|
12
|
+
*
|
|
13
|
+
* Each excluded construct maps to a distinct AST node kind or property:
|
|
14
|
+
*
|
|
15
|
+
* - Headings → `UnknownNode` with `subkind: "heading"`
|
|
16
|
+
* - HR → `UnknownNode` with `subkind: "thematic-break"`
|
|
17
|
+
* - Task list → `ListNode` with `hasTaskItems: true`
|
|
18
|
+
* - Block HTML → `UnknownNode` with `subkind: "html"` (raw checked for
|
|
19
|
+
* the markspec-directive carve-out)
|
|
20
|
+
* - Inline HTML — remains inside `ParagraphNode.content.text` (remark
|
|
21
|
+
* does not extract inline HTML nodes into block-level nodes); each
|
|
22
|
+
* paragraph's text is scanned line-by-line using the same regex
|
|
23
|
+
* approach as the old walkProseLines path, but bounded to prose-only
|
|
24
|
+
* nodes (code/feature/math blocks are automatically excluded because
|
|
25
|
+
* the builder does not emit prose-bearing nodes for verbatim content).
|
|
26
|
+
*
|
|
27
|
+
* Code, Feature, and Math blocks are automatically excluded because the
|
|
28
|
+
* builder emits opaque nodes for verbatim content — no prose text to scan.
|
|
29
|
+
*/
|
|
30
|
+
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
31
|
+
/**
|
|
32
|
+
* Validate that an entry's body contains none of the excluded body
|
|
33
|
+
* constructs. Emits at most one diagnostic per excluded construct per
|
|
34
|
+
* line (so a paragraph with `<div>foo</div><span>bar</span>` still
|
|
35
|
+
* fires MSL-B043 once for that line).
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateBodyBlocks(entry: Entry): readonly Diagnostic[];
|
|
38
|
+
//# sourceMappingURL=body_blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body_blocks.d.ts","sourceRoot":"","sources":["../../src/validator/body_blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAkMzD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAsBtE"}
|