@collie-lang/compiler 1.0.0 → 1.2.0
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/dist/index.cjs +3067 -764
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -3
- package/dist/index.d.ts +109 -3
- package/dist/index.js +3052 -764
- package/dist/index.js.map +1 -1
- package/package.json +11 -5
- package/LICENSE +0 -21
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { NormalizedCollieDialectOptions } from '@collie-lang/config';
|
|
2
|
+
export { CollieCompilerOptions, CollieConfig, CollieCssOptions, CollieCssStrategy, CollieDiagnosticLevel, CollieDialectOptions, CollieDialectPropsOptions, CollieDialectTokenKind, CollieDialectTokenRule, CollieDialectTokens, CollieEditorOptions, CollieFeatureOptions, CollieProjectConfig, HtmlProjectOptions, NormalizedCollieConfig, NormalizedCollieCssOptions, NormalizedCollieDialectOptions, NormalizedCollieDialectPropsOptions, NormalizedCollieDialectTokenRule, NormalizedCollieDialectTokens, NormalizedCollieProjectConfig, ReactProjectOptions, defineConfig, loadAndNormalizeConfig, loadConfig, normalizeConfig } from '@collie-lang/config';
|
|
3
|
+
|
|
1
4
|
type DiagnosticSeverity = "error" | "warning";
|
|
2
|
-
type DiagnosticCode = "COLLIE001" | "COLLIE002" | "COLLIE003" | "COLLIE004" | "COLLIE005" | "COLLIE101" | "COLLIE102" | "COLLIE201" | "COLLIE202" | "COLLIE203" | "COLLIE204" | "COLLIE205" | "COLLIE206" | "COLLIE207" | "COLLIE208" | "COLLIE209" | "COLLIE210" | "COLLIE301" | "COLLIE302" | "COLLIE303" | "COLLIE304" | "COLLIE305" | "COLLIE306" | "COLLIE307" | "COLLIE401" | "COLLIE402" | "COLLIE501" | "COLLIE502" | "COLLIE503" | "COLLIE601";
|
|
5
|
+
type DiagnosticCode = "COLLIE001" | "COLLIE002" | "COLLIE003" | "COLLIE004" | "COLLIE005" | "COLLIE101" | "COLLIE102" | "COLLIE103" | "COLLIE201" | "COLLIE202" | "COLLIE203" | "COLLIE204" | "COLLIE205" | "COLLIE206" | "COLLIE207" | "COLLIE208" | "COLLIE209" | "COLLIE210" | "COLLIE301" | "COLLIE302" | "COLLIE303" | "COLLIE304" | "COLLIE305" | "COLLIE306" | "COLLIE307" | "COLLIE401" | "COLLIE402" | "COLLIE501" | "COLLIE502" | "COLLIE503" | "COLLIE601" | "COLLIE701" | "COLLIE702" | "COLLIE703" | "COLLIE_ID_NOT_PASCAL_CASE" | "dialect.token.disallowed" | "dialect.token.nonPreferred" | "props.missingDeclaration" | "props.unusedDeclaration" | "props.style.nonPreferred" | "props.block.recommendedOrRequired";
|
|
3
6
|
interface SourcePos {
|
|
4
7
|
line: number;
|
|
5
8
|
col: number;
|
|
@@ -13,8 +16,20 @@ interface Diagnostic {
|
|
|
13
16
|
severity: DiagnosticSeverity;
|
|
14
17
|
message: string;
|
|
15
18
|
span?: SourceSpan;
|
|
19
|
+
range?: SourceSpan;
|
|
16
20
|
code?: DiagnosticCode;
|
|
17
21
|
file?: string;
|
|
22
|
+
filePath?: string;
|
|
23
|
+
fix?: DiagnosticFix;
|
|
24
|
+
data?: DiagnosticData;
|
|
25
|
+
}
|
|
26
|
+
interface DiagnosticFix {
|
|
27
|
+
range: SourceSpan;
|
|
28
|
+
replacementText: string;
|
|
29
|
+
}
|
|
30
|
+
interface DiagnosticData {
|
|
31
|
+
kind: string;
|
|
32
|
+
[key: string]: unknown;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
interface ClassAliasDecl {
|
|
@@ -31,6 +46,10 @@ interface RootNode {
|
|
|
31
46
|
props?: PropsDecl;
|
|
32
47
|
classAliases?: ClassAliasesDecl;
|
|
33
48
|
clientComponent?: boolean;
|
|
49
|
+
id?: string;
|
|
50
|
+
rawId?: string;
|
|
51
|
+
idToken?: string;
|
|
52
|
+
idTokenSpan?: SourceSpan;
|
|
34
53
|
}
|
|
35
54
|
type Node = ElementNode | TextNode | ExpressionNode | ConditionalNode | ForNode | ComponentNode | JSXPassthroughNode;
|
|
36
55
|
interface Attribute {
|
|
@@ -45,6 +64,7 @@ interface ElementNode {
|
|
|
45
64
|
attributes: Attribute[];
|
|
46
65
|
children: Node[];
|
|
47
66
|
guard?: string;
|
|
67
|
+
guardSpan?: SourceSpan;
|
|
48
68
|
}
|
|
49
69
|
interface ComponentNode {
|
|
50
70
|
type: "Component";
|
|
@@ -53,16 +73,21 @@ interface ComponentNode {
|
|
|
53
73
|
children: Node[];
|
|
54
74
|
slots?: SlotBlock[];
|
|
55
75
|
guard?: string;
|
|
76
|
+
guardSpan?: SourceSpan;
|
|
56
77
|
}
|
|
57
78
|
interface ForNode {
|
|
58
79
|
type: "For";
|
|
59
80
|
itemName: string;
|
|
60
81
|
arrayExpr: string;
|
|
61
82
|
body: Node[];
|
|
83
|
+
token?: string;
|
|
84
|
+
tokenSpan?: SourceSpan;
|
|
85
|
+
arrayExprSpan?: SourceSpan;
|
|
62
86
|
}
|
|
63
87
|
interface JSXPassthroughNode {
|
|
64
88
|
type: "JSXPassthrough";
|
|
65
89
|
expression: string;
|
|
90
|
+
span?: SourceSpan;
|
|
66
91
|
}
|
|
67
92
|
interface TextNode {
|
|
68
93
|
type: "Text";
|
|
@@ -76,14 +101,20 @@ interface TextChunk {
|
|
|
76
101
|
interface TextExprPart {
|
|
77
102
|
type: "expr";
|
|
78
103
|
value: string;
|
|
104
|
+
span?: SourceSpan;
|
|
79
105
|
}
|
|
80
106
|
interface ExpressionNode {
|
|
81
107
|
type: "Expression";
|
|
82
108
|
value: string;
|
|
109
|
+
span?: SourceSpan;
|
|
83
110
|
}
|
|
84
111
|
interface ConditionalBranch {
|
|
112
|
+
kind?: "if" | "elseIf" | "else";
|
|
85
113
|
test?: string;
|
|
86
114
|
body: Node[];
|
|
115
|
+
token?: string;
|
|
116
|
+
tokenSpan?: SourceSpan;
|
|
117
|
+
testSpan?: SourceSpan;
|
|
87
118
|
}
|
|
88
119
|
interface ConditionalNode {
|
|
89
120
|
type: "Conditional";
|
|
@@ -96,6 +127,7 @@ interface PropsField {
|
|
|
96
127
|
name: string;
|
|
97
128
|
optional: boolean;
|
|
98
129
|
typeText: string;
|
|
130
|
+
span?: SourceSpan;
|
|
99
131
|
}
|
|
100
132
|
interface SlotBlock {
|
|
101
133
|
type: "Slot";
|
|
@@ -103,17 +135,54 @@ interface SlotBlock {
|
|
|
103
135
|
children: Node[];
|
|
104
136
|
}
|
|
105
137
|
|
|
138
|
+
interface TemplateUnit {
|
|
139
|
+
id: string;
|
|
140
|
+
rawId: string;
|
|
141
|
+
span?: SourceSpan;
|
|
142
|
+
ast: RootNode;
|
|
143
|
+
diagnostics: Diagnostic[];
|
|
144
|
+
}
|
|
106
145
|
interface ParseResult {
|
|
107
|
-
|
|
146
|
+
templates: TemplateUnit[];
|
|
147
|
+
diagnostics: Diagnostic[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface FixApplyResult {
|
|
151
|
+
text: string;
|
|
152
|
+
applied: DiagnosticFix[];
|
|
153
|
+
skipped: DiagnosticFix[];
|
|
154
|
+
}
|
|
155
|
+
declare function applyFixes(sourceText: string, fixes: DiagnosticFix[]): FixApplyResult;
|
|
156
|
+
declare function fixAllFromDiagnostics(sourceText: string, diagnostics: Diagnostic[]): FixApplyResult;
|
|
157
|
+
|
|
158
|
+
interface FormatOptions {
|
|
159
|
+
indent?: number;
|
|
160
|
+
}
|
|
161
|
+
interface FormatResult {
|
|
162
|
+
formatted: string;
|
|
108
163
|
diagnostics: Diagnostic[];
|
|
164
|
+
success: boolean;
|
|
109
165
|
}
|
|
166
|
+
declare function formatCollie(source: string, options?: FormatOptions): FormatResult;
|
|
167
|
+
|
|
168
|
+
interface ConvertTsxOptions {
|
|
169
|
+
filename?: string;
|
|
170
|
+
}
|
|
171
|
+
interface ConvertTsxResult {
|
|
172
|
+
collie: string;
|
|
173
|
+
warnings: string[];
|
|
174
|
+
}
|
|
175
|
+
declare function convertTsxToCollie(source: string, options?: ConvertTsxOptions): ConvertTsxResult;
|
|
110
176
|
|
|
111
177
|
interface ParseCollieOptions {
|
|
112
178
|
filename?: string;
|
|
179
|
+
dialect?: NormalizedCollieDialectOptions;
|
|
113
180
|
}
|
|
114
181
|
interface BaseCompileOptions {
|
|
115
182
|
filename?: string;
|
|
183
|
+
/** @deprecated Legacy component module option. */
|
|
116
184
|
componentNameHint?: string;
|
|
185
|
+
dialect?: NormalizedCollieDialectOptions;
|
|
117
186
|
}
|
|
118
187
|
interface JsxCompileOptions extends BaseCompileOptions {
|
|
119
188
|
jsxRuntime?: "classic" | "automatic";
|
|
@@ -122,18 +191,55 @@ interface TsxCompileOptions extends BaseCompileOptions {
|
|
|
122
191
|
jsxRuntime?: "classic" | "automatic";
|
|
123
192
|
}
|
|
124
193
|
interface HtmlCompileOptions extends BaseCompileOptions {
|
|
194
|
+
pretty?: boolean;
|
|
195
|
+
}
|
|
196
|
+
interface CollieCompileMeta {
|
|
197
|
+
id?: string;
|
|
198
|
+
rawId?: string;
|
|
199
|
+
filename?: string;
|
|
200
|
+
span?: SourceSpan;
|
|
125
201
|
}
|
|
126
202
|
interface CompileResult {
|
|
127
203
|
code: string;
|
|
128
204
|
map?: any;
|
|
129
205
|
diagnostics: Diagnostic[];
|
|
206
|
+
meta?: CollieCompileMeta;
|
|
207
|
+
}
|
|
208
|
+
interface ConvertCollieResult {
|
|
209
|
+
tsx: string;
|
|
210
|
+
diagnostics: Diagnostic[];
|
|
211
|
+
meta?: CollieCompileMeta;
|
|
212
|
+
}
|
|
213
|
+
interface CompileTemplateOptions {
|
|
214
|
+
filename?: string;
|
|
215
|
+
jsxRuntime?: "classic" | "automatic";
|
|
216
|
+
flavor?: "jsx" | "tsx";
|
|
130
217
|
}
|
|
131
218
|
type CollieDocument = ParseResult;
|
|
219
|
+
/** @deprecated Legacy component-compile options. Prefer CompileTemplateOptions. */
|
|
132
220
|
type CompileOptions = JsxCompileOptions;
|
|
133
221
|
declare function parseCollie(source: string, options?: ParseCollieOptions): CollieDocument;
|
|
222
|
+
declare function compileTemplate(template: TemplateUnit, options?: CompileTemplateOptions): CompileResult;
|
|
223
|
+
/**
|
|
224
|
+
* @deprecated Legacy component module wrapper.
|
|
225
|
+
* Use compileTemplate for registry-driven render modules.
|
|
226
|
+
*/
|
|
134
227
|
declare function compileToJsx(sourceOrAst: string | RootNode | CollieDocument, options?: JsxCompileOptions): CompileResult;
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated Legacy component module wrapper.
|
|
230
|
+
* Use compileTemplate for registry-driven render modules.
|
|
231
|
+
*/
|
|
135
232
|
declare function compileToTsx(sourceOrAst: string | RootNode | CollieDocument, options?: TsxCompileOptions): CompileResult;
|
|
233
|
+
/**
|
|
234
|
+
* @deprecated Legacy component module wrapper.
|
|
235
|
+
* Use compileTemplate for registry-driven render modules.
|
|
236
|
+
*/
|
|
237
|
+
declare function convertCollieToTsx(source: string, options?: TsxCompileOptions): ConvertCollieResult;
|
|
136
238
|
declare function compileToHtml(sourceOrAst: string | RootNode | CollieDocument, options?: HtmlCompileOptions): CompileResult;
|
|
239
|
+
/**
|
|
240
|
+
* @deprecated Legacy component module wrapper.
|
|
241
|
+
* Use compileTemplate for registry-driven render modules.
|
|
242
|
+
*/
|
|
137
243
|
declare function compile(source: string, options?: CompileOptions): CompileResult;
|
|
138
244
|
|
|
139
|
-
export { type Attribute, type BaseCompileOptions, type ClassAliasDecl, type ClassAliasesDecl, type CollieDocument, type CompileOptions, type CompileResult, type ComponentNode, type ConditionalBranch, type ConditionalNode, type Diagnostic, type DiagnosticSeverity, type ElementNode, type ExpressionNode, type ForNode, type HtmlCompileOptions, type JSXPassthroughNode, type JsxCompileOptions, type Node, type ParseCollieOptions, type ParseResult, type PropsDecl, type PropsField, type RootNode, type SlotBlock, type SourcePos, type SourceSpan, type TextChunk, type TextExprPart, type TextNode, type TextPart, type TsxCompileOptions, compile, compileToHtml, compileToJsx, compileToTsx, parseCollie as parse, parseCollie };
|
|
245
|
+
export { type Attribute, type BaseCompileOptions, type ClassAliasDecl, type ClassAliasesDecl, type CollieCompileMeta, type CollieDocument, type CompileOptions, type CompileResult, type CompileTemplateOptions, type ComponentNode, type ConditionalBranch, type ConditionalNode, type ConvertCollieResult, type ConvertTsxOptions, type ConvertTsxResult, type Diagnostic, type DiagnosticFix, type DiagnosticSeverity, type ElementNode, type ExpressionNode, type ForNode, type FormatOptions, type FormatResult, type HtmlCompileOptions, type JSXPassthroughNode, type JsxCompileOptions, type Node, type ParseCollieOptions, type ParseResult, type PropsDecl, type PropsField, type RootNode, type SlotBlock, type SourcePos, type SourceSpan, type TemplateUnit, type TextChunk, type TextExprPart, type TextNode, type TextPart, type TsxCompileOptions, applyFixes, compile, compileTemplate, compileToHtml, compileToJsx, compileToTsx, convertCollieToTsx, convertTsxToCollie, fixAllFromDiagnostics, formatCollie, parseCollie as parse, parseCollie };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { NormalizedCollieDialectOptions } from '@collie-lang/config';
|
|
2
|
+
export { CollieCompilerOptions, CollieConfig, CollieCssOptions, CollieCssStrategy, CollieDiagnosticLevel, CollieDialectOptions, CollieDialectPropsOptions, CollieDialectTokenKind, CollieDialectTokenRule, CollieDialectTokens, CollieEditorOptions, CollieFeatureOptions, CollieProjectConfig, HtmlProjectOptions, NormalizedCollieConfig, NormalizedCollieCssOptions, NormalizedCollieDialectOptions, NormalizedCollieDialectPropsOptions, NormalizedCollieDialectTokenRule, NormalizedCollieDialectTokens, NormalizedCollieProjectConfig, ReactProjectOptions, defineConfig, loadAndNormalizeConfig, loadConfig, normalizeConfig } from '@collie-lang/config';
|
|
3
|
+
|
|
1
4
|
type DiagnosticSeverity = "error" | "warning";
|
|
2
|
-
type DiagnosticCode = "COLLIE001" | "COLLIE002" | "COLLIE003" | "COLLIE004" | "COLLIE005" | "COLLIE101" | "COLLIE102" | "COLLIE201" | "COLLIE202" | "COLLIE203" | "COLLIE204" | "COLLIE205" | "COLLIE206" | "COLLIE207" | "COLLIE208" | "COLLIE209" | "COLLIE210" | "COLLIE301" | "COLLIE302" | "COLLIE303" | "COLLIE304" | "COLLIE305" | "COLLIE306" | "COLLIE307" | "COLLIE401" | "COLLIE402" | "COLLIE501" | "COLLIE502" | "COLLIE503" | "COLLIE601";
|
|
5
|
+
type DiagnosticCode = "COLLIE001" | "COLLIE002" | "COLLIE003" | "COLLIE004" | "COLLIE005" | "COLLIE101" | "COLLIE102" | "COLLIE103" | "COLLIE201" | "COLLIE202" | "COLLIE203" | "COLLIE204" | "COLLIE205" | "COLLIE206" | "COLLIE207" | "COLLIE208" | "COLLIE209" | "COLLIE210" | "COLLIE301" | "COLLIE302" | "COLLIE303" | "COLLIE304" | "COLLIE305" | "COLLIE306" | "COLLIE307" | "COLLIE401" | "COLLIE402" | "COLLIE501" | "COLLIE502" | "COLLIE503" | "COLLIE601" | "COLLIE701" | "COLLIE702" | "COLLIE703" | "COLLIE_ID_NOT_PASCAL_CASE" | "dialect.token.disallowed" | "dialect.token.nonPreferred" | "props.missingDeclaration" | "props.unusedDeclaration" | "props.style.nonPreferred" | "props.block.recommendedOrRequired";
|
|
3
6
|
interface SourcePos {
|
|
4
7
|
line: number;
|
|
5
8
|
col: number;
|
|
@@ -13,8 +16,20 @@ interface Diagnostic {
|
|
|
13
16
|
severity: DiagnosticSeverity;
|
|
14
17
|
message: string;
|
|
15
18
|
span?: SourceSpan;
|
|
19
|
+
range?: SourceSpan;
|
|
16
20
|
code?: DiagnosticCode;
|
|
17
21
|
file?: string;
|
|
22
|
+
filePath?: string;
|
|
23
|
+
fix?: DiagnosticFix;
|
|
24
|
+
data?: DiagnosticData;
|
|
25
|
+
}
|
|
26
|
+
interface DiagnosticFix {
|
|
27
|
+
range: SourceSpan;
|
|
28
|
+
replacementText: string;
|
|
29
|
+
}
|
|
30
|
+
interface DiagnosticData {
|
|
31
|
+
kind: string;
|
|
32
|
+
[key: string]: unknown;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
interface ClassAliasDecl {
|
|
@@ -31,6 +46,10 @@ interface RootNode {
|
|
|
31
46
|
props?: PropsDecl;
|
|
32
47
|
classAliases?: ClassAliasesDecl;
|
|
33
48
|
clientComponent?: boolean;
|
|
49
|
+
id?: string;
|
|
50
|
+
rawId?: string;
|
|
51
|
+
idToken?: string;
|
|
52
|
+
idTokenSpan?: SourceSpan;
|
|
34
53
|
}
|
|
35
54
|
type Node = ElementNode | TextNode | ExpressionNode | ConditionalNode | ForNode | ComponentNode | JSXPassthroughNode;
|
|
36
55
|
interface Attribute {
|
|
@@ -45,6 +64,7 @@ interface ElementNode {
|
|
|
45
64
|
attributes: Attribute[];
|
|
46
65
|
children: Node[];
|
|
47
66
|
guard?: string;
|
|
67
|
+
guardSpan?: SourceSpan;
|
|
48
68
|
}
|
|
49
69
|
interface ComponentNode {
|
|
50
70
|
type: "Component";
|
|
@@ -53,16 +73,21 @@ interface ComponentNode {
|
|
|
53
73
|
children: Node[];
|
|
54
74
|
slots?: SlotBlock[];
|
|
55
75
|
guard?: string;
|
|
76
|
+
guardSpan?: SourceSpan;
|
|
56
77
|
}
|
|
57
78
|
interface ForNode {
|
|
58
79
|
type: "For";
|
|
59
80
|
itemName: string;
|
|
60
81
|
arrayExpr: string;
|
|
61
82
|
body: Node[];
|
|
83
|
+
token?: string;
|
|
84
|
+
tokenSpan?: SourceSpan;
|
|
85
|
+
arrayExprSpan?: SourceSpan;
|
|
62
86
|
}
|
|
63
87
|
interface JSXPassthroughNode {
|
|
64
88
|
type: "JSXPassthrough";
|
|
65
89
|
expression: string;
|
|
90
|
+
span?: SourceSpan;
|
|
66
91
|
}
|
|
67
92
|
interface TextNode {
|
|
68
93
|
type: "Text";
|
|
@@ -76,14 +101,20 @@ interface TextChunk {
|
|
|
76
101
|
interface TextExprPart {
|
|
77
102
|
type: "expr";
|
|
78
103
|
value: string;
|
|
104
|
+
span?: SourceSpan;
|
|
79
105
|
}
|
|
80
106
|
interface ExpressionNode {
|
|
81
107
|
type: "Expression";
|
|
82
108
|
value: string;
|
|
109
|
+
span?: SourceSpan;
|
|
83
110
|
}
|
|
84
111
|
interface ConditionalBranch {
|
|
112
|
+
kind?: "if" | "elseIf" | "else";
|
|
85
113
|
test?: string;
|
|
86
114
|
body: Node[];
|
|
115
|
+
token?: string;
|
|
116
|
+
tokenSpan?: SourceSpan;
|
|
117
|
+
testSpan?: SourceSpan;
|
|
87
118
|
}
|
|
88
119
|
interface ConditionalNode {
|
|
89
120
|
type: "Conditional";
|
|
@@ -96,6 +127,7 @@ interface PropsField {
|
|
|
96
127
|
name: string;
|
|
97
128
|
optional: boolean;
|
|
98
129
|
typeText: string;
|
|
130
|
+
span?: SourceSpan;
|
|
99
131
|
}
|
|
100
132
|
interface SlotBlock {
|
|
101
133
|
type: "Slot";
|
|
@@ -103,17 +135,54 @@ interface SlotBlock {
|
|
|
103
135
|
children: Node[];
|
|
104
136
|
}
|
|
105
137
|
|
|
138
|
+
interface TemplateUnit {
|
|
139
|
+
id: string;
|
|
140
|
+
rawId: string;
|
|
141
|
+
span?: SourceSpan;
|
|
142
|
+
ast: RootNode;
|
|
143
|
+
diagnostics: Diagnostic[];
|
|
144
|
+
}
|
|
106
145
|
interface ParseResult {
|
|
107
|
-
|
|
146
|
+
templates: TemplateUnit[];
|
|
147
|
+
diagnostics: Diagnostic[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface FixApplyResult {
|
|
151
|
+
text: string;
|
|
152
|
+
applied: DiagnosticFix[];
|
|
153
|
+
skipped: DiagnosticFix[];
|
|
154
|
+
}
|
|
155
|
+
declare function applyFixes(sourceText: string, fixes: DiagnosticFix[]): FixApplyResult;
|
|
156
|
+
declare function fixAllFromDiagnostics(sourceText: string, diagnostics: Diagnostic[]): FixApplyResult;
|
|
157
|
+
|
|
158
|
+
interface FormatOptions {
|
|
159
|
+
indent?: number;
|
|
160
|
+
}
|
|
161
|
+
interface FormatResult {
|
|
162
|
+
formatted: string;
|
|
108
163
|
diagnostics: Diagnostic[];
|
|
164
|
+
success: boolean;
|
|
109
165
|
}
|
|
166
|
+
declare function formatCollie(source: string, options?: FormatOptions): FormatResult;
|
|
167
|
+
|
|
168
|
+
interface ConvertTsxOptions {
|
|
169
|
+
filename?: string;
|
|
170
|
+
}
|
|
171
|
+
interface ConvertTsxResult {
|
|
172
|
+
collie: string;
|
|
173
|
+
warnings: string[];
|
|
174
|
+
}
|
|
175
|
+
declare function convertTsxToCollie(source: string, options?: ConvertTsxOptions): ConvertTsxResult;
|
|
110
176
|
|
|
111
177
|
interface ParseCollieOptions {
|
|
112
178
|
filename?: string;
|
|
179
|
+
dialect?: NormalizedCollieDialectOptions;
|
|
113
180
|
}
|
|
114
181
|
interface BaseCompileOptions {
|
|
115
182
|
filename?: string;
|
|
183
|
+
/** @deprecated Legacy component module option. */
|
|
116
184
|
componentNameHint?: string;
|
|
185
|
+
dialect?: NormalizedCollieDialectOptions;
|
|
117
186
|
}
|
|
118
187
|
interface JsxCompileOptions extends BaseCompileOptions {
|
|
119
188
|
jsxRuntime?: "classic" | "automatic";
|
|
@@ -122,18 +191,55 @@ interface TsxCompileOptions extends BaseCompileOptions {
|
|
|
122
191
|
jsxRuntime?: "classic" | "automatic";
|
|
123
192
|
}
|
|
124
193
|
interface HtmlCompileOptions extends BaseCompileOptions {
|
|
194
|
+
pretty?: boolean;
|
|
195
|
+
}
|
|
196
|
+
interface CollieCompileMeta {
|
|
197
|
+
id?: string;
|
|
198
|
+
rawId?: string;
|
|
199
|
+
filename?: string;
|
|
200
|
+
span?: SourceSpan;
|
|
125
201
|
}
|
|
126
202
|
interface CompileResult {
|
|
127
203
|
code: string;
|
|
128
204
|
map?: any;
|
|
129
205
|
diagnostics: Diagnostic[];
|
|
206
|
+
meta?: CollieCompileMeta;
|
|
207
|
+
}
|
|
208
|
+
interface ConvertCollieResult {
|
|
209
|
+
tsx: string;
|
|
210
|
+
diagnostics: Diagnostic[];
|
|
211
|
+
meta?: CollieCompileMeta;
|
|
212
|
+
}
|
|
213
|
+
interface CompileTemplateOptions {
|
|
214
|
+
filename?: string;
|
|
215
|
+
jsxRuntime?: "classic" | "automatic";
|
|
216
|
+
flavor?: "jsx" | "tsx";
|
|
130
217
|
}
|
|
131
218
|
type CollieDocument = ParseResult;
|
|
219
|
+
/** @deprecated Legacy component-compile options. Prefer CompileTemplateOptions. */
|
|
132
220
|
type CompileOptions = JsxCompileOptions;
|
|
133
221
|
declare function parseCollie(source: string, options?: ParseCollieOptions): CollieDocument;
|
|
222
|
+
declare function compileTemplate(template: TemplateUnit, options?: CompileTemplateOptions): CompileResult;
|
|
223
|
+
/**
|
|
224
|
+
* @deprecated Legacy component module wrapper.
|
|
225
|
+
* Use compileTemplate for registry-driven render modules.
|
|
226
|
+
*/
|
|
134
227
|
declare function compileToJsx(sourceOrAst: string | RootNode | CollieDocument, options?: JsxCompileOptions): CompileResult;
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated Legacy component module wrapper.
|
|
230
|
+
* Use compileTemplate for registry-driven render modules.
|
|
231
|
+
*/
|
|
135
232
|
declare function compileToTsx(sourceOrAst: string | RootNode | CollieDocument, options?: TsxCompileOptions): CompileResult;
|
|
233
|
+
/**
|
|
234
|
+
* @deprecated Legacy component module wrapper.
|
|
235
|
+
* Use compileTemplate for registry-driven render modules.
|
|
236
|
+
*/
|
|
237
|
+
declare function convertCollieToTsx(source: string, options?: TsxCompileOptions): ConvertCollieResult;
|
|
136
238
|
declare function compileToHtml(sourceOrAst: string | RootNode | CollieDocument, options?: HtmlCompileOptions): CompileResult;
|
|
239
|
+
/**
|
|
240
|
+
* @deprecated Legacy component module wrapper.
|
|
241
|
+
* Use compileTemplate for registry-driven render modules.
|
|
242
|
+
*/
|
|
137
243
|
declare function compile(source: string, options?: CompileOptions): CompileResult;
|
|
138
244
|
|
|
139
|
-
export { type Attribute, type BaseCompileOptions, type ClassAliasDecl, type ClassAliasesDecl, type CollieDocument, type CompileOptions, type CompileResult, type ComponentNode, type ConditionalBranch, type ConditionalNode, type Diagnostic, type DiagnosticSeverity, type ElementNode, type ExpressionNode, type ForNode, type HtmlCompileOptions, type JSXPassthroughNode, type JsxCompileOptions, type Node, type ParseCollieOptions, type ParseResult, type PropsDecl, type PropsField, type RootNode, type SlotBlock, type SourcePos, type SourceSpan, type TextChunk, type TextExprPart, type TextNode, type TextPart, type TsxCompileOptions, compile, compileToHtml, compileToJsx, compileToTsx, parseCollie as parse, parseCollie };
|
|
245
|
+
export { type Attribute, type BaseCompileOptions, type ClassAliasDecl, type ClassAliasesDecl, type CollieCompileMeta, type CollieDocument, type CompileOptions, type CompileResult, type CompileTemplateOptions, type ComponentNode, type ConditionalBranch, type ConditionalNode, type ConvertCollieResult, type ConvertTsxOptions, type ConvertTsxResult, type Diagnostic, type DiagnosticFix, type DiagnosticSeverity, type ElementNode, type ExpressionNode, type ForNode, type FormatOptions, type FormatResult, type HtmlCompileOptions, type JSXPassthroughNode, type JsxCompileOptions, type Node, type ParseCollieOptions, type ParseResult, type PropsDecl, type PropsField, type RootNode, type SlotBlock, type SourcePos, type SourceSpan, type TemplateUnit, type TextChunk, type TextExprPart, type TextNode, type TextPart, type TsxCompileOptions, applyFixes, compile, compileTemplate, compileToHtml, compileToJsx, compileToTsx, convertCollieToTsx, convertTsxToCollie, fixAllFromDiagnostics, formatCollie, parseCollie as parse, parseCollie };
|