@spyglassmc/mcdoc 0.3.1 → 0.3.3

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.
@@ -1,8 +1,8 @@
1
1
  import { ColorToken } from '@spyglassmc/core';
2
- export const identifier = node => {
2
+ export const identifier = (node) => {
3
3
  return [ColorToken.create(node, 'variable')];
4
4
  };
5
- export const literal = node => {
5
+ export const literal = (node) => {
6
6
  return [ColorToken.create(node, node.colorTokenType ?? 'literal')];
7
7
  };
8
8
  export function registerMcdocColorizer(meta) {
package/lib/common.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type Segments = readonly string[];
1
+ export type Segments = readonly string[];
2
2
  export declare function identifierToSeg(identifier: string): Segments;
3
3
  export declare function segToIdentifier(seg: Segments): string;
4
4
  export interface AdditionalContext {
@@ -7,13 +7,13 @@ export interface ModuleNode extends AstNode {
7
7
  export declare const ModuleNode: Readonly<{
8
8
  is(node: AstNode | undefined): node is ModuleNode;
9
9
  }>;
10
- export declare type TopLevelNode = CommentNode | DispatchStatementNode | EnumNode | InjectionNode | StructNode | TypeAliasNode | UseStatementNode;
10
+ export type TopLevelNode = CommentNode | DispatchStatementNode | EnumNode | InjectionNode | StructNode | TypeAliasNode | UseStatementNode;
11
11
  export declare const TopLevelNode: Readonly<{
12
12
  is(node: AstNode | undefined): node is TopLevelNode;
13
13
  }>;
14
14
  export interface DispatchStatementNode extends AstNode {
15
15
  type: 'mcdoc:dispatch_statement';
16
- children: (CommentNode | AttributeNode | LiteralNode | ResourceLocationNode | IndexBodyNode | TypeNode)[];
16
+ children: (CommentNode | AttributeNode | LiteralNode | ResourceLocationNode | IndexBodyNode | TypeParamBlockNode | TypeNode)[];
17
17
  }
18
18
  export declare const DispatchStatementNode: Readonly<{
19
19
  destruct(node: DispatchStatementNode): {
@@ -21,6 +21,7 @@ export declare const DispatchStatementNode: Readonly<{
21
21
  location?: ResourceLocationNode;
22
22
  index?: IndexBodyNode;
23
23
  target?: TypeNode;
24
+ typeParams?: TypeParamBlockNode;
24
25
  };
25
26
  is(node: AstNode | undefined): node is DispatchStatementNode;
26
27
  }>;
@@ -42,11 +43,11 @@ export declare const IndexBodyNode: Readonly<{
42
43
  };
43
44
  is(node: AstNode | undefined): node is IndexBodyNode;
44
45
  }>;
45
- export declare type IndexNode = StaticIndexNode | DynamicIndexNode;
46
+ export type IndexNode = StaticIndexNode | DynamicIndexNode;
46
47
  export declare const IndexNode: Readonly<{
47
48
  is(node: AstNode | undefined): node is IndexNode;
48
49
  }>;
49
- export declare type StaticIndexNode = LiteralNode | IdentifierNode | StringNode | ResourceLocationNode;
50
+ export type StaticIndexNode = LiteralNode | IdentifierNode | StringNode | ResourceLocationNode;
50
51
  export declare const StaticIndexNode: Readonly<{
51
52
  is(node: AstNode | undefined): node is StaticIndexNode;
52
53
  }>;
@@ -66,22 +67,22 @@ export declare const DynamicIndexNode: Readonly<{
66
67
  };
67
68
  is(node: AstNode | undefined): node is DynamicIndexNode;
68
69
  }>;
69
- export declare type AccessorKeyNode = LiteralNode | IdentifierNode | StringNode;
70
+ export type AccessorKeyNode = LiteralNode | IdentifierNode | StringNode;
70
71
  export declare const AccessorKeyNode: Readonly<{
71
72
  is(node: AstNode | undefined): node is AccessorKeyNode;
72
73
  }>;
73
- export declare type TypeNode = AnyTypeNode | BooleanTypeNode | StringTypeNode | LiteralTypeNode | NumericTypeNode | PrimitiveArrayTypeNode | ListTypeNode | TupleTypeNode | EnumNode | StructNode | ReferenceTypeNode | DispatcherTypeNode | UnionTypeNode;
74
+ export type TypeNode = AnyTypeNode | BooleanTypeNode | StringTypeNode | LiteralTypeNode | NumericTypeNode | PrimitiveArrayTypeNode | ListTypeNode | TupleTypeNode | EnumNode | StructNode | ReferenceTypeNode | DispatcherTypeNode | UnionTypeNode;
74
75
  export declare const TypeNode: Readonly<{
75
76
  is(node: AstNode | undefined): node is TypeNode;
76
77
  }>;
77
78
  export interface TypeBaseNode<CN extends AstNode> extends AstNode {
78
79
  type: `mcdoc:${string}`;
79
- children: (CommentNode | AttributeNode | IndexBodyNode | CN)[];
80
+ children: (CommentNode | AttributeNode | IndexBodyNode | TypeArgBlockNode | CN)[];
80
81
  }
81
82
  export declare const TypeBaseNode: Readonly<{
82
83
  destruct(node: TypeBaseNode<any>): {
84
+ appendixes: (IndexBodyNode | TypeArgBlockNode)[];
83
85
  attributes: AttributeNode[];
84
- indices: IndexBodyNode[];
85
86
  };
86
87
  }>;
87
88
  export interface AttributeNode extends AstNode {
@@ -95,7 +96,7 @@ export declare const AttributeNode: Readonly<{
95
96
  };
96
97
  is(node: AstNode | undefined): node is AttributeNode;
97
98
  }>;
98
- export declare type AttributeValueNode = TypeNode | AttributeTreeNode;
99
+ export type AttributeValueNode = TypeNode | AttributeTreeNode;
99
100
  export declare const AttributeValueNode: Readonly<{
100
101
  is(node: AstNode | undefined): node is AttributeValueNode;
101
102
  }>;
@@ -135,6 +136,16 @@ export interface AttributeTreeNamedKeyValuePair {
135
136
  key: IdentifierNode | StringNode;
136
137
  value: AttributeValueNode;
137
138
  }
139
+ export interface TypeArgBlockNode extends AstNode {
140
+ type: 'mcdoc:type_arg_block';
141
+ children: (CommentNode | TypeNode)[];
142
+ }
143
+ export declare const TypeArgBlockNode: Readonly<{
144
+ destruct(node: TypeArgBlockNode): {
145
+ args: TypeNode[];
146
+ };
147
+ is(node: AstNode | undefined): node is TypeArgBlockNode;
148
+ }>;
138
149
  export interface AnyTypeNode extends TypeBaseNode<LiteralNode> {
139
150
  type: 'mcdoc:type/any';
140
151
  }
@@ -168,7 +179,7 @@ export declare const LiteralTypeNode: Readonly<{
168
179
  };
169
180
  is(node: AstNode | undefined): node is LiteralTypeNode;
170
181
  }>;
171
- export declare type LiteralTypeValueNode = LiteralNode | TypedNumberNode | StringNode;
182
+ export type LiteralTypeValueNode = LiteralNode | TypedNumberNode | StringNode;
172
183
  export declare const LiteralTypeValueNode: Readonly<{
173
184
  is(node: AstNode | undefined): node is LiteralTypeValueNode;
174
185
  }>;
@@ -199,7 +210,7 @@ export declare const RangeExclusiveChar = "<";
199
210
  * The first bit from the left represents the start, the second bit from the left represents the end.
200
211
  * The bit is turned on if the range is exclusive on that end.
201
212
  */
202
- export declare type RangeKind = 0b00 | 0b01 | 0b10 | 0b11;
213
+ export type RangeKind = 0b00 | 0b01 | 0b10 | 0b11;
203
214
  export declare function getRangeDelimiter(kind: RangeKind): string;
204
215
  export interface FloatRangeNode extends AstNode {
205
216
  type: 'mcdoc:float_range';
@@ -256,7 +267,7 @@ export interface EnumNode extends TypeBaseNode<DocCommentsNode | LiteralNode | I
256
267
  type: 'mcdoc:enum';
257
268
  }
258
269
  declare const EnumKinds: Set<"string" | "float" | "byte" | "short" | "int" | "long" | "double">;
259
- export declare type EnumKind = typeof EnumKinds extends Set<infer V> ? V : never;
270
+ export type EnumKind = typeof EnumKinds extends Set<infer V> ? V : never;
260
271
  export declare const EnumNode: Readonly<{
261
272
  kinds: Set<"string" | "float" | "byte" | "short" | "int" | "long" | "double">;
262
273
  destruct(node: EnumNode): {
@@ -301,11 +312,11 @@ export declare const EnumFieldNode: Readonly<{
301
312
  };
302
313
  is(node: AstNode | undefined): node is EnumFieldNode;
303
314
  }>;
304
- export declare type EnumValueNode = TypedNumberNode | StringNode;
315
+ export type EnumValueNode = TypedNumberNode | StringNode;
305
316
  export declare const EnumValueNode: Readonly<{
306
317
  is(node: AstNode | undefined): node is EnumValueNode;
307
318
  }>;
308
- export declare type PrelimNode = AttributeNode | DocCommentsNode;
319
+ export type PrelimNode = AttributeNode | DocCommentsNode;
309
320
  export declare const PrelimNode: Readonly<{
310
321
  is(node: AstNode | undefined): node is PrelimNode;
311
322
  }>;
@@ -321,13 +332,12 @@ export declare const StructNode: Readonly<{
321
332
  };
322
333
  is(node: AstNode | undefined): node is StructNode;
323
334
  }>;
324
- export interface ReferenceTypeNode extends TypeBaseNode<PathNode | TypeNode> {
335
+ export interface ReferenceTypeNode extends TypeBaseNode<PathNode> {
325
336
  type: 'mcdoc:type/reference';
326
337
  }
327
338
  export declare const ReferenceTypeNode: Readonly<{
328
339
  destruct(node: ReferenceTypeNode): {
329
340
  path: PathNode;
330
- typeParameters: TypeNode[];
331
341
  };
332
342
  is(node: AstNode | undefined): node is ReferenceTypeNode;
333
343
  }>;
@@ -374,7 +384,7 @@ export declare const StructBlockNode: Readonly<{
374
384
  };
375
385
  is(node: AstNode | undefined): node is StructBlockNode;
376
386
  }>;
377
- export declare type StructFieldNode = StructPairFieldNode | StructSpreadFieldNode;
387
+ export type StructFieldNode = StructPairFieldNode | StructSpreadFieldNode;
378
388
  export declare const StructFieldNode: Readonly<{
379
389
  is(node: AstNode | undefined): node is StructFieldNode;
380
390
  }>;
@@ -392,7 +402,7 @@ export declare const StructPairFieldNode: Readonly<{
392
402
  };
393
403
  is(node: AstNode | undefined): node is StructPairFieldNode;
394
404
  }>;
395
- export declare type StructKeyNode = StringNode | IdentifierNode | StructMapKeyNode;
405
+ export type StructKeyNode = StringNode | IdentifierNode | StructMapKeyNode;
396
406
  export declare const StructKeyNode: Readonly<{
397
407
  is(node: AstNode | undefined): node is StructKeyNode;
398
408
  }>;
@@ -446,7 +456,7 @@ export declare const InjectionNode: Readonly<{
446
456
  };
447
457
  is(node: AstNode | undefined): node is InjectionNode;
448
458
  }>;
449
- export declare type InjectionContentNode = EnumInjectionNode | StructInjectionNode;
459
+ export type InjectionContentNode = EnumInjectionNode | StructInjectionNode;
450
460
  export declare const InjectionContentNode: Readonly<{
451
461
  is(node: AstNode | undefined): node is InjectionContentNode;
452
462
  }>;
@@ -466,12 +476,13 @@ export declare const StructInjectionNode: Readonly<{
466
476
  }>;
467
477
  export interface TypeAliasNode extends AstNode {
468
478
  type: 'mcdoc:type_alias';
469
- children: (CommentNode | DocCommentsNode | LiteralNode | IdentifierNode | TypeParamBlockNode | TypeNode)[];
479
+ children: (CommentNode | PrelimNode | LiteralNode | IdentifierNode | TypeParamBlockNode | TypeNode)[];
470
480
  }
471
481
  export declare const TypeAliasNode: Readonly<{
472
482
  destruct(node: TypeAliasNode): {
483
+ attributes: AttributeNode[];
473
484
  docComments?: DocCommentsNode;
474
- identifier?: IdentifierNode;
485
+ identifier: IdentifierNode;
475
486
  keyword: LiteralNode;
476
487
  typeParams?: TypeParamBlockNode;
477
488
  rhs?: TypeNode;
package/lib/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { atArray, CommentNode, FloatNode, ResourceLocationNode, StringNode } from '@spyglassmc/core';
1
+ import { atArray, CommentNode, FloatNode, ResourceLocationNode, StringNode, } from '@spyglassmc/core';
2
2
  export const ModuleNode = Object.freeze({
3
3
  is(node) {
4
4
  return node?.type === 'mcdoc:module';
@@ -22,10 +22,12 @@ export const DispatchStatementNode = Object.freeze({
22
22
  location: node.children.find(ResourceLocationNode.is),
23
23
  index: node.children.find(IndexBodyNode.is),
24
24
  target: node.children.find(TypeNode.is),
25
+ typeParams: node.children.find(TypeParamBlockNode.is),
25
26
  };
26
27
  },
27
28
  is(node) {
28
- return node?.type === 'mcdoc:dispatch_statement';
29
+ return (node?.type ===
30
+ 'mcdoc:dispatch_statement');
29
31
  },
30
32
  });
31
33
  export const LiteralNode = Object.freeze({
@@ -50,7 +52,10 @@ export const IndexNode = Object.freeze({
50
52
  });
51
53
  export const StaticIndexNode = Object.freeze({
52
54
  is(node) {
53
- return LiteralNode.is(node) || IdentifierNode.is(node) || StringNode.is(node) || ResourceLocationNode.is(node);
55
+ return (LiteralNode.is(node) ||
56
+ IdentifierNode.is(node) ||
57
+ StringNode.is(node) ||
58
+ ResourceLocationNode.is(node));
54
59
  },
55
60
  });
56
61
  export const IdentifierNode = Object.freeze({
@@ -65,12 +70,12 @@ export const DynamicIndexNode = Object.freeze({
65
70
  };
66
71
  },
67
72
  is(node) {
68
- return node?.type === 'mcdoc:dynamic_index';
73
+ return (node?.type === 'mcdoc:dynamic_index');
69
74
  },
70
75
  });
71
76
  export const AccessorKeyNode = Object.freeze({
72
77
  is(node) {
73
- return LiteralNode.is(node) || IdentifierNode.is(node) || StringNode.is(node);
78
+ return (LiteralNode.is(node) || IdentifierNode.is(node) || StringNode.is(node));
74
79
  },
75
80
  });
76
81
  export const TypeNode = Object.freeze({
@@ -93,8 +98,8 @@ export const TypeNode = Object.freeze({
93
98
  export const TypeBaseNode = Object.freeze({
94
99
  destruct(node) {
95
100
  return {
101
+ appendixes: node.children.filter((n) => IndexBodyNode.is(n) || TypeArgBlockNode.is(n)),
96
102
  attributes: node.children.filter(AttributeNode.is),
97
- indices: node.children.filter(IndexBodyNode.is),
98
103
  };
99
104
  },
100
105
  });
@@ -122,7 +127,8 @@ export const AttributeTreeNode = Object.freeze({
122
127
  };
123
128
  },
124
129
  is(node) {
125
- return node?.type === 'mcdoc:attribute/tree';
130
+ return (node?.type ===
131
+ 'mcdoc:attribute/tree');
126
132
  },
127
133
  });
128
134
  export const AttributeTreePosValuesNode = Object.freeze({
@@ -132,7 +138,8 @@ export const AttributeTreePosValuesNode = Object.freeze({
132
138
  };
133
139
  },
134
140
  is(node) {
135
- return node?.type === 'mcdoc:attribute/tree/pos';
141
+ return (node?.type ===
142
+ 'mcdoc:attribute/tree/pos');
136
143
  },
137
144
  });
138
145
  export const AttributeTreeNamedValuesNode = Object.freeze({
@@ -156,7 +163,18 @@ export const AttributeTreeNamedValuesNode = Object.freeze({
156
163
  return ans;
157
164
  },
158
165
  is(node) {
159
- return node?.type === 'mcdoc:attribute/tree/named';
166
+ return (node?.type ===
167
+ 'mcdoc:attribute/tree/named');
168
+ },
169
+ });
170
+ export const TypeArgBlockNode = Object.freeze({
171
+ destruct(node) {
172
+ return {
173
+ args: node.children.filter(TypeNode.is),
174
+ };
175
+ },
176
+ is(node) {
177
+ return (node?.type === 'mcdoc:type_arg_block');
160
178
  },
161
179
  });
162
180
  export const AnyTypeNode = Object.freeze({
@@ -166,7 +184,8 @@ export const AnyTypeNode = Object.freeze({
166
184
  });
167
185
  export const BooleanTypeNode = Object.freeze({
168
186
  is(node) {
169
- return node?.type === 'mcdoc:type/boolean';
187
+ return node?.type ===
188
+ 'mcdoc:type/boolean';
170
189
  },
171
190
  });
172
191
  export const IntRangeNode = Object.freeze({
@@ -184,12 +203,13 @@ export const LiteralTypeNode = Object.freeze({
184
203
  };
185
204
  },
186
205
  is(node) {
187
- return node?.type === 'mcdoc:type/literal';
206
+ return node?.type ===
207
+ 'mcdoc:type/literal';
188
208
  },
189
209
  });
190
210
  export const LiteralTypeValueNode = Object.freeze({
191
211
  is(node) {
192
- return LiteralNode.is(node) || TypedNumberNode.is(node) || StringNode.is(node);
212
+ return (LiteralNode.is(node) || TypedNumberNode.is(node) || StringNode.is(node));
193
213
  },
194
214
  });
195
215
  export const TypedNumberNode = Object.freeze({
@@ -200,18 +220,21 @@ export const TypedNumberNode = Object.freeze({
200
220
  };
201
221
  },
202
222
  is(node) {
203
- return node?.type === 'mcdoc:typed_number';
223
+ return node?.type ===
224
+ 'mcdoc:typed_number';
204
225
  },
205
226
  });
206
227
  export const NumericTypeNode = Object.freeze({
207
228
  destruct(node) {
208
229
  return {
209
230
  numericKind: node.children.find(LiteralNode.is),
210
- valueRange: node.children.find(FloatRangeNode.is) || node.children.find(IntRangeNode.is),
231
+ valueRange: node.children.find(FloatRangeNode.is) ||
232
+ node.children.find(IntRangeNode.is),
211
233
  };
212
234
  },
213
235
  is(node) {
214
- return node?.type === 'mcdoc:type/numeric_type';
236
+ return (node?.type ===
237
+ 'mcdoc:type/numeric_type');
215
238
  },
216
239
  });
217
240
  export const RangeExclusiveChar = '<';
@@ -294,7 +317,8 @@ export const PrimitiveArrayTypeNode = Object.freeze({
294
317
  };
295
318
  },
296
319
  is(node) {
297
- return node?.type === 'mcdoc:type/primitive_array';
320
+ return (node?.type ===
321
+ 'mcdoc:type/primitive_array');
298
322
  },
299
323
  });
300
324
  export const ListTypeNode = Object.freeze({
@@ -328,7 +352,15 @@ export const TupleTypeNode = Object.freeze({
328
352
  return node?.type === 'mcdoc:type/tuple';
329
353
  },
330
354
  });
331
- const EnumKinds = new Set(['byte', 'short', 'int', 'long', 'float', 'double', 'string']);
355
+ const EnumKinds = new Set([
356
+ 'byte',
357
+ 'short',
358
+ 'int',
359
+ 'long',
360
+ 'float',
361
+ 'double',
362
+ 'string',
363
+ ]);
332
364
  export const EnumNode = Object.freeze({
333
365
  kinds: EnumKinds,
334
366
  destruct(node) {
@@ -360,19 +392,20 @@ export const DocCommentsNode = Object.freeze({
360
392
  if (!node) {
361
393
  return undefined;
362
394
  }
363
- let comments = node.children.map(doc => doc.comment);
395
+ let comments = node.children.map((doc) => doc.comment);
364
396
  // If every comment contains a leading space or is empty, stripe the leading spaces off.
365
397
  // e.g. /// This is an example doc comment.
366
398
  // ///
367
399
  // /// Another line.
368
400
  // should be converted to "This is an example doc comment.\n\nAnother line."
369
- if (comments.every(s => s.length === 0 || s.startsWith(' '))) {
370
- comments = comments.map(s => s.slice(1));
401
+ if (comments.every((s) => s.length === 0 || s.startsWith(' '))) {
402
+ comments = comments.map((s) => s.slice(1));
371
403
  }
372
404
  return comments.join('\n');
373
405
  },
374
406
  is(node) {
375
- return node?.type === 'mcdoc:doc_comments';
407
+ return node?.type ===
408
+ 'mcdoc:doc_comments';
376
409
  },
377
410
  });
378
411
  export const EnumBlockNode = Object.freeze({
@@ -424,11 +457,11 @@ export const ReferenceTypeNode = Object.freeze({
424
457
  destruct(node) {
425
458
  return {
426
459
  path: node.children.find(PathNode.is),
427
- typeParameters: node.children.filter(TypeNode.is),
428
460
  };
429
461
  },
430
462
  is(node) {
431
- return node?.type === 'mcdoc:type/reference';
463
+ return (node?.type ===
464
+ 'mcdoc:type/reference');
432
465
  },
433
466
  });
434
467
  export const TypeParamBlockNode = Object.freeze({
@@ -438,7 +471,8 @@ export const TypeParamBlockNode = Object.freeze({
438
471
  };
439
472
  },
440
473
  is(node) {
441
- return node?.type === 'mcdoc:type_param_block';
474
+ return (node?.type ===
475
+ 'mcdoc:type_param_block');
442
476
  },
443
477
  });
444
478
  export const TypeParamNode = Object.freeze({
@@ -472,7 +506,8 @@ export const StructBlockNode = Object.freeze({
472
506
  };
473
507
  },
474
508
  is(node) {
475
- return node?.type === 'mcdoc:struct/block';
509
+ return node?.type ===
510
+ 'mcdoc:struct/block';
476
511
  },
477
512
  });
478
513
  export const StructFieldNode = Object.freeze({
@@ -490,12 +525,15 @@ export const StructPairFieldNode = Object.freeze({
490
525
  };
491
526
  },
492
527
  is(node) {
493
- return node?.type === 'mcdoc:struct/field/pair';
528
+ return (node?.type ===
529
+ 'mcdoc:struct/field/pair');
494
530
  },
495
531
  });
496
532
  export const StructKeyNode = Object.freeze({
497
533
  is(node) {
498
- return StringNode.is(node) || IdentifierNode.is(node) || StructMapKeyNode.is(node);
534
+ return (StringNode.is(node) ||
535
+ IdentifierNode.is(node) ||
536
+ StructMapKeyNode.is(node));
499
537
  },
500
538
  });
501
539
  export const StructMapKeyNode = Object.freeze({
@@ -505,7 +543,7 @@ export const StructMapKeyNode = Object.freeze({
505
543
  };
506
544
  },
507
545
  is(node) {
508
- return node?.type === 'mcdoc:struct/map_key';
546
+ return (node?.type === 'mcdoc:struct/map_key');
509
547
  },
510
548
  });
511
549
  export const StructSpreadFieldNode = Object.freeze({
@@ -516,7 +554,8 @@ export const StructSpreadFieldNode = Object.freeze({
516
554
  };
517
555
  },
518
556
  is(node) {
519
- return node?.type === 'mcdoc:struct/field/spread';
557
+ return (node?.type ===
558
+ 'mcdoc:struct/field/spread');
520
559
  },
521
560
  });
522
561
  export const DispatcherTypeNode = Object.freeze({
@@ -527,7 +566,8 @@ export const DispatcherTypeNode = Object.freeze({
527
566
  };
528
567
  },
529
568
  is(node) {
530
- return node?.type === 'mcdoc:type/dispatcher';
569
+ return (node?.type ===
570
+ 'mcdoc:type/dispatcher');
531
571
  },
532
572
  });
533
573
  export const UnionTypeNode = Object.freeze({
@@ -557,17 +597,20 @@ export const InjectionContentNode = Object.freeze({
557
597
  });
558
598
  export const EnumInjectionNode = Object.freeze({
559
599
  is(node) {
560
- return node?.type === 'mcdoc:injection/enum';
600
+ return (node?.type ===
601
+ 'mcdoc:injection/enum');
561
602
  },
562
603
  });
563
604
  export const StructInjectionNode = Object.freeze({
564
605
  is(node) {
565
- return node?.type === 'mcdoc:injection/struct';
606
+ return (node?.type ===
607
+ 'mcdoc:injection/struct');
566
608
  },
567
609
  });
568
610
  export const TypeAliasNode = Object.freeze({
569
611
  destruct(node) {
570
612
  return {
613
+ attributes: node.children.filter(AttributeNode.is),
571
614
  docComments: node.children.find(DocCommentsNode.is),
572
615
  identifier: node.children.find(IdentifierNode.is),
573
616
  keyword: node.children.find(LiteralNode.is),
@@ -587,7 +630,7 @@ export const UseStatementNode = Object.freeze({
587
630
  };
588
631
  },
589
632
  is(node) {
590
- return node?.type === 'mcdoc:use_statement';
633
+ return (node?.type === 'mcdoc:use_statement');
591
634
  },
592
635
  });
593
636
  //# sourceMappingURL=index.js.map
@@ -25,7 +25,7 @@ export declare const typedNumber: InfallibleParser<TypedNumberNode>;
25
25
  export declare const enum_: Parser<EnumNode>;
26
26
  export declare const struct: Parser<StructNode>;
27
27
  export declare const injection: Parser<InjectionNode>;
28
- export declare const typeAlias: Parser<TypeAliasNode>;
28
+ export declare const typeAliasStatement: Parser<TypeAliasNode>;
29
29
  export declare const useStatement: Parser<UseStatementNode>;
30
30
  export declare const module_: Parser<ModuleNode>;
31
31
  export declare const anyType: Parser<AnyTypeNode>;