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

meriyah

Package Overview
Dependencies
Maintainers
1
Versions
918
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meriyah - npm Package Compare versions

Comparing version 1.3.5-dev.20190718 to 1.3.5-dev.20190719

15

dist/common.d.ts

@@ -27,3 +27,3 @@ import { Token } from './token';

InAwaitContext = 4194304,
InArgList = 8388608,
InArgumentList = 8388608,
InConstructor = 16777216,

@@ -54,5 +54,6 @@ InMethod = 33554432,

}
export declare const enum BindingType {
export declare const enum BindingKind {
None = 0,
ArgList = 1,
ArgumentList = 1,
EmptyBinding = 2,
Variable = 4,

@@ -68,3 +69,7 @@ Let = 8,

Statement = 8,
Export = 16
Export = 16,
Other = 32,
IfStatement = 64,
BlockStatement = 512,
TopLevel = 1024
}

@@ -139,3 +144,3 @@ export declare const enum AssignmentKind {

export declare function reinterpretToPattern(state: ParserState, node: any): void;
export declare function validateBindingIdentifier(parser: ParserState, context: Context, type: BindingType, t: Token, skipEvalArgCheck: 0 | 1): void;
export declare function validateBindingIdentifier(parser: ParserState, context: Context, type: BindingKind, t: Token, skipEvalArgCheck: 0 | 1): void;
export declare function isStrictReservedWord(parser: ParserState, context: Context, t: Token): boolean;

@@ -142,0 +147,0 @@ export declare function isPropertyWithPrivateFieldKey(expr: any): boolean;

import { Token } from './token';
import * as ESTree from './estree';
import { ScopeState } from './scope';
import { Context, ParserState, PropertyKind, BindingOrigin, Flags, FunctionStatement, BindingType, HoistedClassFlags, HoistedFunctionFlags } from './common';
import { Context, ParserState, PropertyKind, BindingOrigin, Flags, FunctionStatement, BindingKind, HoistedClassFlags, HoistedFunctionFlags } from './common';
export declare function create(source: string, sourceFile: string | void): ParserState;

@@ -27,10 +27,10 @@ export interface Options {

export declare function parseModuleItem(parser: ParserState, context: Context, scope: ScopeState, start: number, line: number, column: number): any;
export declare function parseStatementListItem(parser: ParserState, context: Context, scope: ScopeState, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.Statement | ESTree.Decorator[];
export declare function parseStatement(parser: ParserState, context: Context, scope: ScopeState, labels: ESTree.Labels, allowFuncDecl: FunctionStatement, start: number, line: number, column: number): ESTree.Statement;
export declare function parseExpressionOrLabelledStatement(parser: ParserState, context: Context, scope: ScopeState, labels: ESTree.Labels, allowFuncDecl: FunctionStatement, start: number, line: number, column: number): ESTree.ExpressionStatement | ESTree.LabeledStatement;
export declare function parseStatementListItem(parser: ParserState, context: Context, scope: ScopeState, origin: BindingOrigin, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.Statement | ESTree.Decorator[];
export declare function parseStatement(parser: ParserState, context: Context, scope: ScopeState, origin: BindingOrigin, labels: ESTree.Labels, allowFuncDecl: FunctionStatement, start: number, line: number, column: number): ESTree.Statement;
export declare function parseExpressionOrLabelledStatement(parser: ParserState, context: Context, scope: ScopeState, origin: BindingOrigin, labels: ESTree.Labels, allowFuncDecl: FunctionStatement, start: number, line: number, column: number): ESTree.ExpressionStatement | ESTree.LabeledStatement;
export declare function parseBlock(parser: ParserState, context: Context, scope: ESTree.Scope, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.BlockStatement;
export declare function parseReturnStatement(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.ReturnStatement;
export declare function parseExpressionStatement(parser: ParserState, context: Context, expression: ESTree.Expression, start: number, line: number, column: number): ESTree.ExpressionStatement;
export declare function parseLabelledStatement(parser: ParserState, context: Context, scope: ScopeState, labels: ESTree.Labels, label: string, expr: ESTree.Identifier, token: Token, allowFuncDecl: 0 | 1, start: number, line: number, column: number): ESTree.LabeledStatement;
export declare function parseAsyncArrowOrAsyncFunctionDeclaration(parser: ParserState, context: Context, scope: ScopeState, labels: ESTree.Labels, allowFuncDecl: FunctionStatement, start: number, line: number, column: number): ESTree.ExpressionStatement | ESTree.LabeledStatement | ESTree.FunctionDeclaration;
export declare function parseLabelledStatement(parser: ParserState, context: Context, scope: ScopeState, origin: BindingOrigin, labels: ESTree.Labels, label: string, expr: ESTree.Identifier, token: Token, allowFuncDecl: 0 | 1, start: number, line: number, column: number): ESTree.LabeledStatement;
export declare function parseAsyncArrowOrAsyncFunctionDeclaration(parser: ParserState, context: Context, scope: ScopeState, origin: BindingOrigin, labels: ESTree.Labels, allowFuncDecl: FunctionStatement, start: number, line: number, column: number): ESTree.ExpressionStatement | ESTree.LabeledStatement | ESTree.FunctionDeclaration;
export declare function parseDirective(parser: ParserState, context: Context, expression: ESTree.ArgumentExpression | ESTree.SequenceExpression, token: Token, start: number, line: number, column: number): ESTree.ExpressionStatement;

@@ -51,5 +51,5 @@ export declare function parseEmptyStatement(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.EmptyStatement;

export declare function parseDoWhileStatement(parser: ParserState, context: Context, scope: ScopeState, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.DoWhileStatement;
export declare function parseLetIdentOrVarDeclarationStatement(parser: ParserState, context: Context, scope: ScopeState, start: number, line: number, column: number): ESTree.VariableDeclaration | ESTree.LabeledStatement | ESTree.ExpressionStatement;
export declare function parseLetIdentOrVarDeclarationStatement(parser: ParserState, context: Context, scope: ScopeState, origin: BindingOrigin, start: number, line: number, column: number): ESTree.VariableDeclaration | ESTree.LabeledStatement | ESTree.ExpressionStatement;
export declare function parseVariableStatement(parser: ParserState, context: Context, scope: ScopeState, origin: BindingOrigin, start: number, line: number, column: number): ESTree.VariableDeclaration;
export declare function parseVariableDeclarationList(parser: ParserState, context: Context, scope: ScopeState, verifyDuplicates: 0 | 1, type: BindingType, origin: BindingOrigin): ESTree.VariableDeclarator[];
export declare function parseVariableDeclarationList(parser: ParserState, context: Context, scope: ScopeState, verifyDuplicates: 0 | 1, type: BindingKind, origin: BindingOrigin): ESTree.VariableDeclarator[];
export declare function parseForStatement(parser: ParserState, context: Context, scope: ScopeState, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.ForStatement | ESTree.ForInStatement | ESTree.ForOfStatement;

@@ -69,3 +69,3 @@ export declare function parseExpression(parser: ParserState, context: Context, allowAssign: 0 | 1, identifierPattern: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.Expression;

export declare function parseMemberOrUpdateExpression(parser: ParserState, context: Context, expr: ESTree.Expression, inNewExpression: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): any;
export declare function parsePrimaryExpressionExtended(parser: ParserState, context: Context, type: BindingType, inNewExpression: 0 | 1, allowAssign: 0 | 1, identifierPattern: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): any;
export declare function parsePrimaryExpressionExtended(parser: ParserState, context: Context, type: BindingKind, inNewExpression: 0 | 1, allowAssign: 0 | 1, identifierPattern: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): any;
export declare function parseImportExpression(parser: ParserState, context: Context, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.ImportExpression;

@@ -82,8 +82,8 @@ export declare function parseBigIntLiteral(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.BigIntLiteral;

export declare function parseThisExpression(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.ThisExpression;
export declare function parseFunctionDeclaration(parser: ParserState, context: Context, scope: ScopeState, allowGen: 0 | 1, flags: HoistedFunctionFlags, isAsync: 0 | 1, start: number, line: number, column: number): ESTree.FunctionDeclaration;
export declare function parseFunctionDeclaration(parser: ParserState, context: Context, scope: ScopeState, _origin: BindingOrigin, allowGen: 0 | 1, flags: HoistedFunctionFlags, isAsync: 0 | 1, start: number, line: number, column: number): ESTree.FunctionDeclaration;
export declare function parseFunctionExpression(parser: ParserState, context: Context, isAsync: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.FunctionExpression;
export declare function parseArrayExpressionOrPattern(parser: ParserState, context: Context, scope: ESTree.Scope, skipInitializer: 0 | 1, inGroup: 0 | 1, type: BindingType, origin: BindingOrigin, start: number, line: number, column: number): ESTree.ArrayExpression | ESTree.ArrayPattern | ESTree.AssignmentExpression;
export declare function parseArrayExpressionOrPattern(parser: ParserState, context: Context, scope: ESTree.Scope, skipInitializer: 0 | 1, inGroup: 0 | 1, type: BindingKind, origin: BindingOrigin, start: number, line: number, column: number): ESTree.ArrayExpression | ESTree.ArrayPattern | ESTree.AssignmentExpression;
export declare function parseMethodDefinition(parser: ParserState, context: Context, kind: PropertyKind, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.FunctionExpression;
export declare function parseObjectLiteralOrPattern(parser: ParserState, context: Context, scope: ESTree.Scope, skipInitializer: 0 | 1, inGroup: 0 | 1, type: BindingType, origin: BindingOrigin, start: number, line: number, column: number): ESTree.ObjectExpression | ESTree.ObjectPattern | ESTree.AssignmentExpression;
export declare function parseMethodFormals(parser: ParserState, context: Context, scope: ESTree.Scope, kind: PropertyKind, type: BindingType, inGroup: 0 | 1): any[];
export declare function parseObjectLiteralOrPattern(parser: ParserState, context: Context, scope: ESTree.Scope, skipInitializer: 0 | 1, inGroup: 0 | 1, type: BindingKind, origin: BindingOrigin, start: number, line: number, column: number): ESTree.ObjectExpression | ESTree.ObjectPattern | ESTree.AssignmentExpression;
export declare function parseMethodFormals(parser: ParserState, context: Context, scope: ESTree.Scope, kind: PropertyKind, type: BindingKind, inGroup: 0 | 1): any[];
export declare function parseComputedPropertyName(parser: ParserState, context: Context, inGroup: 0 | 1): ESTree.Expression;

@@ -93,3 +93,3 @@ export declare function parseParenthesizedExpression(parser: ParserState, context: Context, assignable: 0 | 1, start: number, line: number, column: number): any;

export declare function parseArrowFunctionExpression(parser: ParserState, context: Context, scope: ESTree.Scope, params: any, isAsync: 0 | 1, start: number, line: number, column: number): ESTree.ArrowFunctionExpression;
export declare function parseFormalParametersOrFormalList(parser: ParserState, context: Context, scope: ESTree.Scope, inGroup: 0 | 1, type: BindingType): any[];
export declare function parseFormalParametersOrFormalList(parser: ParserState, context: Context, scope: ESTree.Scope, inGroup: 0 | 1, type: BindingKind): any[];
export declare function parseNewExpression(parser: ParserState, context: Context, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.NewExpression | ESTree.Expression | ESTree.MetaProperty;

@@ -104,5 +104,5 @@ export declare function parseMetaProperty(parser: ParserState, context: Context, meta: ESTree.Identifier, start: number, line: number, column: number): ESTree.MetaProperty;

export declare function parseDecoratorList(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.Decorator;
export declare function parseClassBody(parser: ParserState, context: Context, inheritedContext: Context, scope: ESTree.Scope, type: BindingType, origin: BindingOrigin, inGroup: 0 | 1): ESTree.ClassBody;
export declare function parseClassBody(parser: ParserState, context: Context, inheritedContext: Context, scope: ESTree.Scope, type: BindingKind, origin: BindingOrigin, inGroup: 0 | 1): ESTree.ClassBody;
export declare function parseFieldDefinition(parser: ParserState, context: Context, key: ESTree.PrivateName | ESTree.Expression | null, state: PropertyKind, decorators: ESTree.Decorator[] | null, start: number, line: number, column: number): ESTree.FieldDefinition;
export declare function parseBindingPattern(parser: ParserState, context: Context, scope: ESTree.Scope, dupeChecks: 0 | 1, type: BindingType, origin: BindingOrigin, start: number, line: number, column: number): ESTree.BindingPattern;
export declare function parseBindingPattern(parser: ParserState, context: Context, scope: ESTree.Scope, dupeChecks: 0 | 1, type: BindingKind, origin: BindingOrigin, start: number, line: number, column: number): ESTree.BindingPattern;
export declare function parseOpeningFragment(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.JSXOpeningFragment;

@@ -109,0 +109,0 @@ export declare function parseJSXClosingFragment(parser: ParserState, context: Context, isJSXChild: 0 | 1, start: number, line: number, column: number): ESTree.JSXClosingFragment;

@@ -1,2 +0,2 @@

import { Context, ParserState, BindingType } from './common';
import { Context, ParserState, BindingKind } from './common';
export declare const enum ScopeType {

@@ -8,3 +8,3 @@ None = 0,

Switch = 8,
ArgList = 16
ArgumentList = 16
}

@@ -23,6 +23,6 @@ export declare const enum ScopeMasks {

export declare function inheritScope(scope: any, type: ScopeType): ScopeState;
export declare function declareName(parser: ParserState, context: Context, scope: any, name: string, bindingType: BindingType, dupeChecks: 0 | 1, isVarDecl: 0 | 1): void;
export declare function declareAndDedupe(parser: ParserState, context: Context, scope: any, name: string, type: BindingType, isVarDecl: 0 | 1): void;
export declare function declareUnboundVariable(parser: ParserState, context: Context, scope: any, name: string, type: BindingType): void;
export declare function addFunctionName(parser: ParserState, context: Context, scope: any, name: string, type: BindingType, isVarDecl: 0 | 1): void;
export declare function declareName(parser: ParserState, context: Context, scope: any, name: string, bindingType: BindingKind, dupeChecks: 0 | 1, isVarDecl: 0 | 1): void;
export declare function declareAndDedupe(parser: ParserState, context: Context, scope: any, name: string, type: BindingKind, isVarDecl: 0 | 1): void;
export declare function declareUnboundVariable(parser: ParserState, context: Context, scope: any, name: string, type: BindingKind): void;
export declare function addFunctionName(parser: ParserState, context: Context, scope: any, name: string, type: BindingKind, isVarDecl: 0 | 1): void;
export declare function checkConflictingLexicalDeclarations(parser: ParserState, context: Context, scope: any, checkParent: 0 | 1): boolean;

@@ -29,0 +29,0 @@ export declare function verifyArguments(parser: ParserState, lex: any): void;

{
"name": "meriyah",
"version": "1.3.5-dev.20190718",
"version": "1.3.5-dev.20190719",
"description": "A 100% compliant, self-hosted javascript parser with high focus on both performance and stability",

@@ -5,0 +5,0 @@ "main": "dist/meriyah.umd.js",

@@ -33,3 +33,3 @@ import { Token, KeywordDescTable } from './token';

InAwaitContext = 1 << 22,
InArgList = 1 << 23,
InArgumentList = 1 << 23,
InConstructor = 1 << 24,

@@ -62,8 +62,9 @@ InMethod = 1 << 25,

export const enum BindingType {
export const enum BindingKind {
None = 0,
ArgList = 1 << 0,
ArgumentList = 1 << 0,
EmptyBinding = 1 << 1,
Variable = 1 << 2,
Let = 1 << 3,
Const = 1 << 4
Const = 1 << 4,
}

@@ -77,3 +78,7 @@

Statement = 1 << 3,
Export = 1 << 4
Export = 1 << 4,
Other = 1 << 5,
IfStatement = 1 << 6,
BlockStatement = 1 << 9,
TopLevel = 1 << 10
}

@@ -268,3 +273,3 @@

context: Context,
type: BindingType,
type: BindingKind,
t: Token,

@@ -297,3 +302,3 @@ skipEvalArgCheck: 0 | 1

if (type & (BindingType.Let | BindingType.Const) && t === Token.LetKeyword) {
if (type & (BindingKind.Let | BindingKind.Const) && t === Token.LetKeyword) {
report(parser, Errors.InvalidLetConstBinding);

@@ -300,0 +305,0 @@ }

@@ -376,5 +376,5 @@ import { CharTypes, CharFlags } from './charClassifier';

case Token.LessThan:
const next = nextCP(parser);
let ch = nextCP(parser);
if (parser.index < parser.end) {
if (next === Chars.LessThan) {
if (ch === Chars.LessThan) {
if (parser.index < parser.end && nextCP(parser) === Chars.EqualSign) {

@@ -386,11 +386,11 @@ nextCP(parser);

}
} else if (next === Chars.EqualSign) {
} else if (ch === Chars.EqualSign) {
nextCP(parser);
return Token.LessThanOrEqual;
} else if (next === Chars.Exclamation) {
} else if (ch === Chars.Exclamation) {
// Treat HTML begin-comment as comment-till-end-of-line.
if (
(context & Context.Module) === 0 &&
parser.source.charCodeAt(parser.index + 1) === Chars.Hyphen &&
parser.source.charCodeAt(parser.index + 2) === Chars.Hyphen
parser.source.charCodeAt(parser.index + 2) === Chars.Hyphen &&
parser.source.charCodeAt(parser.index + 1) === Chars.Hyphen
) {

@@ -400,3 +400,3 @@ state = skipSingleLineComment(parser, state);

}
} else if (next === Chars.Slash) {
} else if (ch === Chars.Slash) {
if (!(context & Context.OptionsJSX)) break;

@@ -407,4 +407,4 @@ const index = parser.index + 1;

if (index < parser.end) {
const next = parser.source.charCodeAt(index);
if (next === Chars.Asterisk || next === Chars.Slash) break;
ch = parser.source.charCodeAt(index);
if (ch === Chars.Asterisk || ch === Chars.Slash) break;
}

@@ -421,5 +421,5 @@

if (parser.index >= parser.end) return Token.Assign;
const next = parser.nextCP;
const ch = parser.nextCP;
if (next === Chars.EqualSign) {
if (ch === Chars.EqualSign) {
if (nextCP(parser) === Chars.EqualSign) {

@@ -431,3 +431,3 @@ nextCP(parser);

}
} else if (next === Chars.GreaterThan) {
} else if (ch === Chars.GreaterThan) {
nextCP(parser);

@@ -463,5 +463,5 @@ return Token.Arrow;

const next = parser.nextCP;
const ch = parser.nextCP;
if (next === Chars.EqualSign) {
if (ch === Chars.EqualSign) {
nextCP(parser);

@@ -471,3 +471,3 @@ return Token.GreaterThanOrEqual;

if (next !== Chars.GreaterThan) return Token.GreaterThan;
if (ch !== Chars.GreaterThan) return Token.GreaterThan;

@@ -477,5 +477,5 @@ nextCP(parser);

if (parser.index < parser.end) {
const next = parser.nextCP;
const ch = parser.nextCP;
if (next === Chars.GreaterThan) {
if (ch === Chars.GreaterThan) {
if (nextCP(parser) === Chars.EqualSign) {

@@ -487,3 +487,3 @@ nextCP(parser);

}
} else if (next === Chars.EqualSign) {
} else if (ch === Chars.EqualSign) {
nextCP(parser);

@@ -501,5 +501,5 @@ return Token.ShiftRightAssign;

if (parser.index >= parser.end) return Token.BitwiseAnd;
const next = parser.nextCP;
const ch = parser.nextCP;
if (next === Chars.Ampersand) {
if (ch === Chars.Ampersand) {
nextCP(parser);

@@ -509,3 +509,3 @@ return Token.LogicalAnd;

if (next === Chars.EqualSign) {
if (ch === Chars.EqualSign) {
nextCP(parser);

@@ -512,0 +512,0 @@ return Token.BitwiseAndAssign;

import { report, Errors } from './errors';
import { Context, ParserState, BindingType } from './common';
import { Context, ParserState, BindingKind } from './common';

@@ -13,3 +13,3 @@ /**

Switch = 1 << 3,
ArgList = 1 << 4
ArgumentList = 1 << 4
}

@@ -77,3 +77,3 @@ /**

name: string,
bindingType: BindingType,
bindingType: BindingKind,
dupeChecks: 0 | 1,

@@ -86,3 +86,3 @@ isVarDecl: 0 | 1

if (bindingType & BindingType.Variable) {
if (bindingType & BindingKind.Variable) {
let lex = scope.lexicals;

@@ -99,3 +99,3 @@

} else if (
(lex.type & ScopeType.ArgList) === 0 &&
(lex.type & ScopeType.ArgumentList) === 0 &&
((context & Context.OptionsWebCompat) === 0 ||

@@ -126,3 +126,3 @@ (scope.lexicals.funcs[hashed] & ScopeMasks.Undeclared) === 0 ||

if (lexParent && lexParent.type & (ScopeType.ArgList | ScopeType.Catch) && lexParent[hashed]) {
if (lexParent && lexParent.type & (ScopeType.ArgumentList | ScopeType.Catch) && lexParent[hashed]) {
report(parser, Errors.DuplicateBinding, name);

@@ -168,3 +168,3 @@ } else if (scope.lexicalVariables[hashed]) {

name: string,
type: BindingType,
type: BindingKind,
isVarDecl: 0 | 1

@@ -181,3 +181,3 @@ ): void {

name: string,
type: BindingType
type: BindingKind
): void {

@@ -199,3 +199,3 @@ declareName(parser, context, scope, name, type, 1, 0);

name: string,
type: BindingType,
type: BindingKind,
isVarDecl: 0 | 1

@@ -229,3 +229,3 @@ ): void {

scope.lexicals['$'] &&
scope.lexicals['$'].type & (ScopeType.ArgList | ScopeType.Catch) &&
scope.lexicals['$'].type & (ScopeType.ArgumentList | ScopeType.Catch) &&
scope.lexicals['$'][key]

@@ -232,0 +232,0 @@ ) {

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 too big to display

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

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

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

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

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

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

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

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

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

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 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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc