@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.
Files changed (153) hide show
  1. package/README.md +9 -4
  2. package/dist/analyzer/class-analyzer.d.ts +1 -1
  3. package/dist/analyzer/class-analyzer.d.ts.map +1 -1
  4. package/dist/analyzer/jsdoc-constraints.d.ts +1 -1
  5. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
  6. package/dist/analyzer/tsdoc-parser.d.ts +1 -1
  7. package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
  8. package/dist/browser.cjs +5 -4
  9. package/dist/browser.cjs.map +1 -1
  10. package/dist/browser.js +4 -3
  11. package/dist/browser.js.map +1 -1
  12. package/dist/build-alpha.d.ts +836 -0
  13. package/dist/build-beta.d.ts +836 -0
  14. package/dist/build-internal.d.ts +836 -0
  15. package/dist/build.d.ts +157 -538
  16. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +2 -1
  17. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -1
  18. package/dist/canonicalize/tsdoc-canonicalizer.d.ts +1 -1
  19. package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
  20. package/dist/cli.cjs +85 -126
  21. package/dist/cli.cjs.map +1 -1
  22. package/dist/cli.js +76 -116
  23. package/dist/cli.js.map +1 -1
  24. package/dist/generators/class-schema.d.ts +20 -3
  25. package/dist/generators/class-schema.d.ts.map +1 -1
  26. package/dist/generators/mixed-authoring.d.ts +3 -2
  27. package/dist/generators/mixed-authoring.d.ts.map +1 -1
  28. package/dist/index.cjs +82 -127
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.ts +4 -12
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +76 -101
  33. package/dist/index.js.map +1 -1
  34. package/dist/internals.cjs +80 -15
  35. package/dist/internals.cjs.map +1 -1
  36. package/dist/internals.d.ts +2 -1
  37. package/dist/internals.d.ts.map +1 -1
  38. package/dist/internals.js +73 -7
  39. package/dist/internals.js.map +1 -1
  40. package/dist/json-schema/generator.d.ts +8 -4
  41. package/dist/json-schema/generator.d.ts.map +1 -1
  42. package/dist/json-schema/ir-generator.d.ts +4 -4
  43. package/dist/json-schema/ir-generator.d.ts.map +1 -1
  44. package/dist/json-schema/schema.d.ts +2 -2
  45. package/dist/json-schema/types.d.ts +6 -6
  46. package/dist/ui-schema/ir-generator.d.ts +1 -1
  47. package/dist/ui-schema/ir-generator.d.ts.map +1 -1
  48. package/dist/ui-schema/schema.d.ts +28 -28
  49. package/dist/ui-schema/types.d.ts +152 -3
  50. package/dist/ui-schema/types.d.ts.map +1 -1
  51. package/dist/validate/constraint-validator.d.ts +1 -1
  52. package/dist/validate/constraint-validator.d.ts.map +1 -1
  53. package/package.json +8 -8
  54. package/dist/__tests__/alias-chain-propagation.test.d.ts +0 -9
  55. package/dist/__tests__/alias-chain-propagation.test.d.ts.map +0 -1
  56. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +0 -2
  57. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +0 -1
  58. package/dist/__tests__/class-schema.test.d.ts +0 -2
  59. package/dist/__tests__/class-schema.test.d.ts.map +0 -1
  60. package/dist/__tests__/cli.test.d.ts +0 -2
  61. package/dist/__tests__/cli.test.d.ts.map +0 -1
  62. package/dist/__tests__/constraint-validator.test.d.ts +0 -2
  63. package/dist/__tests__/constraint-validator.test.d.ts.map +0 -1
  64. package/dist/__tests__/date-extension.integration.test.d.ts +0 -2
  65. package/dist/__tests__/date-extension.integration.test.d.ts.map +0 -1
  66. package/dist/__tests__/edge-cases.test.d.ts +0 -7
  67. package/dist/__tests__/edge-cases.test.d.ts.map +0 -1
  68. package/dist/__tests__/extension-api.test.d.ts +0 -2
  69. package/dist/__tests__/extension-api.test.d.ts.map +0 -1
  70. package/dist/__tests__/extension-runtime.integration.test.d.ts +0 -2
  71. package/dist/__tests__/extension-runtime.integration.test.d.ts.map +0 -1
  72. package/dist/__tests__/fixtures/alias-chains.d.ts +0 -37
  73. package/dist/__tests__/fixtures/alias-chains.d.ts.map +0 -1
  74. package/dist/__tests__/fixtures/class-schema-regressions.d.ts +0 -86
  75. package/dist/__tests__/fixtures/class-schema-regressions.d.ts.map +0 -1
  76. package/dist/__tests__/fixtures/edge-cases.d.ts +0 -132
  77. package/dist/__tests__/fixtures/edge-cases.d.ts.map +0 -1
  78. package/dist/__tests__/fixtures/example-a-builtins.d.ts +0 -31
  79. package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +0 -1
  80. package/dist/__tests__/fixtures/example-date-extension.d.ts +0 -12
  81. package/dist/__tests__/fixtures/example-date-extension.d.ts.map +0 -1
  82. package/dist/__tests__/fixtures/example-interface-types.d.ts +0 -107
  83. package/dist/__tests__/fixtures/example-interface-types.d.ts.map +0 -1
  84. package/dist/__tests__/fixtures/example-numeric-extension.d.ts +0 -20
  85. package/dist/__tests__/fixtures/example-numeric-extension.d.ts.map +0 -1
  86. package/dist/__tests__/fixtures/extension-forms.d.ts +0 -7
  87. package/dist/__tests__/fixtures/extension-forms.d.ts.map +0 -1
  88. package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts +0 -31
  89. package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts.map +0 -1
  90. package/dist/__tests__/fixtures/named-primitive-aliases.d.ts +0 -15
  91. package/dist/__tests__/fixtures/named-primitive-aliases.d.ts.map +0 -1
  92. package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts +0 -14
  93. package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts.map +0 -1
  94. package/dist/__tests__/fixtures/sample-forms.d.ts +0 -65
  95. package/dist/__tests__/fixtures/sample-forms.d.ts.map +0 -1
  96. package/dist/__tests__/generate-schemas.test.d.ts +0 -2
  97. package/dist/__tests__/generate-schemas.test.d.ts.map +0 -1
  98. package/dist/__tests__/generator.test.d.ts +0 -2
  99. package/dist/__tests__/generator.test.d.ts.map +0 -1
  100. package/dist/__tests__/guards.test.d.ts +0 -2
  101. package/dist/__tests__/guards.test.d.ts.map +0 -1
  102. package/dist/__tests__/integration.test.d.ts +0 -8
  103. package/dist/__tests__/integration.test.d.ts.map +0 -1
  104. package/dist/__tests__/ir-analyzer.test.d.ts +0 -11
  105. package/dist/__tests__/ir-analyzer.test.d.ts.map +0 -1
  106. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +0 -12
  107. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +0 -1
  108. package/dist/__tests__/ir-json-schema-generator.test.d.ts +0 -11
  109. package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +0 -1
  110. package/dist/__tests__/ir-ui-schema-generator.test.d.ts +0 -2
  111. package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +0 -1
  112. package/dist/__tests__/mixed-authoring.test.d.ts +0 -2
  113. package/dist/__tests__/mixed-authoring.test.d.ts.map +0 -1
  114. package/dist/__tests__/numeric-extension.integration.test.d.ts +0 -2
  115. package/dist/__tests__/numeric-extension.integration.test.d.ts.map +0 -1
  116. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +0 -9
  117. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +0 -1
  118. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +0 -9
  119. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +0 -1
  120. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +0 -19
  121. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +0 -1
  122. package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts +0 -19
  123. package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts.map +0 -1
  124. package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts +0 -6
  125. package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts.map +0 -1
  126. package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts +0 -17
  127. package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts.map +0 -1
  128. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +0 -13
  129. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +0 -1
  130. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +0 -9
  131. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +0 -1
  132. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +0 -28
  133. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +0 -1
  134. package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts +0 -9
  135. package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts.map +0 -1
  136. package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts +0 -6
  137. package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts.map +0 -1
  138. package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts +0 -19
  139. package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts.map +0 -1
  140. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +0 -12
  141. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +0 -1
  142. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +0 -9
  143. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +0 -1
  144. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +0 -19
  145. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +0 -1
  146. package/dist/__tests__/parity/parity.test.d.ts +0 -18
  147. package/dist/__tests__/parity/parity.test.d.ts.map +0 -1
  148. package/dist/__tests__/parity/utils.d.ts +0 -152
  149. package/dist/__tests__/parity/utils.d.ts.map +0 -1
  150. package/dist/__tests__/path-target-parser.test.d.ts +0 -9
  151. package/dist/__tests__/path-target-parser.test.d.ts.map +0 -1
  152. package/dist/__tests__/write-schemas.test.d.ts +0 -2
  153. package/dist/__tests__/write-schemas.test.d.ts.map +0 -1
