swc/crates/swc_estree_compat/scripts/test-acorn.js
Donny/강동윤 586ab0cf76
fix(webpack/ast): Adjust acorn options. (#2908)
swc_babel_ast:
 - Fix serialization of class properties.
 - Adjust `acorn` options.
2021-11-29 21:08:22 +09:00

15 lines
348 B
JavaScript

// File to parse input as an AST using acorn
const parserOptions = {
ranges: true,
locations: true,
ecmaVersion: "latest",
// https://github.com/tc39/proposal-hashbang
allowHashBang: true,
};
const acorn = require("acorn");
const res = acorn.parse(process.argv[1], parserOptions)
console.log(JSON.stringify(res, void 0, 2));