@formspec/build 0.1.0-alpha.27 → 0.1.0-alpha.29

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -2
  3. package/dist/analyzer/class-analyzer.d.ts +12 -6
  4. package/dist/analyzer/class-analyzer.d.ts.map +1 -1
  5. package/dist/analyzer/program.d.ts +3 -2
  6. package/dist/analyzer/program.d.ts.map +1 -1
  7. package/dist/browser.cjs +485 -76
  8. package/dist/browser.cjs.map +1 -1
  9. package/dist/browser.js +486 -77
  10. package/dist/browser.js.map +1 -1
  11. package/dist/build-alpha.d.ts +18 -2
  12. package/dist/build-beta.d.ts +18 -2
  13. package/dist/build-internal.d.ts +18 -2
  14. package/dist/build.d.ts +18 -2
  15. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +5 -2
  16. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -1
  17. package/dist/canonicalize/tsdoc-canonicalizer.d.ts +5 -1
  18. package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
  19. package/dist/cli.cjs +1460 -143
  20. package/dist/cli.cjs.map +1 -1
  21. package/dist/cli.js +1458 -139
  22. package/dist/cli.js.map +1 -1
  23. package/dist/generators/class-schema.d.ts +6 -1
  24. package/dist/generators/class-schema.d.ts.map +1 -1
  25. package/dist/generators/method-schema.d.ts.map +1 -1
  26. package/dist/generators/mixed-authoring.d.ts.map +1 -1
  27. package/dist/index.cjs +1425 -141
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.ts +4 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1425 -139
  32. package/dist/index.js.map +1 -1
  33. package/dist/internals.cjs +1416 -178
  34. package/dist/internals.cjs.map +1 -1
  35. package/dist/internals.js +1416 -176
  36. package/dist/internals.js.map +1 -1
  37. package/dist/json-schema/generator.d.ts +3 -1
  38. package/dist/json-schema/generator.d.ts.map +1 -1
  39. package/dist/json-schema/ir-generator.d.ts.map +1 -1
  40. package/dist/metadata/collision-guards.d.ts +3 -0
  41. package/dist/metadata/collision-guards.d.ts.map +1 -0
  42. package/dist/metadata/index.d.ts +7 -0
  43. package/dist/metadata/index.d.ts.map +1 -0
  44. package/dist/metadata/policy.d.ts +11 -0
  45. package/dist/metadata/policy.d.ts.map +1 -0
  46. package/dist/metadata/resolve.d.ts +20 -0
  47. package/dist/metadata/resolve.d.ts.map +1 -0
  48. package/dist/ui-schema/generator.d.ts +11 -2
  49. package/dist/ui-schema/generator.d.ts.map +1 -1
  50. package/dist/ui-schema/ir-generator.d.ts +2 -1
  51. package/dist/ui-schema/ir-generator.d.ts.map +1 -1
  52. package/package.json +7 -6
@@ -40,6 +40,7 @@ import { ExtensionDefinition } from '@formspec/core';
40
40
  import { FormElement } from '@formspec/core';
41
41
  import { FormSpec } from '@formspec/core';
42
42
  import { Group } from '@formspec/core';
43
+ import type { MetadataPolicyInput } from '@formspec/core';
43
44
  import { NumberField } from '@formspec/core';
44
45
  import { ObjectField } from '@formspec/core';
45
46
  import { StaticEnumField } from '@formspec/core';
@@ -92,7 +93,8 @@ export declare function buildFormSchemas<E extends readonly FormElement[]>(form:
92
93
  *
93
94
  * @public
94
95
  */
95
- export declare type BuildFormSchemasOptions = GenerateJsonSchemaOptions;
96
+ export declare interface BuildFormSchemasOptions extends GenerateJsonSchemaOptions, GenerateUiSchemaOptions {
97
+ }
96
98
 
97
99
  /**
98
100
  * Builds JSON Schema and UI Schema from a TSDoc-derived model with ChainDSL
@@ -377,6 +379,8 @@ export declare interface GenerateJsonSchemaOptions {
377
379
  * @defaultValue "x-formspec"
378
380
  */
379
381
  readonly vendorPrefix?: string | undefined;
382
+ /** Metadata resolution policy for chain DSL generation. */
383
+ readonly metadata?: MetadataPolicyInput | undefined;
380
384
  }
