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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7062a8c1bbde4ac1923e93201a527af14f1e3cea
4
- data.tar.gz: dc3085b345acd4c4f6e7a71cc26f8ad708e89d0c
3
+ metadata.gz: 0ff511b3ef8de15b4e180daeffc6d4307d46103e
4
+ data.tar.gz: 39aa7aef3a221096b47c74ffbf71e2e0a229eead
5
5
  SHA512:
6
- metadata.gz: 46541d24080d33015418644c447949a7d7ca996d714640518b98d34d8f5cd50d47de18d33d7161be0e61224ac61fd49d8526a4c745ad49efa4e9ad6ff54879a3
7
- data.tar.gz: 5c97052928028f300a8c6a5b9163bfb75b807dc6eef86b92e1a0689224eae93d76ded790fd0861d23c41db777a05d8ef819ba35572d5d5cd2299ffba7cd147f8
6
+ metadata.gz: ccf2f514a7406d8ed2bf561624f9778d34182533b6639a7088bf32faf02b333adc2f8fef520d4f12304af1909663c3a3c2ca060a94c03ac29065c2c2183e0bdf
7
+ data.tar.gz: 1022e370f320213866569e4f63e6d8a6f24ae6b352d2e833259f3b32d684e8fba274ca4631e23676dd920cfdc3d4d478d34d260523fd1d4f9526a060bb93beea
data/.rubocop.yml CHANGED
@@ -25,3 +25,9 @@ Style/SignalException:
25
25
 
26
26
  Style/StringLiterals:
27
27
  Enabled: false
28
+
29
+ Style/Alias:
30
+ Enabled: false
31
+
32
+ Style/MutableConstant:
33
+ Enabled: false
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.5
9
- - 2.2.0
10
- - jruby
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.2.0
19
+ - rvm: 2.3.0
19
20
  gemfile: gemfiles/rubyracer
20
- - rvm: 2.1.5
21
+ - rvm: 2.1.7
21
22
  gemfile: gemfiles/rubyracer
22
23
  - rvm: jruby-19mode
23
24
  gemfile: gemfiles/rubyrhino
24
- - rvm: 2.2.0
25
+ - rvm: 2.3.0
25
26
  gemfile: gemfiles/alaska
26
27
  env: ALASKA=1
27
28
  allow_failures:
28
- - rvm: 2.2.0
29
+ - rvm: 2.3.0
29
30
  gemfile: gemfiles/alaska
30
31
  env: ALASKA=1
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --title "Uglifier"
2
+ -
3
+ CHANGELOG.md
4
+ LICENSE.txt
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
@@ -2,8 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- if RUBY_VERSION >= '1.9'
6
- gem 'rubocop', '~> 0.28', :group => [:development]
7
- else
8
- gem 'execjs', '~> 2.0.2'
9
- end
5
+ gem 'rubocop', '~> 0.37.2', :group => [:development]
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
- # Uglifier [![Build Status](https://travis-ci.org/lautis/uglifier.svg?branch=master)](https://travis-ci.org/lautis/uglifier) [![Dependency Status](https://gemnasium.com/lautis/uglifier.svg)](https://gemnasium.com/lautis/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 # Process @ngInject annotations
90
- :keep_fargs => false # Preserve unused function arguments
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
- :source_filename => nil, # The filename of the input file
95
- :source_root => nil, # The URL of the directory which contains :source_filename
96
- :output_filename => nil, # The filename or URL where the minified output can be found
97
- :input_source_map => nil, # The contents of the source map describing the input
98
- :screw_ie8 => false, # Don't bother to generate safe code for IE8
99
- :source_map_url => false, # Url for source mapping to be appended in minified source
100
- :source_url => false # Url to original source to be appended in minified source
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 'rubygems'
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
 
data/lib/es5.js CHANGED
@@ -307,7 +307,7 @@ if(!String.prototype.trim) {
307
307
  function definePropertyWorks() {
308
308
  try {
309
309
  Object.defineProperty({}, "property", {});
310
- return "property" in object;
310
+ return true;
311
311
  } catch (exception) {
312
312
  return false;
313
313
  }