@willbooster/tree-sitter-typescript 1.2.8 → 1.2.9

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 CHANGED
@@ -105,7 +105,7 @@ cargo test
105
105
  `script/tree-sitter` (also `bun run tree-sitter`) runs the tree-sitter CLI of WillBooster/tree-sitter at the runtime
106
106
  version locked in `Cargo.lock`, so the parsers are generated, built, tested, and fuzzed with the generator and the
107
107
  runtime this package ships. The first run downloads that CLI from its GitHub Release into `.tmp/`, or builds it with
108
- `cargo` (which needs `cmake`) when the download fails or the release has no binary that runs here.
108
+ `cargo` (with the `cmake` that `mise.toml` pins) when the download fails or the release has no binary that runs here.
109
109
 
110
110
  `bun run test/ci-setup` installs Chromium for the browser tests. `bun run build/ci` regenerates `typescript/src/` and
111
111
  `tsx/src/` and builds both Wasm files. `bun run test` runs:
@@ -248,13 +248,7 @@ module.exports = function defineGrammar(dialect) {
248
248
  )
249
249
  )
250
250
  ),
251
- prec(
252
- 'template_call',
253
- seq(
254
- field('function', choice($.primary_expression, alias($._argumentless_new_expression, $.new_expression))),
255
- field('arguments', $.template_string)
256
- )
257
- ),
251
+ prec('template_call', seq(field('function', $.primary_expression), field('arguments', $.template_string))),
258
252
  prec(
259
253
  'member',
260
254
  seq(
@@ -266,15 +260,14 @@ module.exports = function defineGrammar(dialect) {
266
260
  )
267
261
  ),
268
262
 
269
- // As in ECMAScript, a `new` with arguments is a member-level (primary) expression and one without them is not, so a
270
- // member access, a call, or a further argument list binds to the nearest `new` with arguments: `new new A().b`
271
- // constructs `new A().b`, and `new new A()(2)` constructs `new A()`.
263
+ // tree-sitter-javascript's two forms of `new`, with type arguments; its 'member' and 'new' precedences group nested
264
+ // `new` as ECMAScript does (`new new A().b` constructs `new A().b`), and both forms are primary expressions.
272
265
  new_expression: ($) =>
273
266
  prec(
274
267
  'new',
275
268
  seq(
276
269
  'new',
277
- field('constructor', $._new_constructor),
270
+ field('constructor', $.primary_expression),
278
271
  field('type_arguments', optional($.type_arguments)),
279
272
  field('arguments', $.arguments)
280
273
  )
@@ -283,12 +276,9 @@ module.exports = function defineGrammar(dialect) {
283
276
  _argumentless_new_expression: ($) =>
284
277
  prec.right(
285
278
  'new',
286
- seq('new', field('constructor', $._new_constructor), field('type_arguments', optional($.type_arguments)))
279
+ seq('new', field('constructor', $.primary_expression), field('type_arguments', optional($.type_arguments)))
287
280
  ),
288
281
 
289
- _new_constructor: ($) =>
290
- prec('new', choice($.primary_expression, alias($._argumentless_new_expression, $.new_expression))),
291
-
292
282
  assignment_expression: ($) =>
293
283
  prec.right(
294
284
  'assign',
@@ -299,20 +289,13 @@ module.exports = function defineGrammar(dialect) {
299
289
 
300
290
  _lhs_expression: ($, previous) => choice(previous, $.non_null_expression),
301
291
 
302
- primary_expression: ($, previous) => choice(previous, $.non_null_expression, $.new_expression),
292
+ primary_expression: ($, previous) => choice(previous, $.non_null_expression),
303
293
 
304
294
  // If the dialect is regular typescript, we exclude JSX expressions and
305
295
  // include type assertions. If the dialect is TSX, we do the opposite.
306
296
  expression: ($, previous) => {
307
- const choices = [
308
- $.as_expression,
309
- $.satisfies_expression,
310
- $.instantiation_expression,
311
- $.internal_module,
312
- alias($._argumentless_new_expression, $.new_expression),
313
- ];
314
- // A `new` with arguments is a primary expression (see new_expression).
315
- const members = previous.members.filter((member) => member.name !== 'new_expression');
297
+ const choices = [$.as_expression, $.satisfies_expression, $.instantiation_expression, $.internal_module];
298
+ const members = previous.members;
316
299
 
317
300
  if (dialect === 'typescript') {
318
301
  choices.push($.type_assertion);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-typescript",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "TypeScript and TSX grammars for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -51,9 +51,9 @@
51
51
  "@vitest/browser-playwright": "5.0.1",
52
52
  "@willbooster/oxfmt-config": "1.2.2",
53
53
  "@willbooster/oxlint-config": "1.4.8",
54
- "@willbooster/tree-sitter-javascript": "1.0.16",
54
+ "@willbooster/tree-sitter-javascript": "1.0.20",
55
55
  "@willbooster/wb": "22.13.1",
56
- "@willbooster/web-tree-sitter": "1.0.15",
56
+ "@willbooster/web-tree-sitter": "1.0.17",
57
57
  "conventional-changelog-conventionalcommits": "10.4.0",
58
58
  "lefthook": "2.1.14",
59
59
  "oxfmt": "0.70.0",
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -83,7 +83,7 @@
83
83
  }
84
84
  ],
85
85
  "metadata": {
86
- "version": "1.2.8",
86
+ "version": "1.2.9",
87
87
  "license": "MIT",
88
88
  "description": "TypeScript and TSX grammars for tree-sitter",
89
89
  "authors": [
@@ -105,10 +105,6 @@
105
105
  "type": "jsx_self_closing_element",
106
106
  "named": true
107
107
  },
108
- {
109
- "type": "new_expression",
110
- "named": true
111
- },
112
108
  {
113
109
  "type": "primary_expression",
114
110
  "named": true
@@ -97,10 +97,6 @@
97
97
  "type": "internal_module",
98
98
  "named": true
99
99
  },
100
- {
101
- "type": "new_expression",
102
- "named": true
103
- },
104
100
  {
105
101
  "type": "primary_expression",
106
102
  "named": true