e706571ad19f1ee452e66c875b4cc8817b8eb2b96cc00723bbe570fb2410d62ddd70d023f6103efce19211739751b2260a561235081770c15b41c4c53fd919 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. # Changelog
  2. ## v4.8.1
  3. - Security fix for RegExps that should not be evaluated (regexp DDOS)
  4. ## v4.8.0
  5. - Support for numeric separators (`million = 1_000_000`) was added.
  6. - Assigning properties to a class is now assumed to be pure.
  7. - Fixed bug where `yield` wasn't considered a valid property key in generators.
  8. ## v4.7.0
  9. - A bug was fixed where an arrow function would have the wrong size
  10. - `arguments` object is now considered safe to retrieve properties from (useful for `length`, or `0`) even when `pure_getters` is not set.
  11. - Fixed erroneous `const` declarations without value (which is invalid) in some corner cases when using `collapse_vars`.
  12. ## v4.6.13
  13. - Fixed issue where ES5 object properties were being turned into ES6 object properties due to more lax unicode rules.
  14. - Fixed parsing of BigInt with lowercase `e` in them.
  15. ## v4.6.12
  16. - Fixed subtree comparison code, making it see that `[1,[2, 3]]` is different from `[1, 2, [3]]`
  17. - Printing of unicode identifiers has been improved
  18. ## v4.6.11
  19. - Read unused classes' properties and method keys, to figure out if they use other variables.
  20. - Prevent inlining into block scopes when there are name collisions
  21. - Functions are no longer inlined into parameter defaults, because they live in their own special scope.
  22. - When inlining identity functions, take into account the fact they may be used to drop `this` in function calls.
  23. - Nullish coalescing operator (`x ?? y`), plus basic optimization for it.
  24. - Template literals in binary expressions such as `+` have been further optimized
  25. ## v4.6.10
  26. - Do not use reduce_vars when classes are present
  27. ## v4.6.9
  28. - Check if block scopes actually exist in blocks
  29. ## v4.6.8
  30. - 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.
  31. ## v4.6.7
  32. - 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.
  33. - An issue with setting `--comments` to `false` in the CLI has been fixed.
  34. - Fixed some issues with inlining
  35. - `unsafe_symbols` compress option was added, which turns `Symbol("name")` into just `Symbol()`
  36. - Brought back compress performance improvement through the `AST_Node.equivalent_to(other)` method (which was reverted in v4.6.6).
  37. ## v4.6.6
  38. (hotfix release)
  39. - Reverted code to 4.6.4 to allow for more time to investigate an issue.
  40. ## v4.6.5 (REVERTED)
  41. - Improved compress performance through using a new method to see if two nodes are equivalent, instead of printing them to a string.
  42. ## v4.6.4
  43. - The `"some"` value in the `comments` output option now preserves `@lic` and other important comments when using `//`
  44. - `</script>` is now better escaped in regex, and in comments, when using the `inline_script` output option
  45. - Fixed an issue when transforming `new RegExp` into `/.../` when slashes are included in the source
  46. - `AST_Node.prototype.constructor` now exists, allowing for easier debugging of crashes
  47. - Multiple if statements with the same consequents are now collapsed
  48. - Typescript typings improvements
  49. - Optimizations while looking for surrogate pairs in strings
  50. ## v4.6.3
  51. - Annotations such as `/*#__NOINLINE__*/` and `/*#__PURE__*/` may now be preserved using the `preserve_annotations` output option
  52. - A TypeScript definition update for the `keep_quoted` output option.
  53. ## v4.6.2
  54. - A bug where functions were inlined into other functions with scope conflicts has been fixed.
  55. - `/*#__NOINLINE__*/` annotation fixed for more use cases where inlining happens.
  56. ## v4.6.1
  57. - Fixed an issue where a class is duplicated by reduce_vars when there's a recursive reference to the class.
  58. ## v4.6.0
  59. - Fixed issues with recursive class references.
  60. - BigInt evaluation has been prevented, stopping Terser from evaluating BigInts like it would do regular numbers.
  61. - Class property support has been added
  62. ## v4.5.1
  63. (hotfix release)
  64. - Fixed issue where `() => ({})[something]` was not parenthesised correctly.
  65. ## v4.5.0
  66. - Inlining has been improved
  67. - An issue where keep_fnames combined with functions declared through variables was causing name shadowing has been fixed
  68. - You can now set the ES version through their year
  69. - The output option `keep_numbers` has been added, which prevents Terser from turning `1000` into `1e3` and such
  70. - Internal small optimisations and refactors
  71. ## v4.4.3
  72. - Number and BigInt parsing has been fixed
  73. - `/*#__INLINE__*/` annotation fixed for arrow functions with non-block bodies.
  74. - Functional tests have been added, using [this repository](https://github.com/terser/terser-functional-tests).
  75. - A memory leak, where the entire AST lives on after compression, has been plugged.
  76. ## v4.4.2
  77. - Fixed a problem with inlining identity functions
  78. ## v4.4.1
  79. *note:* This introduced a feature, therefore it should have been a minor release.
  80. - Fixed a crash when `unsafe` was enabled.
  81. - An issue has been fixed where `let` statements might be collapsed out of their scope.
  82. - Some error messages have been improved by adding quotes around variable names.
  83. ## v4.4.0
  84. - Added `/*#__INLINE__*/` and `/*#__NOINLINE__*/` annotations for calls. If a call has one of these, it either forces or forbids inlining.
  85. ## v4.3.11
  86. - Fixed a problem where `window` was considered safe to access, even though there are situations where it isn't (Node.js, workers...)
  87. - Fixed an error where `++` and `--` were considered side-effect free
  88. - `Number(x)` now needs both `unsafe` and and `unsafe_math` to be compressed into `+x` because `x` might be a `BigInt`
  89. - `keep_fnames` now correctly supports regexes when the function is in a variable declaration
  90. ## v4.3.10
  91. - Fixed syntax error when repeated semicolons were encountered in classes
  92. - Fixed invalid output caused by the creation of empty sequences internally
  93. - Scopes are now updated when scopes are inlined into them
  94. ## v4.3.9
  95. - Fixed issue with mangle's `keep_fnames` option, introduced when adding code to keep variable names of anonymous functions
  96. ## v4.3.8
  97. - Typescript typings fix
  98. ## v4.3.7
  99. - Parsing of regex options in the CLI (which broke in v4.3.5) was fixed.
  100. - typescript definition updates
  101. ## v4.3.6
  102. (crash hotfix)
  103. ## v4.3.5
  104. - Fixed an issue with DOS line endings strings separated by `\` and a new line.
  105. - Improved fix for the output size regression related to unused references within the extends section of a class.
  106. - Variable names of anonymous functions (eg: `const x = () => { ... }` or `var func = function () {...}`) are now preserved when keep_fnames is true.
  107. - Fixed performance degradation introduced for large payloads in v4.2.0
  108. ## v4.3.4
  109. - Fixed a regression where the output size was increased when unused classes were referred to in the extends clause of a class.
  110. - Small typescript typings fixes.
  111. - Comments with `@preserve`, `@license`, `@cc_on` as well as comments starting with `/*!` and `/**!` are now preserved by default.
  112. ## v4.3.3
  113. - Fixed a problem where parsing template strings would mix up octal notation and a slash followed by a zero representing a null character.
  114. - Started accepting the name `async` in destructuring arguments with default value.
  115. - Now Terser takes into account side effects inside class `extends` clauses.
  116. - Added parens whenever there's a comment between a return statement and the returned value, to prevent issues with ASI.
  117. - 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.
  118. ## v4.3.2
  119. - Typescript typing fix
  120. - 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.
  121. ## v4.3.1
  122. - Fixed an issue from 4.3.0 where any block scope within a for loop erroneously had its parent set to the function scopee
  123. - Fixed an issue where compressing IIFEs with argument expansions would result in some parameters becoming undefined
  124. - addEventListener options argument's properties are now part of the DOM properties list.
  125. ## v4.3.0
  126. - Do not drop computed object keys with side effects
  127. - Functions passed to other functions in calls are now wrapped in parentheses by default, which speeds up loading most modules
  128. - Objects with computed properties are now less likely to be hoisted
  129. - Speed and memory efficiency optimizations
  130. - Fixed scoping issues with `try` and `switch`
  131. ## v4.2.1
  132. - Minor refactors
  133. - Fixed a bug similar to #369 in collapse_vars
  134. - Functions can no longer be inlined into a place where they're going to be compared with themselves.
  135. - 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.
  136. - Bug which would cause a random stack overflow has now been fixed.
  137. ## v4.2.0
  138. - When the source map URL is `inline`, don't write it to a file.
  139. - Fixed output parens when a lambda literal is the tag on a tagged template string.
  140. - 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.
  141. - The v8 bug where the toString and source representations of regexes like `RegExp("\\\n")` includes an actual newline is now fixed.
  142. - Now we're guaranteed to not have duplicate comments in the output
  143. - Domprops updates
  144. ## v4.1.4
  145. - Fixed a crash when inlining a function into somewhere else when it has interdependent, non-removable variables.
  146. ## v4.1.3
  147. - Several issues with the `reduce_vars` option were fixed.
  148. - Starting this version, we only have a dist/bundle.min.js
  149. ## v4.1.2
  150. - The hotfix was hotfixed
  151. ## v4.1.1
  152. - Fixed a bug where toplevel scopes were being mixed up with lambda scopes
  153. ## v4.1.0
  154. - Internal functions were replaced by `Object.assign`, `Array.prototype.some`, `Array.prototype.find` and `Array.prototype.every`.
  155. - A serious issue where some ESM-native code was broken was fixed.
  156. - Performance improvements were made.
  157. - Support for BigInt was added.
  158. - Inline efficiency was improved. Functions are now being inlined more proactively instead of being inlined only after another Compressor pass.
  159. ## v4.0.2
  160. (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)
  161. ## v4.0.1
  162. - Collisions between the arguments of inlined functions and names in the outer scope are now being avoided while inlining
  163. - Unmapped segments are now preserved when compressing a file which has source maps
  164. - Default values of functions are now correctly converted from Mozilla AST to Terser AST
  165. - JSON ⊂ ECMAScript spec (if you don't know what this is you don't need to)
  166. - Export AST_* classes to library users
  167. - Fixed issue with `collapse_vars` when functions are created with the same name as a variable which already exists
  168. - Added `MutationObserverInit` (Object with options for initialising a mutation observer) properties to the DOM property list
  169. - Custom `Error` subclasses are now internally used instead of old-school Error inheritance hacks.
  170. - Documentation fixes
  171. - Performance optimizations
  172. ## v4.0.0
  173. - **breaking change**: The `variables` property of all scopes has become a standard JavaScript `Map` as opposed to the old bespoke `Dictionary` object.
  174. - Typescript definitions were fixed
  175. - `terser --help` was fixed
  176. - The public interface was cleaned up
  177. - Fixed optimisation of `Array` and `new Array`
  178. - 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.
  179. - Fixed parent functions' parameters being shadowed in some cases
  180. - Allowed Terser to run in a situation where there are custom functions attached to Object.prototype
  181. - And more bug fixes, optimisations and internal changes
  182. ## v3.17.0
  183. - More DOM properties added to --mangle-properties's DOM property list
  184. - Closed issue where if 2 functions had the same argument name, Terser would not inline them together properly
  185. - Fixed issue with `hasOwnProperty.call`
  186. - You can now list files to minify in a Terser config file
  187. - Started replacing `new Array(<number>)` with an array literal
  188. - Started using ES6 capabilities like `Set` and the `includes` method for strings and arrays
  189. ## v3.16.1
  190. - 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)
  191. ## v3.16.0
  192. - No longer leaves names like Array or Object or window as a SimpleStatement (statement which is just a single expression).
  193. - Add support for sections sourcemaps (IndexedSourceMapConsumer)
  194. - Drops node.js v4 and starts using commonJS
  195. - Is now built with rollup
  196. ## v3.15.0
  197. - Inlined spread syntax (`[...[1, 2, 3], 4, 5] => [1, 2, 3, 4, 5]`) in arrays and objects.
  198. - Fixed typo in compressor warning
  199. - Fixed inline source map input bug
  200. - Fixed parsing of template literals with unnecessary escapes (Like `\\a`)