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

Commit cba9bd2

Browse files
committed
v0.17.3
1 parent 3e7432f commit cba9bd2

7 files changed

+149
-157
lines changed

dist/es6-module-loader-dev.js

+2-2
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

+1-1
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

+71-75
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,73 @@
1+
// from https://gist.github.com/Yaffle/1088850
2+
(function(global) {
3+
function URLPolyfill(url, baseURL) {
4+
if (typeof url != 'string')
5+
throw new TypeError('URL must be a string');
6+
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
7+
if (!m) {
8+
throw new RangeError();
9+
}
10+
var protocol = m[1] || "";
11+
var username = m[2] || "";
12+
var password = m[3] || "";
13+
var host = m[4] || "";
14+
var hostname = m[5] || "";
15+
var port = m[6] || "";
16+
var pathname = m[7] || "";
17+
var search = m[8] || "";
18+
var hash = m[9] || "";
19+
if (baseURL !== undefined) {
20+
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
21+
var flag = protocol === "" && host === "" && username === "";
22+
if (flag && pathname === "" && search === "") {
23+
search = base.search;
24+
}
25+
if (flag && pathname.charAt(0) !== "/") {
26+
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
27+
}
28+
// dot segments removal
29+
var output = [];
30+
pathname.replace(/^(\.\.?(\/|$))+/, "")
31+
.replace(/\/(\.(\/|$))+/g, "/")
32+
.replace(/\/\.\.$/, "/../")
33+
.replace(/\/?[^\/]*/g, function (p) {
34+
if (p === "/..") {
35+
output.pop();
36+
} else {
37+
output.push(p);
38+
}
39+
});
40+
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
41+
if (flag) {
42+
port = base.port;
43+
hostname = base.hostname;
44+
host = base.host;
45+
password = base.password;
46+
username = base.username;
47+
}
48+
if (protocol === "") {
49+
protocol = base.protocol;
50+
}
51+
}
52+
53+
// convert windows file URLs to use /
54+
if (protocol == 'file:')
55+
pathname = pathname.replace(/\\/g, '/');
56+
57+
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
58+
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
59+
this.protocol = protocol;
60+
this.username = username;
61+
this.password = password;
62+
this.host = host;
63+
this.hostname = hostname;
64+
this.port = port;
65+
this.pathname = pathname;
66+
this.search = search;
67+
this.hash = hash;
68+
}
69+
global.URLPolyfill = URLPolyfill;
70+
})(typeof self != 'undefined' ? self : global);
171
(function(__global) {
272

373
var isWorker = typeof window == 'undefined' && typeof self != 'undefined' && typeof importScripts != 'undefined';
@@ -89,13 +159,7 @@
89159
throw new TypeError('No environment baseURI');
90160
}
91161

92-
var URL = __global.URL;
93-
try {
94-
new URL('test:///').protocol == 'test:';
95-
}
96-
catch(e) {
97-
URL = URLPolyfill;
98-
}
162+
var URL = __global.URLPolyfill || __global.URL;
99163

100164
/*
101165
*********************************************************************************************
@@ -1246,74 +1310,6 @@ var transpile = (function() {
12461310
return transpile;
12471311
})();
12481312

1249-
// from https://gist.github.com/Yaffle/1088850
1250-
function URLPolyfill(url, baseURL) {
1251-
if (typeof url != 'string')
1252-
throw new TypeError('URL must be a string');
1253-
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
1254-
if (!m) {
1255-
throw new RangeError();
1256-
}
1257-
var protocol = m[1] || "";
1258-
var username = m[2] || "";
1259-
var password = m[3] || "";
1260-
var host = m[4] || "";
1261-
var hostname = m[5] || "";
1262-
var port = m[6] || "";
1263-
var pathname = m[7] || "";
1264-
var search = m[8] || "";
1265-
var hash = m[9] || "";
1266-
if (baseURL !== undefined) {
1267-
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
1268-
var flag = protocol === "" && host === "" && username === "";
1269-
if (flag && pathname === "" && search === "") {
1270-
search = base.search;
1271-
}
1272-
if (flag && pathname.charAt(0) !== "/") {
1273-
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
1274-
}
1275-
// dot segments removal
1276-
var output = [];
1277-
pathname.replace(/^(\.\.?(\/|$))+/, "")
1278-
.replace(/\/(\.(\/|$))+/g, "/")
1279-
.replace(/\/\.\.$/, "/../")
1280-
.replace(/\/?[^\/]*/g, function (p) {
1281-
if (p === "/..") {
1282-
output.pop();
1283-
} else {
1284-
output.push(p);
1285-
}
1286-
});
1287-
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
1288-
if (flag) {
1289-
port = base.port;
1290-
hostname = base.hostname;
1291-
host = base.host;
1292-
password = base.password;
1293-
username = base.username;
1294-
}
1295-
if (protocol === "") {
1296-
protocol = base.protocol;
1297-
}
1298-
}
1299-
1300-
// convert windows file URLs to use /
1301-
if (protocol == 'file:')
1302-
pathname = pathname.replace(/\\/g, '/');
1303-
1304-
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
1305-
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
1306-
this.protocol = protocol;
1307-
this.username = username;
1308-
this.password = password;
1309-
this.host = host;
1310-
this.hostname = hostname;
1311-
this.port = port;
1312-
this.pathname = pathname;
1313-
this.search = search;
1314-
this.hash = hash;
1315-
}
1316-
(typeof self != 'undefined' ? self : global).URLPolyfill = URLPolyfill;
13171313
/*
13181314
*********************************************************************************************
13191315

dist/es6-module-loader.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/es6-module-loader.src.js

+71-75
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,73 @@
1+
// from https://gist.github.com/Yaffle/1088850
2+
(function(global) {
3+
function URLPolyfill(url, baseURL) {
4+
if (typeof url != 'string')
5+
throw new TypeError('URL must be a string');
6+
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
7+
if (!m) {
8+
throw new RangeError();
9+
}
10+
var protocol = m[1] || "";
11+
var username = m[2] || "";
12+
var password = m[3] || "";
13+
var host = m[4] || "";
14+
var hostname = m[5] || "";
15+
var port = m[6] || "";
16+
var pathname = m[7] || "";
17+
var search = m[8] || "";
18+
var hash = m[9] || "";
19+
if (baseURL !== undefined) {
20+
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
21+
var flag = protocol === "" && host === "" && username === "";
22+
if (flag && pathname === "" && search === "") {
23+
search = base.search;
24+
}
25+
if (flag && pathname.charAt(0) !== "/") {
26+
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
27+
}
28+
// dot segments removal
29+
var output = [];
30+
pathname.replace(/^(\.\.?(\/|$))+/, "")
31+
.replace(/\/(\.(\/|$))+/g, "/")
32+
.replace(/\/\.\.$/, "/../")
33+
.replace(/\/?[^\/]*/g, function (p) {
34+
if (p === "/..") {
35+
output.pop();
36+
} else {
37+
output.push(p);
38+
}
39+
});
40+
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
41+
if (flag) {
42+
port = base.port;
43+
hostname = base.hostname;
44+
host = base.host;
45+
password = base.password;
46+
username = base.username;
47+
}
48+
if (protocol === "") {
49+
protocol = base.protocol;
50+
}
51+
}
52+
53+
// convert windows file URLs to use /
54+
if (protocol == 'file:')
55+
pathname = pathname.replace(/\\/g, '/');
56+
57+
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
58+
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
59+
this.protocol = protocol;
60+
this.username = username;
61+
this.password = password;
62+
this.host = host;
63+
this.hostname = hostname;
64+
this.port = port;
65+
this.pathname = pathname;
66+
this.search = search;
67+
this.hash = hash;
68+
}
69+
global.URLPolyfill = URLPolyfill;
70+
})(typeof self != 'undefined' ? self : global);
171
(function(__global) {
272

373
var isWorker = typeof window == 'undefined' && typeof self != 'undefined' && typeof importScripts != 'undefined';
@@ -89,13 +159,7 @@
89159
throw new TypeError('No environment baseURI');
90160
}
91161

92-
var URL = __global.URL;
93-
try {
94-
new URL('test:///').protocol == 'test:';
95-
}
96-
catch(e) {
97-
URL = URLPolyfill;
98-
}
162+
var URL = __global.URLPolyfill || __global.URL;
99163

100164
/*
101165
*********************************************************************************************
@@ -908,74 +972,6 @@ function logloads(loads) {
908972
throw new TypeError('ES6 transpilation is only provided in the dev module loader build.');
909973
}
910974
})();
911-
// from https://gist.github.com/Yaffle/1088850
912-
function URLPolyfill(url, baseURL) {
913-
if (typeof url != 'string')
914-
throw new TypeError('URL must be a string');
915-
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
916-
if (!m) {
917-
throw new RangeError();
918-
}
919-
var protocol = m[1] || "";
920-
var username = m[2] || "";
921-
var password = m[3] || "";
922-
var host = m[4] || "";
923-
var hostname = m[5] || "";
924-
var port = m[6] || "";
925-
var pathname = m[7] || "";
926-
var search = m[8] || "";
927-
var hash = m[9] || "";
928-
if (baseURL !== undefined) {
929-
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
930-
var flag = protocol === "" && host === "" && username === "";
931-
if (flag && pathname === "" && search === "") {
932-
search = base.search;
933-
}
934-
if (flag && pathname.charAt(0) !== "/") {
935-
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
936-
}
937-
// dot segments removal
938-
var output = [];
939-
pathname.replace(/^(\.\.?(\/|$))+/, "")
940-
.replace(/\/(\.(\/|$))+/g, "/")
941-
.replace(/\/\.\.$/, "/../")
942-
.replace(/\/?[^\/]*/g, function (p) {
943-
if (p === "/..") {
944-
output.pop();
945-
} else {
946-
output.push(p);
947-
}
948-
});
949-
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
950-
if (flag) {
951-
port = base.port;
952-
hostname = base.hostname;
953-
host = base.host;
954-
password = base.password;
955-
username = base.username;
956-
}
957-
if (protocol === "") {
958-
protocol = base.protocol;
959-
}
960-
}
961-
962-
// convert windows file URLs to use /
963-
if (protocol == 'file:')
964-
pathname = pathname.replace(/\\/g, '/');
965-
966-
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
967-
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
968-
this.protocol = protocol;
969-
this.username = username;
970-
this.password = password;
971-
this.host = host;
972-
this.hostname = hostname;
973-
this.port = port;
974-
this.pathname = pathname;
975-
this.search = search;
976-
this.hash = hash;
977-
}
978-
(typeof self != 'undefined' ? self : global).URLPolyfill = URLPolyfill;
979975
/*
980976
*********************************************************************************************
981977

package.json

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

0 commit comments

Comments
 (0)