terser
Advanced tools
Comparing version 5.19.4 to 5.20.0
# Changelog | ||
## v5.20.0 | ||
- Passing `minify()` zero files will now throw a clean exception (#1450) | ||
- `drop_console` supports passing in an array of `console.*` method names (#1445) | ||
- New DOM properties from the WebGPU API have been added for use in the property mangler (#1436) | ||
- Internal code simplification (#1437) | ||
## v5.19.4 | ||
@@ -4,0 +10,0 @@ - Prevent creating very deeply nested ternaries from a long list of `if..return` |
@@ -233,2 +233,5 @@ "use strict"; | ||
} | ||
if (options.parse.toplevel === null) { | ||
throw new Error("no source file given"); | ||
} | ||
@@ -235,0 +238,0 @@ toplevel = options.parse.toplevel; |
@@ -169,6 +169,4 @@ /*********************************************************************** | ||
var normalize_directives = function(body) { | ||
var in_directive = true; | ||
for (var i = 0; i < body.length; i++) { | ||
if (in_directive && body[i] instanceof AST_Statement && body[i].body instanceof AST_String) { | ||
if (body[i] instanceof AST_Statement && body[i].body instanceof AST_String) { | ||
body[i] = new AST_Directive({ | ||
@@ -179,4 +177,4 @@ start: body[i].start, | ||
}); | ||
} else if (in_directive && !(body[i] instanceof AST_Statement && body[i].body instanceof AST_String)) { | ||
in_directive = false; | ||
} else { | ||
return body; | ||
} | ||
@@ -183,0 +181,0 @@ } |
@@ -7,3 +7,3 @@ { | ||
"license": "BSD-2-Clause", | ||
"version": "5.19.4", | ||
"version": "5.20.0", | ||
"engines": { | ||
@@ -10,0 +10,0 @@ "node": ">=10" |
@@ -420,3 +420,3 @@ <h1><img src="https://terser.org/img/terser-banner-logo.png" alt="Terser" width="400"></h1> | ||
Browser loading is also supported: | ||
Browser loading is also supported. It exposes a global variable `Terser` containing a `.minify` property: | ||
```html | ||
@@ -733,5 +733,4 @@ <script src="https://cdn.jsdelivr.net/npm/source-map@0.7.3/dist/source-map.js"></script> | ||
- `drop_console` (default: `false`) -- Pass `true` to discard calls to | ||
`console.*` functions. If you wish to drop a specific function call | ||
such as `console.info` and/or retain side effects from function arguments | ||
after dropping the function call then use `pure_funcs` instead. | ||
`console.*` functions. If you only want to discard a portion of console, | ||
you can pass an array like this `['log', 'info']`, which will only discard `console.log`、 `console.info`. | ||
@@ -738,0 +737,0 @@ - `drop_debugger` (default: `true`) -- remove `debugger;` statements |
@@ -7,2 +7,5 @@ /// <reference lib="es2015" /> | ||
export type ConsoleProperty = keyof typeof console; | ||
type DropConsoleOption = boolean | ConsoleProperty[]; | ||
export interface ParseOptions { | ||
@@ -28,3 +31,3 @@ bare_returns?: boolean; | ||
directives?: boolean; | ||
drop_console?: boolean; | ||
drop_console?: DropConsoleOption; | ||
drop_debugger?: boolean; | ||
@@ -31,0 +34,0 @@ ecma?: ECMA; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
2114383
60161
6
41
1416
32