@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/script/profile/merge.js
CHANGED
|
@@ -66,22 +66,11 @@ function foldTier(base, tier, diagnostics) {
|
|
|
66
66
|
const origin = tier.id;
|
|
67
67
|
const m = tier.manifest;
|
|
68
68
|
// Universal additive.
|
|
69
|
-
const
|
|
70
|
-
const
|
|
69
|
+
const labels = unionLabelMap(base.labels, m.labels, origin, diagnostics);
|
|
70
|
+
const conventions = unionConventionsMap(base.conventions, m.conventions, origin);
|
|
71
71
|
const attributes = unionAttrMap(base.attributes, m.universalAttributes, origin, diagnostics);
|
|
72
72
|
// Colors map: last-write-wins per key, additive across tiers.
|
|
73
73
|
const colors = unionColorsMap(base.colors, m.colors, origin);
|
|
74
|
-
// Shape scopes — same additive pattern.
|
|
75
|
-
const identified = {
|
|
76
|
-
required: unionList(base.identified.required, m.identified.required, origin),
|
|
77
|
-
attributes: unionAttrMap(base.identified.attributes, m.identified.attributes, origin, diagnostics),
|
|
78
|
-
traceability: unionTraceMap(base.identified.traceability, m.identified.traceability, origin, diagnostics),
|
|
79
|
-
};
|
|
80
|
-
const referenced = {
|
|
81
|
-
required: unionList(base.referenced.required, m.referenced.required, origin),
|
|
82
|
-
attributes: unionAttrMap(base.referenced.attributes, m.referenced.attributes, origin, diagnostics),
|
|
83
|
-
traceability: base.referenced.traceability, // always empty
|
|
84
|
-
};
|
|
85
74
|
// Types — add new types, fold existing ones.
|
|
86
75
|
const types = new Map(base.types);
|
|
87
76
|
for (const [name, td] of m.types) {
|
|
@@ -90,7 +79,7 @@ function foldTier(base, tier, diagnostics) {
|
|
|
90
79
|
// Fresh type contributed by this tier.
|
|
91
80
|
const eff = {
|
|
92
81
|
name,
|
|
93
|
-
|
|
82
|
+
extends: td.extends,
|
|
94
83
|
displayIdPattern: { value: td.displayIdPattern, origin },
|
|
95
84
|
displayIdPatternEnforcement: {
|
|
96
85
|
value: td.displayIdPatternEnforcement,
|
|
@@ -100,6 +89,9 @@ function foldTier(base, tier, diagnostics) {
|
|
|
100
89
|
required: { value: td.required, origin },
|
|
101
90
|
attributes: mapFromAttrList(td.attributes, origin),
|
|
102
91
|
traceability: mapFromTrace(td.traceability, origin),
|
|
92
|
+
description: { value: td.description, origin },
|
|
93
|
+
attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
|
|
94
|
+
relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
|
|
103
95
|
};
|
|
104
96
|
types.set(name, { value: eff, origin });
|
|
105
97
|
}
|
|
@@ -121,12 +113,10 @@ function foldTier(base, tier, diagnostics) {
|
|
|
121
113
|
}
|
|
122
114
|
const frontMatter = unionAttrMap(base.documents.frontMatter, m.documents.frontMatter, origin, diagnostics);
|
|
123
115
|
const result = {
|
|
124
|
-
required,
|
|
125
116
|
attributes,
|
|
126
117
|
labels,
|
|
118
|
+
conventions,
|
|
127
119
|
colors,
|
|
128
|
-
identified,
|
|
129
|
-
referenced,
|
|
130
120
|
types,
|
|
131
121
|
documents: {
|
|
132
122
|
types: docTypes,
|
|
@@ -232,7 +222,7 @@ function tightenAttr(existing, child, childOrigin, diagnostics) {
|
|
|
232
222
|
const parent = existing.value;
|
|
233
223
|
// Value-type must match exactly.
|
|
234
224
|
if (parent.type !== child.type) {
|
|
235
|
-
diagnostics.push(mergeRelaxation(`attribute '${parent.name}'`, "type", `${parent.type} (${existing.origin})`, `${child.type} (${childOrigin})
|
|
225
|
+
diagnostics.push(mergeRelaxation(`attribute '${parent.name}'`, "type", `${parent.type} (${existing.origin})`, `${child.type} (${childOrigin})`, "PROFILE-MERGE-011"));
|
|
236
226
|
return undefined;
|
|
237
227
|
}
|
|
238
228
|
// Cardinality: child lower ≥ parent lower AND child upper ≤ parent upper.
|
|
@@ -268,6 +258,9 @@ function tightenAttr(existing, child, childOrigin, diagnostics) {
|
|
|
268
258
|
cardinality: child.cardinality,
|
|
269
259
|
values: parent.type === "enum" ? child.values : parent.values,
|
|
270
260
|
inverse: child.inverse ?? parent.inverse,
|
|
261
|
+
description: child.description !== undefined
|
|
262
|
+
? child.description
|
|
263
|
+
: parent.description,
|
|
271
264
|
};
|
|
272
265
|
const overrides = [
|
|
273
266
|
...(existing.overrides ?? []),
|
|
@@ -284,9 +277,9 @@ const ENFORCEMENT_ORDER = { off: 0, warn: 1, error: 2 };
|
|
|
284
277
|
function tightenType(existing, child, childOrigin, diagnostics) {
|
|
285
278
|
const name = child.name;
|
|
286
279
|
const effExisting = existing.value;
|
|
287
|
-
//
|
|
288
|
-
if (effExisting.
|
|
289
|
-
diagnostics.push(mergeRelaxation(`type '${name}'`, "
|
|
280
|
+
// extends: must match — conflicting core-type targets is a merge error.
|
|
281
|
+
if (effExisting.extends !== child.extends) {
|
|
282
|
+
diagnostics.push(mergeRelaxation(`type '${name}'`, "extends", `${effExisting.extends} (${existing.origin})`, `${child.extends} (${childOrigin})`, "PROFILE-MERGE-012"));
|
|
290
283
|
return undefined;
|
|
291
284
|
}
|
|
292
285
|
// Display-ID pattern: if parent set one, child cannot change it. If parent
|
|
@@ -326,15 +319,27 @@ function tightenType(existing, child, childOrigin, diagnostics) {
|
|
|
326
319
|
const color = child.color !== undefined
|
|
327
320
|
? { value: child.color, origin: childOrigin }
|
|
328
321
|
: effExisting.color;
|
|
322
|
+
// Description: child wins when set; else inherit parent provenance unchanged.
|
|
323
|
+
const description = child.description !== undefined
|
|
324
|
+
? { value: child.description, origin: childOrigin }
|
|
325
|
+
: effExisting.description;
|
|
326
|
+
const attrDescriptions = mergeDescriptionMap(effExisting.attrDescriptions, child.attributes.map((a) => ({ name: a.name, desc: a.description })), childOrigin);
|
|
327
|
+
const relationDescriptions = mergeDescriptionMap(effExisting.relationDescriptions, [...child.traceability.entries()].map(([name, r]) => ({
|
|
328
|
+
name,
|
|
329
|
+
desc: r.description,
|
|
330
|
+
})), childOrigin);
|
|
329
331
|
const merged = {
|
|
330
332
|
name,
|
|
331
|
-
|
|
333
|
+
extends: effExisting.extends,
|
|
332
334
|
displayIdPattern,
|
|
333
335
|
displayIdPatternEnforcement: enforcement,
|
|
334
336
|
color,
|
|
335
337
|
required,
|
|
336
338
|
attributes,
|
|
337
339
|
traceability,
|
|
340
|
+
description,
|
|
341
|
+
attrDescriptions,
|
|
342
|
+
relationDescriptions,
|
|
338
343
|
};
|
|
339
344
|
const overrides = [
|
|
340
345
|
...(existing.overrides ?? []),
|
|
@@ -342,9 +347,9 @@ function tightenType(existing, child, childOrigin, diagnostics) {
|
|
|
342
347
|
];
|
|
343
348
|
return { value: merged, origin: childOrigin, overrides };
|
|
344
349
|
}
|
|
345
|
-
function mergeRelaxation(subject, field, parentView, childView) {
|
|
350
|
+
function mergeRelaxation(subject, field, parentView, childView, code = "PROFILE-MERGE-010") {
|
|
346
351
|
return {
|
|
347
|
-
code
|
|
352
|
+
code,
|
|
348
353
|
severity: "error",
|
|
349
354
|
message: `${subject}: field '${field}' relaxed by child (parent: ${parentView}, child: ${childView})`,
|
|
350
355
|
location: { file: "<merge>", line: 1, column: 1 },
|
|
@@ -447,16 +452,10 @@ function seedFromTier(tier) {
|
|
|
447
452
|
const origin = tier.id;
|
|
448
453
|
const m = tier.manifest;
|
|
449
454
|
return {
|
|
450
|
-
required: { value: m.universalRequired, origin },
|
|
451
455
|
attributes: mapFromAttrList(m.universalAttributes, origin),
|
|
452
|
-
labels:
|
|
456
|
+
labels: mapFromLabelConcerns(m.labels, origin),
|
|
457
|
+
conventions: mapFromConventions(m.conventions, origin),
|
|
453
458
|
colors: mapFromColors(m.colors, origin),
|
|
454
|
-
identified: buildShapeScope(m.identified, origin),
|
|
455
|
-
referenced: {
|
|
456
|
-
required: { value: m.referenced.required, origin },
|
|
457
|
-
attributes: mapFromAttrList(m.referenced.attributes, origin),
|
|
458
|
-
traceability: new Map(),
|
|
459
|
-
},
|
|
460
459
|
types: mapFromTypes(m.types, origin),
|
|
461
460
|
documents: {
|
|
462
461
|
types: mapFromDocTypes(m.documents.types, origin),
|
|
@@ -471,12 +470,76 @@ function mapFromColors(colors, origin) {
|
|
|
471
470
|
}
|
|
472
471
|
return out;
|
|
473
472
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
473
|
+
function mapFromLabelConcerns(concerns, origin) {
|
|
474
|
+
const out = new Map();
|
|
475
|
+
for (const c of concerns) {
|
|
476
|
+
out.set(c.name, { value: c, origin });
|
|
477
|
+
}
|
|
478
|
+
return out;
|
|
479
|
+
}
|
|
480
|
+
function mapFromConventions(conventions, origin) {
|
|
481
|
+
const out = new Map();
|
|
482
|
+
for (const c of conventions) {
|
|
483
|
+
out.set(c.name, { value: c, origin });
|
|
484
|
+
}
|
|
485
|
+
return out;
|
|
486
|
+
}
|
|
487
|
+
function unionLabelMap(parent, childConcerns, childOrigin, diagnostics) {
|
|
488
|
+
if (childConcerns.length === 0)
|
|
489
|
+
return parent;
|
|
490
|
+
const out = new Map(parent);
|
|
491
|
+
for (const c of childConcerns) {
|
|
492
|
+
const existing = out.get(c.name);
|
|
493
|
+
if (!existing) {
|
|
494
|
+
out.set(c.name, { value: c, origin: childOrigin });
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
if (existing.value.kind !== c.kind) {
|
|
498
|
+
diagnostics.push({
|
|
499
|
+
code: "PROFILE-LOAD-003",
|
|
500
|
+
severity: "error",
|
|
501
|
+
message: `label concern '${c.name}': kind '${c.kind}' (${childOrigin}) conflicts with '${existing.value.kind}' (${existing.origin})`,
|
|
502
|
+
location: { file: "<merge>", line: 1, column: 1 },
|
|
503
|
+
});
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
// Union values; child description wins when set.
|
|
507
|
+
const parentValueNames = new Set(existing.value.values.map((v) => v.name));
|
|
508
|
+
const mergedValues = [
|
|
509
|
+
...existing.value.values,
|
|
510
|
+
...c.values.filter((v) => !parentValueNames.has(v.name)),
|
|
511
|
+
];
|
|
512
|
+
const merged = {
|
|
513
|
+
name: c.name,
|
|
514
|
+
kind: c.kind,
|
|
515
|
+
description: c.description !== undefined
|
|
516
|
+
? c.description
|
|
517
|
+
: existing.value.description,
|
|
518
|
+
values: mergedValues,
|
|
519
|
+
};
|
|
520
|
+
out.set(c.name, {
|
|
521
|
+
value: merged,
|
|
522
|
+
origin: childOrigin,
|
|
523
|
+
overrides: [...(existing.overrides ?? []), existing.origin],
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
return out;
|
|
527
|
+
}
|
|
528
|
+
function unionConventionsMap(parent, childConventions, childOrigin) {
|
|
529
|
+
if (childConventions.length === 0)
|
|
530
|
+
return parent;
|
|
531
|
+
const out = new Map(parent);
|
|
532
|
+
for (const c of childConventions) {
|
|
533
|
+
const existing = out.get(c.name);
|
|
534
|
+
out.set(c.name, {
|
|
535
|
+
value: c,
|
|
536
|
+
origin: childOrigin,
|
|
537
|
+
overrides: existing
|
|
538
|
+
? [...(existing.overrides ?? []), existing.origin]
|
|
539
|
+
: undefined,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
return out;
|
|
480
543
|
}
|
|
481
544
|
function mapFromAttrList(attrs, origin) {
|
|
482
545
|
const out = new Map();
|
|
@@ -492,12 +555,46 @@ function mapFromTrace(trace, origin) {
|
|
|
492
555
|
}
|
|
493
556
|
return out;
|
|
494
557
|
}
|
|
558
|
+
function mapFromAttrDescriptions(attrs, origin) {
|
|
559
|
+
const out = new Map();
|
|
560
|
+
for (const a of attrs) {
|
|
561
|
+
if (a.description !== undefined) {
|
|
562
|
+
out.set(a.name, { value: a.description, origin });
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return out;
|
|
566
|
+
}
|
|
567
|
+
function mapFromTraceDescriptions(trace, origin) {
|
|
568
|
+
const out = new Map();
|
|
569
|
+
for (const [name, rule] of trace) {
|
|
570
|
+
if (rule.description !== undefined) {
|
|
571
|
+
out.set(name, { value: rule.description, origin });
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return out;
|
|
575
|
+
}
|
|
576
|
+
function mergeDescriptionMap(parent, childItems, childOrigin) {
|
|
577
|
+
const out = new Map(parent);
|
|
578
|
+
for (const { name, desc } of childItems) {
|
|
579
|
+
if (desc !== undefined) {
|
|
580
|
+
const existing = out.get(name);
|
|
581
|
+
out.set(name, {
|
|
582
|
+
value: desc,
|
|
583
|
+
origin: childOrigin,
|
|
584
|
+
overrides: existing
|
|
585
|
+
? [...(existing.overrides ?? []), existing.origin]
|
|
586
|
+
: undefined,
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return out;
|
|
591
|
+
}
|
|
495
592
|
function mapFromTypes(types, origin) {
|
|
496
593
|
const out = new Map();
|
|
497
594
|
for (const [name, td] of types) {
|
|
498
595
|
const eff = {
|
|
499
596
|
name,
|
|
500
|
-
|
|
597
|
+
extends: td.extends,
|
|
501
598
|
displayIdPattern: { value: td.displayIdPattern, origin },
|
|
502
599
|
displayIdPatternEnforcement: {
|
|
503
600
|
value: td.displayIdPatternEnforcement,
|
|
@@ -507,6 +604,9 @@ function mapFromTypes(types, origin) {
|
|
|
507
604
|
required: { value: td.required, origin },
|
|
508
605
|
attributes: mapFromAttrList(td.attributes, origin),
|
|
509
606
|
traceability: mapFromTrace(td.traceability, origin),
|
|
607
|
+
description: { value: td.description, origin },
|
|
608
|
+
attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
|
|
609
|
+
relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
|
|
510
610
|
};
|
|
511
611
|
out.set(name, { value: eff, origin });
|
|
512
612
|
}
|
package/script/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
|
|
@@ -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/script/profile/mod.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* resolution, and merging. Consumed by the validator pipeline and the CLI.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.buildProfileIntrospection = exports.resolveEntryColor = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = void 0;
|
|
10
10
|
var manifest_js_1 = require("./manifest.js");
|
|
11
11
|
Object.defineProperty(exports, "parseManifest", { enumerable: true, get: function () { return manifest_js_1.parseManifest; } });
|
|
12
12
|
var resolver_js_1 = require("./resolver.js");
|
|
@@ -24,8 +24,11 @@ var load_js_1 = require("./load.js");
|
|
|
24
24
|
Object.defineProperty(exports, "loadProfileForCommand", { enumerable: true, get: function () { return load_js_1.loadProfileForCommand; } });
|
|
25
25
|
var merge_js_1 = require("./merge.js");
|
|
26
26
|
Object.defineProperty(exports, "mergeChain", { enumerable: true, get: function () { return merge_js_1.mergeChain; } });
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
// cacheDir, CacheEnv, defaultRunNpm, resolveNpmSpecifier, ResolveNpmOptions,
|
|
28
|
+
// and RunNpm are internal implementation details of the NPM resolver — they
|
|
29
|
+
// are not part of the public profile API and are not re-exported from
|
|
30
|
+
// core/mod.ts. Consumers use loadChain / loadProfileForCommand instead.
|
|
31
|
+
var colors_js_1 = require("./colors.js");
|
|
32
|
+
Object.defineProperty(exports, "resolveEntryColor", { enumerable: true, get: function () { return colors_js_1.resolveEntryColor; } });
|
|
33
|
+
var introspect_js_1 = require("./introspect.js");
|
|
34
|
+
Object.defineProperty(exports, "buildProfileIntrospection", { enumerable: true, get: function () { return introspect_js_1.buildProfileIntrospection; } });
|
package/script/reporter/mod.js
CHANGED
|
@@ -30,8 +30,8 @@ function filterEntries(result, scope, label) {
|
|
|
30
30
|
if (scope) {
|
|
31
31
|
const scopeUpper = scope.toUpperCase();
|
|
32
32
|
entries = entries.filter((e) => {
|
|
33
|
-
const parts = e.displayId.split(
|
|
34
|
-
return parts.
|
|
33
|
+
const parts = e.displayId.split(/[_-]/);
|
|
34
|
+
return parts.some((p) => p === scopeUpper);
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
if (label) {
|
|
@@ -94,7 +94,7 @@ function computeCoverage(result, entries) {
|
|
|
94
94
|
let withoutSatisfies = 0;
|
|
95
95
|
for (const entry of entries) {
|
|
96
96
|
// Bucket by profile-declared type when available, fall back to shape.
|
|
97
|
-
const t = entry.type ?? (entry.shape === "
|
|
97
|
+
const t = entry.type ?? (entry.shape === "Reference" ? "ref" : "untyped");
|
|
98
98
|
byType[t] = (byType[t] ?? 0) + 1;
|
|
99
99
|
const fwd = result.forward.get(entry.displayId) ?? [];
|
|
100
100
|
const rev = result.reverse.get(entry.displayId) ?? [];
|
|
@@ -102,7 +102,7 @@ function computeCoverage(result, entries) {
|
|
|
102
102
|
if (hasSatisfies) {
|
|
103
103
|
withSatisfies++;
|
|
104
104
|
}
|
|
105
|
-
else if (entry.shape === "
|
|
105
|
+
else if (entry.shape === "Authored") {
|
|
106
106
|
withoutSatisfies++;
|
|
107
107
|
orphans.push(entry.displayId);
|
|
108
108
|
}
|
|
@@ -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,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module core/util/fence
|
|
4
|
+
*
|
|
5
|
+
* Prose-line walker that skips lines inside fenced code blocks.
|
|
6
|
+
* Several validator and formatter passes (body-block exclusions,
|
|
7
|
+
* caption adjacency, `$Identifier` extraction, modal-keyword
|
|
8
|
+
* normalisation) all needed to walk an entry body line-by-line while
|
|
9
|
+
* treating fenced code as verbatim. This helper centralises that
|
|
10
|
+
* pattern so the fence-toggle semantics stay consistent.
|
|
11
|
+
*
|
|
12
|
+
* Fence detection follows CommonMark §4.5 — a line whose first
|
|
13
|
+
* non-whitespace content is three or more backticks or tildes opens
|
|
14
|
+
* (or closes) a fenced block. The language tag that may follow the
|
|
15
|
+
* opening fence does not affect detection: we toggle on every fence
|
|
16
|
+
* marker regardless. (Mismatched marker types — ``` opener / ~~~
|
|
17
|
+
* closer — are accepted by the walker because real Markdown parsers
|
|
18
|
+
* already reject those upstream.)
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.FENCE_RE = void 0;
|
|
22
|
+
exports.walkProseLines = walkProseLines;
|
|
23
|
+
/** Three or more backticks or tildes at the start of a line. */
|
|
24
|
+
exports.FENCE_RE = /^\s*(```|~~~)/;
|
|
25
|
+
/**
|
|
26
|
+
* Walk `body` line by line, invoking `cb` for every line that's NOT
|
|
27
|
+
* inside a fenced code block. The first fence marker opens the block;
|
|
28
|
+
* the next closes it. The fence-marker lines themselves are also
|
|
29
|
+
* skipped (they're structural, not prose).
|
|
30
|
+
*/
|
|
31
|
+
function walkProseLines(body, cb) {
|
|
32
|
+
const lines = body.split("\n");
|
|
33
|
+
let inFence = false;
|
|
34
|
+
for (let i = 0; i < lines.length; i++) {
|
|
35
|
+
const line = lines[i];
|
|
36
|
+
if (exports.FENCE_RE.test(line)) {
|
|
37
|
+
inFence = !inFence;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (inFence)
|
|
41
|
+
continue;
|
|
42
|
+
cb(line, i);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -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"}
|
|
@@ -24,25 +24,16 @@ const CORE_RESERVED_KEYS = new Set([
|
|
|
24
24
|
]);
|
|
25
25
|
/**
|
|
26
26
|
* Compute the effective attribute scope for a given entry against the
|
|
27
|
-
* profile. Uses universal
|
|
27
|
+
* profile. Uses universal scope always; adds type scope only when
|
|
28
28
|
* `entry.type` is set and the type is declared in the profile.
|
|
29
29
|
*/
|
|
30
30
|
function effectiveScope(entry, profile) {
|
|
31
31
|
const required = [];
|
|
32
32
|
const attributes = new Map();
|
|
33
33
|
// Universal scope.
|
|
34
|
-
required.push(...profile.required.value);
|
|
35
34
|
for (const [name, attrEntry] of profile.attributes) {
|
|
36
35
|
attributes.set(name, attrEntry.value);
|
|
37
36
|
}
|
|
38
|
-
// Shape scope.
|
|
39
|
-
const shapeScope = entry.shape === "identified"
|
|
40
|
-
? profile.identified
|
|
41
|
-
: profile.referenced;
|
|
42
|
-
required.push(...shapeScope.required.value);
|
|
43
|
-
for (const [name, e] of shapeScope.attributes) {
|
|
44
|
-
attributes.set(name, e.value);
|
|
45
|
-
}
|
|
46
37
|
// Type scope (only when classified).
|
|
47
38
|
if (entry.type !== undefined) {
|
|
48
39
|
const typeEntry = profile.types.get(entry.type);
|
|
@@ -57,14 +48,6 @@ function effectiveScope(entry, profile) {
|
|
|
57
48
|
// names that aren't explicitly declared as attributes. A trace rule IS an
|
|
58
49
|
// id-list attribute by definition — profile authors shouldn't have to
|
|
59
50
|
// declare it in both places.
|
|
60
|
-
const shapeTrace = entry.shape === "identified"
|
|
61
|
-
? profile.identified.traceability
|
|
62
|
-
: profile.referenced.traceability;
|
|
63
|
-
for (const [name] of shapeTrace) {
|
|
64
|
-
if (!attributes.has(name)) {
|
|
65
|
-
attributes.set(name, synthesizedLinkAttr(name));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
51
|
if (entry.type !== undefined) {
|
|
69
52
|
const typeEntry = profile.types.get(entry.type);
|
|
70
53
|
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"}
|