Skip to content
Botaro Shinomiya edited this page Dec 29, 2024 · 1 revision

Welcome, This is Estige Wiki! In this page, you will learn the essentials to use Estige.

Installation

Open your favorite terminal (mine's kitty btw) and run this command:

npm install estige

After installation, you can use Estige however you want :3

Import

You can import like so in CommonJS:

// Classic
const Estige = require( 'estige' );
// Partial
const { Traverser, Mangler, Optimizer, AST } = require( 'estige' );

What is all of this?

Estige has a Traverser, Mangler, Optimizer and some AST utilities. Traverser is for going through all of the AST nodes inside an AST node recursively. Mangler is for mangling property names inside an AST without breaking anything apart. Optimizer is a basic optimizer that will fix a dev's issues (in AST of course haha). AST utilites are for creating AST nodes out of Javascript/ECMAScript built-in types.

Descriptor

ASTManager -> class {
    clone():  ASTNode
    remove(): boolean
    modify( obj: ASTNode, surfaceLevel: boolean = false ): void
    replace( obj: ASTNode | ASTNode[] ): ( ASTNode | ASTNode[] )
    get self(): ASTNode
}

TraverserFunction           ->  function ( node: ASTNode, manager: ASTManager )

Estige.Mangler.mangle       ->  function ( ast: Program | ASTNode, setup: { reserved: string[] } ): ( Program | ASTNode )
Estige.Optimizer.optimize   ->  function ( ast: Program | ASTNode ): ( Program | ASTNode )
Estige.Traverser.traverse   ->  function ( ast: Program | ASTNode, callback: Function | Object<ASTType of TraverserFunction>, setup: { destructive: boolean = false } ): ( Program | ASTNode )
Estige.Traverser.watch      ->  function ( ast: Program | ASTNode, callback: Function | Object<ASTType of TraverserFunction> ): ( Program | ASTNode )

Clone this wiki locally