terser 1.1.14 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +42 -0
- data/CHANGELOG.md +40 -0
- data/Gemfile +3 -3
- data/README.md +13 -3
- data/Rakefile +7 -6
- data/lib/source-map.js +3233 -2
- data/lib/terser/compressor.rb +1 -1
- data/lib/terser/version.rb +1 -1
- data/lib/terser.js +32542 -1
- data/lib/terser.rb +2 -0
- data/lib/terser_wrapper.js +3 -1
- data/terser.gemspec +2 -0
- metadata +5 -4
data/lib/terser.rb
CHANGED
@@ -79,12 +79,14 @@ class Terser
|
|
79
79
|
:negate_iife => true, # Negate immediately invoked function expressions to avoid extra parens
|
80
80
|
:pure_getters => false, # Assume that object property access does not have any side-effects
|
81
81
|
:pure_funcs => nil, # List of functions without side-effects. Can safely discard function calls when the result value is not used
|
82
|
+
:pure_new => false, # If objects generated by the new keyword are not used for other purposes, removes those objects
|
82
83
|
:drop_console => false, # Drop calls to console.* functions
|
83
84
|
:keep_fargs => false, # Preserve unused function arguments
|
84
85
|
:keep_classnames => false, # Prevents discarding or mangling of class names. Pass a regular expression to only keep class names matching that regex.
|
85
86
|
:keep_fnames => false, # Do not drop names in function definitions
|
86
87
|
:passes => 1, # Number of times to run compress. Raising the number of passes will increase compress time, but can produce slightly smaller code.
|
87
88
|
:keep_infinity => false, # Prevent compression of Infinity to 1/0
|
89
|
+
:lhs_constants => true, # Moves constant values to the left-hand side of binary nodes. `foo == 42 → 42 == foo`
|
88
90
|
:side_effects => true, # Pass false to disable potentially dropping functions marked as "pure" using pure comment annotation. See TerserJS documentation for details.
|
89
91
|
:switches => true # de-duplicate and remove unreachable switch branches
|
90
92
|
}, # Apply transformations to code, set to false to skip
|
data/lib/terser_wrapper.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
// Set source-map.js sourceMap to terser.js MOZ_SourceMap
|
2
2
|
MOZ_SourceMap = sourceMap;
|
3
3
|
|
4
|
+
var global = global || {};
|
5
|
+
|
4
6
|
function comments(option) {
|
5
7
|
if (Object.prototype.toString.call(option) === '[object Array]') {
|
6
8
|
return new RegExp(option[0], option[1]);
|
@@ -47,7 +49,7 @@ function terser_wrapper(options) {
|
|
47
49
|
inputs[inputFilename] = source;
|
48
50
|
|
49
51
|
try {
|
50
|
-
return Terser.
|
52
|
+
return Terser.minify_sync(inputs, options, null);
|
51
53
|
} catch (error) {
|
52
54
|
const { message, filename, line, col, pos } = error;
|
53
55
|
return {error: {message: message, filename: filename, line: line, col: col, pos: pos}}
|
data/terser.gemspec
CHANGED
@@ -35,4 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "rake", "~> 13.0"
|
36
36
|
spec.add_development_dependency "rspec", "~> 3.0"
|
37
37
|
spec.add_development_dependency "sourcemap", "~> 0.1.1"
|
38
|
+
|
39
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/CHANGELOG.md"
|
38
40
|
end
|
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.
|
4
|
+
version: 1.2.3
|
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: 2024-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -123,7 +123,8 @@ files:
|
|
123
123
|
homepage: http://github.com/ahorek/terser-ruby
|
124
124
|
licenses:
|
125
125
|
- MIT
|
126
|
-
metadata:
|
126
|
+
metadata:
|
127
|
+
changelog_uri: http://github.com/ahorek/terser-ruby/blob/master/CHANGELOG.md
|
127
128
|
post_install_message:
|
128
129
|
rdoc_options: []
|
129
130
|
require_paths:
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
140
|
- !ruby/object:Gem::Version
|
140
141
|
version: '0'
|
141
142
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.6.0.dev
|
143
144
|
signing_key:
|
144
145
|
specification_version: 4
|
145
146
|
summary: Ruby wrapper for Terser JavaScript compressor
|