@blockml/validator 0.7.1 → 0.8.1

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.
Files changed (33) hide show
  1. package/blocks/org/blockml/bml/compiler/validator/Library.bml +16 -3
  2. package/blocks/org/blockml/bml/compiler/validator/README.bml +1 -1
  3. package/blocks/org/blockml/bml/compiler/validator/capability/Validate.bml +4 -1
  4. package/blocks/org/blockml/bml/compiler/validator/capability/ValidateStyle.bml +47 -0
  5. package/blocks/org/blockml/bml/compiler/validator/documentation/DesignDecisions.bml +5 -2
  6. package/blocks/org/blockml/bml/compiler/validator/documentation/Diagnostics.bml +9 -4
  7. package/blocks/org/blockml/bml/compiler/validator/documentation/Introduction.bml +5 -3
  8. package/blocks/org/blockml/bml/compiler/validator/documentation/LayerSeparation.bml +4 -4
  9. package/blocks/org/blockml/bml/compiler/validator/documentation/PackageOwnership.bml +7 -4
  10. package/blocks/org/blockml/bml/compiler/validator/documentation/PublicApi.bml +11 -5
  11. package/blocks/org/blockml/bml/compiler/validator/documentation/ScopeExclusions.bml +5 -3
  12. package/blocks/org/blockml/bml/compiler/validator/documentation/ValidationPipeline.bml +6 -4
  13. package/blocks/org/blockml/bml/compiler/validator/documentation/ValidityContract.bml +5 -4
  14. package/blocks/org/blockml/bml/compiler/validator/style/PreferCDataWhenNeedsEscape.bml +27 -0
  15. package/blocks/org/blockml/bml/compiler/validator/style/PreferEmptyElementSelfClosing.bml +25 -0
  16. package/blocks/org/blockml/bml/compiler/validator/style/PreferMarkdownStructure.bml +25 -0
  17. package/blocks/org/blockml/bml/compiler/validator/style/StyleCheck.bml +27 -0
  18. package/blocks/org/blockml/bml/compiler/validator/style/StyleRule.bml +53 -0
  19. package/blocks/org/blockml/bml/compiler/validator/style/rule/CDataWhenEscaping.bml +50 -0
  20. package/blocks/org/blockml/bml/compiler/validator/style/rule/EmptyElementSelfClosing.bml +50 -0
  21. package/blocks/org/blockml/bml/compiler/validator/style/rule/MarkdownStructure.bml +50 -0
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/validate-style.d.ts +10 -0
  27. package/dist/validate-style.d.ts.map +1 -0
  28. package/dist/validate-style.js +149 -0
  29. package/dist/validate-style.js.map +1 -0
  30. package/dist/validate.d.ts.map +1 -1
  31. package/dist/validate.js +2 -0
  32. package/dist/validate.js.map +1 -1
  33. package/package.json +4 -4
@@ -21,6 +21,7 @@
21
21
  xmlns:validator="org.blockml.bml.compiler.validator"
22
22
  xmlns:valcap="org.blockml.bml.compiler.validator.capability"
23
23
  xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation"
24
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style"
24
25
  xmlns:bomdocumentation="org.blockml.bml.bom.documentation">
25
26
 
26
27
  <name>Library</name>
@@ -29,20 +30,23 @@
29
30
  <is>The BlockML Validator compiler package library catalog</is>
30
31
 
31
32
  <documentation>
33
+ # The BlockML Validator compiler package library catalog
34
+
32
35
  Canonical validator specification for BlockML Stage-2 — validate() orchestration
33
- on BomDocument using @blockml/framework utilities. TypeScript in packages/validator/src/
36
+ on BomDocument using @blockml/framework utilities, plus the style catalog
37
+ (org.blockml.bml.compiler.validator.style.*). TypeScript in packages/validator/src/
34
38
  implements this library. Urmodell and API types live in org.blockml.bml.bom.*
35
39
  (@blockml/bom). Membership is defined exclusively by this blocks list.
36
40
  </documentation>
37
41
 
38
- <version>0.7.1</version>
42
+ <version>0.8.1</version>
39
43
 
40
44
  <language>
41
45
  <English />
42
46
  </language>
43
47
 
44
48
  <properties>
45
- <description>
49
+ <description override="true">
46
50
  <value>BlockML Validator library</value>
47
51
  </description>
48
52
  </properties>
@@ -63,6 +67,15 @@
63
67
  <blocks>
64
68
  <composition><validator:ValidatorType />
65
69
  <valcap:Validate />
70
+ <valcap:ValidateStyle />
71
+ <valstyle:StyleRule />
72
+ <valstyle:StyleCheck />
73
+ <valstyle:PreferCDataWhenNeedsEscape />
74
+ <valstyle:PreferMarkdownStructure />
75
+ <valstyle:PreferEmptyElementSelfClosing />
76
+ <valstyle:CDataWhenEscaping />
77
+ <valstyle:MarkdownStructure />
78
+ <valstyle:EmptyElementSelfClosing />
66
79
  <valdocumentation:Introduction />
67
80
  <valdocumentation:ValidityContract />
68
81
  <valdocumentation:LayerSeparation />
@@ -24,7 +24,7 @@
24
24
  xmlns:bomdocumentation="org.blockml.bml.bom.documentation">
25
25
 
26
26
  <name>README</name>
27
- <type>blockml:README</type>
27
+ <type>validator:README</type>
28
28
  <baseType>core:ReadMe</baseType>
