reluxscript 0.1.4

Write AST transformations once. Compile to Babel, SWC, and beyond.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Test file for inline imports
/// Tests the ability to use imports inside function bodies

plugin TestInlineImports {
    fn visit_identifier(node: &mut Identifier) {
        // Inline import to avoid circular dependencies
        use fs;

        let result = fs::write("test.txt", "hello");
    }

    fn visit_string_literal(node: &mut StringLiteral) {
        // Another inline import with named imports
        use json { parse, stringify };

        let data = stringify(&node.value);
    }
}