meriyah 6.1.0 → 6.1.2

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.
@@ -1,7 +1,7 @@
1
1
  import { Token } from './token';
2
2
  import type * as ESTree from './estree';
3
- import { Context, type ParserState, PropertyKind, Origin, Flags, type OnComment, type OnInsertedSemicolon, type OnToken, BindingKind, HoistedClassFlags, HoistedFunctionFlags, type ScopeState, type PrivateScopeState } from './common';
4
- export declare function create(source: string, sourceFile: string | void, onComment: OnComment | void, onToken: OnToken | void, onInsertedSemicolon: OnInsertedSemicolon | void): ParserState;
3
+ import { Context, PropertyKind, Origin, Flags, type OnComment, type OnInsertedSemicolon, type OnToken, BindingKind, HoistedClassFlags, HoistedFunctionFlags, type ScopeState, type PrivateScopeState, type Location } from './common';
4
+ import { Parser } from './parser/parser';
5
5
  export interface Options {
6
6
  module?: boolean;
7
7
  next?: boolean;
@@ -15,105 +15,105 @@ export interface Options {
15
15
  lexical?: boolean;
16
16
  source?: string;
17
17
  jsx?: boolean;
18
- onComment?: Comment[] | OnComment;
18
+ onComment?: ESTree.Comment[] | OnComment;
19
19
  onInsertedSemicolon?: OnInsertedSemicolon;
20
20
  onToken?: Token[] | OnToken;
21
21
  uniqueKeyInPattern?: boolean;
22
22
  }
23
23
  export declare function parseSource(source: string, options: Options | void, context: Context): ESTree.Program;
24
- export declare function parseStatementList(parser: ParserState, context: Context, scope: ScopeState | undefined): ESTree.Statement[];
25
- export declare function parseModuleItemList(parser: ParserState, context: Context, scope: ScopeState | undefined): ReturnType<typeof parseDirective | typeof parseModuleItem>[];
26
- export declare function parseModuleItem(parser: ParserState, context: Context, scope: ScopeState | undefined): any;
27
- export declare function parseStatementListItem(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels): ESTree.Statement | ESTree.Decorator[];
28
- export declare function parseStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, allowFuncDecl: 0 | 1, start: number, line: number, column: number): ESTree.Statement;
29
- export declare function parseExpressionOrLabelledStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, allowFuncDecl: 0 | 1, start: number, line: number, column: number): ESTree.ExpressionStatement | ESTree.LabeledStatement;
30
- export declare function parseBlock<T extends ESTree.BlockStatement | ESTree.StaticBlock = ESTree.BlockStatement>(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number, type?: T['type']): T;
31
- export declare function parseReturnStatement(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, start: number, line: number, column: number): ESTree.ReturnStatement;
32
- export declare function parseExpressionStatement(parser: ParserState, context: Context, expression: ESTree.Expression, start: number, line: number, column: number): ESTree.ExpressionStatement;
33
- export declare function parseLabelledStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, value: string, expr: ESTree.Identifier | ESTree.Expression, token: Token, allowFuncDecl: 0 | 1, start: number, line: number, column: number): ESTree.LabeledStatement;
34
- export declare function parseAsyncArrowOrAsyncFunctionDeclaration(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, allowFuncDecl: 0 | 1, start: number, line: number, column: number): ESTree.ExpressionStatement | ESTree.LabeledStatement | ESTree.FunctionDeclaration;
35
- export declare function parseDirective(parser: ParserState, context: Context, expression: ESTree.ArgumentExpression | ESTree.SequenceExpression | ESTree.Expression, token: Token, start: number, line: number, column: number): ESTree.ExpressionStatement;
36
- export declare function parseEmptyStatement(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.EmptyStatement;
37
- export declare function parseThrowStatement(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, start: number, line: number, column: number): ESTree.ThrowStatement;
38
- export declare function parseIfStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.IfStatement;
39
- export declare function parseConsequentOrAlternative(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.Statement | ESTree.FunctionDeclaration;
40
- export declare function parseSwitchStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.SwitchStatement;
41
- export declare function parseWhileStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.WhileStatement;
42
- export declare function parseIterationStatementBody(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.Statement;
43
- export declare function parseContinueStatement(parser: ParserState, context: Context, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.ContinueStatement;
44
- export declare function parseBreakStatement(parser: ParserState, context: Context, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.BreakStatement;
45
- export declare function parseWithStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.WithStatement;
46
- export declare function parseDebuggerStatement(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.DebuggerStatement;
47
- export declare function parseTryStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.TryStatement;
48
- export declare function parseCatchBlock(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.CatchClause;
49
- export declare function parseStaticBlock(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, start: number, line: number, column: number): ESTree.StaticBlock;
50
- export declare function parseDoWhileStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.DoWhileStatement;
51
- export declare function parseLetIdentOrVarDeclarationStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, start: number, line: number, column: number): ESTree.VariableDeclaration | ESTree.LabeledStatement | ESTree.ExpressionStatement;
52
- export declare function parseVariableStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, start: number, line: number, column: number): ESTree.VariableDeclaration;
53
- export declare function parseVariableDeclarationList(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, kind: BindingKind, origin: Origin): ESTree.VariableDeclarator[];
54
- export declare function parseForStatement(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: number, line: number, column: number): ESTree.ForStatement | ESTree.ForInStatement | ESTree.ForOfStatement;
55
- export declare function parseRestrictedIdentifier(parser: ParserState, context: Context, scope: ScopeState | undefined): ESTree.Identifier;
56
- export declare function parseImportMetaDeclaration(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.ExpressionStatement;
57
- export declare function parseExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, canAssign: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.Expression;
58
- export declare function parseSequenceExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: number, line: number, column: number, expr: ESTree.AssignmentExpression | ESTree.Expression): ESTree.SequenceExpression;
59
- export declare function parseExpressions(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, canAssign: 0 | 1, start: number, line: number, column: number): ESTree.SequenceExpression | ESTree.Expression;
60
- export declare function parseAssignmentExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, isPattern: 0 | 1, start: number, line: number, column: number, left: ESTree.ArgumentExpression | ESTree.Expression | null): ESTree.ArgumentExpression | ESTree.Expression;
61
- export declare function parseAssignmentExpressionOrPattern(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, isPattern: 0 | 1, start: number, line: number, column: number, left: any): any;
62
- export declare function parseConditionalExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, test: ESTree.Expression, start: number, line: number, column: number): ESTree.ConditionalExpression;
63
- export declare function parseBinaryExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: number, line: number, column: number, minPrecedence: number, operator: Token, left: ESTree.ArgumentExpression | ESTree.Expression): ESTree.ArgumentExpression | ESTree.Expression;
64
- export declare function parseUnaryExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, isLHS: 0 | 1, start: number, line: number, column: number, inGroup: 0 | 1): ESTree.UnaryExpression;
65
- export declare function parseAsyncExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, isLHS: 0 | 1, canAssign: 0 | 1, inNew: 0 | 1, start: number, line: number, column: number): ESTree.FunctionExpression | ESTree.ArrowFunctionExpression | ESTree.CallExpression | ESTree.Identifier;
66
- export declare function parseYieldExpressionOrIdentifier(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, canAssign: 0 | 1, start: number, line: number, column: number): ESTree.YieldExpression | ESTree.Identifier | ESTree.ArrowFunctionExpression;
67
- export declare function parseAwaitExpressionOrIdentifier(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inNew: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.IdentifierOrExpression | ESTree.AwaitExpression;
68
- export declare function parseFunctionBody(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, funcNameToken: Token | undefined, scopeError: any): ESTree.BlockStatement;
69
- export declare function parseSuperExpression(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.Super;
70
- export declare function parseLeftHandSideExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, canAssign: 0 | 1, inGroup: 0 | 1, isLHS: 0 | 1, start: number, line: number, column: number): ESTree.Expression;
71
- export declare function parseMemberOrUpdateExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, expr: ESTree.Expression, inGroup: 0 | 1, inChain: 0 | 1, start: number, line: number, column: number): any;
72
- export declare function parseOptionalChain(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, expr: ESTree.Expression, start: number, line: number, column: number): ESTree.MemberExpression | ESTree.CallExpression;
73
- export declare function parsePropertyOrPrivatePropertyName(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined): any;
74
- export declare function parseUpdateExpressionPrefixed(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inNew: 0 | 1, isLHS: 0 | 1, start: number, line: number, column: number): ESTree.UpdateExpression;
75
- export declare function parsePrimaryExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, kind: BindingKind, inNew: 0 | 1, canAssign: 0 | 1, inGroup: 0 | 1, isLHS: 0 | 1, start: number, line: number, column: number): any;
76
- export declare function parseImportMetaExpression(parser: ParserState, context: Context, meta: ESTree.Identifier, start: number, line: number, column: number): ESTree.MetaProperty;
77
- export declare function parseImportExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.ImportExpression;
78
- export declare function parseImportAttributes(parser: ParserState, context: Context, specifiers?: (ESTree.ImportClause | ESTree.ExportSpecifier)[] | null): ESTree.ImportAttribute[];
79
- export declare function parseBigIntLiteral(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.BigIntLiteral;
80
- export declare function parseTemplateLiteral(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.TemplateLiteral;
81
- export declare function parseTemplate(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined): ESTree.TemplateLiteral;
82
- export declare function parseTemplateElement(parser: ParserState, context: Context, cooked: string | null, raw: string, start: number, line: number, col: number, tail: boolean): ESTree.TemplateElement;
83
- export declare function parseArguments(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1): (ESTree.SpreadElement | ESTree.Expression)[];
84
- export declare function parseIdentifier(parser: ParserState, context: Context): ESTree.Identifier;
85
- export declare function parseLiteral(parser: ParserState, context: Context): ESTree.Literal;
86
- export declare function parseNullOrTrueOrFalseLiteral(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.Literal;
87
- export declare function parseThisExpression(parser: ParserState, context: Context): ESTree.ThisExpression;
88
- export declare function parseFunctionDeclaration(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, allowGen: 0 | 1, flags: HoistedFunctionFlags, isAsync: 0 | 1, start: number, line: number, column: number): ESTree.FunctionDeclaration;
89
- export declare function parseFunctionExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, isAsync: 0 | 1, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.FunctionExpression;
90
- export declare function parseArrayExpressionOrPattern(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, skipInitializer: 0 | 1, inGroup: 0 | 1, isPattern: 0 | 1, kind: BindingKind, origin: Origin, start: number, line: number, column: number): ESTree.ArrayExpression | ESTree.ArrayPattern | ESTree.AssignmentExpression;
91
- export declare function parseMethodDefinition(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, kind: PropertyKind, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.FunctionExpression;
92
- export declare function parseObjectLiteralOrPattern(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, skipInitializer: 0 | 1, inGroup: 0 | 1, isPattern: 0 | 1, kind: BindingKind, origin: Origin, start: number, line: number, column: number): ESTree.ObjectExpression | ESTree.ObjectPattern | ESTree.AssignmentExpression;
93
- export declare function parseMethodFormals(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, kind: PropertyKind, type: BindingKind, inGroup: 0 | 1): ESTree.Parameter[];
94
- export declare function parseComputedPropertyName(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1): ESTree.Expression;
95
- export declare function parseParenthesizedExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, canAssign: 0 | 1, kind: BindingKind, origin: Origin, start: number, line: number, column: number): any;
96
- export declare function parseIdentifierOrArrow(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, start: number, line: number, column: number): ESTree.Identifier | ESTree.ArrowFunctionExpression;
97
- export declare function parseArrowFunctionExpression(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, params: any, isAsync: 0 | 1, start: number, line: number, column: number): ESTree.ArrowFunctionExpression;
98
- export declare function parseFormalParametersOrFormalList(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, kind: BindingKind): ESTree.Parameter[];
99
- export declare function parseMemberExpressionNoCall(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, expr: ESTree.Expression, inGroup: 0 | 1, start: number, line: number, column: number): any;
100
- export declare function parseNewExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.NewExpression | ESTree.Expression | ESTree.MetaProperty;
101
- export declare function parseMetaProperty(parser: ParserState, context: Context, meta: ESTree.Identifier, start: number, line: number, column: number): ESTree.MetaProperty;
102
- export declare function parseAsyncArrowOrCallExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, callee: ESTree.Identifier | void, canAssign: 0 | 1, kind: BindingKind, origin: Origin, flags: Flags, start: number, line: number, column: number): ESTree.CallExpression | ESTree.ArrowFunctionExpression;
103
- export declare function parseRegExpLiteral(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.RegExpLiteral;
104
- export declare function parseClassDeclaration(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, flags: HoistedClassFlags, start: number, line: number, column: number): ESTree.ClassDeclaration;
105
- export declare function parseClassExpression(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: number, line: number, column: number): ESTree.ClassExpression;
106
- export declare function parseDecorators(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined): ESTree.Decorator[];
107
- export declare function parseDecoratorList(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, start: number, line: number, column: number): ESTree.Decorator;
108
- export declare function parseClassBody(parser: ParserState, context: Context, inheritedContext: Context, scope: ScopeState | undefined, parentScope: PrivateScopeState | undefined, kind: BindingKind, origin: Origin, inGroup: 0 | 1): ESTree.ClassBody;
109
- export declare function parsePropertyDefinition(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, key: ESTree.PrivateIdentifier | ESTree.Expression | null, state: PropertyKind, decorators: ESTree.Decorator[], start: number, line: number, column: number): ESTree.PropertyDefinition | ESTree.AccessorProperty;
110
- export declare function parseBindingPattern(parser: ParserState, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, type: BindingKind, origin: Origin, start: number, line: number, column: number): ESTree.BindingPattern;
111
- export declare function parseOpeningFragment(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.JSXOpeningFragment;
112
- export declare function parseJSXClosingFragment(parser: ParserState, context: Context, inJSXChild: 0 | 1, start: number, line: number, column: number): ESTree.JSXClosingFragment;
113
- export declare function parseJSXChildrenAndClosingElement(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inJSXChild: 0 | 1): [ESTree.JSXChild[], ESTree.JSXClosingElement];
114
- export declare function parseJSXChildrenAndClosingFragment(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, inJSXChild: 0 | 1): [ESTree.JSXChild[], ESTree.JSXClosingFragment];
115
- export declare function parseJSXText(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.JSXText;
116
- export declare function parseJSXMemberExpression(parser: ParserState, context: Context, object: ESTree.JSXIdentifier | ESTree.JSXMemberExpression, start: number, line: number, column: number): ESTree.JSXMemberExpression;
117
- export declare function parseJSXAttributes(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined): (ESTree.JSXAttribute | ESTree.JSXSpreadAttribute)[];
118
- export declare function parseJSXSpreadAttribute(parser: ParserState, context: Context, privateScope: PrivateScopeState | undefined, start: number, line: number, column: number): ESTree.JSXSpreadAttribute;
119
- export declare function parseJSXIdentifier(parser: ParserState, context: Context, start: number, line: number, column: number): ESTree.JSXIdentifier;
24
+ export declare function parseStatementList(parser: Parser, context: Context, scope: ScopeState | undefined): ESTree.Statement[];
25
+ export declare function parseModuleItemList(parser: Parser, context: Context, scope: ScopeState | undefined): ReturnType<typeof parseDirective | typeof parseModuleItem>[];
26
+ export declare function parseModuleItem(parser: Parser, context: Context, scope: ScopeState | undefined): any;
27
+ export declare function parseStatementListItem(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels): ESTree.Statement | ESTree.Decorator[];
28
+ export declare function parseStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, allowFuncDecl: 0 | 1): ESTree.Statement;
29
+ export declare function parseExpressionOrLabelledStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, allowFuncDecl: 0 | 1): ESTree.ExpressionStatement | ESTree.LabeledStatement;
30
+ export declare function parseBlock<T extends ESTree.BlockStatement | ESTree.StaticBlock = ESTree.BlockStatement>(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: Location, type?: T['type']): T;
31
+ export declare function parseReturnStatement(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): ESTree.ReturnStatement;
32
+ export declare function parseExpressionStatement(parser: Parser, context: Context, expression: ESTree.Expression, start: Location): ESTree.ExpressionStatement;
33
+ export declare function parseLabelledStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, value: string, expr: ESTree.Identifier | ESTree.Expression, token: Token, allowFuncDecl: 0 | 1, start: Location): ESTree.LabeledStatement;
34
+ export declare function parseAsyncArrowOrAsyncFunctionDeclaration(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, labels: ESTree.Labels, allowFuncDecl: 0 | 1): ESTree.ExpressionStatement | ESTree.LabeledStatement | ESTree.FunctionDeclaration;
35
+ export declare function parseDirective(parser: Parser, context: Context, expression: ESTree.ArgumentExpression | ESTree.SequenceExpression | ESTree.Expression, token: Token, start: Location): ESTree.ExpressionStatement;
36
+ export declare function parseEmptyStatement(parser: Parser, context: Context): ESTree.EmptyStatement;
37
+ export declare function parseThrowStatement(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): ESTree.ThrowStatement;
38
+ export declare function parseIfStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.IfStatement;
39
+ export declare function parseConsequentOrAlternative(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.Statement | ESTree.FunctionDeclaration;
40
+ export declare function parseSwitchStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.SwitchStatement;
41
+ export declare function parseWhileStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.WhileStatement;
42
+ export declare function parseIterationStatementBody(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.Statement;
43
+ export declare function parseContinueStatement(parser: Parser, context: Context, labels: ESTree.Labels): ESTree.ContinueStatement;
44
+ export declare function parseBreakStatement(parser: Parser, context: Context, labels: ESTree.Labels): ESTree.BreakStatement;
45
+ export declare function parseWithStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.WithStatement;
46
+ export declare function parseDebuggerStatement(parser: Parser, context: Context): ESTree.DebuggerStatement;
47
+ export declare function parseTryStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.TryStatement;
48
+ export declare function parseCatchBlock(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels, start: Location): ESTree.CatchClause;
49
+ export declare function parseStaticBlock(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, start: Location): ESTree.StaticBlock;
50
+ export declare function parseDoWhileStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.DoWhileStatement;
51
+ export declare function parseLetIdentOrVarDeclarationStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin): ESTree.VariableDeclaration | ESTree.LabeledStatement | ESTree.ExpressionStatement;
52
+ export declare function parseVariableStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin): ESTree.VariableDeclaration;
53
+ export declare function parseVariableDeclarationList(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, kind: BindingKind, origin: Origin): ESTree.VariableDeclarator[];
54
+ export declare function parseForStatement(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, labels: ESTree.Labels): ESTree.ForStatement | ESTree.ForInStatement | ESTree.ForOfStatement;
55
+ export declare function parseRestrictedIdentifier(parser: Parser, context: Context, scope: ScopeState | undefined): ESTree.Identifier;
56
+ export declare function parseImportMetaDeclaration(parser: Parser, context: Context, start: Location): ESTree.ExpressionStatement;
57
+ export declare function parseExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, canAssign: 0 | 1, inGroup: 0 | 1, start: Location): ESTree.Expression;
58
+ export declare function parseSequenceExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: Location, expr: ESTree.AssignmentExpression | ESTree.Expression): ESTree.SequenceExpression;
59
+ export declare function parseExpressions(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, canAssign: 0 | 1, start: Location): ESTree.SequenceExpression | ESTree.Expression;
60
+ export declare function parseAssignmentExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, isPattern: 0 | 1, start: Location, left: ESTree.ArgumentExpression | ESTree.Expression | null): ESTree.ArgumentExpression | ESTree.Expression;
61
+ export declare function parseAssignmentExpressionOrPattern(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, isPattern: 0 | 1, start: Location, left: any): any;
62
+ export declare function parseConditionalExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, test: ESTree.Expression, start: Location): ESTree.ConditionalExpression;
63
+ export declare function parseBinaryExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: Location, minPrecedence: number, operator: Token, left: ESTree.ArgumentExpression | ESTree.Expression): ESTree.ArgumentExpression | ESTree.Expression;
64
+ export declare function parseUnaryExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, isLHS: 0 | 1, inGroup: 0 | 1): ESTree.UnaryExpression;
65
+ export declare function parseAsyncExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, isLHS: 0 | 1, canAssign: 0 | 1, inNew: 0 | 1, start: Location): ESTree.FunctionExpression | ESTree.ArrowFunctionExpression | ESTree.CallExpression | ESTree.Identifier;
66
+ export declare function parseYieldExpressionOrIdentifier(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, canAssign: 0 | 1, start: Location): ESTree.YieldExpression | ESTree.Identifier | ESTree.ArrowFunctionExpression;
67
+ export declare function parseAwaitExpressionOrIdentifier(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inNew: 0 | 1, inGroup: 0 | 1, start: Location): ESTree.IdentifierOrExpression | ESTree.AwaitExpression;
68
+ export declare function parseFunctionBody(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, funcNameToken: Token | undefined, scopeError: any): ESTree.BlockStatement;
69
+ export declare function parseSuperExpression(parser: Parser, context: Context): ESTree.Super;
70
+ export declare function parseLeftHandSideExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, canAssign: 0 | 1, inGroup: 0 | 1, isLHS: 0 | 1): ESTree.Expression;
71
+ export declare function parseMemberOrUpdateExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, expr: ESTree.Expression, inGroup: 0 | 1, inChain: 0 | 1, start: Location): any;
72
+ export declare function parseOptionalChain(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, expr: ESTree.Expression, start: Location): ESTree.MemberExpression | ESTree.CallExpression;
73
+ export declare function parsePropertyOrPrivatePropertyName(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): any;
74
+ export declare function parseUpdateExpressionPrefixed(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inNew: 0 | 1, isLHS: 0 | 1, start: Location): ESTree.UpdateExpression;
75
+ export declare function parsePrimaryExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, kind: BindingKind, inNew: 0 | 1, canAssign: 0 | 1, inGroup: 0 | 1, isLHS: 0 | 1, start: Location): any;
76
+ export declare function parseImportMetaExpression(parser: Parser, context: Context, meta: ESTree.Identifier, start: Location): ESTree.MetaProperty;
77
+ export declare function parseImportExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: Location): ESTree.ImportExpression;
78
+ export declare function parseImportAttributes(parser: Parser, context: Context, specifiers?: (ESTree.ImportClause | ESTree.ExportSpecifier)[] | null): ESTree.ImportAttribute[];
79
+ export declare function parseBigIntLiteral(parser: Parser, context: Context): ESTree.BigIntLiteral;
80
+ export declare function parseTemplateLiteral(parser: Parser, context: Context, start: Location): ESTree.TemplateLiteral;
81
+ export declare function parseTemplate(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): ESTree.TemplateLiteral;
82
+ export declare function parseTemplateElement(parser: Parser, context: Context, cooked: string | null, raw: string, start: Location, tail: boolean): ESTree.TemplateElement;
83
+ export declare function parseArguments(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1): (ESTree.SpreadElement | ESTree.Expression)[];
84
+ export declare function parseIdentifier(parser: Parser, context: Context): ESTree.Identifier;
85
+ export declare function parseLiteral(parser: Parser, context: Context): ESTree.Literal;
86
+ export declare function parseNullOrTrueOrFalseLiteral(parser: Parser, context: Context): ESTree.Literal;
87
+ export declare function parseThisExpression(parser: Parser, context: Context): ESTree.ThisExpression;
88
+ export declare function parseFunctionDeclaration(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, origin: Origin, allowGen: 0 | 1, flags: HoistedFunctionFlags, isAsync: 0 | 1, start: Location): ESTree.FunctionDeclaration;
89
+ export declare function parseFunctionExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, isAsync: 0 | 1, inGroup: 0 | 1, start: Location): ESTree.FunctionExpression;
90
+ export declare function parseArrayExpressionOrPattern(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, skipInitializer: 0 | 1, inGroup: 0 | 1, isPattern: 0 | 1, kind: BindingKind, origin: Origin): ESTree.ArrayExpression | ESTree.ArrayPattern | ESTree.AssignmentExpression;
91
+ export declare function parseMethodDefinition(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, kind: PropertyKind, inGroup: 0 | 1, start: Location): ESTree.FunctionExpression;
92
+ export declare function parseObjectLiteralOrPattern(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, skipInitializer: 0 | 1, inGroup: 0 | 1, isPattern: 0 | 1, kind: BindingKind, origin: Origin): ESTree.ObjectExpression | ESTree.ObjectPattern | ESTree.AssignmentExpression;
93
+ export declare function parseMethodFormals(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, kind: PropertyKind, type: BindingKind, inGroup: 0 | 1): ESTree.Parameter[];
94
+ export declare function parseComputedPropertyName(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1): ESTree.Expression;
95
+ export declare function parseParenthesizedExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, canAssign: 0 | 1, kind: BindingKind, origin: Origin, start: Location): any;
96
+ export declare function parseIdentifierOrArrow(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): ESTree.Identifier | ESTree.ArrowFunctionExpression;
97
+ export declare function parseArrowFunctionExpression(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, params: any, isAsync: 0 | 1, start: Location): ESTree.ArrowFunctionExpression;
98
+ export declare function parseFormalParametersOrFormalList(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, kind: BindingKind): ESTree.Parameter[];
99
+ export declare function parseMemberExpressionNoCall(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, expr: ESTree.Expression, inGroup: 0 | 1, start: Location): any;
100
+ export declare function parseNewExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1): ESTree.NewExpression | ESTree.Expression | ESTree.MetaProperty;
101
+ export declare function parseMetaProperty(parser: Parser, context: Context, meta: ESTree.Identifier, start: Location): ESTree.MetaProperty;
102
+ export declare function parseAsyncArrowOrCallExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, callee: ESTree.Identifier | void, canAssign: 0 | 1, kind: BindingKind, origin: Origin, flags: Flags, start: Location): ESTree.CallExpression | ESTree.ArrowFunctionExpression;
103
+ export declare function parseRegExpLiteral(parser: Parser, context: Context): ESTree.RegExpLiteral;
104
+ export declare function parseClassDeclaration(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, flags: HoistedClassFlags): ESTree.ClassDeclaration;
105
+ export declare function parseClassExpression(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inGroup: 0 | 1, start: Location): ESTree.ClassExpression;
106
+ export declare function parseDecorators(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): ESTree.Decorator[];
107
+ export declare function parseDecoratorList(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, start: Location): ESTree.Decorator;
108
+ export declare function parseClassBody(parser: Parser, context: Context, inheritedContext: Context, scope: ScopeState | undefined, parentScope: PrivateScopeState | undefined, kind: BindingKind, origin: Origin, inGroup: 0 | 1): ESTree.ClassBody;
109
+ export declare function parsePropertyDefinition(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, key: ESTree.PrivateIdentifier | ESTree.Expression | null, state: PropertyKind, decorators: ESTree.Decorator[], start: Location): ESTree.PropertyDefinition | ESTree.AccessorProperty;
110
+ export declare function parseBindingPattern(parser: Parser, context: Context, scope: ScopeState | undefined, privateScope: PrivateScopeState | undefined, type: BindingKind, origin: Origin): ESTree.BindingPattern;
111
+ export declare function parseJSXOpeningFragment(parser: Parser, context: Context, start: Location): ESTree.JSXOpeningFragment;
112
+ export declare function parseJSXClosingFragment(parser: Parser, context: Context, inJSXChild: 0 | 1, start: Location): ESTree.JSXClosingFragment;
113
+ export declare function parseJSXChildrenAndClosingElement(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inJSXChild: 0 | 1): [ESTree.JSXChild[], ESTree.JSXClosingElement];
114
+ export declare function parseJSXChildrenAndClosingFragment(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined, inJSXChild: 0 | 1): [ESTree.JSXChild[], ESTree.JSXClosingFragment];
115
+ export declare function parseJSXText(parser: Parser, context: Context): ESTree.JSXText;
116
+ export declare function parseJSXMemberExpression(parser: Parser, context: Context, object: ESTree.JSXIdentifier | ESTree.JSXMemberExpression, start: Location): ESTree.JSXMemberExpression;
117
+ export declare function parseJSXAttributes(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): (ESTree.JSXAttribute | ESTree.JSXSpreadAttribute)[];
118
+ export declare function parseJSXSpreadAttribute(parser: Parser, context: Context, privateScope: PrivateScopeState | undefined): ESTree.JSXSpreadAttribute;
119
+ export declare function parseJSXIdentifier(parser: Parser, context: Context): ESTree.JSXIdentifier;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meriyah",
3
- "version": "6.1.0",
3
+ "version": "6.1.2",
4
4
  "description": "A 100% compliant, self-hosted javascript parser with high focus on both performance and stability",
