Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-sitter-javascript

Package Overview
Dependencies
Maintainers
5
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-sitter-javascript - npm Package Compare versions

Comparing version 0.4.5 to 0.4.6

22

corpus/expressions.txt

@@ -366,2 +366,24 @@ ============================================

============================================
Class Decorators
============================================
@reload
@eval
class Foo {
@foo.bar(baz) static foo() {
}
}
---
(program
(class
(decorator (identifier))
(decorator (identifier))
(identifier)
(class_body
(decorator (call_expression (member_expression (identifier) (property_identifier)) (arguments (identifier))))
(method_definition (property_identifier) (formal_parameters) (statement_block)))))
============================================
Arrays

@@ -368,0 +390,0 @@ ============================================

@@ -104,2 +104,14 @@ ============================================

============================================
Decorators before exports
============================================
@injectable()
export class Foo {
}
---
(program (export_statement (decorator (call_expression (identifier) (arguments))) (class (identifier) (class_body))))
============================================
If statements

@@ -106,0 +118,0 @@ ============================================

34

grammar.js

@@ -64,4 +64,4 @@ const PREC = {

seq('export', $.export_clause, $._semicolon),
seq('export', $._declaration),
seq('export', 'default', $._expression, $._semicolon)
seq(repeat($.decorator), 'export', $._declaration),
seq(repeat($.decorator), 'export', 'default', $._expression, $._semicolon)
),

@@ -412,3 +412,3 @@

$.spread_element,
$.method_definition,
seq(repeat($.decorator), $.method_definition),
$.assignment_pattern,

@@ -488,2 +488,3 @@ alias(choice($.identifier, $._reserved_identifier), $.shorthand_property_identifier)

anonymous_class: $ => seq(
repeat($.decorator),
'class',

@@ -495,2 +496,3 @@ optional($.class_heritage),

class: $ => seq(
repeat($.decorator),
'class',

@@ -767,5 +769,31 @@ $.identifier,

decorator: $ => seq(
'@',
choice(
$._identifier_reference,
alias($.decorator_member_expression, $.member_expression),
alias($.decorator_call_expression, $.call_expression))
),
_identifier_reference: $ => choice(
$.identifier,
alias($._reserved_identifier, $.identifier)
),
decorator_member_expression: $ => prec(PREC.MEMBER, seq(
seq(
choice($._identifier_reference, alias($.decorator_member_expression, $.member_expression)),
'.',
alias($.identifier, $.property_identifier))
)),
decorator_call_expression: $ => prec(PREC.CALL, seq(
choice($._identifier_reference, alias($.decorator_member_expression, $.member_expression)),
$.arguments
)),
class_body: $ => seq(
'{',
repeat(seq(
repeat($.decorator),
optional('static'),

@@ -772,0 +800,0 @@ choice(

2

package.json
{
"name": "tree-sitter-javascript",
"version": "0.4.5",
"version": "0.4.6",
"description": "Javascript grammar for node-tree-sitter",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc