mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 13:11:31 +03:00
fa342a0067
swc_ecma_minifier: - Don't optimize `1 / t == -1 / 0` as `!1`. - Don't optimize `e === -1 / 0` as false. - Don't inline string literals in arguments, if it's used multiple time. (https://github.com/vercel/next.js/issues/31291)
26 lines
685 B
JavaScript
26 lines
685 B
JavaScript
const readline = require('readline');
|
|
const fs = require('fs').promises;
|
|
const path = require('path');
|
|
|
|
const rl = readline.createInterface({
|
|
input: process.stdin,
|
|
output: process.stdout,
|
|
terminal: false
|
|
});
|
|
|
|
rl.on('line', async (data) => {
|
|
try {
|
|
const { name, source } = eval(`(${data})`)
|
|
const targetPath = path.join(__dirname, '..', '..', 'tests', 'compress', 'fixture', 'issues', 'next', name.replace('.js', ''), 'input.js');
|
|
|
|
|
|
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
|
|
await fs.writeFile(targetPath, source, 'utf8');
|
|
} catch (e) {
|
|
console.log(`Code: (${data})`)
|
|
console.error(e);
|
|
}
|
|
})
|
|
|