aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/systemjs/lib/url-polyfill.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /thirdparty/systemjs/lib/url-polyfill.js
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'thirdparty/systemjs/lib/url-polyfill.js')
-rw-r--r--thirdparty/systemjs/lib/url-polyfill.js64
1 files changed, 0 insertions, 64 deletions
diff --git a/thirdparty/systemjs/lib/url-polyfill.js b/thirdparty/systemjs/lib/url-polyfill.js
deleted file mode 100644
index b2a40198a..000000000
--- a/thirdparty/systemjs/lib/url-polyfill.js
+++ /dev/null
@@ -1,64 +0,0 @@
-// from https://gist.github.com/Yaffle/1088850
-(function(global) {
-function URLPolyfill(url, baseURL) {
- if (typeof url != 'string')
- throw new TypeError('URL must be a string');
- var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
- if (!m)
- throw new RangeError('Invalid URL format');
- var protocol = m[1] || "";
- var username = m[2] || "";
- var password = m[3] || "";
- var host = m[4] || "";
- var hostname = m[5] || "";
- var port = m[6] || "";
- var pathname = m[7] || "";
- var search = m[8] || "";
- var hash = m[9] || "";
- if (baseURL !== undefined) {
- var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
- var flag = !protocol && !host && !username;
- if (flag && !pathname && !search)
- search = base.search;
- if (flag && pathname[0] !== "/")
- pathname = (pathname ? (((base.host || base.username) && !base.pathname ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
- // dot segments removal
- var output = [];
- pathname.replace(/^(\.\.?(\/|$))+/, "")
- .replace(/\/(\.(\/|$))+/g, "/")
- .replace(/\/\.\.$/, "/../")
- .replace(/\/?[^\/]*/g, function (p) {
- if (p === "/..")
- output.pop();
- else
- output.push(p);
- });
- pathname = output.join("").replace(/^\//, pathname[0] === "/" ? "/" : "");
- if (flag) {
- port = base.port;
- hostname = base.hostname;
- host = base.host;
- password = base.password;
- username = base.username;
- }
- if (!protocol)
- protocol = base.protocol;
- }
-
- // convert URLs to use / always
- pathname = pathname.replace(/\\/g, '/');
-
- this.origin = host ? protocol + (protocol !== "" || host !== "" ? "//" : "") + host : "";
- this.href = protocol + (protocol && host || protocol == "file:" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
- this.protocol = protocol;
- this.username = username;
- this.password = password;
- this.host = host;
- this.hostname = hostname;
- this.port = port;
- this.pathname = pathname;
- this.search = search;
- this.hash = hash;
-}
-global.URLPolyfill = URLPolyfill;
-})(typeof self != 'undefined' ? self : global); \ No newline at end of file