Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 15dc9ba

Browse files
committed
0.9.4
1 parent 8ff4941 commit 15dc9ba

9 files changed

+33
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _Note the ES6 module specification is still in draft, and subject to change._
2323

2424
### Basic Use
2525

26-
Download both [es6-module-loader.js](https://raw.githubusercontent.com/ModuleLoader/es6-module-loader/v0.9.3/dist/es6-module-loader.js) and traceur.js into the same folder.
26+
Download both [es6-module-loader.js](https://raw.githubusercontent.com/ModuleLoader/es6-module-loader/v0.9.4/dist/es6-module-loader.js) and traceur.js into the same folder.
2727

2828
If using ES6 syntax (optional), include [`traceur.js`](https://raw.githubusercontent.com/jmcriffey/bower-traceur/0.0.72/traceur.js) in the page first then include `es6-module-loader.js`:
2929

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "es6-module-loader",
3-
"version": "0.9.3",
3+
"version": "0.9.4",
44
"description": "An ES6 Module Loader polyfill based on the latest spec.",
55
"homepage": "https://github.com/ModuleLoader/es6-module-loader",
66
"main": "dist/es6-module-loader-sans-promises.js",

dist/es6-module-loader-sans-promises.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader-sans-promises.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader-sans-promises.src.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ function logloads(loads) {
11671167

11681168
var fetchTextFromURL;
11691169

1170-
if (isBrowser || isWorker) {
1170+
if (typeof XMLHttpRequest != 'undefined') {
11711171
fetchTextFromURL = function(url, fulfill, reject) {
11721172
var xhr = new XMLHttpRequest();
11731173
var sameDomain = true;
@@ -1180,7 +1180,7 @@ function logloads(loads) {
11801180
sameDomain &= domainCheck[1] === window.location.protocol;
11811181
}
11821182
}
1183-
if (!sameDomain) {
1183+
if (!sameDomain && typeof XDomainRequest != 'undefined') {
11841184
xhr = new XDomainRequest();
11851185
xhr.onload = load;
11861186
xhr.onerror = error;
@@ -1210,7 +1210,7 @@ function logloads(loads) {
12101210
xhr.send(null);
12111211
}
12121212
}
1213-
else {
1213+
else if (typeof require != 'undefined') {
12141214
var fs;
12151215
fetchTextFromURL = function(url, fulfill, reject) {
12161216
fs = fs || require('fs');
@@ -1222,19 +1222,25 @@ function logloads(loads) {
12221222
});
12231223
}
12241224
}
1225+
else {
1226+
throw new TypeError('No environment fetch API available.');
1227+
}
12251228

12261229
var SystemLoader = function($__super) {
12271230
function SystemLoader(options) {
12281231
$__Object$getPrototypeOf(SystemLoader.prototype).constructor.call(this, options || {});
12291232

12301233
// Set default baseURL and paths
1231-
if (isBrowser || isWorker) {
1234+
if (typeof location != 'undefined' && location.href) {
12321235
var href = __global.location.href.split('#')[0].split('?')[0];
12331236
this.baseURL = href.substring(0, href.lastIndexOf('/') + 1);
12341237
}
1235-
else {
1238+
else if (typeof process != 'undefined' && process.cwd) {
12361239
this.baseURL = process.cwd() + '/';
12371240
}
1241+
else {
1242+
throw new TypeError('No environment baseURL');
1243+
}
12381244
this.paths = { '*': '*.js' };
12391245
}
12401246

@@ -1392,7 +1398,7 @@ function logloads(loads) {
13921398

13931399
// <script type="module"> support
13941400
// allow a data-init function callback once loaded
1395-
if (isBrowser) {
1401+
if (isBrowser && typeof document.getElementsByTagName != 'undefined') {
13961402
var curScript = document.getElementsByTagName('script');
13971403
curScript = curScript[curScript.length - 1];
13981404

dist/es6-module-loader.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader.src.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ function logloads(loads) {
23912391

23922392
var fetchTextFromURL;
23932393

2394-
if (isBrowser || isWorker) {
2394+
if (typeof XMLHttpRequest != 'undefined') {
23952395
fetchTextFromURL = function(url, fulfill, reject) {
23962396
var xhr = new XMLHttpRequest();
23972397
var sameDomain = true;
@@ -2404,7 +2404,7 @@ function logloads(loads) {
24042404
sameDomain &= domainCheck[1] === window.location.protocol;
24052405
}
24062406
}
2407-
if (!sameDomain) {
2407+
if (!sameDomain && typeof XDomainRequest != 'undefined') {
24082408
xhr = new XDomainRequest();
24092409
xhr.onload = load;
24102410
xhr.onerror = error;
@@ -2434,7 +2434,7 @@ function logloads(loads) {
24342434
xhr.send(null);
24352435
}
24362436
}
2437-
else {
2437+
else if (typeof require != 'undefined') {
24382438
var fs;
24392439
fetchTextFromURL = function(url, fulfill, reject) {
24402440
fs = fs || require('fs');
@@ -2446,19 +2446,25 @@ function logloads(loads) {
24462446
});
24472447
}
24482448
}
2449+
else {
2450+
throw new TypeError('No environment fetch API available.');
2451+
}
24492452

24502453
var SystemLoader = function($__super) {
24512454
function SystemLoader(options) {
24522455
$__Object$getPrototypeOf(SystemLoader.prototype).constructor.call(this, options || {});
24532456

24542457
// Set default baseURL and paths
2455-
if (isBrowser || isWorker) {
2458+
if (typeof location != 'undefined' && location.href) {
24562459
var href = __global.location.href.split('#')[0].split('?')[0];
24572460
this.baseURL = href.substring(0, href.lastIndexOf('/') + 1);
24582461
}
2459-
else {
2462+
else if (typeof process != 'undefined' && process.cwd) {
24602463
this.baseURL = process.cwd() + '/';
24612464
}
2465+
else {
2466+
throw new TypeError('No environment baseURL');
2467+
}
24622468
this.paths = { '*': '*.js' };
24632469
}
24642470

@@ -2616,7 +2622,7 @@ function logloads(loads) {
26162622

26172623
// <script type="module"> support
26182624
// allow a data-init function callback once loaded
2619-
if (isBrowser) {
2625+
if (isBrowser && typeof document.getElementsByTagName != 'undefined') {
26202626
var curScript = document.getElementsByTagName('script');
26212627
curScript = curScript[curScript.length - 1];
26222628

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "es6-module-loader",
33
"description": "An ES6 Module Loader shim",
4-
"version": "0.9.3",
4+
"version": "0.9.4",
55
"homepage": "https://github.com/ModuleLoader/es6-module-loader",
66
"author": {
77
"name": "Guy Bedford, Luke Hoban, Addy Osmani",

0 commit comments

Comments
 (0)