a zip code crypto-currency system good for red ONLY

ng-module-loader.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Compiler, Injectable } from '@angular/core';
  2. /**
  3. * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
  4. */
  5. export class NgModuleLoader {
  6. constructor(_compiler) {
  7. this._compiler = _compiler;
  8. }
  9. load(modulePath, ngModuleExport) {
  10. const offlineMode = this._compiler instanceof Compiler;
  11. return offlineMode ? loadPrecompiledFactory(modulePath, ngModuleExport) : loadAndCompile(this._compiler, modulePath, ngModuleExport);
  12. }
  13. }
  14. NgModuleLoader.decorators = [
  15. { type: Injectable },
  16. ];
  17. /** @nocollapse */
  18. NgModuleLoader.ctorParameters = () => [
  19. { type: Compiler, },
  20. ];
  21. function loadAndCompile(compiler, modulePath, ngModuleExport) {
  22. if (!ngModuleExport) {
  23. ngModuleExport = 'default';
  24. }
  25. return System.import(modulePath)
  26. .then((rawModule) => {
  27. const module = rawModule[ngModuleExport];
  28. if (!module) {
  29. throw new Error(`Module ${modulePath} does not export ${ngModuleExport}`);
  30. }
  31. return compiler.compileModuleAsync(module);
  32. });
  33. }
  34. function loadPrecompiledFactory(modulePath, ngModuleExport) {
  35. return System.import(modulePath)
  36. .then((rawModule) => {
  37. const ngModuleFactory = rawModule[ngModuleExport];
  38. if (!ngModuleFactory) {
  39. throw new Error(`Module ${modulePath} does not export ${ngModuleExport}`);
  40. }
  41. return ngModuleFactory;
  42. });
  43. }
  44. //# sourceMappingURL=ng-module-loader.js.map