Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating grunt builds

  • Loading branch information...
commit 985525dd2aeb77d534a85af81e172e32aebc51e7 1 parent 23636d3
@addyosmani addyosmani authored
Showing with 18 additions and 9 deletions.
  1. +16 −7 dist/es6-module-loader.js
  2. +2 −2 dist/es6-module-loader.min.js
View
23 dist/es6-module-loader.js
@@ -1,4 +1,4 @@
-/*! es6-module-loader - v0.1.0 - 5/19/2012
+/*! es6-module-loader - v0.1.0 - 5/20/2012
* https://github.com/addyosmani/es6-module-loader
* Copyright (c) 2012 Luke Hogan, Addy Osmani; Licensed MIT */
@@ -66,11 +66,16 @@
var self = this;
this._fetch(url, this._baseURL, {
fulfill: function (src) {
- var actualSrc = self._translate(src, url, self._baseURL, key);
+
+ var actualSrc, evalSrc;
+
+ actualSrc = self._translate(src, url, self._baseURL, key);
if (self._strict) {
actualSrc = "'use strict';\n" + actualSrc;
}
- eval(actualSrc);
+
+ evalSrc = eval(actualSrc);
+ self.set(url, evalSrc);
callback(self._mios[key]);
},
redirect: function (url, baseURL) {
@@ -147,12 +152,15 @@
function Module(o) {
- if (o == null) throw new TypeError("Expected object");
- var obj = Object(o);
+
+ if (o === null) throw new TypeError("Expected object");
+ var obj = Object(o);
if (obj instanceof Module) {
- return obj;
+ return obj;
} else {
- var mio = Object.create(null);
+
+ var mio = Object.create(null);
+
for (var key in obj) {
(function (key) {
Object.defineProperty(mio, key, {
@@ -164,6 +172,7 @@
});
})(key);
}
+
return mio;
}
};
View
4 dist/es6-module-loader.min.js
@@ -1,4 +1,4 @@
-/*! es6-module-loader - v0.1.0 - 5/19/2012
+/*! es6-module-loader - v0.1.0 - 5/20/2012
* https://github.com/addyosmani/es6-module-loader
* Copyright (c) 2012 Luke Hogan, Addy Osmani; Licensed MIT */
-(function(global){function Loader(a,b){this._global=b.global||Object.create(null),this._baseURL=b.baseURL||this.global&&this.global.baseURL;if(b.linkedTo===null||b.linkedTo)throw new Error("Setting 'linkedTo' not yet supported.");this._strict=b.string===undefined?!1:!!b.string,this._resolve=b.resolve||a.resolve,this._fetch=b.fetch||a.fetch,this._translate=b.translate||a.translate,this._mios={}}function Module(a){if(a==null)throw new TypeError("Expected object");var b=Object(a);if(b instanceof Module)return b;var c=Object.create(null);for(var d in b)(function(a){Object.defineProperty(c,a,{configurable:!1,enumerable:!0,get:function(){return b[a]}})})(d);return c}Object.defineProperty(Loader.prototype,"global",{configurable:!0,enumerable:!0,get:function(){return this._global}}),Object.defineProperty(Loader.prototype,"baseURL",{configurable:!0,enumerable:!0,get:function(){return this._baseURL}}),Loader.prototype.load=function(url,callback,errback){var key=this._resolve(url,this._baseURL);if(this._mios[key])callback(this._mios[key]);else{var self=this;this._fetch(url,this._baseURL,{fulfill:function(src){var actualSrc=self._translate(src,url,self._baseURL,key);self._strict&&(actualSrc="'use strict';\n"+actualSrc),eval(actualSrc),callback(self._mios[key])},redirect:function(a,b){throw new Error("'redirect' not yet implemented")},reject:function(a){errback(a)}},key)}},Loader.prototype.eval=function(sourceText){with(this._global)eval(sourceText)},Loader.prototype.evalAsync=function(){throw new Error("'evalAsync' is not yet implemented. Its not required until module syntax is natively available.")},Loader.prototype.get=function(a){var b=this._resolve(a,this._baseURL);return this._mios[b]},Loader.prototype.set=function(a,b){var c=this._resolve(a,this._baseURL);if(typeof a=="string")this._mios[c]=Module(b);else for(var d in c)this._mios[d]=Module(c[d])},Loader.prototype.defineBuiltins=function(a){if(typeof a!="object")throw new Error("Expected object");for(var b in global)a[b]=global;return a};var defaultSystemLoader=new Loader(null,{global:window,baseURL:document.URL.substring(0,document.URL.lastIndexOf("/")+1),strict:!1,resolve:function(a,b){var c=b+a;return c},fetch:function(a,b,c,d){var e=b+a,f=new XMLHttpRequest;f.onreadystatechange=function(){f.readyState===4&&(f.status===200?c.fulfill(f.responseText):c.reject(f.statusText))},f.open("GET",e,!0),f.send(null)},translate:function(a,b,c,d){return a}});global.Loader=Loader,global.Module=Module,global.System=defaultSystemLoader})(window)
+(function(global){function Loader(a,b){this._global=b.global||Object.create(null),this._baseURL=b.baseURL||this.global&&this.global.baseURL;if(b.linkedTo===null||b.linkedTo)throw new Error("Setting 'linkedTo' not yet supported.");this._strict=b.string===undefined?!1:!!b.string,this._resolve=b.resolve||a.resolve,this._fetch=b.fetch||a.fetch,this._translate=b.translate||a.translate,this._mios={}}function Module(a){if(a===null)throw new TypeError("Expected object");var b=Object(a);if(b instanceof Module)return b;var c=Object.create(null);for(var d in b)(function(a){Object.defineProperty(c,a,{configurable:!1,enumerable:!0,get:function(){return b[a]}})})(d);return c}Object.defineProperty(Loader.prototype,"global",{configurable:!0,enumerable:!0,get:function(){return this._global}}),Object.defineProperty(Loader.prototype,"baseURL",{configurable:!0,enumerable:!0,get:function(){return this._baseURL}}),Loader.prototype.load=function(url,callback,errback){var key=this._resolve(url,this._baseURL);if(this._mios[key])callback(this._mios[key]);else{var self=this;this._fetch(url,this._baseURL,{fulfill:function(src){var actualSrc,evalSrc;actualSrc=self._translate(src,url,self._baseURL,key),self._strict&&(actualSrc="'use strict';\n"+actualSrc),evalSrc=eval(actualSrc),self.set(url,evalSrc),callback(self._mios[key])},redirect:function(a,b){throw new Error("'redirect' not yet implemented")},reject:function(a){errback(a)}},key)}},Loader.prototype.eval=function(sourceText){with(this._global)eval(sourceText)},Loader.prototype.evalAsync=function(){throw new Error("'evalAsync' is not yet implemented. Its not required until module syntax is natively available.")},Loader.prototype.get=function(a){var b=this._resolve(a,this._baseURL);return this._mios[b]},Loader.prototype.set=function(a,b){var c=this._resolve(a,this._baseURL);if(typeof a=="string")this._mios[c]=Module(b);else for(var d in c)this._mios[d]=Module(c[d])},Loader.prototype.defineBuiltins=function(a){if(typeof a!="object")throw new Error("Expected object");for(var b in global)a[b]=global;return a};var defaultSystemLoader=new Loader(null,{global:window,baseURL:document.URL.substring(0,document.URL.lastIndexOf("/")+1),strict:!1,resolve:function(a,b){var c=b+a;return c},fetch:function(a,b,c,d){var e=b+a,f=new XMLHttpRequest;f.onreadystatechange=function(){f.readyState===4&&(f.status===200?c.fulfill(f.responseText):c.reject(f.statusText))},f.open("GET",e,!0),f.send(null)},translate:function(a,b,c,d){return a}});global.Loader=Loader,global.Module=Module,global.System=defaultSystemLoader})(window)
Please sign in to comment.
Something went wrong with that request. Please try again.