Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

systemjs

Package Overview
Dependencies
Maintainers
1
Versions
236
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systemjs - npm Package Compare versions

Comparing version 2.1.2 to 3.0.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

SystemJS 3.0.0 (2019/01/12)
* Implement new Import Maps specification replacing Package Name Maps (#1893)
SystemJS 2.1.2 (2019/01/12)
* Fix empty bundle registration for named register extension (#1885, @paulmelnikow)
SystemJS 2.1.1 (2018/11/01)

@@ -2,0 +8,0 @@ * Add AMD named define support to named register extension / amd extension combination (#1870, 0f1adb38)

2

dist/extras/transform.js

@@ -16,3 +16,3 @@ /*

if (!res.ok)
throw new Error('Fetch error: ' + res.status + ' ' + res.statusText + (parent ? ' loading from ' + parent : ''));
throw new Error('Fetch error: ' + res.status + ' ' + res.statusText + (parent ? ' loading from ' + parent : ''));
return res.text();

@@ -19,0 +19,0 @@ })

@@ -1,1 +0,1 @@

!function(){const t=System.constructor.prototype,n=t.instantiate;t.instantiate=function(t,r){if(".wasm"===t.slice(-5))return n.call(this,t,r);const e=this;return fetch(t,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw new Error("Fetch error: "+t.status+" "+t.statusText+(r?" loading from "+r:""));return t.text()}).then(function(n){return e.transform.call(this,t,n)}).then(function(n){return(0,eval)(n+"\n//# sourceURL="+t),e.getRegister()})},t.transform=function(t,n){return n}}();
!function(){const t=System.constructor.prototype,n=t.instantiate;t.instantiate=function(t,r){if(".wasm"===t.slice(-5))return n.call(this,t,r);const e=this;return fetch(t,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw new Error("Fetch error: "+t.status+" "+t.statusText+(r?" loading from "+r:""));return t.text()}).then(function(n){return e.transform.call(this,t,n)}).then(function(n){return(0,eval)(n+"\n//# sourceURL="+t),e.getRegister()})},t.transform=function(t,n){return n}}();
/*
* SJS 2.1.2
* SJS 3.0.0
* Minimal SystemJS Build

@@ -4,0 +4,0 @@ */

/*
* SystemJS 2.1.2
* SystemJS 3.0.0
*/

@@ -99,11 +99,7 @@ (function () {

/*
* Package name maps implementation
*
* Reduced implementation - only a single scope level is supported
* Import maps implementation
*
* To make lookups fast we pre-resolve the entire package name map
* To make lookups fast we pre-resolve the entire import map
* and then match based on backtracked hash lookups
*
* path_prefix in scopes not supported
* nested scopes not supported
*/

@@ -117,10 +113,16 @@

function createPackageMap (json, baseUrl) {
if (json.path_prefix) {
baseUrl = resolveUrl(json.path_prefix, baseUrl);
if (baseUrl[baseUrl.length - 1] !== '/')
baseUrl += '/';
function resolvePackages(pkgs) {
var outPkgs = {};
for (var p in pkgs) {
var value = pkgs[p];
// TODO package fallback support
if (typeof value !== 'string')
continue;
outPkgs[resolveIfNotPlainOrUrl(p) || p] = value;
}
const basePackages = json.packages || {};
return outPkgs;
}
function parseImportMap (json, baseUrl) {
const imports = resolvePackages(json.imports) || {};
const scopes = {};

@@ -130,57 +132,47 @@ if (json.scopes) {

const scope = json.scopes[scopeName];
if (scope.path_prefix)
throw new Error('Scope path_prefix not currently supported');
if (scope.scopes)
throw new Error('Nested scopes not currently supported');
let resolvedScopeName = resolveUrl(scopeName, baseUrl);
if (resolvedScopeName[resolvedScopeName.length - 1] === '/')
resolvedScopeName = resolvedScopeName.substr(0, resolvedScopeName.length - 1);
scopes[resolvedScopeName] = scope.packages || {};
if (resolvedScopeName[resolvedScopeName.length - 1] !== '/')
resolvedScopeName += '/';
scopes[resolvedScopeName] = resolvePackages(scope) || {};
}
}
function getMatch (path, matchObj) {
let sepIndex = path.length;
do {
const segment = path.slice(0, sepIndex);
if (segment in matchObj)
return segment;
} while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
return { imports: imports, scopes: scopes, baseUrl: baseUrl };
}
function getMatch (path, matchObj) {
if (matchObj[path])
return path;
let sepIndex = path.length;
do {
const segment = path.slice(0, sepIndex + 1);
if (segment in matchObj)
return segment;
} while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
}
function applyPackages (id, packages, baseUrl) {
const pkgName = getMatch(id, packages);
if (pkgName) {
const pkg = packages[pkgName];
if (pkg === null)
if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/')
console.warn("Invalid package target " + pkg + " for '" + pkgName + "' should have a trailing '/'.");
return resolveUrl(pkg + id.slice(pkgName.length), baseUrl);
}
}
function applyPackages (id, packages, baseUrl) {
const pkgName = getMatch(id, packages);
if (pkgName) {
const pkg = packages[pkgName];
if (pkgName === id) {
if (typeof pkg === 'string')
return resolveUrl(pkg, baseUrl + pkgName + '/');
if (!pkg.main)
throw new Error('Package ' + pkgName + ' has no main');
return resolveUrl(
(pkg.path ? pkg.path + (pkg.path[pkg.path.length - 1] === '/' ? '' : '/') : pkgName + '/') + pkg.main,
baseUrl
);
}
else {
return resolveUrl(
(typeof pkg === 'string' || !pkg.path
? pkgName + '/'
: pkg.path + (pkg.path[pkg.path.length - 1] === '/' ? '' : '/')
) + id.slice(pkgName.length + 1)
, baseUrl);
}
}
function resolveImportMap (id, parentUrl, importMap) {
const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl);
if (urlResolved)
id = urlResolved;
const scopeName = getMatch(parentUrl, importMap.scopes);
if (scopeName) {
const scopePackages = importMap.scopes[scopeName];
const packageResolution = applyPackages(id, scopePackages, scopeName);
if (packageResolution)
return packageResolution;
}
return function (id, parentUrl) {
const scopeName = getMatch(parentUrl, scopes);
if (scopeName) {
const scopePackages = scopes[scopeName];
const packageResolution = applyPackages(id, scopePackages, scopeName + '/');
if (packageResolution)
return packageResolution;
}
return applyPackages(id, basePackages, baseUrl) || throwBare(id, parentUrl);
};
return applyPackages(id, importMap.imports, importMap.baseUrl) || urlResolved || throwBare(id, parentUrl);
}

@@ -662,12 +654,12 @@

/*
* Package name map support for SystemJS
* Import map support for SystemJS
*
* <script type="systemjs-packagemap">{}</script>
* <script type="systemjs-importmap">{}</script>
* OR
* <script type="systemjs-packagemap" src=package.json></script>
* <script type="systemjs-importmap" src=package.json></script>
*
* Only supports loading the first package map
* Only supports loading the first import map
*/
let packageMapPromise, packageMapResolve;
var importMap, importMapPromise;
if (typeof document !== 'undefined') {

@@ -677,11 +669,10 @@ const scripts = document.getElementsByTagName('script');

const script = scripts[i];
if (script.type !== 'systemjs-packagemap')
if (script.type !== 'systemjs-importmap')
continue;
if (!script.src) {
packageMapResolve = createPackageMap(JSON.parse(script.innerHTML), baseUrl);
packageMapPromise = Promise.resolve();
importMap = parseImportMap(JSON.parse(script.innerHTML), baseUrl);
}
else {
packageMapPromise = fetch(script.src)
importMapPromise = fetch(script.src)
.then(function (res) {

@@ -691,7 +682,3 @@ return res.json();

.then(function (json) {
packageMapResolve = createPackageMap(json, script.src);
packageMapPromise = undefined;
}, function () {
packageMapResolve = throwBare;
packageMapPromise = undefined;
importMap = parseImportMap(json, script.src);
});

@@ -702,23 +689,15 @@ }

}
if (!packageMapPromise)
packageMapResolve = throwBare;
importMap = importMap || { imports: {}, scopes: {} };
systemJSPrototype.resolve = function (id, parentUrl) {
parentUrl = parentUrl || baseUrl;
const resolvedIfNotPlainOrUrl = resolveIfNotPlainOrUrl(id, parentUrl);
if (resolvedIfNotPlainOrUrl)
return resolvedIfNotPlainOrUrl;
if (id.indexOf(':') !== -1)
return id;
// now just left with plain
// (if not package map, packageMapResolve just throws)
if (packageMapPromise)
return packageMapPromise
if (importMapPromise)
return importMapPromise
.then(function () {
return packageMapResolve(id, parentUrl);
return resolveImportMap(id, parentUrl, importMap);
});
return packageMapResolve(id, parentUrl);
return resolveImportMap(id, parentUrl, importMap);
};

@@ -725,0 +704,0 @@

/*
* SystemJS 2.1.2
* SystemJS 3.0.0
*/
!function(){const t="undefined"!=typeof self,n=t?self:global;let e;if("undefined"!=typeof location){const t=(e=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}const o=/\\/g;function r(t,n){if(-1!==t.indexOf("\\")&&(t=t.replace(o,"/")),"/"===t[0]&&"/"===t[1])return n.slice(0,n.indexOf(":")+1)+t;if("."===t[0]&&("/"===t[1]||"."===t[1]&&("/"===t[2]||2===t.length&&(t+="/"))||1===t.length&&(t+="/"))||"/"===t[0]){const e=n.slice(0,n.indexOf(":")+1);let o;if(o="/"===n[e.length+1]?"file:"!==e?(o=n.slice(e.length+2)).slice(o.indexOf("/")+1):n.slice(8):n.slice(e.length+("/"===n[e.length])),"/"===t[0])return n.slice(0,n.length-o.length-1)+t;const r=o.slice(0,o.lastIndexOf("/")+1)+t,i=[];let c=-1;for(let t=0;t<r.length;t++)-1!==c?"/"===r[t]&&(i.push(r.slice(c,t+1)),c=-1):"."===r[t]?"."!==r[t+1]||"/"!==r[t+2]&&t+2!==r.length?"/"===r[t+1]||t+1===r.length?t+=1:c=t:(i.pop(),t+=2):c=t;return-1!==c&&i.push(r.slice(c)),n.slice(0,n.length-o.length)+i.join("")}}function i(t,n){return r(t,n)||-1!==t.indexOf(":")&&t||r("./"+t,n)}function c(t,n){t.path_prefix&&"/"!==(n=i(t.path_prefix,n))[n.length-1]&&(n+="/");const e=t.packages||{},o={};if(t.scopes)for(let e in t.scopes){const r=t.scopes[e];if(r.path_prefix)throw new Error("Scope path_prefix not currently supported");if(r.scopes)throw new Error("Nested scopes not currently supported");let c=i(e,n);"/"===c[c.length-1]&&(c=c.substr(0,c.length-1)),o[c]=r.packages||{}}function r(t,n){let e=t.length;do{const o=t.slice(0,e);if(o in n)return o}while(-1!==(e=t.lastIndexOf("/",e-1)))}function c(t,n,e){const o=r(t,n);if(o){const r=n[o];if(o===t){if("string"==typeof r)return i(r,e+o+"/");if(!r.main)throw new Error("Package "+o+" has no main");return i((r.path?r.path+("/"===r.path[r.path.length-1]?"":"/"):o+"/")+r.main,e)}return i(("string"!=typeof r&&r.path?r.path+("/"===r.path[r.path.length-1]?"":"/"):o+"/")+t.slice(o.length+1),e)}}return function(t,i){const u=r(i,o);if(u){const n=c(t,o[u],u+"/");if(n)return n}return c(t,e,n)||s(t,i)}}function s(t,n){throw new Error('Unable to resolve bare specifier "'+t+(n?'" from '+n:'"'))}const u="undefined"!=typeof Symbol,f=u&&Symbol.toStringTag,l=u?Symbol():"@";function a(){this[l]={}}const h=a.prototype;let d;h.import=function(t,n){const e=this;return Promise.resolve(e.resolve(t,n)).then(function(t){const n=function t(n,e,o){let r=n[l][e];if(r)return r;const i=[],c=Object.create(null);f&&Object.defineProperty(c,f,{value:"Module"});let s=Promise.resolve().then(function(){return n.instantiate(e,o)}).then(function(t){if(!t)throw new Error("Module "+e+" did not instantiate");const o=t[1](function(t,n){r.h=!0;let e=!1;if("object"!=typeof t)t in c&&c[t]===n||(c[t]=n,e=!0);else for(let n in t){let o=t[n];n in c&&c[n]===o||(c[n]=o,e=!0)}if(e)for(let t=0;t<i.length;t++)i[t](c);return n},2===t[1].length?{import:function(t){return n.import(t,e)},meta:n.createContext(e)}:void 0);return r.e=o.execute||function(){},[t[0],o.setters||[]]});const u=(s=s.catch(function(t){throw n.onload(r.id,t),t})).then(function(o){return Promise.all(o[0].map(function(r,i){const c=o[1][i];return Promise.resolve(n.resolve(r,e)).then(function(o){const r=t(n,o,e);return Promise.resolve(r.I).then(function(){return c&&(r.i.push(c),!r.h&&r.I||c(r.n)),r})})})).then(function(t){r.d=t})});return u.catch(function(){}),r=n[l][e]={id:e,i:i,n:c,I:s,L:u,h:!1,d:void 0,e:void 0,eE:void 0,E:void 0,C:void 0}}(e,t);return n.C||function(t,n){return n.C=function t(n,e,o){if(!o[e.id])return o[e.id]=!0,Promise.resolve(e.L).then(function(){return Promise.all(e.d.map(function(e){return t(n,e,o)}))})}(t,n,{}).then(function(){return function t(n,e,o){if(o[e.id])return;if(o[e.id]=!0,!e.e){if(e.eE)throw e.eE;return e.E?e.E:void 0}let r;return e.d.forEach(function(i){try{const c=t(n,i,o);c&&(r=r||[]).push(c)}catch(t){throw n.onload(e.id,t),t}}),r?Promise.all(r).then(i).catch(function(t){throw n.onload(e.id,t),t}):i();function i(){try{let t=e.e.call(p);if(t)return(t=t.then(function(){e.C=e.n,e.E=null,n.onload(e.id,null)},function(){throw n.onload(e.id,err),err})).catch(function(){}),e.E=e.E||t;e.C=e.n,n.onload(e.id,null)}catch(t){throw n.onload(e.id,t),e.eE=t,t}finally{e.L=e.I=void 0,e.e=null}}}(t,n,{})}).then(function(){return n.n})}(e,n)})},h.createContext=function(t){return{url:t}},h.onload=function(){},h.register=function(t,n){d=[t,n]},h.getRegister=function(){const t=d;return d=void 0,t};const p=Object.freeze(Object.create(null));let m;n.System=new a,"undefined"!=typeof window&&window.addEventListener("error",function(t){m=t.error});const g=h.register;h.register=function(t,n){m=void 0,g.call(this,t,n)},h.instantiate=function(t,n){const e=this;return new Promise(function(o,r){const i=document.createElement("script");i.charset="utf-8",i.async=!0,i.crossOrigin="anonymous",i.addEventListener("error",function(){r(new Error("Error loading "+t+(n?" from "+n:"")))}),i.addEventListener("load",function(){if(document.head.removeChild(i),m)return r(m);o(e.getRegister())}),i.src=t,document.head.appendChild(i)})},t&&"function"==typeof importScripts&&(h.instantiate=function(t){const n=this;return new Promise(function(e,o){try{importScripts(t)}catch(t){o(t)}e(n.getRegister())})}),function(t){const n=System.constructor.prototype;let e,o,r;const i=n.import;n.import=function(n,c){return function(){e=o=void 0;for(let n in t)t.hasOwnProperty(n)&&(e?o||(o=n):e=n,r=n)}(),i.call(this,n,c)};const c=[[],function(){return{}}],s=n.getRegister;n.getRegister=function(){const n=s.call(this);if(n)return n;const i=function(){let n,i=0;for(let r in t)if(t.hasOwnProperty(r)){if(0===i&&r!==e||1===i&&r!==o)return r;i++,n=r}if(n!==r)return n}();if(!i)return c;let u;try{u=t[i]}catch(t){return c}return[[],function(t){return{execute:function(){t("default",u)}}}]}}("undefined"!=typeof self?self:global);const y=h.instantiate;let w,v;if(h.instantiate=function(t,n){return".wasm"!==t.slice(-5)?y.call(this,t,n):fetch(t).then(function(t){if(!t.ok)throw new Error(t.status+" "+t.statusText+" "+t.url+(n?" loading from "+n:""));return WebAssembly.compileStreaming?WebAssembly.compileStreaming(t):t.arrayBuffer().then(function(t){return WebAssembly.compile(t)})}).then(function(t){const n=[],e=[],o={};return WebAssembly.Module.imports&&WebAssembly.Module.imports(t).forEach(function(t){const r=t.module;e.push(function(t){o[r]=t}),-1===n.indexOf(r)&&n.push(r)}),[n,function(n){return{setters:e,execute:function(){return WebAssembly.instantiate(t,o).then(function(t){n(t.exports)})}}}]})},"undefined"!=typeof document){const t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){const o=t[n];if("systemjs-packagemap"===o.type){o.src?w=fetch(o.src).then(function(t){return t.json()}).then(function(t){v=c(t,o.src),w=void 0},function(){v=s,w=void 0}):(v=c(JSON.parse(o.innerHTML),e),w=Promise.resolve());break}}}w||(v=s),h.resolve=function(t,n){return r(t,n=n||e)||(-1!==t.indexOf(":")?t:w?w.then(function(){return v(t,n)}):v(t,n))},h.get=function(t){const n=this[l][t];if(n&&null===n.e&&!n.E)return n.eE?null:n.n},h.delete=function(t){const n=this.get(t);return void 0!==n&&(n&&n.d&&n.d.forEach(function(t){const e=t.i.indexOf(n);-1!==e&&t.i.splice(e,1)}),delete this[l][t])}}();
!function(){const t="undefined"!=typeof self,n=t?self:global;let e;if("undefined"!=typeof location){const t=(e=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}const o=/\\/g;function r(t,n){if(-1!==t.indexOf("\\")&&(t=t.replace(o,"/")),"/"===t[0]&&"/"===t[1])return n.slice(0,n.indexOf(":")+1)+t;if("."===t[0]&&("/"===t[1]||"."===t[1]&&("/"===t[2]||2===t.length&&(t+="/"))||1===t.length&&(t+="/"))||"/"===t[0]){const e=n.slice(0,n.indexOf(":")+1);let o;if(o="/"===n[e.length+1]?"file:"!==e?(o=n.slice(e.length+2)).slice(o.indexOf("/")+1):n.slice(8):n.slice(e.length+("/"===n[e.length])),"/"===t[0])return n.slice(0,n.length-o.length-1)+t;const r=o.slice(0,o.lastIndexOf("/")+1)+t,i=[];let c=-1;for(let t=0;t<r.length;t++)-1!==c?"/"===r[t]&&(i.push(r.slice(c,t+1)),c=-1):"."===r[t]?"."!==r[t+1]||"/"!==r[t+2]&&t+2!==r.length?"/"===r[t+1]||t+1===r.length?t+=1:c=t:(i.pop(),t+=2):c=t;return-1!==c&&i.push(r.slice(c)),n.slice(0,n.length-o.length)+i.join("")}}function i(t,n){return r(t,n)||-1!==t.indexOf(":")&&t||r("./"+t,n)}function c(t){var n={};for(var e in t){var o=t[e];"string"==typeof o&&(n[r(e)||e]=o)}return n}function s(t,n){const e=c(t.imports)||{},o={};if(t.scopes)for(let e in t.scopes){const r=t.scopes[e];let s=i(e,n);"/"!==s[s.length-1]&&(s+="/"),o[s]=c(r)||{}}return{imports:e,scopes:o,baseUrl:n}}function u(t,n){if(n[t])return t;let e=t.length;do{const o=t.slice(0,e+1);if(o in n)return o}while(-1!==(e=t.lastIndexOf("/",e-1)))}function l(t,n,e){const o=u(t,n);if(o){const r=n[o];return null===r&&t.length>o.length&&"/"!==r[r.length-1]&&console.warn("Invalid package target "+r+" for '"+o+"' should have a trailing '/'."),i(r+t.slice(o.length),e)}}function f(t,n,e){const o=r(t,n);o&&(t=o);const i=u(n,e.scopes);if(i){const n=l(t,e.scopes[i],i);if(n)return n}return l(t,e.imports,e.baseUrl)||o||function(t,n){throw new Error('Unable to resolve bare specifier "'+t+(n?'" from '+n:'"'))}(t,n)}const a="undefined"!=typeof Symbol,d=a&&Symbol.toStringTag,h=a?Symbol():"@";function p(){this[h]={}}const m=p.prototype;let g;m.import=function(t,n){const e=this;return Promise.resolve(e.resolve(t,n)).then(function(t){const n=function t(n,e,o){let r=n[h][e];if(r)return r;const i=[],c=Object.create(null);d&&Object.defineProperty(c,d,{value:"Module"});let s=Promise.resolve().then(function(){return n.instantiate(e,o)}).then(function(t){if(!t)throw new Error("Module "+e+" did not instantiate");const o=t[1](function(t,n){r.h=!0;let e=!1;if("object"!=typeof t)t in c&&c[t]===n||(c[t]=n,e=!0);else for(let n in t){let o=t[n];n in c&&c[n]===o||(c[n]=o,e=!0)}if(e)for(let t=0;t<i.length;t++)i[t](c);return n},2===t[1].length?{import:function(t){return n.import(t,e)},meta:n.createContext(e)}:void 0);return r.e=o.execute||function(){},[t[0],o.setters||[]]});const u=(s=s.catch(function(t){throw n.onload(r.id,t),t})).then(function(o){return Promise.all(o[0].map(function(r,i){const c=o[1][i];return Promise.resolve(n.resolve(r,e)).then(function(o){const r=t(n,o,e);return Promise.resolve(r.I).then(function(){return c&&(r.i.push(c),!r.h&&r.I||c(r.n)),r})})})).then(function(t){r.d=t})});return u.catch(function(){}),r=n[h][e]={id:e,i:i,n:c,I:s,L:u,h:!1,d:void 0,e:void 0,eE:void 0,E:void 0,C:void 0}}(e,t);return n.C||function(t,n){return n.C=function t(n,e,o){if(!o[e.id])return o[e.id]=!0,Promise.resolve(e.L).then(function(){return Promise.all(e.d.map(function(e){return t(n,e,o)}))})}(t,n,{}).then(function(){return function t(n,e,o){if(o[e.id])return;if(o[e.id]=!0,!e.e){if(e.eE)throw e.eE;return e.E?e.E:void 0}let r;return e.d.forEach(function(i){try{const c=t(n,i,o);c&&(r=r||[]).push(c)}catch(t){throw n.onload(e.id,t),t}}),r?Promise.all(r).then(i).catch(function(t){throw n.onload(e.id,t),t}):i();function i(){try{let t=e.e.call(y);if(t)return(t=t.then(function(){e.C=e.n,e.E=null,n.onload(e.id,null)},function(){throw n.onload(e.id,err),err})).catch(function(){}),e.E=e.E||t;e.C=e.n,n.onload(e.id,null)}catch(t){throw n.onload(e.id,t),e.eE=t,t}finally{e.L=e.I=void 0,e.e=null}}}(t,n,{})}).then(function(){return n.n})}(e,n)})},m.createContext=function(t){return{url:t}},m.onload=function(){},m.register=function(t,n){g=[t,n]},m.getRegister=function(){const t=g;return g=void 0,t};const y=Object.freeze(Object.create(null));let v;n.System=new p,"undefined"!=typeof window&&window.addEventListener("error",function(t){v=t.error});const b=m.register;m.register=function(t,n){v=void 0,b.call(this,t,n)},m.instantiate=function(t,n){const e=this;return new Promise(function(o,r){const i=document.createElement("script");i.charset="utf-8",i.async=!0,i.crossOrigin="anonymous",i.addEventListener("error",function(){r(new Error("Error loading "+t+(n?" from "+n:"")))}),i.addEventListener("load",function(){if(document.head.removeChild(i),v)return r(v);o(e.getRegister())}),i.src=t,document.head.appendChild(i)})},t&&"function"==typeof importScripts&&(m.instantiate=function(t){const n=this;return new Promise(function(e,o){try{importScripts(t)}catch(t){o(t)}e(n.getRegister())})}),function(t){const n=System.constructor.prototype;let e,o,r;const i=n.import;n.import=function(n,c){return function(){e=o=void 0;for(let n in t)t.hasOwnProperty(n)&&(e?o||(o=n):e=n,r=n)}(),i.call(this,n,c)};const c=[[],function(){return{}}],s=n.getRegister;n.getRegister=function(){const n=s.call(this);if(n)return n;const i=function(){let n,i=0;for(let r in t)if(t.hasOwnProperty(r)){if(0===i&&r!==e||1===i&&r!==o)return r;i++,n=r}if(n!==r)return n}();if(!i)return c;let u;try{u=t[i]}catch(t){return c}return[[],function(t){return{execute:function(){t("default",u)}}}]}}("undefined"!=typeof self?self:global);const w=m.instantiate;var E,O;if(m.instantiate=function(t,n){return".wasm"!==t.slice(-5)?w.call(this,t,n):fetch(t).then(function(t){if(!t.ok)throw new Error(t.status+" "+t.statusText+" "+t.url+(n?" loading from "+n:""));return WebAssembly.compileStreaming?WebAssembly.compileStreaming(t):t.arrayBuffer().then(function(t){return WebAssembly.compile(t)})}).then(function(t){const n=[],e=[],o={};return WebAssembly.Module.imports&&WebAssembly.Module.imports(t).forEach(function(t){const r=t.module;e.push(function(t){o[r]=t}),-1===n.indexOf(r)&&n.push(r)}),[n,function(n){return{setters:e,execute:function(){return WebAssembly.instantiate(t,o).then(function(t){n(t.exports)})}}}]})},"undefined"!=typeof document){const t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){const o=t[n];if("systemjs-importmap"===o.type){o.src?O=fetch(o.src).then(function(t){return t.json()}).then(function(t){E=s(t,o.src)}):E=s(JSON.parse(o.innerHTML),e);break}}}E=E||{imports:{},scopes:{}},m.resolve=function(t,n){return n=n||e,O?O.then(function(){return f(t,n,E)}):f(t,n,E)},m.get=function(t){const n=this[h][t];if(n&&null===n.e&&!n.E)return n.eE?null:n.n},m.delete=function(t){const n=this.get(t);return void 0!==n&&(n&&n.d&&n.d.forEach(function(t){const e=t.i.indexOf(n);-1!==e&&t.i.splice(e,1)}),delete this[h][t])}}();
{
"name": "systemjs",
"version": "2.1.2",
"version": "3.0.0",
"description": "Dynamic ES module loader",

@@ -5,0 +5,0 @@ "repository": {

@@ -1,2 +0,2 @@

# SystemJS 2.0
# SystemJS

@@ -15,3 +15,3 @@ [![Build Status][travis-image]][travis-url]

SystemJS 2.0 provides two hookable base builds:
SystemJS provides two hookable base builds:

@@ -30,5 +30,5 @@ #### 1. s.js minimal loader

The [3KB system.js loader](dist/system.min.js) loader builds on the s.js core and adds support for upcoming module specifications (currently [package name maps](https://github.com/domenic/package-name-maps) and [WASM integration](https://github.com/WebAssembly/esm-integration) with module loading) as well as development and convenience features.
The [3KB system.js loader](dist/system.min.js) loader builds on the s.js core and adds support for upcoming module specifications (currently [import maps](https://github.com/domenic/import-maps) and [WASM integration](https://github.com/WebAssembly/esm-integration) with module loading) as well as development and convenience features.
* Support for loading [bare specifier names](docs/package-name-maps.md) through package name maps (formerly map configuration), loaded via `<script type="system-packagenamemap">` (requires a `fetch` polyfill for eg IE11).
* Support for loading [bare specifier names](docs/import-maps.md) through import maps (formerly package maps, formerly map configuration), loaded via `<script type="system-importmap">` (requires a `fetch` polyfill for eg IE11).
* Includes the [global loading extra](#extras) for loading global scripts, useful for loading library dependencies traditionally loaded with script tags.

@@ -60,3 +60,3 @@ * [Tracing hooks](docs/hooks.md#trace-hooks) and [registry deletion API](docs/api.md#registry) for reloading workflows

* [Package Name Maps](docs/package-name-maps.md)
* [Import Maps](docs/import-maps.md)
* [API](docs/api.md)

@@ -83,11 +83,11 @@ * [System.register](docs/system-register.md)

### Package Name Maps
### Import Maps
Say `main.js` depends on loading `'lodash'`, then we can define a package name map:
Say `main.js` depends on loading `'lodash'`, then we can define an import map:
```html
<script type="systemjs-packagemap">
<script type="systemjs-importmap">
{
"packages": {
"imports": {
"lodash": "https://unpkg.com/lodash@4.17.10/lodash.js"

@@ -98,5 +98,5 @@ }

<!-- Alternatively:
<script type="systemjs-packagemap" src="path/to/map.json">
<script type="systemjs-importmap" src="path/to/map.json">
-->
<!-- SystemJS must be loaded after the package map -->
<!-- SystemJS must be loaded after the import map -->
<script src="system.js"></script>

@@ -158,3 +158,3 @@ <script>

To support package maps in the system.js build, a fetch polyfill is need. The [GitHub polyfill](https://github.github.io/fetch/) is recommended:
To support import maps in the system.js build, a fetch polyfill is need. The [GitHub polyfill](https://github.github.io/fetch/) is recommended:

@@ -170,3 +170,3 @@ ```html

This list can be extended to include third-party loader extensions. Feel free to [post a PR to share your work](https://github.com/systemjs/systemjs/edit/2.0/README.md).
This list can be extended to include third-party loader extensions. Feel free to [post a PR to share your work](https://github.com/systemjs/systemjs/edit/3.0/README.md).

@@ -192,2 +192,6 @@ * [transform-babel](https://github.com/systemjs/systemjs-transform-babel) Supports ES module transformation into System.register with Babel.

## Changes
For the changelog, see [CHANGELOG.md](CHANGELOG.md).
## License

@@ -194,0 +198,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc