1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/compiler/src/ng_module_resolver", ["require", "exports", "@angular/compiler/src/core", "@angular/compiler/src/directive_resolver", "@angular/compiler/src/util"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.NgModuleResolver = void 0;
|
---|
20 | var core_1 = require("@angular/compiler/src/core");
|
---|
21 | var directive_resolver_1 = require("@angular/compiler/src/directive_resolver");
|
---|
22 | var util_1 = require("@angular/compiler/src/util");
|
---|
23 | /**
|
---|
24 | * Resolves types to {@link NgModule}.
|
---|
25 | */
|
---|
26 | var NgModuleResolver = /** @class */ (function () {
|
---|
27 | function NgModuleResolver(_reflector) {
|
---|
28 | this._reflector = _reflector;
|
---|
29 | }
|
---|
30 | NgModuleResolver.prototype.isNgModule = function (type) {
|
---|
31 | return this._reflector.annotations(type).some(core_1.createNgModule.isTypeOf);
|
---|
32 | };
|
---|
33 | NgModuleResolver.prototype.resolve = function (type, throwIfNotFound) {
|
---|
34 | if (throwIfNotFound === void 0) { throwIfNotFound = true; }
|
---|
35 | var ngModuleMeta = directive_resolver_1.findLast(this._reflector.annotations(type), core_1.createNgModule.isTypeOf);
|
---|
36 | if (ngModuleMeta) {
|
---|
37 | return ngModuleMeta;
|
---|
38 | }
|
---|
39 | else {
|
---|
40 | if (throwIfNotFound) {
|
---|
41 | throw new Error("No NgModule metadata found for '" + util_1.stringify(type) + "'.");
|
---|
42 | }
|
---|
43 | return null;
|
---|
44 | }
|
---|
45 | };
|
---|
46 | return NgModuleResolver;
|
---|
47 | }());
|
---|
48 | exports.NgModuleResolver = NgModuleResolver;
|
---|
49 | });
|
---|
50 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmdfbW9kdWxlX3Jlc29sdmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL25nX21vZHVsZV9yZXNvbHZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7Ozs7SUFHSCxtREFBc0Q7SUFDdEQsK0VBQThDO0lBQzlDLG1EQUFpQztJQUdqQzs7T0FFRztJQUNIO1FBQ0UsMEJBQW9CLFVBQTRCO1lBQTVCLGVBQVUsR0FBVixVQUFVLENBQWtCO1FBQUcsQ0FBQztRQUVwRCxxQ0FBVSxHQUFWLFVBQVcsSUFBUztZQUNsQixPQUFPLElBQUksQ0FBQyxVQUFVLENBQUMsV0FBVyxDQUFDLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxxQkFBYyxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQ3pFLENBQUM7UUFFRCxrQ0FBTyxHQUFQLFVBQVEsSUFBVSxFQUFFLGVBQXNCO1lBQXRCLGdDQUFBLEVBQUEsc0JBQXNCO1lBQ3hDLElBQU0sWUFBWSxHQUNkLDZCQUFRLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLEVBQUUscUJBQWMsQ0FBQyxRQUFRLENBQUMsQ0FBQztZQUV6RSxJQUFJLFlBQVksRUFBRTtnQkFDaEIsT0FBTyxZQUFZLENBQUM7YUFDckI7aUJBQU07Z0JBQ0wsSUFBSSxlQUFlLEVBQUU7b0JBQ25CLE1BQU0sSUFBSSx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