@formspec/build 0.1.0-alpha.19 → 0.1.0-alpha.20

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 (35) hide show
  1. package/dist/__tests__/fixtures/class-schema-regressions.d.ts +4 -0
  2. package/dist/__tests__/fixtures/class-schema-regressions.d.ts.map +1 -1
  3. package/dist/__tests__/parity/utils.d.ts.map +1 -1
  4. package/dist/analyzer/class-analyzer.d.ts +4 -1
  5. package/dist/analyzer/class-analyzer.d.ts.map +1 -1
  6. package/dist/analyzer/jsdoc-constraints.d.ts +2 -1
  7. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
  8. package/dist/analyzer/tsdoc-parser.d.ts +13 -3
  9. package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
  10. package/dist/browser.cjs +30 -748
  11. package/dist/browser.cjs.map +1 -1
  12. package/dist/browser.js +32 -748
  13. package/dist/browser.js.map +1 -1
  14. package/dist/build.d.ts +14 -14
  15. package/dist/cli.cjs +691 -1101
  16. package/dist/cli.cjs.map +1 -1
  17. package/dist/cli.js +704 -1100
  18. package/dist/cli.js.map +1 -1
  19. package/dist/generators/class-schema.d.ts.map +1 -1
  20. package/dist/index.cjs +689 -1095
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.js +703 -1095
  23. package/dist/index.js.map +1 -1
  24. package/dist/internals.cjs +663 -1069
  25. package/dist/internals.cjs.map +1 -1
  26. package/dist/internals.js +675 -1067
  27. package/dist/internals.js.map +1 -1
  28. package/dist/ui-schema/schema.d.ts +14 -14
  29. package/dist/validate/constraint-validator.d.ts +6 -45
  30. package/dist/validate/constraint-validator.d.ts.map +1 -1
  31. package/package.json +2 -1
  32. package/dist/__tests__/json-utils.test.d.ts +0 -5
  33. package/dist/__tests__/json-utils.test.d.ts.map +0 -1
  34. package/dist/analyzer/json-utils.d.ts +0 -22
  35. package/dist/analyzer/json-utils.d.ts.map +0 -1
@@ -74,17 +74,17 @@ export declare const ruleSchema: z.ZodObject<{
74
74
  scope: string;
75
75
  }>;
76
76
  }, "strict", z.ZodTypeAny, {
77
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
78
77
  condition: {
79
78
  schema: RuleConditionSchema;
80
79
  scope: string;
81
80
  };
82
- }, {
83
81
  effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
82
+ }, {
84
83
  condition: {
85
84
  schema: RuleConditionSchema;
86
85
  scope: string;
87
86
  };
87
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
88
88
  }>;