381
385
 
382
386
  /**
@@ -511,7 +515,17 @@ export declare interface GenerateSchemasOptions extends StaticSchemaGenerationOp
511
515
  *
512
516
  * @public
513
517
  */
514
- export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>): UISchema;
518
+ export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>, options?: GenerateUiSchemaOptions): UISchema;
519
+
520
+ /**
521
+ * Options for generating a UI Schema from a Chain DSL form.
522
+ *
523
+ * @public
524
+ */
525
+ export declare interface GenerateUiSchemaOptions {
526
+ /** Metadata resolution policy for chain DSL UI generation. */
527
+ readonly metadata?: MetadataPolicyInput | undefined;
528
+ }
515
529
 
516
530
  export { Group }
517
531
 
@@ -850,6 +864,8 @@ export declare interface StaticSchemaGenerationOptions {
850
864
  * @defaultValue "x-formspec"
851
865
  */
852
866
  readonly vendorPrefix?: string | undefined;
867
+ /** Metadata resolution policy for static schema generation. */
868
+ readonly metadata?: MetadataPolicyInput | undefined;
853
869
  }
854
870
 
855
871
  export { TextField }
@@ -40,6 +40,7 @@ import { ExtensionDefinition } from '@formspec/core';
40
40
  import { FormElement } from '@formspec/core';
41
41
  import { FormSpec } from '@formspec/core';
42
42
  import { Group } from '@formspec/core';
43
+ import type { MetadataPolicyInput } from '@formspec/core';
43
44
  import { NumberField } from '@formspec/core';
44
45
  import { ObjectField } from '@formspec/core';
45
46
  import { StaticEnumField } from '@formspec/core';
@@ -92,7 +93,8 @@ export declare function buildFormSchemas<E extends readonly FormElement[]>(form:
92
93
  *
93
94
  * @public
94
95
  */
95
- export declare type BuildFormSchemasOptions = GenerateJsonSchemaOptions;
96
+ export declare interface BuildFormSchemasOptions extends GenerateJsonSchemaOptions, GenerateUiSchemaOptions {
97
+ }
96
98
 
97
99
  /**
98
100
  * Builds JSON Schema and UI Schema from a TSDoc-derived model with ChainDSL
@@ -377,6 +379,8 @@ export declare interface GenerateJsonSchemaOptions {
377
379
  * @defaultValue "x-formspec"
378
380
  */
379
381
  readonly vendorPrefix?: string | undefined;
382
+ /** Metadata resolution policy for chain DSL generation. */
383
+ readonly metadata?: MetadataPolicyInput | undefined;
380
384
  }
381
385
 
382
386
  /**
@@ -511,7 +515,17 @@ export declare interface GenerateSchemasOptions extends StaticSchemaGenerationOp
511
515
  *
512
516
  * @public
513
517
  */
514
- export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>): UISchema;
518
+ export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>, options?: GenerateUiSchemaOptions): UISchema;
519
+
520
+ /**
521
+ * Options for generating a UI Schema from a Chain DSL form.
522
+ *
523
+ * @public
524
+ */
525
+ export declare interface GenerateUiSchemaOptions {
526
+ /** Metadata resolution policy for chain DSL UI generation. */
527
+ readonly metadata?: MetadataPolicyInput | undefined;
528
+ }
515
529
 
516
530
  export { Group }
517
531
 
@@ -850,6 +864,8 @@ export declare interface StaticSchemaGenerationOptions {
850
864
  * @defaultValue "x-formspec"
851
865
  */
852
866
  readonly vendorPrefix?: string | undefined;
867
+ /** Metadata resolution policy for static schema generation. */
868
+ readonly metadata?: MetadataPolicyInput | undefined;
853
869
  }
854
870
 
855
871
  export { TextField }
@@ -40,6 +40,7 @@ import { ExtensionDefinition } from '@formspec/core';
40
40
  import { FormElement } from '@formspec/core';
