@willbooster/tree-sitter-javascript 1.0.2 → 1.0.4

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/grammar.js CHANGED
@@ -23,6 +23,12 @@ module.exports = grammar({
23
23
  $.escape_sequence,
24
24
  $.regex_pattern,
25
25
  $.jsx_text,
26
+ // Zero-width tokens after an arrow function's block body that a line break (or `}` or the end of input) follows:
27
+ // such a function cannot be called, indexed, or used as an operand, so the statement ends there if it can. The
28
+ // scanner inserts the automatic semicolon right after _arrow_function_block_end, or else emits
29
+ // _arrow_function_block_continuation, since the arrow function may be, e.g., an argument.
30
+ $._arrow_function_block_end,
31
+ $._arrow_function_block_continuation,
26
32
  ],
27
33
 
28
34
  extras: ($) => [$.comment, $.html_comment, /[\s\p{Zs}\uFEFF\u2028\u2029\u2060\u200B]/u],
@@ -697,7 +703,13 @@ module.exports = grammar({
697
703
  $._call_signature
698
704
  ),
699
705
  '=>',
700
- field('body', choice($.expression, $.statement_block))
706
+ choice(
707
+ field('body', $.expression),
708
+ seq(
709
+ field('body', $.statement_block),
710
+ optional(seq($._arrow_function_block_end, optional($._arrow_function_block_continuation)))
711
+ )
712
+ )
701
713
  ),
702
714
 
703
715
  // Override
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-javascript",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "JavaScript grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -29,7 +29,7 @@
29
29
  "lint": "bun wb lint",
30
30
  "lint-fix": "bun wb lint --fix",
31
31
  "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
32
- "release": "wb release",
32
+ "release": "node script/release.mjs",
33
33
  "prestart": "bun run build-wasm",
34
34
  "start": "tree-sitter playground",
35
35
  "test": "bun wb test",
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "1.0.2",
19
+ "version": "1.0.4",
20
20
  "license": "MIT",
21
21
  "description": "JavaScript grammar for tree-sitter",
22
22
  "authors": [