@blockml/xsd-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/xsd/Library.bml +94 -0
- package/blocks/org/blockml/bml/target/xsd/README.bml +56 -0
- package/blocks/org/blockml/bml/target/xsd/XsdType.bml +31 -0
- package/blocks/org/blockml/bml/target/xsd/api/CatalogEntry.bml +33 -0
- package/blocks/org/blockml/bml/target/xsd/api/XsdOptions.bml +38 -0
- package/blocks/org/blockml/bml/target/xsd/api/XsdRenderOutput.bml +34 -0
- package/blocks/org/blockml/bml/target/xsd/capability/CatalogRelativePath.bml +42 -0
- package/blocks/org/blockml/bml/target/xsd/capability/EmitBlockXsd.bml +43 -0
- package/blocks/org/blockml/bml/target/xsd/capability/EmitCatalogXml.bml +43 -0
- package/blocks/org/blockml/bml/target/xsd/capability/EmitServiceXsd.bml +43 -0
- package/blocks/org/blockml/bml/target/xsd/capability/EmitTypesXsd.bml +43 -0
- package/blocks/org/blockml/bml/target/xsd/capability/ExtraElementNames.bml +43 -0
- package/blocks/org/blockml/bml/target/xsd/capability/MemberPrefersElement.bml +43 -0
- package/blocks/org/blockml/bml/target/xsd/capability/Render.bml +47 -0
- package/blocks/org/blockml/bml/target/xsd/capability/ResolveOptions.bml +44 -0
- package/blocks/org/blockml/bml/target/xsd/capability/VocabularyElements.bml +42 -0
- package/blocks/org/blockml/bml/target/xsd/config/DefaultXsdOptions.bml +33 -0
- package/blocks/org/blockml/bml/target/xsd/config/XsdConstants.bml +42 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/ArchitectureOverview.bml +45 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/CatalogAndOutputLayout.bml +45 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/DesignDecisions.bml +49 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/Diagnostics.bml +38 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/DomainVocabularyRules.bml +41 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/Introduction.bml +50 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/LayerSeparation.bml +42 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/PackageOwnership.bml +43 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/ParticleMappingRules.bml +49 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/PublicApi.bml +45 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/ScopeExclusions.bml +41 -0
- package/blocks/org/blockml/bml/target/xsd/documentation/V1Scope.bml +46 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -0
- package/dist/emit-block-xsd.d.ts +3 -0
- package/dist/emit-block-xsd.d.ts.map +1 -0
- package/dist/emit-block-xsd.js +122 -0
- package/dist/emit-block-xsd.js.map +1 -0
- package/dist/emit-catalog-xml.d.ts +7 -0
- package/dist/emit-catalog-xml.d.ts.map +1 -0
- package/dist/emit-catalog-xml.js +15 -0
- package/dist/emit-catalog-xml.js.map +1 -0
- package/dist/emit-service-xsd.d.ts +3 -0
- package/dist/emit-service-xsd.d.ts.map +1 -0
- package/dist/emit-service-xsd.js +34 -0
- package/dist/emit-service-xsd.js.map +1 -0
- package/dist/emit-types-xsd.d.ts +3 -0
- package/dist/emit-types-xsd.d.ts.map +1 -0
- package/dist/emit-types-xsd.js +34 -0
- package/dist/emit-types-xsd.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +9 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +12 -0
- package/dist/options.js.map +1 -0
- package/dist/xsd-target.d.ts +17 -0
- package/dist/xsd-target.d.ts.map +1 -0
- package/dist/xsd-target.js +53 -0
- package/dist/xsd-target.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
XSD Documentation — ScopeExclusions
|
|
3
|
+
FQN: org.blockml.bml.target.xsd.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:cli="org.blockml.bml.cli"
|
|
15
|
+
xmlns:core="org.blockml.bml.core"
|
|
16
|
+
xmlns:def="org.blockml.bml.definition"
|
|
17
|
+
xmlns:xsd="org.blockml.bml.target.xsd"
|
|
18
|
+
xmlns:xsdapi="org.blockml.bml.target.xsd.api"
|
|
19
|
+
xmlns:xsdcap="org.blockml.bml.target.xsd.capability"
|
|
20
|
+
xmlns:xsdconfig="org.blockml.bml.target.xsd.config"
|
|
21
|
+
xmlns:xsddocumentation="org.blockml.bml.target.xsd.documentation"
|
|
22
|
+
xmlns:type="org.blockml.bml.type"
|
|
23
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
24
|
+
|
|
25
|
+
<name>ScopeExclusions</name>
|
|
26
|
+
<type>xsddocumentation:ScopeExclusions</type>
|
|
27
|
+
<baseType>core:Documentation</baseType>
|
|
28
|
+
<is>Explicitly out of XSD V1 library scope</is>
|
|
29
|
+
|
|
30
|
+
<documentation>Out of scope for this library / V1:
|
|
31
|
+
• Authoring validation against generated XSD (--no-xsd, xsdValidation)
|
|
32
|
+
• Full D1 particle fidelity (attributes, text, nested content models)
|
|
33
|
+
• Pure Definition-driven particle lists without hardcoded D1 arrays
|
|
34
|
+
• includeNonExported filtering effect
|
|
35
|
+
• MachineBlocks / product domain schemas
|
|
36
|
+
• Package-local emit diagnostics
|
|
37
|
+
• CLI flag parsing and file I/O
|
|
38
|
+
• Codegen from BML to TypeScript (structural SSOT only)
|
|
39
|
+
• BlockDoc / FatBlock / SCAD targets</documentation>
|
|
40
|
+
|
|
41
|
+
</block>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
XSD Documentation — V1Scope
|
|
3
|
+
FQN: org.blockml.bml.target.xsd.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:cli="org.blockml.bml.cli"
|
|
15
|
+
xmlns:core="org.blockml.bml.core"
|
|
16
|
+
xmlns:def="org.blockml.bml.definition"
|
|
17
|
+
xmlns:xsd="org.blockml.bml.target.xsd"
|
|
18
|
+
xmlns:xsdapi="org.blockml.bml.target.xsd.api"
|
|
19
|
+
xmlns:xsdcap="org.blockml.bml.target.xsd.capability"
|
|
20
|
+
xmlns:xsdconfig="org.blockml.bml.target.xsd.config"
|
|
21
|
+
xmlns:xsddocumentation="org.blockml.bml.target.xsd.documentation"
|
|
22
|
+
xmlns:type="org.blockml.bml.type"
|
|
23
|
+
xmlns:doc="org.blockml.bml.documentation">
|
|
24
|
+
|
|
25
|
+
<name>V1Scope</name>
|
|
26
|
+
<type>xsddocumentation:V1Scope</type>
|
|
27
|
+
<baseType>core:Documentation</baseType>
|
|
28
|
+
<is>What V1 delivers</is>
|
|
29
|
+
|
|
30
|
+
<documentation>V1 includes:
|
|
31
|
+
• Registry name xsd; accepts library, corpus, auto
|
|
32
|
+
• Always bml.xsd: D1 identity + container lists + registry extras; no element xs:any;
|
|
33
|
+
anyAttribute processContents=lax; mixed=true root block
|
|
34
|
+
• Weak xmlRendering filter (MemberPrefersElement) — not full D1 fidelity
|
|
35
|
+
• Optional types.xsd / service.xsd as xs:string vocabularies when emitDomainSchemas
|
|
36
|
+
• Always OASIS catalog.xml via rootFiles
|
|
37
|
+
• No package-local emit diagnostics
|
|
38
|
+
• includeNonExported reserved unused
|
|
39
|
+
|
|
40
|
+
V1 does NOT include authoring XSD validation, MachineBlocks domain schemas,
|
|
41
|
+
or full attribute/text/nested particle models from Definition.</documentation>
|
|
42
|
+
<references>
|
|
43
|
+
<see type="xsddocumentation:PublicApi" relation="ReadNext"></see>
|
|
44
|
+
</references>
|
|
45
|
+
|
|
46
|
+
</block>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const BML_DOCUMENT_NS = "http://blockml.org/bml";
|
|
2
|
+
export declare const BML_TYPES_NS = "http://blockml.org/schema/types";
|
|
3
|
+
export declare const BML_SERVICE_NS = "http://blockml.org/schema/service";
|
|
4
|
+
export declare const TYPE_FQN_PREFIX = "org.blockml.bml.type.";
|
|
5
|
+
export declare const SERVICE_FQN_PREFIX = "org.blockml.bml.service.";
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,2BAA2B,CAAC;AACxD,eAAO,MAAM,YAAY,oCAAoC,CAAC;AAC9D,eAAO,MAAM,cAAc,sCAAsC,CAAC;AAClE,eAAO,MAAM,eAAe,0BAA0B,CAAC;AACvD,eAAO,MAAM,kBAAkB,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const BML_DOCUMENT_NS = "http://blockml.org/bml";
|
|
2
|
+
export const BML_TYPES_NS = "http://blockml.org/schema/types";
|
|
3
|
+
export const BML_SERVICE_NS = "http://blockml.org/schema/service";
|
|
4
|
+
export const TYPE_FQN_PREFIX = "org.blockml.bml.type.";
|
|
5
|
+
export const SERVICE_FQN_PREFIX = "org.blockml.bml.service.";
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACxD,MAAM,CAAC,MAAM,YAAY,GAAG,iCAAiC,CAAC;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAG,mCAAmC,CAAC;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-block-xsd.d.ts","sourceRoot":"","sources":["../src/emit-block-xsd.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAsGvD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAgC3D"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { BML_DOCUMENT_NS } from "./constants.js";
|
|
2
|
+
/** D1 definition-document identity / prose particles. */
|
|
3
|
+
const D1_IDENTITY_ELEMENTS = [
|
|
4
|
+
"name",
|
|
5
|
+
"type",
|
|
6
|
+
"baseType",
|
|
7
|
+
"is",
|
|
8
|
+
"isNot",
|
|
9
|
+
"isnot",
|
|
10
|
+
"version",
|
|
11
|
+
"summary",
|
|
12
|
+
"documentation",
|
|
13
|
+
"abstract",
|
|
14
|
+
"final",
|
|
15
|
+
"since",
|
|
16
|
+
"status",
|
|
17
|
+
"language",
|
|
18
|
+
"keywords",
|
|
19
|
+
"aliases",
|
|
20
|
+
];
|
|
21
|
+
/** D1 aggregation / structured containers. */
|
|
22
|
+
const D1_CONTAINER_ELEMENTS = [
|
|
23
|
+
"properties",
|
|
24
|
+
"aggregations",
|
|
25
|
+
"associations",
|
|
26
|
+
"capabilities",
|
|
27
|
+
"subBlocks",
|
|
28
|
+
"embeddedBlocks",
|
|
29
|
+
"references",
|
|
30
|
+
"examples",
|
|
31
|
+
"changelog",
|
|
32
|
+
"constraints",
|
|
33
|
+
"suggestions",
|
|
34
|
+
"composition",
|
|
35
|
+
"implementation",
|
|
36
|
+
"groups",
|
|
37
|
+
"contracts",
|
|
38
|
+
"genericTypes",
|
|
39
|
+
];
|
|
40
|
+
const META_DEFINITION_FQNS = [
|
|
41
|
+
"org.blockml.bml.definition.BlockDefinition",
|
|
42
|
+
"org.blockml.bml.definition.StructuralDefinition",
|
|
43
|
+
"org.blockml.bml.definition.MemberDefinition",
|
|
44
|
+
"org.blockml.bml.definition.RootBlockDefinition",
|
|
45
|
+
];
|
|
46
|
+
function memberPrefersElement(member) {
|
|
47
|
+
const rendering = member.xmlRendering;
|
|
48
|
+
if (rendering?.kinds?.includes("element")) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (rendering?.raw?.includes("element")) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (rendering?.kinds?.length === 1 && rendering.kinds[0] === "attribute") {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (rendering?.raw === "attribute") {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (member.kind === "aggregation" || member.kind === "association") {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
function extraElementNamesFromBlock(block) {
|
|
66
|
+
const names = [];
|
|
67
|
+
for (const member of block.members) {
|
|
68
|
+
if (memberPrefersElement(member)) {
|
|
69
|
+
names.push(member.name);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const sub of block.subBlocks) {
|
|
73
|
+
names.push(...extraElementNamesFromBlock(sub));
|
|
74
|
+
}
|
|
75
|
+
return names;
|
|
76
|
+
}
|
|
77
|
+
function extraElementNames(registry) {
|
|
78
|
+
const names = [];
|
|
79
|
+
for (const fqn of META_DEFINITION_FQNS) {
|
|
80
|
+
const doc = registry.get(fqn);
|
|
81
|
+
if (doc) {
|
|
82
|
+
names.push(...extraElementNamesFromBlock(doc.block));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return names;
|
|
86
|
+
}
|
|
87
|
+
function uniqueSorted(values) {
|
|
88
|
+
return [...new Set(values)].sort();
|
|
89
|
+
}
|
|
90
|
+
function elementDecl(name) {
|
|
91
|
+
return ` <xs:element name="${name}" minOccurs="0" maxOccurs="unbounded"/>`;
|
|
92
|
+
}
|
|
93
|
+
export function emitBlockXsd(registry) {
|
|
94
|
+
const identity = uniqueSorted(D1_IDENTITY_ELEMENTS);
|
|
95
|
+
const containers = uniqueSorted(D1_CONTAINER_ELEMENTS);
|
|
96
|
+
const extras = extraElementNames(registry).filter((name) => !identity.includes(name) && !containers.includes(name));
|
|
97
|
+
const children = [
|
|
98
|
+
...identity.map(elementDecl),
|
|
99
|
+
...containers.map(elementDecl),
|
|
100
|
+
...extras.map(elementDecl),
|
|
101
|
+
].join("\n");
|
|
102
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
103
|
+
<xs:schema
|
|
104
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
105
|
+
targetNamespace="${BML_DOCUMENT_NS}"
|
|
106
|
+
xmlns="${BML_DOCUMENT_NS}"
|
|
107
|
+
elementFormDefault="qualified"
|
|
108
|
+
attributeFormDefault="unqualified">
|
|
109
|
+
|
|
110
|
+
<xs:element name="block">
|
|
111
|
+
<xs:complexType mixed="true">
|
|
112
|
+
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
|
113
|
+
${children}
|
|
114
|
+
</xs:choice>
|
|
115
|
+
<xs:anyAttribute processContents="lax"/>
|
|
116
|
+
</xs:complexType>
|
|
117
|
+
</xs:element>
|
|
118
|
+
|
|
119
|
+
</xs:schema>
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=emit-block-xsd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-block-xsd.js","sourceRoot":"","sources":["../src/emit-block-xsd.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface CatalogEntry {
|
|
2
|
+
namespaceUri: string;
|
|
3
|
+
relativePath: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function catalogRelativePath(outDir: string, schemaFileName: string): string;
|
|
6
|
+
export declare function emitCatalogXml(entries: CatalogEntry[]): string;
|
|
7
|
+
//# sourceMappingURL=emit-catalog-xml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-catalog-xml.d.ts","sourceRoot":"","sources":["../src/emit-catalog-xml.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGlF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAa9D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function catalogRelativePath(outDir, schemaFileName) {
|
|
2
|
+
const normalized = outDir.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
3
|
+
return `./${normalized}/${schemaFileName}`;
|
|
4
|
+
}
|
|
5
|
+
export function emitCatalogXml(entries) {
|
|
6
|
+
const uris = entries
|
|
7
|
+
.map((e) => ` <uri\n name="${e.namespaceUri}"\n uri="${e.relativePath}"/>`)
|
|
8
|
+
.join("\n");
|
|
9
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
10
|
+
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
|
11
|
+
${uris}
|
|
12
|
+
</catalog>
|
|
13
|
+
`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=emit-catalog-xml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-catalog-xml.js","sourceRoot":"","sources":["../src/emit-catalog-xml.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,cAAsB;IACxE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClE,OAAO,KAAK,UAAU,IAAI,cAAc,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAuB;IACpD,MAAM,IAAI,GAAG,OAAO;SACjB,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,qBAAqB,CAAC,CAAC,YAAY,eAAe,CAAC,CAAC,YAAY,KAAK,CACxE;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;EAEP,IAAI;;CAEL,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-service-xsd.d.ts","sourceRoot":"","sources":["../src/emit-service-xsd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgBvD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAqB7D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BML_SERVICE_NS, SERVICE_FQN_PREFIX } from "./constants.js";
|
|
2
|
+
function shortName(fqn) {
|
|
3
|
+
const idx = fqn.lastIndexOf(".");
|
|
4
|
+
return idx >= 0 ? fqn.slice(idx + 1) : fqn;
|
|
5
|
+
}
|
|
6
|
+
function vocabularyElements(registry, prefix) {
|
|
7
|
+
return registry
|
|
8
|
+
.keys()
|
|
9
|
+
.filter((fqn) => fqn.startsWith(prefix))
|
|
10
|
+
.map(shortName)
|
|
11
|
+
.sort();
|
|
12
|
+
}
|
|
13
|
+
export function emitServiceXsd(registry) {
|
|
14
|
+
const elements = vocabularyElements(registry, SERVICE_FQN_PREFIX);
|
|
15
|
+
const decls = elements
|
|
16
|
+
.map((name) => ` <xs:element name="${name}" type="xs:string"/>`)
|
|
17
|
+
.join("\n");
|
|
18
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
19
|
+
<xs:schema
|
|
20
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
21
|
+
targetNamespace="${BML_SERVICE_NS}"
|
|
22
|
+
xmlns="${BML_SERVICE_NS}"
|
|
23
|
+
elementFormDefault="qualified"
|
|
24
|
+
attributeFormDefault="unqualified">
|
|
25
|
+
|
|
26
|
+
<xs:annotation>
|
|
27
|
+
<xs:documentation>Generated vocabulary for ${SERVICE_FQN_PREFIX}*</xs:documentation>
|
|
28
|
+
</xs:annotation>
|
|
29
|
+
${decls}
|
|
30
|
+
|
|
31
|
+
</xs:schema>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=emit-service-xsd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-service-xsd.js","sourceRoot":"","sources":["../src/emit-service-xsd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC7C,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAsB,EAAE,MAAc;IAChE,OAAO,QAAQ;SACZ,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SACvC,GAAG,CAAC,SAAS,CAAC;SACd,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAsB;IACnD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IAClE,MAAM,KAAK,GAAG,QAAQ;SACnB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAuB,IAAI,sBAAsB,CAAC;SAChE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;qBAGY,cAAc;WACxB,cAAc;;;;;iDAKwB,kBAAkB;;EAEjE,KAAK;;;CAGN,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-types-xsd.d.ts","sourceRoot":"","sources":["../src/emit-types-xsd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgBvD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAqB3D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BML_TYPES_NS, TYPE_FQN_PREFIX } from "./constants.js";
|
|
2
|
+
function shortName(fqn) {
|
|
3
|
+
const idx = fqn.lastIndexOf(".");
|
|
4
|
+
return idx >= 0 ? fqn.slice(idx + 1) : fqn;
|
|
5
|
+
}
|
|
6
|
+
function vocabularyElements(registry, prefix) {
|
|
7
|
+
return registry
|
|
8
|
+
.keys()
|
|
9
|
+
.filter((fqn) => fqn.startsWith(prefix))
|
|
10
|
+
.map(shortName)
|
|
11
|
+
.sort();
|
|
12
|
+
}
|
|
13
|
+
export function emitTypesXsd(registry) {
|
|
14
|
+
const elements = vocabularyElements(registry, TYPE_FQN_PREFIX);
|
|
15
|
+
const decls = elements
|
|
16
|
+
.map((name) => ` <xs:element name="${name}" type="xs:string"/>`)
|
|
17
|
+
.join("\n");
|
|
18
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
19
|
+
<xs:schema
|
|
20
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
21
|
+
targetNamespace="${BML_TYPES_NS}"
|
|
22
|
+
xmlns="${BML_TYPES_NS}"
|
|
23
|
+
elementFormDefault="qualified"
|
|
24
|
+
attributeFormDefault="unqualified">
|
|
25
|
+
|
|
26
|
+
<xs:annotation>
|
|
27
|
+
<xs:documentation>Generated vocabulary for ${TYPE_FQN_PREFIX}*</xs:documentation>
|
|
28
|
+
</xs:annotation>
|
|
29
|
+
${decls}
|
|
30
|
+
|
|
31
|
+
</xs:schema>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=emit-types-xsd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-types-xsd.js","sourceRoot":"","sources":["../src/emit-types-xsd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/D,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC7C,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAsB,EAAE,MAAc;IAChE,OAAO,QAAQ;SACZ,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SACvC,GAAG,CAAC,SAAS,CAAC;SACd,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAsB;IACjD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,QAAQ;SACnB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAuB,IAAI,sBAAsB,CAAC;SAChE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;qBAGY,YAAY;WACtB,YAAY;;;;;iDAK0B,eAAe;;EAE9D,KAAK;;;CAGN,CAAC;AACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { XsdTarget, type XsdRenderOutput } from "./xsd-target.js";
|
|
2
|
+
export { type XsdOptions, resolveXsdOptions, DEFAULT_XSD_OPTIONS } from "./options.js";
|
|
3
|
+
export { emitBlockXsd } from "./emit-block-xsd.js";
|
|
4
|
+
export { emitTypesXsd } from "./emit-types-xsd.js";
|
|
5
|
+
export { emitServiceXsd } from "./emit-service-xsd.js";
|
|
6
|
+
export { emitCatalogXml, catalogRelativePath, type CatalogEntry, } from "./emit-catalog-xml.js";
|
|
7
|
+
export { BML_DOCUMENT_NS, BML_TYPES_NS, BML_SERVICE_NS, TYPE_FQN_PREFIX, SERVICE_FQN_PREFIX, } from "./constants.js";
|
|
8
|
+
//# 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,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,KAAK,UAAU,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,KAAK,YAAY,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { XsdTarget } from "./xsd-target.js";
|
|
2
|
+
export { resolveXsdOptions, DEFAULT_XSD_OPTIONS } from "./options.js";
|
|
3
|
+
export { emitBlockXsd } from "./emit-block-xsd.js";
|
|
4
|
+
export { emitTypesXsd } from "./emit-types-xsd.js";
|
|
5
|
+
export { emitServiceXsd } from "./emit-service-xsd.js";
|
|
6
|
+
export { emitCatalogXml, catalogRelativePath, } from "./emit-catalog-xml.js";
|
|
7
|
+
export { BML_DOCUMENT_NS, BML_TYPES_NS, BML_SERVICE_NS, TYPE_FQN_PREFIX, SERVICE_FQN_PREFIX, } from "./constants.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAmB,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface XsdOptions {
|
|
2
|
+
/** when false, only Library.blocks exports inform extra particles; unused for V1 emit */
|
|
3
|
+
includeNonExported?: boolean;
|
|
4
|
+
/** when false, skip types.xsd / service.xsd and their catalog entries */
|
|
5
|
+
emitDomainSchemas?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const DEFAULT_XSD_OPTIONS: Required<XsdOptions>;
|
|
8
|
+
export declare function resolveXsdOptions(targetOptions?: unknown): Required<XsdOptions>;
|
|
9
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,yFAAyF;IACzF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,UAAU,CAGpD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,CAQ/E"}
|
package/dist/options.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const DEFAULT_XSD_OPTIONS = {
|
|
2
|
+
includeNonExported: true,
|
|
3
|
+
emitDomainSchemas: true,
|
|
4
|
+
};
|
|
5
|
+
export function resolveXsdOptions(targetOptions) {
|
|
6
|
+
const opts = (targetOptions ?? {});
|
|
7
|
+
return {
|
|
8
|
+
includeNonExported: opts.includeNonExported ?? DEFAULT_XSD_OPTIONS.includeNonExported,
|
|
9
|
+
emitDomainSchemas: opts.emitDomainSchemas ?? DEFAULT_XSD_OPTIONS.emitDomainSchemas,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,mBAAmB,GAAyB;IACvD,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,aAAuB;IACvD,MAAM,IAAI,GAAG,CAAC,aAAa,IAAI,EAAE,CAAe,CAAC;IACjD,OAAO;QACL,kBAAkB,EAChB,IAAI,CAAC,kBAAkB,IAAI,mBAAmB,CAAC,kBAAkB;QACnE,iBAAiB,EACf,IAAI,CAAC,iBAAiB,IAAI,mBAAmB,CAAC,iBAAiB;KAClE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CompileRequest, RenderContext, RenderOutput, RenderTarget } from "@blockml/compiler";
|
|
2
|
+
export interface XsdRenderOutput extends RenderOutput {
|
|
3
|
+
files: {
|
|
4
|
+
path: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}[];
|
|
7
|
+
rootFiles?: {
|
|
8
|
+
path: string;
|
|
9
|
+
content: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export declare class XsdTarget implements RenderTarget {
|
|
13
|
+
readonly name = "xsd";
|
|
14
|
+
readonly accepts: Array<"library" | "corpus" | "auto">;
|
|
15
|
+
render(request: CompileRequest, ctx: RenderContext): XsdRenderOutput;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=xsd-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xsd-target.d.ts","sourceRoot":"","sources":["../src/xsd-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAYnG,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjD;AAED,qBAAa,SAAU,YAAW,YAAY;IAC5C,QAAQ,CAAC,IAAI,SAAS;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAiC;IAEvF,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,eAAe;CAoDrE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BML_DOCUMENT_NS, BML_SERVICE_NS, BML_TYPES_NS, } from "./constants.js";
|
|
2
|
+
import { catalogRelativePath, emitCatalogXml } from "./emit-catalog-xml.js";
|
|
3
|
+
import { emitBlockXsd } from "./emit-block-xsd.js";
|
|
4
|
+
import { emitServiceXsd } from "./emit-service-xsd.js";
|
|
5
|
+
import { emitTypesXsd } from "./emit-types-xsd.js";
|
|
6
|
+
import { resolveXsdOptions } from "./options.js";
|
|
7
|
+
export class XsdTarget {
|
|
8
|
+
name = "xsd";
|
|
9
|
+
accepts = ["library", "corpus", "auto"];
|
|
10
|
+
render(request, ctx) {
|
|
11
|
+
const options = resolveXsdOptions(request.targetOptions);
|
|
12
|
+
const registry = ctx.session.typeRegistry;
|
|
13
|
+
const outDir = ctx.session.outputBasePath;
|
|
14
|
+
const files = [
|
|
15
|
+
{
|
|
16
|
+
path: "bml.xsd",
|
|
17
|
+
content: emitBlockXsd(registry),
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
const catalogEntries = [
|
|
21
|
+
{
|
|
22
|
+
namespaceUri: BML_DOCUMENT_NS,
|
|
23
|
+
relativePath: catalogRelativePath(outDir, "bml.xsd"),
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
if (options.emitDomainSchemas) {
|
|
27
|
+
files.push({
|
|
28
|
+
path: "types.xsd",
|
|
29
|
+
content: emitTypesXsd(registry),
|
|
30
|
+
}, {
|
|
31
|
+
path: "service.xsd",
|
|
32
|
+
content: emitServiceXsd(registry),
|
|
33
|
+
});
|
|
34
|
+
catalogEntries.push({
|
|
35
|
+
namespaceUri: BML_TYPES_NS,
|
|
36
|
+
relativePath: catalogRelativePath(outDir, "types.xsd"),
|
|
37
|
+
}, {
|
|
38
|
+
namespaceUri: BML_SERVICE_NS,
|
|
39
|
+
relativePath: catalogRelativePath(outDir, "service.xsd"),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
files,
|
|
44
|
+
rootFiles: [
|
|
45
|
+
{
|
|
46
|
+
path: "catalog.xml",
|
|
47
|
+
content: emitCatalogXml(catalogEntries),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=xsd-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xsd-target.js","sourceRoot":"","sources":["../src/xsd-target.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAOjD,MAAM,OAAO,SAAS;IACX,IAAI,GAAG,KAAK,CAAC;IACb,OAAO,GAAyC,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEvF,MAAM,CAAC,OAAuB,EAAE,GAAkB;QAChD,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;QAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC;QAE1C,MAAM,KAAK,GAAwC;YACjD;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,YAAY,CAAC,QAAQ,CAAC;aAChC;SACF,CAAC;QAEF,MAAM,cAAc,GAAG;YACrB;gBACE,YAAY,EAAE,eAAe;gBAC7B,YAAY,EAAE,mBAAmB,CAAC,MAAM,EAAE,SAAS,CAAC;aACrD;SACF,CAAC;QAEF,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CACR;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,YAAY,CAAC,QAAQ,CAAC;aAChC,EACD;gBACE,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,cAAc,CAAC,QAAQ,CAAC;aAClC,CACF,CAAC;YACF,cAAc,CAAC,IAAI,CACjB;gBACE,YAAY,EAAE,YAAY;gBAC1B,YAAY,EAAE,mBAAmB,CAAC,MAAM,EAAE,WAAW,CAAC;aACvD,EACD;gBACE,YAAY,EAAE,cAAc;gBAC5B,YAAY,EAAE,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC;aACzD,CACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,KAAK;YACL,SAAS,EAAE;gBACT;oBACE,IAAI,EAAE,aAAa;oBACnB,OAAO,EAAE,cAAc,CAAC,cAAc,CAAC;iBACxC;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blockml/xsd-target",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "BlockML XSD render target — XML Schema generation",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/pks5/blockml-toolchain.git",
|
|
9
|
+
"directory": "packages/xsd-target"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"blockml": {
|
|
17
|
+
"library": "./blocks/org/blockml/bml/target/xsd/Library.bml"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"blocks"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc --build",
|
|
31
|
+
"prepublishOnly": "npm run build",
|
|
32
|
+
"test": "vitest run packages/xsd-target/test"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@blockml/bom": "^0.1.0",
|
|
36
|
+
"@blockml/compiler": "^0.1.0",
|
|
37
|
+
"@blockml/framework": "^0.1.0"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
}
|
|
42
|
+
}
|