@willbooster/tree-sitter-typescript 1.1.4 → 1.2.1
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 +8 -4
- package/common/defineGrammar.js +118 -53
- package/package.json +2 -2
- package/tree-sitter-tsx.wasm +0 -0
- package/tree-sitter-typescript.wasm +0 -0
- package/tree-sitter.json +15 -15
- package/tsx/src/node-types.json +66 -23
- package/typescript/src/node-types.json +66 -23
package/README.md
CHANGED
|
@@ -17,7 +17,10 @@ and, for TSX, [JSX](https://facebook.github.io/jsx/).
|
|
|
17
17
|
|
|
18
18
|
TypeScript and TSX are two different dialects (`<T>x` is a type assertion in TypeScript but a JSX element in TSX),
|
|
19
19
|
so this package defines two grammars: `typescript` in `typescript/` and `tsx` in `tsx/`, both generated from
|
|
20
|
-
`common/defineGrammar.js
|
|
20
|
+
`common/defineGrammar.js`, which extends the JavaScript grammar of
|
|
21
|
+
[@willbooster/tree-sitter-javascript](https://www.npmjs.com/package/@willbooster/tree-sitter-javascript) and ports its
|
|
22
|
+
external scanner in `common/scanner.h`. The `tsx` grammar also parses JavaScript with [Flow](https://flow.org/) type
|
|
23
|
+
annotations.
|
|
21
24
|
|
|
22
25
|
## Usage
|
|
23
26
|
|
|
@@ -100,9 +103,10 @@ cargo test
|
|
|
100
103
|
|
|
101
104
|
- the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK).
|
|
102
105
|
Cases run with the `typescript` grammar unless they carry `:language(tsx)`;
|
|
103
|
-
- an incremental-parsing check (`test/unit/incremental.test.ts`): `tree-sitter fuzz
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
- an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
|
|
107
|
+
edits each corpus case of each grammar at random, reparses it, undoes the edits, and reparses again, on the
|
|
108
|
+
WillBooster/tree-sitter runtime version locked in `Cargo.lock` (the first run builds that CLI with `cargo`).
|
|
109
|
+
`TREE_SITTER_SEED`, `TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
|
|
106
110
|
- a check that the real-world files in `examples/`, the checked-in ones and those of the cloned repositories, fail to
|
|
107
111
|
parse exactly as listed in `script/known-failures.txt`. `.ts` files are parsed with the `typescript` grammar and
|
|
108
112
|
`.tsx` files with the `tsx` grammar. The first run clones the repositories. The example repositories are pinned to
|
package/common/defineGrammar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// oxlint-disable unicorn/prefer-module -- This package is CommonJS, so tree-sitter loads the grammar as CommonJS.
|
|
2
|
-
const JavaScript = require('tree-sitter-javascript/grammar');
|
|
2
|
+
const JavaScript = require('@willbooster/tree-sitter-javascript/grammar');
|
|
3
3
|
|
|
4
4
|
module.exports = function defineGrammar(dialect) {
|
|
5
5
|
return grammar(JavaScript, {
|
|
@@ -13,6 +13,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
13
13
|
...previous,
|
|
14
14
|
['call', 'instantiation', 'unary', 'binary', $.await_expression, $.arrow_function],
|
|
15
15
|
['extends', 'instantiation'],
|
|
16
|
+
['new', 'generic_call', 'instantiation', 'unary', 'binary'],
|
|
16
17
|
[
|
|
17
18
|
$.intersection_type,
|
|
18
19
|
$.union_type,
|
|
@@ -58,10 +59,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
58
59
|
|
|
59
60
|
conflicts: ($, previous) => [
|
|
60
61
|
...previous,
|
|
61
|
-
[$.
|
|
62
|
-
[$.call_expression, $.instantiation_expression, $.binary_expression, $.unary_expression],
|
|
63
|
-
[$.call_expression, $.instantiation_expression, $.binary_expression, $.update_expression],
|
|
64
|
-
[$.call_expression, $.instantiation_expression, $.binary_expression, $.await_expression],
|
|
62
|
+
[$.expression, $.call_expression, $.instantiation_expression],
|
|
65
63
|
|
|
66
64
|
// This appears to be necessary to parse a parenthesized class expression
|
|
67
65
|
[$.class],
|
|
@@ -159,22 +157,20 @@ module.exports = function defineGrammar(dialect) {
|
|
|
159
157
|
|
|
160
158
|
call_expression: ($) =>
|
|
161
159
|
choice(
|
|
162
|
-
prec(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
field('type_arguments', $.type_arguments),
|
|
177
|
-
field('arguments', $.template_string)
|
|
160
|
+
prec('call', seq(field('function', choice($.expression, $.import)), field('arguments', $.arguments))),
|
|
161
|
+
// Type arguments follow a primary expression, as in TypeScript: `a + b<T>(c)` calls `b`. Where comparisons
|
|
162
|
+
// could also read the input, as in `a < b > (c)`, TypeScript reads a generic call, hence the dynamic
|
|
163
|
+
// precedence. A tag with type arguments is parsed like a generic call. Optional type arguments in the
|
|
164
|
+
// `template_call` alternative below would make the parser commit to a tagged template at the `<` of `f<T>(x)`.
|
|
165
|
+
prec.dynamic(
|
|
166
|
+
1,
|
|
167
|
+
prec(
|
|
168
|
+
'generic_call',
|
|
169
|
+
seq(
|
|
170
|
+
field('function', choice($.primary_expression, $.new_expression)),
|
|
171
|
+
field('type_arguments', $.type_arguments),
|
|
172
|
+
field('arguments', choice($.arguments, $.template_string))
|
|
173
|
+
)
|
|
178
174
|
)
|
|
179
175
|
),
|
|
180
176
|
prec(
|
|
@@ -188,7 +184,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
188
184
|
'member',
|
|
189
185
|
seq(
|
|
190
186
|
field('function', $.primary_expression),
|
|
191
|
-
'
|
|
187
|
+
field('optional_chain', $.optional_chain),
|
|
192
188
|
field('type_arguments', optional($.type_arguments)),
|
|
193
189
|
field('arguments', $.arguments)
|
|
194
190
|
)
|
|
@@ -209,12 +205,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
209
205
|
assignment_expression: ($) =>
|
|
210
206
|
prec.right(
|
|
211
207
|
'assign',
|
|
212
|
-
seq(
|
|
213
|
-
optional('using'),
|
|
214
|
-
field('left', choice($.parenthesized_expression, $._lhs_expression)),
|
|
215
|
-
'=',
|
|
216
|
-
field('right', $.expression)
|
|
217
|
-
)
|
|
208
|
+
seq(field('left', choice($.parenthesized_expression, $._lhs_expression)), '=', field('right', $.expression))
|
|
218
209
|
),
|
|
219
210
|
|
|
220
211
|
_augmented_assignment_lhs: ($, previous) => choice(previous, $.non_null_expression),
|
|
@@ -257,6 +248,15 @@ module.exports = function defineGrammar(dialect) {
|
|
|
257
248
|
)
|
|
258
249
|
),
|
|
259
250
|
|
|
251
|
+
// Any identifier name may name a JSX attribute, such as `class` in `<div class="x" />`, which the JavaScript
|
|
252
|
+
// grammar's reserved words reject (WillBooster/tree-sitter-javascript#25).
|
|
253
|
+
_jsx_attribute_name: ($) =>
|
|
254
|
+
choice(
|
|
255
|
+
alias($.jsx_identifier, $.property_identifier),
|
|
256
|
+
alias(reserved('properties', $.identifier), $.property_identifier),
|
|
257
|
+
$.jsx_namespace_name
|
|
258
|
+
),
|
|
259
|
+
|
|
260
260
|
// This rule is only referenced by expression when the dialect is 'tsx'
|
|
261
261
|
jsx_opening_element: ($) => prec.dynamic(-1, seq($._jsx_start_opening_element, '>')),
|
|
262
262
|
|
|
@@ -265,6 +265,10 @@ module.exports = function defineGrammar(dialect) {
|
|
|
265
265
|
|
|
266
266
|
export_specifier: (_, previous) => seq(optional(choice('type', 'typeof')), previous),
|
|
267
267
|
|
|
268
|
+
// Any identifier name may be exported or imported. The JavaScript grammar rejects reserved words other than
|
|
269
|
+
// `default`, for which it leaves no node (WillBooster/tree-sitter-javascript#17 and #24).
|
|
270
|
+
_module_export_name: ($) => choice(reserved('properties', $.identifier), $.string),
|
|
271
|
+
|
|
268
272
|
_import_identifier: ($) => choice($.identifier, alias('type', $.identifier)),
|
|
269
273
|
|
|
270
274
|
import_specifier: ($) =>
|
|
@@ -307,12 +311,42 @@ module.exports = function defineGrammar(dialect) {
|
|
|
307
311
|
seq('export', 'as', 'namespace', $.identifier, $._semicolon)
|
|
308
312
|
),
|
|
309
313
|
|
|
314
|
+
// The JavaScript grammar leaves `await (x).y` ambiguous with a call of an identifier named `await`, and GLR keeps
|
|
315
|
+
// the call; TypeScript and V8 read the operator (WillBooster/tree-sitter-javascript#23).
|
|
316
|
+
await_expression: ($) => prec.dynamic(2, prec('unary_void', seq('await', $.expression))),
|
|
317
|
+
|
|
318
|
+
// The JavaScript grammar's for header takes no `using` declaration, although ECMAScript allows one.
|
|
319
|
+
for_statement: ($) =>
|
|
320
|
+
seq(
|
|
321
|
+
'for',
|
|
322
|
+
'(',
|
|
323
|
+
choice(
|
|
324
|
+
field(
|
|
325
|
+
'initializer',
|
|
326
|
+
choice(
|
|
327
|
+
alias($.for_lexical_declaration, $.lexical_declaration),
|
|
328
|
+
alias($.for_variable_declaration, $.variable_declaration),
|
|
329
|
+
alias($._for_using_declaration, $.using_declaration)
|
|
330
|
+
)
|
|
331
|
+
),
|
|
332
|
+
seq(field('initializer', $._expressions), ';'),
|
|
333
|
+
field('initializer', $.empty_statement)
|
|
334
|
+
),
|
|
335
|
+
field('condition', choice(seq($._expressions, ';'), $.empty_statement)),
|
|
336
|
+
field('increment', optional($._expressions)),
|
|
337
|
+
')',
|
|
338
|
+
field('body', $.statement)
|
|
339
|
+
),
|
|
340
|
+
|
|
341
|
+
_for_using_declaration: ($) =>
|
|
342
|
+
seq(field('kind', choice('using', seq('await', 'using'))), commaSep1($.variable_declarator), ';'),
|
|
343
|
+
|
|
310
344
|
non_null_expression: ($) => prec.left('unary', seq($.expression, '!')),
|
|
311
345
|
|
|
312
346
|
variable_declarator: ($) =>
|
|
313
347
|
choice(
|
|
314
348
|
seq(
|
|
315
|
-
field('name', choice($.identifier, $._destructuring_pattern)),
|
|
349
|
+
field('name', choice($.identifier, alias('of', $.identifier), $._destructuring_pattern)),
|
|
316
350
|
field('type', optional($.type_annotation)),
|
|
317
351
|
optional($._initializer)
|
|
318
352
|
),
|
|
@@ -378,15 +412,18 @@ module.exports = function defineGrammar(dialect) {
|
|
|
378
412
|
)
|
|
379
413
|
),
|
|
380
414
|
|
|
381
|
-
decorator_parenthesized_expression: ($) =>
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
415
|
+
decorator_parenthesized_expression: ($) => seq('(', $._expressions, ')'),
|
|
416
|
+
|
|
417
|
+
// A decorator's member name may be any identifier name, as a member expression's may, which the JavaScript
|
|
418
|
+
// grammar's reserved words reject.
|
|
419
|
+
decorator_member_expression: ($) =>
|
|
420
|
+
prec(
|
|
421
|
+
'member',
|
|
422
|
+
seq(
|
|
423
|
+
field('object', choice($.identifier, alias($.decorator_member_expression, $.member_expression))),
|
|
424
|
+
'.',
|
|
425
|
+
field('property', reserved('properties', alias($.identifier, $.property_identifier)))
|
|
426
|
+
)
|
|
390
427
|
),
|
|
391
428
|
|
|
392
429
|
class_body: ($) =>
|
|
@@ -452,7 +489,13 @@ module.exports = function defineGrammar(dialect) {
|
|
|
452
489
|
satisfies_expression: ($) => prec.left('binary', seq($.expression, 'satisfies', $.type)),
|
|
453
490
|
|
|
454
491
|
instantiation_expression: ($) =>
|
|
455
|
-
prec(
|
|
492
|
+
prec.dynamic(
|
|
493
|
+
-1,
|
|
494
|
+
prec(
|
|
495
|
+
'instantiation',
|
|
496
|
+
seq(choice($.primary_expression, $.new_expression), field('type_arguments', $.type_arguments))
|
|
497
|
+
)
|
|
498
|
+
),
|
|
456
499
|
|
|
457
500
|
class_heritage: ($) => choice(seq($.extends_clause, optional($.implements_clause)), $.implements_clause),
|
|
458
501
|
|
|
@@ -523,7 +566,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
523
566
|
_module: ($) =>
|
|
524
567
|
prec.right(
|
|
525
568
|
seq(
|
|
526
|
-
field('name', choice($.string, $.identifier, $.nested_identifier)),
|
|
569
|
+
field('name', choice($.string, reserved('properties', $.identifier), $.nested_identifier)),
|
|
527
570
|
// On .d.ts files "declare module foo" desugars to "declare module foo {}",
|
|
528
571
|
// hence why it is optional here
|
|
529
572
|
field('body', optional($.statement_block))
|
|
@@ -532,6 +575,17 @@ module.exports = function defineGrammar(dialect) {
|
|
|
532
575
|
|
|
533
576
|
import_alias: ($) => seq('import', $.identifier, '=', choice($.identifier, $.nested_identifier), $._semicolon),
|
|
534
577
|
|
|
578
|
+
// A qualified name may end in any identifier name, as a member expression may.
|
|
579
|
+
nested_identifier: ($) =>
|
|
580
|
+
prec(
|
|
581
|
+
'member',
|
|
582
|
+
seq(
|
|
583
|
+
field('object', choice($.identifier, alias($.nested_identifier, $.member_expression))),
|
|
584
|
+
'.',
|
|
585
|
+
field('property', reserved('properties', alias($.identifier, $.property_identifier)))
|
|
586
|
+
)
|
|
587
|
+
),
|
|
588
|
+
|
|
535
589
|
nested_type_identifier: ($) =>
|
|
536
590
|
prec(
|
|
537
591
|
'member',
|
|
@@ -612,7 +666,10 @@ module.exports = function defineGrammar(dialect) {
|
|
|
612
666
|
)
|
|
613
667
|
),
|
|
614
668
|
'.',
|
|
615
|
-
field(
|
|
669
|
+
field(
|
|
670
|
+
'property',
|
|
671
|
+
choice($.private_property_identifier, reserved('properties', alias($.identifier, $.property_identifier)))
|
|
672
|
+
)
|
|
616
673
|
),
|
|
617
674
|
_type_query_call_expression_in_type_annotation: ($) =>
|
|
618
675
|
seq(
|
|
@@ -673,7 +730,8 @@ module.exports = function defineGrammar(dialect) {
|
|
|
673
730
|
'const',
|
|
674
731
|
'unique',
|
|
675
732
|
'abstract',
|
|
676
|
-
'import'
|
|
733
|
+
'import',
|
|
734
|
+
'function'
|
|
677
735
|
),
|
|
678
736
|
$.identifier
|
|
679
737
|
),
|
|
@@ -791,29 +849,32 @@ module.exports = function defineGrammar(dialect) {
|
|
|
791
849
|
field(
|
|
792
850
|
'object',
|
|
793
851
|
choice(
|
|
794
|
-
$.identifier,
|
|
852
|
+
reserved('properties', $.identifier),
|
|
795
853
|
$.this,
|
|
796
854
|
alias($._type_query_subscript_expression, $.subscript_expression),
|
|
797
855
|
alias($._type_query_member_expression, $.member_expression),
|
|
798
856
|
alias($._type_query_call_expression, $.call_expression)
|
|
799
857
|
)
|
|
800
858
|
),
|
|
801
|
-
choice('.', '
|
|
802
|
-
field(
|
|
859
|
+
choice('.', field('optional_chain', $.optional_chain)),
|
|
860
|
+
field(
|
|
861
|
+
'property',
|
|
862
|
+
choice($.private_property_identifier, reserved('properties', alias($.identifier, $.property_identifier)))
|
|
863
|
+
)
|
|
803
864
|
),
|
|
804
865
|
_type_query_subscript_expression: ($) =>
|
|
805
866
|
seq(
|
|
806
867
|
field(
|
|
807
868
|
'object',
|
|
808
869
|
choice(
|
|
809
|
-
$.identifier,
|
|
870
|
+
reserved('properties', $.identifier),
|
|
810
871
|
$.this,
|
|
811
872
|
alias($._type_query_subscript_expression, $.subscript_expression),
|
|
812
873
|
alias($._type_query_member_expression, $.member_expression),
|
|
813
874
|
alias($._type_query_call_expression, $.call_expression)
|
|
814
875
|
)
|
|
815
876
|
),
|
|
816
|
-
optional('
|
|
877
|
+
optional(field('optional_chain', $.optional_chain)),
|
|
817
878
|
'[',
|
|
818
879
|
field('index', choice($.predefined_type, $.string, $.number)),
|
|
819
880
|
']'
|
|
@@ -824,7 +885,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
824
885
|
'function',
|
|
825
886
|
choice(
|
|
826
887
|
$.import,
|
|
827
|
-
$.identifier,
|
|
888
|
+
reserved('properties', $.identifier),
|
|
828
889
|
alias($._type_query_member_expression, $.member_expression),
|
|
829
890
|
alias($._type_query_subscript_expression, $.subscript_expression)
|
|
830
891
|
)
|
|
@@ -837,7 +898,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
837
898
|
'function',
|
|
838
899
|
choice(
|
|
839
900
|
$.import,
|
|
840
|
-
$.identifier,
|
|
901
|
+
reserved('properties', $.identifier),
|
|
841
902
|
alias($._type_query_member_expression, $.member_expression),
|
|
842
903
|
alias($._type_query_subscript_expression, $.subscript_expression)
|
|
843
904
|
)
|
|
@@ -853,7 +914,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
853
914
|
alias($._type_query_member_expression, $.member_expression),
|
|
854
915
|
alias($._type_query_call_expression, $.call_expression),
|
|
855
916
|
alias($._type_query_instantiation_expression, $.instantiation_expression),
|
|
856
|
-
$.identifier,
|
|
917
|
+
reserved('properties', $.identifier),
|
|
857
918
|
$.this
|
|
858
919
|
)
|
|
859
920
|
)
|
|
@@ -988,8 +1049,10 @@ module.exports = function defineGrammar(dialect) {
|
|
|
988
1049
|
tuple_type: ($) => seq('[', commaSep($._tuple_type_member), optional(','), ']'),
|
|
989
1050
|
readonly_type: ($) => seq('readonly', $.type),
|
|
990
1051
|
|
|
991
|
-
|
|
992
|
-
|
|
1052
|
+
// TypeScript allows a leading `|` or `&` only at the start of a type, so `a < b || c > (d)` compares instead of
|
|
1053
|
+
// calling `a` with `b | | c`. The negative dynamic precedence outweighs that of the generic call.
|
|
1054
|
+
union_type: ($) => prec.left(choice(seq($.type, '|', $.type), prec.dynamic(-2, seq('|', $.type)))),
|
|
1055
|
+
intersection_type: ($) => prec.left(choice(seq($.type, '&', $.type), prec.dynamic(-2, seq('&', $.type)))),
|
|
993
1056
|
|
|
994
1057
|
function_type: ($) =>
|
|
995
1058
|
prec.left(
|
|
@@ -1001,7 +1064,9 @@ module.exports = function defineGrammar(dialect) {
|
|
|
1001
1064
|
)
|
|
1002
1065
|
),
|
|
1003
1066
|
|
|
1004
|
-
|
|
1067
|
+
// A type name may be a reserved word, which TypeScript reports only as a semantic error. The reserved words must be
|
|
1068
|
+
// allowed on the identifier inside the alias: around the alias, the keyword token still wins in the lexer.
|
|
1069
|
+
_type_identifier: ($) => alias(reserved('properties', $.identifier), $.type_identifier),
|
|
1005
1070
|
|
|
1006
1071
|
_reserved_identifier: (_, previous) =>
|
|
1007
1072
|
choice(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-typescript",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "TypeScript and TSX grammars for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@vitest/browser-playwright": "5.0.1",
|
|
50
50
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
51
51
|
"@willbooster/oxlint-config": "1.4.8",
|
|
52
|
+
"@willbooster/tree-sitter-javascript": "1.0.3",
|
|
52
53
|
"@willbooster/wb": "22.11.5",
|
|
53
54
|
"@willbooster/web-tree-sitter": "1.0.7",
|
|
54
55
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
@@ -60,7 +61,6 @@
|
|
|
60
61
|
"semantic-release": "25.0.9",
|
|
61
62
|
"sort-package-json": "4.0.0",
|
|
62
63
|
"tree-sitter-cli": "0.27.0",
|
|
63
|
-
"tree-sitter-javascript": "0.23.1",
|
|
64
64
|
"typescript": "7.0.2",
|
|
65
65
|
"vite": "8.3.0",
|
|
66
66
|
"vitest": "5.0.1",
|
package/tree-sitter-tsx.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/tree-sitter.json
CHANGED
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
],
|
|
15
15
|
"highlights": [
|
|
16
16
|
"queries/highlights.scm",
|
|
17
|
-
"node_modules/tree-sitter-javascript/queries/highlights.scm"
|
|
17
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/highlights.scm"
|
|
18
18
|
],
|
|
19
|
-
"injections": "node_modules/tree-sitter-javascript/queries/injections.scm",
|
|
19
|
+
"injections": "node_modules/@willbooster/tree-sitter-javascript/queries/injections.scm",
|
|
20
20
|
"locals": [
|
|
21
21
|
"queries/locals.scm",
|
|
22
|
-
"node_modules/tree-sitter-javascript/queries/locals.scm"
|
|
22
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/locals.scm"
|
|
23
23
|
],
|
|
24
24
|
"tags": [
|
|
25
25
|
"queries/tags.scm",
|
|
26
|
-
"node_modules/tree-sitter-javascript/queries/tags.scm"
|
|
26
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/tags.scm"
|
|
27
27
|
],
|
|
28
28
|
"injection-regex": "^(ts|typescript)$"
|
|
29
29
|
},
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
],
|
|
41
41
|
"highlights": [
|
|
42
42
|
"queries/highlights.scm",
|
|
43
|
-
"node_modules/tree-sitter-javascript/queries/highlights-jsx.scm",
|
|
44
|
-
"node_modules/tree-sitter-javascript/queries/highlights.scm"
|
|
43
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/highlights-jsx.scm",
|
|
44
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/highlights.scm"
|
|
45
45
|
],
|
|
46
|
-
"injections": "node_modules/tree-sitter-javascript/queries/injections.scm",
|
|
47
|
-
"locals": "node_modules/tree-sitter-javascript/queries/locals.scm",
|
|
46
|
+
"injections": "node_modules/@willbooster/tree-sitter-javascript/queries/injections.scm",
|
|
47
|
+
"locals": "node_modules/@willbooster/tree-sitter-javascript/queries/locals.scm",
|
|
48
48
|
"tags": [
|
|
49
49
|
"queries/tags.scm",
|
|
50
|
-
"node_modules/tree-sitter-javascript/queries/tags.scm"
|
|
50
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/tags.scm"
|
|
51
51
|
],
|
|
52
52
|
"injection-regex": "^(ts|typescript)$"
|
|
53
53
|
},
|
|
@@ -64,20 +64,20 @@
|
|
|
64
64
|
],
|
|
65
65
|
"highlights": [
|
|
66
66
|
"queries/highlights.scm",
|
|
67
|
-
"node_modules/tree-sitter-javascript/queries/highlights-jsx.scm",
|
|
68
|
-
"node_modules/tree-sitter-javascript/queries/highlights.scm"
|
|
67
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/highlights-jsx.scm",
|
|
68
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/highlights.scm"
|
|
69
69
|
],
|
|
70
|
-
"injections": "node_modules/tree-sitter-javascript/queries/injections.scm",
|
|
71
|
-
"locals": "node_modules/tree-sitter-javascript/queries/locals.scm",
|
|
70
|
+
"injections": "node_modules/@willbooster/tree-sitter-javascript/queries/injections.scm",
|
|
71
|
+
"locals": "node_modules/@willbooster/tree-sitter-javascript/queries/locals.scm",
|
|
72
72
|
"tags": [
|
|
73
73
|
"queries/tags.scm",
|
|
74
|
-
"node_modules/tree-sitter-javascript/queries/tags.scm"
|
|
74
|
+
"node_modules/@willbooster/tree-sitter-javascript/queries/tags.scm"
|
|
75
75
|
],
|
|
76
76
|
"content-regex": "@flow"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
"metadata": {
|
|
80
|
-
"version": "1.1
|
|
80
|
+
"version": "1.2.1",
|
|
81
81
|
"license": "MIT",
|
|
82
82
|
"description": "TypeScript and TSX grammars for tree-sitter",
|
|
83
83
|
"authors": [
|
package/tsx/src/node-types.json
CHANGED
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
"type": "type_alias_declaration",
|
|
56
56
|
"named": true
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
"type": "using_declaration",
|
|
60
|
+
"named": true
|
|
61
|
+
},
|
|
58
62
|
{
|
|
59
63
|
"type": "variable_declaration",
|
|
60
64
|
"named": true
|
|
@@ -1244,6 +1248,16 @@
|
|
|
1244
1248
|
}
|
|
1245
1249
|
]
|
|
1246
1250
|
},
|
|
1251
|
+
"optional_chain": {
|
|
1252
|
+
"multiple": false,
|
|
1253
|
+
"required": false,
|
|
1254
|
+
"types": [
|
|
1255
|
+
{
|
|
1256
|
+
"type": "optional_chain",
|
|
1257
|
+
"named": true
|
|
1258
|
+
}
|
|
1259
|
+
]
|
|
1260
|
+
},
|
|
1247
1261
|
"type_arguments": {
|
|
1248
1262
|
"multiple": false,
|
|
1249
1263
|
"required": false,
|
|
@@ -2141,9 +2155,13 @@
|
|
|
2141
2155
|
]
|
|
2142
2156
|
},
|
|
2143
2157
|
"kind": {
|
|
2144
|
-
"multiple":
|
|
2158
|
+
"multiple": true,
|
|
2145
2159
|
"required": false,
|
|
2146
2160
|
"types": [
|
|
2161
|
+
{
|
|
2162
|
+
"type": "await",
|
|
2163
|
+
"named": false
|
|
2164
|
+
},
|
|
2147
2165
|
{
|
|
2148
2166
|
"type": "const",
|
|
2149
2167
|
"named": false
|
|
@@ -2152,6 +2170,10 @@
|
|
|
2152
2170
|
"type": "let",
|
|
2153
2171
|
"named": false
|
|
2154
2172
|
},
|
|
2173
|
+
{
|
|
2174
|
+
"type": "using",
|
|
2175
|
+
"named": false
|
|
2176
|
+
},
|
|
2155
2177
|
{
|
|
2156
2178
|
"type": "var",
|
|
2157
2179
|
"named": false
|
|
@@ -2306,6 +2328,10 @@
|
|
|
2306
2328
|
"type": "sequence_expression",
|
|
2307
2329
|
"named": true
|
|
2308
2330
|
},
|
|
2331
|
+
{
|
|
2332
|
+
"type": "using_declaration",
|
|
2333
|
+
"named": true
|
|
2334
|
+
},
|
|
2309
2335
|
{
|
|
2310
2336
|
"type": "variable_declaration",
|
|
2311
2337
|
"named": true
|
|
@@ -3077,7 +3103,11 @@
|
|
|
3077
3103
|
"required": false,
|
|
3078
3104
|
"types": [
|
|
3079
3105
|
{
|
|
3080
|
-
"type": "
|
|
3106
|
+
"type": "new_expression",
|
|
3107
|
+
"named": true
|
|
3108
|
+
},
|
|
3109
|
+
{
|
|
3110
|
+
"type": "primary_expression",
|
|
3081
3111
|
"named": true
|
|
3082
3112
|
}
|
|
3083
3113
|
]
|
|
@@ -4178,11 +4208,6 @@
|
|
|
4178
4208
|
]
|
|
4179
4209
|
}
|
|
4180
4210
|
},
|
|
4181
|
-
{
|
|
4182
|
-
"type": "optional_chain",
|
|
4183
|
-
"named": true,
|
|
4184
|
-
"fields": {}
|
|
4185
|
-
},
|
|
4186
4211
|
{
|
|
4187
4212
|
"type": "optional_parameter",
|
|
4188
4213
|
"named": true,
|
|
@@ -4384,22 +4409,10 @@
|
|
|
4384
4409
|
"multiple": false,
|
|
4385
4410
|
"required": true,
|
|
4386
4411
|
"types": [
|
|
4387
|
-
{
|
|
4388
|
-
"type": "call_expression",
|
|
4389
|
-
"named": true
|
|
4390
|
-
},
|
|
4391
4412
|
{
|
|
4392
4413
|
"type": "expression",
|
|
4393
4414
|
"named": true
|
|
4394
4415
|
},
|
|
4395
|
-
{
|
|
4396
|
-
"type": "identifier",
|
|
4397
|
-
"named": true
|
|
4398
|
-
},
|
|
4399
|
-
{
|
|
4400
|
-
"type": "member_expression",
|
|
4401
|
-
"named": true
|
|
4402
|
-
},
|
|
4403
4416
|
{
|
|
4404
4417
|
"type": "sequence_expression",
|
|
4405
4418
|
"named": true
|
|
@@ -5499,6 +5512,36 @@
|
|
|
5499
5512
|
}
|
|
5500
5513
|
}
|
|
5501
5514
|
},
|
|
5515
|
+
{
|
|
5516
|
+
"type": "using_declaration",
|
|
5517
|
+
"named": true,
|
|
5518
|
+
"fields": {
|
|
5519
|
+
"kind": {
|
|
5520
|
+
"multiple": true,
|
|
5521
|
+
"required": true,
|
|
5522
|
+
"types": [
|
|
5523
|
+
{
|
|
5524
|
+
"type": "await",
|
|
5525
|
+
"named": false
|
|
5526
|
+
},
|
|
5527
|
+
{
|
|
5528
|
+
"type": "using",
|
|
5529
|
+
"named": false
|
|
5530
|
+
}
|
|
5531
|
+
]
|
|
5532
|
+
}
|
|
5533
|
+
},
|
|
5534
|
+
"children": {
|
|
5535
|
+
"multiple": true,
|
|
5536
|
+
"required": true,
|
|
5537
|
+
"types": [
|
|
5538
|
+
{
|
|
5539
|
+
"type": "variable_declarator",
|
|
5540
|
+
"named": true
|
|
5541
|
+
}
|
|
5542
|
+
]
|
|
5543
|
+
}
|
|
5544
|
+
},
|
|
5502
5545
|
{
|
|
5503
5546
|
"type": "variable_declaration",
|
|
5504
5547
|
"named": true,
|
|
@@ -5825,10 +5868,6 @@
|
|
|
5825
5868
|
"type": "?",
|
|
5826
5869
|
"named": false
|
|
5827
5870
|
},
|
|
5828
|
-
{
|
|
5829
|
-
"type": "?.",
|
|
5830
|
-
"named": false
|
|
5831
|
-
},
|
|
5832
5871
|
{
|
|
5833
5872
|
"type": "?:",
|
|
5834
5873
|
"named": false
|
|
@@ -6095,6 +6134,10 @@
|
|
|
6095
6134
|
"type": "of",
|
|
6096
6135
|
"named": false
|
|
6097
6136
|
},
|
|
6137
|
+
{
|
|
6138
|
+
"type": "optional_chain",
|
|
6139
|
+
"named": true
|
|
6140
|
+
},
|
|
6098
6141
|
{
|
|
6099
6142
|
"type": "override",
|
|
6100
6143
|
"named": false
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
"type": "type_alias_declaration",
|
|
56
56
|
"named": true
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
"type": "using_declaration",
|
|
60
|
+
"named": true
|
|
61
|
+
},
|
|
58
62
|
{
|
|
59
63
|
"type": "variable_declaration",
|
|
60
64
|
"named": true
|
|
@@ -1240,6 +1244,16 @@
|
|
|
1240
1244
|
}
|
|
1241
1245
|
]
|
|
1242
1246
|
},
|
|
1247
|
+
"optional_chain": {
|
|
1248
|
+
"multiple": false,
|
|
1249
|
+
"required": false,
|
|
1250
|
+
"types": [
|
|
1251
|
+
{
|
|
1252
|
+
"type": "optional_chain",
|
|
1253
|
+
"named": true
|
|
1254
|
+
}
|
|
1255
|
+
]
|
|
1256
|
+
},
|
|
1243
1257
|
"type_arguments": {
|
|
1244
1258
|
"multiple": false,
|
|
1245
1259
|
"required": false,
|
|
@@ -2137,9 +2151,13 @@
|
|
|
2137
2151
|
]
|
|
2138
2152
|
},
|
|
2139
2153
|
"kind": {
|
|
2140
|
-
"multiple":
|
|
2154
|
+
"multiple": true,
|
|
2141
2155
|
"required": false,
|
|
2142
2156
|
"types": [
|
|
2157
|
+
{
|
|
2158
|
+
"type": "await",
|
|
2159
|
+
"named": false
|
|
2160
|
+
},
|
|
2143
2161
|
{
|
|
2144
2162
|
"type": "const",
|
|
2145
2163
|
"named": false
|
|
@@ -2148,6 +2166,10 @@
|
|
|
2148
2166
|
"type": "let",
|
|
2149
2167
|
"named": false
|
|
2150
2168
|
},
|
|
2169
|
+
{
|
|
2170
|
+
"type": "using",
|
|
2171
|
+
"named": false
|
|
2172
|
+
},
|
|
2151
2173
|
{
|
|
2152
2174
|
"type": "var",
|
|
2153
2175
|
"named": false
|
|
@@ -2302,6 +2324,10 @@
|
|
|
2302
2324
|
"type": "sequence_expression",
|
|
2303
2325
|
"named": true
|
|
2304
2326
|
},
|
|
2327
|
+
{
|
|
2328
|
+
"type": "using_declaration",
|
|
2329
|
+
"named": true
|
|
2330
|
+
},
|
|
2305
2331
|
{
|
|
2306
2332
|
"type": "variable_declaration",
|
|
2307
2333
|
"named": true
|
|
@@ -3073,7 +3099,11 @@
|
|
|
3073
3099
|
"required": false,
|
|
3074
3100
|
"types": [
|
|
3075
3101
|
{
|
|
3076
|
-
"type": "
|
|
3102
|
+
"type": "new_expression",
|
|
3103
|
+
"named": true
|
|
3104
|
+
},
|
|
3105
|
+
{
|
|
3106
|
+
"type": "primary_expression",
|
|
3077
3107
|
"named": true
|
|
3078
3108
|
}
|
|
3079
3109
|
]
|
|
@@ -3929,11 +3959,6 @@
|
|
|
3929
3959
|
]
|
|
3930
3960
|
}
|
|
3931
3961
|
},
|
|
3932
|
-
{
|
|
3933
|
-
"type": "optional_chain",
|
|
3934
|
-
"named": true,
|
|
3935
|
-
"fields": {}
|
|
3936
|
-
},
|
|
3937
3962
|
{
|
|
3938
3963
|
"type": "optional_parameter",
|
|
3939
3964
|
"named": true,
|
|
@@ -4135,22 +4160,10 @@
|
|
|
4135
4160
|
"multiple": false,
|
|
4136
4161
|
"required": true,
|
|
4137
4162
|
"types": [
|
|
4138
|
-
{
|
|
4139
|
-
"type": "call_expression",
|
|
4140
|
-
"named": true
|
|
4141
|
-
},
|
|
4142
4163
|
{
|
|
4143
4164
|
"type": "expression",
|
|
4144
4165
|
"named": true
|
|
4145
4166
|
},
|
|
4146
|
-
{
|
|
4147
|
-
"type": "identifier",
|
|
4148
|
-
"named": true
|
|
4149
|
-
},
|
|
4150
|
-
{
|
|
4151
|
-
"type": "member_expression",
|
|
4152
|
-
"named": true
|
|
4153
|
-
},
|
|
4154
4167
|
{
|
|
4155
4168
|
"type": "sequence_expression",
|
|
4156
4169
|
"named": true
|
|
@@ -5265,6 +5278,36 @@
|
|
|
5265
5278
|
}
|
|
5266
5279
|
}
|
|
5267
5280
|
},
|
|
5281
|
+
{
|
|
5282
|
+
"type": "using_declaration",
|
|
5283
|
+
"named": true,
|
|
5284
|
+
"fields": {
|
|
5285
|
+
"kind": {
|
|
5286
|
+
"multiple": true,
|
|
5287
|
+
"required": true,
|
|
5288
|
+
"types": [
|
|
5289
|
+
{
|
|
5290
|
+
"type": "await",
|
|
5291
|
+
"named": false
|
|
5292
|
+
},
|
|
5293
|
+
{
|
|
5294
|
+
"type": "using",
|
|
5295
|
+
"named": false
|
|
5296
|
+
}
|
|
5297
|
+
]
|
|
5298
|
+
}
|
|
5299
|
+
},
|
|
5300
|
+
"children": {
|
|
5301
|
+
"multiple": true,
|
|
5302
|
+
"required": true,
|
|
5303
|
+
"types": [
|
|
5304
|
+
{
|
|
5305
|
+
"type": "variable_declarator",
|
|
5306
|
+
"named": true
|
|
5307
|
+
}
|
|
5308
|
+
]
|
|
5309
|
+
}
|
|
5310
|
+
},
|
|
5268
5311
|
{
|
|
5269
5312
|
"type": "variable_declaration",
|
|
5270
5313
|
"named": true,
|
|
@@ -5583,10 +5626,6 @@
|
|
|
5583
5626
|
"type": "?",
|
|
5584
5627
|
"named": false
|
|
5585
5628
|
},
|
|
5586
|
-
{
|
|
5587
|
-
"type": "?.",
|
|
5588
|
-
"named": false
|
|
5589
|
-
},
|
|
5590
5629
|
{
|
|
5591
5630
|
"type": "?:",
|
|
5592
5631
|
"named": false
|
|
@@ -5845,6 +5884,10 @@
|
|
|
5845
5884
|
"type": "of",
|
|
5846
5885
|
"named": false
|
|
5847
5886
|
},
|
|
5887
|
+
{
|
|
5888
|
+
"type": "optional_chain",
|
|
5889
|
+
"named": true
|
|
5890
|
+
},
|
|
5848
5891
|
{
|
|
5849
5892
|
"type": "override",
|
|
5850
5893
|
"named": false
|