uglifier 2.0.1 → 2.1.0
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/CHANGELOG.md +16 -0
- data/README.md +63 -53
- data/VERSION +1 -1
- data/lib/uglifier.rb +25 -4
- data/lib/uglify.js +517 -57
- data/spec/uglifier_spec.rb +25 -0
- data/uglifier.gemspec +3 -2
- metadata +47 -46
data/spec/uglifier_spec.rb
CHANGED
@@ -142,6 +142,12 @@ describe "Uglifier" do
|
|
142
142
|
Uglifier.compile(code, :compress => {:hoist_vars => true}).should match /var \w,\w/
|
143
143
|
end
|
144
144
|
|
145
|
+
it "forwards screw_ie8 option to UglifyJS" do
|
146
|
+
code = "function something() { return g['switch']; }"
|
147
|
+
Uglifier.compile(code, :mangle => false, :screw_ie8 => true).should match /g\.switch/
|
148
|
+
Uglifier.compile(code, :compress => false, :screw_ie8 => true).should match /g\.switch/
|
149
|
+
end
|
150
|
+
|
145
151
|
it "can be configured to output only ASCII" do
|
146
152
|
code = "function emoji() { return '\\ud83c\\ude01'; }"
|
147
153
|
Uglifier.compile(code, :output => {:ascii_only => true}).should include("\\ud83c\\ude01")
|
@@ -182,4 +188,23 @@ describe "Uglifier" do
|
|
182
188
|
}.should_not raise_error
|
183
189
|
end
|
184
190
|
end
|
191
|
+
|
192
|
+
describe "enclose" do
|
193
|
+
let(:code) { "$.foo()" }
|
194
|
+
|
195
|
+
it "encloses code with given arguments" do
|
196
|
+
Uglifier.compile(code, :enclose => {'window.jQuery' => '$'}).should match /window.jQuery/
|
197
|
+
end
|
198
|
+
|
199
|
+
it "handles multiple definitions" do
|
200
|
+
minified = Uglifier.compile(code, :enclose => [['lol','lulz'],['foo','bar']])
|
201
|
+
minified.should match(/lol,foo/)
|
202
|
+
minified.should match(/lulz,bar/)
|
203
|
+
end
|
204
|
+
|
205
|
+
it "wraps with function when given empty object" do
|
206
|
+
minified = Uglifier.compile(code, :enclose => {})
|
207
|
+
minified.should match(/function\(/)
|
208
|
+
end
|
209
|
+
end
|
185
210
|
end
|
data/uglifier.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "uglifier"
|
8
|
-
s.version = "2.0
|
8
|
+
s.version = "2.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ville Lautanala"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-05-08"
|
13
13
|
s.email = "lautis@gmail.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
".gitmodules",
|
21
21
|
".rspec",
|
22
22
|
".travis.yml",
|
23
|
+
"CHANGELOG.md",
|
23
24
|
"CONTRIBUTING.md",
|
24
25
|
"Gemfile",
|
25
26
|
"LICENSE.txt",
|
metadata
CHANGED
@@ -1,35 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uglifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.0
|
4
5
|
prerelease:
|
5
|
-
version: 2.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ville Lautanala
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
16
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - ! '>='
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: 0.3.0
|
21
|
-
name: execjs
|
22
|
-
prerelease: false
|
23
|
-
requirement: !ruby/object:Gem::Requirement
|
24
20
|
none: false
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
24
|
- - ! '>='
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: 0.3.0
|
29
|
-
type: :runtime
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
version_requirements: !ruby/object:Gem::Requirement
|
32
27
|
none: false
|
28
|
+
prerelease: false
|
29
|
+
name: execjs
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
33
32
|
requirements:
|
34
33
|
- - ! '>='
|
35
34
|
- !ruby/object:Gem::Version
|
@@ -37,10 +36,9 @@ dependencies:
|
|
37
36
|
- - ~>
|
38
37
|
- !ruby/object:Gem::Version
|
39
38
|
version: '1.0'
|
40
|
-
name: multi_json
|
41
|
-
prerelease: false
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
43
39
|
none: false
|
40
|
+
type: :runtime
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
42
|
requirements:
|
45
43
|
- - ! '>='
|
46
44
|
- !ruby/object:Gem::Version
|
@@ -48,87 +46,89 @@ dependencies:
|
|
48
46
|
- - ~>
|
49
47
|
- !ruby/object:Gem::Version
|
50
48
|
version: '1.0'
|
51
|
-
type: :runtime
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
49
|
none: false
|
55
|
-
requirements:
|
56
|
-
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version: '2.7'
|
59
|
-
name: rspec
|
60
50
|
prerelease: false
|
51
|
+
name: multi_json
|
52
|
+
- !ruby/object:Gem::Dependency
|
61
53
|
requirement: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
54
|
requirements:
|
64
55
|
- - ~>
|
65
56
|
- !ruby/object:Gem::Version
|
66
57
|
version: '2.7'
|
58
|
+
none: false
|
67
59
|
type: :development
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
60
|
version_requirements: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
61
|
requirements:
|
72
62
|
- - ~>
|
73
63
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
75
|
-
|
64
|
+
version: '2.7'
|
65
|
+
none: false
|
76
66
|
prerelease: false
|
67
|
+
name: rspec
|
68
|
+
- !ruby/object:Gem::Dependency
|
77
69
|
requirement: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
70
|
requirements:
|
80
71
|
- - ~>
|
81
72
|
- !ruby/object:Gem::Version
|
82
73
|
version: '1.0'
|
74
|
+
none: false
|
83
75
|
type: :development
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
76
|
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
77
|
requirements:
|
88
78
|
- - ~>
|
89
79
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.
|
91
|
-
|
80
|
+
version: '1.0'
|
81
|
+
none: false
|
92
82
|
prerelease: false
|
83
|
+
name: bundler
|
84
|
+
- !ruby/object:Gem::Dependency
|
93
85
|
requirement: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
86
|
requirements:
|
96
87
|
- - ~>
|
97
88
|
- !ruby/object:Gem::Version
|
98
89
|
version: 1.8.3
|
90
|
+
none: false
|
99
91
|
type: :development
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
92
|
version_requirements: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
93
|
requirements:
|
104
|
-
- -
|
94
|
+
- - ~>
|
105
95
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
107
|
-
|
96
|
+
version: 1.8.3
|
97
|
+
none: false
|
108
98
|
prerelease: false
|
99
|
+
name: jeweler
|
100
|
+
- !ruby/object:Gem::Dependency
|
109
101
|
requirement: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
102
|
requirements:
|
112
103
|
- - ! '>='
|
113
104
|
- !ruby/object:Gem::Version
|
114
105
|
version: '3.11'
|
106
|
+
none: false
|
115
107
|
type: :development
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
108
|
version_requirements: !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
109
|
requirements:
|
120
110
|
- - ! '>='
|
121
111
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
123
|
-
|
112
|
+
version: '3.11'
|
113
|
+
none: false
|
124
114
|
prerelease: false
|
115
|
+
name: rdoc
|
116
|
+
- !ruby/object:Gem::Dependency
|
125
117
|
requirement: !ruby/object:Gem::Requirement
|
126
|
-
none: false
|
127
118
|
requirements:
|
128
119
|
- - ! '>='
|
129
120
|
- !ruby/object:Gem::Version
|
130
121
|
version: '0'
|
122
|
+
none: false
|
131
123
|
type: :development
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
none: false
|
130
|
+
prerelease: false
|
131
|
+
name: source_map
|
132
132
|
description:
|
133
133
|
email: lautis@gmail.com
|
134
134
|
executables: []
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- .gitmodules
|
142
142
|
- .rspec
|
143
143
|
- .travis.yml
|
144
|
+
- CHANGELOG.md
|
144
145
|
- CONTRIBUTING.md
|
145
146
|
- Gemfile
|
146
147
|
- LICENSE.txt
|
@@ -162,20 +163,20 @@ rdoc_options: []
|
|
162
163
|
require_paths:
|
163
164
|
- lib
|
164
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
166
|
requirements:
|
167
167
|
- - ! '>='
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
+
hash: -745476378542227179
|
169
170
|
segments:
|
170
171
|
- 0
|
171
|
-
hash: 887923606777556648
|
172
172
|
version: '0'
|
173
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
173
|
none: false
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - ! '>='
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: '0'
|
179
|
+
none: false
|
179
180
|
requirements: []
|
180
181
|
rubyforge_project:
|
181
182
|
rubygems_version: 1.8.23
|