uglifier 2.2.0 → 2.2.1
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 +4 -0
- data/README.md +1 -2
- data/VERSION +1 -1
- data/lib/uglifier.rb +9 -4
- data/spec/uglifier_spec.rb +5 -0
- data/uglifier.gemspec +2 -2
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -49,7 +49,6 @@ Available options and their defaults are
|
|
49
49
|
:inline_script => false, # Escape occurrences of </script in strings
|
50
50
|
:quote_keys => false, # Quote keys in object literals
|
51
51
|
:max_line_len => 32 * 1024, # Maximum line length in minified code
|
52
|
-
:ie_proof => true, # Output block brackets around do-while loops
|
53
52
|
:bracketize => false, # Bracketize if, for, do, while or with statements, even if their body is a single statement
|
54
53
|
:semicolons => true, # Separate statements with semicolons
|
55
54
|
:preserve_line => false, # Preserve line numbers in outputs
|
@@ -86,7 +85,7 @@ Available options and their defaults are
|
|
86
85
|
:source_root => nil, # The URL of the directory which contains :source_filename
|
87
86
|
:output_filename => nil, # The filename or URL where the minified output can be found
|
88
87
|
:input_source_map => nil, # The contents of the source map describing the input
|
89
|
-
:screw_ie8 => false #
|
88
|
+
:screw_ie8 => false # Generate safe code for IE8
|
90
89
|
}
|
91
90
|
```
|
92
91
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.1
|
data/lib/uglifier.rb
CHANGED
@@ -14,7 +14,6 @@ class Uglifier
|
|
14
14
|
:inline_script => false, # Escape occurrences of </script in strings
|
15
15
|
:quote_keys => false, # Quote keys in object literals
|
16
16
|
:max_line_len => 32 * 1024, # Maximum line length in minified code
|
17
|
-
:ie_proof => true, # Output block brakcets around do-while loops
|
18
17
|
:bracketize => false, # Bracketize if, for, do, while or with statements, even if their body is a single statement
|
19
18
|
:semicolons => true, # Separate statements with semicolons
|
20
19
|
:preserve_line => false, # Preserve line numbers in outputs
|
@@ -52,7 +51,7 @@ class Uglifier
|
|
52
51
|
:source_root => nil, # The URL of the directory which contains :source_filename
|
53
52
|
:output_filename => nil, # The filename or URL where the minified output can be found
|
54
53
|
:input_source_map => nil, # The contents of the source map describing the input
|
55
|
-
:screw_ie8 => false #
|
54
|
+
:screw_ie8 => false # Generate safe code for IE8
|
56
55
|
}
|
57
56
|
|
58
57
|
SourcePath = File.expand_path("../uglify.js", __FILE__)
|
@@ -224,10 +223,16 @@ class Uglifier
|
|
224
223
|
end
|
225
224
|
|
226
225
|
def output_options
|
226
|
+
screw_ie8 = if (@options[:output] || {}).has_key?(:ie_proof)
|
227
|
+
false
|
228
|
+
else
|
229
|
+
@options[:screw_ie8] || DEFAULTS[:screw_ie8]
|
230
|
+
end
|
231
|
+
|
227
232
|
DEFAULTS[:output].merge(@options[:output] || {}).merge(
|
228
233
|
:comments => comment_options,
|
229
|
-
:screw_ie8 =>
|
230
|
-
).reject
|
234
|
+
:screw_ie8 => screw_ie8
|
235
|
+
).reject { |key,value| key == :ie_proof}
|
231
236
|
end
|
232
237
|
|
233
238
|
def source_map_options
|
data/spec/uglifier_spec.rb
CHANGED
@@ -163,6 +163,11 @@ describe "Uglifier" do
|
|
163
163
|
Uglifier.compile(code, :output => {:quote_keys => true}).should include('"foo"')
|
164
164
|
end
|
165
165
|
|
166
|
+
it "quotes unsafe keys by default" do
|
167
|
+
code = 'var code = {"class": ""}'
|
168
|
+
Uglifier.compile(code).should include('"class"')
|
169
|
+
end
|
170
|
+
|
166
171
|
it "handles constant definitions" do
|
167
172
|
code = "if (BOOLEAN) { var a = STRING; var b = NULL; var c = NUMBER; }"
|
168
173
|
defines = {"NUMBER" => 1234, "BOOLEAN" => true, "NULL" => nil, "STRING" => "str"}
|
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.2.
|
8
|
+
s.version = "2.2.1"
|
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-08-
|
12
|
+
s.date = "2013-08-28"
|
13
13
|
s.email = "lautis@gmail.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: uglifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.2.
|
5
|
+
version: 2.2.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-08-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
segments:
|
172
172
|
- 0
|
173
|
-
hash:
|
173
|
+
hash: -3464762904681284644
|
174
174
|
version: '0'
|
175
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
176
|
none: false
|