Socket
Socket
Sign inDemoInstall

@lezer/javascript

Package Overview
Dependencies
3
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.15 to 1.4.16

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## 1.4.16 (2024-05-04)
### Bug fixes
Don't consume `?.` tokens when followed by a digit.
Support type arguments on non-call expressions.
## 1.4.15 (2024-04-23)

@@ -2,0 +10,0 @@

2

package.json
{
"name": "@lezer/javascript",
"version": "1.4.15",
"version": "1.4.16",
"description": "lezer-based JavaScript grammar",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs",

// This file was generated by lezer-generator. You probably shouldn't edit it.
export const
noSemi = 310,
noSemi = 312,
incdec = 1,
incdecPrefix = 2,
JSXStartTag = 3,
insertSemi = 311,
spaces = 313,
newline = 314,
LineComment = 4,
BlockComment = 5,
Script = 6,
Hashbang = 7,
ExportDeclaration = 8,
_export = 9,
Star = 10,
as = 11,
VariableName = 12,
String = 13,
Escape = 14,
from = 15,
_default = 17,
FunctionDeclaration = 18,
questionDot = 3,
JSXStartTag = 4,
insertSemi = 313,
spaces = 315,
newline = 316,
LineComment = 5,
BlockComment = 6,
Script = 7,
Hashbang = 8,
ExportDeclaration = 9,
_export = 10,
Star = 11,
as = 12,
VariableName = 13,
String = 14,
Escape = 15,
from = 16,
_default = 18,
FunctionDeclaration = 19,
async = 61,
_function = 20,
VariableDefinition = 21,
TypeParamList = 24,
TypeDefinition = 25,
_extends = 26,
_this = 28,
Number = 31,
BooleanLiteral = 32,
TemplateType = 33,
InterpolationEnd = 34,
templateType = 35,
InterpolationStart = 36,
_null = 38,
_void = 40,
_typeof = 42,
typeofMemberExpression = 43,
_function = 21,
VariableDefinition = 22,
TypeParamList = 25,
TypeDefinition = 26,
_extends = 27,
_this = 29,
Number = 32,
BooleanLiteral = 33,
TemplateType = 34,
InterpolationEnd = 35,
templateType = 36,
InterpolationStart = 37,
_null = 39,
_void = 41,
_typeof = 43,
PropertyName = 46,

@@ -53,23 +53,23 @@ TemplateString = 48,

Block = 65,
_new = 195,
TypeArgList = 70,
LessThan = 71,
ArgList = 75,
UnaryExpression = 76,
_delete = 77,
YieldExpression = 80,
_yield = 81,
AwaitExpression = 82,
_await = 83,
ParenthesizedExpression = 84,
ClassExpression = 85,
_class = 86,
ClassBody = 87,
MethodDeclaration = 88,
Decorator = 89,
PrivatePropertyName = 92,
declare = 220,
_new = 197,
ArgList = 72,
UnaryExpression = 73,
_delete = 74,
YieldExpression = 77,
_yield = 78,
AwaitExpression = 79,
_await = 80,
ParenthesizedExpression = 81,
ClassExpression = 82,
_class = 83,
ClassBody = 84,
MethodDeclaration = 85,
Decorator = 86,
PrivatePropertyName = 89,
TypeArgList = 91,
LessThan = 92,
declare = 222,
Privacy = 114,
_static = 96,
abstract = 203,
abstract = 205,
override = 98,

@@ -98,77 +98,77 @@ PrivatePropertyDefinition = 99,

AssignmentExpression = 138,
_import = 144,
JSXElement = 146,
JSXSelfCloseEndTag = 147,
JSXSelfClosingTag = 148,
JSXIdentifier = 149,
JSXLowerIdentifier = 151,
JSXNamespacedName = 152,
JSXMemberExpression = 153,
JSXAttributeValue = 156,
JSXEndTag = 158,
JSXOpenTag = 159,
JSXFragmentTag = 160,
JSXText = 161,
JSXEscape = 162,
JSXStartCloseTag = 163,
JSXCloseTag = 164,
SequenceExpression = 168,
keyof = 170,
unique = 172,
infer = 175,
TypeName = 176,
ParamTypeList = 179,
IndexedType = 181,
Label = 183,
ObjectType = 186,
MethodType = 187,
PropertyType = 188,
IndexSignature = 189,
TypePredicate = 192,
is = 193,
unionOp = 197,
intersectionOp = 199,
ClassDeclaration = 202,
_implements = 204,
type = 205,
VariableDeclaration = 206,
_let = 207,
_var = 208,
using = 209,
TypeAliasDeclaration = 210,
InterfaceDeclaration = 211,
_interface = 212,
EnumDeclaration = 213,
_enum = 214,
NamespaceDeclaration = 216,
namespace = 217,
module = 218,
AmbientDeclaration = 219,
global = 222,
ExportGroup = 226,
ImportDeclaration = 229,
ImportGroup = 230,
_for = 232,
ForSpec = 233,
ForInSpec = 234,
ForOfSpec = 235,
of = 236,
_while = 238,
_with = 240,
_do = 242,
_if = 244,
_else = 245,
_switch = 247,
_case = 250,
_try = 253,
_catch = 255,
_finally = 257,
_return = 259,
_throw = 261,
_break = 263,
_continue = 265,
_debugger = 267,
SingleExpression = 270,
SingleClassItem = 271,
_import = 145,
JSXElement = 147,
JSXSelfCloseEndTag = 148,
JSXSelfClosingTag = 149,
JSXIdentifier = 150,
JSXLowerIdentifier = 152,
JSXNamespacedName = 153,
JSXMemberExpression = 154,
JSXAttributeValue = 157,
JSXEndTag = 159,
JSXOpenTag = 160,
JSXFragmentTag = 161,
JSXText = 162,
JSXEscape = 163,
JSXStartCloseTag = 164,
JSXCloseTag = 165,
SequenceExpression = 169,
keyof = 172,
unique = 174,
infer = 177,
TypeName = 178,
ParamTypeList = 181,
IndexedType = 183,
Label = 185,
ObjectType = 188,
MethodType = 189,
PropertyType = 190,
IndexSignature = 191,
TypePredicate = 194,
is = 195,
unionOp = 199,
intersectionOp = 201,
ClassDeclaration = 204,
_implements = 206,
type = 207,
VariableDeclaration = 208,
_let = 209,
_var = 210,
using = 211,
TypeAliasDeclaration = 212,
InterfaceDeclaration = 213,
_interface = 214,
EnumDeclaration = 215,
_enum = 216,
NamespaceDeclaration = 218,
namespace = 219,
module = 220,
AmbientDeclaration = 221,
global = 224,
ExportGroup = 228,
ImportDeclaration = 231,
ImportGroup = 232,
_for = 234,
ForSpec = 235,
ForInSpec = 236,
ForOfSpec = 237,
of = 238,
_while = 240,
_with = 242,
_do = 244,
_if = 246,
_else = 247,
_switch = 249,
_case = 252,
_try = 255,
_catch = 257,
_finally = 259,
_return = 261,
_throw = 263,
_break = 265,
_continue = 267,
_debugger = 269,
SingleExpression = 272,
SingleClassItem = 273,
Dialect_jsx = 0,
Dialect_ts = 1

@@ -5,3 +5,3 @@ /* Hand-written tokenizers for JavaScript tokens that can't be

import {ExternalTokenizer, ContextTracker} from "@lezer/lr"
import {insertSemi, noSemi, incdec, incdecPrefix,
import {insertSemi, noSemi, incdec, incdecPrefix, questionDot,
spaces, newline, BlockComment, LineComment,

@@ -13,3 +13,4 @@ JSXStartTag, Dialect_jsx} from "./parser.terms.js"

const braceR = 125, semicolon = 59, slash = 47, star = 42, plus = 43, minus = 45, lt = 60, comma = 44
const braceR = 125, semicolon = 59, slash = 47, star = 42, plus = 43, minus = 45, lt = 60, comma = 44,
question = 63, dot = 46

@@ -38,3 +39,3 @@ export const trackNewline = new ContextTracker({

export const incdecToken = new ExternalTokenizer((input, stack) => {
export const operatorToken = new ExternalTokenizer((input, stack) => {
let {next} = input

@@ -48,2 +49,6 @@ if (next == plus || next == minus) {

}
} else if (next == question && input.peek(1) == dot) {
input.advance(); input.advance()
if (input.next < 48 || input.next > 57) // No digit after
input.acceptToken(questionDot)
}

@@ -50,0 +55,0 @@ }, {contextual: true})

@@ -679,1 +679,9 @@ # Minimal

Script(ExpressionStatement(TemplateString(⚠)))
# Ternary with leading-dot number
a?.2:.3
==>
Script(ExpressionStatement(ConditionalExpression(VariableName,LogicOp,Number,LogicOp,Number)))

@@ -79,5 +79,5 @@ # Undefined and Null Type {"dialect": "ts"}

ExpressionStatement(BinaryExpression(
CallExpression(VariableName, TypeArgList(TypeName, TypeName), ArgList),
CallExpression(InstantiationExpression(VariableName, TypeArgList(TypeName, TypeName)), ArgList),
ArithOp,
NewExpression(new, VariableName, TypeArgList(LiteralType(Number)), ArgList))),
NewExpression(new, InstantiationExpression(VariableName, TypeArgList(LiteralType(Number))), ArgList))),
ExpressionStatement(BinaryExpression(BinaryExpression(VariableName, CompareOp, Number), CompareOp, Number)))

@@ -313,3 +313,3 @@

VariableDeclaration(let,VariableDefinition,Equals,
CallExpression(VariableName,TypeArgList(TypeName),ArgList(Number))),
CallExpression(InstantiationExpression(VariableName,TypeArgList(TypeName)),ArgList(Number))),
ReturnStatement(return,Number))

@@ -340,1 +340,24 @@

VoidType(void))))
# Instantiated expression {"dialect": "ts"}
let x = a<b>;
type Foo = Bar<typeof baz<Bug<Quux>>>;
==>
Script(
VariableDeclaration(let,VariableDefinition,Equals,InstantiationExpression(VariableName,TypeArgList(TypeName))),
TypeAliasDeclaration(type,TypeDefinition,Equals,ParameterizedType(TypeName,TypeArgList(
TypeofType(typeof,InstantiationExpression(VariableName,TypeArgList(
ParameterizedType(TypeName,TypeArgList(TypeName)))))))))
# Not instantiated {"dialect": "ts"}
let x = a<b>c
==>
Script(VariableDeclaration(let,VariableDefinition,Equals,BinaryExpression(
BinaryExpression(VariableName,CompareOp,VariableName),CompareOp,VariableName)))

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc