jitReflector.js 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var compiler_1 = require("@angular/compiler");
  4. var core_1 = require("@angular/core");
  5. exports.MODULE_SUFFIX = '';
  6. var builtinExternalReferences = createBuiltinExternalReferencesMap();
  7. var JitReflector = (function () {
  8. function JitReflector() {
  9. this.reflectionCapabilities = new core_1.ɵReflectionCapabilities();
  10. }
  11. JitReflector.prototype.guards = function () {
  12. return {};
  13. };
  14. JitReflector.prototype.componentModuleUrl = function (type, cmpMetadata) {
  15. var moduleId = cmpMetadata.moduleId;
  16. if (typeof moduleId === 'string') {
  17. var scheme = compiler_1.getUrlScheme(moduleId);
  18. return scheme ? moduleId : "package:" + moduleId + exports.MODULE_SUFFIX;
  19. }
  20. else if (moduleId !== null && moduleId !== void 0) {
  21. throw compiler_1.syntaxError("moduleId should be a string in \"" + core_1.ɵstringify(type) + "\". See https://goo.gl/wIDDiL for more information.\n" +
  22. "If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.");
  23. }
  24. return "./" + core_1.ɵstringify(type);
  25. };
  26. JitReflector.prototype.parameters = function (typeOrFunc) {
  27. return this.reflectionCapabilities.parameters(typeOrFunc);
  28. };
  29. JitReflector.prototype.annotations = function (typeOrFunc) {
  30. return this.reflectionCapabilities.annotations(typeOrFunc);
  31. };
  32. JitReflector.prototype.shallowAnnotations = function (typeOrFunc) {
  33. throw new Error('Not supported in JIT mode');
  34. };
  35. JitReflector.prototype.propMetadata = function (typeOrFunc) {
  36. return this.reflectionCapabilities.propMetadata(typeOrFunc);
  37. };
  38. JitReflector.prototype.hasLifecycleHook = function (type, lcProperty) {
  39. return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
  40. };
  41. JitReflector.prototype.resolveExternalReference = function (ref) {
  42. return builtinExternalReferences.get(ref) || ref.runtime;
  43. };
  44. return JitReflector;
  45. }());
  46. exports.JitReflector = JitReflector;
  47. function createBuiltinExternalReferencesMap() {
  48. var map = new Map();
  49. map.set(compiler_1.Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS, core_1.ANALYZE_FOR_ENTRY_COMPONENTS);
  50. map.set(compiler_1.Identifiers.ElementRef, core_1.ElementRef);
  51. map.set(compiler_1.Identifiers.NgModuleRef, core_1.NgModuleRef);
  52. map.set(compiler_1.Identifiers.ViewContainerRef, core_1.ViewContainerRef);
  53. map.set(compiler_1.Identifiers.ChangeDetectorRef, core_1.ChangeDetectorRef);
  54. map.set(compiler_1.Identifiers.QueryList, core_1.QueryList);
  55. map.set(compiler_1.Identifiers.TemplateRef, core_1.TemplateRef);
  56. map.set(compiler_1.Identifiers.CodegenComponentFactoryResolver, core_1.ɵCodegenComponentFactoryResolver);
  57. map.set(compiler_1.Identifiers.ComponentFactoryResolver, core_1.ComponentFactoryResolver);
  58. map.set(compiler_1.Identifiers.ComponentFactory, core_1.ComponentFactory);
  59. map.set(compiler_1.Identifiers.ComponentRef, core_1.ComponentRef);
  60. map.set(compiler_1.Identifiers.NgModuleFactory, core_1.NgModuleFactory);
  61. map.set(compiler_1.Identifiers.createModuleFactory, core_1.ɵcmf);
  62. map.set(compiler_1.Identifiers.moduleDef, core_1.ɵmod);
  63. map.set(compiler_1.Identifiers.moduleProviderDef, core_1.ɵmpd);
  64. map.set(compiler_1.Identifiers.RegisterModuleFactoryFn, core_1.ɵregisterModuleFactory);
  65. map.set(compiler_1.Identifiers.Injector, core_1.Injector);
  66. map.set(compiler_1.Identifiers.ViewEncapsulation, core_1.ViewEncapsulation);
  67. map.set(compiler_1.Identifiers.ChangeDetectionStrategy, core_1.ChangeDetectionStrategy);
  68. map.set(compiler_1.Identifiers.SecurityContext, core_1.SecurityContext);
  69. map.set(compiler_1.Identifiers.LOCALE_ID, core_1.LOCALE_ID);
  70. map.set(compiler_1.Identifiers.TRANSLATIONS_FORMAT, core_1.TRANSLATIONS_FORMAT);
  71. map.set(compiler_1.Identifiers.inlineInterpolate, core_1.ɵinlineInterpolate);
  72. map.set(compiler_1.Identifiers.interpolate, core_1.ɵinterpolate);
  73. map.set(compiler_1.Identifiers.EMPTY_ARRAY, core_1.ɵEMPTY_ARRAY);
  74. map.set(compiler_1.Identifiers.EMPTY_MAP, core_1.ɵEMPTY_MAP);
  75. map.set(compiler_1.Identifiers.viewDef, core_1.ɵvid);
  76. map.set(compiler_1.Identifiers.elementDef, core_1.ɵeld);
  77. map.set(compiler_1.Identifiers.anchorDef, core_1.ɵand);
  78. map.set(compiler_1.Identifiers.textDef, core_1.ɵted);
  79. map.set(compiler_1.Identifiers.directiveDef, core_1.ɵdid);
  80. map.set(compiler_1.Identifiers.providerDef, core_1.ɵprd);
  81. map.set(compiler_1.Identifiers.queryDef, core_1.ɵqud);
  82. map.set(compiler_1.Identifiers.pureArrayDef, core_1.ɵpad);
  83. map.set(compiler_1.Identifiers.pureObjectDef, core_1.ɵpod);
  84. map.set(compiler_1.Identifiers.purePipeDef, core_1.ɵppd);
  85. map.set(compiler_1.Identifiers.pipeDef, core_1.ɵpid);
  86. map.set(compiler_1.Identifiers.nodeValue, core_1.ɵnov);
  87. map.set(compiler_1.Identifiers.ngContentDef, core_1.ɵncd);
  88. map.set(compiler_1.Identifiers.unwrapValue, core_1.ɵunv);
  89. map.set(compiler_1.Identifiers.createRendererType2, core_1.ɵcrt);
  90. map.set(compiler_1.Identifiers.createComponentFactory, core_1.ɵccf);
  91. return map;
  92. }