Socket
Socket
Sign inDemoInstall

terser

Package Overview
Dependencies
4
Maintainers
1
Versions
171
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.16.1 to 3.17.0

11

CHANGELOG.md
# Changelog
## v3.17.0
- More DOM properties added to --mangle-properties's DOM property list
- Closed issue where if 2 functions had the same argument name, Terser would not inline them together properly
- Fixed issue with `hasOwnProperty.call`
- You can now list files to minify in a Terser config file
- Started replacing `new Array(<number>)` with an array literal
- Started using ES6 capabilities like `Set` and the `includes` method for strings and arrays
## v3.16.1
- Fixed issue where Terser being imported with `import` would cause it not to work due to the `__esModule` property.
- Fixed issue where Terser being imported with `import` would cause it not to work due to the `__esModule` property. (PR #254 was submitted, which was nice, but since it wasn't a pure commonJS approach I decided to go with my own solution)

@@ -7,0 +16,0 @@ ## v3.16.0

31

package.json

@@ -7,3 +7,3 @@ {

"license": "BSD-2-Clause",
"version": "3.16.1",
"version": "3.17.0",
"engines": {

@@ -13,5 +13,3 @@ "node": ">=6.0.0"

"maintainers": [
"Fábio Santos <fabiosantosart@gmail.com>",
"Alex Lam <alexlamsl@gmail.com>",
"Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)"
"Fábio Santos <fabiosantosart@gmail.com>"
],

@@ -27,3 +25,2 @@ "repository": "https://github.com/fabiosantoscode/terser.git",

"dist",
"!dist/bundle.instrumented.js",
"tools",

@@ -36,16 +33,13 @@ "LICENSE",

"dependencies": {
"commander": "~2.17.1",
"commander": "^2.19.0",
"source-map": "~0.6.1",
"source-map-support": "~0.5.9"
"source-map-support": "~0.5.10"
},
"devDependencies": {
"acorn": "^6.0.4",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"csv": "^5.1.0",
"es6-promise": "^4.2.5",
"escodegen": "^1.11.0",
"eslint": "^4.19.1",
"eslump": "^2.0.0",
"istanbul": "^0.4.5",
"mocha": "^3.0.0",

@@ -56,11 +50,9 @@ "mochallel": "^1.8.6",

"rollup": "^1.0.1",
"semver": "~5.5.1"
"semver": "~5.6.0"
},
"scripts": {
"test": "rimraf dist/* && npm run prepare && istanbul instrument dist/bundle.min.js > dist/bundle.instrumented.js && node test/run-tests.js",
"coverage": "istanbul cover test/run-tests.js",
"coveralls": "coveralls < coverage/lcov.info",
"test": "npm run prepare --silent && istanbul instrument dist/bundle.min.js > dist/bundle.instrumented.js && node test/run-tests.js",
"lint": "eslint lib",
"lint-fix": "eslint --fix lib",
"prepare": "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",
"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",
"postversion": "echo 'Remember to update the changelog!'"

@@ -91,2 +83,11 @@ },

},
"env": {
"es6": true
},
"globals": {
"describe": false,
"it": false,
"require": false,
"global": false
},
"rules": {

@@ -93,0 +94,0 @@ "brace-style": [

@@ -8,3 +8,3 @@ terser

*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 for our first-tier patrons.

@@ -15,7 +15,9 @@ Terser recommends you use RollupJS to bundle your modules, as that produces smaller code overall.

[![Build Status](https://travis-ci.org/terser-js/terser.svg?branch=master)](https://travis-ci.org/terser-js/terser) [![Coverage Status](https://coveralls.io/repos/github/terser-js/terser/badge.svg?branch=master)](https://coveralls.io/github/terser-js/terser?branch=master)
[![Build Status](https://travis-ci.org/terser-js/terser.svg?branch=master)](https://travis-ci.org/terser-js/terser)
Find the changelog in [CHANGELOG.md](https://github.com/terser-js/terser/blob/master/CHANGELOG.md)
A JavaScript parser, mangler/compressor and beautifier toolkit for ES6+.
Why choose terser?

@@ -92,2 +94,3 @@ ------------------

`reserved` List of names that should not be mangled.
-b, --beautify [options] Specify output options:
`preamble` Preamble to prepend to the output. You

@@ -245,8 +248,25 @@ can use this to insert a comment, for

**Note:** THIS *MIGHT* BREAK YOUR CODE. Mangling property names
is a separate step, different from variable name mangling. Pass
`--mangle-props` to enable it. It will mangle all properties in the
**Note:** THIS **WILL** BREAK YOUR CODE. A good rule of thumb is not to use this unless you know exactly what you're doing and how this works and read this section until the end.
Mangling property names is a separate step, different from variable name mangling. Pass
`--mangle-props` to enable it. The least dangerous
way to use this is to use the `regex` option like so:
```
terser example.js -c -m --mangle-props regex=/_$/
```
This will mangle all properties that start with an
underscore. So you can use it to mangle internal methods.
By default, it will mangle all properties in the
input code with the exception of built in DOM properties and properties
in core JavaScript classes. For example:
in core JavaScript classes, which is what will break your code if you don't:
1. Control all the code you're mangling
2. Avoid using a module bundler, as they usually will call Terser on each file individually, making it impossible to pass mangled objects between modules.
3. Avoid calling functions like `defineProperty` or `hasOwnProperty`, because they refer to object properties using strings and will break your code if you don't know what you are doing.
An example:
```javascript

@@ -265,3 +285,3 @@ // example.js

```
Mangle all properties (except for JavaScript `builtins`):
Mangle all properties (except for JavaScript `builtins`) (**very** unsafe):
```bash

@@ -273,3 +293,3 @@ $ terser example.js -c -m --mangle-props

```
Mangle all properties except for `reserved` properties:
Mangle all properties except for `reserved` properties (still very unsafe):
```bash

@@ -281,3 +301,3 @@ $ terser example.js -c -m --mangle-props reserved=[foo_,bar_]

```
Mangle all properties matching a `regex`:
Mangle all properties matching a `regex` (not as unsafe but still unsafe):
```bash

@@ -476,2 +496,3 @@ $ terser example.js -c -m --mangle-props regex=/_$/

output: {
beautify: false,
preamble: "/* minified */"

@@ -934,3 +955,4 @@ }

The code generator tries to output shortest code possible. Optionally you
The code generator tries to output shortest code possible by default. In
case you want beautified output, pass `--beautify` (`-b`). Optionally you
can pass additional arguments that control the code output:

@@ -941,2 +963,7 @@

- `beautify` (default `true`) -- whether to actually beautify the output.
Passing `-b` will set this to true, but you might need to pass `-b` even
when you want to generate minified code, in order to specify additional
arguments, so you can use `-b beautify=false` to override it.
- `braces` (default `false`) -- always insert braces in `if`, `for`,

@@ -952,3 +979,4 @@ `do`, `while` or `with` statements, even if their body is a single

greater to emit shorthand object properties - i.e.: `{a}` instead of `{a: a}`.
Non-compatible features in the abstract syntax tree will still
The `ecma` option will only change the output in direct control of the
beautifier. Non-compatible features in the abstract syntax tree will still
be output as is. For example: an `ecma` setting of `5` will **not** convert

@@ -955,0 +983,0 @@ ES6+ code to ES5.

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc