@formspec/build 0.1.0-alpha.16 → 0.1.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -128
- package/dist/__tests__/class-schema.test.d.ts +2 -0
- package/dist/__tests__/class-schema.test.d.ts.map +1 -0
- package/dist/__tests__/date-extension.integration.test.d.ts +2 -0
- package/dist/__tests__/date-extension.integration.test.d.ts.map +1 -0
- package/dist/__tests__/fixtures/class-schema-regressions.d.ts +83 -0
- package/dist/__tests__/fixtures/class-schema-regressions.d.ts.map +1 -0
- package/dist/__tests__/fixtures/example-date-extension.d.ts +12 -0
- package/dist/__tests__/fixtures/example-date-extension.d.ts.map +1 -0
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts +20 -0
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts.map +1 -0
- package/dist/__tests__/fixtures/extension-forms.d.ts +7 -0
- package/dist/__tests__/fixtures/extension-forms.d.ts.map +1 -0
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts +1 -0
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts.map +1 -1
- package/dist/__tests__/fixtures/named-primitive-aliases.d.ts +15 -0
- package/dist/__tests__/fixtures/named-primitive-aliases.d.ts.map +1 -0
- package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts +14 -0
- package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts.map +1 -0
- package/dist/__tests__/fixtures/sample-forms.d.ts +10 -0
- package/dist/__tests__/fixtures/sample-forms.d.ts.map +1 -1
- package/dist/__tests__/generate-schemas.test.d.ts +2 -0
- package/dist/__tests__/generate-schemas.test.d.ts.map +1 -0
- package/dist/__tests__/numeric-extension.integration.test.d.ts +2 -0
- package/dist/__tests__/numeric-extension.integration.test.d.ts.map +1 -0
- package/dist/__tests__/parity/parity.test.d.ts +6 -2
- package/dist/__tests__/parity/parity.test.d.ts.map +1 -1
- package/dist/__tests__/parity/utils.d.ts +9 -4
- package/dist/__tests__/parity/utils.d.ts.map +1 -1
- package/dist/analyzer/class-analyzer.d.ts +5 -4
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +3 -2
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/program.d.ts +15 -0
- package/dist/analyzer/program.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +23 -2
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +269 -11
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +269 -11
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +28 -2
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -1
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
- package/dist/cli.cjs +1640 -282
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1638 -281
- package/dist/cli.js.map +1 -1
- package/dist/extensions/registry.d.ts +25 -1
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/generators/class-schema.d.ts +4 -4
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/method-schema.d.ts.map +1 -1
- package/dist/generators/mixed-authoring.d.ts.map +1 -1
- package/dist/index.cjs +1615 -271
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1615 -271
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +990 -236
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +988 -234
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/ir-generator.d.ts.map +1 -1
- package/dist/validate/constraint-validator.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,173 +1,119 @@
|
|
|
1
1
|
# @formspec/build
|
|
2
2
|
|
|
3
|
-
Build
|
|
3
|
+
Build-time schema generation for FormSpec.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package covers:
|
|
6
|
+
|
|
7
|
+
- Chain DSL to JSON Schema / UI Schema compilation
|
|
8
|
+
- Static analysis of TypeScript classes, interfaces, and type aliases with TSDoc tags
|
|
9
|
+
- Canonical IR generation and validation
|
|
10
|
+
- Extension-aware schema generation with custom vendor keywords
|
|
11
|
+
|
|
12
|
+
## Install
|
|
6
13
|
|
|
7
14
|
```bash
|
|
8
|
-
npm install @formspec/build
|
|
9
|
-
# or
|
|
10
15
|
pnpm add @formspec/build
|
|
11
16
|
```
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
Most app code can use `formspec`, but use `@formspec/build` directly when you need static analysis or lower-level generation APIs.
|
|
14
19
|
|
|
15
|
-
##
|
|
20
|
+
## Public Entry Points
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
| Entry point | Purpose |
|
|
23
|
+
| --------------------------- | -------------------------------------- |
|
|
24
|
+
| `@formspec/build` | Public build APIs |
|
|
25
|
+
| `@formspec/build/browser` | Browser-safe schema generation surface |
|
|
26
|
+
| `@formspec/build/internals` | Unstable internal APIs used by the CLI |
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
// package.json
|
|
21
|
-
{
|
|
22
|
-
"type": "module"
|
|
23
|
-
}
|
|
24
|
-
```
|
|
28
|
+
## Chain DSL Generation
|
|
25
29
|
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
"compilerOptions": {
|
|
30
|
-
"module": "NodeNext",
|
|
31
|
-
"moduleResolution": "NodeNext"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
30
|
+
```ts
|
|
31
|
+
import { buildFormSchemas } from "@formspec/build";
|
|
32
|
+
import { field, formspec } from "@formspec/dsl";
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
const form = formspec(
|
|
35
|
+
field.text("name", { required: true }),
|
|
36
|
+
field.enum("status", ["draft", "published"] as const)
|
|
37
|
+
);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
const { jsonSchema, uiSchema } = buildFormSchemas(form);
|
|
40
|
+
```
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
import { buildFormSchemas } from "@formspec/build";
|
|
42
|
-
import { formspec, field, group } from "@formspec/dsl";
|
|
42
|
+
## Static Analysis
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
field.text("name", { label: "Name", required: true }),
|
|
46
|
-
field.text("email", { label: "Email", required: true }),
|
|
47
|
-
field.enum("subject", ["General", "Support", "Sales"])
|
|
48
|
-
);
|
|
44
|
+
`generateSchemas()` is the main entry point for TSDoc-backed generation.
|
|
49
45
|
|
|
50
|
-
|
|
46
|
+
```ts
|
|
47
|
+
import { generateSchemas } from "@formspec/build";
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const { jsonSchema, uiSchema } = generateSchemas({
|
|
50
|
+
filePath: "./src/forms.ts",
|
|
51
|
+
typeName: "ProductConfig",
|
|
52
|
+
});
|
|
54
53
|
```
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
`generateSchemasFromClass()` remains available when the input is definitely a class declaration.
|
|
57
56
|
|
|
58
|
-
```
|
|
59
|
-
import {
|
|
57
|
+
```ts
|
|
58
|
+
import { generateSchemasFromClass } from "@formspec/build";
|
|
60
59
|
|
|
61
|
-
const result =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
indent: 2,
|
|
60
|
+
const result = generateSchemasFromClass({
|
|
61
|
+
filePath: "./src/forms.ts",
|
|
62
|
+
className: "ProductConfig",
|
|
65
63
|
});
|
|
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
64
|
```
|
|
72
65
|
|
|
73
|
-
###
|
|
66
|
+
### Supported TSDoc Examples
|
|
74
67
|
|
|
75
|
-
```
|
|
76
|
-
|
|
68
|
+
```ts
|
|
69
|
+
export interface ProductConfig {
|
|
70
|
+
/** @displayName Product Name @minLength 1 */
|
|
71
|
+
name: string;
|
|
77
72
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```
|
|
73
|
+
/** @format email */
|
|
74
|
+
supportEmail?: string;
|
|
81
75
|
|
|
82
|
-
|
|
76
|
+
/** @placeholder Search products */
|
|
77
|
+
query?: string;
|
|
83
78
|
|
|
84
|
-
|
|
79
|
+
/** @minimum 0 @maximum 9999.99 */
|
|
80
|
+
price: number;
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
/** @uniqueItems */
|
|
83
|
+
tags: string[];
|
|
84
|
+
}
|
|
88
85
|
```
|
|
89
86
|
|
|
90
|
-
|
|
87
|
+
## Extension-Aware Generation
|
|
91
88
|
|
|
92
|
-
|
|
89
|
+
Both chain and static generation APIs accept `extensionRegistry` and `vendorPrefix` where relevant.
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
```ts
|
|
92
|
+
import { createExtensionRegistry, generateSchemas } from "@formspec/build";
|
|
95
93
|
|
|
96
|
-
|
|
97
|
-
import { generateSchemasFromClass } from "@formspec/build";
|
|
94
|
+
const registry = createExtensionRegistry([myExtension]);
|
|
98
95
|
|
|
99
|
-
const
|
|
96
|
+
const result = generateSchemas({
|
|
100
97
|
filePath: "./src/forms.ts",
|
|
101
|
-
|
|
98
|
+
typeName: "Invoice",
|
|
99
|
+
extensionRegistry: registry,
|
|
100
|
+
vendorPrefix: "x-acme",
|
|
102
101
|
});
|
|
103
102
|
```
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
### Entry Points
|
|
108
|
-
|
|
109
|
-
| Entry Point | Audience | Description |
|
|
110
|
-
| --------------------------- | -------------------- | --------------------------------------------------------------------------------- |
|
|
111
|
-
| `@formspec/build` | Public API | `buildFormSchemas`, `writeSchemas`, `generateSchemasFromClass`, schema generators |
|
|
112
|
-
| `@formspec/build/browser` | Browser (playground) | Schema generators without Node.js `fs`/`path` — safe for bundlers |
|
|
113
|
-
| `@formspec/build/internals` | CLI (unstable) | Internal APIs: `createProgramContext`, `analyzeClass`, `generateClassSchemas` |
|
|
114
|
-
|
|
115
|
-
## Generated Output
|
|
116
|
-
|
|
117
|
-
### JSON Schema (2020-12)
|
|
118
|
-
|
|
119
|
-
```json
|
|
120
|
-
{
|
|
121
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
122
|
-
"type": "object",
|
|
123
|
-
"properties": {
|
|
124
|
-
"name": { "type": "string", "title": "Name" },
|
|
125
|
-
"email": { "type": "string", "title": "Email" },
|
|
126
|
-
"subject": {
|
|
127
|
-
"type": "string",
|
|
128
|
-
"enum": ["General", "Support", "Sales"]
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
"required": ["name", "email"]
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### JSON Forms UI Schema
|
|
104
|
+
Generation validates canonical IR before emitting schemas. Invalid inputs now fail generation with structured diagnostic codes surfaced in the thrown error.
|
|
136
105
|
|
|
137
|
-
|
|
138
|
-
{
|
|
139
|
-
"type": "VerticalLayout",
|
|
140
|
-
"elements": [
|
|
141
|
-
{ "type": "Control", "scope": "#/properties/name", "label": "Name" },
|
|
142
|
-
{ "type": "Control", "scope": "#/properties/email", "label": "Email" },
|
|
143
|
-
{ "type": "Control", "scope": "#/properties/subject" }
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
```
|
|
106
|
+
## Main Exports
|
|
147
107
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
| `writeSchemas(form, options)` | Build and write schemas to disk |
|
|
158
|
-
| `generateSchemasFromClass(options)` | Generate schemas from a TypeScript class via static analysis |
|
|
159
|
-
| `generateSchemas(options)` | Generate schemas from a TypeScript type via static analysis |
|
|
160
|
-
|
|
161
|
-
### Types
|
|
162
|
-
|
|
163
|
-
| Type | Description |
|
|
164
|
-
| -------------------------- | -------------------------------------- |
|
|
165
|
-
| `BuildResult` | Return type of `buildFormSchemas` |
|
|
166
|
-
| `WriteSchemasOptions` | Options for `writeSchemas` |
|
|
167
|
-
| `WriteSchemasResult` | Return type of `writeSchemas` |
|
|
168
|
-
| `JsonSchema2020` | JSON Schema 2020-12 type |
|
|
169
|
-
| `GenerateFromClassOptions` | Options for `generateSchemasFromClass` |
|
|
170
|
-
| `UISchema` | JSON Forms UI Schema type |
|
|
108
|
+
- `buildFormSchemas(form, options?)`
|
|
109
|
+
- `generateJsonSchema(form, options?)`
|
|
110
|
+
- `generateUiSchema(form)`
|
|
111
|
+
- `writeSchemas(form, options)`
|
|
112
|
+
- `generateSchemas(options)`
|
|
113
|
+
- `generateSchemasFromClass(options)`
|
|
114
|
+
- `generateJsonSchemaFromIR(ir, options?)`
|
|
115
|
+
- `buildMixedAuthoringSchemas(options)`
|
|
116
|
+
- `createExtensionRegistry(extensions)`
|
|
171
117
|
|
|
172
118
|
## License
|
|
173
119
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-schema.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/class-schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-extension.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/date-extension.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare class NotificationPreferences {
|
|
2
|
+
/** @defaultValue "email" */
|
|
3
|
+
channel?: string;
|
|
4
|
+
/** @defaultValue 3 */
|
|
5
|
+
retryCount?: number;
|
|
6
|
+
/** @defaultValue true */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
/** @defaultValue null */
|
|
9
|
+
nickname?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export declare class ContactForm {
|
|
12
|
+
/** @format email */
|
|
13
|
+
emailAddress: string;
|
|
14
|
+
/** @format date */
|
|
15
|
+
birthDate: string;
|
|
16
|
+
/** @format uri */
|
|
17
|
+
website: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class SearchForm {
|
|
20
|
+
/** @placeholder Search by keyword... */
|
|
21
|
+
query: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class SettingsForm {
|
|
24
|
+
/** @deprecated Use displayName instead */
|
|
25
|
+
legacyName: string;
|
|
26
|
+
/** @displayName Display Name */
|
|
27
|
+
displayName: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class TagManager {
|
|
30
|
+
/** @minItems 1 @maxItems 10 @uniqueItems */
|
|
31
|
+
tags: string[];
|
|
32
|
+
}
|
|
33
|
+
export declare class SurveyForm {
|
|
34
|
+
/** @maxLength 280 */
|
|
35
|
+
responses: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Summary text becomes the root schema description when no explicit tag is present.
|
|
39
|
+
*/
|
|
40
|
+
export declare class DescriptionPrecedenceForm {
|
|
41
|
+
/**
|
|
42
|
+
* Summary that should be ignored.
|
|
43
|
+
* @remarks Ignored remarks.
|
|
44
|
+
* @description Explicit description wins.
|
|
45
|
+
*/
|
|
46
|
+
explicit: string;
|
|
47
|
+
/** @remarks Remarks become description when no explicit description is present. */
|
|
48
|
+
remarks: string;
|
|
49
|
+
/** Summary text becomes the description when there are no explicit tags. */
|
|
50
|
+
summary: string;
|
|
51
|
+
}
|
|
52
|
+
export declare class PriceRange {
|
|
53
|
+
/** @minimum 100 @maximum 50 */
|
|
54
|
+
price: number;
|
|
55
|
+
}
|
|
56
|
+
export declare class MismatchedForm {
|
|
57
|
+
/** @minimum 0 */
|
|
58
|
+
label: string;
|
|
59
|
+
}
|
|
60
|
+
interface Address {
|
|
61
|
+
street: string;
|
|
62
|
+
city: string;
|
|
63
|
+
}
|
|
64
|
+
export declare class LocationForm {
|
|
65
|
+
/** @minLength :zipCode 5 */
|
|
66
|
+
address: Address;
|
|
67
|
+
}
|
|
68
|
+
interface Dimensions {
|
|
69
|
+
name: string;
|
|
70
|
+
width: number;
|
|
71
|
+
}
|
|
72
|
+
export declare class BoxForm {
|
|
73
|
+
/** @minimum :name 0 */
|
|
74
|
+
size: Dimensions;
|
|
75
|
+
}
|
|
76
|
+
/** @minimum 0 */
|
|
77
|
+
type SafeTemperature = number;
|
|
78
|
+
export declare class ThermostatForm {
|
|
79
|
+
/** @minimum -10 */
|
|
80
|
+
target: SafeTemperature;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=class-schema-regressions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-schema-regressions.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/class-schema-regressions.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAuB;IAClC,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,yBAAyB;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAAa,WAAW;IACtB,oBAAoB;IACpB,YAAY,EAAG,MAAM,CAAC;IAEtB,mBAAmB;IACnB,SAAS,EAAG,MAAM,CAAC;IAEnB,kBAAkB;IAClB,OAAO,EAAG,MAAM,CAAC;CAClB;AAED,qBAAa,UAAU;IACrB,wCAAwC;IACxC,KAAK,EAAG,MAAM,CAAC;CAChB;AAED,qBAAa,YAAY;IACvB,0CAA0C;IAC1C,UAAU,EAAG,MAAM,CAAC;IAEpB,gCAAgC;IAChC,WAAW,EAAG,MAAM,CAAC;CACtB;AAED,qBAAa,UAAU;IACrB,4CAA4C;IAC5C,IAAI,EAAG,MAAM,EAAE,CAAC;CACjB;AAED,qBAAa,UAAU;IACrB,qBAAqB;IACrB,SAAS,EAAG,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,yBAAyB;IACpC;;;;OAIG;IACH,QAAQ,EAAG,MAAM,CAAC;IAElB,mFAAmF;IACnF,OAAO,EAAG,MAAM,CAAC;IAEjB,4EAA4E;IAC5E,OAAO,EAAG,MAAM,CAAC;CAClB;AAED,qBAAa,UAAU;IACrB,+BAA+B;IAC/B,KAAK,EAAG,MAAM,CAAC;CAChB;AAED,qBAAa,cAAc;IACzB,iBAAiB;IACjB,KAAK,EAAG,MAAM,CAAC;CAChB;AAED,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,YAAY;IACvB,4BAA4B;IAC5B,OAAO,EAAG,OAAO,CAAC;CACnB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,OAAO;IAClB,uBAAuB;IACvB,IAAI,EAAG,UAAU,CAAC;CACnB;AAED,iBAAiB;AACjB,KAAK,eAAe,GAAG,MAAM,CAAC;AAE9B,qBAAa,cAAc;IACzB,mBAAmB;IACnB,MAAM,EAAG,eAAe,CAAC;CAC1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ConstraintTagRegistration, type CustomConstraintRegistration, type CustomTypeRegistration } from "@formspec/core";
|
|
2
|
+
export declare const DATE_EXTENSION_ID = "x-formspec/example-date";
|
|
3
|
+
export declare const DATE_TIME_TYPE_ID = "x-formspec/example-date/DateTime";
|
|
4
|
+
export declare function parseCanonicalDateTime(raw: string): string;
|
|
5
|
+
export declare const dateTimeType: CustomTypeRegistration;
|
|
6
|
+
export declare const afterConstraint: CustomConstraintRegistration;
|
|
7
|
+
export declare const beforeConstraint: CustomConstraintRegistration;
|
|
8
|
+
export declare const afterTag: ConstraintTagRegistration;
|
|
9
|
+
export declare const beforeTag: ConstraintTagRegistration;
|
|
10
|
+
export declare const dateExtension: import("@formspec/core").ExtensionDefinition;
|
|
11
|
+
export declare function createDateExtensionRegistry(): import("../../extensions/registry.js").ExtensionRegistry;
|
|
12
|
+
//# sourceMappingURL=example-date-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example-date-extension.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-date-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAG5B,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,qCAAkC,CAAC;AAKjE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc1D;AAoBD,eAAO,MAAM,YAAY,EAAE,sBASzB,CAAC;AAwBH,eAAO,MAAM,eAAe,8BAAiD,CAAC;AAC9E,eAAO,MAAM,gBAAgB,8BAAmD,CAAC;AAEjF,eAAO,MAAM,QAAQ,EAAE,yBAKrB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,yBAKtB,CAAC;AAEH,eAAO,MAAM,aAAa,8CAKxB,CAAC;AAEH,wBAAgB,2BAA2B,6DAE1C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ConstraintTagRegistration, type CustomTypeRegistration } from "@formspec/core";
|
|
2
|
+
export declare const NUMERIC_EXTENSION_ID = "x-formspec/example-numeric";
|
|
3
|
+
export declare const DECIMAL_TYPE_ID = "x-formspec/example-numeric/Decimal";
|
|
4
|
+
export declare const BIGINT_TYPE_ID = "x-formspec/example-numeric/BigInt";
|
|
5
|
+
export interface DecimalValue {
|
|
6
|
+
readonly coefficient: bigint;
|
|
7
|
+
readonly scale: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseDecimal(raw: string): DecimalValue;
|
|
10
|
+
export declare function formatDecimal(value: DecimalValue): string;
|
|
11
|
+
export declare function compareDecimal(left: DecimalValue, right: DecimalValue): -1 | 0 | 1;
|
|
12
|
+
export declare function addDecimal(left: DecimalValue, right: DecimalValue): DecimalValue;
|
|
13
|
+
export declare function subtractDecimal(left: DecimalValue, right: DecimalValue): DecimalValue;
|
|
14
|
+
export declare const decimalType: CustomTypeRegistration;
|
|
15
|
+
export declare const bigIntType: CustomTypeRegistration;
|
|
16
|
+
export declare const maxSigFigTag: ConstraintTagRegistration;
|
|
17
|
+
export declare const maxDecimalPlacesTag: ConstraintTagRegistration;
|
|
18
|
+
export declare const numericExtension: import("@formspec/core").ExtensionDefinition;
|
|
19
|
+
export declare function createNumericExtensionRegistry(): import("../../extensions/registry.js").ExtensionRegistry;
|
|
20
|
+
//# sourceMappingURL=example-numeric-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example-numeric-extension.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-numeric-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,yBAAyB,EAE9B,KAAK,sBAAsB,EAG5B,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AACjE,eAAO,MAAM,eAAe,uCAAoC,CAAC;AACjE,eAAO,MAAM,cAAc,sCAAmC,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAMD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAetD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAazD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CASlF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAQhF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAQrF;AAgDD,eAAO,MAAM,WAAW,EAAE,sBAkCxB,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,sBAOvB,CAAC;AA6FH,eAAO,MAAM,YAAY,EAAE,yBAKzB,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,yBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB,8CAa3B,CAAC;AAEH,wBAAgB,8BAA8B,6DAE7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-forms.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/extension-forms.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG,MAAM,CAAC;AAE3B,MAAM,WAAW,WAAW;IAC1B,mBAAmB;IACnB,MAAM,EAAE,YAAY,CAAC;CACtB"}
|
|
@@ -27,4 +27,5 @@ export declare const duplicateShippingAddressOverlays: import("@formspec/core").
|
|
|
27
27
|
export declare const unknownShippingAddressOverlays: import("@formspec/core").FormSpec<readonly [import("@formspec/core").DynamicEnumField<"region", "regions">]>;
|
|
28
28
|
export declare const constrainedShippingAddressOverlays: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"city">]>;
|
|
29
29
|
export declare const requiredShippingAddressOverlays: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"postalCode">]>;
|
|
30
|
+
export declare const requiredCountryShippingAddressOverlays: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"country">]>;
|
|
30
31
|
//# sourceMappingURL=mixed-authoring-shipping-address.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixed-authoring-shipping-address.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/mixed-authoring-shipping-address.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,2BAA2B;IAC3B,OAAO,EAAG,MAAM,CAAC;IAEjB,wBAAwB;IACxB,IAAI,EAAG,MAAM,CAAC;IAEd,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,2GAInC,CAAC;AAEF,qBAAa,2BAA2B;IACtC,QAAQ,EAAG,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,mCAAmC,+GAE/C,CAAC;AAEF,qBAAa,0BAA0B;IACrC,OAAO,EAAG;QACR,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,eAAO,MAAM,6BAA6B,uKAEzC,CAAC;AAEF,eAAO,MAAM,gCAAgC,+KAG5C,CAAC;AAEF,eAAO,MAAM,8BAA8B,8GAAmD,CAAC;AAE/F,eAAO,MAAM,kCAAkC,
|
|
1
|
+
{"version":3,"file":"mixed-authoring-shipping-address.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/mixed-authoring-shipping-address.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,2BAA2B;IAC3B,OAAO,EAAG,MAAM,CAAC;IAEjB,wBAAwB;IACxB,IAAI,EAAG,MAAM,CAAC;IAEd,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,2GAInC,CAAC;AAEF,qBAAa,2BAA2B;IACtC,QAAQ,EAAG,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,mCAAmC,+GAE/C,CAAC;AAEF,qBAAa,0BAA0B;IACrC,OAAO,EAAG;QACR,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,eAAO,MAAM,6BAA6B,uKAEzC,CAAC;AAEF,eAAO,MAAM,gCAAgC,+KAG5C,CAAC;AAEF,eAAO,MAAM,8BAA8B,8GAAmD,CAAC;AAE/F,eAAO,MAAM,kCAAkC,0FAAiD,CAAC;AAEjG,eAAO,MAAM,+BAA+B,gGAE3C,CAAC;AAEF,eAAO,MAAM,sCAAsC,6FAElD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @multipleOf 1 */
|
|
2
|
+
export type Integer = number;
|
|
3
|
+
/** @minimum 0 @maximum 65535 */
|
|
4
|
+
export type PortNumber = Integer;
|
|
5
|
+
/** @minimum 0 @maximum 100 */
|
|
6
|
+
export type Percentage = number;
|
|
7
|
+
/** @minimum 0 @maximum 9007199254740991 */
|
|
8
|
+
export type BigCounter = bigint;
|
|
9
|
+
export declare class ServerConfig {
|
|
10
|
+
httpPort: PortNumber;
|
|
11
|
+
httpsPort: PortNumber;
|
|
12
|
+
cpuThreshold: Percentage;
|
|
13
|
+
requestCount: BigCounter;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=named-primitive-aliases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-primitive-aliases.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/named-primitive-aliases.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,gCAAgC;AAChC,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;AAEjC,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,qBAAa,YAAY;IACvB,QAAQ,EAAG,UAAU,CAAC;IACtB,SAAS,EAAG,UAAU,CAAC;IACvB,YAAY,EAAG,UAAU,CAAC;IAC1B,YAAY,EAAG,UAAU,CAAC;CAC3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Article {
|
|
2
|
+
tags: string[];
|
|
3
|
+
}
|
|
4
|
+
export declare class BlogConfig {
|
|
5
|
+
/**
|
|
6
|
+
* @minItems 1
|
|
7
|
+
* @maxItems 50
|
|
8
|
+
* @minItems :tags 1
|
|
9
|
+
* @maxItems :tags 20
|
|
10
|
+
* @uniqueItems :tags
|
|
11
|
+
*/
|
|
12
|
+
articles: Article[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=nested-array-path-constraints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-array-path-constraints.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/nested-array-path-constraints.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,qBAAa,UAAU;IACrB;;;;;;OAMG;IACH,QAAQ,EAAG,OAAO,EAAE,CAAC;CACtB"}
|
|
@@ -52,4 +52,14 @@ export declare class SimpleProduct {
|
|
|
52
52
|
price?: number;
|
|
53
53
|
}): boolean;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @displayName Vehicle Registration
|
|
57
|
+
* @description Collect vehicle details for fleet management
|
|
58
|
+
*/
|
|
59
|
+
export declare class VehicleRegistration {
|
|
60
|
+
/** @displayName Make */
|
|
61
|
+
make: string;
|
|
62
|
+
/** @displayName Model */
|
|
63
|
+
model: string;
|
|
64
|
+
}
|
|
55
65
|
//# sourceMappingURL=sample-forms.d.ts.map
|
|
@@ -1 +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,GA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AE,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;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,wBAAwB;IACxB,IAAI,EAAG,MAAM,CAAC;IAEd,yBAAyB;IACzB,KAAK,EAAG,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-schemas.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/generate-schemas.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric-extension.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/numeric-extension.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
* Parity tests.
|
|
3
3
|
*
|
|
4
4
|
* Proves that both authoring surfaces (chain DSL and TSDoc/class annotations)
|
|
5
|
-
* produce identical intermediate representations (IR) for equivalent
|
|
6
|
-
*
|
|
5
|
+
* produce identical intermediate representations (IR) for equivalent shared
|
|
6
|
+
* form constructs, modulo provenance metadata.
|
|
7
|
+
*
|
|
8
|
+
* TSDoc-only helper types that the chain DSL cannot express directly, such as
|
|
9
|
+
* constrained primitive aliases, are normalized to their effective field
|
|
10
|
+
* semantics before parity comparison.
|
|
7
11
|
*
|
|
8
12
|
* Three-test pattern per fixture:
|
|
9
13
|
* 1. Chain DSL → IR matches expected IR
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parity.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/parity/parity.test.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"parity.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/parity/parity.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
* - `ProvenanceFree<T>` — type-level mapper that strips `provenance` fields from IR nodes
|
|
6
6
|
* - `stripProvenance(ir)` — runtime equivalent for `FormIR`
|
|
7
7
|
* - `compareIR(a, b)` — structured IR comparison after stripping provenance
|
|
8
|
+
* - narrow parity normalization for TSDoc-only helper types the chain DSL
|
|
9
|
+
* cannot express directly
|
|
8
10
|
*
|
|
9
|
-
* `ProvenanceFree<T>` is implemented as explicit per-type mapped interfaces
|
|
10
|
-
* than a generic deep-recursive mapped type. This keeps the type
|
|
11
|
-
* guarantees intact: if an IR node gains or loses a
|
|
12
|
-
* here will fail to compile, catching
|
|
11
|
+
* `ProvenanceFree<T>` is implemented as explicit per-type mapped interfaces
|
|
12
|
+
* rather than a generic deep-recursive mapped type. This keeps the type
|
|
13
|
+
* system's structural guarantees intact: if an IR node gains or loses a
|
|
14
|
+
* field, the provenance-free variants here will fail to compile, catching
|
|
15
|
+
* shape regressions at type-check time.
|
|
13
16
|
*/
|
|
14
17
|
import type { FormIR, FormIRElement, PrimitiveTypeNode, EnumMember, DynamicTypeNode, CustomTypeNode, NumericConstraintNode, LengthConstraintNode, PatternConstraintNode, ArrayCardinalityConstraintNode, EnumMemberConstraintNode, ConstConstraintNode, CustomConstraintNode, DisplayNameAnnotationNode, DescriptionAnnotationNode, FormatAnnotationNode, PlaceholderAnnotationNode, DefaultValueAnnotationNode, DeprecatedAnnotationNode, FormatHintAnnotationNode, CustomAnnotationNode, JsonValue } from "@formspec/core";
|
|
15
18
|
/** Primitive type node has no `provenance` field — pass through unchanged. */
|
|
@@ -107,6 +110,8 @@ export type ProvenanceFreeFormIRElement = ProvenanceFreeFieldNode | ProvenanceFr
|
|
|
107
110
|
export interface ProvenanceFreeTypeDefinition {
|
|
108
111
|
readonly name: string;
|
|
109
112
|
readonly type: ProvenanceFreeTypeNode;
|
|
113
|
+
readonly constraints?: readonly ProvenanceFreeConstraintNode[];
|
|
114
|
+
readonly annotations?: readonly ProvenanceFreeAnnotationNode[];
|
|
110
115
|
}
|
|
111
116
|
/** The top-level `FormIR` with all `provenance` fields stripped. */
|
|
112
117
|
export interface ProvenanceFreeFormIR {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/parity/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/parity/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EAKb,iBAAiB,EACjB,UAAU,EAGV,eAAe,EACf,cAAc,EAEd,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EAEpB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,SAAS,EACV,MAAM,gBAAgB,CAAC;AAUxB,8EAA8E;AAC9E,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,C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,GAAG,YAAY,EAAE,CAQ9D"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as ts from "typescript";
|
|
9
9
|
import type { FieldNode, TypeNode, AnnotationNode, TypeDefinition, JsonValue } from "@formspec/core";
|
|
10
|
+
import type { ExtensionRegistry } from "../extensions/index.js";
|
|
10
11
|
/**
|
|
11
12
|
* Layout metadata extracted from `@Group` and `@ShowWhen` TSDoc tags.
|
|
12
13
|
* One entry per field, in the same order as `fields`.
|
|
@@ -52,19 +53,19 @@ export type AnalyzeTypeAliasToIRResult = {
|
|
|
52
53
|
/**
|
|
53
54
|
* Analyzes a class declaration and produces canonical IR FieldNodes.
|
|
54
55
|
*/
|
|
55
|
-
export declare function analyzeClassToIR(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, file?: string): IRClassAnalysis;
|
|
56
|
+
export declare function analyzeClassToIR(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, file?: string, extensionRegistry?: ExtensionRegistry): IRClassAnalysis;
|
|
56
57
|
/**
|
|
57
58
|
* Analyzes an interface declaration and produces canonical IR FieldNodes.
|
|
58
59
|
*/
|
|
59
|
-
export declare function analyzeInterfaceToIR(interfaceDecl: ts.InterfaceDeclaration, checker: ts.TypeChecker, file?: string): IRClassAnalysis;
|
|
60
|
+
export declare function analyzeInterfaceToIR(interfaceDecl: ts.InterfaceDeclaration, checker: ts.TypeChecker, file?: string, extensionRegistry?: ExtensionRegistry): IRClassAnalysis;
|
|
60
61
|
/**
|
|
61
62
|
* Analyzes a type alias declaration and produces canonical IR FieldNodes.
|
|
62
63
|
*/
|
|
63
|
-
export declare function analyzeTypeAliasToIR(typeAlias: ts.TypeAliasDeclaration, checker: ts.TypeChecker, file?: string): AnalyzeTypeAliasToIRResult;
|
|
64
|
+
export declare function analyzeTypeAliasToIR(typeAlias: ts.TypeAliasDeclaration, checker: ts.TypeChecker, file?: string, extensionRegistry?: ExtensionRegistry): AnalyzeTypeAliasToIRResult;
|
|
64
65
|
/**
|
|
65
66
|
* Resolves a TypeScript type to a canonical IR TypeNode.
|
|
66
67
|
*/
|
|
67
|
-
export declare function resolveTypeNode(type: ts.Type, checker: ts.TypeChecker, file: string, typeRegistry: Record<string, TypeDefinition>, visiting: Set<ts.Type>, sourceNode?: ts.Node): TypeNode;
|
|
68
|
+
export declare function resolveTypeNode(type: ts.Type, checker: ts.TypeChecker, file: string, typeRegistry: Record<string, TypeDefinition>, visiting: Set<ts.Type>, sourceNode?: ts.Node, extensionRegistry?: ExtensionRegistry): TypeNode;
|
|
68
69
|
/**
|
|
69
70
|
* Analyzed method information.
|
|
70
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-analyzer.d.ts","sourceRoot":"","sources":["../../src/analyzer/class-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EAIR,cAAc,EAId,cAAc,EACd,SAAS,EACV,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"class-analyzer.d.ts","sourceRoot":"","sources":["../../src/analyzer/class-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EAIR,cAAc,EAId,cAAc,EACd,SAAS,EACV,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAwDhE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,6FAA6F;IAC7F,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;K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