29
29
  <is>Reading entry for the Validator compiler library</is>
30
30
 
@@ -27,7 +27,9 @@
27
27
  <baseType>core:Capability</baseType>
28
28
  <is>Public entry: BomDocument → ValidateResult (B26)</is>
29
29
 
30
- <documentation>Orchestrates TypeRegistry bootstrap/injection, forkBom, validateTypes, and validateConstraints. Does not mutate input Urmodell.</documentation>
30
+ <documentation>Orchestrates TypeRegistry bootstrap/injection, forkBom, semantic framework
31
+ checks, and validateStyle. Does not mutate input Urmodell. Style diagnostics never
32
+ fail success.</documentation>
31
33
 
32
34
  <references>
33
35
  <see type="valdocumentation:PublicApi" relation="SeeAlso" />
@@ -36,6 +38,7 @@
36
38
  <see type="fwcap:ForkBom" relation="SeeAlso" />
37
39
  <see type="fwcap:ValidateTypes" relation="SeeAlso" />
38
40
  <see type="fwcap:ValidateConstraints" relation="SeeAlso" />
41
+ <see type="valcap:ValidateStyle" relation="SeeAlso" />
39
42
  <see type="fwcap:BootstrapTypeRegistry" relation="SeeAlso" />
40
43
  </references>
41
44
 
@@ -0,0 +1,47 @@
1
+ <!--
2
+ Validator Capability — ValidateStyle
3
+ FQN: org.blockml.bml.compiler.validator.capability.ValidateStyle
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:bom="org.blockml.bml.bom"
12
+ xmlns:bomapi="org.blockml.bml.bom.api"
13
+ xmlns:bomcommon="org.blockml.bml.bom.common"
14
+ xmlns:bomdoc="org.blockml.bml.bom.document"
15
+ xmlns:core="org.blockml.bml.core"
16
+ xmlns:def="org.blockml.bml.definition"
17
+ xmlns:type="org.blockml.bml.type"
18
+ xmlns:validator="org.blockml.bml.compiler.validator"
19
+ xmlns:valcap="org.blockml.bml.compiler.validator.capability"
20
+ xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation"
21
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
22
+
23
+ <name>ValidateStyle</name>
24
+ <type>valcap:ValidateStyle</type>
25
+ <baseType>core:Capability</baseType>
26
+ <is>Run the BML style catalog against a BomDocument</is>
27
+
28
+ <documentation>Loads StyleRule documents from this package blocks/style/rule/, dispatches each
29
+ check type to a TypeScript interpreter, and returns diagnostics. Does not affect
30
+ success (warnings and recommendations only). Unknown check types emit
31
+ BML_STYLE_UNKNOWN_CHECK as info.</documentation>
32
+
33
+ <references>
34
+ <see type="valstyle:StyleRule" relation="SeeAlso" />
35
+ <see type="valcap:Validate" relation="SeeAlso" />
36
+ </references>
37
+
38
+ <properties>
39
+ <document type="bomdoc:BomDocument">
40
+ <documentation>document. TS type: bomdoc:BomDocument. (required)</documentation>
41
+ </document>
42
+ <result type="bomcommon:Diagnostic[]">
43
+ <documentation>Style diagnostics. TS type: bomcommon:Diagnostic[]. (required)</documentation>
44
+ </result>
45
+ </properties>
46
+
47
+ </block>
@@ -38,7 +38,10 @@
38
38
  LSP and incremental validation scenarios.
39
39
 
40
40
  success semantics: false when any diagnostic has severity === "error"; warnings
41
- alone do not fail success.
41
+ and recommendations alone do not fail success.
42
+
43
+ Style catalog (validateStyle): BML StyleRule documents under style/rule/ are the SSOT.
44
+ Interpreters bind to StyleCheck type FQNs. Unknown checks emit BML_STYLE_UNKNOWN_CHECK.
42
45
 
43
46
  Bootstrap modes: bootstrapPaths (corpus flat scan) or libraryPaths (Library.bml graph).
44
47
  validateVersions runs after validateTypes and before validateConstraints.
@@ -50,7 +53,7 @@
50
53
  serializer, validator, and compiler.</documentation>
51
54
 
52
55
  <references>
53
- <see type="valdocumentation:Diagnostics" relation="ReadNext"></see>
56
+ <see type="valdocumentation:Diagnostics" relation="ReadNext" />
54
57
  </references>
55
58
 
56
59
  </block>
@@ -21,7 +21,9 @@
21
21
  xmlns:validator="org.blockml.bml.compiler.validator"
22
22
  xmlns:valcap="org.blockml.bml.compiler.validator.capability"
23
23
  xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation"
24
- xmlns:doc="org.blockml.bml.documentation">
24
+ xmlns:doc="org.blockml.bml.documentation"
25
+ xmlns:fwconfig="org.blockml.bml.framework.config"
26
+ >
25
27
 
26
28
  <name>Diagnostics</name>
27
29
  <type>valdocumentation:Diagnostics</type>
@@ -29,19 +31,22 @@
29
31
  <is>Validator diagnostics and host abort policy</is>
30
32
 
31
33
  <documentation>The validator aggregates diagnostics from framework utilities (validateTypes,
32
- validateConstraints) and bootstrap (when TypeRegistry is built inline).
34
+ validateConstraints), bootstrap (when TypeRegistry is built inline), and validateStyle.
33
35
 
34
36
  Diagnostic type: org.blockml.bml.bom.common.Diagnostic (shared across toolchain).
