Platform-specific native binary for SWC TypeScript/JavaScript compiler on macOS ARM64 architecture
89
Build a tool that parses JavaScript code into an Abstract Syntax Tree (AST) and then converts the AST back into formatted JavaScript source code.
const x = 5; and printing the resulting AST produces valid JavaScript code @testfunction add(a, b) { return a + b; } and printing the resulting AST produces valid JavaScript code @testconst elem = <div>Hello</div>; and printing the resulting AST produces valid JSX code @testlet name = "Alice"; produces the expected output synchronously @test@generates
/**
* Parses JavaScript code to AST and prints it back to source code.
*
* @param {string} code - The JavaScript code to parse and print.
* @returns {Promise<string>} The generated source code.
*/
async function parseAndPrint(code) {
// IMPLEMENTATION HERE
}
/**
* Synchronously parses JavaScript code to AST and prints it back to source code.
*
* @param {string} code - The JavaScript code to parse and print.
* @returns {string} The generated source code.
*/
function parseAndPrintSync(code) {
// IMPLEMENTATION HERE
}
module.exports = {
parseAndPrint,
parseAndPrintSync,
};Provides fast JavaScript/TypeScript parsing and code generation capabilities.
Install with Tessl CLI
npx tessl i tessl/npm-swc--core-darwin-arm64docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10