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

Commit b2f4ff6

Browse files
committed
v0.17.7
1 parent e436b84 commit b2f4ff6

7 files changed

+31
-17
lines changed

dist/es6-module-loader-dev.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-dev.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-dev.src.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ function applyPaths(paths, name) {
13981398
}
13991399

14001400
var outPath = paths[pathMatch] || name;
1401-
if (wildcard)
1401+
if (typeof wildcard == 'string')
14021402
outPath = outPath.replace('*', wildcard);
14031403

14041404
return outPath;
@@ -1456,7 +1456,7 @@ SystemLoader.prototype.instantiate = function(load) {
14561456
};
14571457
var fetchTextFromURL;
14581458
if (typeof XMLHttpRequest != 'undefined') {
1459-
fetchTextFromURL = function(url, fulfill, reject) {
1459+
fetchTextFromURL = function(url, authorization, fulfill, reject) {
14601460
var xhr = new XMLHttpRequest();
14611461
var sameDomain = true;
14621462
var doTimeout = false;
@@ -1496,8 +1496,15 @@ SystemLoader.prototype.instantiate = function(load) {
14961496
};
14971497
xhr.open("GET", url, true);
14981498

1499-
if (xhr.setRequestHeader)
1499+
if (xhr.setRequestHeader) {
15001500
xhr.setRequestHeader('Accept', 'application/x-es-module */*');
1501+
// can set "authorization: true" to enable withCredentials only
1502+
if (authorization) {
1503+
if (typeof authorization == 'string')
1504+
xhr.setRequestHeader('Authorization', authorization);
1505+
xhr.withCredentials = true;
1506+
}
1507+
}
15011508

15021509
if (doTimeout)
15031510
setTimeout(function() {
@@ -1509,7 +1516,7 @@ SystemLoader.prototype.instantiate = function(load) {
15091516
}
15101517
else if (typeof require != 'undefined') {
15111518
var fs;
1512-
fetchTextFromURL = function(url, fulfill, reject) {
1519+
fetchTextFromURL = function(url, authorization, fulfill, reject) {
15131520
if (url.substr(0, 8) != 'file:///')
15141521
throw new Error('Unable to fetch "' + url + '". Only file URLs of the form file:/// allowed running in Node.');
15151522
fs = fs || require('fs');
@@ -1538,7 +1545,7 @@ SystemLoader.prototype.instantiate = function(load) {
15381545

15391546
SystemLoader.prototype.fetch = function(load) {
15401547
return new Promise(function(resolve, reject) {
1541-
fetchTextFromURL(load.address, resolve, reject);
1548+
fetchTextFromURL(load.address, undefined, resolve, reject);
15421549
});
15431550
};
15441551

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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ function applyPaths(paths, name) {
10561056
}
10571057

10581058
var outPath = paths[pathMatch] || name;
1059-
if (wildcard)
1059+
if (typeof wildcard == 'string')
10601060
outPath = outPath.replace('*', wildcard);
10611061

10621062
return outPath;
@@ -1114,7 +1114,7 @@ SystemLoader.prototype.instantiate = function(load) {
11141114
};
11151115
var fetchTextFromURL;
11161116
if (typeof XMLHttpRequest != 'undefined') {
1117-
fetchTextFromURL = function(url, fulfill, reject) {
1117+
fetchTextFromURL = function(url, authorization, fulfill, reject) {
11181118
var xhr = new XMLHttpRequest();
11191119
var sameDomain = true;
11201120
var doTimeout = false;
@@ -1154,8 +1154,15 @@ SystemLoader.prototype.instantiate = function(load) {
11541154
};
11551155
xhr.open("GET", url, true);
11561156

1157-
if (xhr.setRequestHeader)
1157+
if (xhr.setRequestHeader) {
11581158
xhr.setRequestHeader('Accept', 'application/x-es-module */*');
1159+
// can set "authorization: true" to enable withCredentials only
1160+
if (authorization) {
1161+
if (typeof authorization == 'string')
1162+
xhr.setRequestHeader('Authorization', authorization);
1163+
xhr.withCredentials = true;
1164+
}
1165+
}
11591166

11601167
if (doTimeout)
11611168
setTimeout(function() {
@@ -1167,7 +1174,7 @@ SystemLoader.prototype.instantiate = function(load) {
11671174
}
11681175
else if (typeof require != 'undefined') {
11691176
var fs;
1170-
fetchTextFromURL = function(url, fulfill, reject) {
1177+
fetchTextFromURL = function(url, authorization, fulfill, reject) {
11711178
if (url.substr(0, 8) != 'file:///')
11721179
throw new Error('Unable to fetch "' + url + '". Only file URLs of the form file:/// allowed running in Node.');
11731180
fs = fs || require('fs');
@@ -1196,7 +1203,7 @@ SystemLoader.prototype.instantiate = function(load) {
11961203

11971204
SystemLoader.prototype.fetch = function(load) {
11981205
return new Promise(function(resolve, reject) {
1199-
fetchTextFromURL(load.address, resolve, reject);
1206+
fetchTextFromURL(load.address, undefined, resolve, reject);
12001207
});
12011208
};
12021209

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.17.6",
4+
"version": "0.17.7",
55
"homepage": "https://github.com/ModuleLoader/es6-module-loader",
66
"author": {
77
"name": "Guy Bedford, Luke Hoban, Addy Osmani",

0 commit comments

Comments
 (0)