swc/crates/swc_ecma_minifier/scripts/_/reduce/compare.js
Donny/강동윤 1c1c9f0eae
fix(es/minifier): Fix bugs (#2955)
swc_ecma_minifier:
 - Improve the script for extracting inputs from next.js app.
 - Ensure the name is removed on inlining.
 - Respect `inline_prevented`.
2022-01-05 05:12:52 +09:00

15 lines
502 B
JavaScript
Executable File

#!/usr/bin/env node
const { readFileSync } = require('fs');
const { parseModule } = require('esprima');
const { notDeepEqual } = require('assert');
let [ast1, ast2] =
process.argv.slice(2) // skip node executable and script filename
.map(file => readFileSync(file, 'utf-8')) // read given files as strings
.map(code => {
console.log(code);
return parseModule(code)
}); // parse into ASTs
notDeepEqual(ast1, ast2); // ensure they're still not equal