Comparing version 3.17.0 to 4.0.0
# Changelog | ||
## v4.0.0 | ||
- **breaking change**: The `variables` property of all scopes has become a standard JavaScript `Map` as opposed to the old bespoke `Dictionary` object. | ||
- Typescript definitions were fixed | ||
- `terser --help` was fixed | ||
- The public interface was cleaned up | ||
- Fixed optimisation of `Array` and `new Array` | ||
- Added the `keep_quoted=strict` mode to mangle_props, which behaves more like Google Closure Compiler by mangling all unquoted property names, instead of reserving quoted property names automatically. | ||
- Fixed parent functions' parameters being shadowed in some cases | ||
- Allowed Terser to run in a situation where there are custom functions attached to Object.prototype | ||
- And more bug fixes, optimisations and internal changes | ||
## v3.17.0 | ||
@@ -4,0 +16,0 @@ |
@@ -7,3 +7,3 @@ { | ||
"license": "BSD-2-Clause", | ||
"version": "3.17.0", | ||
"version": "4.0.0", | ||
"engines": { | ||
@@ -37,3 +37,2 @@ "node": ">=6.0.0" | ||
"acorn": "^6.0.4", | ||
"cross-env": "^5.2.0", | ||
"csv": "^5.1.0", | ||
@@ -51,6 +50,8 @@ "escodegen": "^1.11.0", | ||
"scripts": { | ||
"test": "npm run prepare --silent && istanbul instrument dist/bundle.min.js > dist/bundle.instrumented.js && node test/run-tests.js", | ||
"test": "npm run build -- --silent --input=main.tests.js && npm run minify && node test/run-tests.js", | ||
"lint": "eslint lib", | ||
"lint-fix": "eslint --fix lib", | ||
"prepare": "rimraf dist/* && rollup -c && cd dist && cross-env TERSER_NO_BUNDLE=1 ../bin/uglifyjs bundle.js -mc --source-map 'content=bundle.js.map,includeSources=true,url=bundle.min.js.map' -o bundle.min.js", | ||
"build": "rimraf dist/* && rollup -c", | ||
"minify": "cd dist && node ../bin/uglifyjsnobundle bundle.js -mc --source-map content=bundle.js.map,includeSources=true -o bundle.min.js", | ||
"prepare": "npm run build && npm run minify", | ||
"postversion": "echo 'Remember to update the changelog!'" | ||
@@ -57,0 +58,0 @@ }, |
@@ -0,5 +1,11 @@ | ||
# Our patrons | ||
These are the first-tier patrons from [Patreon](https://www.patreon.com/fabiosantoscode). My appreciation goes to everyone on this list for supporting the project! | ||
* 38elements | ||
* Alan Orozco | ||
* CKEditor | ||
* Mariusz Nowak | ||
* Philippe Léger | ||
* Piotrek Koszuliński | ||
* Viktor Hubert |
@@ -8,3 +8,3 @@ terser | ||
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/fabiosantoscode"><img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" alt="patron" width="100px" height="auto"></a>. Check out PATRONS.md for our first-tier patrons. | ||
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/fabiosantoscode"><img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" alt="patron" width="100px" height="auto"></a>. Check out [PATRONS.md](https://github.com/terser-js/terser/blob/master/PATRONS.md) for our first-tier patrons. | ||
@@ -27,3 +27,3 @@ Terser recommends you use RollupJS to bundle your modules, as that produces smaller code overall. | ||
**`terser`** is a fork of `uglify-es` that retains API and CLI compatibility | ||
**`terser`** is a fork of `uglify-es` that mostly retains API and CLI compatibility | ||
with `uglify-es` and `uglify-js@3`. | ||
@@ -91,3 +91,6 @@ | ||
with DOM properties. | ||
`keep_quoted` Only mangle unquoted properties. | ||
`keep_quoted` Only mangle unquoted properties, quoted | ||
properties are automatically reserved. | ||
`strict` disables quoted properties | ||
being automatically reserved. | ||
`regex` Only mangle matched property names. | ||
@@ -934,14 +937,17 @@ `reserved` List of names that should not be mangled. | ||
- `builtins` (default: `false`) -- Use `true` to allow the mangling of builtin | ||
- `builtins` (default: `false`) — Use `true` to allow the mangling of builtin | ||
DOM properties. Not recommended to override this setting. | ||
- `debug` (default: `false`) -— Mangle names with the original name still present. | ||
- `debug` (default: `false`) — Mangle names with the original name still present. | ||
Pass an empty string `""` to enable, or a non-empty string to set the debug suffix. | ||
- `keep_quoted` (default: `false`) -— Only mangle unquoted property names. | ||
- `keep_quoted` (default: `false`) — Only mangle unquoted property names. | ||
- `true` -- Quoted property names are automatically reserved and any unquoted | ||
property names will not be mangled. | ||
- `"strict"` -- Advanced, all unquoted property names are mangled unless | ||
explicitly reserved. | ||
- `regex` (default: `null`) -— Pass a RegExp literal to only mangle property | ||
names matching the regular expression. | ||
- `regex` (default: `null`) — Pass a [RegExp literal or pattern string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) to only mangle property matching the regular expression. | ||
- `reserved` (default: `[]`) -- Do not mangle property names listed in the | ||
- `reserved` (default: `[]`) — Do not mangle property names listed in the | ||
`reserved` array. | ||
@@ -1305,6 +1311,7 @@ | ||
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/terser_ecmacomp_maintainer"><img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" alt="patron" width="100px" height="auto"></a>. Check out PATRONS.md for our first-tier patrons. | ||
*note*: You can support this project on patreon: <a target="_blank" rel="nofollow" href="https://www.patreon.com/fabiosantoscode"><img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" alt="patron" width="100px" height="auto"></a>. Check out [PATRONS.md](https://github.com/terser-js/terser/blob/master/PATRONS.md) for our first-tier patrons. | ||
These are the second-tier patrons. Great thanks for your support! | ||
* CKEditor ![](https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInciOjEwMH0%3D/patreon-media/p/user/15452278/f8548dcf48d740619071e8d614459280/1?token-time=2145916800&token-hash=SIQ54PhIPHv3M7CVz9LxS8_8v4sOw4H304HaXsXj8MM%3D) | ||
* 38elements ![](https://c10.patreonusercontent.com/3/eyJ3IjoyMDB9/patreon-media/p/user/12501844/88e7fc5dd62d45c6a5626533bbd48cfb/1?token-time=2145916800&token-hash=c3AsQ5T0IQWic0zKxFHu-bGGQJkXQFvafvJ4bPerFR4%3D) |
@@ -1,22 +0,19 @@ | ||
var fs = require("fs"); | ||
import { minify } from "../lib/minify"; | ||
var bundle_path = __dirname + "/../dist/bundle.js"; | ||
var UglifyJS = require(bundle_path); | ||
module.exports = UglifyJS; | ||
export function default_options() { | ||
const defs = {}; | ||
Object.keys(infer_options({ 0: 0 })).forEach((component) => { | ||
const options = infer_options({ | ||
[component]: {0: 0} | ||
}); | ||
if (options) defs[component] = options; | ||
}); | ||
return defs; | ||
} | ||
function infer_options(options) { | ||
var result = UglifyJS.minify("", options); | ||
var result = minify("", options); | ||
return result.error && result.error.defs; | ||
} | ||
UglifyJS.default_options = function() { | ||
var defs = {}; | ||
Object.keys(infer_options({ 0: 0 })).forEach(function(component) { | ||
var options = {}; | ||
options[component] = { 0: 0 }; | ||
if (options = infer_options(options)) { | ||
defs[component] = options; | ||
} | ||
}); | ||
return defs; | ||
}; |
@@ -0,1 +1,3 @@ | ||
/// <reference lib="es2015" /> | ||
import { RawSourceMap } from 'source-map'; | ||
@@ -18,2 +20,3 @@ | ||
comparisons?: boolean; | ||
computed_props?: boolean; | ||
conditionals?: boolean; | ||
@@ -25,2 +28,3 @@ dead_code?: boolean; | ||
drop_debugger?: boolean; | ||
ecma?: ECMA; | ||
evaluate?: boolean; | ||
@@ -40,2 +44,3 @@ expression?: boolean; | ||
loops?: boolean; | ||
module?: boolean; | ||
negate_iife?: boolean; | ||
@@ -89,3 +94,3 @@ passes?: number; | ||
keep_quoted?: boolean; | ||
regex?: RegExp; | ||
regex?: RegExp | string; | ||
reserved?: string[]; | ||
@@ -186,17 +191,2 @@ } | ||
type DictEachCallback = (val: any, key: string) => any; | ||
export class Dictionary { | ||
static fromObject(obj: object): Dictionary; | ||
add(key: string, val: any): this; | ||
clone(): Dictionary; | ||
del(key: string): this; | ||
each(fn: DictEachCallback): void; | ||
get(key: string): any; | ||
has(key: string): boolean; | ||
map(fn: DictEachCallback): any[]; | ||
set(key: string, val: any): this; | ||
size(): number; | ||
} | ||
export function minify(files: string | string[] | { [file: string]: string } | AST_Node, options?: MinifyOptions): MinifyOutput; | ||
@@ -203,0 +193,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
11
1313
1
10
3976184
27076