@blockml/fatblock-target 0.1.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/blocks/org/blockml/bml/target/fatblock/FatblockType.bml +33 -0
- package/blocks/org/blockml/bml/target/fatblock/Library.bml +101 -0
- package/blocks/org/blockml/bml/target/fatblock/README.bml +57 -0
- package/blocks/org/blockml/bml/target/fatblock/api/AssembleFatDocumentResult.bml +35 -0
- package/blocks/org/blockml/bml/target/fatblock/api/FatBlockOptions.bml +42 -0
- package/blocks/org/blockml/bml/target/fatblock/api/FatBlockRenderOutput.bml +36 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/AssembleFatDocument.bml +54 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/CloneBlockDefinition.bml +41 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/CollectCandidateFqns.bml +57 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/FatOutputBasename.bml +45 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/FilterByIncludes.bml +48 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/MatchesIncludePattern.bml +44 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/MergeNamespaceBindings.bml +48 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/Render.bml +49 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/ResolveOptions.bml +46 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/RootFqnsByFilePath.bml +45 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/SerializeFatDocument.bml +48 -0
- package/blocks/org/blockml/bml/target/fatblock/capability/ValidateRequest.bml +45 -0
- package/blocks/org/blockml/bml/target/fatblock/config/DefaultFatBlockOptions.bml +35 -0
- package/blocks/org/blockml/bml/target/fatblock/config/FatBlockConstants.bml +38 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/ArchitectureOverview.bml +53 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/CandidateCollection.bml +45 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/DesignDecisions.bml +51 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/Diagnostics.bml +48 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/EmbedAssemblyRules.bml +46 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/Introduction.bml +49 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/LayerSeparation.bml +50 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/NamespaceMergeRules.bml +42 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/OutputLayout.bml +40 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/PackageOwnership.bml +47 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/PublicApi.bml +48 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/ScopeExclusions.bml +40 -0
- package/blocks/org/blockml/bml/target/fatblock/documentation/V1Scope.bml +49 -0
- package/dist/assemble-fat-document.d.ts +13 -0
- package/dist/assemble-fat-document.d.ts.map +1 -0
- package/dist/assemble-fat-document.js +110 -0
- package/dist/assemble-fat-document.js.map +1 -0
- package/dist/clone-block.d.ts +3 -0
- package/dist/clone-block.d.ts.map +1 -0
- package/dist/clone-block.js +4 -0
- package/dist/clone-block.js.map +1 -0
- package/dist/collect-candidates.d.ts +8 -0
- package/dist/collect-candidates.d.ts.map +1 -0
- package/dist/collect-candidates.js +41 -0
- package/dist/collect-candidates.js.map +1 -0
- package/dist/fat-output-path.d.ts +2 -0
- package/dist/fat-output-path.d.ts.map +1 -0
- package/dist/fat-output-path.js +9 -0
- package/dist/fat-output-path.js.map +1 -0
- package/dist/fatblock-target.d.ts +16 -0
- package/dist/fatblock-target.d.ts.map +1 -0
- package/dist/fatblock-target.js +48 -0
- package/dist/fatblock-target.js.map +1 -0
- package/dist/filter-includes.d.ts +3 -0
- package/dist/filter-includes.d.ts.map +1 -0
- package/dist/filter-includes.js +14 -0
- package/dist/filter-includes.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/merge-namespace-bindings.d.ts +10 -0
- package/dist/merge-namespace-bindings.d.ts.map +1 -0
- package/dist/merge-namespace-bindings.js +23 -0
- package/dist/merge-namespace-bindings.js.map +1 -0
- package/dist/options.d.ts +13 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +13 -0
- package/dist/options.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
FatBlock Documentation — NamespaceMergeRules
|
|
3
|
+
FQN: org.blockml.bml.target.fatblock.documentation.NamespaceMergeRules
|
|
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:bomblock="org.blockml.bml.bom.block"
|
|
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:fatblock="org.blockml.bml.target.fatblock"
|
|
18
|
+
xmlns:fbapi="org.blockml.bml.target.fatblock.api"
|
|
19
|
+
xmlns:fbcap="org.blockml.bml.target.fatblock.capability"
|
|
20
|
+
xmlns:fbconfig="org.blockml.bml.target.fatblock.config"
|
|
21
|
+
xmlns:fbdocumentation="org.blockml.bml.target.fatblock.documentation"
|
|
22
|
+
xmlns:serializer="org.blockml.bml.compiler.serializer"
|
|
23
|
+
xmlns:type="org.blockml.bml.type"
|
|
24
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
25
|
+
|
|
26
|
+
<name>NamespaceMergeRules</name>
|
|
27
|
+
<type>fbdocumentation:NamespaceMergeRules</type>
|
|
28
|
+
<baseType>core:Documentation</baseType>
|
|
29
|
+
<is>Stage-2 namespace merge before emit (FB9–FB11, D2)</is>
|
|
30
|
+
|
|
31
|
+
<documentation>FB9: merge host bindings first, then each embed source in candidate order.
|
|
32
|
+
FB11: missing bindings default empty prefix to http://blockml.org/bml.
|
|
33
|
+
FB10: same prefix, different URI → BML_NAMESPACE_PREFIX_COLLISION (no silent rewrite;
|
|
34
|
+
no inventing new prefixes). First writer wins for new prefixes.
|
|
35
|
+
|
|
36
|
+
Aligns with docs/19 Definition / bml:xml D2 consumer rules. Serializer may still emit
|
|
37
|
+
BML_NAMESPACE_UNBOUND if a QName lacks a binding after merge.</documentation>
|
|
38
|
+
<references>
|
|
39
|
+
<see type="fbdocumentation:OutputLayout" relation="ReadNext"></see>
|
|
40
|
+
</references>
|
|
41
|
+
|
|
42
|
+
</block>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
FatBlock Documentation — OutputLayout
|
|
3
|
+
FQN: org.blockml.bml.target.fatblock.documentation.OutputLayout
|
|
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:bomblock="org.blockml.bml.bom.block"
|
|
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:fatblock="org.blockml.bml.target.fatblock"
|
|
18
|
+
xmlns:fbapi="org.blockml.bml.target.fatblock.api"
|
|
19
|
+
xmlns:fbcap="org.blockml.bml.target.fatblock.capability"
|
|
20
|
+
xmlns:fbconfig="org.blockml.bml.target.fatblock.config"
|
|
21
|
+
xmlns:fbdocumentation="org.blockml.bml.target.fatblock.documentation"
|
|
22
|
+
xmlns:serializer="org.blockml.bml.compiler.serializer"
|
|
23
|
+
xmlns:type="org.blockml.bml.type"
|
|
24
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
25
|
+
|
|
26
|
+
<name>OutputLayout</name>
|
|
27
|
+
<type>fbdocumentation:OutputLayout</type>
|
|
28
|
+
<baseType>core:Documentation</baseType>
|
|
29
|
+
<is>Output file naming and host write path</is>
|
|
30
|
+
|
|
31
|
+
<documentation>FB18 FatOutputBasename: Host.bml → Host.fat.bml (strip .bml, append .fat.bml).
|
|
32
|
+
Target returns relative path only; CLI writes beside host or under --out.
|
|
33
|
+
|
|
34
|
+
Single file per render. Content is canonical BML XML from SerializeFatDocument
|
|
35
|
+
(indent 2, no XML declaration by serializer defaults).</documentation>
|
|
36
|
+
<references>
|
|
37
|
+
<see type="fbdocumentation:Diagnostics" relation="ReadNext"></see>
|
|
38
|
+
</references>
|
|
39
|
+
|
|
40
|
+
</block>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
FatBlock Documentation — PackageOwnership
|
|
3
|
+
FQN: org.blockml.bml.target.fatblock.documentation.PackageOwnership
|
|
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:bomblock="org.blockml.bml.bom.block"
|
|
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:fatblock="org.blockml.bml.target.fatblock"
|
|
18
|
+
xmlns:fbapi="org.blockml.bml.target.fatblock.api"
|
|
19
|
+
xmlns:fbcap="org.blockml.bml.target.fatblock.capability"
|
|
20
|
+
xmlns:fbconfig="org.blockml.bml.target.fatblock.config"
|
|
21
|
+
xmlns:fbdocumentation="org.blockml.bml.target.fatblock.documentation"
|
|
22
|
+
xmlns:serializer="org.blockml.bml.compiler.serializer"
|
|
23
|
+
xmlns:type="org.blockml.bml.type"
|
|
24
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
25
|
+
|
|
26
|
+
<name>PackageOwnership</name>
|
|
27
|
+
<type>fbdocumentation:PackageOwnership</type>
|
|
28
|
+
<baseType>core:Documentation</baseType>
|
|
29
|
+
<is>Who owns FatBlock vs CLI vs BOM</is>
|
|
30
|
+
|
|
31
|
+
<documentation>@blockml/fatblock-target owns: this BML library; TypeScript assemble/filter/merge/emit;
|
|
32
|
+
FatBlockOptions; BML_FATBLOCK_* diagnostics; output basename algorithm.
|
|
33
|
+
|
|
34
|
+
@blockml/cli owns: --src / --include / --out; host file required; separate registry
|
|
35
|
+
bootstrap for fatblock; writing Host.fat.bml; exit codes.
|
|
36
|
+
See org.blockml.bml.cli.documentation.CompileCommand.
|
|
37
|
+
|
|
38
|
+
@blockml/bom owns: embeddedBlocks shape and language invariants.
|
|
39
|
+
|
|
40
|
+
@blockml/serializer owns: XML emit of the assembled BomDocument.
|
|
41
|
+
|
|
42
|
+
@blockml/compiler owns: RenderTarget contract and document compile scope.</documentation>
|
|
43
|
+
<references>
|
|
44
|
+
<see type="fbdocumentation:ScopeExclusions" relation="ReadNext"></see>
|
|
45
|
+
</references>
|
|
46
|
+
|
|
47
|
+
</block>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
FatBlock Documentation — PublicApi
|
|
3
|
+
FQN: org.blockml.bml.target.fatblock.documentation.PublicApi
|
|
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:bomblock="org.blockml.bml.bom.block"
|
|
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:fatblock="org.blockml.bml.target.fatblock"
|
|
18
|
+
xmlns:fbapi="org.blockml.bml.target.fatblock.api"
|
|
19
|
+
xmlns:fbcap="org.blockml.bml.target.fatblock.capability"
|
|
20
|
+
xmlns:fbconfig="org.blockml.bml.target.fatblock.config"
|
|
21
|
+
xmlns:fbdocumentation="org.blockml.bml.target.fatblock.documentation"
|
|
22
|
+
xmlns:serializer="org.blockml.bml.compiler.serializer"
|
|
23
|
+
xmlns:type="org.blockml.bml.type"
|
|
24
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
25
|
+
|
|
26
|
+
<name>PublicApi</name>
|
|
27
|
+
<type>fbdocumentation:PublicApi</type>
|
|
28
|
+
<baseType>core:Documentation</baseType>
|
|
29
|
+
<is>Public TypeScript and capability surface</is>
|
|
30
|
+
|
|
31
|
+
<documentation>Package @blockml/fatblock-target exports:
|
|
32
|
+
• FatBlockTarget — RenderTarget; name fatblock; accepts document;
|
|
33
|
+
validateRequest; render → FatBlockRenderOutput
|
|
34
|
+
• FatBlockOptions / DEFAULT_FATBLOCK_OPTIONS / resolveFatBlockOptions
|
|
35
|
+
• assembleFatDocument / serializeFatDocument / AssembleFatDocumentResult
|
|
36
|
+
• collectCandidateFqns / rootFqnsByFilePath
|
|
37
|
+
• filterByIncludes / matchesIncludePattern
|
|
38
|
+
• mergeNamespaceBindings / cloneBlockDefinition / fatOutputBasename
|
|
39
|
+
|
|
40
|
+
BML: fbcap:Render, ValidateRequest, AssembleFatDocument, api/FatBlockOptions.</documentation>
|
|
41
|
+
<references>
|
|
42
|
+
<see type="fbdocumentation:CandidateCollection" relation="ReadNext"></see>
|
|
43
|
+
<see type="fbcap:Render" relation="Defines"></see>
|
|
44
|
+
<see type="fbapi:FatBlockOptions" relation="Defines"></see>
|
|
45
|
+
<see type="fbcap:AssembleFatDocument" relation="Defines"></see>
|
|
46
|
+
</references>
|
|
47
|
+
|
|
48
|
+
</block>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
FatBlock Documentation — ScopeExclusions
|
|
3
|
+
FQN: org.blockml.bml.target.fatblock.documentation.ScopeExclusions
|
|
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:bomblock="org.blockml.bml.bom.block"
|
|
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:fatblock="org.blockml.bml.target.fatblock"
|
|
18
|
+
xmlns:fbapi="org.blockml.bml.target.fatblock.api"
|
|
19
|
+
xmlns:fbcap="org.blockml.bml.target.fatblock.capability"
|
|
20
|
+
xmlns:fbconfig="org.blockml.bml.target.fatblock.config"
|
|
21
|
+
xmlns:fbdocumentation="org.blockml.bml.target.fatblock.documentation"
|
|
22
|
+
xmlns:serializer="org.blockml.bml.compiler.serializer"
|
|
23
|
+
xmlns:type="org.blockml.bml.type"
|
|
24
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
25
|
+
|
|
26
|
+
<name>ScopeExclusions</name>
|
|
27
|
+
<type>fbdocumentation:ScopeExclusions</type>
|
|
28
|
+
<baseType>core:Documentation</baseType>
|
|
29
|
+
<is>Explicitly out of FatBlock V1 library scope</is>
|
|
30
|
+
|
|
31
|
+
<documentation>Out of scope for this library / V1:
|
|
32
|
+
• Transitive dependency-closure candidate selection (planned v2)
|
|
33
|
+
• Alternative embeddedBlocksStrategy behaviors beyond empty-embeds error
|
|
34
|
+
• Inventing or rewriting xmlns prefixes
|
|
35
|
+
• CLI flag parsing and file I/O
|
|
36
|
+
• Unused @blockml/parser package dependency (registry pre-loaded by host)
|
|
37
|
+
• Codegen from BML to TypeScript (structural SSOT only)
|
|
38
|
+
• BlockDoc / XSD / SCAD targets</documentation>
|
|
39
|
+
|
|
40
|
+
</block>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
FatBlock Documentation — V1Scope
|
|
3
|
+
FQN: org.blockml.bml.target.fatblock.documentation.V1Scope
|
|
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:bomblock="org.blockml.bml.bom.block"
|
|
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:fatblock="org.blockml.bml.target.fatblock"
|
|
18
|
+
xmlns:fbapi="org.blockml.bml.target.fatblock.api"
|
|
19
|
+
xmlns:fbcap="org.blockml.bml.target.fatblock.capability"
|
|
20
|
+
xmlns:fbconfig="org.blockml.bml.target.fatblock.config"
|
|
21
|
+
xmlns:fbdocumentation="org.blockml.bml.target.fatblock.documentation"
|
|
22
|
+
xmlns:serializer="org.blockml.bml.compiler.serializer"
|
|
23
|
+
xmlns:type="org.blockml.bml.type"
|
|
24
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
25
|
+
|
|
26
|
+
<name>V1Scope</name>
|
|
27
|
+
<type>fbdocumentation:V1Scope</type>
|
|
28
|
+
<baseType>core:Documentation</baseType>
|
|
29
|
+
<is>V1 folder pool vs planned closure</is>
|
|
30
|
+
|
|
31
|
+
<documentation>V1 implemented:
|
|
32
|
+
• Registry name fatblock; accepts document only
|
|
33
|
+
• Required srcDir peer pool of root blocks under that directory
|
|
34
|
+
• Optional include exact / prefix* filters
|
|
35
|
+
• Reject host or embed that already declares embeddedBlocks
|
|
36
|
+
• Flat root embeddedBlocks; preserve embed subBlocks[]
|
|
37
|
+
• Namespace binding union with collision errors
|
|
38
|
+
• Serialize via @blockml/serializer indent 2 → Host.fat.bml
|
|
39
|
+
|
|
40
|
+
Not V1 (see ScopeExclusions):
|
|
41
|
+
• Transitive registry-closure candidate set (v2)
|
|
42
|
+
• Alternative embeddedBlocksStrategy values beyond hardcoded empty-embeds error
|
|
43
|
+
• Inventing or rewriting xmlns prefixes
|
|
44
|
+
• Nested / pre-fatted host merge</documentation>
|
|
45
|
+
<references>
|
|
46
|
+
<see type="fbdocumentation:PublicApi" relation="ReadNext"></see>
|
|
47
|
+
</references>
|
|
48
|
+
|
|
49
|
+
</block>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BomDocument, Diagnostic } from "@blockml/bom";
|
|
2
|
+
import type { TypeRegistry } from "@blockml/framework";
|
|
3
|
+
import type { FatBlockOptions } from "./options.js";
|
|
4
|
+
export interface AssembleFatDocumentResult {
|
|
5
|
+
document: BomDocument | null;
|
|
6
|
+
diagnostics: Diagnostic[];
|
|
7
|
+
}
|
|
8
|
+
export declare function assembleFatDocument(registry: TypeRegistry, hostFilePath: string, options: FatBlockOptions, rootDir: string): AssembleFatDocumentResult;
|
|
9
|
+
export declare function serializeFatDocument(document: BomDocument): {
|
|
10
|
+
text: string | null;
|
|
11
|
+
diagnostics: Diagnostic[];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=assemble-fat-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble-fat-document.d.ts","sourceRoot":"","sources":["../src/assemble-fat-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAmB,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAsCD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,GACd,yBAAyB,CAkI3B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,GAAG;IAC3D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAMA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { serialize } from "@blockml/serializer";
|
|
2
|
+
import { cloneBlockDefinition } from "./clone-block.js";
|
|
3
|
+
import { collectCandidateFqns, rootFqnsByFilePath } from "./collect-candidates.js";
|
|
4
|
+
import { mergeNamespaceBindings } from "./merge-namespace-bindings.js";
|
|
5
|
+
function diagnostic(code, message, file) {
|
|
6
|
+
return {
|
|
7
|
+
severity: "error",
|
|
8
|
+
code,
|
|
9
|
+
message,
|
|
10
|
+
source: { file, line: 1, column: 1 },
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function findHostDocument(registry, hostFilePath) {
|
|
14
|
+
const roots = rootFqnsByFilePath(registry);
|
|
15
|
+
const hostFqn = roots.get(hostFilePath);
|
|
16
|
+
if (!hostFqn) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return registry.get(hostFqn);
|
|
20
|
+
}
|
|
21
|
+
function getRootBlockForFqn(registry, fqn) {
|
|
22
|
+
const doc = registry.get(fqn);
|
|
23
|
+
if (!doc || doc.block.type !== fqn) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return doc.block;
|
|
27
|
+
}
|
|
28
|
+
export function assembleFatDocument(registry, hostFilePath, options, rootDir) {
|
|
29
|
+
const diagnostics = [];
|
|
30
|
+
const srcDir = options.srcDir;
|
|
31
|
+
if (!srcDir) {
|
|
32
|
+
diagnostics.push(diagnostic("BML_FATBLOCK_SRC_REQUIRED", "FatBlock requires targetOptions.srcDir (CLI: --src)", hostFilePath));
|
|
33
|
+
return { document: null, diagnostics };
|
|
34
|
+
}
|
|
35
|
+
const hostRoot = findHostDocument(registry, hostFilePath);
|
|
36
|
+
if (!hostRoot) {
|
|
37
|
+
diagnostics.push(diagnostic("BML_FATBLOCK_HOST_NOT_FOUND", `Host block not found in registry for ${hostFilePath}`, hostFilePath));
|
|
38
|
+
return { document: null, diagnostics };
|
|
39
|
+
}
|
|
40
|
+
const hostFqn = hostRoot.block.type;
|
|
41
|
+
if (hostRoot.block.embeddedBlocks.length > 0) {
|
|
42
|
+
diagnostics.push(diagnostic("BML_FATBLOCK_HOST_HAS_EMBEDDED_BLOCKS", "Host block already declares embeddedBlocks; FatBlock v1 requires an empty embeddedBlocks on the host", hostFilePath));
|
|
43
|
+
return { document: null, diagnostics };
|
|
44
|
+
}
|
|
45
|
+
const { fqns: candidateFqns } = collectCandidateFqns(registry, srcDir, rootDir, hostFqn, options.include);
|
|
46
|
+
const seen = new Set();
|
|
47
|
+
const embeddedBlocks = [];
|
|
48
|
+
const namespaceSources = [
|
|
49
|
+
{
|
|
50
|
+
file: hostFilePath,
|
|
51
|
+
...(hostRoot.source.namespaceBindings
|
|
52
|
+
? { bindings: hostRoot.source.namespaceBindings }
|
|
53
|
+
: {}),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
for (const fqn of candidateFqns) {
|
|
57
|
+
if (seen.has(fqn)) {
|
|
58
|
+
diagnostics.push(diagnostic("BML_DUPLICATE_EMBEDDED_BLOCK", `Duplicate embed candidate FQN: ${fqn}`, hostFilePath));
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
seen.add(fqn);
|
|
62
|
+
const sourceBlock = getRootBlockForFqn(registry, fqn);
|
|
63
|
+
const sourceDoc = registry.get(fqn);
|
|
64
|
+
if (!sourceBlock || !sourceDoc) {
|
|
65
|
+
diagnostics.push(diagnostic("BML_FATBLOCK_EMBED_NOT_FOUND", `Embed candidate not found in registry: ${fqn}`, hostFilePath));
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (sourceBlock.embeddedBlocks.length > 0) {
|
|
69
|
+
diagnostics.push(diagnostic("BML_FATBLOCK_EMBED_HAS_EMBEDDED_BLOCKS", `Embed candidate ${fqn} already declares embeddedBlocks`, sourceDoc.source.filePath ?? hostFilePath));
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const cloned = cloneBlockDefinition(sourceBlock);
|
|
73
|
+
cloned.embeddedBlocks = [];
|
|
74
|
+
embeddedBlocks.push(cloned);
|
|
75
|
+
namespaceSources.push({
|
|
76
|
+
file: sourceDoc.source.filePath ?? hostFilePath,
|
|
77
|
+
...(sourceDoc.source.namespaceBindings
|
|
78
|
+
? { bindings: sourceDoc.source.namespaceBindings }
|
|
79
|
+
: {}),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (diagnostics.some((d) => d.severity === "error")) {
|
|
83
|
+
return { document: null, diagnostics };
|
|
84
|
+
}
|
|
85
|
+
const { bindings, diagnostics: mergeDiagnostics } = mergeNamespaceBindings(namespaceSources);
|
|
86
|
+
diagnostics.push(...mergeDiagnostics);
|
|
87
|
+
if (mergeDiagnostics.some((d) => d.severity === "error")) {
|
|
88
|
+
return { document: null, diagnostics };
|
|
89
|
+
}
|
|
90
|
+
const assembled = {
|
|
91
|
+
kind: "block",
|
|
92
|
+
source: {
|
|
93
|
+
...hostRoot.source,
|
|
94
|
+
namespaceBindings: bindings,
|
|
95
|
+
},
|
|
96
|
+
block: {
|
|
97
|
+
...cloneBlockDefinition(hostRoot.block),
|
|
98
|
+
embeddedBlocks,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
return { document: assembled, diagnostics };
|
|
102
|
+
}
|
|
103
|
+
export function serializeFatDocument(document) {
|
|
104
|
+
const result = serialize(document, { indent: 2 });
|
|
105
|
+
return {
|
|
106
|
+
text: result.text,
|
|
107
|
+
diagnostics: result.diagnostics,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=assemble-fat-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble-fat-document.js","sourceRoot":"","sources":["../src/assemble-fat-document.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAA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block.js","sourceRoot":"","sources":["../src/clone-block.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,KAAsB;IACzD,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TypeRegistry } from "@blockml/framework";
|
|
2
|
+
/** Root FQN per file: the registry key not prefixed by another key from the same file. */
|
|
3
|
+
export declare function rootFqnsByFilePath(registry: TypeRegistry): Map<string, string>;
|
|
4
|
+
export declare function collectCandidateFqns(registry: TypeRegistry, srcDir: string, rootDir: string, hostFqn: string, includePatterns?: string[]): {
|
|
5
|
+
fqns: string[];
|
|
6
|
+
hostFilePath?: string;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=collect-candidates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-candidates.d.ts","sourceRoot":"","sources":["../src/collect-candidates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAcvD,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAE9E;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CA2B3C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { resolve, sep } from "node:path";
|
|
2
|
+
import { rootFqnByFilePath } from "@blockml/framework";
|
|
3
|
+
import { filterByIncludes } from "./filter-includes.js";
|
|
4
|
+
function normalizePath(p) {
|
|
5
|
+
return p.split(sep).join("/");
|
|
6
|
+
}
|
|
7
|
+
function isPathUnderDir(filePath, dirPath) {
|
|
8
|
+
const file = normalizePath(resolve(filePath));
|
|
9
|
+
const dir = normalizePath(resolve(dirPath));
|
|
10
|
+
return file === dir || file.startsWith(`${dir}/`);
|
|
11
|
+
}
|
|
12
|
+
/** Root FQN per file: the registry key not prefixed by another key from the same file. */
|
|
13
|
+
export function rootFqnsByFilePath(registry) {
|
|
14
|
+
return rootFqnByFilePath(registry);
|
|
15
|
+
}
|
|
16
|
+
export function collectCandidateFqns(registry, srcDir, rootDir, hostFqn, includePatterns) {
|
|
17
|
+
const absSrc = resolve(rootDir, srcDir);
|
|
18
|
+
const roots = rootFqnsByFilePath(registry);
|
|
19
|
+
const candidates = [];
|
|
20
|
+
let hostFilePath;
|
|
21
|
+
for (const [filePath, fqn] of roots) {
|
|
22
|
+
if (!isPathUnderDir(filePath, absSrc)) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (fqn === hostFqn) {
|
|
26
|
+
hostFilePath = filePath;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
candidates.push(fqn);
|
|
30
|
+
}
|
|
31
|
+
let fqns = candidates.sort();
|
|
32
|
+
if (includePatterns?.length) {
|
|
33
|
+
fqns = filterByIncludes(fqns, includePatterns);
|
|
34
|
+
}
|
|
35
|
+
const result = { fqns };
|
|
36
|
+
if (hostFilePath !== undefined) {
|
|
37
|
+
result.hostFilePath = hostFilePath;
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=collect-candidates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-candidates.js","sourceRoot":"","sources":["../src/collect-candidates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,s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AC5B,IAAI,GAAG,gBAAgB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,MAAM,GAA8C,EAAE,IAAI,EAAE,CAAC;IACnE,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fat-output-path.d.ts","sourceRoot":"","sources":["../src/fat-output-path.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAM9D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
export function fatOutputBasename(hostFilePath) {
|
|
3
|
+
const base = basename(hostFilePath);
|
|
4
|
+
if (base.endsWith(".bml")) {
|
|
5
|
+
return `${base.slice(0, -4)}.fat.bml`;
|
|
6
|
+
}
|
|
7
|
+
return `${base}.fat.bml`;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=fat-output-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fat-output-path.js","sourceRoot":"","sources":["../src/fat-output-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,UAAU,iBAAiB,CAAC,YAAoB;IACpD,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACpC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IACxC,CAAC;IACD,OAAO,GAAG,IAAI,UAAU,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CompileRequest, RenderContext, RenderOutput, RenderTarget } from "@blockml/compiler";
|
|
2
|
+
import type { Diagnostic } from "@blockml/bom";
|
|
3
|
+
export interface FatBlockRenderOutput extends RenderOutput {
|
|
4
|
+
files: {
|
|
5
|
+
path: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}[];
|
|
8
|
+
diagnostics?: Diagnostic[];
|
|
9
|
+
}
|
|
10
|
+
export declare class FatBlockTarget implements RenderTarget {
|
|
11
|
+
readonly name = "fatblock";
|
|
12
|
+
readonly accepts: Array<"document">;
|
|
13
|
+
validateRequest(request: CompileRequest): Diagnostic[];
|
|
14
|
+
render(request: CompileRequest, ctx: RenderContext): FatBlockRenderOutput;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=fatblock-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fatblock-target.d.ts","sourceRoot":"","sources":["../src/fatblock-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B;AAED,qBAAa,cAAe,YAAW,YAAY;IACjD,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAgB;IAEnD,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,UAAU,EAAE;IAetD,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,oBAAoB;CAuC1E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { assembleFatDocument, serializeFatDocument } from "./assemble-fat-document.js";
|
|
2
|
+
import { fatOutputBasename } from "./fat-output-path.js";
|
|
3
|
+
import { resolveFatBlockOptions } from "./options.js";
|
|
4
|
+
export class FatBlockTarget {
|
|
5
|
+
name = "fatblock";
|
|
6
|
+
accepts = ["document"];
|
|
7
|
+
validateRequest(request) {
|
|
8
|
+
const options = resolveFatBlockOptions(request.targetOptions);
|
|
9
|
+
if (!options.srcDir) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
severity: "error",
|
|
13
|
+
code: "BML_FATBLOCK_SRC_REQUIRED",
|
|
14
|
+
message: "FatBlock requires targetOptions.srcDir (CLI: --src)",
|
|
15
|
+
source: { file: "<config>", line: 1, column: 1 },
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
render(request, ctx) {
|
|
22
|
+
const options = resolveFatBlockOptions(request.targetOptions);
|
|
23
|
+
const rootDir = options.rootDir ?? process.cwd();
|
|
24
|
+
const hostFilePath = ctx.session.sourceFilePath;
|
|
25
|
+
const { document, diagnostics } = assembleFatDocument(ctx.session.typeRegistry, hostFilePath, options, rootDir);
|
|
26
|
+
if (!document || diagnostics.some((d) => d.severity === "error")) {
|
|
27
|
+
return { files: [], diagnostics };
|
|
28
|
+
}
|
|
29
|
+
const serialized = serializeFatDocument(document);
|
|
30
|
+
if (!serialized.text ||
|
|
31
|
+
serialized.diagnostics.some((d) => d.severity === "error")) {
|
|
32
|
+
return {
|
|
33
|
+
files: [],
|
|
34
|
+
diagnostics: [...diagnostics, ...serialized.diagnostics],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
files: [
|
|
39
|
+
{
|
|
40
|
+
path: fatOutputBasename(hostFilePath),
|
|
41
|
+
content: serialized.text,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
diagnostics: [...diagnostics, ...serialized.diagnostics].filter((d) => d.severity !== "info"),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=fatblock-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fatblock-target.js","sourceRoot":"","sources":["../src/fatblock-target.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAOtD,MAAM,OAAO,cAAc;IAChB,IAAI,GAAG,UAAU,CAAC;IAClB,OAAO,GAAsB,CAAC,UAAU,CAAC,CAAC;IAEnD,eAAe,CAAC,OAAuB;QACrC,MAAM,OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO;gBACL;oBACE,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,2BAA2B;oBACjC,OAAO,EAAE,qDAAqD;oBAC9D,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;iBACjD;aACF,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,OAAuB,EAAE,GAAkB;QAChD,MAAM,OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACjD,MAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC;QAEhD,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,mBAAmB,CACnD,GAAG,CAAC,OAAO,CAAC,YAAY,EACxB,YAAY,EACZ,OAAO,E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
1
|
+
export function matchesIncludePattern(fqn, pattern) {
|
|
2
|
+
if (pattern.endsWith("*")) {
|
|
3
|
+
const prefix = pattern.slice(0, -1);
|
|
4
|
+
return fqn.startsWith(prefix);
|
|
5
|
+
}
|
|
6
|
+
return fqn === pattern;
|
|
7
|
+
}
|
|
8
|
+
export function filterByIncludes(fqns, patterns) {
|
|
9
|
+
if (!patterns?.length) {
|
|
10
|
+
return fqns;
|
|
11
|
+
}
|
|
12
|
+
return fqns.filter((fqn) => patterns.some((pattern) => matchesIncludePattern(fqn, pattern.trim())));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=filter-includes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-includes.js","sourceRoot":"","sources":["../src/filter-includes.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,OAAe;IAChE,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,GAAG,KAAK,OAAO,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAc,EAAE,QAAmB;IAClE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CACzB,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CACvE,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { FatBlockTarget, type FatBlockRenderOutput } from "./fatblock-target.js";
|
|
2
|
+
export { type FatBlockOptions, resolveFatBlockOptions, DEFAULT_FATBLOCK_OPTIONS, } from "./options.js";
|
|
3
|
+
export { collectCandidateFqns, rootFqnsByFilePath } from "./collect-candidates.js";
|
|
4
|
+
export { filterByIncludes, matchesIncludePattern } from "./filter-includes.js";
|
|
5
|
+
export { mergeNamespaceBindings } from "./merge-namespace-bindings.js";
|
|
6
|
+
export { assembleFatDocument, serializeFatDocument, type AssembleFatDocumentResult, } from "./assemble-fat-document.js";
|
|
7
|
+
export { fatOutputBasename } from "./fat-output-path.js";
|
|
8
|
+
export { cloneBlockDefinition } from "./clone-block.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EACL,KAAK,eAAe,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|