function NodeESModuleLoader(baseKey, rcPath) { if (!isNode) throw new Error('Node module loader can only be used in Node'); if (baseKey) this.baseKey = resolveIfNotPlain(baseKey, baseURI) || resolveIfNotPlain('./' + baseKey, baseURI); else this.baseKey = baseURI; if (this.baseKey[this.baseKey.length - 1] !== '/') this.baseKey += '/'; if (rcPath) { if (typeof rcPath !== 'string') throw new TypeError('Second argument to Node loader must be a valid file path to the babelrc file.'); this.rcPath = rcPath; } RegisterLoader.call(this); var loader = this; // ensure System.register is available global.System = global.System || {}; global.System.register = function() { loader.register.apply(loader, arguments); }; }
function ready() { document.removeEventListener('DOMContentLoaded', ready, false ); var anonCnt = 0; var scripts = document.getElementsByTagName('script'); for (var i = 0; i < scripts.length; i++) { var script = scripts[i]; if (script.type == 'module' && !script.loaded) { script.loaded = true; if (script.src) { loader.import(script.src).catch(handleError); } // anonymous modules supported via a custom naming scheme and registry else { var uri = './<anon' + ++anonCnt + '>'; if (script.id !== ""){ uri = "./" + script.id; } var anonName = resolveIfNotPlain(uri, baseURI); anonSources[anonName] = script.innerHTML; loader.import(anonName).catch(handleError); } } } }
function BrowserESModuleLoader(baseKey) { if (baseKey) this.baseKey = resolveIfNotPlain(baseKey, baseURI) || resolveIfNotPlain('./' + baseKey, baseURI); RegisterLoader.call(this); var loader = this; // ensure System.register is available global.System = global.System || {}; if (typeof global.System.register == 'function') var prevRegister = global.System.register; global.System.register = function() { loader.register.apply(loader, arguments); if (prevRegister) prevRegister.apply(this, arguments); }; }