@formspec/build 0.1.0-alpha.20 → 0.1.0-alpha.22
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/dist/__tests__/fixtures/class-schema-regressions.d.ts +7 -8
- package/dist/__tests__/fixtures/class-schema-regressions.d.ts.map +1 -1
- package/dist/__tests__/fixtures/example-a-builtins.d.ts +5 -4
- package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +1 -1
- package/dist/__tests__/fixtures/example-interface-types.d.ts +7 -2
- package/dist/__tests__/fixtures/example-interface-types.d.ts.map +1 -1
- package/dist/__tests__/fixtures/sample-forms.d.ts +1 -1
- package/dist/__tests__/parity/utils.d.ts +3 -2
- package/dist/__tests__/parity/utils.d.ts.map +1 -1
- package/dist/analyzer/class-analyzer.d.ts +1 -1
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +8 -7
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +6 -3
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +4 -1
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +150 -2
- package/dist/cli.cjs +44 -47
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +25 -28
- package/dist/cli.js.map +1 -1
- package/dist/extensions/registry.d.ts +4 -0
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/generators/class-schema.d.ts +12 -0
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/mixed-authoring.d.ts +6 -0
- package/dist/generators/mixed-authoring.d.ts.map +1 -1
- package/dist/index.cjs +42 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -28
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +42 -45
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +25 -28
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/generator.d.ts +4 -0
- package/dist/json-schema/generator.d.ts.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +6 -0
- package/dist/json-schema/ir-generator.d.ts.map +1 -1
- package/dist/json-schema/schema.d.ts +7 -0
- package/dist/json-schema/schema.d.ts.map +1 -1
- package/dist/json-schema/types.d.ts +18 -2
- package/dist/json-schema/types.d.ts.map +1 -1
- package/dist/ui-schema/generator.d.ts +2 -0
- package/dist/ui-schema/generator.d.ts.map +1 -1
- package/dist/ui-schema/schema.d.ts +77 -0
- package/dist/ui-schema/schema.d.ts.map +1 -1
- package/dist/ui-schema/types.d.ts +2 -0
- package/dist/ui-schema/types.d.ts.map +1 -1
- package/dist/validate/constraint-validator.d.ts +1 -1
- package/dist/validate/constraint-validator.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export { generateSchemasFromClass, generateSchemas } from "./generators/class-sc
|
|
|
49
49
|
export { buildMixedAuthoringSchemas } from "./generators/mixed-authoring.js";
|
|
50
50
|
/**
|
|
51
51
|
* Result of building form schemas.
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
52
54
|
*/
|
|
53
55
|
export interface BuildResult {
|
|
54
56
|
/** JSON Schema 2020-12 for validation */
|
|
@@ -61,6 +63,8 @@ export interface BuildResult {
|
|
|
61
63
|
*
|
|
62
64
|
* Currently identical to `GenerateJsonSchemaOptions`. Defined separately so the
|
|
63
65
|
* Chain DSL surface can grow independently in the future if needed.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
64
68
|
*/
|
|
65
69
|
export type BuildFormSchemasOptions = GenerateJsonSchemaOptions;
|
|
66
70
|
/**
|
|
@@ -89,10 +93,14 @@ export type BuildFormSchemasOptions = GenerateJsonSchemaOptions;
|
|
|
89
93
|
*
|
|
90
94
|
* @param form - The FormSpec to build schemas from
|
|
91
95
|
* @returns Object containing both jsonSchema and uiSchema
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
92
98
|
*/
|
|
93
99
|
export declare function buildFormSchemas<E extends readonly FormElement[]>(form: FormSpec<E>, options?: BuildFormSchemasOptions): BuildResult;
|
|
94
100
|
/**
|
|
95
101
|
* Options for writing schemas to disk.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
96
104
|
*/
|
|
97
105
|
export interface WriteSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
98
106
|
/** Output directory for the schema files */
|
|
@@ -104,6 +112,8 @@ export interface WriteSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
|
104
112
|
}
|
|
105
113
|
/**
|
|
106
114
|
* Result of writing schemas to disk.
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
107
117
|
*/
|
|
108
118
|
export interface WriteSchemasResult {
|
|
109
119
|
/** Path to the generated JSON Schema file */
|
|
@@ -139,6 +149,8 @@ export interface WriteSchemasResult {
|
|
|
139
149
|
* @param form - The FormSpec to build schemas from
|
|
140
150
|
* @param options - Output options (directory, file name, indentation)
|
|
141
151
|
* @returns Object containing paths to the generated files
|
|
152
|
+
*
|
|
153
|
+
* @public
|
|
142
154
|
*/
|
|
143
155
|
export declare function writeSchemas<E extends readonly FormElement[]>(form: FormSpec<E>, options: WriteSchemasOptions): WriteSchemasResult;
|
|
144
156
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAsB,KAAK,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEhG,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAQr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C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,WAAW,EAAE,EAC3D,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,mBAAmB,GAC3B,kBAAkB,CA2BpB"}
|
package/dist/index.js
CHANGED
|
@@ -741,6 +741,9 @@ function applyAnnotations(schema, annotations, ctx) {
|
|
|
741
741
|
case "description":
|
|
742
742
|
schema.description = annotation.value;
|
|
743
743
|
break;
|
|
744
|
+
case "remarks":
|
|
745
|
+
schema[`${ctx.vendorPrefix}-remarks`] = annotation.value;
|
|
746
|
+
break;
|
|
744
747
|
case "defaultValue":
|
|
745
748
|
schema.default = annotation.value;
|
|
746
749
|
break;
|
|
@@ -1231,7 +1234,7 @@ import {
|
|
|
1231
1234
|
sliceCommentSpan,
|
|
1232
1235
|
parseCommentBlock,
|
|
1233
1236
|
parseTagSyntax
|
|
1234
|
-
} from "@formspec/analysis";
|
|
1237
|
+
} from "@formspec/analysis/internal";
|
|
1235
1238
|
import {
|
|
1236
1239
|
TSDocParser,
|
|
1237
1240
|
TSDocConfiguration,
|
|
@@ -1258,7 +1261,7 @@ function createFormSpecTSDocConfig(extensionTagNames = []) {
|
|
|
1258
1261
|
})
|
|
1259
1262
|
);
|
|
1260
1263
|
}
|
|
1261
|
-
for (const tagName of ["displayName", "
|
|
1264
|
+
for (const tagName of ["displayName", "format", "placeholder"]) {
|
|
1262
1265
|
config.addTagDefinition(
|
|
1263
1266
|
new TSDocTagDefinition({
|
|
1264
1267
|
tagName: "@" + tagName,
|
|
@@ -1618,10 +1621,8 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1618
1621
|
const annotations = [];
|
|
1619
1622
|
const diagnostics = [];
|
|
1620
1623
|
let displayName;
|
|
1621
|
-
let description;
|
|
1622
1624
|
let placeholder;
|
|
1623
1625
|
let displayNameProvenance;
|
|
1624
|
-
let descriptionProvenance;
|
|
1625
1626
|
let placeholderProvenance;
|
|
1626
1627
|
const rawTextTags = [];
|
|
1627
1628
|
const sourceFile = node.getSourceFile();
|
|
@@ -1666,7 +1667,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1666
1667
|
for (const block of docComment.customBlocks) {
|
|
1667
1668
|
const tagName = normalizeConstraintTagName(block.blockTag.tagName.substring(1));
|
|
1668
1669
|
const parsedTag = nextParsedTag(tagName);
|
|
1669
|
-
if (tagName === "displayName" || tagName === "
|
|
1670
|
+
if (tagName === "displayName" || tagName === "format" || tagName === "placeholder") {
|
|
1670
1671
|
const text2 = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
|
|
1671
1672
|
if (text2 === "") continue;
|
|
1672
1673
|
const provenance2 = parsedTag !== null ? provenanceForParsedTag(parsedTag, sourceFile, file) : provenanceForComment(range, sourceFile, file, tagName);
|
|
@@ -1685,10 +1686,6 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1685
1686
|
provenance: provenance2
|
|
1686
1687
|
});
|
|
1687
1688
|
break;
|
|
1688
|
-
case "description":
|
|
1689
|
-
description = text2;
|
|
1690
|
-
descriptionProvenance = provenance2;
|
|
1691
|
-
break;
|
|
1692
1689
|
case "placeholder":
|
|
1693
1690
|
if (placeholder === void 0) {
|
|
1694
1691
|
placeholder = text2;
|
|
@@ -1735,18 +1732,26 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1735
1732
|
provenance: provenanceForComment(range, sourceFile, file, "deprecated")
|
|
1736
1733
|
});
|
|
1737
1734
|
}
|
|
1738
|
-
|
|
1739
|
-
const remarks = extractBlockText(docComment.remarksBlock).trim();
|
|
1740
|
-
if (remarks !== "") {
|
|
1741
|
-
description = remarks;
|
|
1742
|
-
descriptionProvenance = provenanceForComment(range, sourceFile, file, "remarks");
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
if (description === void 0) {
|
|
1735
|
+
{
|
|
1746
1736
|
const summary = extractPlainText(docComment.summarySection).trim();
|
|
1747
1737
|
if (summary !== "") {
|
|
1748
|
-
|
|
1749
|
-
|
|
1738
|
+
annotations.push({
|
|
1739
|
+
kind: "annotation",
|
|
1740
|
+
annotationKind: "description",
|
|
1741
|
+
value: summary,
|
|
1742
|
+
provenance: provenanceForComment(range, sourceFile, file, "summary")
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
if (docComment.remarksBlock !== void 0) {
|
|
1747
|
+
const remarksText = extractBlockText(docComment.remarksBlock).trim();
|
|
1748
|
+
if (remarksText !== "") {
|
|
1749
|
+
annotations.push({
|
|
1750
|
+
kind: "annotation",
|
|
1751
|
+
annotationKind: "remarks",
|
|
1752
|
+
value: remarksText,
|
|
1753
|
+
provenance: provenanceForComment(range, sourceFile, file, "remarks")
|
|
1754
|
+
});
|
|
1750
1755
|
}
|
|
1751
1756
|
}
|
|
1752
1757
|
}
|
|
@@ -1759,14 +1764,6 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1759
1764
|
provenance: displayNameProvenance
|
|
1760
1765
|
});
|
|
1761
1766
|
}
|
|
1762
|
-
if (description !== void 0 && descriptionProvenance !== void 0) {
|
|
1763
|
-
annotations.push({
|
|
1764
|
-
kind: "annotation",
|
|
1765
|
-
annotationKind: "description",
|
|
1766
|
-
value: description,
|
|
1767
|
-
provenance: descriptionProvenance
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
1767
|
if (placeholder !== void 0 && placeholderProvenance !== void 0) {
|
|
1771
1768
|
annotations.push({
|
|
1772
1769
|
kind: "annotation",
|
|
@@ -3222,7 +3219,7 @@ function analyzeNamedTypeToIR(filePath, typeName, extensionRegistry) {
|
|
|
3222
3219
|
// src/validate/constraint-validator.ts
|
|
3223
3220
|
import {
|
|
3224
3221
|
analyzeConstraintTargets
|
|
3225
|
-
} from "@formspec/analysis";
|
|
3222
|
+
} from "@formspec/analysis/internal";
|
|
3226
3223
|
function validateFieldNode(ctx, field) {
|
|
3227
3224
|
const analysis = analyzeConstraintTargets(
|
|
3228
3225
|
field.name,
|