89
89
  /**
90
90
  * Rule for conditional element visibility/enablement.
@@ -115,17 +115,17 @@ export declare const controlSchema: z.ZodObject<{
115
115
  scope: string;
116
116
  }>;
117
117
  }, "strict", z.ZodTypeAny, {
118
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
119
118
  condition: {
120
119
  schema: RuleConditionSchema;
121
120
  scope: string;
122
121
  };
123
- }, {
124
122
  effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
123
+ }, {
125
124
  condition: {
126
125
  schema: RuleConditionSchema;
127
126
  scope: string;
128
127
  };
128
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
129
129
  }>>;
130
130
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
131
131
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -145,17 +145,17 @@ export declare const controlSchema: z.ZodObject<{
145
145
  scope: string;
146
146
  }>;
147
147
  }, "strict", z.ZodTypeAny, {
148
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
149
148
  condition: {
150
149
  schema: RuleConditionSchema;
151
150
  scope: string;
152
151
  };
153
- }, {
154
152
  effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
153
+ }, {
155
154
  condition: {
156
155
  schema: RuleConditionSchema;
157
156
  scope: string;
158
157
  };
158
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
159
159
  }>>;
160
160
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
161
161
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
@@ -175,17 +175,17 @@ export declare const controlSchema: z.ZodObject<{
175
175
  scope: string;
176
176
  }>;
177
177
  }, "strict", z.ZodTypeAny, {
178
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
179
178
  condition: {
180
179
  schema: RuleConditionSchema;
181
180
  scope: string;
182
181
  };
183
- }, {
184
182
  effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
183
+ }, {
185
184
  condition: {
186
185
  schema: RuleConditionSchema;
187
186
  scope: string;
188
187
  };
188
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
189
189
  }>>;
190
190
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
191
191
  }, z.ZodTypeAny, "passthrough">>;
@@ -270,17 +270,17 @@ export declare const labelElementSchema: z.ZodObject<{
270
270
  scope: string;
271
271
  }>;
272
272
  }, "strict", z.ZodTypeAny, {
273
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
274
273
  condition: {
275
274
  schema: RuleConditionSchema;
276
275
  scope: string;
277
276
  };
278
- }, {
279
277
  effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
278
+ }, {
280
279
  condition: {
281
280
  schema: RuleConditionSchema;
282
281
  scope: string;
283
282
  };
283
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
284
284
  }>>;
285
285
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
286
286
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -299,17 +299,17 @@ export declare const labelElementSchema: z.ZodObject<{
299
299
  scope: string;
300
300
  }>;
301
301
  }, "strict", z.ZodTypeAny, {
302
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
303
302
  condition: {
304
303
  schema: RuleConditionSchema;
305
304
  scope: string;
306
305
  };
307
- }, {
308
306
  effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
307
+ }, {
309
308
  condition: {
310
309
  schema: RuleConditionSchema;
311
310
  scope: string;
312
311
  };
312
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
313
313
  }>>;
314
314
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
315
315
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
@@ -328,17 +328,17 @@ export declare const labelElementSchema: z.ZodObject<{
328
328
  scope: string;
329
329
  }>;
330
330
  }, "strict", z.ZodTypeAny, {
331
- effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
332
331
  condition: {
333
332
  schema: RuleConditionSchema;
334
333
  scope: string;
335
334
  };
336
- }, {
337
335
  effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
336
+ }, {
338
337
  condition: {
339
338
  schema: RuleConditionSchema;
340
339
  scope: string;
341
340
  };
341
+ effect: "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
342
342
  }>>;
343
343
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
344
344
  }, z.ZodTypeAny, "passthrough">>;
@@ -1,62 +1,23 @@
1
1
  /**
2
2
  * Constraint validator for the FormSpec IR.
3
3
  *
4
- * Performs the Validate pipeline phase:
5
- * - Contradiction detection between paired constraints
6
- * - Type applicability checks (e.g. numeric constraints on string fields)
7
- * - Custom constraint type applicability (when extension registry is provided)
8
- * - Unknown extension warnings (when a registry is provided)
4
+ * Delegates target-centric semantic analysis to `@formspec/analysis` so build
5
+ * validation and editor tooling share the same inheritance, path-target,
6
+ * contradiction, and broadening semantics.
9
7
  *
10
8
  * @packageDocumentation
11
9
  */
12
- import type { FormIR, Provenance } from "@formspec/core";
10
+ import { type ConstraintSemanticDiagnostic } from "@formspec/analysis";
11
+ import type { FormIR } from "@formspec/core";
13
12
  import type { ExtensionRegistry } from "../extensions/index.js";
14
- /**
15
- * A structured diagnostic produced by constraint validation.
16
- *
17
- * The `code` is a stable, machine-readable semantic identifier.
18
- * Examples: `CONTRADICTING_CONSTRAINTS`, `TYPE_MISMATCH`, `UNKNOWN_EXTENSION`.
19
- */
20
- export interface ValidationDiagnostic {
21
- readonly code: string;
22
- readonly message: string;
23
- readonly severity: "error" | "warning";
24
- /** Location of the primary constraint involved in the violation. */
25
- readonly primaryLocation: Provenance;
26
- /** Related locations (e.g., the other side of a contradiction pair). */
27
- readonly relatedLocations: readonly Provenance[];
28
- }
29
- /** Result of validating a {@link FormIR}. */
13
+ export type ValidationDiagnostic = ConstraintSemanticDiagnostic;
30
14
  export interface ValidationResult {
31
15
  readonly diagnostics: readonly ValidationDiagnostic[];
32
- /** `true` if there are no error-severity diagnostics (warnings are OK). */
33
16
  readonly valid: boolean;
34
17
  }