@@ -7,7 +7,8 @@
7
7
  * downstream phases (validation, JSON Schema generation, UI Schema generation)
8
8
  * consume.
9
9
  */
10
- import type { FormElement, FormSpec, FormIR } from "@formspec/core";
10
+ import type { FormElement, FormSpec } from "@formspec/core";
11
+ import type { FormIR } from "@formspec/core/internals";
11
12
  /**
12
13
  * Translates a chain DSL `FormSpec` into the canonical `FormIR`.
13
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"chain-dsl-canonicalizer.d.ts","sourceRoot":"","sources":["../../src/canonicalize/chain-dsl-canonicalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EASV,WAAW,EACX,QAAQ,EAiBR,MAAM,EAYP,MAAM,gBAAgB,CAAC;AAqCxB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,GAAG,MAAM,CASnF"}
1
+ {"version":3,"file":"chain-dsl-canonicalizer.d.ts","sourceRoot":"","sources":["../../src/canonicalize/chain-dsl-canonicalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EASV,WAAW,EACX,QAAQ,EAMT,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAYV,MAAM,EAYP,MAAM,0BAA0B,CAAC;AAqClC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,GAAG,MAAM,CASnF"}
@@ -8,7 +8,7 @@
8
8
  * the layout metadata to wrap fields in `GroupLayoutNode` and
9
9
  * `ConditionalLayoutNode` elements.
10
10
  */
