mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
41 lines
754 B
TypeScript
41 lines
754 B
TypeScript
/// <reference types="node" />
|
|
|
|
import { OutputQuoteStyle, minify } from 'uglify-js';
|
|
|
|
let code: any;
|
|
|
|
code = {
|
|
"file1.js": "function add(first, second) { return first + second; }",
|
|
"file2.js": "console.log(add(1 + 2, 3 + 4));"
|
|
};
|
|
|
|
minify(code);
|
|
|
|
code = "function add(first, second) { return first + second; }";
|
|
minify(code);
|
|
|
|
minify(code, {
|
|
output: {
|
|
quote_style: OutputQuoteStyle.AlwaysDouble
|
|
}
|
|
});
|
|
|
|
const output = minify(code, {
|
|
warnings: 'verbose',
|
|
mangle: {
|
|
properties: {
|
|
regex: /reg/
|
|
}
|
|
},
|
|
sourceMap: {
|
|
filename: 'foo.map'
|
|
},
|
|
compress: {
|
|
arguments: true
|
|
}
|
|
});
|
|
|
|
if (output.warnings) {
|
|
output.warnings.filter(x => x === 'Dropping unused variable');
|
|
}
|