UNPKG

16.1 kBMarkdownView Raw
1# Changelog
2
3## v5.3.6
4
5 - Fixed parentheses when outputting `??` mixed with `||` and `&&`
6 - Improved hygiene of the symbol generator
7
8## v5.3.5
9
10 - Avoid moving named functions into default exports.
11 - Enabled transform() for chain expressions. This allows AST transformers to reach inside chain expressions.
12
13## v5.3.4
14
15 - Fixed a crash when hoisting (with `hoist_vars`) a destructuring variable declaration
16
17## v5.3.3
18
19 - `source-map` library has been updated, bringing memory usage and CPU time improvements when reading input source maps (the SourceMapConsumer is now WASM based).
20 - The `wrap_func_args` option now also wraps arrow functions, as opposed to only function expressions.
21
22## v5.3.2
23
24 - Prevented spread operations from being expanded when the expanded array/object contains getters, setters, or array holes.
25 - Fixed _very_ slow self-recursion in some cases of removing extraneous parentheses from `+` operations.
26
27## v5.3.1
28
29 - An issue with destructuring declarations when `pure_getters` is enabled has been fixed
30 - Fixed a crash when chain expressions need to be shallowly compared
31 - Made inlining functions more conservative to make sure a function that contains a reference to itself isn't moved into a place that can create multiple instances of itself.
32
33## v5.3.0
34
35 - Fixed a crash when compressing object spreads in some cases
36 - Fixed compiletime evaluation of optional chains (caused typeof a?.b to always return "object")
37 - domprops has been updated to contain every single possible prop
38
39## v5.2.1
40
41 - The parse step now doesn't accept an `ecma` option, so that all ES code is accepted.
42 - Optional dotted chains now accept keywords, just like dotted expressions (`foo?.default`)
43
44## v5.2.0
45
46 - Optional chaining syntax is now supported.
47 - Consecutive await expressions don't have unnecessary parens
48 - Taking the variable name's length (after mangling) into consideration when deciding to inline
49
50## v5.1.0
51
52 - `import.meta` is now supported
53 - Typescript typings have been improved
54
55## v5.0.0
56
57 - `in` operator now taken into account during property mangle.
58 - Fixed infinite loop in face of a reference loop in some situations.
59 - Kept exports and imports around even if there's something which will throw before them.
60 - The main exported bundle for commonjs, dist/bundle.min.js is no longer minified.
61
62## v5.0.0-beta.0
63
64 - BREAKING: `minify()` is now async and rejects a promise instead of returning an error.
65 - BREAKING: Internal AST is no longer exposed, so that it can be improved without releasing breaking changes.
66 - BREAKING: Lowest supported node version is 10
67 - BREAKING: There are no more warnings being emitted
68 - Module is now distributed as a dual package - You can `import` and `require()` too.
69 - Inline improvements were made
70
71## v4.8.0
72
73 - Support for numeric separators (`million = 1_000_000`) was added.
74 - Assigning properties to a class is now assumed to be pure.
75 - Fixed bug where `yield` wasn't considered a valid property key in generators.
76
77## v4.7.0
78
79 - A bug was fixed where an arrow function would have the wrong size
80 - `arguments` object is now considered safe to retrieve properties from (useful for `length`, or `0`) even when `pure_getters` is not set.
81 - Fixed erroneous `const` declarations without value (which is invalid) in some corner cases when using `collapse_vars`.
82
83## v4.6.13
84
85 - Fixed issue where ES5 object properties were being turned into ES6 object properties due to more lax unicode rules.
86 - Fixed parsing of BigInt with lowercase `e` in them.
87
88## v4.6.12
89
90 - Fixed subtree comparison code, making it see that `[1,[2, 3]]` is different from `[1, 2, [3]]`
91 - Printing of unicode identifiers has been improved
92
93## v4.6.11
94
95 - Read unused classes' properties and method keys, to figure out if they use other variables.
96 - Prevent inlining into block scopes when there are name collisions
97 - Functions are no longer inlined into parameter defaults, because they live in their own special scope.
98 - When inlining identity functions, take into account the fact they may be used to drop `this` in function calls.
99 - Nullish coalescing operator (`x ?? y`), plus basic optimization for it.
100 - Template literals in binary expressions such as `+` have been further optimized
101
102## v4.6.10
103
104 - Do not use reduce_vars when classes are present
105
106## v4.6.9
107
108 - Check if block scopes actually exist in blocks
109
110## v4.6.8
111
112 - Take into account "executed bits" of classes like static properties or computed keys, when checking if a class evaluation might throw or have side effects.
113
114## v4.6.7
115
116 - Some new performance gains through a `AST_Node.size()` method which measures a node's source code length without printing it to a string first.
117 - An issue with setting `--comments` to `false` in the CLI has been fixed.
118 - Fixed some issues with inlining
119 - `unsafe_symbols` compress option was added, which turns `Symbol("name")` into just `Symbol()`
120 - Brought back compress performance improvement through the `AST_Node.equivalent_to(other)` method (which was reverted in v4.6.6).
121
122## v4.6.6
123
124(hotfix release)
125
126 - Reverted code to 4.6.4 to allow for more time to investigate an issue.
127
128## v4.6.5 (REVERTED)
129
130 - Improved compress performance through using a new method to see if two nodes are equivalent, instead of printing them to a string.
131
132## v4.6.4
133
134 - The `"some"` value in the `comments` output option now preserves `@lic` and other important comments when using `//`
135 - `</script>` is now better escaped in regex, and in comments, when using the `inline_script` output option
136 - Fixed an issue when transforming `new RegExp` into `/.../` when slashes are included in the source
137 - `AST_Node.prototype.constructor` now exists, allowing for easier debugging of crashes
138 - Multiple if statements with the same consequents are now collapsed
139 - Typescript typings improvements
140 - Optimizations while looking for surrogate pairs in strings
141
142## v4.6.3
143
144 - Annotations such as `/*#__NOINLINE__*/` and `/*#__PURE__*/` may now be preserved using the `preserve_annotations` output option
145 - A TypeScript definition update for the `keep_quoted` output option.
146
147## v4.6.2
148
149 - A bug where functions were inlined into other functions with scope conflicts has been fixed.
150 - `/*#__NOINLINE__*/` annotation fixed for more use cases where inlining happens.
151
152## v4.6.1
153
154 - Fixed an issue where a class is duplicated by reduce_vars when there's a recursive reference to the class.
155
156## v4.6.0
157
158 - Fixed issues with recursive class references.
159 - BigInt evaluation has been prevented, stopping Terser from evaluating BigInts like it would do regular numbers.
160 - Class property support has been added
161
162## v4.5.1
163
164(hotfix release)
165
166 - Fixed issue where `() => ({})[something]` was not parenthesised correctly.
167
168## v4.5.0
169
170 - Inlining has been improved
171 - An issue where keep_fnames combined with functions declared through variables was causing name shadowing has been fixed
172 - You can now set the ES version through their year
173 - The output option `keep_numbers` has been added, which prevents Terser from turning `1000` into `1e3` and such
174 - Internal small optimisations and refactors
175
176## v4.4.3
177
178 - Number and BigInt parsing has been fixed
179 - `/*#__INLINE__*/` annotation fixed for arrow functions with non-block bodies.
180 - Functional tests have been added, using [this repository](https://github.com/terser/terser-functional-tests).
181 - A memory leak, where the entire AST lives on after compression, has been plugged.
182
183## v4.4.2
184
185 - Fixed a problem with inlining identity functions
186
187## v4.4.1
188
189*note:* This introduced a feature, therefore it should have been a minor release.
190
191 - Fixed a crash when `unsafe` was enabled.
192 - An issue has been fixed where `let` statements might be collapsed out of their scope.
193 - Some error messages have been improved by adding quotes around variable names.
194
195## v4.4.0
196
197 - Added `/*#__INLINE__*/` and `/*#__NOINLINE__*/` annotations for calls. If a call has one of these, it either forces or forbids inlining.
198
199## v4.3.11
200
201 - Fixed a problem where `window` was considered safe to access, even though there are situations where it isn't (Node.js, workers...)
202 - Fixed an error where `++` and `--` were considered side-effect free
203 - `Number(x)` now needs both `unsafe` and and `unsafe_math` to be compressed into `+x` because `x` might be a `BigInt`
204 - `keep_fnames` now correctly supports regexes when the function is in a variable declaration
205
206## v4.3.10
207
208 - Fixed syntax error when repeated semicolons were encountered in classes
209 - Fixed invalid output caused by the creation of empty sequences internally
210 - Scopes are now updated when scopes are inlined into them
211
212## v4.3.9
213 - Fixed issue with mangle's `keep_fnames` option, introduced when adding code to keep variable names of anonymous functions
214
215## v4.3.8
216
217 - Typescript typings fix
218
219## v4.3.7
220
221 - Parsing of regex options in the CLI (which broke in v4.3.5) was fixed.
222 - typescript definition updates
223
224## v4.3.6
225
226(crash hotfix)
227
228## v4.3.5
229
230 - Fixed an issue with DOS line endings strings separated by `\` and a new line.
231 - Improved fix for the output size regression related to unused references within the extends section of a class.
232 - Variable names of anonymous functions (eg: `const x = () => { ... }` or `var func = function () {...}`) are now preserved when keep_fnames is true.
233 - Fixed performance degradation introduced for large payloads in v4.2.0
234
235## v4.3.4
236
237 - Fixed a regression where the output size was increased when unused classes were referred to in the extends clause of a class.
238 - Small typescript typings fixes.
239 - Comments with `@preserve`, `@license`, `@cc_on` as well as comments starting with `/*!` and `/**!` are now preserved by default.
240
241## v4.3.3
242
243 - Fixed a problem where parsing template strings would mix up octal notation and a slash followed by a zero representing a null character.
244 - Started accepting the name `async` in destructuring arguments with default value.
245 - Now Terser takes into account side effects inside class `extends` clauses.
246 - Added parens whenever there's a comment between a return statement and the returned value, to prevent issues with ASI.
247 - Stopped using raw RegExp objects, since the spec is going to continue to evolve. This ensures Terser is able to process new, unknown RegExp flags and features. This is a breaking change in the AST node AST_RegExp.
248
249## v4.3.2
250
251 - Typescript typing fix
252 - Ensure that functions can't be inlined, by reduce_vars, into places where they're accessing variables with the same name, but from somewhere else.
253
254## v4.3.1
255
256 - Fixed an issue from 4.3.0 where any block scope within a for loop erroneously had its parent set to the function scopee
257 - Fixed an issue where compressing IIFEs with argument expansions would result in some parameters becoming undefined
258 - addEventListener options argument's properties are now part of the DOM properties list.
259
260## v4.3.0
261
262 - Do not drop computed object keys with side effects
263 - Functions passed to other functions in calls are now wrapped in parentheses by default, which speeds up loading most modules
264 - Objects with computed properties are now less likely to be hoisted
265 - Speed and memory efficiency optimizations
266 - Fixed scoping issues with `try` and `switch`
267
268## v4.2.1
269
270 - Minor refactors
271 - Fixed a bug similar to #369 in collapse_vars
272 - Functions can no longer be inlined into a place where they're going to be compared with themselves.
273 - reduce_funcs option is now legacy, as using reduce_vars without reduce_funcs caused some weird corner cases. As a result, it is now implied in reduce_vars and can't be turned off without turning off reduce_vars.
274 - Bug which would cause a random stack overflow has now been fixed.
275
276## v4.2.0
277
278 - When the source map URL is `inline`, don't write it to a file.
279 - Fixed output parens when a lambda literal is the tag on a tagged template string.
280 - The `mangle.properties.undeclared` option was added. This enables the property mangler to mangle properties of variables which can be found in the name cache, but whose properties are not known to this Terser run.
281 - The v8 bug where the toString and source representations of regexes like `RegExp("\\\n")` includes an actual newline is now fixed.
282 - Now we're guaranteed to not have duplicate comments in the output
283 - Domprops updates
284
285## v4.1.4
286
287 - Fixed a crash when inlining a function into somewhere else when it has interdependent, non-removable variables.
288
289## v4.1.3
290
291 - Several issues with the `reduce_vars` option were fixed.
292 - Starting this version, we only have a dist/bundle.min.js
293
294## v4.1.2
295
296 - The hotfix was hotfixed
297
298## v4.1.1
299
300 - Fixed a bug where toplevel scopes were being mixed up with lambda scopes
301
302## v4.1.0
303
304 - Internal functions were replaced by `Object.assign`, `Array.prototype.some`, `Array.prototype.find` and `Array.prototype.every`.
305 - A serious issue where some ESM-native code was broken was fixed.
306 - Performance improvements were made.
307 - Support for BigInt was added.
308 - Inline efficiency was improved. Functions are now being inlined more proactively instead of being inlined only after another Compressor pass.
309
310## v4.0.2
311
312(Hotfix release. Reverts unmapped segments PR [#342](https://github.com/terser/terser/pull/342), which will be put back on Terser when the upstream issue is resolved)
313
314## v4.0.1
315
316 - Collisions between the arguments of inlined functions and names in the outer scope are now being avoided while inlining
317 - Unmapped segments are now preserved when compressing a file which has source maps
318 - Default values of functions are now correctly converted from Mozilla AST to Terser AST
319 - JSON ⊂ ECMAScript spec (if you don't know what this is you don't need to)
320 - Export AST_* classes to library users
321 - Fixed issue with `collapse_vars` when functions are created with the same name as a variable which already exists
322 - Added `MutationObserverInit` (Object with options for initialising a mutation observer) properties to the DOM property list
323 - Custom `Error` subclasses are now internally used instead of old-school Error inheritance hacks.
324 - Documentation fixes
325 - Performance optimizations
326
327## v4.0.0
328
329 - **breaking change**: The `variables` property of all scopes has become a standard JavaScript `Map` as opposed to the old bespoke `Dictionary` object.
330 - Typescript definitions were fixed
331 - `terser --help` was fixed
332 - The public interface was cleaned up
333 - Fixed optimisation of `Array` and `new Array`
334 - 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.
335 - Fixed parent functions' parameters being shadowed in some cases
336 - Allowed Terser to run in a situation where there are custom functions attached to Object.prototype
337 - And more bug fixes, optimisations and internal changes
338
339## v3.17.0
340
341 - More DOM properties added to --mangle-properties's DOM property list
342 - Closed issue where if 2 functions had the same argument name, Terser would not inline them together properly
343 - Fixed issue with `hasOwnProperty.call`
344 - You can now list files to minify in a Terser config file
345 - Started replacing `new Array(<number>)` with an array literal
346 - Started using ES6 capabilities like `Set` and the `includes` method for strings and arrays
347
348## v3.16.1
349
350 - 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)
351
352## v3.16.0
353
354 - No longer leaves names like Array or Object or window as a SimpleStatement (statement which is just a single expression).
355 - Add support for sections sourcemaps (IndexedSourceMapConsumer)
356 - Drops node.js v4 and starts using commonJS
357 - Is now built with rollup
358
359## v3.15.0
360
361 - Inlined spread syntax (`[...[1, 2, 3], 4, 5] => [1, 2, 3, 4, 5]`) in arrays and objects.
362 - Fixed typo in compressor warning
363 - Fixed inline source map input bug
364 - Fixed parsing of template literals with unnecessary escapes (Like `\\a`)