11
- import type { FormIR } from "@formspec/core";
11
+ import type { FormIR } from "@formspec/core/internals";
12
12
  import type { IRClassAnalysis } from "../analyzer/class-analyzer.js";
13
13
  /**
14
14
  * Source-level metadata for provenance tracking.
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc-canonicalizer.d.ts","sourceRoot":"","sources":["../../src/canonicalize/tsdoc-canonicalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,MAAM,EAMP,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,+BAA+B,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAuBzF"}
1
+ {"version":3,"file":"tsdoc-canonicalizer.d.ts","sourceRoot":"","sources":["../../src/canonicalize/tsdoc-canonicalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,MAAM,EAMP,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,+BAA+B,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAuBzF"}
package/dist/cli.cjs CHANGED
@@ -43,7 +43,7 @@ function isField(el) {
43
43
  function canonicalizeChainDSL(form) {
44
44
  return {
45
45
  kind: "form-ir",
46
- irVersion: import_core.IR_VERSION,
46
+ irVersion: import_internals.IR_VERSION,
47
47
  elements: canonicalizeElements(form.elements),
48
48
  rootAnnotations: [],
49
49
  typeRegistry: {},
@@ -334,11 +334,11 @@ function buildObjectProperties(elements, insideConditional = false) {
334
334
  }
335
335
  return properties;
336
336
  }
337
- var import_core, CHAIN_DSL_PROVENANCE;
337
+ var import_internals, CHAIN_DSL_PROVENANCE;
338
338
  var init_chain_dsl_canonicalizer = __esm({
339
339
  "src/canonicalize/chain-dsl-canonicalizer.ts"() {
340
340
  "use strict";
341
- import_core = require("@formspec/core");
341
+ import_internals = require("@formspec/core/internals");
342
342
  CHAIN_DSL_PROVENANCE = {
343
343
  surface: "chain-dsl",
344
344
  file: "",
@@ -360,7 +360,7 @@ function canonicalizeTSDoc(analysis, source) {
360
360
  const elements = assembleElements(analysis.fields, analysis.fieldLayouts, provenance);
361
361
  return {
362
362
  kind: "form-ir",
363
- irVersion: import_core2.IR_VERSION,
363
+ irVersion: import_internals2.IR_VERSION,
364
364
  elements,
365
365
  typeRegistry: analysis.typeRegistry,
366
366
  ...analysis.annotations !== void 0 && analysis.annotations.length > 0 && { rootAnnotations: analysis.annotations },
@@ -422,11 +422,11 @@ function wrapInConditional(field, layout, provenance) {
422
422
  };
423
423
  return conditional;
424
424
  }
425
- var import_core2;
425
+ var import_internals2;
426
426
  var init_tsdoc_canonicalizer = __esm({
427
427
  "src/canonicalize/tsdoc-canonicalizer.ts"() {
428
428
  "use strict";
429
- import_core2 = require("@formspec/core");
429
+ import_internals2 = require("@formspec/core/internals");
430
430
  }
431
431
  });
432
432
 
@@ -882,7 +882,8 @@ var init_ir_generator = __esm({
882
882
  // src/json-schema/generator.ts
883
883
  function generateJsonSchema(form, options) {
884
884
  const ir = canonicalizeChainDSL(form);
885
- return generateJsonSchemaFromIR(ir, options);
885
+ const internalOptions = options?.vendorPrefix === void 0 ? void 0 : { vendorPrefix: options.vendorPrefix };
886
+ return generateJsonSchemaFromIR(ir, internalOptions);
886
887
  }
887
888
  var init_generator = __esm({
888
889
  "src/json-schema/generator.ts"() {
@@ -1141,19 +1142,6 @@ var init_generator2 = __esm({
1141
1142
  }
1142
1143
  });
1143
1144
 
1144
- // src/json-schema/types.ts
1145
- function setSchemaExtension(schema, key, value) {
1146
- schema[key] = value;
1147
- }
1148
- function getSchemaExtension(schema, key) {
1149
- return schema[key];
1150
- }
1151
- var init_types = __esm({
1152
- "src/json-schema/types.ts"() {
1153
- "use strict";
1154
- }
1155
- });
1156
-
1157
1145
  // src/extensions/registry.ts
1158
1146
  function createExtensionRegistry(extensions) {
1159
1147
  const typeMap = /* @__PURE__ */ new Map();
