Global

Methods

plugin() → {BabelPluginTransformClassInjectDirective}

Source:

Generates the object that Babel will load in order to hook the parser for every functions and methods are being processed.

Returns:
Type
BabelPluginTransformClassInjectDirective

Type Definitions

BabelPluginTransformClassInjectDirective

Source:
Properties:
Name Type Description
visitor Visitors

A dictionary with keys for each object type Babel processes. In the case of this plugin, it only has keys for methods and functions.

Type:

ClassMethodVisitor

Source:
Properties:
Name Type Description
enter ParserCallback

This is called when Babel starts processing the method.

Type:

FunctionDeclarationVisitor

Source:
Properties:
Name Type Description
enter ParserCallback

This is called when Babel starts processing the function.

Type:

FunctionExpressionVisitor

Source:
Properties:
Name Type Description
enter ParserCallback

This is called when Babel starts processing the function.

Type:

ParserCallback(path)

Source:
Parameters:
Name Type Description
path Path

The Babel information for the object that is currently being processed.

Throws:

If called before ProgramVisitorStart.

Type
Error

ProgramVisitor

Source:
Properties:
Name Type Description
enter ProgramVisitorStart

This method is called when Babel starts processing a file. It takes care of creating an instance of InjectDirectiveParser so the other ParserCallback can use.

exit ProgramVisitorFinish

This method is called when Babel finishes processing a file. After parsing all available methods and functions, it uses the instance of InjectDirectiveParser to apply the changes on the code.

Type:

ProgramVisitorFinish()

Source:
Throws:

if called before ProgramVisitorStart

Type
error

ProgramVisitorStart()

Source:

Visitors

Source:
Properties:
Name Type Description
ClassMethod ClassMethodVisitor

The methods inside this object are only called when Babel is processing a class method.

FunctionDeclaration FunctionDeclarationVisitor

The methods inside this object are only called when Babel is processing a function declaration (function name (...) { }).

FunctionExpression FunctionExpressionVisitor

The methods inside this object are only called when Babel is processing a function expression (const name = function (...) { }).

Program ProgramVisitor

The methods inside this object are called when Babel starts and finishes processing file.

Type: