Skip to content

Latest commit

 

History

History
 
 

rspack_ast_viewer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

rspack-ast-viewer

Print AST generated by SWC.

Options

  • -k, --keep-span: keep span information from the AST (default: false)

Example

Input:

echo "var a = 123" | cargo run -p rspack_ast_viewer

Output:

Module(
    Module {
        body: [
            Stmt(
                Decl(
                    Var(
                        VarDecl {
                            kind: "var",
                            declare: false,
                            decls: [
                                VarDeclarator {
                                    name: Ident(
                                        BindingIdent {
                                            id: Ident {
                                                sym: Atom('abc' type=inline),
                                                optional: false,
                                            },
                                            type_ann: None,
                                        },
                                    ),
                                    init: Some(
                                        Lit(
                                            Num(
                                                Number {
                                                    value: 123.0,
                                                    raw: Some(
                                                        "123",
                                                    ),
                                                },
                                            ),
                                        ),
                                    ),
                                    definite: false,
                                },
                            ],
                        },
                    ),
                ),
            ),
        ],
        shebang: None,
    },
)