Skip to content
Browse files

updated build

  • Loading branch information...
1 parent ffc2998 commit ff178d7acb05fe5cdeb7cc06c7e7801969802e97 @cadorn cadorn committed Aug 14, 2012
2 README.md
@@ -4,7 +4,7 @@ Optimized [PINF](http://pinf.org/)/[CommonJS](http://commonjs.org/) Loader for J
*Status: ALPHA* [![Build Status](https://secure.travis-ci.org/sourcemint/loader-js.png)](http://travis-ci.org/sourcemint/loader-js)
The `Sourcemint JavaScript Loader` is an optimized *(intended for production use)* **CommonJS package mappings**
-based **JavaScript module loader** for the browser in only **1637 bytes** *(minified and zipped)*.
+based **JavaScript module loader** for the browser in only **1720 bytes** *(minified and zipped)*.
* Copyright: 2011 [Christoph Dorn](http://www.christophdorn.com/)
* Code License: [MIT](http://www.opensource.org/licenses/mit-license.php) and [MPL](http://mozilla.org/MPL/2.0/)
View
2 loader.crush.js
@@ -1 +1 @@
-_=',=>;((v,gj=[],w={ed:1,7Wractive:1,compXW:1},x o,m` d(b`%importSHs)importSHs(b/,A))`(else{/b)?"//"+g.locatiK.host+b/,A):/^b)4 +bpD(p=g.getEXmFsByTagName("head")c=g.cQaWEXmF("sH"c.type="Wxt/javasH";c.K=c bb=bDv.evF;%""Yb.typeDw[@.QadyStaW])@.K=@=@.Kerror=>`((c.parFNode.QmoveChild(c)})c.Kerror c.charset="utf-8";c.async=!0;c.src=b;c=p.7sertBefoQ(c,p.firstChild)}} t(b,i,cA!==i4b=( +i+ +b)5+/g, )qG?c(k):nG?nG.push(c):(nG=[],b=o+b,(#Df.Dd)(b,(ddeXW #;u(b,ic(kd&&d()}))} u(b`for(c 7 j[1])"undef7ed"= i[c]4i[f+c]=j[1][c]j.shift()}i=6q=6r=6p,n=6kJo},s b%rG)rG;d=i[b+"/pZ.jsK"]D{:"/.js"},c=d.mapp7gsD6g=d.diQctoriesD6j=g.lib&&A!=g.lib?g.lib+ :A,lJb,:d.},m e d9-1Ya ).pop().7dexOf(".")?a+=".js":/^a)D9= +aa} g9%/^\\./.Wst9))a=a^\\.5/,A)"../"),a= +j.slice(1,j-a+1).cKcat9[a-1]).jo7( ),[l,d9)];a=a Qturn[s(c[a]),d9.slice(1).jo7( ))]}j=e5[^5]*$/,A) ),hJe,:6:9,b%"str7g"! a)async.call(>,a,ba=g9aV9[1]).}hVid aa=g9aV.id9[1])async a,ba=g9a.9[1],b) 3Y4[2].=[2].Df./^\\./.Wst()4=o+ +,=5\\.5/g, )._.id=o;nameToUrl ao+id9)h. %""= iaJh.id,:void 0AYb4l.Ye&&!0Yf.isMa7)4=a%ModuX)ModuX9,h,l,kc=i(hV,h.,aa.?h.=a.:c4h.=c)}else h.="str7g"= i?decodeURICompKF(i):ihl. e,ct((!/^e)? +j:A)+e,b,(c(lV(e).)})lV ec;/^e)D(e= +j+ee=b+e;qD(q=m(e)).(%nc=n;deXW n;for(d=0;d<c;d++)c[d](k)}qlV.id c/^c)D(c= +j+cQturn((A!==b? +b+ :A)+c)5+/g, )%PZ)PZ(l,k,{f7alizeLoad:u,moduXInitializers:i}rG=lkV bs(A)V(b)k.boot kV(s(A).).k. b=k.boot(b.?b._:void 0t(".js",A,mk g=6m @.bundX d`g=6i=new m(di.memoize d`g[d]=ff(ij.push([d,g])}}`=new m;ff. d`,jd=d\\.js$/,Ag[d]=x(d`,jD{})f}(D(="object"= 4V=)})(@,documF?documF:>functiKQquiQQturn "undef7ed"! exportsargumFs.Qplace(/5/.Wst( =( ==typeof "/"var sourcem7tload){);^5?\\{host\\}ma7.supports=["ucjs2-p7f-0"];[0].XngthhV.f.KInitb=g.locatiK.protocol+]};.split(sandbox.KQadystaWchange#f.rootBundXLoader%if(4&&(5\\/6{},7in9(a>null@thisA""D||FentG[b]HcriptJ={id:KonQreV.WteXleY===Zackage_.apply(>,)`,f';for(Y=0;$='`_ZYXWVQKJHGFDA@>97654%# '[Y++];)with(_.split($))_=join(pop());eval(_)
+_=', =@;(x,gn=[],y={ed:1,>Yractive:1,compZY:1},z=qD.bundZg,hp=e=new q(ge.memoizej,ep[j]=eh(en.push([g,p])}},h=new q;hh.h,q,pe=h\\.js$/,5,j=pFAb,i6importSKs)importSKs(b/,5),i(else{/b)?"//"+g.locatiV.host+b/,5:/^b)7 +brF(r=g.getEZmHsByTagName("head")c=g.cWaYEZmH("sK"c.type="Yxt/javasK";c.V=c%bb=bFx.evH;6""_b.typeFy[D.WadyStaY])D.V=D%=D.Verror=@,i(c.parHNode.WmoveChild(c)})c.Verrorc.charset="utf-8";c.async=!0;c.src=b;c=r.>sertBefoW(c,r.firstChild)}},wb,i,c""!==i7b=( +i+ +b)9+/g, )sJ?c(k):oJ?oJ.push(c):(oJ=[],b=e+b,(4Fj.FA)(b,edeZY 4;v(b,ic(ke&&e()}))},vb,efor(c > n[1])"undef>ed"= l[c]7l[e+c]=n[1][c]n.shift()},l=s=t=r,o=kQe},ub6tJ)tJ;i=l[b+"/p`.jsV"]F{:"/.js"},c=i.mapp>gsFg=i.diWctoriesFh=g.lib&&""!=g.lib?g.lib+ :"",mQb,:i.},nd gG-1_a# ).pop().>dexOf(".")?a+=".js":/^a)FG= +aa} hG6/^\\./.YstG))a=a^\\.9/,5#"../"),a= +i.slice(1,i-a+1).cVcatG[a-1]).jo>( ),[m,gG)];a=a# Wturn[u(c[a]),gG.slice(1).jo>( ))]}i=d9[^9]*$/,5# ),fQd,::a,b6"str>g"! a)async.call(@,a,ba=hGaXG[1]).}fXidaa=hGaX.idG[1])asynca,ba=hGa.G[1],b)3_7[2].=[2].Fj./^\\./.Yst()7=e+ +,=9\\.9/g, ) ..apply(@,).id=e;nameToUrlae+idG)f.6""= laQf.id,:void 0""_b7m._d&&!0_j.isMa>)7=a6ModuZ)ModuZG,f,m,kc=l(fX,f.,aa.?f.=a.:c7f.=c)}else f.="str>g"= l?decodeURICompVH(l):lfm.d,cw((!/^d)? +h:5+d,b,c(mX(d).)})mXdc;/^d)F(d= +h+dd=b+d;sF(s=n(d)).(6oc=o;deZY o;for(e=0;e<c;e++)c[e](k)}smX.idc/^c)F(c= +h+cWturn((""!==b? +b+ :5+c)9+/g, )6P`)P`(m,k,{f>alizeLoad:v,moduZInitializers:l}tJ=mkXbu(5X(b)k.bootkX(u(5.).k.b=k.boot(b.?b..apply(@,):void 0w(".js","",qz[e]=k =h;F(= "object"= 7X= )})(D,documH?documH:@(WquiWWturn "undef>ed"! exportsargumHs.Wplace(/9/.Yst( ==typeof "/" sourcem>tvar load){);^9?\\{host\\}ma>.supports=["ucjs2-p>f-0"];[0].Zngth=fX.functiVj.VInitb=g.locatiV.protocol+[d]};{},sandbox#.split(%.VWadystaYchange4j.rootBundZLoader5"")6if(7&&(9\\/>in@nullDthisF||G(aHentJ[b]KcriptQ={id:VonWreX.YteZle_===`ackage';for(Y=0;$='`_ZYXWVQKJHGFD@>97654%# '[Y++];)with(_.split($))_=join(pop());eval(_)
View
BIN loader.crush.js.gz
Binary file not shown.
View
18 loader.js
@@ -32,9 +32,27 @@ var sourcemint = null;
id: sandboxIdentifier
};
+ /*DEBUG*/ function logDebug() {
+ /*DEBUG*/ if (sandboxOptions.debug !== true) return;
+ /*DEBUG*/ // NOTRE: This does not work in google chrome.
+ /*DEBUG*/ //console.log.apply(null, arguments);
+ /*DEBUG*/ if (arguments.length === 1) {
+ /*DEBUG*/ console.log(arguments[0]);
+ /*DEBUG*/ } else
+ /*DEBUG*/ if (arguments.length === 2) {
+ /*DEBUG*/ console.log(arguments[0], arguments[1]);
+ /*DEBUG*/ } else
+ /*DEBUG*/ if (arguments.length === 3) {
+ /*DEBUG*/ console.log(arguments[0], arguments[1], arguments[2]);
+ /*DEBUG*/ } else
+ /*DEBUG*/ if (arguments.length === 4) {
+ /*DEBUG*/ console.log(arguments[0], arguments[1], arguments[2], arguments[3]);
+ /*DEBUG*/ }
+ /*DEBUG*/ }
// @credit https://github.com/unscriptable/curl/blob/62caf808a8fd358ec782693399670be6806f1845/src/curl.js#L319-360
function loadInBrowser(uri, loadedCallback) {
+ /*DEBUG*/ logDebug("[sm-loader]", 'loadInBrowser("' + uri + '")"');
// See if we are in a web worker.
if (typeof importScripts !== "undefined") {
importScripts(uri.replace(/^\/?\{host\}/, ""));
View
16 loader.min.js
@@ -1,9 +1,9 @@
var require,sourcemint=null;
-(function(v,g){var j=[],w={loaded:1,interactive:1,complete:1},x=function(o,m,f){function d(b,f){if("undefined"!==typeof importScripts)importScripts(b.replace(/^\/?\{host\}/,"")),f();else{/^\/?\{host\}\//.test(b)?b=g.location.protocol+"//"+g.location.host+b.replace(/^\/?\{host\}/,""):/^\//.test(b)&&(b=g.location.protocol+"/"+b);p||(p=g.getElementsByTagName("head")[0]);var c=g.createElement("script");c.type="text/javascript";c.onload=c.onreadystatechange=function(b){b=b||v.event;if("load"===b.type||
-w[this.readyState])this.onload=this.onreadystatechange=this.onerror=null,f(function(){c.parentNode.removeChild(c)})};c.onerror=function(){};c.charset="utf-8";c.async=!0;c.src=b;c=p.insertBefore(c,p.firstChild)}}function t(b,i,c){""!==i&&(b=("/"+i+"/"+b).replace(/\/+/g,"/"));q[b]?c(k):n[b]?n[b].push(c):(n[b]=[],b=o+b,(f.rootBundleLoader||f.load||d)(b,function(d){delete f.rootBundleLoader;u(b,i);c(k);d&&d()}))}function u(b,f){for(var c in j[0][1])"undefined"===typeof i[c]&&(i[f+c]=j[0][1][c]);j.shift()}
-var i={},q={},r={},p,n={},k={id:o},s=function(b){if(r[b])return r[b];var d=i[b+"/package.json"]||{main:"/main.js"},c=d.mappings||{},g=d.directories||{},j="undefined"!==typeof g.lib&&""!=g.lib?g.lib+"/":"",l={id:b,main:d.main},m=function(e){function d(a){-1===a.split("/").pop().indexOf(".")?a+=".js":/^\//.test(a)||(a="/"+a);return a}function g(a){if(/^\./.test(a))return a=a.replace(/^\.\//,"").split("../"),a="/"+j.slice(1,j.length-a.length+1).concat(a[a.length-1]).join("/"),[l,d(a)];a=a.split("/");
-return[s(c[a[0]]),d(a.slice(1).join("/"))]}var j=e.replace(/\/[^\/]*$/,"").split("/"),h={id:e,exports:{},require:function(a,b){if("string"!==typeof a)return h.require.async.call(null,a[0],b);a=g(a);return a[0].require(a[1]).exports}};h.require.supports=["ucjs2-pinf-0"];h.require.id=function(a){a=g(a);return a[0].require.id(a[1])};h.require.async=function(a,b){a=g(a);a[0].load(a[1],b)};h.require.sandbox=function(){3===arguments.length&&(arguments[2].load=arguments[2].load||f.load);/^\./.test(arguments[0])&&
-(arguments[0]=o+"/"+arguments[0],arguments[0]=arguments[0].replace(/\/\.\//g,"/"));return sourcemint.sandbox.apply(null,arguments)};h.require.sandbox.id=o;h.require.nameToUrl=function(a){return o+h.require.id(a)};h.load=function(){if("function"===typeof i[e]){var a={id:h.id,exports:void 0};""===b&&(l.main===e&&!0===f.isMain)&&(h.require.main=a);if(f.onInitModule)f.onInitModule(a,h,l,k);var c=i[e](h.require,h.exports,a);"undefined"!==typeof a.exports?h.exports=a.exports:"undefined"!==typeof c&&(h.exports=
-c)}else h.exports="string"===typeof i[e]?decodeURIComponent(i[e]):i[e]};return h};l.load=function(e,c){t((!/^\//.test(e)?"/"+j:"")+e,b,function(){c(l.require(e).exports)})};l.require=function(e){var c;/^\//.test(e)||(e="/"+j+e);e=b+e;q[e]||(q[e]=m(e)).load();if(n[e]){c=n[e];delete n[e];for(var d=0;d<c.length;d++)c[d](k)}return q[e]};l.require.id=function(c){/^\//.test(c)||(c="/"+j+c);return((""!==b?"/"+b+"/":"")+c).replace(/\/+/g,"/")};if(f.onInitPackage)f.onInitPackage(l,k,{finalizeLoad:u,moduleInitializers:i});
-return r[b]=l};k.require=function(b){return s("").require(b)};k.boot=function(){return k.require(s("").main).exports};k.main=function(){var b=k.boot();return b.main?b.main.apply(null,arguments):void 0};t(".js","",m);return k};sourcemint=function(){var g={},m=function(){this.bundle=function(d,f){var g={},i=new m(d);i.memoize=function(d,f){g[d]=f};f(i);j.push([d,g])}},f=new m;f.supports=["ucjs2-pinf-0"];f.sandbox=function(d,f,j){d=d.replace(/\.js$/,"");return g[d]=x(d,f,j||{})};return f}();require||
-(require=sourcemint);"object"===typeof exports&&(exports.require=sourcemint)})(this,"undefined"!==typeof document?document:null);
+(function(x,g){function y(){1===arguments.length?console.log(arguments[0]):2===arguments.length?console.log(arguments[0],arguments[1]):3===arguments.length?console.log(arguments[0],arguments[1],arguments[2]):4===arguments.length&&console.log(arguments[0],arguments[1],arguments[2],arguments[3])}var n=[],z={loaded:1,interactive:1,complete:1},A={},q=function(){this.bundle=function(g,h){var p={},e=new q(g);e.memoize=function(j,e){p[j]=e};h(e);n.push([g,p])}},h=new q;h.supports=["ucjs2-pinf-0"];h.sandbox=
+function(h,q,p){var e=h.replace(/\.js$/,""),j=p||{},B=function(a,i){y("[sm-loader]",'loadInBrowser("'+a+'")"');if("undefined"!==typeof importScripts)importScripts(a.replace(/^\/?\{host\}/,"")),i();else{/^\/?\{host\}\//.test(a)?a=g.location.protocol+"//"+g.location.host+a.replace(/^\/?\{host\}/,""):/^\//.test(a)&&(a=g.location.protocol+"/"+a);r||(r=g.getElementsByTagName("head")[0]);var c=g.createElement("script");c.type="text/javascript";c.onload=c.onreadystatechange=function(a){a=a||x.event;if("load"===
+a.type||z[this.readyState])this.onload=this.onreadystatechange=this.onerror=null,i(function(){c.parentNode.removeChild(c)})};c.onerror=function(){};c.charset="utf-8";c.async=!0;c.src=a;c=r.insertBefore(c,r.firstChild)}},w=function(a,i,c){""!==i&&(a=("/"+i+"/"+a).replace(/\/+/g,"/"));s[a]?c(k):o[a]?o[a].push(c):(o[a]=[],a=e+a,(j.rootBundleLoader||j.load||B)(a,function(e){delete j.rootBundleLoader;v(a,i);c(k);e&&e()}))},v=function(a,e){for(var c in n[0][1])"undefined"===typeof l[c]&&(l[e+c]=n[0][1][c]);
+n.shift()},l={},s={},t={},r,o={},k={id:e},u=function(a){if(t[a])return t[a];var i=l[a+"/package.json"]||{main:"/main.js"},c=i.mappings||{},g=i.directories||{},h="undefined"!==typeof g.lib&&""!=g.lib?g.lib+"/":"",m={id:a,main:i.main},n=function(d){function g(b){-1===b.split("/").pop().indexOf(".")?b+=".js":/^\//.test(b)||(b="/"+b);return b}function h(b){if(/^\./.test(b))return b=b.replace(/^\.\//,"").split("../"),b="/"+i.slice(1,i.length-b.length+1).concat(b[b.length-1]).join("/"),[m,g(b)];b=b.split("/");
+return[u(c[b[0]]),g(b.slice(1).join("/"))]}var i=d.replace(/\/[^\/]*$/,"").split("/"),f={id:d,exports:{},require:function(b,a){if("string"!==typeof b)return f.require.async.call(null,b[0],a);b=h(b);return b[0].require(b[1]).exports}};f.require.supports=["ucjs2-pinf-0"];f.require.id=function(b){b=h(b);return b[0].require.id(b[1])};f.require.async=function(b,a){b=h(b);b[0].load(b[1],a)};f.require.sandbox=function(){3===arguments.length&&(arguments[2].load=arguments[2].load||j.load);/^\./.test(arguments[0])&&
+(arguments[0]=e+"/"+arguments[0],arguments[0]=arguments[0].replace(/\/\.\//g,"/"));return sourcemint.sandbox.apply(null,arguments)};f.require.sandbox.id=e;f.require.nameToUrl=function(a){return e+f.require.id(a)};f.load=function(){if("function"===typeof l[d]){var b={id:f.id,exports:void 0};""===a&&(m.main===d&&!0===j.isMain)&&(f.require.main=b);if(j.onInitModule)j.onInitModule(b,f,m,k);var c=l[d](f.require,f.exports,b);"undefined"!==typeof b.exports?f.exports=b.exports:"undefined"!==typeof c&&(f.exports=
+c)}else f.exports="string"===typeof l[d]?decodeURIComponent(l[d]):l[d]};return f};m.load=function(d,c){w((!/^\//.test(d)?"/"+h:"")+d,a,function(){c(m.require(d).exports)})};m.require=function(d){var c;/^\//.test(d)||(d="/"+h+d);d=a+d;s[d]||(s[d]=n(d)).load();if(o[d]){c=o[d];delete o[d];for(var e=0;e<c.length;e++)c[e](k)}return s[d]};m.require.id=function(c){/^\//.test(c)||(c="/"+h+c);return((""!==a?"/"+a+"/":"")+c).replace(/\/+/g,"/")};if(j.onInitPackage)j.onInitPackage(m,k,{finalizeLoad:v,moduleInitializers:l});
+return t[a]=m};k.require=function(a){return u("").require(a)};k.boot=function(){return k.require(u("").main).exports};k.main=function(){var a=k.boot();return a.main?a.main.apply(null,arguments):void 0};w(".js","",q);return A[e]=k};sourcemint=h;require||(require=sourcemint);"object"===typeof exports&&(exports.require=sourcemint)})(this,"undefined"!==typeof document?document:null);
View
BIN loader.min.js.gz
Binary file not shown.
View
6 workspace/main.js
@@ -149,6 +149,9 @@ function getMinifiedSource(callback)
FS.writeFileSync(ROOT_PATH + "/README.md", readme);
console.log("... OK");
+
+ // TMP: Bypass for now cos it is so slow.
+ /*
console.log("Crushing loader.min.js using JSCrush ...");
crushSource(compiledSource, function(crushedSource)
@@ -162,11 +165,14 @@ function getMinifiedSource(callback)
FS.writeFileSync(ROOT_PATH + "/workspace/www/loader.stripped.js.md5", sourceHash);
console.log("... OK");
+ */
minifying = false;
done();
+ /*
});
});
+ */
});
});
}
View
2 workspace/www/loader.crush.js-size
@@ -1 +1 @@
-2293
+2280
View
2 workspace/www/loader.crush.js.gz-size
@@ -1 +1 @@
-1715
+1710
View
2 workspace/www/loader.min.js-size
@@ -1 +1 @@
-3715
+3985
View
2 workspace/www/loader.min.js.gz-size
@@ -1 +1 @@
-1637
+1720

0 comments on commit ff178d7

Please sign in to comment.
Something went wrong with that request. Please try again.