37
+ Style codes: BML_STYLE_PREFER_CDATA, BML_STYLE_PREFER_MARKDOWN,
38
+ BML_STYLE_EMPTY_ELEMENT_SELF_CLOSE, BML_STYLE_UNKNOWN_CHECK.
35
39
 
36
40
  Host policy: CLI, IDE, and other orchestrators decide whether error diagnostics
37
41
  block serialize, compile, or other downstream steps. The validator package does
38
42
  not enforce abort-on-error — it reports diagnostics and success flag only.
43
+ Style warnings and recommendations do not fail success.
39
44
 
40
45
  Cross-ref diagnostic codes: org.blockml.bml.framework.config.FrameworkDiagnosticCodes</documentation>
41
46
 
42
47
  <references>
43
- <see type="fwconfig:FrameworkDiagnosticCodes" relation="SeeAlso"></see>
44
- <see type="valdocumentation:PackageOwnership" relation="ReadNext"></see>
48
+ <see type="fwconfig:FrameworkDiagnosticCodes" relation="SeeAlso" />
49
+ <see type="valdocumentation:PackageOwnership" relation="ReadNext" />
45
50
  </references>
46
51
 
47
52
  </block>
@@ -21,7 +21,9 @@
21
21
  xmlns:validator="org.blockml.bml.compiler.validator"
22
22
  xmlns:valcap="org.blockml.bml.compiler.validator.capability"
23
23
  xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation"
24
- xmlns:doc="org.blockml.bml.documentation">
24
+ xmlns:doc="org.blockml.bml.documentation"
25
+ xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
26
+ >
25
27
 
26
28
  <name>Introduction</name>
27
29
  <type>valdocumentation:Introduction</type>
@@ -45,8 +47,8 @@
45
47
  complete TypeRegistry. CLI validate and LSP share this engine.</documentation>
46
48
 
47
49
  <references>
48
- <see type="valdocumentation:ValidityContract" relation="ReadNext"></see>
49
- <see type="bomdocumentation:Introduction" relation="SeeAlso"></see>
50
+ <see type="valdocumentation:ValidityContract" relation="ReadNext" />
51
+ <see type="bomdocumentation:Introduction" relation="SeeAlso" />
50
52
  </references>
51
53
 
52
54
  </block>
@@ -37,15 +37,15 @@
37
37
  validateTypes, validateConstraints, bootstrapTypeRegistry. Validator calls these;
38
38
  does not reimplement them.
39
39
 
40
- org.blockml.bml.compiler.validator.* (this package) — validate() orchestration
41
- and Stage-2 entry point contract only.
40
+ org.blockml.bml.compiler.validator.* (this package) — validate() orchestration,
41
+ style catalog (org.blockml.bml.compiler.validator.style.*), and Stage-2 entry point.
42
42
 
43
43
  org.blockml.bml.compiler.parser.* (@blockml/parser) — BML → BomDocument (Stage 1).
44
44
  Validator consumes parser output; does not call parse() directly (bootstrap is via framework).</documentation>
45
45
 
46
46
  <references>
47
- <see type="valdocumentation:ValidationPipeline" relation="ReadNext"></see>
48
- <see type="fwdocumentation:Introduction" relation="SeeAlso"></see>
47
+ <see type="valdocumentation:ValidationPipeline" relation="ReadNext" />
48
+ <see type="fwdocumentation:Introduction" relation="SeeAlso" />
49
49
  </references>
50
50
 
51
51
  </block>
@@ -21,14 +21,17 @@
21
21
  xmlns:validator="org.blockml.bml.compiler.validator"
22
22
  xmlns:valcap="org.blockml.bml.compiler.validator.capability"
23
23
  xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation"
24
- xmlns:doc="org.blockml.bml.documentation">
24
+ xmlns:doc="org.blockml.bml.documentation"
25
+ xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
26
+ >
25
27
 
26
28
  <name>PackageOwnership</name>
27
29
  <type>valdocumentation:PackageOwnership</type>
28
30
  <baseType>core:Documentation</baseType>
29
31
  <is>Toolchain package responsibilities for validation</is>
30
32
 
31
- <documentation>@blockml/validator — validate() orchestration; ValidateResult assembly. Owns this BML library.
33
+ <documentation>@blockml/validator — validate() orchestration, style catalog, ValidateResult assembly.
34
+ Owns this BML library including org.blockml.bml.compiler.validator.style.*.
32
35
 
33
36
  @blockml/bom — Urmodell types, ValidateOptions/ValidateResult (B26), Diagnostic.
34
37
  Validator consumes; does not redefine.
@@ -41,8 +44,8 @@
41
44
  @blockml/cli — validate command host; may inject TypeRegistry or bootstrap paths.</documentation>
42
45
 
43
46
  <references>
44
- <see type="valdocumentation:ScopeExclusions" relation="ReadNext"></see>
45
- <see type="bomdocumentation:PackageOwnership" relation="SeeAlso"></see>
47
+ <see type="valdocumentation:ScopeExclusions" relation="ReadNext" />
48
+ <see type="bomdocumentation:PackageOwnership" relation="SeeAlso" />
46
49
  </references>
47
50
 
48
51
  </block>
@@ -28,7 +28,8 @@
28
28
  <baseType>core:Documentation</baseType>
29
29
  <is>validate() entry point (B26)</is>
30
30
 