41
41
  import { FormSpec } from '@formspec/core';
42
42
  import { Group } from '@formspec/core';
43
+ import type { MetadataPolicyInput } from '@formspec/core';
43
44
  import { NumberField } from '@formspec/core';
44
45
  import { ObjectField } from '@formspec/core';
45
46
  import { StaticEnumField } from '@formspec/core';
@@ -92,7 +93,8 @@ export declare function buildFormSchemas<E extends readonly FormElement[]>(form:
92
93
  *
93
94
  * @public
94
95
  */
95
- export declare type BuildFormSchemasOptions = GenerateJsonSchemaOptions;
96
+ export declare interface BuildFormSchemasOptions extends GenerateJsonSchemaOptions, GenerateUiSchemaOptions {
97
+ }
96
98
 
97
99
  /**
98
100
  * Builds JSON Schema and UI Schema from a TSDoc-derived model with ChainDSL
@@ -377,6 +379,8 @@ export declare interface GenerateJsonSchemaOptions {
377
379
  * @defaultValue "x-formspec"
378
380
  */
379
381
  readonly vendorPrefix?: string | undefined;
382
+ /** Metadata resolution policy for chain DSL generation. */
383
+ readonly metadata?: MetadataPolicyInput | undefined;
380
384
  }
381
385
 
382
386
  /**
@@ -511,7 +515,17 @@ export declare interface GenerateSchemasOptions extends StaticSchemaGenerationOp
511
515
  *
512
516
  * @public
513
517
  */
514
- export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>): UISchema;
518
+ export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>, options?: GenerateUiSchemaOptions): UISchema;
519
+
520
+ /**
521
+ * Options for generating a UI Schema from a Chain DSL form.
522
+ *
523
+ * @public
524
+ */
525
+ export declare interface GenerateUiSchemaOptions {
526
+ /** Metadata resolution policy for chain DSL UI generation. */
527
+ readonly metadata?: MetadataPolicyInput | undefined;
528
+ }
515
529
 
516
530
  export { Group }
517
531
 
@@ -850,6 +864,8 @@ export declare interface StaticSchemaGenerationOptions {
850
864
  * @defaultValue "x-formspec"
851
865
  */
852
866
  readonly vendorPrefix?: string | undefined;
867
+ /** Metadata resolution policy for static schema generation. */
868
+ readonly metadata?: MetadataPolicyInput | undefined;
853
869
  }
854
870
 
855
871
  export { TextField }
package/dist/build.d.ts CHANGED
@@ -40,6 +40,7 @@ import { ExtensionDefinition } from '@formspec/core';
40
40
  import { FormElement } from '@formspec/core';
41
41
  import { FormSpec } from '@formspec/core';
42
42
  import { Group } from '@formspec/core';
43
+ import type { MetadataPolicyInput } from '@formspec/core';
43
44
  import { NumberField } from '@formspec/core';
44
45
  import { ObjectField } from '@formspec/core';
45
46
  import { StaticEnumField } from '@formspec/core';
@@ -92,7 +93,8 @@ export declare function buildFormSchemas<E extends readonly FormElement[]>(form:
92
93
  *
93
94
  * @public
94
95
  */
95
- export declare type BuildFormSchemasOptions = GenerateJsonSchemaOptions;
96
+ export declare interface BuildFormSchemasOptions extends GenerateJsonSchemaOptions, GenerateUiSchemaOptions {
97
+ }
96
98
 
97
99
  /**
98
100
  * Builds JSON Schema and UI Schema from a TSDoc-derived model with ChainDSL
@@ -377,6 +379,8 @@ export declare interface GenerateJsonSchemaOptions {
377
379
  * @defaultValue "x-formspec"
378
380
  */
379
381
  readonly vendorPrefix?: string | undefined;
382
+ /** Metadata resolution policy for chain DSL generation. */
383
+ readonly metadata?: MetadataPolicyInput | undefined;
380
384
  }
381
385
 
