@formspec/build 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (108) hide show
  1. package/README.md +138 -0
  2. package/dist/__tests__/analyzer-edge-cases.test.d.ts +13 -0
  3. package/dist/__tests__/analyzer-edge-cases.test.d.ts.map +1 -0
  4. package/dist/__tests__/analyzer.test.d.ts +5 -0
  5. package/dist/__tests__/analyzer.test.d.ts.map +1 -0
  6. package/dist/__tests__/codegen.test.d.ts +5 -0
  7. package/dist/__tests__/codegen.test.d.ts.map +1 -0
  8. package/dist/__tests__/decorator-pipeline.test.d.ts +11 -0
  9. package/dist/__tests__/decorator-pipeline.test.d.ts.map +1 -0
  10. package/dist/__tests__/fixtures/edge-cases.d.ts +110 -0
  11. package/dist/__tests__/fixtures/edge-cases.d.ts.map +1 -0
  12. package/dist/__tests__/fixtures/example-a-builtins.d.ts +12 -0
  13. package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +1 -0
  14. package/dist/__tests__/fixtures/example-b-decorators.d.ts +5 -0
  15. package/dist/__tests__/fixtures/example-b-decorators.d.ts.map +1 -0
  16. package/dist/__tests__/fixtures/example-b-extended.d.ts +5 -0
  17. package/dist/__tests__/fixtures/example-b-extended.d.ts.map +1 -0
  18. package/dist/__tests__/fixtures/example-c-custom.d.ts +5 -0
  19. package/dist/__tests__/fixtures/example-c-custom.d.ts.map +1 -0
  20. package/dist/__tests__/fixtures/example-c-decorators.d.ts +5 -0
  21. package/dist/__tests__/fixtures/example-c-decorators.d.ts.map +1 -0
  22. package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts +6 -0
  23. package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts.map +1 -0
  24. package/dist/__tests__/fixtures/example-e-decorators.d.ts +11 -0
  25. package/dist/__tests__/fixtures/example-e-decorators.d.ts.map +1 -0
  26. package/dist/__tests__/fixtures/example-e-no-namespace.d.ts +5 -0
  27. package/dist/__tests__/fixtures/example-e-no-namespace.d.ts.map +1 -0
  28. package/dist/__tests__/fixtures/example-interface-types.d.ts +102 -0
  29. package/dist/__tests__/fixtures/example-interface-types.d.ts.map +1 -0
  30. package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts +16 -0
  31. package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts.map +1 -0
  32. package/dist/__tests__/fixtures/example-nested-class.d.ts +45 -0
  33. package/dist/__tests__/fixtures/example-nested-class.d.ts.map +1 -0
  34. package/dist/__tests__/fixtures/sample-forms.d.ts +55 -0
  35. package/dist/__tests__/fixtures/sample-forms.d.ts.map +1 -0
  36. package/dist/__tests__/interface-types.test.d.ts +11 -0
  37. package/dist/__tests__/interface-types.test.d.ts.map +1 -0
  38. package/dist/__tests__/jsdoc-constraints.test.d.ts +10 -0
  39. package/dist/__tests__/jsdoc-constraints.test.d.ts.map +1 -0
  40. package/dist/analyzer/class-analyzer.d.ts +139 -0
  41. package/dist/analyzer/class-analyzer.d.ts.map +1 -0
  42. package/dist/analyzer/decorator-extractor.d.ts +78 -0
  43. package/dist/analyzer/decorator-extractor.d.ts.map +1 -0
  44. package/dist/analyzer/jsdoc-constraints.d.ts +47 -0
  45. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -0
  46. package/dist/analyzer/program.d.ts +53 -0
  47. package/dist/analyzer/program.d.ts.map +1 -0
  48. package/dist/analyzer/type-converter.d.ts +75 -0
  49. package/dist/analyzer/type-converter.d.ts.map +1 -0
  50. package/dist/browser.cjs +549 -0
  51. package/dist/browser.cjs.map +1 -0
  52. package/dist/browser.d.ts +56 -0
  53. package/dist/browser.d.ts.map +1 -0
  54. package/dist/browser.js +501 -0
  55. package/dist/browser.js.map +1 -0
  56. package/dist/build.d.ts +890 -0
  57. package/dist/cli.cjs +2267 -0
  58. package/dist/cli.cjs.map +1 -0
  59. package/dist/cli.js +2204 -103
  60. package/dist/cli.js.map +1 -1
  61. package/dist/codegen/index.d.ts +75 -0
  62. package/dist/codegen/index.d.ts.map +1 -0
  63. package/dist/generators/class-schema.d.ts +114 -0
  64. package/dist/generators/class-schema.d.ts.map +1 -0
  65. package/dist/generators/method-schema.d.ts +67 -0
  66. package/dist/generators/method-schema.d.ts.map +1 -0
  67. package/dist/index.cjs +2093 -0
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.ts +11 -3
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +2024 -104
  72. package/dist/index.js.map +1 -1
  73. package/dist/internals.cjs +1345 -0
  74. package/dist/internals.cjs.map +1 -0
  75. package/dist/internals.d.ts +21 -0
  76. package/dist/internals.d.ts.map +1 -0
  77. package/dist/internals.js +1298 -0
  78. package/dist/internals.js.map +1 -0
  79. package/dist/json-schema/generator.d.ts.map +1 -1
  80. package/dist/json-schema/schema.d.ts +16 -0
  81. package/dist/json-schema/schema.d.ts.map +1 -0
  82. package/dist/json-schema/types.d.ts +28 -0
  83. package/dist/json-schema/types.d.ts.map +1 -1
  84. package/dist/ui-schema/generator.d.ts +15 -0
  85. package/dist/ui-schema/generator.d.ts.map +1 -1
  86. package/dist/ui-schema/schema.d.ts +357 -0
  87. package/dist/ui-schema/schema.d.ts.map +1 -0
  88. package/dist/ui-schema/types.d.ts +8 -73
  89. package/dist/ui-schema/types.d.ts.map +1 -1
  90. package/package.json +25 -7
  91. package/dist/__tests__/cli.test.js +0 -178
  92. package/dist/__tests__/cli.test.js.map +0 -1
  93. package/dist/__tests__/edge-cases.test.js +0 -209
  94. package/dist/__tests__/edge-cases.test.js.map +0 -1
  95. package/dist/__tests__/generator.test.js +0 -208
  96. package/dist/__tests__/generator.test.js.map +0 -1
  97. package/dist/__tests__/integration.test.js +0 -163
  98. package/dist/__tests__/integration.test.js.map +0 -1
  99. package/dist/__tests__/write-schemas.test.js +0 -196
  100. package/dist/__tests__/write-schemas.test.js.map +0 -1
  101. package/dist/json-schema/generator.js +0 -146
  102. package/dist/json-schema/generator.js.map +0 -1
  103. package/dist/json-schema/types.js +0 -7
  104. package/dist/json-schema/types.js.map +0 -1
  105. package/dist/ui-schema/generator.js +0 -150
  106. package/dist/ui-schema/generator.js.map +0 -1
  107. package/dist/ui-schema/types.js +0 -8
  108. package/dist/ui-schema/types.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # @formspec/build
