2222
2323var fs = require ( "fs" ) ;
2424var querystring = require ( 'querystring' ) ;
25- var http = require ( 'http ' ) ;
25+ var https = require ( 'https ' ) ;
2626
2727if ( process . argv . indexOf ( "-h" ) >= 0 || process . argv . indexOf ( "--help" ) >= 0 ) {
2828 console . log ( "Build file for shutup" ) ;
@@ -127,14 +127,15 @@ var post_data = querystring.stringify({
127127 //'compilation_level' : 'SIMPLE_OPTIMIZATIONS',
128128 'output_format' : 'json' ,
129129 'output_info' : [ 'compiled_code' , 'errors' ] ,
130+ 'language_out' : 'ES5' ,
130131 'language' : 'ECMASCRIPT5_STRICT' ,
131132 'js_code' : full
132133} ) ;
133134
134135// An object of options to indicate where to post to
135136var post_options = {
136137 host : 'closure-compiler.appspot.com' ,
137- port : '80 ' ,
138+ port : '443 ' ,
138139 path : '/compile' ,
139140 method : 'POST' ,
140141 headers : {
@@ -146,7 +147,7 @@ var post_options = {
146147var chunkAcc = "" ;
147148
148149// Set up the request
149- var post_req = http . request ( post_options , function ( res ) {
150+ var post_req = https . request ( post_options , function ( res ) {
150151 res . setEncoding ( 'utf8' ) ;
151152 res . on ( "data" , function ( chunk ) {
152153 chunkAcc += chunk ;
@@ -199,7 +200,7 @@ function preCompress(shutupjs){
199200 . file ( "example.html" , fs . readFileSync ( "example.html" ) )
200201 . file ( "CopyrightNotice" , copyright )
201202 . file ( "LICENSE" , fs . readFileSync ( rootDir + "LICENSE" ) )
202- . generate ( { type :"nodebuffer" , compression : "DEFLATE" } ) ;
203+ . generateNodeStream ( { type :"nodebuffer" , compression : "DEFLATE" } ) ;
203204 fs . writeFileSync ( filename , blob ) ;
204205}
205206
0 commit comments