Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improved build script

  • Loading branch information...
commit 39e74f870d7940147ff6e141da13703ed481b93d 1 parent 7f95ea0
@contra authored
Showing with 10 additions and 3 deletions.
  1. +9 −2 build
  2. +1 −1  nova.min.js
View
11 build
@@ -1,4 +1,11 @@
#!/bin/sh
-coffee --watch --join nova.js --compile ./src/require.coffee ./src/nova.coffee ./src/modules/*.coffee
-uglifyjs --unsafe -nc --reserved-names "require" -o nova.min.js nova.js ./lib/superagent.js
+IN=nova.js
+OUT=nova.min.js
+
+coffee --watch --join "$IN" --compile ./src/require.coffee ./src/nova.coffee ./src/modules/*.coffee
+
+SIZE_MIN=$(uglifyjs "$IN" --extra --unsafe --reserved-names "require" | tee "$OUT" | wc -c)
+SIZE_GZIP=$(gzip -nfc --best "$OUT" | wc -c)
+
+echo $SIZE_MIN bytes minified, $SIZE_GZIP bytes gzipped
View
2  nova.min.js
@@ -1 +1 @@
-(function(){var require,a=Array.prototype.slice;require=function(a){var b;b=require.modules[a];if(!b)throw'module "'+a+'" does not exist';return b.exports||(b.exports={},b.call(b.exports,b,b.exports,require)),b.exports},require.modules={},require.register=function(a,b){return require.modules[a]=b},window.require=require,require.register("nova",function(a,b,require){return a.exports={version:"0.0.1",author:"Contra"}}),require.register("assert",function(a,b,require){var c,d,e,f;return f=require("util"),c=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,this.message=a.message||[JSON.stringify(this.actual),this.operator,JSON.stringify(this.expected)].join(" ");if(Error.captureStackTrace)return console.log("capturing trace"),Error.captureStackTrace(this,a.stackStartFunction||e)},f.inherits(c,Error),c.prototype=Error.prototype,c.prototype.toString=function(){return this.message!=null?this.name+": "+this.message:[this.name+":",JSON.stringify(this.actual),this.operator,JSON.stringify(this.expected)].join(" ")},e=function(a,b,d,e,f){throw new c({message:d,actual:a,expected:b,operator:e,stackStartFunction:f})},d=function(a,b){return!a&&!b?!1:b instanceof RegExp?b.test(a):a instanceof b?!0:b.call({},a)?!0:!1},a.exports={AssertionError:c,fail:e,ok:function(b,c){if(!b)return e(b,!0,c,"==",a.exports.ok)},equal:function(b,c,d){if(b!==c)return e(b,c,d,"==",a.exports.equal)},notEqual:function(b,c,d){if(b===c)return e(b,c,d,"!=",a.exports.notEqual)},deepEqual:function(b,c,d){if(b!==c)return e(b,c,d,"deepEqual",a.exports.deepEqual)},notDeepEqual:function(b,c,d){if(b===c)return e(b,c,d,"notDeepEqual",a.exports.notDeepEqual)},strictEqual:function(b,c,d){if(b!==c)return e(b,c,d,"===",a.exports.strictEqual)},notStrictEqual:function(b,c,d){if(b===c)return e(b,c,d,"!==",a.exports.notStrictEqual)},"throws":function(a,b,c){var f;typeof b=="string"&&(c=b,b=null);try{a()}catch(g){f=g}c=(b&&b.name?" ("+b.name+").":".")+(c?" "+c:"."),f||e("Missing expected exception"+c);if(!d(f,b))throw f},doesNotThrow:function(a,b,c){var f;typeof b=="string"&&(c=b,b=null);try{a()}catch(g){f=g}c=(b&&b.name?" ("+b.name+").":".")+(c?" "+c:"."),f&&d(f,b)&&e("Got unwanted exception"+c);if(f)throw f},ifError:function(a){if(a)throw a}}}),require.register("events",function(b,c,require){var d;return d=function(){return this.callbacks={},this.maxListeners=10},d.prototype.listeners=function(a){return this.callbacks[a]},d.prototype.setMaxListeners=function(a){return this.maxListeners=a},d.prototype.addListener=function(a,b){var c,d,e;if(typeof b!="function")throw new Error("addListener only takes instances of Function");return(d=this.callbacks)[a]||(d[a]=[]),this.callbacks[a].push(b),c=this.callbacks[a].length,c>(e=this.maxListeners)&&e>0&&console.error("warning: possible EventEmitter memory leak detected. "+c+" listeners added. Use emitter.setMaxListeners() to increase limit."),this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){return b._emitOnce=!0,this.addListener(a,b),this},d.prototype.removeListener=function(a,b){var c,d,e,f;if(typeof b!="function")throw new Error("addListener only takes instances of Function");if(this.callbacks[a]!=null){f=this.callbacks[a](where(c!==b));for(d=0,e=f.length;d<e;d++)c=f[d],this.callbacks[a]=c}return this},d.prototype.removeAllListeners=function(a){return a!=null?this.callbacks[a]!=null&&delete this.callbacks[a]:this.callbacks={},this},d.prototype.emit=function(){var b,c,d,e,f,g;c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[];if(this.callbacks[c]!=null){g=this.callbacks[c];for(e=0,f=g.length;e<f;e++){d=g[e],d.apply(d,b);if(d._emitOnce){this.callbacks[c].splice(e,1);if(this.callbacks[c].length===0){delete this.callbacks[c];break}}}}else if(c==="error")throw b[0]==null?new Error("Uncaught, unspecified 'error' event."):b[0]instanceof Error?b[0]:new Error(b[0]);return this},b.exports.EventEmitter=d}),require.register("fs",function(a,b,require){var c;return c=new Error("browser does not support localStorage"),a.exports={readFile:function(a,b){var c;if(typeof localStorage!="undefined"&&localStorage!==null){c=localStorage.getItem(a);if(c!=null){b(null,JSON.parse(c));return}}superagent.get(a,function(c){c.ok?b(null,c.text):b(new Error("ENOENT, The system cannot find the file specified. "+a),null)})},readFileSync:function(a){if(!localStorage)throw c;return JSON.parse(localStorage.getItem(a))},writeFile:function(a,b,c,d){d||(d=c),localStorage||d,localStorage.setItem(a,JSON.stringify(b)),d!=null&&d(null)},writeFileSync:function(a,b,d){if(!localStorage)throw c;localStorage.setItem(a,JSON.stringify(b))},rename:function(a,b,d){var e;if(!localStorage)throw c;e=localStorage.getItem(a);if(e!=null){localStorage.removeItem(a),localStorage.setItem(b,e);if(d!=null)return d(null)}else if(d!=null)return d(new Error("ENOENT, The system cannot find the file specified. "+a))}}}),require.register("readline",function(a,b,require){return a.exports={question:function(a,b){b(prompt(a))}}}),require.register("sys",function(a,b,require){return a.exports=require("util")}),require.register("util",function(a,b,require){return a.exports={print:console.log,puts:console.log,debug:console.debug,error:console.error,inspect:JSON.stringify,p:function(){return console.log(JSON.stringify(arguments))},log:console.log,pump:function(){return console.error("util.pump is not supported in nova at this time")},inherits:function(a,b){return a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}}})}).call(this)
+(function(){var a,b=Array.prototype.slice;a=function(b){var c;c=a.modules[b];if(!c)throw'module "'+b+'" does not exist';return c.exports||(c.exports={},c.call(c.exports,c,c.exports,a)),c.exports},a.modules={},a.register=function(b,c){return a.modules[b]=c},window.require=a,a.register("nova",function(a,b,c){return a.exports={version:"0.0.1",author:"Contra"}}),a.register("assert",function(a,b,c){var d,e,f,g;return g=c("util"),d=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,this.message=a.message||[JSON.stringify(this.actual),this.operator,JSON.stringify(this.expected)].join(" ");if(Error.captureStackTrace)return console.log("capturing trace"),Error.captureStackTrace(this,a.stackStartFunction||f)},g.inherits(d,Error),d.prototype=Error.prototype,d.prototype.toString=function(){return this.message!=null?this.name+": "+this.message:[this.name+":",JSON.stringify(this.actual),this.operator,JSON.stringify(this.expected)].join(" ")},f=function(a,b,c,e,f){throw new d({message:c,actual:a,expected:b,operator:e,stackStartFunction:f})},e=function(a,b){return!a&&!b?!1:b instanceof RegExp?b.test(a):a instanceof b?!0:b.call({},a)?!0:!1},a.exports={AssertionError:d,fail:f,ok:function(b,c){if(!b)return f(b,!0,c,"==",a.exports.ok)},equal:function(b,c,d){if(b!==c)return f(b,c,d,"==",a.exports.equal)},notEqual:function(b,c,d){if(b===c)return f(b,c,d,"!=",a.exports.notEqual)},deepEqual:function(b,c,d){if(b!==c)return f(b,c,d,"deepEqual",a.exports.deepEqual)},notDeepEqual:function(b,c,d){if(b===c)return f(b,c,d,"notDeepEqual",a.exports.notDeepEqual)},strictEqual:function(b,c,d){if(b!==c)return f(b,c,d,"===",a.exports.strictEqual)},notStrictEqual:function(b,c,d){if(b===c)return f(b,c,d,"!==",a.exports.notStrictEqual)},"throws":function(a,b,c){var d;typeof b=="string"&&(c=b,b=null);try{a()}catch(g){d=g}c=(b&&b.name?" ("+b.name+").":".")+(c?" "+c:"."),d||f("Missing expected exception"+c);if(!e(d,b))throw d},doesNotThrow:function(a,b,c){var d;typeof b=="string"&&(c=b,b=null);try{a()}catch(g){d=g}c=(b&&b.name?" ("+b.name+").":".")+(c?" "+c:"."),d&&e(d,b)&&f("Got unwanted exception"+c);if(d)throw d},ifError:function(a){if(a)throw a}}}),a.register("events",function(a,c,d){var e;return e=function(){return this.callbacks={},this.maxListeners=10},e.prototype.listeners=function(a){return this.callbacks[a]},e.prototype.setMaxListeners=function(a){return this.maxListeners=a},e.prototype.addListener=function(a,b){var c,d,e;if(typeof b!="function")throw new Error("addListener only takes instances of Function");return(d=this.callbacks)[a]||(d[a]=[]),this.callbacks[a].push(b),c=this.callbacks[a].length,c>(e=this.maxListeners)&&e>0&&console.error("warning: possible EventEmitter memory leak detected. "+c+" listeners added. Use emitter.setMaxListeners() to increase limit."),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(a,b){return b._emitOnce=!0,this.addListener(a,b),this},e.prototype.removeListener=function(a,b){var c,d,e,f;if(typeof b!="function")throw new Error("addListener only takes instances of Function");if(this.callbacks[a]!=null){f=this.callbacks[a](where(c!==b));for(d=0,e=f.length;d<e;d++)c=f[d],this.callbacks[a]=c}return this},e.prototype.removeAllListeners=function(a){return a!=null?this.callbacks[a]!=null&&delete this.callbacks[a]:this.callbacks={},this},e.prototype.emit=function(){var a,c,d,e,f,g;c=arguments[0],a=2<=arguments.length?b.call(arguments,1):[];if(this.callbacks[c]!=null){g=this.callbacks[c];for(e=0,f=g.length;e<f;e++){d=g[e],d.apply(d,a);if(d._emitOnce){this.callbacks[c].splice(e,1);if(this.callbacks[c].length===0){delete this.callbacks[c];break}}}}else if(c==="error")throw a[0]==null?new Error("Uncaught, unspecified 'error' event."):a[0]instanceof Error?a[0]:new Error(a[0]);return this},a.exports.EventEmitter=e}),a.register("fs",function(a,b,c){var d;return d=new Error("browser does not support localStorage"),a.exports={readFile:function(a,b){var c;if(typeof localStorage!="undefined"&&localStorage!==null){c=localStorage.getItem(a);if(c!=null){b(null,JSON.parse(c));return}}superagent.get(a,function(c){c.ok?b(null,c.text):b(new Error("ENOENT, The system cannot find the file specified. "+a),null)})},readFileSync:function(a){if(!localStorage)throw d;return JSON.parse(localStorage.getItem(a))},writeFile:function(a,b,c,d){d||(d=c),localStorage||d,localStorage.setItem(a,JSON.stringify(b)),d!=null&&d(null)},writeFileSync:function(a,b,c){if(!localStorage)throw d;localStorage.setItem(a,JSON.stringify(b))},rename:function(a,b,c){var e;if(!localStorage)throw d;e=localStorage.getItem(a);if(e!=null){localStorage.removeItem(a),localStorage.setItem(b,e);if(c!=null)return c(null)}else if(c!=null)return c(new Error("ENOENT, The system cannot find the file specified. "+a))}}}),a.register("readline",function(a,b,c){return a.exports={question:function(a,b){b(prompt(a))}}}),a.register("sys",function(a,b,c){return a.exports=c("util")}),a.register("util",function(a,b,c){return a.exports={print:console.log,puts:console.log,debug:console.debug,error:console.error,inspect:JSON.stringify,p:function(){return console.log(JSON.stringify(arguments))},log:console.log,pump:function(){return console.error("util.pump is not supported in nova at this time")},inherits:function(a,b){return a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}}})}).call(this)
Please sign in to comment.
Something went wrong with that request. Please try again.