@formspec/build 0.1.0-alpha.22 → 0.1.0-alpha.24
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/README.md +9 -4
- package/dist/analyzer/class-analyzer.d.ts +1 -1
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +5 -4
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +4 -3
- package/dist/browser.js.map +1 -1
- package/dist/build-alpha.d.ts +836 -0
- package/dist/build-beta.d.ts +836 -0
- package/dist/build-internal.d.ts +836 -0
- package/dist/build.d.ts +157 -538
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +2 -1
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -1
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts +1 -1
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
- package/dist/cli.cjs +85 -126
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +76 -116
- package/dist/cli.js.map +1 -1
- package/dist/generators/class-schema.d.ts +20 -3
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/mixed-authoring.d.ts +3 -2
- package/dist/generators/mixed-authoring.d.ts.map +1 -1
- package/dist/index.cjs +82 -127
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -101
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +80 -15
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.d.ts +2 -1
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +73 -7
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/generator.d.ts +8 -4
- package/dist/json-schema/generator.d.ts.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +4 -4
- package/dist/json-schema/ir-generator.d.ts.map +1 -1
- package/dist/json-schema/schema.d.ts +2 -2
- package/dist/json-schema/types.d.ts +6 -6
- package/dist/ui-schema/ir-generator.d.ts +1 -1
- package/dist/ui-schema/ir-generator.d.ts.map +1 -1
- package/dist/ui-schema/schema.d.ts +28 -28
- package/dist/ui-schema/types.d.ts +152 -3
- 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 +8 -8
- package/dist/__tests__/alias-chain-propagation.test.d.ts +0 -9
- package/dist/__tests__/alias-chain-propagation.test.d.ts.map +0 -1
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +0 -2
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +0 -1
- package/dist/__tests__/class-schema.test.d.ts +0 -2
- package/dist/__tests__/class-schema.test.d.ts.map +0 -1
- package/dist/__tests__/cli.test.d.ts +0 -2
- package/dist/__tests__/cli.test.d.ts.map +0 -1
- package/dist/__tests__/constraint-validator.test.d.ts +0 -2
- package/dist/__tests__/constraint-validator.test.d.ts.map +0 -1
- package/dist/__tests__/date-extension.integration.test.d.ts +0 -2
- package/dist/__tests__/date-extension.integration.test.d.ts.map +0 -1
- package/dist/__tests__/edge-cases.test.d.ts +0 -7
- package/dist/__tests__/edge-cases.test.d.ts.map +0 -1
- package/dist/__tests__/extension-api.test.d.ts +0 -2
- package/dist/__tests__/extension-api.test.d.ts.map +0 -1
- package/dist/__tests__/extension-runtime.integration.test.d.ts +0 -2
- package/dist/__tests__/extension-runtime.integration.test.d.ts.map +0 -1
- package/dist/__tests__/fixtures/alias-chains.d.ts +0 -37
- package/dist/__tests__/fixtures/alias-chains.d.ts.map +0 -1
- package/dist/__tests__/fixtures/class-schema-regressions.d.ts +0 -86
- package/dist/__tests__/fixtures/class-schema-regressions.d.ts.map +0 -1
- package/dist/__tests__/fixtures/edge-cases.d.ts +0 -132
- package/dist/__tests__/fixtures/edge-cases.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-a-builtins.d.ts +0 -31
- package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-date-extension.d.ts +0 -12
- package/dist/__tests__/fixtures/example-date-extension.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-interface-types.d.ts +0 -107
- package/dist/__tests__/fixtures/example-interface-types.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts +0 -20
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts.map +0 -1
- package/dist/__tests__/fixtures/extension-forms.d.ts +0 -7
- package/dist/__tests__/fixtures/extension-forms.d.ts.map +0 -1
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts +0 -31
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts.map +0 -1
- package/dist/__tests__/fixtures/named-primitive-aliases.d.ts +0 -15
- package/dist/__tests__/fixtures/named-primitive-aliases.d.ts.map +0 -1
- package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts +0 -14
- package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts.map +0 -1
- package/dist/__tests__/fixtures/sample-forms.d.ts +0 -65
- package/dist/__tests__/fixtures/sample-forms.d.ts.map +0 -1
- package/dist/__tests__/generate-schemas.test.d.ts +0 -2
- package/dist/__tests__/generate-schemas.test.d.ts.map +0 -1
- package/dist/__tests__/generator.test.d.ts +0 -2
- package/dist/__tests__/generator.test.d.ts.map +0 -1
- package/dist/__tests__/guards.test.d.ts +0 -2
- package/dist/__tests__/guards.test.d.ts.map +0 -1
- package/dist/__tests__/integration.test.d.ts +0 -8
- package/dist/__tests__/integration.test.d.ts.map +0 -1
- package/dist/__tests__/ir-analyzer.test.d.ts +0 -11
- package/dist/__tests__/ir-analyzer.test.d.ts.map +0 -1
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +0 -12
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +0 -1
- package/dist/__tests__/ir-json-schema-generator.test.d.ts +0 -11
- package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +0 -1
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts +0 -2
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +0 -1
- package/dist/__tests__/mixed-authoring.test.d.ts +0 -2
- package/dist/__tests__/mixed-authoring.test.d.ts.map +0 -1
- package/dist/__tests__/numeric-extension.integration.test.d.ts +0 -2
- package/dist/__tests__/numeric-extension.integration.test.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +0 -9
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +0 -9
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +0 -19
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts +0 -19
- package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts +0 -6
- package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts +0 -17
- package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +0 -13
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +0 -9
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +0 -28
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts +0 -9
- package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts +0 -6
- package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts +0 -19
- package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +0 -12
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +0 -9
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +0 -1
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +0 -19
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +0 -1
- package/dist/__tests__/parity/parity.test.d.ts +0 -18
- package/dist/__tests__/parity/parity.test.d.ts.map +0 -1
- package/dist/__tests__/parity/utils.d.ts +0 -152
- package/dist/__tests__/parity/utils.d.ts.map +0 -1
- package/dist/__tests__/path-target-parser.test.d.ts +0 -9
- package/dist/__tests__/path-target-parser.test.d.ts.map +0 -1
- package/dist/__tests__/write-schemas.test.d.ts +0 -2
- package/dist/__tests__/write-schemas.test.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,26 +24,18 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import type { FormElement, FormSpec } from "@formspec/core";
|
|
26
26
|
import { type GenerateJsonSchemaOptions } from "./json-schema/generator.js";
|
|
27
|
-
import { type
|
|
27
|
+
import { type JsonSchema2020 } from "./json-schema/ir-generator.js";
|
|
28
28
|
import type { UISchema } from "./ui-schema/types.js";
|
|
29
29
|
export type { JsonSchema2020 } from "./json-schema/ir-generator.js";
|
|
30
|
-
export type { GenerateJsonSchemaFromIROptions } from "./json-schema/ir-generator.js";
|
|
31
30
|
export type { GenerateJsonSchemaOptions } from "./json-schema/generator.js";
|
|
31
|
+
export type { AnyField, ArrayField, BooleanField, Conditional, DynamicEnumField, DynamicSchemaField, ExtensionApplicableType, ExtensionDefinition, ExtensionPayloadValue, ExtensionTypeKind, EnumOption, EnumOptionValue, FormElement, FormSpec, Group, NumberField, ObjectField, StaticEnumField, TextField, CustomAnnotationRegistration, CustomConstraintRegistration, CustomTypeRegistration, ConstraintTagRegistration, BuiltinConstraintBroadeningRegistration, BuiltinConstraintName, ConstraintSemanticRole, VocabularyKeywordRegistration, } from "@formspec/core";
|
|
32
32
|
export type { JSONSchema7, JSONSchemaType, ExtendedJSONSchema7, FormSpecSchemaExtensions, } from "./json-schema/types.js";
|
|
33
|
-
export { setSchemaExtension, getSchemaExtension } from "./json-schema/types.js";
|
|
34
33
|
export { createExtensionRegistry } from "./extensions/index.js";
|
|
35
34
|
export type { ExtensionRegistry } from "./extensions/index.js";
|
|
36
35
|
export type { UISchema, UISchemaElement, UISchemaElementBase, UISchemaElementType, ControlElement, VerticalLayout, HorizontalLayout, GroupLayout, Categorization, Category, LabelElement, Rule, RuleEffect, RuleConditionSchema, SchemaBasedCondition, } from "./ui-schema/types.js";
|
|
37
|
-
export type {
|
|
36
|
+
export type { StaticSchemaGenerationOptions, GenerateFromClassOptions, GenerateFromClassResult, GenerateSchemasOptions, } from "./generators/class-schema.js";
|
|
38
37
|
export type { BuildMixedAuthoringSchemasOptions, MixedAuthoringSchemas, } from "./generators/mixed-authoring.js";
|
|
39
|
-
export { ruleEffectSchema, uiSchemaElementTypeSchema, ruleConditionSchema, schemaBasedConditionSchema, ruleSchema, controlSchema, verticalLayoutSchema, horizontalLayoutSchema, groupLayoutSchema, categorizationSchema, categorySchema, labelElementSchema, uiSchemaElementSchema, uiSchema as uiSchemaSchema, } from "./ui-schema/schema.js";
|
|
40
|
-
export { jsonSchemaTypeSchema, jsonSchema7Schema } from "./json-schema/schema.js";
|
|
41
38
|
export { generateJsonSchema } from "./json-schema/generator.js";
|
|
42
|
-
/**
|
|
43
|
-
* Advanced API — consumers are responsible for supplying canonical FormIR.
|
|
44
|
-
* Most callers should prefer `generateJsonSchema()` or `buildFormSchemas()`.
|
|
45
|
-
*/
|
|
46
|
-
export { generateJsonSchemaFromIR } from "./json-schema/ir-generator.js";
|
|
47
39
|
export { generateUiSchema } from "./ui-schema/generator.js";
|
|
48
40
|
export { generateSchemasFromClass, generateSchemas } from "./generators/class-schema.js";
|
|
49
41
|
export { buildMixedAuthoringSchemas } from "./generators/mixed-authoring.js";
|
|
@@ -102,7 +94,7 @@ export declare function buildFormSchemas<E extends readonly FormElement[]>(form:
|
|
|
102
94
|
*
|
|
103
95
|
* @public
|
|
104
96
|
*/
|
|
105
|
-
export interface WriteSchemasOptions extends
|
|
97
|
+
export interface WriteSchemasOptions extends GenerateJsonSchemaOptions {
|
|
106
98
|
/** Output directory for the schema files */
|
|
107
99
|
readonly outDir: string;
|
|
108
100
|
/** Base name for the output files (without extension). Defaults to "schema" */
|
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,
|
|
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,OAA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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/canonicalize/chain-dsl-canonicalizer.ts
|
|
2
|
-
import { IR_VERSION } from "@formspec/core";
|
|
2
|
+
import { IR_VERSION } from "@formspec/core/internals";
|
|
3
3
|
var CHAIN_DSL_PROVENANCE = {
|
|
4
4
|
surface: "chain-dsl",
|
|
5
5
|
file: "",
|
|
@@ -311,7 +311,7 @@ function buildObjectProperties(elements, insideConditional = false) {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
// src/canonicalize/tsdoc-canonicalizer.ts
|
|
314
|
-
import { IR_VERSION as IR_VERSION2 } from "@formspec/core";
|
|
314
|
+
import { IR_VERSION as IR_VERSION2 } from "@formspec/core/internals";
|
|
315
315
|
function canonicalizeTSDoc(analysis, source) {
|
|
316
316
|
const file = source?.file ?? "";
|
|
317
317
|
const provenance = {
|
|
@@ -824,7 +824,8 @@ function assignVendorPrefixedExtensionKeywords(schema, extensionSchema, vendorPr
|
|
|
824
824
|
// src/json-schema/generator.ts
|
|
825
825
|
function generateJsonSchema(form, options) {
|
|
826
826
|
const ir = canonicalizeChainDSL(form);
|
|
827
|
-
|
|
827
|
+
const internalOptions = options?.vendorPrefix === void 0 ? void 0 : { vendorPrefix: options.vendorPrefix };
|
|
828
|
+
return generateJsonSchemaFromIR(ir, internalOptions);
|
|
828
829
|
}
|
|
829
830
|
|
|
830
831
|
// src/ui-schema/schema.ts
|
|
@@ -1060,14 +1061,6 @@ function generateUiSchema(form) {
|
|
|
1060
1061
|
import * as fs from "fs";
|
|
1061
1062
|
import * as path2 from "path";
|
|
1062
1063
|
|
|
1063
|
-
// src/json-schema/types.ts
|
|
1064
|
-
function setSchemaExtension(schema, key, value) {
|
|
1065
|
-
schema[key] = value;
|
|
1066
|
-
}
|
|
1067
|
-
function getSchemaExtension(schema, key) {
|
|
1068
|
-
return schema[key];
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
1064
|
// src/extensions/registry.ts
|
|
1072
1065
|
function createExtensionRegistry(extensions) {
|
|
1073
1066
|
const typeMap = /* @__PURE__ */ new Map();
|
|
@@ -1148,68 +1141,6 @@ function createExtensionRegistry(extensions) {
|
|
|
1148
1141
|
};
|
|
1149
1142
|
}
|
|
1150
1143
|
|
|
1151
|
-
// src/json-schema/schema.ts
|
|
1152
|
-
import { z as z3 } from "zod";
|
|
1153
|
-
var jsonSchemaTypeSchema = z3.enum([
|
|
1154
|
-
"string",
|
|
1155
|
-
"number",
|
|
1156
|
-
"integer",
|
|
1157
|
-
"boolean",
|
|
1158
|
-
"object",
|
|
1159
|
-
"array",
|
|
1160
|
-
"null"
|
|
1161
|
-
]);
|
|
1162
|
-
var jsonSchema7Schema = z3.lazy(
|
|
1163
|
-
() => z3.object({
|
|
1164
|
-
$schema: z3.string().optional(),
|
|
1165
|
-
$id: z3.string().optional(),
|
|
1166
|
-
$ref: z3.string().optional(),
|
|
1167
|
-
// Metadata
|
|
1168
|
-
title: z3.string().optional(),
|
|
1169
|
-
description: z3.string().optional(),
|
|
1170
|
-
deprecated: z3.boolean().optional(),
|
|
1171
|
-
// Type
|
|
1172
|
-
type: z3.union([jsonSchemaTypeSchema, z3.array(jsonSchemaTypeSchema)]).optional(),
|
|
1173
|
-
// String validation
|
|
1174
|
-
minLength: z3.number().optional(),
|
|
1175
|
-
maxLength: z3.number().optional(),
|
|
1176
|
-
pattern: z3.string().optional(),
|
|
1177
|
-
// Number validation
|
|
1178
|
-
minimum: z3.number().optional(),
|
|
1179
|
-
maximum: z3.number().optional(),
|
|
1180
|
-
exclusiveMinimum: z3.number().optional(),
|
|
1181
|
-
exclusiveMaximum: z3.number().optional(),
|
|
1182
|
-
// Enum
|
|
1183
|
-
enum: z3.array(z3.union([z3.string(), z3.number(), z3.boolean(), z3.null()])).readonly().optional(),
|
|
1184
|
-
const: z3.union([z3.string(), z3.number(), z3.boolean(), z3.null()]).optional(),
|
|
1185
|
-
// Object
|
|
1186
|
-
properties: z3.record(z3.string(), jsonSchema7Schema).optional(),
|
|
1187
|
-
required: z3.array(z3.string()).optional(),
|
|
1188
|
-
additionalProperties: z3.union([z3.boolean(), jsonSchema7Schema]).optional(),
|
|
1189
|
-
// Array
|
|
1190
|
-
items: z3.union([jsonSchema7Schema, z3.array(jsonSchema7Schema)]).optional(),
|
|
1191
|
-
minItems: z3.number().optional(),
|
|
1192
|
-
maxItems: z3.number().optional(),
|
|
1193
|
-
// Composition
|
|
1194
|
-
allOf: z3.array(jsonSchema7Schema).optional(),
|
|
1195
|
-
anyOf: z3.array(jsonSchema7Schema).optional(),
|
|
1196
|
-
oneOf: z3.array(jsonSchema7Schema).optional(),
|
|
1197
|
-
not: jsonSchema7Schema.optional(),
|
|
1198
|
-
// Conditional
|
|
1199
|
-
if: jsonSchema7Schema.optional(),
|
|
1200
|
-
then: jsonSchema7Schema.optional(),
|
|
1201
|
-
else: jsonSchema7Schema.optional(),
|
|
1202
|
-
// Format
|
|
1203
|
-
format: z3.string().optional(),
|
|
1204
|
-
// Default
|
|
1205
|
-
default: z3.unknown().optional(),
|
|
1206
|
-
// FormSpec extensions
|
|
1207
|
-
"x-formspec-source": z3.string().optional(),
|
|
1208
|
-
"x-formspec-params": z3.array(z3.string()).readonly().optional(),
|
|
1209
|
-
"x-formspec-schemaSource": z3.string().optional()
|
|
1210
|
-
}).passthrough()
|
|
1211
|
-
);
|
|
1212
|
-
|
|
1213
1144
|
// src/analyzer/program.ts
|
|
1214
1145
|
import * as ts4 from "typescript";
|
|
1215
1146
|
import * as path from "path";
|
|
@@ -1240,6 +1171,7 @@ import {
|
|
|
1240
1171
|
TSDocConfiguration,
|
|
1241
1172
|
TSDocTagDefinition,
|
|
1242
1173
|
TSDocTagSyntaxKind,
|
|
1174
|
+
DocExcerpt,
|
|
1243
1175
|
DocPlainText,
|
|
1244
1176
|
DocSoftBreak,
|
|
1245
1177
|
TextRange
|
|
@@ -1248,7 +1180,8 @@ import {
|
|
|
1248
1180
|
BUILTIN_CONSTRAINT_DEFINITIONS,
|
|
1249
1181
|
normalizeConstraintTagName,
|
|
1250
1182
|
isBuiltinConstraintName
|
|
1251
|
-
} from "@formspec/core";
|
|
1183
|
+
} from "@formspec/core/internals";
|
|
1184
|
+
import "@formspec/core/internals";
|
|
1252
1185
|
var TAGS_REQUIRING_RAW_TEXT = /* @__PURE__ */ new Set(["pattern", "enumOptions", "defaultValue"]);
|
|
1253
1186
|
function createFormSpecTSDocConfig(extensionTagNames = []) {
|
|
1254
1187
|
const config = new TSDocConfiguration();
|
|
@@ -1295,10 +1228,71 @@ function sharedTagValueOptions(options) {
|
|
|
1295
1228
|
};
|
|
1296
1229
|
}
|
|
1297
1230
|
var SYNTHETIC_TYPE_FORMAT_FLAGS = ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
|
|
1231
|
+
function collectImportedNames(sourceFile) {
|
|
1232
|
+
const importedNames = /* @__PURE__ */ new Set();
|
|
1233
|
+
for (const statement of sourceFile.statements) {
|
|
1234
|
+
if (ts.isImportDeclaration(statement) && statement.importClause !== void 0) {
|
|
1235
|
+
const clause = statement.importClause;
|
|
1236
|
+
if (clause.name !== void 0) {
|
|
1237
|
+
importedNames.add(clause.name.text);
|
|
1238
|
+
}
|
|
1239
|
+
if (clause.namedBindings !== void 0) {
|
|
1240
|
+
if (ts.isNamedImports(clause.namedBindings)) {
|
|
1241
|
+
for (const specifier of clause.namedBindings.elements) {
|
|
1242
|
+
importedNames.add(specifier.name.text);
|
|
1243
|
+
}
|
|
1244
|
+
} else if (ts.isNamespaceImport(clause.namedBindings)) {
|
|
1245
|
+
importedNames.add(clause.namedBindings.name.text);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
continue;
|
|
1249
|
+
}
|
|
1250
|
+
if (ts.isImportEqualsDeclaration(statement)) {
|
|
1251
|
+
importedNames.add(statement.name.text);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
return importedNames;
|
|
1255
|
+
}
|
|
1256
|
+
function isNonReferenceIdentifier(node) {
|
|
1257
|
+
const parent = node.parent;
|
|
1258
|
+
if ((ts.isBindingElement(parent) || ts.isClassDeclaration(parent) || ts.isEnumDeclaration(parent) || ts.isEnumMember(parent) || ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(parent) || ts.isImportClause(parent) || ts.isImportEqualsDeclaration(parent) || ts.isImportSpecifier(parent) || ts.isInterfaceDeclaration(parent) || ts.isMethodDeclaration(parent) || ts.isMethodSignature(parent) || ts.isModuleDeclaration(parent) || ts.isNamespaceExport(parent) || ts.isNamespaceImport(parent) || ts.isParameter(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent) || ts.isSetAccessorDeclaration(parent) || ts.isGetAccessorDeclaration(parent) || ts.isTypeAliasDeclaration(parent) || ts.isTypeParameterDeclaration(parent) || ts.isVariableDeclaration(parent)) && parent.name === node) {
|
|
1259
|
+
return true;
|
|
1260
|
+
}
|
|
1261
|
+
if ((ts.isPropertyAssignment(parent) || ts.isPropertyAccessExpression(parent)) && parent.name === node) {
|
|
1262
|
+
return true;
|
|
1263
|
+
}
|
|
1264
|
+
if (ts.isQualifiedName(parent) && parent.right === node) {
|
|
1265
|
+
return true;
|
|
1266
|
+
}
|
|
1267
|
+
return false;
|
|
1268
|
+
}
|
|
1269
|
+
function statementReferencesImportedName(statement, importedNames) {
|
|
1270
|
+
let referencesImportedName = false;
|
|
1271
|
+
const visit = (node) => {
|
|
1272
|
+
if (referencesImportedName) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
if (ts.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
|
|
1276
|
+
referencesImportedName = true;
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
ts.forEachChild(node, visit);
|
|
1280
|
+
};
|
|
1281
|
+
visit(statement);
|
|
1282
|
+
return referencesImportedName;
|
|
1283
|
+
}
|
|
1298
1284
|
function buildSupportingDeclarations(sourceFile) {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1285
|
+
const importedNames = collectImportedNames(sourceFile);
|
|
1286
|
+
return sourceFile.statements.filter((statement) => {
|
|
1287
|
+
if (ts.isImportDeclaration(statement)) return false;
|
|
1288
|
+
if (ts.isImportEqualsDeclaration(statement)) return false;
|
|
1289
|
+
if (ts.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0)
|
|
1290
|
+
return false;
|
|
1291
|
+
if (importedNames.size > 0 && statementReferencesImportedName(statement, importedNames)) {
|
|
1292
|
+
return false;
|
|
1293
|
+
}
|
|
1294
|
+
return true;
|
|
1295
|
+
}).map((statement) => statement.getText(sourceFile));
|
|
1302
1296
|
}
|
|
1303
1297
|
function renderSyntheticArgumentExpression(valueKind, argumentText) {
|
|
1304
1298
|
const trimmed = argumentText.trim();
|
|
@@ -1885,6 +1879,9 @@ function extractBlockText(block) {
|
|
|
1885
1879
|
}
|
|
1886
1880
|
function extractPlainText(node) {
|
|
1887
1881
|
let result = "";
|
|
1882
|
+
if (node instanceof DocExcerpt) {
|
|
1883
|
+
return node.content.toString();
|
|
1884
|
+
}
|
|
1888
1885
|
if (node instanceof DocPlainText) {
|
|
1889
1886
|
return node.text;
|
|
1890
1887
|
}
|
|
@@ -3540,11 +3537,8 @@ function buildFormSchemas(form, options) {
|
|
|
3540
3537
|
};
|
|
3541
3538
|
}
|
|
3542
3539
|
function writeSchemas(form, options) {
|
|
3543
|
-
const { outDir, name = "schema", indent = 2,
|
|
3544
|
-
const buildOptions =
|
|
3545
|
-
extensionRegistry,
|
|
3546
|
-
vendorPrefix
|
|
3547
|
-
};
|
|
3540
|
+
const { outDir, name = "schema", indent = 2, vendorPrefix } = options;
|
|
3541
|
+
const buildOptions = vendorPrefix === void 0 ? void 0 : { vendorPrefix };
|
|
3548
3542
|
const { jsonSchema, uiSchema: uiSchema2 } = buildFormSchemas(form, buildOptions);
|
|
3549
3543
|
if (!fs.existsSync(outDir)) {
|
|
3550
3544
|
fs.mkdirSync(outDir, { recursive: true });
|
|
@@ -3558,30 +3552,11 @@ function writeSchemas(form, options) {
|
|
|
3558
3552
|
export {
|
|
3559
3553
|
buildFormSchemas,
|
|
3560
3554
|
buildMixedAuthoringSchemas,
|
|
3561
|
-
categorizationSchema,
|
|
3562
|
-
categorySchema,
|
|
3563
|
-
controlSchema,
|
|
3564
3555
|
createExtensionRegistry,
|
|
3565
3556
|
generateJsonSchema,
|
|
3566
|
-
generateJsonSchemaFromIR,
|
|
3567
3557
|
generateSchemas,
|
|
3568
3558
|
generateSchemasFromClass,
|
|
3569
3559
|
generateUiSchema,
|
|
3570
|
-
getSchemaExtension,
|
|
3571
|
-
groupLayoutSchema,
|
|
3572
|
-
horizontalLayoutSchema,
|
|
3573
|
-
jsonSchema7Schema,
|
|
3574
|
-
jsonSchemaTypeSchema,
|
|
3575
|
-
labelElementSchema,
|
|
3576
|
-
ruleConditionSchema,
|
|
3577
|
-
ruleEffectSchema,
|
|
3578
|
-
ruleSchema,
|
|
3579
|
-
schemaBasedConditionSchema,
|
|
3580
|
-
setSchemaExtension,
|
|
3581
|
-
uiSchemaElementSchema,
|
|
3582
|
-
uiSchemaElementTypeSchema,
|
|
3583
|
-
uiSchema as uiSchemaSchema,
|
|
3584
|
-
verticalLayoutSchema,
|
|
3585
3560
|
writeSchemas
|
|
3586
3561
|
};
|
|
3587
3562
|
//# sourceMappingURL=index.js.map
|