uglifier 2.7.1 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/.travis.yml +9 -8
- data/.yardopts +4 -0
- data/CHANGELOG.md +21 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -5
- data/README.md +21 -10
- data/Rakefile +3 -30
- data/lib/es5.js +1 -1
- data/lib/source-map.js +3055 -0
- data/lib/uglifier/version.rb +1 -1
- data/lib/uglifier.js +114 -0
- data/lib/uglifier.rb +112 -93
- data/lib/uglify.js +55 -1803
- data/spec/source_map_spec.rb +151 -35
- data/spec/spec_helper.rb +11 -2
- data/spec/uglifier_spec.rb +110 -24
- data/uglifier.gemspec +3 -5
- metadata +17 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ff511b3ef8de15b4e180daeffc6d4307d46103e
|
4
|
+
data.tar.gz: 39aa7aef3a221096b47c74ffbf71e2e0a229eead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccf2f514a7406d8ed2bf561624f9778d34182533b6639a7088bf32faf02b333adc2f8fef520d4f12304af1909663c3a3c2ca060a94c03ac29065c2c2183e0bdf
|
7
|
+
data.tar.gz: 1022e370f320213866569e4f63e6d8a6f24ae6b352d2e833259f3b32d684e8fba274ca4631e23676dd920cfdc3d4d478d34d260523fd1d4f9526a060bb93beea
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -2,12 +2,13 @@ sudo: false
|
|
2
2
|
language: ruby
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
|
-
- 1.8.7
|
6
5
|
- 1.9.3
|
7
6
|
- 2.0.0
|
8
|
-
- 2.1.
|
9
|
-
- 2.2.
|
10
|
-
-
|
7
|
+
- 2.1.7
|
8
|
+
- 2.2.3
|
9
|
+
- 2.3.0
|
10
|
+
- jruby-19mode
|
11
|
+
- jruby-9.0.4.0
|
11
12
|
- rbx-2
|
12
13
|
git:
|
13
14
|
submodules: false
|
@@ -15,16 +16,16 @@ gemfile:
|
|
15
16
|
- Gemfile
|
16
17
|
matrix:
|
17
18
|
include:
|
18
|
-
- rvm: 2.
|
19
|
+
- rvm: 2.3.0
|
19
20
|
gemfile: gemfiles/rubyracer
|
20
|
-
- rvm: 2.1.
|
21
|
+
- rvm: 2.1.7
|
21
22
|
gemfile: gemfiles/rubyracer
|
22
23
|
- rvm: jruby-19mode
|
23
24
|
gemfile: gemfiles/rubyrhino
|
24
|
-
- rvm: 2.
|
25
|
+
- rvm: 2.3.0
|
25
26
|
gemfile: gemfiles/alaska
|
26
27
|
env: ALASKA=1
|
27
28
|
allow_failures:
|
28
|
-
- rvm: 2.
|
29
|
+
- rvm: 2.3.0
|
29
30
|
gemfile: gemfiles/alaska
|
30
31
|
env: ALASKA=1
|
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
## 3.0.1 (28 July 2016)
|
2
|
+
|
3
|
+
- update UglifyJS to 2.7.0
|
4
|
+
- split JS dependencies to separate files
|
5
|
+
|
6
|
+
## 3.0.0 (22 March 2016)
|
7
|
+
|
8
|
+
- drop support for Ruby 1.8
|
9
|
+
- remove json as dependency
|
10
|
+
- discard unused function arguments only in unsafe mode
|
11
|
+
- add `keep_fnames` option to preserve function names in compressed code
|
12
|
+
- add `collapse_vars` option to collapse single-use variables
|
13
|
+
- backwards incompatible changes to source map options
|
14
|
+
- support for inline base64 encoded source maps
|
15
|
+
- mangle property names option (disabled by default)
|
16
|
+
- update UglifyJS to 2.6.2
|
17
|
+
|
18
|
+
## 2.7.2 (26 August 2015)
|
19
|
+
|
20
|
+
- update UglifyJS to 2.4.24
|
21
|
+
|
1
22
|
## 2.7.1 (27 February 2015)
|
2
23
|
|
3
24
|
- fix compatibility with experimental Alaska ExecJS runtime
|
data/CONTRIBUTING.md
CHANGED
@@ -32,7 +32,7 @@ After that, UglifyJS and source-map are checked out under `vendor/uglifyjs` and
|
|
32
32
|
|
33
33
|
Use Git commands (e.g. git checkout master) to change the included version. You can even write custom code to yourself. After changing the dependencies, compile new version of the bundled JS file using
|
34
34
|
|
35
|
-
rake js
|
35
|
+
bundle exec rake js
|
36
36
|
|
37
37
|
After this, the new JS is used in your development version.
|
38
38
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
# Uglifier
|
1
|
+
# Uglifier
|
2
2
|
|
3
3
|
Ruby wrapper for [UglifyJS](https://github.com/mishoo/UglifyJS2) JavaScript compressor.
|
4
4
|
|
5
|
+
Uglifier is able to process ES5 JavaScript, with very limited support for ES6. Uglifier should be only applied to ES6 code after transpiling to ES5 (with e.g. [babel-transpiler](https://github.com/babel/ruby-babel-transpiler)). For directly minifying ES6 code, [Closure Compiler](https://github.com/documentcloud/closure-compiler) is a more suitable option.
|
6
|
+
|
7
|
+
[![Build Status](https://travis-ci.org/lautis/uglifier.svg?branch=master)](https://travis-ci.org/lautis/uglifier)
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Uglifier is available as a ruby gem.
|
@@ -65,6 +69,9 @@ Available options and their defaults are
|
|
65
69
|
:sort => false, # Assign shorter names to most frequently used variables. Often results in bigger output after gzip.
|
66
70
|
:toplevel => false # Mangle names declared in the toplevel scope
|
67
71
|
}, # Mangle variable and function names, set to false to skip mangling
|
72
|
+
:mangle_properties => {
|
73
|
+
:regex => nil # A regular expression to filter property names to be mangled
|
74
|
+
} # Mangle property names, disabled by default
|
68
75
|
:compress => {
|
69
76
|
:sequences => true, # Allow statements to be joined by commas
|
70
77
|
:properties => true, # Rewrite property access using the dot notation
|
@@ -82,22 +89,26 @@ Available options and their defaults are
|
|
82
89
|
:if_return => true, # Optimizations for if/return and if/continue
|
83
90
|
:join_vars => true, # Join consecutive var statements
|
84
91
|
:cascade => true, # Cascade sequences
|
92
|
+
:collapse_vars => false, # Collapse single-use var and const definitions when possible.
|
85
93
|
:negate_iife => true, # Negate immediately invoked function expressions to avoid extra parens
|
86
94
|
:pure_getters => false, # Assume that object property access does not have any side-effects
|
87
95
|
:pure_funcs => nil, # List of functions without side-effects. Can safely discard function calls when the result value is not used
|
88
96
|
:drop_console => false, # Drop calls to console.* functions
|
89
|
-
:angular => false
|
90
|
-
:keep_fargs => false
|
97
|
+
:angular => false, # Process @ngInject annotations
|
98
|
+
:keep_fargs => false, # Preserve unused function arguments
|
99
|
+
:keep_fnames => false # Preserve function names
|
91
100
|
}, # Apply transformations to code, set to false to skip
|
92
101
|
:define => {}, # Define values for symbol replacement
|
93
102
|
:enclose => false, # Enclose in output function wrapper, define replacements as key-value pairs
|
94
|
-
:
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
103
|
+
:source_map => {
|
104
|
+
:map_url => false, # Url for source mapping to be appended in minified source
|
105
|
+
:url => false, # Url for original source to be appended in minified source
|
106
|
+
:sources_content => false, # Include original source content in map
|
107
|
+
:filename => nil, # The filename of the input file
|
108
|
+
:root => nil, # The URL of the directory which contains :filename
|
109
|
+
:output_filename => nil, # The filename or URL where the minified output can be found
|
110
|
+
:input_source_map => nil # The contents of the source map describing the input
|
111
|
+
}
|
101
112
|
}
|
102
113
|
```
|
103
114
|
|
data/Rakefile
CHANGED
@@ -1,40 +1,16 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'bundler'
|
3
|
+
require 'fileutils'
|
5
4
|
require 'bundler/gem_tasks'
|
6
|
-
|
7
|
-
begin
|
8
|
-
Bundler.setup(:default, :development)
|
9
|
-
rescue Bundler::BundlerError => e
|
10
|
-
$stderr.puts e.message
|
11
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
12
|
-
exit e.status_code
|
13
|
-
end
|
14
|
-
|
15
|
-
require 'rake'
|
16
|
-
|
17
|
-
require 'rspec/core'
|
18
5
|
require 'rspec/core/rake_task'
|
19
6
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
20
7
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
21
8
|
end
|
22
9
|
|
23
|
-
require 'rdoc/task'
|
24
|
-
Rake::RDocTask.new do |rdoc|
|
25
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
26
|
-
|
27
|
-
rdoc.rdoc_dir = 'rdoc'
|
28
|
-
rdoc.title = "uglifier #{version}"
|
29
|
-
rdoc.rdoc_files.include('README*')
|
30
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
31
|
-
end
|
32
|
-
|
33
10
|
desc "Rebuild lib/uglify.js"
|
34
11
|
task :js do
|
35
12
|
cd 'vendor/source-map/' do
|
36
13
|
`npm install`
|
37
|
-
`node Makefile.dryice.js`
|
38
14
|
end
|
39
15
|
|
40
16
|
cd 'vendor/uglifyjs/' do
|
@@ -42,12 +18,9 @@ task :js do
|
|
42
18
|
`npm install`
|
43
19
|
end
|
44
20
|
|
45
|
-
source
|
46
|
-
source << "window = this;"
|
47
|
-
source << File.read("vendor/source-map/dist/source-map.js")
|
48
|
-
source << "MOZ_SourceMap = sourceMap;"
|
49
|
-
source << `./vendor/uglifyjs/bin/uglifyjs --self --comments /Copyright/`
|
21
|
+
FileUtils.cp("vendor/source-map/dist/source-map.js", "lib/source-map.js")
|
50
22
|
|
23
|
+
source = `./vendor/uglifyjs/bin/uglifyjs --self --comments /Copyright/`
|
51
24
|
File.write("lib/uglify.js", source)
|
52
25
|
end
|
53
26
|
|