5
5
  "main": "dist/meriyah.cjs",
6
6
  "module": "dist/meriyah.min.mjs",
@@ -53,34 +53,35 @@
53
53
  "access": "public"
54
54
  },
55
55
  "scripts": {
56
- "build": "tsc",
57
- "build:watch": "tsc -w",
58
- "lint": "npm run lint:eslint && npm run lint:prettier && npm run lint:cspell",
56
+ "build": "node scripts/build.mjs",
57
+ "lint": "npm run lint:eslint && npm run lint:types && npm run lint:prettier && npm run lint:cspell",
59
58
  "lint:eslint": "eslint",
60
59
  "lint:prettier": "prettier . --check",
61
60
  "lint:cspell": "cspell . --gitignore",
61
+ "lint:types": "tsc",
62
62
  "fix": "npm run fix:eslint && npm run fix:prettier",
63
63
  "fix:eslint": "eslint --fix",
64
64
  "fix:prettier": "prettier . --write",
65
- "bundle": "node scripts/bundle.mjs",
66
65
  "test": "vitest",
67
66
  "test:watch": "vitest --watch",
68
- "production-test": "npm run bundle && cross-env PRODUCTION_TEST=1 vitest test/production/production-tests.ts",
67
+ "production-test": "npm run build && cross-env PRODUCTION_TEST=1 vitest test/production/production-tests.ts",
69
68
  "prepare-nightly": "node scripts/bump-dev-version.mjs",
70
69
  "coverage": "vitest --coverage",
71
70
  "post_coverage": "cross-env cat ./coverage/lcov.info | coveralls",
72
- "prepublishOnly": "npm run bundle",
71
+ "prepublishOnly": "npm run build",
73
72
  "preversion": "npm test",
74
73
  "version": "standard-changelog && git add CHANGELOG.md",
75
74
  "postversion": "git push && git push --tags && npm publish",
76
75
  "prepare": "husky",
77
76
  "generate-unicode": "node scripts/generate-unicode.mjs",
78
- "generate-test262-whitelist": "npm run bundle && node scripts/generate-test262-whitelist.mjs"
77
+ "generate-test262-whitelist": "npm run build && node test262/generate-test262-whitelist.mjs"
79
78
  },
80
79
  "devDependencies": {
80
+ "@babel/code-frame": "^7.27.1",
81
81
  "@eslint/js": "^9.24.0",
82
82
  "@rollup/plugin-json": "^6.1.0",
83
83
  "@rollup/plugin-terser": "^0.4.4",
84
+ "@types/babel__code-frame": "^7.0.6",
84
85
  "@types/node": "^22.14.0",
85
86
  "@unicode/unicode-16.0.0": "^1.6.5",
86
87
  "@vitest/coverage-v8": "^3.1.1",
@@ -99,7 +100,6 @@
99
100
  "rollup": "^4.39.0",
100
101
  "rollup-plugin-typescript2": "^0.36.0",
101
102
  "standard-changelog": "^6.0.0",
102
- "test262": "github:tc39/test262#5c9ff876dcefd19a27ef735224bd69ac1d1ee8e9",
103
103
  "test262-parser-runner": "^0.5.0",
104
104
  "typescript": "^5.8.2",
105
105
  "typescript-eslint": "^8.27.0",