35
- /** Options for constraint validation. */
36
18
  export interface ValidateIROptions {
37
- /** @deprecated Ignored. Diagnostic codes are semantic identifiers only. */
38
19
  readonly vendorPrefix?: string;
39
- /**
40
- * Extension registry for resolving custom constraint type applicability.
41
- * When provided, custom constraints with `applicableTypes` will be
42
- * validated against the field's type node kind. Custom constraints
43
- * whose IDs are absent from this registry emit a WARNING (UNKNOWN_EXTENSION).
44
- * When omitted, custom constraints are silently skipped.
45
- */
46
20
  readonly extensionRegistry?: ExtensionRegistry;
47
21
  }
48
- /**
49
- * Validate all constraints in a {@link FormIR}.
50
- *
51
- * Checks for:
52
- * - Contradictions between paired constraints (e.g. `minimum > maximum`)
53
- * - Type applicability violations (e.g. `minLength` on a number field)
54
- * - Custom constraint type applicability (via extension registry)
55
- * - Unknown extension constraints (when `extensionRegistry` is provided)
56
- *
57
- * @param ir - The form IR to validate.
58
- * @param options - Optional configuration.
59
- * @returns A {@link ValidationResult} with diagnostics and a `valid` flag.
60
- */
61
22
  export declare function validateIR(ir: FormIR, options?: ValidateIROptions): ValidationResult;
62
23
  //# sourceMappingURL=constraint-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constraint-validator.d.ts","sourceRoot":"","sources":["../../src/validate/constraint-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,MAAM,EAQN,UAAU,EAGX,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,oEAAoE;IACpE,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC;IACrC,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,SAAS,UAAU,EAAE,CAAC;CAClD;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACtD,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CAChD;AAonCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAepF"}
1
+ {"version":3,"file":"constraint-validator.d.ts","sourceRoot":"","sources":["../../src/validate/constraint-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAA4C,MAAM,gBAAgB,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CAChD;AA6ED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAepF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formspec/build",
3
- "version": "0.1.0-alpha.19",
3
+ "version": "0.1.0-alpha.20",
4
4
  "description": "Build tools to compile FormSpec forms to JSON Schema and UI Schema",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -34,6 +34,7 @@
34
34
  "@microsoft/tsdoc": "^0.16.0",
35
35
  "@microsoft/tsdoc-config": "^0.18.1",
36
36
  "zod": "^3.25.0",
37
+ "@formspec/analysis": "0.1.0-alpha.20",
37
38
  "@formspec/core": "0.1.0-alpha.19"
38
39
  },
39
40
  "peerDependencies": {
@@ -1,5 +0,0 @@
1
- /**
2
- * Tests for the shared JSON parsing utility used by the analyzer pipeline.
3
- */
4
- export {};
5
- //# sourceMappingURL=json-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-utils.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/json-utils.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Shared JSON parsing utilities for the analyzer pipeline.
3
- */
4
- /**
5
- * Attempts to parse `text` as JSON.
6
- *
7
- * Returns the parsed value on success, or `null` if the input is not valid
8
- * JSON. This is the canonical "try-parse" wrapper used by the constraint tag
9
- * parsers so that every `JSON.parse` call in this package is consistent and
10
- * centrally tested.
11
- *
12
- * Note: when the input is the literal string `"null"`, the return value is
13
- * also `null` (valid JSON). This helper therefore cannot distinguish parse
14
- * failure from a successfully-parsed JSON `null`. Callers that need to
15
- * distinguish these cases should use a different API (for example, a wrapper
16
- * that returns a discriminated result such as `{ ok: boolean, value?: unknown }`).
17
- *
18
- * @param text - Raw string to parse
19
- * @returns The parsed value, or `null` on parse failure
20
- */
21
- export declare function tryParseJson(text: string): unknown;
22
- //# sourceMappingURL=json-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-utils.d.ts","sourceRoot":"","sources":["../../src/analyzer/json-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMlD"}