class JavascriptParser extends Parser
new JavascriptParser(sourceType?, options?): JavascriptParser
"module" | "auto" | "script"Objectboolean(code: string, options: ParseOptions) => ParseResultfalse | "error" | "warn"booleanJavascriptParserCreates an instance of JavascriptParser.
Source Code: lib/javascript/JavascriptParser.js#L746CommentJavascriptParser[]Record<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettingsObjectSyncBailHook<[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>HookMap<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>>HookMap<SyncBailHook<[CallExpression], boolean | void>>HookMap<SyncBailHook<[CallExpression, string[], CallExpression, string[], [number, number][]], boolean | void>>HookMap<SyncBailHook<[Expression], boolean | void>>SyncBailHook<[Expression, MethodDefinition | PropertyDefinition, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>SyncBailHook<[Expression, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>SyncBailHook<[Expression], boolean | void>SyncBailHook<[Expression], void | GuardCollection>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>>HookMap<SyncBailHook<[CallExpression], undefined | null | BasicEvaluatedExpression>>HookMap<SyncBailHook<[CallExpression, BasicEvaluatedExpression], undefined | null | BasicEvaluatedExpression>>HookMap<SyncBailHook<[Identifier | MemberExpression | ThisExpression], undefined | null | BasicEvaluatedExpression>>HookMap<SyncBailHook<[Identifier | MemberExpression | MetaProperty | ThisExpression], undefined | null | BasicEvaluatedExpression>>HookMap<SyncBailHook<[NewExpression], undefined | null | BasicEvaluatedExpression>>HookMap<SyncBailHook<[UnaryExpression], undefined | null | BasicEvaluatedExpression>>SyncBailHook<[ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration, Declaration], boolean | void>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>SyncBailHook<[ExportNamedDeclaration | ExportAllDeclaration, ImportSource], boolean | void>HookMap<SyncBailHook<[Expression], boolean | void>>SyncBailHook<[Program, CommentJavascriptParser[]], boolean | void>SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>SyncBailHook<[ImportExpressionJavascriptParser, undefined | SimpleCallExpression | NewExpression], boolean | void>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>>HookMap<SyncBailHook<[Expression, string[], CallExpression, string[], [number, number][]], boolean | void>>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>HookMap<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>>SyncBailHook<[Program, CommentJavascriptParser[]], boolean | void>HookMap<SyncBailHook<[Expression], boolean | void>>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>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>HookMap<SyncBailHook<[Expression], boolean | void>>ContextObjectbooleanjavascriptParser.options.parse(code, options): ParseResult
false | "error" | "warn"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 | 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"StatementPathItem[]312JavascriptParser.getImportAttributes(node): Record<string, string> | undefined
ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpressionJavascriptParsertypeof VariableInfoObject0124javascriptParser.blockPreWalkClassDeclaration(statement): void
ClassDeclaration | MaybeNamedClassDeclarationBlock pre walk class declaration.
javascriptParser.blockPreWalkExportDefaultDeclaration(statement): void
ExportDefaultDeclarationBlock pre walk export default declaration.
javascriptParser.blockPreWalkExportNamedDeclaration(statement): void
ExportNamedDeclarationBlock pre walk export named declaration.
javascriptParser.blockPreWalkExpressionStatement(statement): void
ExpressionStatementBlock pre walk expression statement.
javascriptParser.blockPreWalkStatement(statement): void
ClassDeclaration | 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 | VariableDeclarationBlock pre walk statement.
javascriptParser.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)[]Block pre walking iterates the scope for block variable declarations
javascriptParser.blockPreWalkVariableDeclaration(statement): void
VariableDeclarationBlock pre walk variable declaration.
javascriptParser.callHooksForExpression(hookMap, expr, ...args?): R | undefined
HookMap<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.
javascriptParser.callHooksForExpressionWithFallback(hookMap, expr, fallback, defined, ...args?): R | undefined
HookMap<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 with fallback.
javascriptParser.callHooksForInfo(hookMap, info, ...args?): R | undefined
HookMap<SyncBailHook<T, R, UnsetAdditionalOptions>>ExportedVariableInfoAsArray<T>R | undefinedCall hooks for info.
javascriptParser.callHooksForInfoWithFallback(hookMap, info, fallback, defined, ...args?): R | undefined
Call hooks for info with fallback.
javascriptParser.callHooksForName(hookMap, name, ...args?): R | undefined
Call hooks for name.
javascriptParser.callHooksForNameWithFallback(hookMap, name, fallback, defined, ...args?): R | undefined
Call hooks for name with fallback.
javascriptParser.defineVariable(name): void
stringProcesses the provided name.
javascriptParser.destructuringAssignmentPropertiesFor(node): Set<DestructuringAssignmentProperty> | undefined
ExpressionSet<DestructuringAssignmentProperty> | undefinedDestructuring assignment properties for.
javascriptParser.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)[]Processes the provided statement.
javascriptParser.enterArrayPattern(pattern, onIdent): void
Enter array pattern.
javascriptParser.enterAssignmentPattern(pattern, onIdent): void
Enter assignment pattern.
javascriptParser.enterDeclaration(declaration, onIdent): void
DeclarationProcesses the provided declaration.
javascriptParser.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 | undefined
PatternExpressionClassExpression | 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.
javascriptParser.enterIdentifier(pattern, onIdent): void
Processes the provided pattern.
javascriptParser.enterObjectPattern(pattern, onIdent): void
Enter object pattern.
javascriptParser.enterPattern(pattern, onIdent): void
Processes the provided pattern.
javascriptParser.enterPatterns(patterns, onIdent): void
Processes the provided pattern.
javascriptParser.enterRestElement(pattern, onIdent): void
Enter rest element.
javascriptParser.evaluate(source): BasicEvaluatedExpression
stringBasicEvaluatedExpressionReturns evaluation result.
javascriptParser.evaluatedVariable(tagInfo): VariableInfo
TagInfoVariableInfoEvaluated variable.
javascriptParser.evaluateExpression(expression): BasicEvaluatedExpression
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 | PrivateIdentifier | SpreadElement | SuperBasicEvaluatedExpressionEvaluate expression.
javascriptParser.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.
javascriptParser.getComments(range): CommentJavascriptParser[]
CommentJavascriptParser[]Returns comments in the range.
javascriptParser.getFreeInfoFromVariable(varName): { info: string | VariableInfo; name: string } | undefined
string{ info: string | VariableInfo; name: string } | undefinedGets free info from variable.
javascriptParser.getLocation(node): DependencyLocation
Returns the location of a node or comment, computed from its offsets so
ASTs from parsers without location support work too. Falls back to the
node's own loc only when no source text is available (preparsed ASTs).
Offsets can only be mapped while parsing — callbacks deferred past the
parse() call must take the location upfront.
javascriptParser.getMemberExpressionInfo(expression, allowedTypes): CallExpressionInfo | ExpressionExpressionInfo | undefined
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 | SupernumberCallExpressionInfo | ExpressionExpressionInfo | undefinedGets member expression info.
javascriptParser.getMemberExpressionRoot(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 | 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 | SuperClassExpression | 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 | SuperFinds the root object of a member expression chain without allocating the
member arrays. The traversal/break logic must stay in sync with
extractMemberExpressionChain; it lets getMemberExpressionInfo reject
unrecognized roots (~77% of calls) before paying for the arrays.
javascriptParser.getNameForExpression(expression): { getMembers: () => string[]; name: string; rootInfo: ExportedVariableInfo } | undefined
Expression{ getMembers: () => string[]; name: string; rootInfo: ExportedVariableInfo } | undefinedGets name for expression.
javascriptParser.getNameInfoFromVariable(varName): { info: string | VariableInfo; name: string } | undefined
string{ info: string | VariableInfo; name: string } | undefinedGets name info from variable.
javascriptParser.getRenameIdentifier(expr): string | VariableInfo | undefined
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 | SpreadElementstring | VariableInfo | undefinedGets rename identifier.
javascriptParser.getTagData(name, tag): Record<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettings | undefined
stringsymbolRecord<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettings | undefinedReturns tag data.
javascriptParser.getVariableInfo(name): ExportedVariableInfo
stringExportedVariableInfoGets variable info.
javascriptParser.inBlockScope(fn, inExecutedPath?): void
Processes the provided fn.
javascriptParser.inClassScope(hasThis, params, fn): void
Processes the provided has thi.
javascriptParser.inFunctionScope(hasThis, params, fn): void
Processes the provided has thi.
javascriptParser.inScope(params, fn): void
Processes the provided param.
javascriptParser.isAsiPosition(pos): boolean
Checks whether this javascript parser is asi position.
javascriptParser.isPure(expr, commentsStartPos): 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 | PrivateIdentifier | VariableDeclaration | null | undefinednumberbooleanChecks whether this javascript parser is pure.
javascriptParser.isStatementLevelExpression(expr): boolean
ExpressionbooleanChecks whether this javascript parser is statement level expression.
javascriptParser.isVariableDefined(name): boolean
Checks whether this javascript parser is variable defined.
javascriptParser.modulePreWalkExportAllDeclaration(statement): void
ExportAllDeclarationModule pre walk export all declaration.
javascriptParser.modulePreWalkExportNamedDeclaration(statement): void
ExportNamedDeclarationModule pre walk export named declaration.
javascriptParser.modulePreWalkImportDeclaration(statement): void
ImportDeclarationModule pre walk import declaration.
javascriptParser.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)[]Module pre walking iterates the scope for import entries
javascriptParser.parse(source, state): ParserState
Parses the provided source and updates the parser state.
javascriptParser.parseCalculatedString(expression): CalculatedStringResult
ExpressionCalculatedStringResultParses calculated string.
javascriptParser.parseCommentOptions(range): { errors: (Error & { comment: CommentJavascriptParser })[] | null; options: Record<string, any> | null }
Parses comment options.
javascriptParser.parseString(expression): string
ExpressionstringReturns parsed string.
javascriptParser.preWalkAssignmentExpression(expression): void
AssignmentExpressionPre walk assignment expression.
javascriptParser.preWalkBlockStatement(statement): void
BlockStatementPre walk block statement.
javascriptParser.preWalkCatchClause(catchClause): void
CatchClausePre walk catch clause.
javascriptParser.preWalkDoWhileStatement(statement): void
DoWhileStatementPre walk do while statement.
javascriptParser.preWalkForInStatement(statement): void
ForInStatementPre walk for in statement.
javascriptParser.preWalkForOfStatement(statement): void
ForOfStatementPre walk for of statement.
javascriptParser.preWalkForStatement(statement): void
ForStatementPre walk for statement.
javascriptParser.preWalkFunctionDeclaration(statement): void
FunctionDeclaration | MaybeNamedFunctionDeclarationPre walk function declaration.
javascriptParser.preWalkIfStatement(statement): void
IfStatementPre walk if statement.
javascriptParser.preWalkLabeledStatement(statement): void
LabeledStatementPre walk labeled statement.
javascriptParser.preWalkStatement(statement): void
ClassDeclaration | 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 | VariableDeclarationWalking iterates the statements and expressions and processes them
javascriptParser.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)[]Pre walking iterates the scope for variable declarations
javascriptParser.preWalkSwitchCases(switchCases): void
SwitchCase[]Pre walk switch cases.
javascriptParser.preWalkSwitchStatement(statement): void
SwitchStatementPre walk switch statement.
javascriptParser.preWalkTryStatement(statement): void
TryStatementPre walk try statement.
javascriptParser.preWalkVariableDeclaration(statement): void
VariableDeclarationPre walk variable declaration.
javascriptParser.preWalkVariableDeclarator(declarator): void
VariableDeclaratorPre walk variable declarator.
javascriptParser.preWalkWhileStatement(statement): void
WhileStatementPre walk while statement.
javascriptParser.preWalkWithStatement(statement): void
WithStatementPre walk with statement.
javascriptParser.setAsiPosition(pos): void
numberUpdates asi position using the provided po.
javascriptParser.setVariable(name, variableInfo): void
stringExportedVariableInfoUpdates variable using the provided name.
javascriptParser.tagVariable(name, tag, data?, flags?): void
stringsymbolRecord<string, any> | TopLevelSymbol | HarmonySettings | ImportSettings | CommonJsImportSettings | CompatibilitySettings0 | 2 | 1 | 4Processes the provided name.
javascriptParser.undefineVariable(name): void
stringProcesses the provided name.
javascriptParser.unsetAsiPosition(pos): void
numberUnset asi position.
javascriptParser.walkArrayExpression(expression): void
ArrayExpressionWalk array expression.
javascriptParser.walkArrayPattern(pattern): void
ArrayPatternWalk array pattern.
javascriptParser.walkArrowFunctionExpression(expression): void
ArrowFunctionExpressionWalk arrow function expression.
javascriptParser.walkAssignmentExpression(expression): void
AssignmentExpressionWalk assignment expression.
javascriptParser.walkAssignmentPattern(pattern): void
AssignmentPatternWalk assignment pattern.
javascriptParser.walkAwaitExpression(expression): void
AwaitExpressionWalk await expression.
javascriptParser.walkBinaryExpression(expression): void
BinaryExpressionWalk binary expression.
javascriptParser.walkBlockStatement(statement): void
BlockStatement | StaticBlockWalk block statement.
javascriptParser.walkCallExpression(expression): void
CallExpressionWalk call expression.
javascriptParser.walkCatchClause(catchClause): void
CatchClauseProcesses the provided catch clause.
javascriptParser.walkChainExpression(expression): void
ChainExpressionWalk chain expression.
javascriptParser.walkClass(classy): void
ClassDeclaration | MaybeNamedClassDeclaration | ClassExpressionProcesses the provided classy.
javascriptParser.walkClassDeclaration(statement): void
ClassDeclaration | MaybeNamedClassDeclarationWalk class declaration.
javascriptParser.walkClassExpression(expression): void
ClassExpressionWalk class expression.
javascriptParser.walkConditionalExpression(expression): void
ConditionalExpressionWalk conditional expression.
javascriptParser.walkDoWhileStatement(statement): void
DoWhileStatementWalk do while statement.
javascriptParser.walkExportDefaultDeclaration(statement): void
ExportDefaultDeclarationWalk export default declaration.
javascriptParser.walkExportNamedDeclaration(statement): void
ExportNamedDeclarationWalk export named declaration.
javascriptParser.walkExpression(expression): 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 | PrivateIdentifier | SpreadElement | SuperProcesses the provided expression.
javascriptParser.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)[]Processes the provided expression.
javascriptParser.walkExpressionStatement(statement): void
ExpressionStatementWalk expression statement.
javascriptParser.walkForInStatement(statement): void
ForInStatementWalk for in statement.
javascriptParser.walkForOfStatement(statement): void
ForOfStatementWalk for of statement.
javascriptParser.walkForStatement(statement): void
ForStatementWalk for statement.
javascriptParser.walkFunctionDeclaration(statement): void
FunctionDeclaration | MaybeNamedFunctionDeclarationWalk function declaration.
javascriptParser.walkFunctionExpression(expression): void
FunctionExpressionWalk function expression.
javascriptParser.walkGuardedBranch(frame, walk): void
Walks a conditional branch with its guard frame (if any) pushed onto the parser-state guard stack for the duration of the branch body.
javascriptParser.walkIdentifier(expression): void
IdentifierProcesses the provided expression.
javascriptParser.walkIfStatement(statement): void
IfStatementProcesses the provided statement.
javascriptParser.walkImportExpression(expression): void
ImportExpressionJavascriptParserWalk import expression.
javascriptParser.walkLabeledStatement(statement): void
LabeledStatementWalk labeled statement.
javascriptParser.walkLeftRightExpression(expression): void
BinaryExpression | LogicalExpressionWalk left right expression.
javascriptParser.walkLogicalExpression(expression): void
LogicalExpressionWalk logical expression.
javascriptParser.walkMemberExpression(expression): void
MemberExpressionWalk member expression.
javascriptParser.walkMemberExpressionWithExpressionName(expression, name, rootInfo, members, onUnhandled): void
MemberExpressionstringstring | VariableInfostring[]() => R | undefinedWalk member expression with expression name.
javascriptParser.walkMetaProperty(metaProperty): void
MetaPropertyWalk meta property.
javascriptParser.walkNestedStatement(statement): void
StatementWalks 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.
javascriptParser.walkNewExpression(expression): void
NewExpressionWalk new expression.
javascriptParser.walkObjectExpression(expression): void
ObjectExpressionWalk object expression.
javascriptParser.walkObjectPattern(pattern): void
ObjectPatternWalk object pattern.
javascriptParser.walkPattern(pattern): void
PatternProcesses the provided pattern.
javascriptParser.walkProperty(prop): void
Property | SpreadElementProcesses the provided prop.
javascriptParser.walkRestElement(pattern): void
RestElementProcesses the provided pattern.
javascriptParser.walkReturnStatement(statement): void
ReturnStatementWalk return statement.
javascriptParser.walkSequenceExpression(expression): void
SequenceExpressionWalk sequence expression.
javascriptParser.walkSpreadElement(expression): void
SpreadElementWalk spread element.
javascriptParser.walkStatement(statement): void
ClassDeclaration | 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 | VariableDeclarationProcesses the provided statement.
javascriptParser.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)[]Walking iterates the statements and expressions and processes them
javascriptParser.walkSwitchCases(switchCases): void
SwitchCase[]Processes the provided switch case.
javascriptParser.walkSwitchStatement(statement): void
SwitchStatementWalk switch statement.
javascriptParser.walkTaggedTemplateExpression(expression): void
TaggedTemplateExpressionWalk tagged template expression.
javascriptParser.walkTemplateLiteral(expression): void
TemplateLiteralWalk template literal.
javascriptParser.walkTerminatingStatement(statement): void
ReturnStatement | ThrowStatementWalk terminating statement.
javascriptParser.walkThisExpression(expression): void
ThisExpressionWalk this expression.
javascriptParser.walkThrowStatement(statement): void
ThrowStatementWalk throw statement.
javascriptParser.walkTryStatement(statement): void
TryStatementWalk try statement.
javascriptParser.walkUnaryExpression(expression): void
UnaryExpressionWalk unary expression.
javascriptParser.walkUpdateExpression(expression): void
UpdateExpressionWalk update expression.
javascriptParser.walkVariableDeclaration(statement): void
VariableDeclarationWalk variable declaration.
javascriptParser.walkWhileStatement(statement): void
WhileStatementWalk while statement.
javascriptParser.walkWithStatement(statement): void
WithStatementWalk with statement.
javascriptParser.walkYieldExpression(expression): void
YieldExpressionWalk yield expression.
JavascriptParser.extend(...plugins?): typeof JavascriptParser
typeof JavascriptParserReturns parser.