@@ -1247,78 +1235,10 @@ var init_extensions = __esm({
1247
1235
  }
1248
1236
  });
1249
1237
 
1250
- // src/json-schema/schema.ts
1251
- var import_zod3, jsonSchemaTypeSchema, jsonSchema7Schema;
1252
- var init_schema2 = __esm({
1253
- "src/json-schema/schema.ts"() {
1254
- "use strict";
1255
- import_zod3 = require("zod");
1256
- jsonSchemaTypeSchema = import_zod3.z.enum([
1257
- "string",
1258
- "number",
1259
- "integer",
1260
- "boolean",
1261
- "object",
1262
- "array",
1263
- "null"
1264
- ]);
1265
- jsonSchema7Schema = import_zod3.z.lazy(
1266
- () => import_zod3.z.object({
1267
- $schema: import_zod3.z.string().optional(),
1268
- $id: import_zod3.z.string().optional(),
1269
- $ref: import_zod3.z.string().optional(),
1270
- // Metadata
1271
- title: import_zod3.z.string().optional(),
1272
- description: import_zod3.z.string().optional(),
1273
- deprecated: import_zod3.z.boolean().optional(),
1274
- // Type
1275
- type: import_zod3.z.union([jsonSchemaTypeSchema, import_zod3.z.array(jsonSchemaTypeSchema)]).optional(),
1276
- // String validation
1277
- minLength: import_zod3.z.number().optional(),
1278
- maxLength: import_zod3.z.number().optional(),
1279
- pattern: import_zod3.z.string().optional(),
1280
- // Number validation
1281
- minimum: import_zod3.z.number().optional(),
1282
- maximum: import_zod3.z.number().optional(),
1283
- exclusiveMinimum: import_zod3.z.number().optional(),
1284
- exclusiveMaximum: import_zod3.z.number().optional(),
1285
- // Enum
1286
- enum: import_zod3.z.array(import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number(), import_zod3.z.boolean(), import_zod3.z.null()])).readonly().optional(),
1287
- const: import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number(), import_zod3.z.boolean(), import_zod3.z.null()]).optional(),
1288
- // Object
1289
- properties: import_zod3.z.record(import_zod3.z.string(), jsonSchema7Schema).optional(),
1290
- required: import_zod3.z.array(import_zod3.z.string()).optional(),
1291
- additionalProperties: import_zod3.z.union([import_zod3.z.boolean(), jsonSchema7Schema]).optional(),
1292
- // Array
1293
- items: import_zod3.z.union([jsonSchema7Schema, import_zod3.z.array(jsonSchema7Schema)]).optional(),
1294
- minItems: import_zod3.z.number().optional(),
1295
- maxItems: import_zod3.z.number().optional(),
1296
- // Composition
1297
- allOf: import_zod3.z.array(jsonSchema7Schema).optional(),
1298
- anyOf: import_zod3.z.array(jsonSchema7Schema).optional(),
1299
- oneOf: import_zod3.z.array(jsonSchema7Schema).optional(),
1300
- not: jsonSchema7Schema.optional(),
1301
- // Conditional
1302
- if: jsonSchema7Schema.optional(),
1303
- then: jsonSchema7Schema.optional(),
1304
- else: jsonSchema7Schema.optional(),
1305
- // Format
1306
- format: import_zod3.z.string().optional(),
1307
- // Default
1308
- default: import_zod3.z.unknown().optional(),
1309
- // FormSpec extensions
1310
- "x-formspec-source": import_zod3.z.string().optional(),
1311
- "x-formspec-params": import_zod3.z.array(import_zod3.z.string()).readonly().optional(),
1312
- "x-formspec-schemaSource": import_zod3.z.string().optional()
1313
- }).passthrough()
1314
- );
1315
- }
1316
- });
1317
-
1318
1238
  // src/analyzer/tsdoc-parser.ts