382
386
  /**
@@ -511,7 +515,17 @@ export declare interface GenerateSchemasOptions extends StaticSchemaGenerationOp
511
515
  *
512
516
  * @public
513
517
  */
514
- export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>): UISchema;
518
+ export declare function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>, options?: GenerateUiSchemaOptions): UISchema;
519
+
520
+ /**
521
+ * Options for generating a UI Schema from a Chain DSL form.
522
+ *
523
+ * @public
524
+ */
525
+ export declare interface GenerateUiSchemaOptions {
526
+ /** Metadata resolution policy for chain DSL UI generation. */
527
+ readonly metadata?: MetadataPolicyInput | undefined;
528
+ }
515
529
 
516
530
  export { Group }
517
531
 
@@ -850,6 +864,8 @@ export declare interface StaticSchemaGenerationOptions {
850
864
  * @defaultValue "x-formspec"
851
865
  */
852
866
  readonly vendorPrefix?: string | undefined;
867
+ /** Metadata resolution policy for static schema generation. */
868
+ readonly metadata?: MetadataPolicyInput | undefined;
853
869
  }
854
870
 
855
871
  export { TextField }
@@ -7,7 +7,7 @@
7
7
  * downstream phases (validation, JSON Schema generation, UI Schema generation)
8
8
  * consume.
9
9
  */
10
- import type { FormElement, FormSpec } from "@formspec/core";
10
+ import type { FormElement, FormSpec, MetadataPolicyInput } from "@formspec/core";
11
11
  import type { FormIR } from "@formspec/core/internals";
12
12
  /**
13
13
  * Translates a chain DSL `FormSpec` into the canonical `FormIR`.
@@ -15,5 +15,8 @@ import type { FormIR } from "@formspec/core/internals";
15
15
  * @param form - A form specification created via `formspec(...)` from `@formspec/dsl`
16
16
  * @returns The canonical intermediate representation
17
17
  */
18
- export declare function canonicalizeChainDSL(form: FormSpec<readonly FormElement[]>): FormIR;
18
+ export interface CanonicalizeChainDSLOptions {
19
+ readonly metadata?: MetadataPolicyInput;
20
+ }
21
+ export declare function canonicalizeChainDSL(form: FormSpec<readonly FormElement[]>, options?: CanonicalizeChainDSLOptions): FormIR;
19
22
  //# sourceMappingURL=chain-dsl-canonicalizer.d.ts.map
@@ -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,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"}
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,EAMR,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAYV,MAAM,EAaP,MAAM,0BAA0B,CAAC;AA2ClC;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CACzC;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,EACtC,OAAO,CAAC,EAAE,2BAA2B,GACpC,MAAM,CAYR"}
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type { FormIR } from "@formspec/core/internals";
12
12
  import type { IRClassAnalysis } from "../analyzer/class-analyzer.js";
13
+ import type { MetadataPolicyInput } from "@formspec/core";
13
14
  /**
14
15
  * Source-level metadata for provenance tracking.
15
16
  */
@@ -17,6 +18,9 @@ export interface TSDocSource {
17
18
  /** Absolute path to the source file. */
18
19
  readonly file: string;
19
20
  }
21
+ export interface CanonicalizeTSDocOptions {
22
+ readonly metadata?: MetadataPolicyInput;
23
+ }
20
24
  /**
21
25
  * Wraps an {@link IRClassAnalysis} (from `analyzeClassToIR`,
22
26
  * `analyzeInterfaceToIR`, or `analyzeTypeAliasToIR`) into a canonical
@@ -30,5 +34,5 @@ export interface TSDocSource {
30
34
  * @param source - Optional source file metadata for provenance
31
35
  * @returns The canonical FormIR
32
36
  */
33
- export declare function canonicalizeTSDoc(analysis: IRClassAnalysis, source?: TSDocSource): FormIR;
37
+ export declare function canonicalizeTSDoc(analysis: IRClassAnalysis, source?: TSDocSource, options?: CanonicalizeTSDocOptions): FormIR;
34
38
  //# sourceMappingURL=tsdoc-canonicalizer.d.ts.map
@@ -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,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"}
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,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CACzC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CA8BR"}