@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
|
@@ -14,6 +14,8 @@ import type { ExtensionDefinition, CustomTypeRegistration, CustomConstraintRegis
|
|
|
14
14
|
* Type IDs follow the format: `<extensionId>/<typeName>`
|
|
15
15
|
* Constraint IDs follow the format: `<extensionId>/<constraintName>`
|
|
16
16
|
* Annotation IDs follow the format: `<extensionId>/<annotationName>`
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
17
19
|
*/
|
|
18
20
|
export interface ExtensionRegistry {
|
|
19
21
|
/** The extensions registered in this registry (in registration order). */
|
|
@@ -74,6 +76,8 @@ export interface ExtensionRegistry {
|
|
|
74
76
|
* @param extensions - The extension definitions to register.
|
|
75
77
|
* @returns An {@link ExtensionRegistry} instance.
|
|
76
78
|
* @throws If duplicate type/constraint/annotation IDs are detected across extensions.
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
77
81
|
*/
|
|
78
82
|
export declare function createExtensionRegistry(extensions: readonly ExtensionDefinition[]): ExtensionRegistry;
|
|
79
83
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/extensions/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,uCAAuC,EACxC,MAAM,gBAAgB,CAAC;AAMxB
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/extensions/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,uCAAuC,EACxC,MAAM,gBAAgB,CAAC;AAMxB;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAEpD;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAAC;IAC7D;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,MAAM,GACf;QAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAA;KAAE,GAAG,SAAS,CAAC;IAE/F;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAAC;IAC/E;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAC7B;QACE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;KAClD,GACD,SAAS,CAAC;IACd;;OAEG;IACH,+BAA+B,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAEb;QACE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,YAAY,EAAE,uCAAuC,CAAC;KAChE,GACD,SAAS,CAAC;IAEd;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAAC;CAChF;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,SAAS,mBAAmB,EAAE,GACzC,iBAAiB,CA8FnB"}
|
|
@@ -11,6 +11,8 @@ import { type TSDocSource } from "../canonicalize/index.js";
|
|
|
11
11
|
import { type GenerateJsonSchemaFromIROptions, type JsonSchema2020 } from "../json-schema/ir-generator.js";
|
|
12
12
|
/**
|
|
13
13
|
* Generated schemas for a class.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
14
16
|
*/
|
|
15
17
|
export interface ClassSchemas {
|
|
16
18
|
/** JSON Schema 2020-12 for validation */
|
|
@@ -31,6 +33,8 @@ export interface ClassSchemas {
|
|
|
31
33
|
export declare function generateClassSchemas(analysis: IRClassAnalysis, source?: TSDocSource, options?: GenerateJsonSchemaFromIROptions): ClassSchemas;
|
|
32
34
|
/**
|
|
33
35
|
* Options for generating schemas from a decorated class.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
34
38
|
*/
|
|
35
39
|
export interface GenerateFromClassOptions extends GenerateJsonSchemaFromIROptions {
|
|
36
40
|
/** Path to the TypeScript source file */
|
|
@@ -40,6 +44,8 @@ export interface GenerateFromClassOptions extends GenerateJsonSchemaFromIROption
|
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
46
|
* Result of generating schemas from a decorated class.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
43
49
|
*/
|
|
44
50
|
export interface GenerateFromClassResult {
|
|
45
51
|
/** JSON Schema 2020-12 for validation */
|
|
@@ -65,10 +71,14 @@ export interface GenerateFromClassResult {
|
|
|
65
71
|
*
|
|
66
72
|
* @param options - File path, class name, and optional compiler options
|
|
67
73
|
* @returns Generated JSON Schema and UI Schema
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
68
76
|
*/
|
|
69
77
|
export declare function generateSchemasFromClass(options: GenerateFromClassOptions): GenerateFromClassResult;
|
|
70
78
|
/**
|
|
71
79
|
* Options for generating schemas from a named type (class, interface, or type alias).
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
72
82
|
*/
|
|
73
83
|
export interface GenerateSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
74
84
|
/** Path to the TypeScript source file */
|
|
@@ -94,6 +104,8 @@ export interface GenerateSchemasOptions extends GenerateJsonSchemaFromIROptions
|
|
|
94
104
|
*
|
|
95
105
|
* @param options - File path and type name
|
|
96
106
|
* @returns Generated JSON Schema and UI Schema
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
97
109
|
*/
|
|
98
110
|
export declare function generateSchemas(options: GenerateSchemasOptions): GenerateFromClassResult;
|
|
99
111
|
//# sourceMappingURL=class-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/generators/class-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAIxC
|
|
1
|
+
{"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/generators/class-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAIxC;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,+BAA+B,GACxC,YAAY,CAuBd;AAmBD;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,+BAA+B;IAC/E,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,wBAAwB,GAChC,uBAAuB,CAsBzB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,+BAA+B;IAC7E,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,uBAAuB,CAOxF"}
|
|
@@ -11,6 +11,8 @@ import type { GenerateJsonSchemaFromIROptions, JsonSchema2020 } from "../json-sc
|
|
|
11
11
|
import type { UISchema } from "../ui-schema/types.js";
|
|
12
12
|
/**
|
|
13
13
|
* Result of generating schemas from a mixed-authoring composition.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
14
16
|
*/
|
|
15
17
|
export interface MixedAuthoringSchemas {
|
|
16
18
|
/** JSON Schema 2020-12 for validation. */
|
|
@@ -23,6 +25,8 @@ export interface MixedAuthoringSchemas {
|
|
|
23
25
|
*
|
|
24
26
|
* The `typeName` can resolve to a class, interface, or object type alias, just
|
|
25
27
|
* like `generateSchemas()`.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
26
30
|
*/
|
|
27
31
|
export interface BuildMixedAuthoringSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
28
32
|
/** Path to the TypeScript source file. */
|
|
@@ -40,6 +44,8 @@ export interface BuildMixedAuthoringSchemasOptions extends GenerateJsonSchemaFro
|
|
|
40
44
|
* ordering, and constraints; ChainDSL overlays may contribute dynamic runtime
|
|
41
45
|
* field metadata such as dynamic enum or dynamic schema keywords, and may fill
|
|
42
46
|
* in missing annotations.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
43
49
|
*/
|
|
44
50
|
export declare function buildMixedAuthoringSchemas(options: BuildMixedAuthoringSchemasOptions): MixedAuthoringSchemas;
|
|
45
51
|
//# sourceMappingURL=mixed-authoring.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixed-authoring.d.ts","sourceRoot":"","sources":["../../src/generators/mixed-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAGV,WAAW,EAEX,QAAQ,EAET,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,+BAA+B,EAC/B,cAAc,EACf,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKtD
|
|
1
|
+
{"version":3,"file":"mixed-authoring.d.ts","sourceRoot":"","sources":["../../src/generators/mixed-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAGV,WAAW,EAEX,QAAQ,EAET,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,+BAA+B,EAC/B,cAAc,EACf,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKtD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iCAAkC,SAAQ,+BAA+B;IACxF,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2GAA2G;IAC3G,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;CACrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iCAAiC,GACzC,qBAAqB,CAUvB"}
|
package/dist/index.cjs
CHANGED
|
@@ -803,6 +803,9 @@ function applyAnnotations(schema, annotations, ctx) {
|
|
|
803
803
|
case "description":
|
|
804
804
|
schema.description = annotation.value;
|
|
805
805
|
break;
|
|
806
|
+
case "remarks":
|
|
807
|
+
schema[`${ctx.vendorPrefix}-remarks`] = annotation.value;
|
|
808
|
+
break;
|
|
806
809
|
case "defaultValue":
|
|
807
810
|
schema.default = annotation.value;
|
|
808
811
|
break;
|
|
@@ -1281,7 +1284,7 @@ var ts2 = __toESM(require("typescript"), 1);
|
|
|
1281
1284
|
|
|
1282
1285
|
// src/analyzer/tsdoc-parser.ts
|
|
1283
1286
|
var ts = __toESM(require("typescript"), 1);
|
|
1284
|
-
var
|
|
1287
|
+
var import_internal = require("@formspec/analysis/internal");
|
|
1285
1288
|
var import_tsdoc = require("@microsoft/tsdoc");
|
|
1286
1289
|
var import_core3 = require("@formspec/core");
|
|
1287
1290
|
var TAGS_REQUIRING_RAW_TEXT = /* @__PURE__ */ new Set(["pattern", "enumOptions", "defaultValue"]);
|
|
@@ -1296,7 +1299,7 @@ function createFormSpecTSDocConfig(extensionTagNames = []) {
|
|
|
1296
1299
|
})
|
|
1297
1300
|
);
|
|
1298
1301
|
}
|
|
1299
|
-
for (const tagName of ["displayName", "
|
|
1302
|
+
for (const tagName of ["displayName", "format", "placeholder"]) {
|
|
1300
1303
|
config.addTagDefinition(
|
|
1301
1304
|
new import_tsdoc.TSDocTagDefinition({
|
|
1302
1305
|
tagName: "@" + tagName,
|
|
@@ -1375,12 +1378,12 @@ function supportsConstraintCapability(type, checker, capability) {
|
|
|
1375
1378
|
if (capability === void 0) {
|
|
1376
1379
|
return true;
|
|
1377
1380
|
}
|
|
1378
|
-
if ((0,
|
|
1381
|
+
if ((0, import_internal.hasTypeSemanticCapability)(type, checker, capability)) {
|
|
1379
1382
|
return true;
|
|
1380
1383
|
}
|
|
1381
1384
|
if (capability === "string-like") {
|
|
1382
1385
|
const itemType = getArrayElementType(type, checker);
|
|
1383
|
-
return itemType !== null && (0,
|
|
1386
|
+
return itemType !== null && (0, import_internal.hasTypeSemanticCapability)(itemType, checker, capability);
|
|
1384
1387
|
}
|
|
1385
1388
|
return false;
|
|
1386
1389
|
}
|
|
@@ -1478,11 +1481,11 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
1478
1481
|
if (checker === void 0 || subjectType === void 0) {
|
|
1479
1482
|
return [];
|
|
1480
1483
|
}
|
|
1481
|
-
const placement = (0,
|
|
1484
|
+
const placement = (0, import_internal.resolveDeclarationPlacement)(node);
|
|
1482
1485
|
if (placement === null) {
|
|
1483
1486
|
return [];
|
|
1484
1487
|
}
|
|
1485
|
-
const definition = (0,
|
|
1488
|
+
const definition = (0, import_internal.getTagDefinition)(tagName, options?.extensionRegistry?.extensions);
|
|
1486
1489
|
if (definition === null) {
|
|
1487
1490
|
return [];
|
|
1488
1491
|
}
|
|
@@ -1516,7 +1519,7 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
1516
1519
|
)
|
|
1517
1520
|
];
|
|
1518
1521
|
}
|
|
1519
|
-
const resolution = (0,
|
|
1522
|
+
const resolution = (0, import_internal.resolvePathTargetType)(subjectType, checker, target.path.segments);
|
|
1520
1523
|
if (resolution.kind === "missing-property") {
|
|
1521
1524
|
return [
|
|
1522
1525
|
makeDiagnostic(
|
|
@@ -1573,7 +1576,7 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
1573
1576
|
const subjectTypeText = checker.typeToString(subjectType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
|
|
1574
1577
|
const hostType = options?.hostType ?? subjectType;
|
|
1575
1578
|
const hostTypeText = checker.typeToString(hostType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
|
|
1576
|
-
const result = (0,
|
|
1579
|
+
const result = (0, import_internal.checkSyntheticTagApplication)({
|
|
1577
1580
|
tagName,
|
|
1578
1581
|
placement,
|
|
1579
1582
|
hostType: hostTypeText,
|
|
@@ -1656,10 +1659,8 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1656
1659
|
const annotations = [];
|
|
1657
1660
|
const diagnostics = [];
|
|
1658
1661
|
let displayName;
|
|
1659
|
-
let description;
|
|
1660
1662
|
let placeholder;
|
|
1661
1663
|
let displayNameProvenance;
|
|
1662
|
-
let descriptionProvenance;
|
|
1663
1664
|
let placeholderProvenance;
|
|
1664
1665
|
const rawTextTags = [];
|
|
1665
1666
|
const sourceFile = node.getSourceFile();
|
|
@@ -1681,7 +1682,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1681
1682
|
import_tsdoc.TextRange.fromStringRange(sourceText, range.pos, range.end)
|
|
1682
1683
|
);
|
|
1683
1684
|
const docComment = parserContext.docComment;
|
|
1684
|
-
const parsedComment = (0,
|
|
1685
|
+
const parsedComment = (0, import_internal.parseCommentBlock)(
|
|
1685
1686
|
commentText,
|
|
1686
1687
|
sharedCommentSyntaxOptions(options, range.pos)
|
|
1687
1688
|
);
|
|
@@ -1704,7 +1705,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1704
1705
|
for (const block of docComment.customBlocks) {
|
|
1705
1706
|
const tagName = (0, import_core3.normalizeConstraintTagName)(block.blockTag.tagName.substring(1));
|
|
1706
1707
|
const parsedTag = nextParsedTag(tagName);
|
|
1707
|
-
if (tagName === "displayName" || tagName === "
|
|
1708
|
+
if (tagName === "displayName" || tagName === "format" || tagName === "placeholder") {
|
|
1708
1709
|
const text2 = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
|
|
1709
1710
|
if (text2 === "") continue;
|
|
1710
1711
|
const provenance2 = parsedTag !== null ? provenanceForParsedTag(parsedTag, sourceFile, file) : provenanceForComment(range, sourceFile, file, tagName);
|
|
@@ -1723,10 +1724,6 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1723
1724
|
provenance: provenance2
|
|
1724
1725
|
});
|
|
1725
1726
|
break;
|
|
1726
|
-
case "description":
|
|
1727
|
-
description = text2;
|
|
1728
|
-
descriptionProvenance = provenance2;
|
|
1729
|
-
break;
|
|
1730
1727
|
case "placeholder":
|
|
1731
1728
|
if (placeholder === void 0) {
|
|
1732
1729
|
placeholder = text2;
|
|
@@ -1754,7 +1751,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1754
1751
|
diagnostics.push(...compilerDiagnostics);
|
|
1755
1752
|
continue;
|
|
1756
1753
|
}
|
|
1757
|
-
const constraintNode = (0,
|
|
1754
|
+
const constraintNode = (0, import_internal.parseConstraintTagValue)(
|
|
1758
1755
|
tagName,
|
|
1759
1756
|
text,
|
|
1760
1757
|
provenance,
|
|
@@ -1773,18 +1770,26 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1773
1770
|
provenance: provenanceForComment(range, sourceFile, file, "deprecated")
|
|
1774
1771
|
});
|
|
1775
1772
|
}
|
|
1776
|
-
|
|
1777
|
-
const remarks = extractBlockText(docComment.remarksBlock).trim();
|
|
1778
|
-
if (remarks !== "") {
|
|
1779
|
-
description = remarks;
|
|
1780
|
-
descriptionProvenance = provenanceForComment(range, sourceFile, file, "remarks");
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
if (description === void 0) {
|
|
1773
|
+
{
|
|
1784
1774
|
const summary = extractPlainText(docComment.summarySection).trim();
|
|
1785
1775
|
if (summary !== "") {
|
|
1786
|
-
|
|
1787
|
-
|
|
1776
|
+
annotations.push({
|
|
1777
|
+
kind: "annotation",
|
|
1778
|
+
annotationKind: "description",
|
|
1779
|
+
value: summary,
|
|
1780
|
+
provenance: provenanceForComment(range, sourceFile, file, "summary")
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
if (docComment.remarksBlock !== void 0) {
|
|
1785
|
+
const remarksText = extractBlockText(docComment.remarksBlock).trim();
|
|
1786
|
+
if (remarksText !== "") {
|
|
1787
|
+
annotations.push({
|
|
1788
|
+
kind: "annotation",
|
|
1789
|
+
annotationKind: "remarks",
|
|
1790
|
+
value: remarksText,
|
|
1791
|
+
provenance: provenanceForComment(range, sourceFile, file, "remarks")
|
|
1792
|
+
});
|
|
1788
1793
|
}
|
|
1789
1794
|
}
|
|
1790
1795
|
}
|
|
@@ -1797,14 +1802,6 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1797
1802
|
provenance: displayNameProvenance
|
|
1798
1803
|
});
|
|
1799
1804
|
}
|
|
1800
|
-
if (description !== void 0 && descriptionProvenance !== void 0) {
|
|
1801
|
-
annotations.push({
|
|
1802
|
-
kind: "annotation",
|
|
1803
|
-
annotationKind: "description",
|
|
1804
|
-
value: description,
|
|
1805
|
-
provenance: descriptionProvenance
|
|
1806
|
-
});
|
|
1807
|
-
}
|
|
1808
1805
|
if (placeholder !== void 0 && placeholderProvenance !== void 0) {
|
|
1809
1806
|
annotations.push({
|
|
1810
1807
|
kind: "annotation",
|
|
@@ -1824,7 +1821,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1824
1821
|
if (text === "") continue;
|
|
1825
1822
|
const provenance = provenanceForParsedTag(rawTextTag.tag, sourceFile, file);
|
|
1826
1823
|
if (rawTextTag.tag.normalizedTagName === "defaultValue") {
|
|
1827
|
-
const defaultValueNode = (0,
|
|
1824
|
+
const defaultValueNode = (0, import_internal.parseDefaultValueTagValue)(text, provenance);
|
|
1828
1825
|
annotations.push(defaultValueNode);
|
|
1829
1826
|
continue;
|
|
1830
1827
|
}
|
|
@@ -1841,7 +1838,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1841
1838
|
diagnostics.push(...compilerDiagnostics);
|
|
1842
1839
|
continue;
|
|
1843
1840
|
}
|
|
1844
|
-
const constraintNode = (0,
|
|
1841
|
+
const constraintNode = (0, import_internal.parseConstraintTagValue)(
|
|
1845
1842
|
rawTextTag.tag.normalizedTagName,
|
|
1846
1843
|
text,
|
|
1847
1844
|
provenance,
|
|
@@ -1858,7 +1855,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1858
1855
|
if (text === "") continue;
|
|
1859
1856
|
const provenance = fallback.provenance;
|
|
1860
1857
|
if (tagName === "defaultValue") {
|
|
1861
|
-
const defaultValueNode = (0,
|
|
1858
|
+
const defaultValueNode = (0, import_internal.parseDefaultValueTagValue)(text, provenance);
|
|
1862
1859
|
annotations.push(defaultValueNode);
|
|
1863
1860
|
continue;
|
|
1864
1861
|
}
|
|
@@ -1875,7 +1872,7 @@ function parseTSDocTags(node, file = "", options) {
|
|
|
1875
1872
|
diagnostics.push(...compilerDiagnostics);
|
|
1876
1873
|
continue;
|
|
1877
1874
|
}
|
|
1878
|
-
const constraintNode = (0,
|
|
1875
|
+
const constraintNode = (0, import_internal.parseConstraintTagValue)(
|
|
1879
1876
|
tagName,
|
|
1880
1877
|
text,
|
|
1881
1878
|
provenance,
|
|
@@ -1901,7 +1898,7 @@ function extractDisplayNameMetadata(node) {
|
|
|
1901
1898
|
if (range.kind !== ts.SyntaxKind.MultiLineCommentTrivia) continue;
|
|
1902
1899
|
const commentText = sourceText.substring(range.pos, range.end);
|
|
1903
1900
|
if (!commentText.startsWith("/**")) continue;
|
|
1904
|
-
const parsed = (0,
|
|
1901
|
+
const parsed = (0, import_internal.parseCommentBlock)(commentText);
|
|
1905
1902
|
for (const tag of parsed.tags) {
|
|
1906
1903
|
if (tag.normalizedTagName !== "displayName") {
|
|
1907
1904
|
continue;
|
|
@@ -1954,7 +1951,7 @@ function getSharedPayloadText(tag, commentText, commentOffset) {
|
|
|
1954
1951
|
if (tag.payloadSpan === null) {
|
|
1955
1952
|
return "";
|
|
1956
1953
|
}
|
|
1957
|
-
return (0,
|
|
1954
|
+
return (0, import_internal.sliceCommentSpan)(commentText, tag.payloadSpan, {
|
|
1958
1955
|
offset: commentOffset
|
|
1959
1956
|
}).trim();
|
|
1960
1957
|
}
|
|
@@ -1980,7 +1977,7 @@ function collectRawTextFallbacks(node, file) {
|
|
|
1980
1977
|
return fallbacks;
|
|
1981
1978
|
}
|
|
1982
1979
|
function isMemberTargetDisplayName(text) {
|
|
1983
|
-
return (0,
|
|
1980
|
+
return (0, import_internal.parseTagSyntax)("displayName", text).target !== null;
|
|
1984
1981
|
}
|
|
1985
1982
|
function provenanceForComment(range, sourceFile, file, tagName) {
|
|
1986
1983
|
const { line, character } = sourceFile.getLineAndCharacterOfPosition(range.pos);
|
|
@@ -3258,9 +3255,9 @@ function analyzeNamedTypeToIR(filePath, typeName, extensionRegistry) {
|
|
|
3258
3255
|
}
|
|
3259
3256
|
|
|
3260
3257
|
// src/validate/constraint-validator.ts
|
|
3261
|
-
var
|
|
3258
|
+
var import_internal2 = require("@formspec/analysis/internal");
|
|
3262
3259
|
function validateFieldNode(ctx, field) {
|
|
3263
|
-
const analysis = (0,
|
|
3260
|
+
const analysis = (0, import_internal2.analyzeConstraintTargets)(
|
|
3264
3261
|
field.name,
|
|
3265
3262
|
field.type,
|
|
3266
3263
|
field.constraints,
|
|
@@ -3278,7 +3275,7 @@ function validateFieldNode(ctx, field) {
|
|
|
3278
3275
|
}
|
|
3279
3276
|
function validateObjectProperty(ctx, parentName, property) {
|
|
3280
3277
|
const qualifiedName = `${parentName}.${property.name}`;
|
|
3281
|
-
const analysis = (0,
|
|
3278
|
+
const analysis = (0, import_internal2.analyzeConstraintTargets)(
|
|
3282
3279
|
qualifiedName,
|
|
3283
3280
|
property.type,
|
|
3284
3281
|
property.constraints,
|