1319
1239
  function createFormSpecTSDocConfig(extensionTagNames = []) {
1320
1240
  const config = new import_tsdoc.TSDocConfiguration();
1321
- for (const tagName of Object.keys(import_core3.BUILTIN_CONSTRAINT_DEFINITIONS)) {
1241
+ for (const tagName of Object.keys(import_internals3.BUILTIN_CONSTRAINT_DEFINITIONS)) {
1322
1242
  config.addTagDefinition(
1323
1243
  new import_tsdoc.TSDocTagDefinition({
1324
1244
  tagName: "@" + tagName,
@@ -1360,10 +1280,71 @@ function sharedTagValueOptions(options) {
1360
1280
  ...options?.fieldType !== void 0 ? { fieldType: options.fieldType } : {}
1361
1281
  };
1362
1282
  }
1283
+ function collectImportedNames(sourceFile) {
1284
+ const importedNames = /* @__PURE__ */ new Set();
1285
+ for (const statement of sourceFile.statements) {
1286
+ if (ts.isImportDeclaration(statement) && statement.importClause !== void 0) {
1287
+ const clause = statement.importClause;
1288
+ if (clause.name !== void 0) {
1289
+ importedNames.add(clause.name.text);
1290
+ }
1291
+ if (clause.namedBindings !== void 0) {
1292
+ if (ts.isNamedImports(clause.namedBindings)) {
1293
+ for (const specifier of clause.namedBindings.elements) {
1294
+ importedNames.add(specifier.name.text);
1295
+ }
1296
+ } else if (ts.isNamespaceImport(clause.namedBindings)) {
1297
+ importedNames.add(clause.namedBindings.name.text);
1298
+ }
1299
+ }
1300
+ continue;
1301
+ }
1302
+ if (ts.isImportEqualsDeclaration(statement)) {
1303
+ importedNames.add(statement.name.text);
1304
+ }
1305
+ }
1306
+ return importedNames;
1307
+ }
1308
+ function isNonReferenceIdentifier(node) {
1309
+ const parent = node.parent;
1310
+ 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) {
1311
+ return true;
1312
+ }
1313
+ if ((ts.isPropertyAssignment(parent) || ts.isPropertyAccessExpression(parent)) && parent.name === node) {
1314
+ return true;
1315
+ }
1316
+ if (ts.isQualifiedName(parent) && parent.right === node) {
1317
+ return true;
1318
+ }
1319
+ return false;
1320
+ }
1321
+ function statementReferencesImportedName(statement, importedNames) {
1322
+ let referencesImportedName = false;
1323
+ const visit = (node) => {
1324
+ if (referencesImportedName) {
1325
+ return;
1326
+ }
1327
+ if (ts.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
1328
+ referencesImportedName = true;
1329
+ return;
1330
+ }
1331
+ ts.forEachChild(node, visit);
1332
+ };
1333
+ visit(statement);
1334
+ return referencesImportedName;
1335
+ }
1363
1336
  function buildSupportingDeclarations(sourceFile) {
1364
- return sourceFile.statements.filter(
1365
- (statement) => !ts.isImportDeclaration(statement) && !ts.isImportEqualsDeclaration(statement) && !(ts.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0)
1366
- ).map((statement) => statement.getText(sourceFile));
1337
+ const importedNames = collectImportedNames(sourceFile);
1338
+ return sourceFile.statements.filter((statement) => {
1339
+ if (ts.isImportDeclaration(statement)) return false;
1340
+ if (ts.isImportEqualsDeclaration(statement)) return false;
1341
+ if (ts.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0)
1342
+ return false;
1343
+ if (importedNames.size > 0 && statementReferencesImportedName(statement, importedNames)) {
1344
+ return false;
1345
+ }
1346
+ return true;
1347
+ }).map((statement) => statement.getText(sourceFile));
1367
1348
  }
1368
1349
  function renderSyntheticArgumentExpression(valueKind, argumentText) {
1369
1350
  const trimmed = argumentText.trim();
@@ -1500,7 +1481,7 @@ function hasBuiltinConstraintBroadening(tagName, options) {
1500
1481
  return broadenedTypeId !== void 0 && options?.extensionRegistry?.findBuiltinConstraintBroadening(broadenedTypeId, tagName) !== void 0;
1501
1482
  }
1502
1483
  function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, parsedTag, provenance, supportingDeclarations, options) {
1503
- if (!(0, import_core3.isBuiltinConstraintName)(tagName)) {
1484
+ if (!(0, import_internals3.isBuiltinConstraintName)(tagName)) {
1504
1485
  return [];
1505
1486
  }
1506
1487
  const checker = options?.checker;
@@ -1728,7 +1709,7 @@ function parseTSDocTags(node, file = "", options) {
1728
1709
  }
1729
1710
  }
1730
1711
  for (const block of docComment.customBlocks) {
1731
- const tagName = (0, import_core3.normalizeConstraintTagName)(block.blockTag.tagName.substring(1));
1712
+ const tagName = (0, import_internals3.normalizeConstraintTagName)(block.blockTag.tagName.substring(1));
1732
1713
  const parsedTag = nextParsedTag(tagName);
1733
1714
  if (tagName === "displayName" || tagName === "format" || tagName === "placeholder") {
1734
1715
  const text2 = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
@@ -1760,7 +1741,7 @@ function parseTSDocTags(node, file = "", options) {
1760
1741
  }
1761
1742
  if (TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
1762
1743
  const text = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
1763
- const expectedType = (0, import_core3.isBuiltinConstraintName)(tagName) ? import_core3.BUILTIN_CONSTRAINT_DEFINITIONS[tagName] : void 0;
1744
+ const expectedType = (0, import_internals3.isBuiltinConstraintName)(tagName) ? import_internals3.BUILTIN_CONSTRAINT_DEFINITIONS[tagName] : void 0;
1764
1745
  if (text === "" && expectedType !== "boolean") continue;
1765
1746
  const provenance = parsedTag !== null ? provenanceForParsedTag(parsedTag, sourceFile, file) : provenanceForComment(range, sourceFile, file, tagName);
1766
1747
  const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
@@ -1948,6 +1929,9 @@ function extractBlockText(block) {
1948
1929
  }
1949
1930
  function extractPlainText(node) {
1950
1931
  let result = "";
1932
+ if (node instanceof import_tsdoc.DocExcerpt) {
1933
+ return node.content.toString();
1934
+ }
1951
1935
  if (node instanceof import_tsdoc.DocPlainText) {
1952
1936
  return node.text;
1953
1937
  }
@@ -1988,7 +1972,7 @@ function getBestBlockPayloadText(tag, commentText, commentOffset, block) {
1988
1972
  function collectRawTextFallbacks(node, file) {
1989
1973
  const fallbacks = /* @__PURE__ */ new Map();
1990
1974
  for (const tag of ts.getJSDocTags(node)) {
1991
- const tagName = (0, import_core3.normalizeConstraintTagName)(tag.tagName.text);
1975
+ const tagName = (0, import_internals3.normalizeConstraintTagName)(tag.tagName.text);
1992
1976
  if (!TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
1993
1977
  const commentText = getTagCommentText(tag)?.trim() ?? "";
1994
1978
  if (commentText === "") continue;
@@ -2044,14 +2028,15 @@ function getTagCommentText(tag) {
2044
2028
  }
2045
2029
  return ts.getTextOfJSDocComment(tag.comment);
2046
2030
  }
2047
- var ts, import_internal, import_tsdoc, import_core3, TAGS_REQUIRING_RAW_TEXT, SYNTHETIC_TYPE_FORMAT_FLAGS, parserCache, parseResultCache;
2031
+ var ts, import_internal, import_tsdoc, import_internals3, import_internals4, TAGS_REQUIRING_RAW_TEXT, SYNTHETIC_TYPE_FORMAT_FLAGS, parserCache, parseResultCache;
2048
2032
  var init_tsdoc_parser = __esm({
2049
2033
  "src/analyzer/tsdoc-parser.ts"() {
2050
2034
  "use strict";
2051
2035
  ts = __toESM(require("typescript"), 1);
2052
2036
  import_internal = require("@formspec/analysis/internal");
2053
2037
  import_tsdoc = require("@microsoft/tsdoc");
2054
- import_core3 = require("@formspec/core");
2038
+ import_internals3 = require("@formspec/core/internals");
2039
+ import_internals4 = require("@formspec/core/internals");
2055
2040
  TAGS_REQUIRING_RAW_TEXT = /* @__PURE__ */ new Set(["pattern", "enumOptions", "defaultValue"]);
2056
2041
  SYNTHETIC_TYPE_FORMAT_FLAGS = ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
2057
2042
  parserCache = /* @__PURE__ */ new Map();
@@ -3672,30 +3657,11 @@ var index_exports = {};
3672
3657
  __export(index_exports, {
3673
3658
  buildFormSchemas: () => buildFormSchemas,
3674
3659
  buildMixedAuthoringSchemas: () => buildMixedAuthoringSchemas,
3675
- categorizationSchema: () => categorizationSchema,
3676
- categorySchema: () => categorySchema,
3677
- controlSchema: () => controlSchema,
3678
3660
  createExtensionRegistry: () => createExtensionRegistry,
3679
3661
  generateJsonSchema: () => generateJsonSchema,
3680
- generateJsonSchemaFromIR: () => generateJsonSchemaFromIR,
3681
3662
  generateSchemas: () => generateSchemas,
3682
3663
  generateSchemasFromClass: () => generateSchemasFromClass,
3683
3664
  generateUiSchema: () => generateUiSchema,
3684
- getSchemaExtension: () => getSchemaExtension,
3685
- groupLayoutSchema: () => groupLayoutSchema,
3686
- horizontalLayoutSchema: () => horizontalLayoutSchema,
3687
- jsonSchema7Schema: () => jsonSchema7Schema,
3688
- jsonSchemaTypeSchema: () => jsonSchemaTypeSchema,
3689
- labelElementSchema: () => labelElementSchema,
3690
- ruleConditionSchema: () => ruleConditionSchema,
3691
- ruleEffectSchema: () => ruleEffectSchema,
3692
- ruleSchema: () => ruleSchema,
3693
- schemaBasedConditionSchema: () => schemaBasedConditionSchema,
3694
- setSchemaExtension: () => setSchemaExtension,
3695
- uiSchemaElementSchema: () => uiSchemaElementSchema,
3696
- uiSchemaElementTypeSchema: () => uiSchemaElementTypeSchema,
3697
- uiSchemaSchema: () => uiSchema,
3698
- verticalLayoutSchema: () => verticalLayoutSchema,
3699
3665
  writeSchemas: () => writeSchemas
3700
3666
  });
3701
3667
  function buildFormSchemas(form, options) {
@@ -3705,11 +3671,8 @@ function buildFormSchemas(form, options) {
3705
3671
  };
3706
3672
  }
3707
3673
  function writeSchemas(form, options) {
3708
- const { outDir, name = "schema", indent = 2, extensionRegistry, vendorPrefix } = options;
3709
- const buildOptions = extensionRegistry === void 0 && vendorPrefix === void 0 ? void 0 : {
3710
- extensionRegistry,
3711
- vendorPrefix
3712
- };
3674
+ const { outDir, name = "schema", indent = 2, vendorPrefix } = options;
3675
+ const buildOptions = vendorPrefix === void 0 ? void 0 : { vendorPrefix };
3713
3676
  const { jsonSchema, uiSchema: uiSchema2 } = buildFormSchemas(form, buildOptions);
3714
3677
  if (!fs.existsSync(outDir)) {
3715
3678
  fs.mkdirSync(outDir, { recursive: true });
@@ -3729,12 +3692,8 @@ var init_index = __esm({
3729
3692
  init_ir_generator();
3730
3693
  fs = __toESM(require("fs"), 1);
3731
3694
  path2 = __toESM(require("path"), 1);
3732
- init_types();
3733
3695
  init_extensions();
3734
- init_schema();
3735
- init_schema2();
3736
3696
  init_generator();
3737
- init_ir_generator();
3738
3697
  init_generator2();
3739
3698
  init_class_schema();
3740
3699
  init_mixed_authoring();