terser 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -0
- data/lib/terser/version.rb +1 -1
- data/lib/terser.js +1305 -311
- data/lib/terser.rb +8 -3
- metadata +2 -2
data/lib/terser.rb
CHANGED
|
@@ -87,7 +87,10 @@ class Terser
|
|
|
87
87
|
:keep_infinity => false, # Prevent compression of Infinity to 1/0
|
|
88
88
|
:lhs_constants => true, # Moves constant values to the left-hand side of binary nodes. `foo == 42 → 42 == foo`
|
|
89
89
|
:side_effects => true, # Pass false to disable potentially dropping functions marked as "pure" using pure comment annotation. See TerserJS documentation for details.
|
|
90
|
-
:switches => true # de-duplicate and remove unreachable switch branches
|
|
90
|
+
:switches => true, # de-duplicate and remove unreachable switch branches
|
|
91
|
+
:ecma => 5, # Pass `2015` or greater to enable `compress` options that will transform ES5 code into smaller ES6+ equivalent forms.
|
|
92
|
+
:builtins_ecma => 5, # An ES version number (like `ecma`). Tells Terser which well-known functions, constants, methods and classes are available in the global object. Does nothing by itself, but is used by `builtins_pure` and `unsafe`.
|
|
93
|
+
:builtins_pure => false # Pass `true` to assume that functions matched by the `builtins_ecma` option (such as `Math.sin` or `unescape`) are pure and calls to them can be removed.
|
|
91
94
|
}, # Apply transformations to code, set to false to skip
|
|
92
95
|
:parse => {
|
|
93
96
|
:bare_returns => false, # Allow top-level return statements.
|
|
@@ -101,7 +104,8 @@ class Terser
|
|
|
101
104
|
:keep_classnames => false, # Prevents discarding or mangling of class names. Sets both compress and mangle keep_classnames to true.
|
|
102
105
|
:toplevel => false,
|
|
103
106
|
:source_map => false, # Generate source map
|
|
104
|
-
:error_context_lines => 8 # How many lines surrounding the error line
|
|
107
|
+
:error_context_lines => 8, # How many lines surrounding the error line
|
|
108
|
+
:module => false # Use when minifying an ES6 module. "use strict" is implied and names can be mangled on the top scope
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
EXTRA_OPTIONS = [:comments, :mangle_properties]
|
|
@@ -222,7 +226,8 @@ class Terser
|
|
|
222
226
|
:compress => compressor_options,
|
|
223
227
|
:mangle => mangle_options,
|
|
224
228
|
:parse => parse_options(source_map_options),
|
|
225
|
-
:sourceMap => source_map_options(input_map, source_map_options)
|
|
229
|
+
:sourceMap => source_map_options(input_map, source_map_options),
|
|
230
|
+
:module => @options[:module] || DEFAULTS[:module]
|
|
226
231
|
}
|
|
227
232
|
|
|
228
233
|
parse_result(context.call("terser_wrapper", options), generate_map, options, source_map_options)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: terser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pavel Rosicky
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: execjs
|