mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-25 14:57:38 +00:00
4.0.1
This commit is contained in:
parent
c22fc675f3
commit
e6775c4cfd
@ -1,3 +1,7 @@
|
||||
SystemJS 4.0.1 (2019/07/06)
|
||||
* Fix IE11 regression related to loading json files (https://github.com/systemjs/systemjs/pull/1963, @joeldenning)
|
||||
* Fix bug where System.import() rejected incorrectly, due to unrelated errors (https://github.com/systemjs/systemjs/pull/1963)
|
||||
|
||||
SystemJS 4.0.0 (2019/06/29)
|
||||
* Support `<base href>` setting baseURL (https://github.com/systemjs/systemjs/pull/1957, @LarsDenBakker)
|
||||
* Use `Error` over `new Error` to reduce footprint (https://github.com/systemjs/systemjs/pull/1951, @joeldenning)
|
||||
|
||||
25
dist/s.js
vendored
25
dist/s.js
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SJS 4.0.0
|
||||
* SJS 4.0.1
|
||||
* Minimal SystemJS Build
|
||||
*/
|
||||
(function () {
|
||||
@ -364,12 +364,6 @@
|
||||
* Supports loading System.register via script tag injection
|
||||
*/
|
||||
|
||||
let err;
|
||||
if (typeof window !== 'undefined')
|
||||
window.addEventListener('error', function (e) {
|
||||
err = e.error;
|
||||
});
|
||||
|
||||
const systemRegister = systemJSPrototype.register;
|
||||
systemJSPrototype.register = function (deps, declare) {
|
||||
err = undefined;
|
||||
@ -378,7 +372,7 @@
|
||||
|
||||
systemJSPrototype.instantiate = function (url, firstParentUrl) {
|
||||
const loader = this;
|
||||
if (url.endsWith('.json')) {
|
||||
if (url.substr(-5) === '.json') {
|
||||
return fetch(url).then(function (resp) {
|
||||
return resp.text();
|
||||
}).then(function (source) {
|
||||
@ -388,19 +382,30 @@
|
||||
});
|
||||
} else {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let err;
|
||||
|
||||
function windowErrorListener(evt) {
|
||||
if (evt.filename === url)
|
||||
err = evt.error;
|
||||
}
|
||||
|
||||
window.addEventListener('error', windowErrorListener);
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.charset = 'utf-8';
|
||||
script.async = true;
|
||||
script.crossOrigin = 'anonymous';
|
||||
script.addEventListener('error', function () {
|
||||
window.removeEventListener('error', windowErrorListener);
|
||||
reject(Error('Error loading ' + url + (firstParentUrl ? ' from ' + firstParentUrl : '')));
|
||||
});
|
||||
script.addEventListener('load', function () {
|
||||
window.removeEventListener('error', windowErrorListener);
|
||||
document.head.removeChild(script);
|
||||
// Note URL normalization issues are going to be a careful concern here
|
||||
// Note that if an error occurs that isn't caught by this if statement,
|
||||
// that getRegister will return null and a "did not instantiate" error will be thrown.
|
||||
if (err) {
|
||||
reject(err);
|
||||
return err = undefined;
|
||||
}
|
||||
else {
|
||||
resolve(loader.getRegister());
|
||||
|
||||
2
dist/s.min.js
vendored
2
dist/s.min.js
vendored
@ -1 +1 @@
|
||||
!function(){const e="undefined"!=typeof self,n=e?self:global;let t;if("undefined"!=typeof document){const e=document.querySelector("base[href]");e&&(t=e.href)}if(!t&&"undefined"!=typeof location){const e=(t=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==e&&(t=t.slice(0,e+1))}const r=/\\/g,o="undefined"!=typeof Symbol,i=o&&Symbol.toStringTag,c=o?Symbol():"@";function u(){this[c]={}}const s=u.prototype;let l;s.import=function(e,n){const t=this;return Promise.resolve(t.resolve(e,n)).then(function(e){const n=function e(n,t,r){let o=n[c][t];if(o)return o;const u=[],s=Object.create(null);i&&Object.defineProperty(s,i,{value:"Module"});let l=Promise.resolve().then(function(){return n.instantiate(t,r)}).then(function(e){if(!e)throw Error("Module "+t+" did not instantiate");const r=e[1](function(e,n){o.h=!0;let t=!1;if("object"!=typeof e)e in s&&s[e]===n||(s[e]=n,t=!0);else for(let n in e){let r=e[n];n in s&&s[n]===r||(s[n]=r,t=!0)}if(t)for(let e=0;e<u.length;e++)u[e](s);return n},2===e[1].length?{import:function(e){return n.import(e,t)},meta:n.createContext(t)}:void 0);return o.e=r.execute||function(){},[e[0],r.setters||[]]});const f=l.then(function(r){return Promise.all(r[0].map(function(o,i){const c=r[1][i];return Promise.resolve(n.resolve(o,t)).then(function(r){const o=e(n,r,t);return Promise.resolve(o.I).then(function(){return c&&(o.i.push(c),!o.h&&o.I||c(o.n)),o})})})).then(function(e){o.d=e})});return f.catch(function(e){o.e=null,o.er=e}),o=n[c][t]={id:t,i:u,n:s,I:l,L:f,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0}}(t,e);return n.C||function(e,n){return n.C=function e(n,t,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then(function(){return Promise.all(t.d.map(function(t){return e(n,t,r)}))})}(e,n,{}).then(function(){return function e(n,t,r){if(r[t.id])return;if(r[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}let o;return t.d.forEach(function(t){{const i=e(n,t,r);i&&(o=o||[]).push(i)}}),o?Promise.all(o).then(i):i();function i(){try{let e=t.e.call(f);if(e)return e=e.then(function(){t.C=t.n,t.E=null}),t.E=t.E||e;t.C=t.n}catch(e){throw t.er=e,e}finally{t.L=t.I=void 0,t.e=null}}}(e,n,{})}).then(function(){return n.n})}(t,n)})},s.createContext=function(e){return{url:e}},s.register=function(e,n){l=[e,n]},s.getRegister=function(){const e=l;return l=void 0,e};const f=Object.freeze(Object.create(null));let d;n.System=new u,"undefined"!=typeof window&&window.addEventListener("error",function(e){d=e.error});const h=s.register;s.register=function(e,n){d=void 0,h.call(this,e,n)},s.instantiate=function(e,n){const t=this;return e.endsWith(".json")?fetch(e).then(function(e){return e.text()}).then(function(e){return[[],function(n){return{execute:function(){n("default",JSON.parse(e))}}}]}):new Promise(function(r,o){const i=document.createElement("script");i.charset="utf-8",i.async=!0,i.crossOrigin="anonymous",i.addEventListener("error",function(){o(Error("Error loading "+e+(n?" from "+n:"")))}),i.addEventListener("load",function(){if(document.head.removeChild(i),d)return o(d),d=void 0;r(t.getRegister())}),i.src=e,document.head.appendChild(i)})},e&&"function"==typeof importScripts&&(s.instantiate=function(e){const n=this;return new Promise(function(t,r){try{importScripts(e)}catch(e){r(e)}t(n.getRegister())})}),s.resolve=function(e,n){const o=function(e,n){if(-1!==e.indexOf("\\")&&(e=e.replace(r,"/")),"/"===e[0]&&"/"===e[1])return n.slice(0,n.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const t=n.slice(0,n.indexOf(":")+1);let r;if(r="/"===n[t.length+1]?"file:"!==t?(r=n.slice(t.length+2)).slice(r.indexOf("/")+1):n.slice(8):n.slice(t.length+("/"===n[t.length])),"/"===e[0])return n.slice(0,n.length-r.length-1)+e;const o=r.slice(0,r.lastIndexOf("/")+1)+e,i=[];let c=-1;for(let e=0;e<o.length;e++)-1!==c?"/"===o[e]&&(i.push(o.slice(c,e+1)),c=-1):"."===o[e]?"."!==o[e+1]||"/"!==o[e+2]&&e+2!==o.length?"/"===o[e+1]||e+1===o.length?e+=1:c=e:(i.pop(),e+=2):c=e;return-1!==c&&i.push(o.slice(c)),n.slice(0,n.length-r.length)+i.join("")}}(e,n||t);if(!o){if(-1!==e.indexOf(":"))return Promise.resolve(e);throw Error('Cannot resolve "'+e+(n?'" from '+n:'"'))}return Promise.resolve(o)}}();
|
||||
!function(){const e="undefined"!=typeof self,n=e?self:global;let t;if("undefined"!=typeof document){const e=document.querySelector("base[href]");e&&(t=e.href)}if(!t&&"undefined"!=typeof location){const e=(t=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==e&&(t=t.slice(0,e+1))}const r=/\\/g,o="undefined"!=typeof Symbol,i=o&&Symbol.toStringTag,c=o?Symbol():"@";function u(){this[c]={}}const s=u.prototype;let l;s.import=function(e,n){const t=this;return Promise.resolve(t.resolve(e,n)).then(function(e){const n=function e(n,t,r){let o=n[c][t];if(o)return o;const u=[],s=Object.create(null);i&&Object.defineProperty(s,i,{value:"Module"});let l=Promise.resolve().then(function(){return n.instantiate(t,r)}).then(function(e){if(!e)throw Error("Module "+t+" did not instantiate");const r=e[1](function(e,n){o.h=!0;let t=!1;if("object"!=typeof e)e in s&&s[e]===n||(s[e]=n,t=!0);else for(let n in e){let r=e[n];n in s&&s[n]===r||(s[n]=r,t=!0)}if(t)for(let e=0;e<u.length;e++)u[e](s);return n},2===e[1].length?{import:function(e){return n.import(e,t)},meta:n.createContext(t)}:void 0);return o.e=r.execute||function(){},[e[0],r.setters||[]]});const f=l.then(function(r){return Promise.all(r[0].map(function(o,i){const c=r[1][i];return Promise.resolve(n.resolve(o,t)).then(function(r){const o=e(n,r,t);return Promise.resolve(o.I).then(function(){return c&&(o.i.push(c),!o.h&&o.I||c(o.n)),o})})})).then(function(e){o.d=e})});return f.catch(function(e){o.e=null,o.er=e}),o=n[c][t]={id:t,i:u,n:s,I:l,L:f,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0}}(t,e);return n.C||function(e,n){return n.C=function e(n,t,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then(function(){return Promise.all(t.d.map(function(t){return e(n,t,r)}))})}(e,n,{}).then(function(){return function e(n,t,r){if(r[t.id])return;if(r[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}let o;return t.d.forEach(function(t){{const i=e(n,t,r);i&&(o=o||[]).push(i)}}),o?Promise.all(o).then(i):i();function i(){try{let e=t.e.call(f);if(e)return e=e.then(function(){t.C=t.n,t.E=null}),t.E=t.E||e;t.C=t.n}catch(e){throw t.er=e,e}finally{t.L=t.I=void 0,t.e=null}}}(e,n,{})}).then(function(){return n.n})}(t,n)})},s.createContext=function(e){return{url:e}},s.register=function(e,n){l=[e,n]},s.getRegister=function(){const e=l;return l=void 0,e};const f=Object.freeze(Object.create(null));n.System=new u;const d=s.register;s.register=function(e,n){err=void 0,d.call(this,e,n)},s.instantiate=function(e,n){const t=this;return".json"===e.substr(-5)?fetch(e).then(function(e){return e.text()}).then(function(e){return[[],function(n){return{execute:function(){n("default",JSON.parse(e))}}}]}):new Promise(function(r,o){let i;function c(n){n.filename===e&&(i=n.error)}window.addEventListener("error",c);const u=document.createElement("script");u.charset="utf-8",u.async=!0,u.crossOrigin="anonymous",u.addEventListener("error",function(){window.removeEventListener("error",c),o(Error("Error loading "+e+(n?" from "+n:"")))}),u.addEventListener("load",function(){window.removeEventListener("error",c),document.head.removeChild(u),i?o(i):r(t.getRegister())}),u.src=e,document.head.appendChild(u)})},e&&"function"==typeof importScripts&&(s.instantiate=function(e){const n=this;return new Promise(function(t,r){try{importScripts(e)}catch(e){r(e)}t(n.getRegister())})}),s.resolve=function(e,n){const o=function(e,n){if(-1!==e.indexOf("\\")&&(e=e.replace(r,"/")),"/"===e[0]&&"/"===e[1])return n.slice(0,n.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const t=n.slice(0,n.indexOf(":")+1);let r;if(r="/"===n[t.length+1]?"file:"!==t?(r=n.slice(t.length+2)).slice(r.indexOf("/")+1):n.slice(8):n.slice(t.length+("/"===n[t.length])),"/"===e[0])return n.slice(0,n.length-r.length-1)+e;const o=r.slice(0,r.lastIndexOf("/")+1)+e,i=[];let c=-1;for(let e=0;e<o.length;e++)-1!==c?"/"===o[e]&&(i.push(o.slice(c,e+1)),c=-1):"."===o[e]?"."!==o[e+1]||"/"!==o[e+2]&&e+2!==o.length?"/"===o[e+1]||e+1===o.length?e+=1:c=e:(i.pop(),e+=2):c=e;return-1!==c&&i.push(o.slice(c)),n.slice(0,n.length-r.length)+i.join("")}}(e,n||t);if(!o){if(-1!==e.indexOf(":"))return Promise.resolve(e);throw Error('Cannot resolve "'+e+(n?'" from '+n:'"'))}return Promise.resolve(o)}}();
|
||||
2
dist/s.min.js.map
vendored
2
dist/s.min.js.map
vendored
File diff suppressed because one or more lines are too long
25
dist/system.js
vendored
25
dist/system.js
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SystemJS 4.0.0
|
||||
* SystemJS 4.0.1
|
||||
*/
|
||||
(function () {
|
||||
const hasSelf = typeof self !== 'undefined';
|
||||
@ -471,12 +471,6 @@
|
||||
* Supports loading System.register via script tag injection
|
||||
*/
|
||||
|
||||
let err;
|
||||
if (typeof window !== 'undefined')
|
||||
window.addEventListener('error', function (e) {
|
||||
err = e.error;
|
||||
});
|
||||
|
||||
const systemRegister = systemJSPrototype.register;
|
||||
systemJSPrototype.register = function (deps, declare) {
|
||||
err = undefined;
|
||||
@ -485,7 +479,7 @@
|
||||
|
||||
systemJSPrototype.instantiate = function (url, firstParentUrl) {
|
||||
const loader = this;
|
||||
if (url.endsWith('.json')) {
|
||||
if (url.substr(-5) === '.json') {
|
||||
return fetch(url).then(function (resp) {
|
||||
return resp.text();
|
||||
}).then(function (source) {
|
||||
@ -495,19 +489,30 @@
|
||||
});
|
||||
} else {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let err;
|
||||
|
||||
function windowErrorListener(evt) {
|
||||
if (evt.filename === url)
|
||||
err = evt.error;
|
||||
}
|
||||
|
||||
window.addEventListener('error', windowErrorListener);
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.charset = 'utf-8';
|
||||
script.async = true;
|
||||
script.crossOrigin = 'anonymous';
|
||||
script.addEventListener('error', function () {
|
||||
window.removeEventListener('error', windowErrorListener);
|
||||
reject(Error('Error loading ' + url + (firstParentUrl ? ' from ' + firstParentUrl : '')));
|
||||
});
|
||||
script.addEventListener('load', function () {
|
||||
window.removeEventListener('error', windowErrorListener);
|
||||
document.head.removeChild(script);
|
||||
// Note URL normalization issues are going to be a careful concern here
|
||||
// Note that if an error occurs that isn't caught by this if statement,
|
||||
// that getRegister will return null and a "did not instantiate" error will be thrown.
|
||||
if (err) {
|
||||
reject(err);
|
||||
return err = undefined;
|
||||
}
|
||||
else {
|
||||
resolve(loader.getRegister());
|
||||
|
||||
4
dist/system.min.js
vendored
4
dist/system.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/system.min.js.map
vendored
2
dist/system.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "systemjs",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.1",
|
||||
"description": "Dynamic ES module loader",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user