uglifier 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of uglifier might be problematic. Click here for more details.

data/Rakefile CHANGED
@@ -17,10 +17,6 @@ Jeweler::Tasks.new do |gem|
17
17
  gem.email = "lautis@gmail.com"
18
18
  gem.homepage = "http://github.com/lautis/uglifier"
19
19
  gem.authors = ["Ville Lautanala"]
20
-
21
- # Dependencies defined in Gemfile
22
-
23
- gem.files.include 'vendor/uglifyjs/lib/*'
24
20
  end
25
21
  Jeweler::RubygemsDotOrgTasks.new
26
22
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.4
data/lib/es5.js ADDED
@@ -0,0 +1,78 @@
1
+ // https://developer.mozilla.org/en/JavaScript/Reference/global_objects/array/foreach
2
+
3
+ if (!Array.prototype.forEach)
4
+ {
5
+ Array.prototype.forEach = function(fun /*, thisp */)
6
+ {
7
+ "use strict";
8
+
9
+ if (this === void 0 || this === null)
10
+ throw new TypeError();
11
+
12
+ var t = Object(this);
13
+ var len = t.length >>> 0;
14
+ if (typeof fun !== "function")
15
+ throw new TypeError();
16
+
17
+ var thisp = arguments[1];
18
+ for (var i = 0; i < len; i++)
19
+ {
20
+ if (i in t)
21
+ fun.call(thisp, t[i], i, t);
22
+ }
23
+ };
24
+ }
25
+
26
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/Reduce
27
+
28
+ if (!Array.prototype.reduce)
29
+ {
30
+ Array.prototype.reduce = function(fun /*, initialValue */)
31
+ {
32
+ "use strict";
33
+
34
+ if (this === void 0 || this === null)
35
+ throw new TypeError();
36
+
37
+ var t = Object(this);
38
+ var len = t.length >>> 0;
39
+ if (typeof fun !== "function")
40
+ throw new TypeError();
41
+
42
+ // no value to return if no initial value and an empty array
43
+ if (len == 0 && arguments.length == 1)
44
+ throw new TypeError();
45
+
46
+ var k = 0;
47
+ var accumulator;
48
+ if (arguments.length >= 2)
49
+ {
50
+ accumulator = arguments[1];
51
+ }
52
+ else
53
+ {
54
+ do
55
+ {
56
+ if (k in t)
57
+ {
58
+ accumulator = t[k++];
59
+ break;
60
+ }
61
+
62
+ // if array contains no values, no initial value to return
63
+ if (++k >= len)
64
+ throw new TypeError();
65
+ }
66
+ while (true);
67
+ }
68
+
69
+ while (k < len)
70
+ {
71
+ if (k in t)
72
+ accumulator = fun.call(undefined, accumulator, t[k], k, t);
73
+ k++;
74
+ }
75
+
76
+ return accumulator;
77
+ };
78
+ }
data/lib/uglifier.rb CHANGED
@@ -23,6 +23,7 @@ class Uglifier
23
23
  }
24
24
 
25
25
  SourcePath = File.expand_path("../uglify.js", __FILE__)
26
+ ES5FallbackPath = File.expand_path("../es5.js", __FILE__)
26
27
 
27
28
  def self.compile(source, options = {})
28
29
  self.new(options).compile(source)
@@ -31,7 +32,7 @@ class Uglifier
31
32
  # Create new instance of Uglifier with given options
32
33
  def initialize(options = {})
33
34
  @options = DEFAULTS.merge(options)
34
- @context = ExecJS.compile(File.read(SourcePath))
35
+ @context = ExecJS.compile(File.read(ES5FallbackPath) + File.read(SourcePath))
35
36
  end
36
37
 
37
38
  def compile(source)
data/uglifier.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{uglifier}
8
- s.version = "0.5.3"
8
+ s.version = "0.5.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Ville Lautanala"]
12
- s.date = %q{2011-05-13}
11
+ s.authors = [%q{Ville Lautanala}]
12
+ s.date = %q{2011-05-19}
13
13
  s.email = %q{lautis@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -25,18 +25,16 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "build.js",
28
+ "lib/es5.js",
28
29
  "lib/uglifier.rb",
29
30
  "lib/uglify.js",
30
31
  "spec/spec_helper.rb",
31
32
  "spec/uglifier_spec.rb",
32
- "uglifier.gemspec",
33
- "vendor/uglifyjs/lib/parse-js.js",
34
- "vendor/uglifyjs/lib/process.js",
35
- "vendor/uglifyjs/lib/squeeze-more.js"
33
+ "uglifier.gemspec"
36
34
  ]
