terser 1.1.14 → 1.2.3
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/.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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a79c3ce462ccc7dbc82fac484b88f9d99d863113d831b46f450846cd0c16153
|
4
|
+
data.tar.gz: 67113e1a30a5260a02ec66269a2a85884681a46377dfb564e13ae767d0b34dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d63da1e879cd56a5b43c5e4e6dc115a7b724cf6ff9a8abf42034154b925996da40858376dfb56cc14630c02f75206eec92c53b636c4069865d64ca283d87a0ce
|
7
|
+
data.tar.gz: 2889a964e38a30c94610f5bb807561b085dc5c615058f47d8f445791ca57c61116b3e9e73153263a59c5d84a1616f5c9490d0ec549dd93aea44ac6f82e6629ea
|
data/.rubocop.yml
CHANGED
@@ -310,6 +310,48 @@ Style/RedundantStringEscape: # new in 1.37
|
|
310
310
|
Enabled: true
|
311
311
|
Style/SelectByRegexp: # new in 1.22
|
312
312
|
Enabled: true
|
313
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
314
|
+
Enabled: true
|
315
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
316
|
+
Enabled: true
|
317
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
318
|
+
Enabled: true
|
319
|
+
Lint/MixedCaseRange: # new in 1.53
|
320
|
+
Enabled: true
|
321
|
+
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
322
|
+
Enabled: true
|
323
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
324
|
+
Enabled: true
|
325
|
+
Style/DataInheritance: # new in 1.49
|
326
|
+
Enabled: true
|
327
|
+
Style/DirEmpty: # new in 1.48
|
328
|
+
Enabled: true
|
329
|
+
Style/ExactRegexpMatch: # new in 1.51
|
330
|
+
Enabled: true
|
331
|
+
Style/FileEmpty: # new in 1.48
|
332
|
+
Enabled: true
|
333
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
334
|
+
Enabled: true
|
335
|
+
Style/RedundantCurrentDirectoryInPath: # new in 1.53
|
336
|
+
Enabled: true
|
337
|
+
Style/RedundantFilterChain: # new in 1.52
|
338
|
+
Enabled: true
|
339
|
+
Style/RedundantLineContinuation: # new in 1.49
|
340
|
+
Enabled: true
|
341
|
+
Style/RedundantRegexpArgument: # new in 1.53
|
342
|
+
Enabled: true
|
343
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
344
|
+
Enabled: true
|
345
|
+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
346
|
+
Enabled: true
|
347
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
348
|
+
Enabled: true
|
349
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
350
|
+
Enabled: true
|
351
|
+
Style/YAMLFileRead: # new in 1.53
|
352
|
+
Enabled: true
|
353
|
+
Performance/MapMethodChain: # new in 1.19
|
354
|
+
Enabled: true
|
313
355
|
|
314
356
|
Performance/AncestorsInclude:
|
315
357
|
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,44 @@
|
|
1
|
+
Behavioural changes in TerserJS are listed [here](https://github.com/terser/terser/blob/master/CHANGELOG.md).
|
2
|
+
|
1
3
|
## Unreleased
|
4
|
+
## 1.2.3 (11 June 2024)
|
5
|
+
- update TerserJS to [5.31.1]
|
6
|
+
|
7
|
+
## 1.2.2 (2 April 2024)
|
8
|
+
- update TerserJS to [5.30.2]
|
9
|
+
- build an unminified version to make security reviews easier
|
10
|
+
|
11
|
+
## 1.2.1 (28 March 2024)
|
12
|
+
- update TerserJS to [5.30.0]
|
13
|
+
|
14
|
+
## 1.2.0 (22 January 2024)
|
15
|
+
- update TerserJS to [5.27.0]
|
16
|
+
- remove sourcemap patches
|
17
|
+
- `pure_new` option added
|
18
|
+
- EOL rubies are no longer tested
|
19
|
+
- update rubocop
|
20
|
+
|
21
|
+
## 1.1.20 (27 November 2023)
|
22
|
+
- update TerserJS to [5.24.0]
|
23
|
+
- fix mangle properties, thanks @khaitu!
|
24
|
+
|
25
|
+
## 1.1.19 (19 October 2023)
|
26
|
+
- update TerserJS to [5.22.0]
|
27
|
+
- enable passing terser options with Rails directly
|
28
|
+
|
29
|
+
## 1.1.18 (5 September 2023)
|
30
|
+
- update TerserJS to [5.19.4]
|
31
|
+
|
32
|
+
## 1.1.17 (14 July 2023)
|
33
|
+
- update TerserJS to [5.19.0]
|
34
|
+
|
35
|
+
## 1.1.16 (01 June 2023)
|
36
|
+
- update TerserJS to [5.17.7]
|
37
|
+
|
38
|
+
## 1.1.15 (09 May 2023)
|
39
|
+
- update TerserJS to [5.17.3]
|
40
|
+
- add lhs_constants (default is true)
|
41
|
+
|
2
42
|
## 1.1.14 (24 February 2023)
|
3
43
|
- update TerserJS to [5.16.5]
|
4
44
|
- update Rubocop
|
data/Gemfile
CHANGED
@@ -4,9 +4,9 @@ source "https://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
unless RUBY_VERSION < '2.
|
7
|
+
unless RUBY_VERSION < '2.7'
|
8
8
|
group :development do
|
9
|
-
gem 'rubocop', '~> 1.
|
10
|
-
gem 'rubocop-performance', '~> 1.
|
9
|
+
gem 'rubocop', '~> 1.60.1'
|
10
|
+
gem 'rubocop-performance', '~> 1.20.2', :require => false
|
11
11
|
end
|
12
12
|
end
|
data/README.md
CHANGED
@@ -18,6 +18,15 @@ Rails.application.configure do
|
|
18
18
|
config.assets.js_compressor = :terser
|
19
19
|
end
|
20
20
|
```
|
21
|
+
|
22
|
+
Passing terser options
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
Rails.application.configure do
|
26
|
+
config.assets.terser = { compress: { drop_console: true } }
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
21
30
|
in `config/environments/production.rb`.
|
22
31
|
|
23
32
|
## Installation
|
@@ -80,8 +89,8 @@ Available options and their defaults are
|
|
80
89
|
:indent_start => 0, # Starting indent level
|
81
90
|
:width => 80, # Specify line width when beautifier is used (only with beautifier)
|
82
91
|
:preamble => nil, # Preamble for the generated JS file. Can be used to insert any code or comment.
|
83
|
-
:wrap_iife => false
|
84
|
-
:shebang => true
|
92
|
+
:wrap_iife => false, # Wrap IIFEs in parenthesis. Note: this disables the negate_iife compression option.
|
93
|
+
:shebang => true, # Preserve shebang (#!) in preamble (shell scripts)
|
85
94
|
:quote_style => 0, # Quote style, possible values :auto (default), :single, :double, :original
|
86
95
|
:keep_quoted_props => false # Keep quotes property names
|
87
96
|
},
|
@@ -97,7 +106,7 @@ Available options and their defaults are
|
|
97
106
|
:regex => nil, # A regular expression to filter property names to be mangled
|
98
107
|
:ignore_quoted => false, # Only mangle unquoted property names
|
99
108
|
:debug => false, # Mangle names with the original name still present
|
100
|
-
}
|
109
|
+
}, # Mangle property names, disabled by default
|
101
110
|
:compress => {
|
102
111
|
:sequences => true, # Allow statements to be joined by commas
|
103
112
|
:properties => true, # Rewrite property access using the dot notation
|
@@ -130,6 +139,7 @@ Available options and their defaults are
|
|
130
139
|
:keep_fnames => false, # Do not drop names in function definitions
|
131
140
|
:passes => 1, # Number of times to run compress. Raising the number of passes will increase compress time, but can produce slightly smaller code.
|
132
141
|
:keep_infinity => false, # Prevent compression of Infinity to 1/0
|
142
|
+
:lhs_constants => true, # Moves constant values to the left-hand side of binary nodes. `foo == 42 → 42 == foo`
|
133
143
|
:side_effects => true, # Pass false to disable potentially dropping functions marked as "pure" using pure comment annotation. See UglifyJS documentation for details.
|
134
144
|
:switches => true, # de-duplicate and remove unreachable switch branches
|
135
145
|
}, # Apply transformations to code, set to false to skip
|
data/Rakefile
CHANGED
@@ -54,16 +54,17 @@ namespace :terser do
|
|
54
54
|
|
55
55
|
cd 'vendor/terser/' do
|
56
56
|
FileUtils.rm_rf("package-lock.json")
|
57
|
-
`patch -p1 -i ../../patches/terser-sync.patch`
|
58
|
-
`patch -p1 -i ../../patches/revert-source-maps.patch`
|
59
57
|
`npm install --no-package-lock --no-save`
|
60
58
|
end
|
61
59
|
|
62
|
-
FileUtils.cp("vendor/source-map/dist/source-map.min.js", "lib/source-map.js")
|
60
|
+
# FileUtils.cp("vendor/source-map/dist/source-map.min.js", "lib/source-map.js")
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
FileUtils.cp("vendor/source-map/dist/source-map.js", "lib/source-map.js")
|
63
|
+
|
64
|
+
FileUtils.cp("vendor/terser/dist/bundle.min.js", "lib/terser.js")
|
65
|
+
|
66
|
+
# minified_source = `node ./vendor/terser/bin/terser vendor/terser/dist/bundle.min.js`
|
67
|
+
# File.write("lib/terser.js", minified_source)
|
67
68
|
|
68
69
|
FileUtils.cp("vendor/split/split.js", "lib/split.js")
|
69
70
|
`patch -p1 -i patches/es5-string-split.patch`
|