INNER CODE UNIT · JavaScript
main
Fausto-404/js-reverse-automation--skill · js-reverse-automation/scripts/ast_candidate_analyzer.js:109
function main() {
const opt = args();
const code = fs.readFileSync(opt.input, "utf8");
const map = new Map();
if (babelParser) analyzeWithBabel(code, map);
else analyzeFallback(code, map);
const result = {
input: path.resolve(opt.input),
parser_mode: babelParser ? "babel" : "fallback-regex",
candidates: Array.from(map.values())
};
fs.mkdirSync(path.dirname(opt.output), { recursive: true });
fs.writeFileSync(opt.output, JSON.stringify(result, null, 2) + "\n");
console.log(JSON.stringify({
status: "ok",