@tylix/compiler 0.5.2 → 0.7.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/LICENSE +21 -0
- package/package.json +30 -2
- package/src/ast/nodes.js +219 -16
- package/src/ast/substituteCapabilityRefs.js +185 -61
- package/src/codegen/emitStatementLines.js +98 -54
- package/src/codegen/generateExpression.js +339 -36
- package/src/codegen/generateMethod.js +5 -3
- package/src/codegen/generatePage.js +74 -44
- package/src/codegen/generateStatement.js +169 -20
- package/src/codegen/generateTemplate.js +183 -101
- package/src/codegen/generateTemplateExpression.js +102 -59
- package/src/codegen/jsGlobals.js +211 -0
- package/src/compileComponent.js +39 -8
- package/src/imports/extractImports.js +112 -26
- package/src/imports/resolveImports.js +186 -0
- package/src/index.js +3 -2
- package/src/lexer/Lexer.js +430 -235
- package/src/lexer/tokenTypes.js +32 -7
- package/src/parser/Parser.js +2176 -325
- package/src/parser/languageOptions.js +16 -0
- package/src/parser/parseExpressionString.js +23 -7
- package/src/parser/parsePageFile.js +139 -58
- package/src/parser/parseTemplate.js +350 -62
- package/src/renderPageDocument.js +338 -56
- package/src/runtime/capability.js +39 -17
- package/src/runtime/loadingIndicator.js +91 -29
- package/src/runtime/reactive.js +362 -64
- package/src/runtime/useApi.js +74 -13
- package/src/runtime/useChannel.js +27 -6
- package/src/typecheck/buildVirtualTs.js +23 -12
- package/src/typecheck/tylix-globals.d.ts +23 -4
- package/src/typecheck/typedTemplateExpr.js +195 -53
- package/src/typecheckPage.js +28 -4
- package/src/codegen/generateExpression.array.test.js +0 -13
- package/src/codegen/generateExpression.callexpr.test.js +0 -19
- package/src/codegen/generateExpression.test.js +0 -59
- package/src/codegen/generateMethod.asyncawait.test.js +0 -37
- package/src/codegen/generateMethod.ifstatement.test.js +0 -20
- package/src/codegen/generateMethod.test.js +0 -81
- package/src/codegen/generatePage.onmount.test.js +0 -46
- package/src/codegen/generatePage.test.js +0 -138
- package/src/codegen/generateStatement.test.js +0 -31
- package/src/codegen/generateTemplate.ifeach.test.js +0 -138
- package/src/codegen/generateTemplate.test.js +0 -149
- package/src/codegen/generateTemplateExpression.test.js +0 -34
- package/src/compileComponent.test.js +0 -121
- package/src/imports/resolvePackageComponents.js +0 -41
- package/src/lexer/Lexer.test.js +0 -151
- package/src/parser/Parser.array.test.js +0 -37
- package/src/parser/Parser.asyncawait.test.js +0 -33
- package/src/parser/Parser.ifstatement.test.js +0 -20
- package/src/parser/Parser.onmount.test.js +0 -18
- package/src/parser/Parser.test.js +0 -315
- package/src/parser/parseComponent.test.js +0 -53
- package/src/parser/parsePageFile.test.js +0 -101
- package/src/parser/parseTemplate.ifeach.test.js +0 -33
- package/src/parser/parseTemplate.pre.test.js +0 -39
- package/src/parser/parseTemplate.test.js +0 -112
- package/src/renderPageDocument.test.js +0 -125
- package/src/runtime/reactive.test.js +0 -106
- package/test/dashboard-syntax.test.js +0 -116
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mbiyrukzz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tylix/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Compiler for Tylix .tyx pages and components: parses, type-checks and compiles them to server-rendered HTML and client JavaScript.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Mbiyrukzz",
|
|
4
7
|
"type": "module",
|
|
5
8
|
"keywords": [
|
|
6
9
|
"tylix",
|
|
7
10
|
"compiler",
|
|
8
|
-
"ui"
|
|
11
|
+
"ui",
|
|
12
|
+
"templates",
|
|
13
|
+
"ssr",
|
|
14
|
+
"components"
|
|
9
15
|
],
|
|
16
|
+
"homepage": "https://github.com/Mbiyrukzz/tylix/tree/main/packages/compiler#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Mbiyrukzz/tylix.git",
|
|
20
|
+
"directory": "packages/compiler"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/Mbiyrukzz/tylix/issues"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.13"
|
|
27
|
+
},
|
|
10
28
|
"main": "./src/index.js",
|
|
29
|
+
"files": [
|
|
30
|
+
"src",
|
|
31
|
+
"!**/*.test.js",
|
|
32
|
+
"!**/*.test.mjs",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
11
39
|
"scripts": {
|
|
12
40
|
"test": "node --test src/*.test.js src/**/*.test.js"
|
|
13
41
|
},
|
package/src/ast/nodes.js
CHANGED
|
@@ -16,6 +16,7 @@ export function PageNode({
|
|
|
16
16
|
meta = [],
|
|
17
17
|
computed = [],
|
|
18
18
|
actions = [],
|
|
19
|
+
helpers = [],
|
|
19
20
|
onMount = null,
|
|
20
21
|
}) {
|
|
21
22
|
return {
|
|
@@ -32,6 +33,7 @@ export function PageNode({
|
|
|
32
33
|
meta,
|
|
33
34
|
computed,
|
|
34
35
|
actions,
|
|
36
|
+
helpers,
|
|
35
37
|
onMount,
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -58,6 +60,22 @@ export function MethodNode(name, params, body, returnType = null) {
|
|
|
58
60
|
return { type: 'Method', name, params, body, returnType }
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
// A function/method parameter:
|
|
64
|
+
// name plain name, or destructuring source text ("{ a, b }")
|
|
65
|
+
// typeAnnotation TS type text or null
|
|
66
|
+
// defaultValue expression node or null
|
|
67
|
+
// rest true for `...name`
|
|
68
|
+
// optional true for `name?: Type`
|
|
69
|
+
export function Param(
|
|
70
|
+
name,
|
|
71
|
+
typeAnnotation = null,
|
|
72
|
+
defaultValue = null,
|
|
73
|
+
rest = false,
|
|
74
|
+
optional = false,
|
|
75
|
+
) {
|
|
76
|
+
return { name, typeAnnotation, defaultValue, rest, optional }
|
|
77
|
+
}
|
|
78
|
+
|
|
61
79
|
export function AssignmentExpr(target, value) {
|
|
62
80
|
return { type: 'AssignmentExpression', target, value }
|
|
63
81
|
}
|
|
@@ -103,6 +121,10 @@ export function ExpressionStatement(expression) {
|
|
|
103
121
|
return { type: 'ExpressionStatement', expression }
|
|
104
122
|
}
|
|
105
123
|
|
|
124
|
+
export function EmptyStatement() {
|
|
125
|
+
return { type: 'EmptyStatement' }
|
|
126
|
+
}
|
|
127
|
+
|
|
106
128
|
export function ElementNode(tag, attributes, children) {
|
|
107
129
|
return { type: 'Element', tag, attributes, children }
|
|
108
130
|
}
|
|
@@ -119,12 +141,31 @@ export function InterpolationNode(expression) {
|
|
|
119
141
|
return { type: 'Interpolation', expression }
|
|
120
142
|
}
|
|
121
143
|
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
// elseChildren: null, or the nodes of the {{#else}} branch. An
|
|
145
|
+
// `{{#else if c}}` is represented as elseChildren = [IfNode(...)].
|
|
146
|
+
export function IfNode(condition, children, elseChildren = null) {
|
|
147
|
+
return { type: 'If', condition, children, elseChildren }
|
|
124
148
|
}
|
|
125
149
|
|
|
126
|
-
|
|
127
|
-
|
|
150
|
+
// itemName may be a plain name or destructuring source text
|
|
151
|
+
// ("[k, v]", "{ id, name }"). indexName is the optional second binding
|
|
152
|
+
// of `{{#each item, i in items}}`. elseChildren renders when the list
|
|
153
|
+
// is empty.
|
|
154
|
+
export function EachNode(
|
|
155
|
+
itemName,
|
|
156
|
+
iterable,
|
|
157
|
+
children,
|
|
158
|
+
indexName = null,
|
|
159
|
+
elseChildren = null,
|
|
160
|
+
) {
|
|
161
|
+
return {
|
|
162
|
+
type: 'Each',
|
|
163
|
+
itemName,
|
|
164
|
+
iterable,
|
|
165
|
+
children,
|
|
166
|
+
indexName,
|
|
167
|
+
elseChildren,
|
|
168
|
+
}
|
|
128
169
|
}
|
|
129
170
|
|
|
130
171
|
export function CallExpr(callee, args) {
|
|
@@ -135,15 +176,30 @@ export function AwaitExpr(argument) {
|
|
|
135
176
|
return { type: 'AwaitExpression', argument }
|
|
136
177
|
}
|
|
137
178
|
|
|
138
|
-
|
|
139
|
-
|
|
179
|
+
// `more` holds extra declarators of `const a = 1, b = 2`:
|
|
180
|
+
// [{ name, init, typeAnnotation }]. init may be null for `let x`.
|
|
181
|
+
// typeAnnotation (TS type text or null) belongs to the FIRST declarator;
|
|
182
|
+
// extra declarators carry their own in `more[i].typeAnnotation`.
|
|
183
|
+
export function VariableDeclaration(
|
|
184
|
+
kind,
|
|
185
|
+
name,
|
|
186
|
+
init,
|
|
187
|
+
more = [],
|
|
188
|
+
typeAnnotation = null,
|
|
189
|
+
) {
|
|
190
|
+
return { type: 'VariableDeclaration', kind, name, init, more, typeAnnotation }
|
|
140
191
|
}
|
|
141
192
|
|
|
142
193
|
export function ObjectExpr(properties) {
|
|
143
|
-
// properties: [{ key, value }]
|
|
194
|
+
// properties: [{ key, value }] plain
|
|
195
|
+
// [{ key: null, keyExpr, value }] computed key
|
|
196
|
+
// [{ key, keyExpr, method: true, kind: 'method' | 'get' | 'set',
|
|
197
|
+
// value: FunctionExpr }] method shorthand / accessors
|
|
198
|
+
// [{ key: null, spread: true, value }]
|
|
144
199
|
return { type: 'ObjectExpression', properties }
|
|
145
200
|
}
|
|
146
201
|
|
|
202
|
+
// elements may contain `null` for array holes: [1, , 3]
|
|
147
203
|
export function ArrayExpr(elements) {
|
|
148
204
|
return { type: 'ArrayExpression', elements }
|
|
149
205
|
}
|
|
@@ -156,6 +212,12 @@ export function UnaryExpr(operator, argument) {
|
|
|
156
212
|
return { type: 'UnaryExpression', operator, argument }
|
|
157
213
|
}
|
|
158
214
|
|
|
215
|
+
// `++x` / `x++` / `--x` / `x--`. Kept as its own node (not desugared to
|
|
216
|
+
// `x = x + 1`) so a postfix update evaluates to the old value.
|
|
217
|
+
export function UpdateExpr(operator, argument, prefix) {
|
|
218
|
+
return { type: 'UpdateExpression', operator, argument, prefix }
|
|
219
|
+
}
|
|
220
|
+
|
|
159
221
|
export function NullishCoalescingExpr(left, right) {
|
|
160
222
|
return { type: 'NullishCoalescingExpression', left, right }
|
|
161
223
|
}
|
|
@@ -164,8 +226,30 @@ export function TernaryExpr(condition, consequent, alternate) {
|
|
|
164
226
|
return { type: 'TernaryExpression', condition, consequent, alternate }
|
|
165
227
|
}
|
|
166
228
|
|
|
167
|
-
|
|
168
|
-
|
|
229
|
+
// varName: a plain name or a destructuring pattern node. declKind is
|
|
230
|
+
// 'const' (default) or 'let'. Iterates VALUES (for...of). isAwait
|
|
231
|
+
// marks `for await (... of ...)`.
|
|
232
|
+
export function ForInStatement(
|
|
233
|
+
varName,
|
|
234
|
+
iterable,
|
|
235
|
+
body,
|
|
236
|
+
declKind = 'const',
|
|
237
|
+
isAwait = false,
|
|
238
|
+
) {
|
|
239
|
+
return { type: 'ForInStatement', varName, iterable, body, declKind, isAwait }
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// JS `for (const k in obj)` -- iterates KEYS.
|
|
243
|
+
export function ForKeysStatement(varName, object, body, declKind = 'const') {
|
|
244
|
+
return { type: 'ForKeysStatement', varName, object, body, declKind }
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// C-style `for (init; test; update) { }`
|
|
248
|
+
// init: VariableDeclaration | { type: 'ExpressionList', expressions } | null
|
|
249
|
+
// test: expression | null
|
|
250
|
+
// update: expression[]
|
|
251
|
+
export function ForStatement(init, test, update, body) {
|
|
252
|
+
return { type: 'ForStatement', init, test, update, body }
|
|
169
253
|
}
|
|
170
254
|
|
|
171
255
|
export function ForRangeStatement(varName, start, end, body) {
|
|
@@ -176,12 +260,22 @@ export function RepeatStatement(count, body) {
|
|
|
176
260
|
return { type: 'RepeatStatement', count, body }
|
|
177
261
|
}
|
|
178
262
|
|
|
179
|
-
|
|
180
|
-
|
|
263
|
+
// label is the target of `break outer` / `continue outer`, or null.
|
|
264
|
+
export function BreakStatement(label = null) {
|
|
265
|
+
return { type: 'BreakStatement', label }
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export function ContinueStatement(label = null) {
|
|
269
|
+
return { type: 'ContinueStatement', label }
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// `outer: for (...) { ... }`
|
|
273
|
+
export function LabeledStatement(label, body) {
|
|
274
|
+
return { type: 'LabeledStatement', label, body }
|
|
181
275
|
}
|
|
182
276
|
|
|
183
|
-
export function
|
|
184
|
-
return { type: '
|
|
277
|
+
export function DebuggerStatement() {
|
|
278
|
+
return { type: 'DebuggerStatement' }
|
|
185
279
|
}
|
|
186
280
|
|
|
187
281
|
export function ArrowFunctionExpr(
|
|
@@ -189,28 +283,122 @@ export function ArrowFunctionExpr(
|
|
|
189
283
|
body,
|
|
190
284
|
paramTypes = null,
|
|
191
285
|
isAsync = false,
|
|
286
|
+
paramDefaults = null,
|
|
287
|
+
paramOptional = null,
|
|
288
|
+
returnType = null,
|
|
192
289
|
) {
|
|
193
290
|
// body is either an expression node, or a BlockStatement node for
|
|
194
291
|
// block-bodied arrows (`x => { ... }`). Block bodies are only valid
|
|
195
292
|
// in script code; the template generators reject BlockStatement
|
|
196
|
-
// with
|
|
293
|
+
// with a clear error.
|
|
197
294
|
// isAsync marks `async x => ...` / `async (a, b) => ...`.
|
|
198
|
-
|
|
295
|
+
// params are source strings ("x", "[k, v]", "{ id }", "...rest");
|
|
296
|
+
// paramDefaults is a parallel array of expression nodes or null;
|
|
297
|
+
// paramOptional is a parallel array of booleans (`b?: string`);
|
|
298
|
+
// returnType is TS type text or null (`(x): number => ...`).
|
|
299
|
+
return {
|
|
300
|
+
type: 'ArrowFunctionExpression',
|
|
301
|
+
params,
|
|
302
|
+
body,
|
|
303
|
+
paramTypes,
|
|
304
|
+
isAsync,
|
|
305
|
+
paramDefaults,
|
|
306
|
+
paramOptional,
|
|
307
|
+
returnType,
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// `function name(a, b = 1, ...rest) { ... }` used as an expression
|
|
312
|
+
// (also the value of object-literal methods and accessors).
|
|
313
|
+
// isGenerator marks `function*`. Script only.
|
|
314
|
+
export function FunctionExpr(
|
|
315
|
+
params,
|
|
316
|
+
body,
|
|
317
|
+
isAsync = false,
|
|
318
|
+
name = null,
|
|
319
|
+
isGenerator = false,
|
|
320
|
+
) {
|
|
321
|
+
return { type: 'FunctionExpression', params, body, isAsync, name, isGenerator }
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export function FunctionDeclaration(
|
|
325
|
+
name,
|
|
326
|
+
params,
|
|
327
|
+
body,
|
|
328
|
+
isAsync = false,
|
|
329
|
+
isGenerator = false,
|
|
330
|
+
) {
|
|
331
|
+
return {
|
|
332
|
+
type: 'FunctionDeclaration',
|
|
333
|
+
name,
|
|
334
|
+
params,
|
|
335
|
+
body,
|
|
336
|
+
isAsync,
|
|
337
|
+
isGenerator,
|
|
338
|
+
}
|
|
199
339
|
}
|
|
200
340
|
|
|
201
341
|
export function TemplateLiteralExpr(parts) {
|
|
202
342
|
return { type: 'TemplateLiteralExpression', parts }
|
|
203
343
|
}
|
|
204
344
|
|
|
345
|
+
// tag`text ${x}` -- quasi is a TemplateLiteralExpression whose text
|
|
346
|
+
// parts carry `raw` (the text as written) for String.raw.
|
|
347
|
+
export function TaggedTemplateExpr(tag, quasi) {
|
|
348
|
+
return { type: 'TaggedTemplateExpression', tag, quasi }
|
|
349
|
+
}
|
|
350
|
+
|
|
205
351
|
export function SpreadElement(argument) {
|
|
206
352
|
return { type: 'SpreadElement', argument }
|
|
207
353
|
}
|
|
208
354
|
|
|
209
|
-
|
|
355
|
+
// `(a, b, c)` -- the comma operator.
|
|
356
|
+
export function SequenceExpr(expressions) {
|
|
357
|
+
return { type: 'SequenceExpression', expressions }
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// `yield x` / `yield* x` / bare `yield` (argument null).
|
|
361
|
+
export function YieldExpr(argument, delegate = false) {
|
|
362
|
+
return { type: 'YieldExpression', argument, delegate }
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// `expr as Type` / `expr satisfies Type` -- the cast exists only in
|
|
366
|
+
// the virtual .ts file; real JS output is just the inner expression.
|
|
367
|
+
export function AsExpr(expression, typeAnnotation, keyword = 'as') {
|
|
368
|
+
return { type: 'AsExpression', expression, typeAnnotation, keyword }
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// `expr!` -- non-null assertion, same deal: .ts only.
|
|
372
|
+
export function NonNullExpr(expression) {
|
|
373
|
+
return { type: 'NonNullExpression', expression }
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// members: see Parser.parseClassMember. Each is
|
|
377
|
+
// { kind: 'constructor' | 'method' | 'get' | 'set' | 'field' | 'staticBlock',
|
|
378
|
+
// static, key, keyExpr, keyKind: 'name' | 'string' | 'number' | 'computed',
|
|
379
|
+
// isAsync, isGenerator, params, body, returnType, typeAnnotation, value }
|
|
380
|
+
export function ClassDeclaration(name, superClass, members) {
|
|
381
|
+
return { type: 'ClassDeclaration', name, superClass, members }
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export function ClassExpr(name, superClass, members) {
|
|
385
|
+
return { type: 'ClassExpression', name, superClass, members }
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// catchParam: null, a plain name, or a destructuring pattern node.
|
|
389
|
+
// catchType: optional `any` / `unknown` written after a plain name.
|
|
390
|
+
export function TryStatement(
|
|
391
|
+
tryBlock,
|
|
392
|
+
catchParam,
|
|
393
|
+
catchBlock,
|
|
394
|
+
finallyBlock,
|
|
395
|
+
catchType = null,
|
|
396
|
+
) {
|
|
210
397
|
return {
|
|
211
398
|
type: 'TryStatement',
|
|
212
399
|
tryBlock,
|
|
213
400
|
catchParam,
|
|
401
|
+
catchType,
|
|
214
402
|
catchBlock,
|
|
215
403
|
finallyBlock,
|
|
216
404
|
}
|
|
@@ -228,8 +416,23 @@ export function WhileStatement(condition, body) {
|
|
|
228
416
|
return { type: 'WhileStatement', condition, body }
|
|
229
417
|
}
|
|
230
418
|
|
|
419
|
+
export function DoWhileStatement(body, condition) {
|
|
420
|
+
return { type: 'DoWhileStatement', body, condition }
|
|
421
|
+
}
|
|
422
|
+
|
|
231
423
|
// cases: [{ tests: Expression[] | null, body: Statement[] }]
|
|
232
424
|
// tests === null marks the `default` clause.
|
|
233
425
|
export function SwitchStatement(discriminant, cases) {
|
|
234
426
|
return { type: 'SwitchStatement', discriminant, cases }
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// `type X = ...` / `interface X {...}`. `source` is the full TS text;
|
|
430
|
+
// it only appears in the virtual .ts file, never in real JS output.
|
|
431
|
+
export function TypeDeclaration(kind, name, source) {
|
|
432
|
+
return { type: 'TypeDeclaration', kind, name, source }
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// members: [{ name, init: expression | null }]
|
|
436
|
+
export function EnumDeclaration(name, members) {
|
|
437
|
+
return { type: 'EnumDeclaration', name, members }
|
|
235
438
|
}
|