2
+
3
+ Build tools to compile FormSpec forms into JSON Schema and JSON Forms UI Schema.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @formspec/build
9
+ # or
10
+ pnpm add @formspec/build
11
+ ```
12
+
13
+ > **Note:** Most users should install the `formspec` umbrella package instead, which re-exports everything from this package.
14
+
15
+ ## Requirements
16
+
17
+ This package is ESM-only and requires:
18
+
19
+ ```json
20
+ // package.json
21
+ {
22
+ "type": "module"
23
+ }
24
+ ```
25
+
26
+ ```json
27
+ // tsconfig.json
28
+ {
29
+ "compilerOptions": {
30
+ "module": "NodeNext",
31
+ "moduleResolution": "NodeNext"
32
+ }
33
+ }
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ### Generate Schemas in Memory
39
+
40
+ ```typescript
41
+ import { buildFormSchemas } from "@formspec/build";
42
+ import { formspec, field, group } from "@formspec/dsl";
43
+
44
+ const ContactForm = formspec(
45
+ field.text("name", { label: "Name", required: true }),
46
+ field.text("email", { label: "Email", required: true }),
47
+ field.enum("subject", ["General", "Support", "Sales"])
48
+ );
49
+
50
+ const { jsonSchema, uiSchema } = buildFormSchemas(ContactForm);
51
+
52
+ // Use with JSON Forms renderer
53
+ // <JsonForms schema={jsonSchema} uischema={uiSchema} data={formData} />
54
+ ```
55
+
56
+ ### Write Schemas to Disk
57
+
58
+ ```typescript
59
+ import { writeSchemas } from "@formspec/build";
60
+
61
+ const result = writeSchemas(ContactForm, {
62
+ outDir: "./generated",
63
+ name: "contact-form",
64
+ indent: 2,
65
+ });
66
+
67
+ console.log(`JSON Schema: ${result.jsonSchemaPath}`);
68
+ console.log(`UI Schema: ${result.uiSchemaPath}`);
69
+ // JSON Schema: ./generated/contact-form-schema.json
70
+ // UI Schema: ./generated/contact-form-uischema.json
71
+ ```
72
+
73
+ ### Use Individual Generators
74
+
75
+ ```typescript
76
+ import { generateJsonSchema, generateUiSchema } from "@formspec/build";
77
+
78
+ const jsonSchema = generateJsonSchema(ContactForm);
79
+ const uiSchema = generateUiSchema(ContactForm);
80
+ ```
81
+
82
+ ## Generated Output
83
+
84
+ ### JSON Schema (Draft-07)
85
+
86
+ ```json
87
+ {
88
+ "$schema": "https://json-schema.org/draft-07/schema#",
89
+ "type": "object",
90
+ "properties": {
91
+ "name": { "type": "string", "title": "Name" },
92
+ "email": { "type": "string", "title": "Email" },
93
+ "subject": {
94
+ "type": "string",
95
+ "enum": ["General", "Support", "Sales"]
96
+ }
97
+ },
98
+ "required": ["name", "email"]
99
+ }
100
+ ```
101
+
102
+ ### JSON Forms UI Schema
103
+
104
+ ```json
105
+ {
106
+ "type": "VerticalLayout",
107
+ "elements": [
108
+ { "type": "Control", "scope": "#/properties/name", "label": "Name" },
109
+ { "type": "Control", "scope": "#/properties/email", "label": "Email" },
110
+ { "type": "Control", "scope": "#/properties/subject" }
111
+ ]
112
+ }
113
+ ```
114
+
115
+ ## API Reference
116
+
117
+ ### Functions
118
+
119
+ | Function | Description |
120
+ | ----------------------------- | --------------------------------------- |
121
+ | `buildFormSchemas(form)` | Generate both JSON Schema and UI Schema |
122
+ | `generateJsonSchema(form)` | Generate only JSON Schema |
123
+ | `generateUiSchema(form)` | Generate only UI Schema |
124
+ | `writeSchemas(form, options)` | Build and write schemas to disk |
125
+
126
+ ### Types
127
+
128
+ | Type | Description |
129
+ | --------------------- | --------------------------------- |
130
+ | `BuildResult` | Return type of `buildFormSchemas` |
131
+ | `WriteSchemasOptions` | Options for `writeSchemas` |
132
+ | `WriteSchemasResult` | Return type of `writeSchemas` |
133
+ | `JSONSchema7` | JSON Schema Draft-07 type |
134
+ | `UISchema` | JSON Forms UI Schema type |
135
+
136
+ ## License
137
+
138
+ UNLICENSED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Edge case and negative tests for analysis and generation components.
3
+ *
4
+ * Tests cover:
5
+ * - Complex union types
6
+ * - Nullable and optional patterns
7
+ * - Array edge cases
8
+ * - Object edge cases
9
+ * - Decorator extractor edge cases
10
+ * - Program context error handling
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=analyzer-edge-cases.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer-edge-cases.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/analyzer-edge-cases.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for the analyzer module.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=analyzer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/analyzer.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for the codegen type generation functions.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=codegen.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/codegen.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Integration tests for the decorated class -> static analysis -> JSON Schema pipeline.
3
+ *
4
+ * Tests the full pipeline: decorated TypeScript class -> analyzeClass -> generateClassSchemas
5
+ * -> JSON Schema + UI Schema output, including extended and custom decorator support.
6
+ *
7
+ * @see packages/decorators/src/index.ts for decorator definitions
8
+ * @see packages/build/src/analyzer/decorator-extractor.ts for brand resolution
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=decorator-pipeline.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator-pipeline.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/decorator-pipeline.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Edge case fixtures for testing type converter and analyzer.
3
+ *
4
+ * These test various TypeScript type patterns that might cause issues.
5
+ */
6
+ /**
7
+ * Mixed type union (not just literals) - should produce oneOf.
8
+ */
9
+ export declare class MixedUnionTypes {
10
+ mixedPrimitive: string | number;
11
+ complexUnion: string | {
12
+ nested: boolean;
13
+ };
14
+ objectUnion: {
15
+ type: "a";
16
+ valueA: string;
17
+ } | {
18
+ type: "b";
19
+ valueB: number;
20
+ };
21
+ }
22
+ /**
23
+ * Various nullable patterns.
24
+ */
25
+ export declare class NullablePatterns {
26
+ nullableString: string | null;
27
+ undefinedString: string | undefined;
28
+ optionalNullable?: string | null;
29
+ tripleUnion: string | null | undefined;
30
+ nullableStatus: "active" | "inactive" | null;
31
+ }
32
+ /**
33
+ * Various array patterns.
34
+ */
35
+ export declare class ArrayEdgeCases {
36
+ strings: string[];
37
+ mixedArray: (string | number)[];
38
+ nullableArray: string[] | null;
39
+ objectArray: {
40
+ id: number;
41
+ name: string;
42
+ }[];
43
+ anyArray: unknown[];
44
+ nestedArray: string[][];
45
+ }
46
+ /**
47
+ * Various object type patterns.
48
+ */
49
+ export declare class ObjectEdgeCases {
50
+ emptyObject: {};
51
+ stringRecord: Record<string, string>;
52
+ deepNested: {
53
+ level1: {
54
+ level2: {
55
+ level3: {
56
+ value: string;
57
+ };
58
+ };
59
+ };
60
+ };
61
+ optionalProps: {
62
+ required: string;
63
+ optional?: number;
64
+ };
65
+ }
66
+ /**
67
+ * Special TypeScript types.
68
+ */
69
+ export declare class SpecialTypes {
70
+ anyField: any;
71
+ unknownField: unknown;
72
+ voidField: void;
73
+ dateField: Date;
74
+ }
75
+ /**
76
+ * Various enum patterns.
77
+ */
78
+ export declare class EnumVariations {
79
+ singleLiteral: "only";
80
+ numberEnum: 1 | 2 | 3;
81
+ mixedLiterals: "string" | 42;
82
+ largeEnum: "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j";
83
+ }
84
+ /**
85
+ * Simple class with no decorators for testing analyzer edge cases.
86
+ */
87
+ export declare class NoDecoratorsClass {
88
+ name: string;
89
+ count?: number;
90
+ active: boolean;
91
+ }
92
+ export declare const notFormSpec1: null;
93
+ export declare const notFormSpec2: undefined;
94
+ export declare const notFormSpec3 = "string";
95
+ export declare const notFormSpec4 = 123;
96
+ export declare const notFormSpec5: {
97
+ notElements: never[];
98
+ };
99
+ export declare const notFormSpec6: {
100
+ elements: string;
101
+ };
102
+ export declare const notFormSpec7: {
103
+ elements: {
104
+ missingType: boolean;
105
+ }[];
106
+ };
107
+ export declare const notFormSpec8: {
108
+ elements: null[];
109
+ };
110
+ //# sourceMappingURL=edge-cases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-cases.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/edge-cases.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,qBAAa,eAAe;IAE1B,cAAc,EAAG,MAAM,GAAG,MAAM,CAAC;IAGjC,YAAY,EAAG,MAAM,GAAG;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAG5C,WAAW,EAAG;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7E;AAMD;;GAEG;AACH,qBAAa,gBAAgB;IAE3B,cAAc,EAAG,MAAM,GAAG,IAAI,CAAC;IAG/B,eAAe,EAAG,MAAM,GAAG,SAAS,CAAC;IAGrC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,WAAW,EAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAGxC,cAAc,EAAG,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC;CAC/C;AAMD;;GAEG;AACH,qBAAa,cA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,MAAM,CAAC;IAGd,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,MAAM,EAAG,OAAO,CAAC;CAClB;AAMD,eAAO,MAAM,YAAY,MAAO,CAAC;AACjC,eAAO,MAAM,YAAY,WAAY,CAAC;AACtC,eAAO,MAAM,YAAY,WAAW,CAAC;AACrC,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY;;CAAsB,CAAC;AAChD,eAAO,MAAM,YAAY;;CAA4B,CAAC;AACtD,eAAO,MAAM,YAAY;;;;CAAwC,CAAC;AAClE,eAAO,MAAM,YAAY;;CAAuB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare class ExampleAForm {
2
+ name: string;
3
+ age: number;
4
+ score: number;
5
+ email?: string;
6
+ country: "us" | "ca";
7
+ state?: string;
8
+ /** @deprecated Use email instead */
9
+ fax?: string;
10
+ role: "admin" | "user";
11
+ }
12
+ //# sourceMappingURL=example-a-builtins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-a-builtins.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-a-builtins.ts"],"names":[],"mappings":"AAaA,qBAAa,YAAY;IAIvB,IAAI,EAAG,MAAM,CAAC;IAKd,GAAG,EAAG,MAAM,CAAC;IAIb,KAAK,EAAG,MAAM,CAAC;IAIf,KAAK,CAAC,EAAE,MAAM,CAAC;IAQf,OAAO,EAAG,IAAI,GAAG,IAAI,CAAC;IAItB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oCAAoC;IAEpC,GAAG,CAAC,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,OAAO,GAAG,MAAM,CAAU;CACjC"}
@@ -0,0 +1,5 @@
1
+ import type { FieldOptions } from "@formspec/decorators";
2
+ export declare const CustomField: ((_args: FieldOptions) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Field">;
3
+ export declare const Floor: ((_args: number) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Minimum">;
4
+ export declare const Ceiling: ((_args: number) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Maximum">;
5
+ //# sourceMappingURL=example-b-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-b-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-decorators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,WAAW,2JAA2D,CAAC;AACpF,eAAO,MAAM,KAAK,uJAAiD,CAAC;AACpE,eAAO,MAAM,OAAO,uJAAmD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class ExampleBForm {
2
+ amount: number;
3
+ label: string;
4
+ }
5
+ //# sourceMappingURL=example-b-extended.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-b-extended.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-extended.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IAIvB,MAAM,EAAG,MAAM,CAAC;IAGhB,KAAK,EAAG,MAAM,CAAC;CAChB"}
@@ -0,0 +1,5 @@
1
+ export declare class ExampleCForm {
2
+ heading: string;
3
+ urgency: number;
4
+ }
5
+ //# sourceMappingURL=example-c-custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-c-custom.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-c-custom.ts"],"names":[],"mappings":"AAGA,qBAAa,YAAY;IAGvB,OAAO,EAAG,MAAM,CAAC;IAKjB,OAAO,EAAG,MAAM,CAAC;CAClB"}
@@ -0,0 +1,5 @@
1
+ export declare const Title: ((value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecMarkerBrand & import("@formspec/decorators").FormSpecExtensionBrand<"title-field">;
2
+ export declare const Priority: ((_args: {
3
+ level: string;
4
+ }) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtensionBrand<"priority">;
5
+ //# sourceMappingURL=example-c-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-c-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-c-decorators.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,+LAAiD,CAAC;AACpE,eAAO,MAAM,QAAQ;WAA2C,MAAM;0IAAe,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare class ExampleDForm {
2
+ username: string;
3
+ score: number;
4
+ plain: string;
5
+ }
6
+ //# sourceMappingURL=example-d-mixed-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-d-mixed-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-d-mixed-decorators.ts"],"names":[],"mappings":"AAYA,qBAAa,YAAY;IAGvB,QAAQ,EAAG,MAAM,CAAC;IAIlB,KAAK,EAAG,MAAM,CAAC;IAGf,KAAK,EAAG,MAAM,CAAC;CAChB"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Custom decorator created without an extension namespace.
3
+ * The `customDecorator()` no-arg overload produces decorators
4
+ * that are recognized as FormSpec but have no extensionName,
5
+ * so no x-formspec-* keys should be emitted.
6
+ */
7
+ export declare const Highlight: ((value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecMarkerBrand;
8
+ export declare const Metadata: (_args: {
9
+ key: string;
10
+ }) => (value: undefined, context: ClassFieldDecoratorContext) => void;
11
+ //# sourceMappingURL=example-e-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-e-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-e-decorators.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,SAAS,wHAAwC,CAAC;AAC/D,eAAO,MAAM,QAAQ;SAA+B,MAAM;qEAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class ExampleEForm {
2
+ title: string;
3
+ notes: string;
4
+ }
5
+ //# sourceMappingURL=example-e-no-namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-e-no-namespace.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-e-no-namespace.ts"],"names":[],"mappings":"AAGA,qBAAa,YAAY;IAGvB,KAAK,EAAG,MAAM,CAAC;IAIf,KAAK,EAAG,MAAM,CAAC;CAChB"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Test fixtures for interface and type alias analysis.
3
+ *
4
+ * Tests the TSDoc-based schema extraction pipeline for interfaces,
5
+ * type aliases, nested types, and edge cases.
6
+ */
7
+ export interface SimpleConfig {
8
+ /**
9
+ * @Field_displayName Full Name
10
+ * @Field_description The user's legal name
11
+ * @MinLength 1
12
+ * @MaxLength 200
13
+ */
14
+ name: string;
15
+ /** @Field_displayName Age @Minimum 0 @Maximum 150 */
16
+ age: number;
17
+ /** @Field_displayName Email @Pattern ^[^@]+@[^@]+$ */
18
+ email?: string;
19
+ /** @Field_displayName Active */
20
+ active: boolean;
21
+ }
22
+ export interface WithEnumOptions {
23
+ /**
24
+ * @Field_displayName Status
25
+ * @EnumOptions ["draft","active","archived"]
26
+ */
27
+ status: "draft" | "active" | "archived";
28
+ /**
29
+ * @Field_displayName Priority
30
+ * @EnumOptions [{"id":"low","label":"Low Priority"},{"id":"high","label":"High Priority"}]
31
+ */
32
+ priority: "low" | "high";
33
+ }
34
+ export interface EmptyInterface {
35
+ }
36
+ export interface OnlyOptionalFields {
37
+ /** @Field_displayName Notes */
38
+ notes?: string;
39
+ /** @Field_displayName Tags */
40
+ tags?: string;
41
+ }
42
+ /** @deprecated Use NewConfig instead */
43
+ export interface DeprecatedFieldInterface {
44
+ /** @deprecated Use fullName instead */
45
+ name?: string;
46
+ /** @Field_displayName Full Name */
47
+ fullName: string;
48
+ }
49
+ export type SimpleTypeAlias = {
50
+ /** @Field_displayName Label @MinLength 1 */
51
+ label: string;
52
+ /** @Field_displayName Count @Minimum 0 */
53
+ count: number;
54
+ /** @Field_displayName Description */
55
+ description?: string;
56
+ };
57
+ export type TypeAliasWithEnumOptions = {
58
+ /**
59
+ * @Field_displayName Color
60
+ * @EnumOptions ["red","green","blue"]
61
+ */
62
+ color: "red" | "green" | "blue";
63
+ };
64
+ export type StringAlias = string;
65
+ export type UnionAlias = "a" | "b" | "c";
66
+ /** @Minimum 0 @Maximum 100 */
67
+ export type Percent = number;
68
+ /** @MinLength 1 @MaxLength 255 @Pattern ^[^@]+@[^@]+$ */
69
+ export type Email = string;
70
+ /** @Field_displayName Discount Rate @Field_description Percentage discount applied @Minimum 0 @Maximum 100 */
71
+ export type AnnotatedPercent = number;
72
+ export interface ConfigWithAliasedTypes {
73
+ /** @Field_displayName Discount */
74
+ discount: Percent;
75
+ /** @Field_displayName Contact Email */
76
+ contactEmail: Email;
77
+ /** @Field_displayName Tax Rate */
78
+ taxRate: AnnotatedPercent;
79
+ }
80
+ export interface Address {
81
+ /** @Field_displayName Street @MinLength 1 @MaxLength 200 */
82
+ street: string;
83
+ /** @Field_displayName City @MinLength 1 */
84
+ city: string;
85
+ /** @Field_displayName Zip @Pattern ^[0-9]{5}$ */
86
+ zip?: string;
87
+ }
88
+ export type ContactInfo = {
89
+ /** @Field_displayName Email @Pattern ^[^@]+@[^@]+$ */
90
+ email: string;
91
+ /** @Field_displayName Phone @MaxLength 20 */
92
+ phone?: string;
93
+ };
94
+ export interface NestedConfig {
95
+ /** @Field_displayName Name */
96
+ name: string;
97
+ /** @Field_displayName Address */
98
+ address: Address;
99
+ /** @Field_displayName Contact */
100
+ contact: ContactInfo;
101
+ }
102
+ //# sourceMappingURL=example-interface-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-interface-types.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-interface-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG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MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC,MAAM,WAAW,sBAAsB;IACrC,kCAAkC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAElB,uCAAuC;IACvC,YAAY,EAAE,KAAK,CAAC;IAEpB,kCAAkC;IAClC,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAID,MAAM,WAAW,OAAO;IACtB,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,MAAM,WAAW,GAAG;IACxB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,OAAO,EAAE,WAAW,CAAC;CACtB"}
@@ -0,0 +1,16 @@
1
+ export declare class JSDocConstraintsForm {
2
+ /** @MinLength 1 @MaxLength 200 */
3
+ name: string;
4
+ /** @Minimum 0 @Maximum 150 */
5
+ age: number;
6
+ /** @Minimum 0.01 @Maximum 1000 */
7
+ weight: number;
8
+ /** @Minimum -273.15 */
9
+ temperature: number;
10
+ /** @Pattern ^[A-Z]{3}-\d{4}$ */
11
+ sku: string;
12
+ /** @ExclusiveMaximum 10000 */
13
+ stock: number;
14
+ notes?: string;
15
+ }
16
+ //# sourceMappingURL=example-jsdoc-constraints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-jsdoc-constraints.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-jsdoc-constraints.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAC/B,kCAAkC;IAElC,IAAI,EAAG,MAAM,CAAC;IAEd,8BAA8B;IAE9B,GAAG,EAAG,MAAM,CAAC;IAEb,kCAAkC;IAElC,MAAM,EAAG,MAAM,CAAC;IAEhB,uBAAuB;IAEvB,WAAW,EAAG,MAAM,CAAC;IAErB,gCAAgC;IAEhC,GAAG,EAAG,MAAM,CAAC;IAGb,8BAA8B;IAG9B,KAAK,EAAG,MAAM,CAAC;IAIf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,45 @@
1
+ export declare class Address {
2
+ street: string;
3
+ city: string;
4
+ zip?: string;
5
+ }
6
+ export declare class Dimensions {
7
+ /** @Minimum 0 @Maximum 10000 */
8
+ width: number;
9
+ /** @Minimum 0 @Maximum 10000 */
10
+ height: number;
11
+ /** @Minimum 0 */
12
+ depth: number;
13
+ }
14
+ export declare class UserWithAddress {
15
+ username: string;
16
+ address: Address;
17
+ }
18
+ export declare class ProductWithDimensions {
19
+ name: string;
20
+ dimensions: Dimensions;
21
+ }
22
+ export declare class Customer {
23
+ name: string;
24
+ address: Address;
25
+ }
26
+ export declare class Order {
27
+ orderId: string;
28
+ customer: Customer;
29
+ }
30
+ export declare class NodeA {
31
+ name: string;
32
+ sibling?: NodeB;
33
+ }
34
+ export declare class NodeB {
35
+ label: string;
36
+ sibling?: NodeA;
37
+ }
38
+ export declare class WithInlineObject {
39
+ title: string;
40
+ metadata: {
41
+ key: string;
42
+ value: string;
43
+ };
44
+ }
45
+ //# sourceMappingURL=example-nested-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-nested-class.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-nested-class.ts"],"names":[],"mappings":"AAIA,qBAAa,OAAO;IAIlB,MAAM,EAAG,MAAM,CAAC;IAIhB,IAAI,EAAG,MAAM,CAAC;IAId,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,UAAU;IACrB,gCAAgC;IAEhC,KAAK,EAAG,MAAM,CAAC;IAEf,gCAAgC;IAEhC,MAAM,EAAG,MAAM,CAAC;IAEhB,iBAAiB;IAEjB,KAAK,EAAG,MAAM,CAAC;CAChB;AAID,qBAAa,eAAe;IAG1B,QAAQ,EAAG,MAAM,CAAC;IAGlB,OAAO,EAAG,OAAO,CAAC;CACnB;AAED,qBAAa,qBAAqB;IAEhC,IAAI,EAAG,MAAM,CAAC;IAGd,UAAU,EAAG,UAAU,CAAC;CACzB;AAID,qBAAa,QAAQ;IAGnB,IAAI,EAAG,MAAM,CAAC;IAGd,OAAO,EAAG,OAAO,CAAC;CACnB;AAED,qBAAa,KAAK;IAEhB,OAAO,EAAG,MAAM,CAAC;IAGjB,QAAQ,EAAG,QAAQ,CAAC;CACrB;AAID,qBAAa,KAAK;IAGhB,IAAI,EAAG,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,qBAAa,KAAK;IAEhB,KAAK,EAAG,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAID,qBAAa,gBAAgB;IAE3B,KAAK,EAAG,MAAM,CAAC;IAEf,QAAQ,EAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Test fixture for CLI analyzer.
3
+ *
4
+ * Contains both:
5
+ * - Decorated classes (class + decorator DSL)
6
+ * - FormSpec exports (chain DSL)
7
+ */
8
+ import type { InferFormSchema } from "@formspec/dsl";
9
+ /**
10
+ * FormSpec for user registration.
11
+ */
12
+ export declare const UserRegistrationForm: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"username">, import("@formspec/core").TextField<"email">, import("@formspec/core").TextField<"password">, import("@formspec/core").BooleanField<"acceptTerms">]>;
13
+ /**
14
+ * FormSpec for product configuration.
15
+ */
16
+ export declare const ProductConfigForm: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"name">, import("@formspec/core").NumberField<"price">, import("@formspec/core").StaticEnumField<"status", readonly ["draft", "active", "archived"]>]>;
17
+ /**
18
+ * FormSpec for method parameters.
19
+ */
20
+ export declare const ActivateParams: import("@formspec/core").FormSpec<readonly [import("@formspec/core").NumberField<"amount">, import("@formspec/core").NumberField<"installments">]>;
21
+ export declare const CancelParams: import("@formspec/core").FormSpec<readonly [import("@formspec/core").StaticEnumField<"reason", readonly ["user_request", "fraud", "other"]>, import("@formspec/core").TextField<"notes">]>;
22
+ /**
23
+ * Sample class with decorated fields and methods.
24
+ */
25
+ export declare class InstallmentPlan {
26
+ status: "active" | "paused" | "canceled";
27
+ amount: number;
28
+ customerEmail?: string;
29
+ installments: number;
30
+ /**
31
+ * Activates the plan with the given parameters.
32
+ */
33
+ activate(params: InferFormSchema<typeof ActivateParams>): {
34
+ success: boolean;
35
+ };
36
+ /**
37
+ * Cancels the plan.
38
+ */
39
+ cancelPlan(params: InferFormSchema<typeof CancelParams>): void;
40
+ /**
41
+ * Static factory method.
42
+ */
43
+ static createStandard(name: string, amount: number): InstallmentPlan;
44
+ }
45
+ export declare class SimpleProduct {
46
+ name: string;
47
+ price?: number;
48
+ active: boolean;
49
+ tags?: string[];
50
+ update(data: {
51
+ name?: string;
52
+ price?: number;
53
+ }): boolean;
54
+ }
55
+ //# sourceMappingURL=sample-forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sample-forms.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/sample-forms.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAMrD;;GAEG;AACH,eAAO,MAAM,oBAAoB,iPAKhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,uOAM7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,oJAG1B,CAAC;AAEF,eAAO,MAAM,YAAY,4LAKxB,CAAC;AAMF;;GAEG;AACH,qBAAa,eAAe;IAC1B,MAAM,EAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IAE1C,MAAM,EAAG,MAAM,CAAC;IAEhB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,YAAY,EAAG,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,OAAO,cAAc,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IAK9E;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,eAAe,CAAC,OAAO,YAAY,CAAC,GAAG,IAAI;IAI9D;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe;CAKrE;AAMD,qBAAa,aAAa;IACxB,IAAI,EAAG,MAAM,CAAC;IAEd,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,EAAG,OAAO,CAAC;IAEjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,MAAM,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO;CAKzD"}