37
35
  s.homepage = %q{http://github.com/lautis/uglifier}
38
- s.require_paths = ["lib"]
39
- s.rubygems_version = %q{1.7.2}
36
+ s.require_paths = [%q{lib}]
37
+ s.rubygems_version = %q{1.8.2}
40
38
  s.summary = %q{Ruby wrapper for UglifyJS JavaScript compressor}
41
39
  s.test_files = [
42
40
  "spec/spec_helper.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uglifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 3
10
- version: 0.5.3
9
+ - 4
10
+ version: 0.5.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ville Lautanala
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-13 00:00:00 Z
18
+ date: 2011-05-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -29,10 +29,10 @@ dependencies:
29
29
  - 3
30
30
  - 0
31
31
  version: 0.3.0
32
- name: execjs
33
- prerelease: false
34
32
  type: :runtime
35
33
  requirement: *id001
34
+ prerelease: false
35
+ name: execjs
36
36
  - !ruby/object:Gem::Dependency
37
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
@@ -45,10 +45,10 @@ dependencies:
45
45
  - 0
46
46
  - 2
47
47
  version: 1.0.2
48
- name: multi_json
49
- prerelease: false
50
48
  type: :runtime
51
49
  requirement: *id002
50
+ prerelease: false
51
+ name: multi_json
52
52
  - !ruby/object:Gem::Dependency
53
53
  version_requirements: &id003 !ruby/object:Gem::Requirement
54
54
  none: false
@@ -61,10 +61,10 @@ dependencies:
61
61
  - 5
62
62
  - 0
63
63
  version: 2.5.0
64
- name: rspec
65
- prerelease: false
66
64
  type: :development
67
65
  requirement: *id003
66
+ prerelease: false
67
+ name: rspec
68
68
  - !ruby/object:Gem::Dependency
69
69
  version_requirements: &id004 !ruby/object:Gem::Requirement
70
70
  none: false
@@ -77,10 +77,10 @@ dependencies:
77
77
  - 0
78
78
  - 0
79
79
  version: 1.0.0
80
- name: bundler
81
- prerelease: false
82
80
  type: :development
83
81
  requirement: *id004
82
+ prerelease: false
83
+ name: bundler
84
84
  - !ruby/object:Gem::Dependency
85
85
  version_requirements: &id005 !ruby/object:Gem::Requirement
86
86
  none: false
@@ -93,10 +93,10 @@ dependencies:
93
93
  - 5
94
94
  - 0
95
95
  version: 1.5.0
96
- name: jeweler
97
- prerelease: false
98
96
  type: :development
99
97
  requirement: *id005
98
+ prerelease: false
99
+ name: jeweler
100
100
  - !ruby/object:Gem::Dependency
101
101
  version_requirements: &id006 !ruby/object:Gem::Requirement
102
102
  none: false
@@ -107,10 +107,10 @@ dependencies:
107
107
  segments:
108
108
  - 0
109
109
  version: "0"
110
- name: rcov
111
- prerelease: false
112
110
  type: :development
113
111
  requirement: *id006
112
+ prerelease: false
113
+ name: rcov
114
114
  description:
115
115
  email: lautis@gmail.com
116
116
  executables: []
@@ -130,14 +130,12 @@ files:
130
130
  - Rakefile
131
131
  - VERSION
132
132
  - build.js
133
+ - lib/es5.js
133
134
  - lib/uglifier.rb
134
135
  - lib/uglify.js
135
136
  - spec/spec_helper.rb
136
137
  - spec/uglifier_spec.rb
137
138
  - uglifier.gemspec
138
- - vendor/uglifyjs/lib/parse-js.js
139
- - vendor/uglifyjs/lib/process.js
140
- - vendor/uglifyjs/lib/squeeze-more.js
141
139
  homepage: http://github.com/lautis/uglifier
142
140
  licenses: []
143
141
 
@@ -167,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
165
  requirements: []
168
166
 
169
167
  rubyforge_project:
170
- rubygems_version: 1.7.2
168
+ rubygems_version: 1.8.2
171
169
  signing_key:
172
170
  specification_version: 3
173
171
  summary: Ruby wrapper for UglifyJS JavaScript compressor