31
- <documentation>validate(document: BomDocument, options?: ValidateOptions): ValidateResult
31
+ <documentation> validate(document: BomDocument, options?: ValidateOptions): ValidateResult
32
+ validateStyle(document: BomDocument): Diagnostic[]
32
33
 
33
34
  ValidateOptions (owned by @blockml/bom):
34
35
  • typeRegistry — pre-built TypeRegistryReader / TypeRegistry instance (optional)
@@ -40,13 +41,18 @@
40
41
  • diagnostics — Diagnostic[]
41
42
  • success — false if any error-severity diagnostic
42
43
 
44
+ Style: validateStyle runs after semantic checks. Catalog SSOT lives under
45
+ org.blockml.bml.compiler.validator.style.*. Warnings and recommendations do not
46
+ fail success.
47
+
43
48
  Sync only; does not throw on validation errors. Host decides abort policy.</documentation>
44
49
 
45
50
  <references>
46
- <see type="bomapi:ValidateOptions" relation="Defines"></see>
47
- <see type="bomapi:ValidateResult" relation="Defines"></see>
48
- <see type="valcap:Validate" relation="Defines"></see>
49
- <see type="valdocumentation:DesignDecisions" relation="ReadNext"></see>
51
+ <see type="bomapi:ValidateOptions" relation="Defines" />
52
+ <see type="bomapi:ValidateResult" relation="Defines" />
53
+ <see type="valcap:Validate" relation="Defines" />
54
+ <see type="valcap:ValidateStyle" relation="Defines" />
55
+ <see type="valdocumentation:DesignDecisions" relation="ReadNext" />
50
56
  </references>
51
57
 
52
58
  </block>
@@ -31,8 +31,9 @@
31
31
  <documentation>Out of scope for @blockml/validator:
32
32
 
33
33
  • TypeRegistry implementation — @blockml/framework
