lib/uglifier.rb in uglifier-1.2.4 vs lib/uglifier.rb in uglifier-1.2.5

- old
+ new

@@ -59,11 +59,11 @@ def compile(source) source = source.respond_to?(:read) ? source.read : source.to_s js = [] js << "var result = '';" - js << "var source = #{MultiJson.encode(source)};" + js << "var source = #{MultiJson.dump(source)};" js << "var ast = UglifyJS.parser.parse(source);" if @options[:lift_vars] js << "ast = UglifyJS.uglify.ast_lift_variables(ast);" end @@ -76,23 +76,21 @@ result += (c.type == "comment1") ? "//"+c.value+"\\n" : "/*"+c.value+"*/\\n"; } JS end - if @options[:mangle] - js << "ast = UglifyJS.uglify.ast_mangle(ast, #{MultiJson.encode(mangle_options)});" - end + js << "ast = UglifyJS.uglify.ast_mangle(ast, #{MultiJson.dump(mangle_options)});" if @options[:squeeze] - js << "ast = UglifyJS.uglify.ast_squeeze(ast, #{MultiJson.encode(squeeze_options)});" + js << "ast = UglifyJS.uglify.ast_squeeze(ast, #{MultiJson.dump(squeeze_options)});" end if @options[:unsafe] js << "ast = UglifyJS.uglify.ast_squeeze_more(ast);" end - js << "result += UglifyJS.uglify.gen_code(ast, #{MultiJson.encode(gen_code_options)});" + js << "result += UglifyJS.uglify.gen_code(ast, #{MultiJson.dump(gen_code_options)});" if !@options[:beautify] && @options[:max_line_length] js << "result = UglifyJS.uglify.split_lines(result, #{@options[:max_line_length].to_i})" end @@ -104,9 +102,10 @@ private def mangle_options { + "mangle" => @options[:mangle], "toplevel" => @options[:toplevel], "defines" => {}, "except" => @options[:except], "no_functions" => @options[:mangle] == :vars }