class webpack.javascript.JavascriptParser extends ParserDefines the parser state base type used by this module.
new JavascriptParser(sourceType?, options?): JavascriptParser"module" | "auto" | "script"(code: string, options: ParseOptions) => ParseResultbooleanJavascriptParserCreates an instance of JavascriptParser.
CommentJavascriptParser[]Record<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettings | HarmonySpecifierGuardsWeakMap<Expression, Set<DestructuringAssignmentProperty>>Readonly<{ assign: HookMap<SyncBailHook<[AssignmentExpression], boolean | void>>; assignMemberChain: HookMap<SyncBailHook<[AssignmentExpression, string[]], boolean | void>>; binaryExpression: SyncBailHook<[BinaryExpression], boolean | void>; blockPreStatement: SyncBailHook<[ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | FunctionDeclaration | MaybeNamedFunctionDeclaration | VariableDeclaration | ClassDeclaration | MaybeNamedClassDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | ExportDefaultDeclaration], boolean | void>; call: HookMap<SyncBailHook<[CallExpression], boolean | void>>; callMemberChain: HookMap<SyncBailHook<[CallExpression, string[], boolean[], [number, number][]], boolean | void>>; callMemberChainOfCallMemberChain: HookMap<SyncBailHook<[CallExpression, string[], CallExpression, string[], [number, number][]], boolean | void>>; canRename: HookMap<SyncBailHook<[Expression], boolean | void>>; classBodyElement: SyncBailHook<[StaticBlock | MethodDefinition | PropertyDefinition, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>; classBodyValue: SyncBailHook<[Expression, MethodDefinition | PropertyDefinition, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>; classExtendsExpression: SyncBailHook<[Expression, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>; collectDestructuringAssignmentProperties: SyncBailHook<[Expression], boolean | void>; collectGuards: SyncBailHook<[Expression], void | ((walk: () => void) => void)>; declarator: SyncBailHook<[VariableDeclarator, Statement], boolean | void>; evaluate: HookMap<SyncBailHook<[ImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpression | SpreadElement | PrivateIdentifier | Super], undefined | null | BasicEvaluatedExpression>>; evaluateCallExpression: HookMap<SyncBailHook<[CallExpression], undefined | null | BasicEvaluatedExpression>>; evaluateCallExpressionMember: HookMap<SyncBailHook<[CallExpression, BasicEvaluatedExpression], undefined | null | BasicEvaluatedExpression>>; evaluateDefinedIdentifier: HookMap<SyncBailHook<[Identifier | MemberExpression | ThisExpression], undefined | null | BasicEvaluatedExpression>>; evaluateIdentifier: HookMap<SyncBailHook<[Identifier | MemberExpression | MetaProperty | ThisExpression], undefined | null | BasicEvaluatedExpression>>; evaluateNewExpression: HookMap<SyncBailHook<[NewExpression], undefined | null | BasicEvaluatedExpression>>; evaluateTypeof: HookMap<SyncBailHook<[UnaryExpression], undefined | null | BasicEvaluatedExpression>>; export: SyncBailHook<[ExportNamedDeclaration | ExportDefaultDeclaration], boolean | void>; exportDeclaration: SyncBailHook<[ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration, Declaration], boolean | void>; exportExpression: SyncBailHook<[ExportDefaultDeclaration, ImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpression | MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration], boolean | void>; exportImport: SyncBailHook<[ExportNamedDeclaration | ExportAllDeclaration, ImportSource], boolean | void>; exportImportSpecifier: SyncBailHook<[ExportNamedDeclaration | ExportAllDeclaration, ImportSource, null | string, null | string, undefined | number], boolean | void>; exportSpecifier: SyncBailHook<[ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration, string, string, undefined | number], boolean | void>; expression: HookMap<SyncBailHook<[Expression], boolean | void>>; expressionConditionalOperator: SyncBailHook<[ConditionalExpression], boolean | void>; expressionLogicalOperator: SyncBailHook<[LogicalExpression], boolean | void>; expressionMemberChain: HookMap<SyncBailHook<[MemberExpression, string[], boolean[], [number, number][]], boolean | void>>; finish: SyncBailHook<[Program, CommentJavascriptParser[]], boolean | void>; import: SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>; importCall: SyncBailHook<[ImportExpressionJavascriptParser, undefined | SimpleCallExpression | NewExpression], boolean | void>; importSpecifier: SyncBailHook<[ImportDeclaration, ImportSource, null | string, string], boolean | void>; isPure: HookMap<SyncBailHook<[ImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpression | PrivateIdentifier | FunctionDeclaration | MaybeNamedFunctionDeclaration | VariableDeclaration | ClassDeclaration | MaybeNamedClassDeclaration, number], boolean | void>>; label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>; memberChainOfCallMemberChain: HookMap<SyncBailHook<[Expression, string[], CallExpression, string[], [number, number][]], boolean | void>>; new: HookMap<SyncBailHook<[NewExpression], boolean | void>>; optionalChaining: SyncBailHook<[ChainExpression], boolean | void>; pattern: HookMap<SyncBailHook<[Identifier], boolean | void>>; preDeclarator: SyncBailHook<[VariableDeclarator, VariableDeclaration], boolean | void>; preStatement: SyncBailHook<[ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | FunctionDeclaration | MaybeNamedFunctionDeclaration | VariableDeclaration | ClassDeclaration | MaybeNamedClassDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | ExportDefaultDeclaration], boolean | void>; program: SyncBailHook<[Program, CommentJavascriptParser[]], boolean | void>; rename: HookMap<SyncBailHook<[Expression], boolean | void>>; statement: SyncBailHook<[ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | FunctionDeclaration | MaybeNamedFunctionDeclaration | VariableDeclaration | ClassDeclaration | MaybeNamedClassDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | ExportDefaultDeclaration], boolean | void>; statementIf: SyncBailHook<[IfStatement], boolean | void>; terminate: SyncBailHook<[ReturnStatement | ThrowStatement], boolean | void>; topLevelAwait: SyncBailHook<[ImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpression | ForOfStatement], boolean | void>; typeof: HookMap<SyncBailHook<[Expression], boolean | void>>; unhandledExpressionMemberChain: HookMap<SyncBailHook<[MemberExpression, string[]], boolean | void>>; unusedStatement: SyncBailHook<[Statement], boolean | void>; varDeclaration: HookMap<SyncBailHook<[Identifier], boolean | void>>; varDeclarationConst: HookMap<SyncBailHook<[Identifier], boolean | void>>; varDeclarationLet: HookMap<SyncBailHook<[Identifier], boolean | void>>; varDeclarationUsing: HookMap<SyncBailHook<[Identifier], boolean | void>>; varDeclarationVar: HookMap<SyncBailHook<[Identifier], boolean | void>> }>Context{ parse?: (code: string, options: ParseOptions) => ParseResult; typescript?: boolean }ClassDeclaration | MaybeNamedClassDeclaration | ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | FunctionDeclaration | MaybeNamedFunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclarationScopeInfo"module" | "auto" | "script"JavascriptParserStateStatementPathItem[]312(node: ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpressionJavascriptParser) => Record<string, string> | undefinedtypeof VariableInfoReadonly<{ Evaluated: 0; Free: 1; Normal: 2; Tagged: 4 }>blockPreWalkClassDeclaration(statement): voidClassDeclaration | MaybeNamedClassDeclarationvoidBlock pre walk class declaration.
blockPreWalkExportDefaultDeclaration(statement): voidExportDefaultDeclarationvoidBlock pre walk export default declaration.
blockPreWalkExportNamedDeclaration(statement): voidExportNamedDeclarationvoidBlock pre walk export named declaration.
blockPreWalkExpressionStatement(statement): voidExpressionStatementvoidBlock pre walk expression statement.
blockPreWalkStatement(statement): voidClassDeclaration | MaybeNamedClassDeclaration | FunctionDeclaration | MaybeNamedFunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclarationvoidBlock pre walk statement.
blockPreWalkStatements(statements): void(ClassDeclaration | FunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclaration)[]voidBlock pre walking iterates the scope for block variable declarations
blockPreWalkVariableDeclaration(statement): voidVariableDeclarationvoidBlock pre walk variable declaration.
callHooksForExpression(hookMap, expr, ...args?): R | undefinedHookMap<SyncBailHook<T, R, UnsetAdditionalOptions>>ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | SuperAsArray<T>R | undefinedCall hooks for expression.
callHooksForExpressionWithFallback(hookMap, expr, fallback, defined, ...args?): R | undefinedHookMap<SyncBailHook<T, R, UnsetAdditionalOptions>>ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | Super((name: string, rootInfo: string | VariableInfo | ScopeInfo, getMembers: () => string[]) => R) | undefinedAsArray<T>R | undefinedCall hooks for expression with fallback.
callHooksForInfo(hookMap, info, ...args?): R | undefinedHookMap<SyncBailHook<T, R, UnsetAdditionalOptions>>ExportedVariableInfoAsArray<T>R | undefinedCall hooks for info.
callHooksForInfoWithFallback(hookMap, info, fallback, defined, ...args?): R | undefinedHookMap<SyncBailHook<T, R, UnsetAdditionalOptions>>ExportedVariableInfoAsArray<T>R | undefinedCall hooks for info with fallback.
callHooksForName(hookMap, name, ...args?): R | undefinedCall hooks for name.
callHooksForNameWithFallback(hookMap, name, fallback, defined, ...args?): R | undefinedCall hooks for name with fallback.
defineVariable(name): voidProcesses the provided name.
destructuringAssignmentPropertiesFor(node): Set<DestructuringAssignmentProperty> | undefinedExpressionSet<DestructuringAssignmentProperty> | undefinedDestructuring assignment properties for.
detectMode(statements): void(ClassDeclaration | FunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclaration | Directive)[]voidProcesses the provided statement.
enterArrayPattern(pattern, onIdent): voidEnter array pattern.
enterAssignmentPattern(pattern, onIdent): voidEnter assignment pattern.
enterDeclaration(declaration, onIdent): voidDeclarationvoidProcesses the provided declaration.
enterDestructuringAssignment(pattern, expression): ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | undefinedPatternExpressionClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | undefinedEnter destructuring assignment.
enterIdentifier(pattern, onIdent): voidProcesses the provided pattern.
enterObjectPattern(pattern, onIdent): voidEnter object pattern.
enterPattern(pattern, onIdent): voidProcesses the provided pattern.
enterPatterns(patterns, onIdent): voidProcesses the provided pattern.
enterRestElement(pattern, onIdent): voidEnter rest element.
evaluate(source): BasicEvaluatedExpressionstringBasicEvaluatedExpressionReturns evaluation result.
evaluatedVariable(tagInfo): VariableInfoTagInfoVariableInfoEvaluated variable.
evaluateExpression(expression): BasicEvaluatedExpressionClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateIdentifier | SpreadElement | SuperBasicEvaluatedExpressionEvaluate expression.
extractMemberExpressionChain(expression): { memberRanges: [number, number][]; members: string[]; membersOptionals: boolean[]; object: ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | Super }ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | Super{ memberRanges: [number, number][]; members: string[]; membersOptionals: boolean[]; object: ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | Super }Extract member expression chain.
getComments(range): CommentJavascriptParser[]CommentJavascriptParser[]Returns comments in the range.
getFreeInfoFromVariable(varName): { info: string | VariableInfo; name: string } | undefinedstring{ info: string | VariableInfo; name: string } | undefinedGets free info from variable.
getMemberExpressionInfo(expression, allowedTypes): CallExpressionInfo | ExpressionExpressionInfo | undefinedClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | SupernumberCallExpressionInfo | ExpressionExpressionInfo | undefinedGets member expression info.
getNameForExpression(expression): { getMembers: () => string[]; name: string; rootInfo: ExportedVariableInfo } | undefinedExpression{ getMembers: () => string[]; name: string; rootInfo: ExportedVariableInfo } | undefinedGets name for expression.
getNameInfoFromVariable(varName): { info: string | VariableInfo; name: string } | undefinedstring{ info: string | VariableInfo; name: string } | undefinedGets name info from variable.
getRenameIdentifier(expr): string | VariableInfo | undefinedClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | SpreadElementstring | VariableInfo | undefinedGets rename identifier.
getTagData(name, tag): Record<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettings | HarmonySpecifierGuards | undefinedstringsymbolRecord<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettings | HarmonySpecifierGuards | undefinedReturns tag data.
getVariableInfo(name): ExportedVariableInfostringExportedVariableInfoGets variable info.
inBlockScope(fn, inExecutedPath?): voidProcesses the provided fn.
inClassScope(hasThis, params, fn): voidProcesses the provided has thi.
inFunctionScope(hasThis, params, fn): voidProcesses the provided has thi.
inScope(params, fn): voidProcesses the provided param.
isAsiPosition(pos): booleanChecks whether this javascript parser is asi position.
isPure(expr, commentsStartPos): booleanClassDeclaration | MaybeNamedClassDeclaration | ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | FunctionDeclaration | MaybeNamedFunctionDeclaration | PrivateIdentifier | VariableDeclaration | null | undefinednumberbooleanChecks whether this javascript parser is pure.
isStatementLevelExpression(expr): booleanExpressionbooleanChecks whether this javascript parser is statement level expression.
isVariableDefined(name): booleanChecks whether this javascript parser is variable defined.
modulePreWalkExportAllDeclaration(statement): voidExportAllDeclarationvoidModule pre walk export all declaration.
modulePreWalkExportNamedDeclaration(statement): voidExportNamedDeclarationvoidModule pre walk export named declaration.
modulePreWalkImportDeclaration(statement): voidImportDeclarationvoidModule pre walk import declaration.
modulePreWalkStatements(statements): void(ClassDeclaration | FunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclaration)[]voidModule pre walking iterates the scope for import entries
parse(source, state): ParserStatestring | Buffer<ArrayBufferLike> | PreparsedAstParserStateParserStateParses the provided source and updates the parser state.
parseCalculatedString(expression): CalculatedStringResultExpressionCalculatedStringResultParses calculated string.
parseCommentOptions(range): { errors: (Error & { comment: CommentJavascriptParser })[] | null; options: Record<string, any> | null }Parses comment options.
parseString(expression): stringExpressionstringReturns parsed string.
preWalkAssignmentExpression(expression): voidAssignmentExpressionvoidPre walk assignment expression.
preWalkBlockStatement(statement): voidBlockStatementvoidPre walk block statement.
preWalkCatchClause(catchClause): voidCatchClausevoidPre walk catch clause.
preWalkDoWhileStatement(statement): voidDoWhileStatementvoidPre walk do while statement.
preWalkForInStatement(statement): voidForInStatementvoidPre walk for in statement.
preWalkForOfStatement(statement): voidForOfStatementvoidPre walk for of statement.
preWalkForStatement(statement): voidForStatementvoidPre walk for statement.
preWalkFunctionDeclaration(statement): voidFunctionDeclaration | MaybeNamedFunctionDeclarationvoidPre walk function declaration.
preWalkIfStatement(statement): voidIfStatementvoidPre walk if statement.
preWalkLabeledStatement(statement): voidLabeledStatementvoidPre walk labeled statement.
preWalkStatement(statement): voidClassDeclaration | MaybeNamedClassDeclaration | FunctionDeclaration | MaybeNamedFunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclarationvoidWalking iterates the statements and expressions and processes them
preWalkStatements(statements): void(ClassDeclaration | FunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclaration)[]voidPre walking iterates the scope for variable declarations
preWalkSwitchCases(switchCases): voidSwitchCase[]voidPre walk switch cases.
preWalkSwitchStatement(statement): voidSwitchStatementvoidPre walk switch statement.
preWalkTryStatement(statement): voidTryStatementvoidPre walk try statement.
preWalkVariableDeclaration(statement): voidVariableDeclarationvoidPre walk variable declaration.
preWalkVariableDeclarator(declarator): voidVariableDeclaratorvoidPre walk variable declarator.
preWalkWhileStatement(statement): voidWhileStatementvoidPre walk while statement.
preWalkWithStatement(statement): voidWithStatementvoidPre walk with statement.
setAsiPosition(pos): voidUpdates asi position using the provided po.
setVariable(name, variableInfo): voidUpdates variable using the provided name.
tagVariable(name, tag, data?, flags?): voidstringsymbolRecord<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettings | HarmonySpecifierGuards0 | 2 | 1 | 4voidProcesses the provided name.
undefineVariable(name): voidProcesses the provided name.
unsetAsiPosition(pos): voidUnset asi position.
walkArrayExpression(expression): voidArrayExpressionvoidWalk array expression.
walkArrayPattern(pattern): voidArrayPatternvoidWalk array pattern.
walkArrowFunctionExpression(expression): voidArrowFunctionExpressionvoidWalk arrow function expression.
walkAssignmentExpression(expression): voidAssignmentExpressionvoidWalk assignment expression.
walkAssignmentPattern(pattern): voidAssignmentPatternvoidWalk assignment pattern.
walkAwaitExpression(expression): voidAwaitExpressionvoidWalk await expression.
walkBinaryExpression(expression): voidBinaryExpressionvoidWalk binary expression.
walkBlockStatement(statement): voidBlockStatement | StaticBlockvoidWalk block statement.
walkCallExpression(expression): voidCallExpressionvoidWalk call expression.
walkCatchClause(catchClause): voidCatchClausevoidProcesses the provided catch clause.
walkChainExpression(expression): voidChainExpressionvoidWalk chain expression.
walkClass(classy): voidClassDeclaration | MaybeNamedClassDeclaration | ClassExpressionvoidProcesses the provided classy.
walkClassDeclaration(statement): voidClassDeclaration | MaybeNamedClassDeclarationvoidWalk class declaration.
walkClassExpression(expression): voidClassExpressionvoidWalk class expression.
walkConditionalExpression(expression): voidConditionalExpressionvoidWalk conditional expression.
walkDoWhileStatement(statement): voidDoWhileStatementvoidWalk do while statement.
walkExportDefaultDeclaration(statement): voidExportDefaultDeclarationvoidWalk export default declaration.
walkExportNamedDeclaration(statement): voidExportNamedDeclarationvoidWalk export named declaration.
walkExpression(expression): voidClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateIdentifier | SpreadElement | SupervoidProcesses the provided expression.
walkExpressions(expressions): void(ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | SpreadElement | null)[]voidProcesses the provided expression.
walkExpressionStatement(statement): voidExpressionStatementvoidWalk expression statement.
walkForInStatement(statement): voidForInStatementvoidWalk for in statement.
walkForOfStatement(statement): voidForOfStatementvoidWalk for of statement.
walkForStatement(statement): voidForStatementvoidWalk for statement.
walkFunctionDeclaration(statement): voidFunctionDeclaration | MaybeNamedFunctionDeclarationvoidWalk function declaration.
walkFunctionExpression(expression): voidFunctionExpressionvoidWalk function expression.
walkIdentifier(expression): voidIdentifiervoidProcesses the provided expression.
walkIfStatement(statement): voidIfStatementvoidProcesses the provided statement.
walkImportExpression(expression): voidImportExpressionJavascriptParservoidWalk import expression.
walkLabeledStatement(statement): voidLabeledStatementvoidWalk labeled statement.
walkLeftRightExpression(expression): voidBinaryExpression | LogicalExpressionvoidWalk left right expression.
walkLogicalExpression(expression): voidLogicalExpressionvoidWalk logical expression.
walkMemberExpression(expression): voidMemberExpressionvoidWalk member expression.
walkMemberExpressionWithExpressionName(expression, name, rootInfo, members, onUnhandled): voidWalk member expression with expression name.
walkMetaProperty(metaProperty): voidMetaPropertyvoidWalk meta property.
walkNestedStatement(statement): voidWalks a statements that is nested within a parent statement and can potentially be a non-block statement. This enforces the nested statement to never be in ASI position.
walkNewExpression(expression): voidNewExpressionvoidWalk new expression.
walkObjectExpression(expression): voidObjectExpressionvoidWalk object expression.
walkObjectPattern(pattern): voidObjectPatternvoidWalk object pattern.
walkPattern(pattern): voidProcesses the provided pattern.
walkProperty(prop): voidProperty | SpreadElementvoidProcesses the provided prop.
walkRestElement(pattern): voidRestElementvoidProcesses the provided pattern.
walkReturnStatement(statement): voidReturnStatementvoidWalk return statement.
walkSequenceExpression(expression): voidSequenceExpressionvoidWalk sequence expression.
walkSpreadElement(expression): voidSpreadElementvoidWalk spread element.
walkStatement(statement): voidClassDeclaration | MaybeNamedClassDeclaration | FunctionDeclaration | MaybeNamedFunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclarationvoidProcesses the provided statement.
walkStatements(statements): void(ClassDeclaration | FunctionDeclaration | ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | VariableDeclaration)[]voidWalking iterates the statements and expressions and processes them
walkSwitchCases(switchCases): voidSwitchCase[]voidProcesses the provided switch case.
walkSwitchStatement(statement): voidSwitchStatementvoidWalk switch statement.
walkTaggedTemplateExpression(expression): voidTaggedTemplateExpressionvoidWalk tagged template expression.
walkTemplateLiteral(expression): voidTemplateLiteralvoidWalk template literal.
walkTerminatingStatement(statement): voidReturnStatement | ThrowStatementvoidWalk terminating statement.
walkThisExpression(expression): voidThisExpressionvoidWalk this expression.
walkThrowStatement(statement): voidThrowStatementvoidWalk throw statement.
walkTryStatement(statement): voidTryStatementvoidWalk try statement.
walkUnaryExpression(expression): voidUnaryExpressionvoidWalk unary expression.
walkUpdateExpression(expression): voidUpdateExpressionvoidWalk update expression.
walkVariableDeclaration(statement): voidVariableDeclarationvoidWalk variable declaration.
walkWhileStatement(statement): voidWhileStatementvoidWalk while statement.
walkWithStatement(statement): voidWithStatementvoidWalk with statement.
walkYieldExpression(expression): voidYieldExpressionvoidWalk yield expression.
typeof JavascriptParserReturns parser.
CallExpressionstring() => string[]() => string[]() => boolean[]stringstring | VariableInfo"call"FunctionDeclaration | VariableDeclaration | ClassDeclarationHelper function for joining two ranges into a single range. This is useful when working with AST nodes, as it allows you to combine the ranges of child nodes to create the range of the parent node.
string | VariableInfo | ScopeInfoImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpressionParserStateBase & Record<string, any> & KnownJavascriptParserStateIdentifier | MemberExpression | ObjectPattern | ArrayPattern | RestElement | AssignmentPatternFunctionDeclaration | VariableDeclaration | ClassDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatementImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpressionImport | UnaryExpression | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UpdateExpression | YieldExpression | FunctionDeclaration | MaybeNamedFunctionDeclaration | VariableDeclaration | ClassDeclaration | MaybeNamedClassDeclaration | ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | ExportDefaultDeclaration