34
- • Individual validation rules — @blockml/framework (validateTypes, validateEmbeddedBlocks,
34
+ • Individual semantic validation rules — @blockml/framework (validateTypes, validateEmbeddedBlocks,
35
35
  validateInstances, validatePresets, validateVisibility, validateReadOnly, validateConstraints)
36
+ • Style/quality rules — in scope here (validateStyle + style catalog)
36
37
  • SCAD / MachineBlocks Stage-3 render validation
37
38
  • MemberGroups axis constraints (Category / AiUsage) — MachineBlocks-only; see docs/TODOs
38
39
  • parse() / serialize() — @blockml/parser / @blockml/serializer
@@ -40,10 +41,11 @@
40
41
  • CLI file I/O — @blockml/cli
41
42
  • Language BML corpus — @blockml/core (npm)
42
43
 
43
- In scope: validate() orchestration on BomDocument with framework utilities.</documentation>
44
+ In scope: validate() orchestration on BomDocument with framework utilities and the
45
+ style catalog.</documentation>
44
46
 
45
47
  <references>
46
- <see type="valdocumentation:Introduction" relation="SeeAlso"></see>
48
+ <see type="valdocumentation:Introduction" relation="SeeAlso" />
47
49
  </references>
48
50
 
49
51
  </block>
@@ -41,8 +41,9 @@
41
41
  8. validateVisibility(pragmaticModel, registry) → append diagnostics
42
42
  9. validateReadOnly(pragmaticModel, registry) → append diagnostics
43
43
  10. validateConstraints(pragmaticModel, registry) → append diagnostics
44
- 11. success = no diagnostic with severity === "error"
45
- 12. Return ValidateResult { pragmaticModel?, diagnostics, success }
44
+ 11. validateStyle(pragmaticModel) append warning/recommendation diagnostics
45
+ 12. success = no diagnostic with severity === "error"
46
+ 13. Return ValidateResult { pragmaticModel?, diagnostics, success }
46
47
 
47
48
  When continueOnError === false and success === false, pragmaticModel is omitted
48
49
  from the result (early return with diagnostics only).
@@ -51,8 +52,9 @@
51
52
  MemberGroups axis constraints (MB-only).</documentation>
52
53
 
53
54
  <references>
54
- <see type="valdocumentation:PublicApi" relation="ReadNext"></see>
55
- <see type="valcap:Validate" relation="Defines"></see>
55
+ <see type="valdocumentation:PublicApi" relation="ReadNext" />
56
+ <see type="valcap:Validate" relation="Defines" />
57
+ <see type="valcap:ValidateStyle" relation="SeeAlso" />
56
58
  </references>
57
59
 
58
60
  </block>
@@ -34,8 +34,9 @@
34
34
  CLI blockml validate and LSP analyzeDocument consume the same parse + validate engine.
35
35
  Generated XSD is a non-authoritative render-target projection and is not consulted.
36
36
 
37
- Severity: error = not valid BlockML; warning = valid but problematic (deprecation);
38
- info = hint. Unknown element, attribute, member, type, block, or missing library is error.
37
+ Severity: error = not valid BlockML; warning = valid but problematic (deprecation
38
+ or mechanical style); recommendation = quality improvement; info = hint.
39
+ Unknown element, attribute, member, type, block, or missing library is error.
39
40
 
40
41
  Semantic checks (this package / framework): every type FQN must resolve in the
41
42
  TypeRegistry or be a well-known primitive; instance typeFqn and memberValues keys
@@ -48,8 +49,8 @@
48
49
  Unknown instance members stay in memberValues plus BML_UNKNOWN_PROPERTY error.</documentation>
49
50
 
50
51
  <references>
51
- <see type="pardocumentation:StructuralGrammar" relation="SeeAlso"></see>
52
- <see type="valdocumentation:ValidationPipeline" relation="ReadNext"></see>
52
+ <see type="pardocumentation:StructuralGrammar" relation="SeeAlso" />
53
+ <see type="valdocumentation:ValidationPipeline" relation="ReadNext" />
53
54
  </references>
54
55
 
55
56
  </block>
@@ -0,0 +1,27 @@
1
+ <!--
2
+ Validator Style Check — PreferCDataWhenNeedsEscape
3
+ FQN: org.blockml.bml.compiler.validator.style.PreferCDataWhenNeedsEscape
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:core="org.blockml.bml.core"
12
+ xmlns:def="org.blockml.bml.definition"
13
+ xmlns:type="org.blockml.bml.type"
14
+ xmlns:validator="org.blockml.bml.compiler.validator"
15
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
16
+
17
+ <name>PreferCDataWhenNeedsEscape</name>
18
+ <type>valstyle:PreferCDataWhenNeedsEscape</type>
19
+ <baseType>valstyle:StyleCheck</baseType>
20
+ <is>Recommend CDATA when documentation text contains and or less-than</is>
21
+
22
+ <documentation><![CDATA[
23
+ Matches block-level documentation prose whose text contains & or <
24
+ and authoredCharacterDataForm is not cdata.
25
+ ]]></documentation>
26
+
27
+ </block>
@@ -0,0 +1,25 @@
1
+ <!--
2
+ Validator Style Check — PreferEmptyElementSelfClosing
3
+ FQN: org.blockml.bml.compiler.validator.style.PreferEmptyElementSelfClosing
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:core="org.blockml.bml.core"
12
+ xmlns:def="org.blockml.bml.definition"
13
+ xmlns:type="org.blockml.bml.type"
14
+ xmlns:validator="org.blockml.bml.compiler.validator"
15
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
16
+
17
+ <name>PreferEmptyElementSelfClosing</name>
18
+ <type>valstyle:PreferEmptyElementSelfClosing</type>
19
+ <baseType>valstyle:StyleCheck</baseType>
20
+ <is>Warn when an empty see reference is authored as a paired tag</is>
21
+
22
+ <documentation>Matches DocumentationReference with empty context and authoredEmptyElementForm paired
23
+ (see open-close with no body). Preferred form is self-closing.</documentation>
24
+
25
+ </block>
@@ -0,0 +1,25 @@
1
+ <!--
2
+ Validator Style Check — PreferMarkdownStructure
3
+ FQN: org.blockml.bml.compiler.validator.style.PreferMarkdownStructure
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:core="org.blockml.bml.core"
12
+ xmlns:def="org.blockml.bml.definition"
13
+ xmlns:type="org.blockml.bml.type"
14
+ xmlns:validator="org.blockml.bml.compiler.validator"
15
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
16
+
17
+ <name>PreferMarkdownStructure</name>
18
+ <type>valstyle:PreferMarkdownStructure</type>
19
+ <baseType>valstyle:StyleCheck</baseType>
20
+ <is>Recommend markdown structure for long block documentation</is>
21
+
22
+ <documentation>Matches block-level documentation longer than 280 characters with no blank
23
+ line, heading, or list marker. Short member documentation is out of scope.</documentation>
24
+
25
+ </block>
@@ -0,0 +1,27 @@
1
+ <!--
2
+ Validator Style — StyleCheck
3
+ FQN: org.blockml.bml.compiler.validator.style.StyleCheck
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:core="org.blockml.bml.core"
12
+ xmlns:def="org.blockml.bml.definition"
13
+ xmlns:type="org.blockml.bml.type"
14
+ xmlns:validator="org.blockml.bml.compiler.validator"
15
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
16
+
17
+ <name>StyleCheck</name>
18
+ <type>valstyle:StyleCheck</type>
19
+ <baseType>validator:ValidatorType</baseType>
20
+ <is>Abstract marker for a style-check interpreter kind</is>
21
+
22
+ <documentation>Concrete check types bind to a TypeScript interpreter in validateStyle.
23
+ Unknown check types emit BML_STYLE_UNKNOWN_CHECK (info) and are skipped.</documentation>
24
+
25
+ <abstract>true</abstract>
26
+
27
+ </block>
@@ -0,0 +1,53 @@
1
+ <!--
2
+ Validator Style — StyleRule
3
+ FQN: org.blockml.bml.compiler.validator.style.StyleRule
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:bom="org.blockml.bml.bom"
12
+ xmlns:bomcommon="org.blockml.bml.bom.common"
13
+ xmlns:core="org.blockml.bml.core"
14
+ xmlns:def="org.blockml.bml.definition"
15
+ xmlns:type="org.blockml.bml.type"
16
+ xmlns:validator="org.blockml.bml.compiler.validator"
17
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style"
18
+ xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
19
+
20
+ <name>StyleRule</name>
21
+ <type>valstyle:StyleRule</type>
22
+ <baseType>validator:ValidatorType</baseType>
23
+ <is>Catalog entry for a BML authoring quality rule</is>
24
+
25
+ <documentation>SSOT for one style check. Concrete rules extend this type. validateStyle loads
26
+ rule documents from this package blocks/ and dispatches on check type FQN.
27
+ Warnings and recommendations never set ValidateResult.success to false.</documentation>
28
+
29
+ <properties>
30
+ <code type="type:Text">
31
+ <documentation>Diagnostic code, e.g. BML_STYLE_PREFER_CDATA. (required)</documentation>
32
+ </code>
33
+ <severity type="bomcommon:DiagnosticSeverity">
34
+ <documentation>warning or recommendation for v1 style rules. (required)</documentation>
35
+ </severity>
36
+ <appliesTo type="type:Text">
37
+ <documentation>Human-readable target, e.g. block documentation. (required)</documentation>
38
+ </appliesTo>
39
+ <message type="type:Text">
40
+ <documentation>Diagnostic message emitted on match. (required)</documentation>
41
+ </message>
42
+ </properties>
43
+
44
+ <aggregations>
45
+ <check>
46
+ <documentation>StyleCheck subtype that selects the TypeScript interpreter. (required)</documentation>
47
+ <composition>
48
+ <valstyle:StyleCheck />
49
+ </composition>
50
+ </check>
51
+ </aggregations>
52
+
53
+ </block>
@@ -0,0 +1,50 @@
1
+ <!--
2
+ Validator Style Rule — CDataWhenEscaping
3
+ FQN: org.blockml.bml.compiler.validator.style.CDataWhenEscaping
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:bom="org.blockml.bml.bom"
12
+ xmlns:bomcommon="org.blockml.bml.bom.common"
13
+ xmlns:core="org.blockml.bml.core"
14
+ xmlns:def="org.blockml.bml.definition"
15
+ xmlns:type="org.blockml.bml.type"
16
+ xmlns:validator="org.blockml.bml.compiler.validator"
17
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
18
+
19
+ <name>CDataWhenEscaping</name>
20
+ <type>valstyle:CDataWhenEscaping</type>
21
+ <baseType>valstyle:StyleRule</baseType>
22
+ <is>Recommend CDATA for documentation that needs XML escaping</is>
23
+
24
+ <documentation>Block-level documentation whose text contains markup characters should use CDATA
25
+ instead of entity escaping so humans can read the source.</documentation>
26
+
27
+ <properties>
28
+ <code override="true">
29
+ <value>BML_STYLE_PREFER_CDATA</value>
30
+ </code>
31
+ <severity override="true">
32
+ <value>recommendation</value>
33
+ </severity>
34
+ <appliesTo override="true">
35
+ <value>block documentation</value>
36
+ </appliesTo>
37
+ <message override="true">
38
+ <value>Use CDATA instead of XML entity escaping in documentation.</value>
39
+ </message>
40
+ </properties>
41
+
42
+ <aggregations>
43
+ <check>
44
+ <composition>
45
+ <valstyle:PreferCDataWhenNeedsEscape />
46
+ </composition>
47
+ </check>
48
+ </aggregations>
49
+
50
+ </block>
@@ -0,0 +1,50 @@
1
+ <!--
2
+ Validator Style Rule — EmptyElementSelfClosing
3
+ FQN: org.blockml.bml.compiler.validator.style.EmptyElementSelfClosing
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:bom="org.blockml.bml.bom"
12
+ xmlns:bomcommon="org.blockml.bml.bom.common"
13
+ xmlns:core="org.blockml.bml.core"
14
+ xmlns:def="org.blockml.bml.definition"
15
+ xmlns:type="org.blockml.bml.type"
16
+ xmlns:validator="org.blockml.bml.compiler.validator"
17
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
18
+
19
+ <name>EmptyElementSelfClosing</name>
20
+ <type>valstyle:EmptyElementSelfClosing</type>
21
+ <baseType>valstyle:StyleRule</baseType>
22
+ <is>Require self-closing form for empty see references</is>
23
+
24
+ <documentation>Empty see tags should be written as self-closing elements:
25
+ see with attributes and slash, not a paired open-close with no body.</documentation>
26
+
27
+ <properties>
28
+ <code override="true">
29
+ <value>BML_STYLE_EMPTY_ELEMENT_SELF_CLOSE</value>
30
+ </code>
31
+ <severity override="true">
32
+ <value>warning</value>
33
+ </severity>
34
+ <appliesTo override="true">
35
+ <value>empty see reference</value>
36
+ </appliesTo>
37
+ <message override="true">
38
+ <value>Write empty elements as self-closing tags.</value>
39
+ </message>
40
+ </properties>
41
+
42
+ <aggregations>
43
+ <check>
44
+ <composition>
45
+ <valstyle:PreferEmptyElementSelfClosing />
46
+ </composition>
47
+ </check>
48
+ </aggregations>
49
+
50
+ </block>
@@ -0,0 +1,50 @@
1
+ <!--
2
+ Validator Style Rule — MarkdownStructure
3
+ FQN: org.blockml.bml.compiler.validator.style.MarkdownStructure
4
+ -->
5
+ <block
6
+ xmlns="http://blockml.org/bml"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8
+ xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
9
+ "
10
+ xmlns:blockml="org.blockml.bml"
11
+ xmlns:bom="org.blockml.bml.bom"
12
+ xmlns:bomcommon="org.blockml.bml.bom.common"
13
+ xmlns:core="org.blockml.bml.core"
14
+ xmlns:def="org.blockml.bml.definition"
15
+ xmlns:type="org.blockml.bml.type"
16
+ xmlns:validator="org.blockml.bml.compiler.validator"
17
+ xmlns:valstyle="org.blockml.bml.compiler.validator.style">
18
+
19
+ <name>MarkdownStructure</name>
20
+ <type>valstyle:MarkdownStructure</type>
21
+ <baseType>valstyle:StyleRule</baseType>
22
+ <is>Recommend markdown structure for long unstructured documentation</is>
23
+
24
+ <documentation>Long block-level documentation should use markdown headings, lists, or blank-line
25
+ paragraphs instead of a single run-on text block.</documentation>
26
+
27
+ <properties>
28
+ <code override="true">
29
+ <value>BML_STYLE_PREFER_MARKDOWN</value>
30
+ </code>
31
+ <severity override="true">
32
+ <value>recommendation</value>
33
+ </severity>
34
+ <appliesTo override="true">
35
+ <value>block documentation</value>
36
+ </appliesTo>
37
+ <message override="true">
38
+ <value>Structure long documentation with markdown (headings, lists, or paragraphs).</value>
39
+ </message>
40
+ </properties>
41
+
42
+ <aggregations>
43
+ <check>
44
+ <composition>
45
+ <valstyle:PreferMarkdownStructure />
46
+ </composition>
47
+ </check>
48
+ </aggregations>
49
+
50
+ </block>
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { validate } from "./validate.js";
2
+ export { validateStyle } from "./validate-style.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { validate } from "./validate.js";
2
+ export { validateStyle } from "./validate-style.js";
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { BomDocument, Diagnostic, DiagnosticSeverity } from "@blockml/bom";
2
+ export interface StyleRuleRecord {
3
+ name: string;
4
+ code: string;
5
+ severity: DiagnosticSeverity;
6
+ message: string;
7
+ check: string;
8
+ }
9
+ export declare function validateStyle(document: BomDocument): Diagnostic[];
10
+ //# sourceMappingURL=validate-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-style.d.ts","sourceRoot":"","sources":["../src/validate-style.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,WAAW,EACX,UAAU,EACV,kBAAkB,EAGnB,MAAM,cAAc,CAAC;AAItB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AA2KD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,GAAG,UAAU,EAAE,CAmBjE"}
@@ -0,0 +1,149 @@
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const MARKDOWN_MIN_LENGTH = 280;
5
+ const FALLBACK_RULES = [
6
+ {
7
+ name: "CDataWhenEscaping",
8
+ code: "BML_STYLE_PREFER_CDATA",
9
+ severity: "recommendation",
10
+ message: "Use CDATA instead of XML entity escaping in documentation.",
11
+ check: "PreferCDataWhenNeedsEscape",
12
+ },
13
+ {
14
+ name: "MarkdownStructure",
15
+ code: "BML_STYLE_PREFER_MARKDOWN",
16
+ severity: "recommendation",
17
+ message: "Structure long documentation with markdown (headings, lists, or paragraphs).",
18
+ check: "PreferMarkdownStructure",
19
+ },
20
+ {
21
+ name: "EmptyElementSelfClosing",
22
+ code: "BML_STYLE_EMPTY_ELEMENT_SELF_CLOSE",
23
+ severity: "warning",
24
+ message: "Write empty elements as self-closing tags.",
25
+ check: "PreferEmptyElementSelfClosing",
26
+ },
27
+ ];
28
+ function styleRuleDir() {
29
+ const here = dirname(fileURLToPath(import.meta.url));
30
+ return join(here, "..", "blocks/org/blockml/bml/compiler/validator/style/rule");
31
+ }
32
+ function propertyValue(source, name) {
33
+ const re = new RegExp(`<${name}\\b[\\s\\S]*?<value>([\\s\\S]*?)</value>`);
34
+ return source.match(re)?.[1]?.trim();
35
+ }
36
+ function checkTypeName(source) {
37
+ return source.match(/<check>[\s\S]*?<(?:[\w]+:)?(\w+)\s*\/>/)?.[1];
38
+ }
39
+ let cachedRules;
40
+ function loadStyleCatalog() {
41
+ if (cachedRules) {
42
+ return cachedRules;
43
+ }
44
+ const dir = styleRuleDir();
45
+ if (!existsSync(dir)) {
46
+ cachedRules = FALLBACK_RULES;
47
+ return cachedRules;
48
+ }
49
+ const rules = [];
50
+ for (const entry of readdirSync(dir)) {
51
+ if (!entry.endsWith(".bml")) {
52
+ continue;
53
+ }
54
+ const text = readFileSync(join(dir, entry), "utf8");
55
+ const name = text.match(/<name>([^<]+)<\/name>/)?.[1]?.trim();
56
+ const code = propertyValue(text, "code");
57
+ const severity = propertyValue(text, "severity");
58
+ const message = propertyValue(text, "message");
59
+ const check = checkTypeName(text);
60
+ if (!name || !code || !severity || !message || !check) {
61
+ continue;
62
+ }
63
+ rules.push({ name, code, severity, message, check });
64
+ }
65
+ cachedRules = rules.length > 0 ? rules : FALLBACK_RULES;
66
+ return cachedRules;
67
+ }
68
+ function needsCData(text) {
69
+ return /[<&]/.test(text);
70
+ }
71
+ function hasMarkdownStructure(text) {
72
+ return (/\n\s*\n/.test(text) ||
73
+ /^#{1,6} /m.test(text) ||
74
+ /^(\s*[-*] |\s*\d+\. |\s*• )/m.test(text));
75
+ }
76
+ function loc(file, source) {
77
+ return source ?? { file, line: 1, column: 1 };
78
+ }
79
+ function styleDiag(rule, file, source) {
80
+ return {
81
+ severity: rule.severity,
82
+ code: rule.code,
83
+ message: rule.message,
84
+ source: loc(file, source),
85
+ };
86
+ }
87
+ function walkBlocks(block, visit) {
88
+ visit(block);
89
+ for (const sub of block.subBlocks) {
90
+ walkBlocks(sub, visit);
91
+ }
92
+ for (const emb of block.embeddedBlocks) {
93
+ walkBlocks(emb, visit);
94
+ }
95
+ }
96
+ function collectReferences(block) {
97
+ const refs = [...(block.references ?? [])];
98
+ for (const member of block.members) {
99
+ refs.push(...(member.references ?? []));
100
+ }
101
+ return refs;
102
+ }
103
+ function runPreferCData(rule, block, file, out) {
104
+ for (const prose of block.documentations ?? []) {
105
+ if (needsCData(prose.text) && prose.authoredCharacterDataForm !== "cdata") {
106
+ out.push(styleDiag(rule, file, prose.source));
107
+ }
108
+ }
109
+ }
110
+ function runPreferMarkdown(rule, block, file, out) {
111
+ for (const prose of block.documentations ?? []) {
112
+ if (prose.text.length > MARKDOWN_MIN_LENGTH && !hasMarkdownStructure(prose.text)) {
113
+ out.push(styleDiag(rule, file, prose.source));
114
+ }
115
+ }
116
+ }
117
+ function runPreferSelfClosing(rule, block, file, out) {
118
+ for (const ref of collectReferences(block)) {
119
+ if (ref.context.trim() === "" && ref.authoredEmptyElementForm === "paired") {
120
+ out.push(styleDiag(rule, file, ref.source));
121
+ }
122
+ }
123
+ }
124
+ const INTERPRETERS = {
125
+ PreferCDataWhenNeedsEscape: runPreferCData,
126
+ PreferMarkdownStructure: runPreferMarkdown,
127
+ PreferEmptyElementSelfClosing: runPreferSelfClosing,
128
+ };
129
+ export function validateStyle(document) {
130
+ const file = document.source.filePath;
131
+ const diagnostics = [];
132
+ for (const rule of loadStyleCatalog()) {
133
+ const run = INTERPRETERS[rule.check];
134
+ if (!run) {
135
+ diagnostics.push({
136
+ severity: "info",
137
+ code: "BML_STYLE_UNKNOWN_CHECK",
138
+ message: `Unknown style check type: ${rule.check}`,
139
+ source: { file, line: 1, column: 1 },
140
+ });
141
+ continue;
142
+ }
143
+ walkBlocks(document.block, (block) => {
144
+ run(rule, block, file, diagnostics);
145
+ });
146
+ }
147
+ return diagnostics;
148
+ }
149
+ //# sourceMappingURL=validate-style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-style.js","sourceRoot":"","sources":["../src/validate-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAUzC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAUhC,MAAM,cAAc,GAAsB;IACxC;QACE,IAAI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ACpD,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,QAAqB;IACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;IACtC,MAAM,WAAW,GAAiB,EAAE,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,WAAW,CAAC,IAAI,CAAC;gBACf,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,yBAAyB;gBAC/B,OAAO,EAAE,6BAA6B,IAAI,CAAC,KAAK,EAAE;gBAClD,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;aACrC,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;YACnC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAc,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA+B7F,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,WAAW,EACrB,OAAO,GAAE,eAAoB,GAC5B,cAAc,CA4ChB"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAc,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAgC7F,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,WAAW,EACrB,OAAO,GAAE,eAAoB,GAC5B,cAAc,CA6ChB"}
package/dist/validate.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { validateStyle } from "./validate-style.js";
1
2
  import { bootstrapTypeRegistry, forkBom, validateConstraints, validateEmbeddedBlocks, validateInstances, validatePresets, validateReadOnly, validateTypes, validateVersions, validateVisibility, TypeRegistry, } from "@blockml/framework";
2
3
  /** Bootstrap scan diagnostics apply to the corpus, not the document under validation. */
3
4
  function libraryBootstrapDiagnostics(bootstrap, options) {
@@ -37,6 +38,7 @@ export function validate(document, options = {}) {
37
38
  ...validateVisibility(pragmaticModel, registry),
38
39
  ...validateReadOnly(pragmaticModel, registry),
39
40
  ...validateConstraints(pragmaticModel, registry),
41
+ ...validateStyle(pragmaticModel),
40
42
  ];
41
43
  const success = !diagnostics.some((d) => d.severity === "error");
42
44
  if (!continueOnError && !success) {
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAE5B,yFAAyF;AACzF,SAAS,2BAA2B,CAClC,SAA0B,EAC1B,OAAwB;IAExB,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,SAAS,CAAC,WAAW,CAAC,MAAM,CACjC,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,IAAI,KAAK,2BAA2B;QACtC,CAAC,CAAC,IAAI,KAAK,+BAA+B,CAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,QAAqB,EACrB,UAA2B,EAAE;IAE7B,MAAM,eAAe,GAAG,OAAO,CAAC,eAA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E,WAAW,EAAE,OAAO,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockml/validator",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "BlockML validator — semantic validation of BOM documents",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -32,9 +32,9 @@
32
32
  "test": "vitest run packages/validator/test"
33
33
  },
34
34
  "dependencies": {
35
- "@blockml/bom": "^0.7.1",
36
- "@blockml/core": "^1.0.5",
37
- "@blockml/framework": "^0.7.1"
35
+ "@blockml/bom": "^0.8.1",
36
+ "@blockml/core": "^1.0.6",
37
+ "@blockml/framework": "^0.8.1"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=20"