UNPKG

ngast

Version:

Parsing tools for Angular. The project is an abstraction over the Angular compiler which provides friendly interface.

73 lines 2.86 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { Symbol } from './symbol'; import { assertDeps, exists } from './utils'; import { WrappedNodeExpr } from '@angular/compiler'; var DirectiveSymbol = /** @class */ (function (_super) { __extends(DirectiveSymbol, _super); function DirectiveSymbol() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.annotation = 'Directive'; return _this; } Object.defineProperty(DirectiveSymbol.prototype, "deps", { /** @internal */ get: function () { var _a; return (_a = this.analysis) === null || _a === void 0 ? void 0 : _a.meta.deps; }, enumerable: false, configurable: true }); Object.defineProperty(DirectiveSymbol.prototype, "metadata", { get: function () { var _a; var meta = (_a = this.analysis) === null || _a === void 0 ? void 0 : _a.meta; if (!meta) { return null; } return { exportAs: meta.exportAs, selector: meta.selector, inputs: meta.inputs, outputs: meta.outputs }; }, enumerable: false, configurable: true }); /** * Return class & factory providers specific to this class * @note only providers specified in the `provider` fields of the directive will be returned (not the module). */ DirectiveSymbol.prototype.getProviders = function () { var _a; var providers = (_a = this.analysis) === null || _a === void 0 ? void 0 : _a.meta.providers; if (providers instanceof WrappedNodeExpr) { return this.workspace.providerRegistry.getAllProviders(providers.node); } else { return []; } }; /** Return dependencies injected in the constructor of the directive */ DirectiveSymbol.prototype.getDependencies = function () { var _this = this; assertDeps(this.deps, this.name); return this.deps.map(function (dep) { return _this.workspace.findSymbol(dep.token); }).filter(exists); }; return DirectiveSymbol; }(Symbol)); export { DirectiveSymbol }; //# sourceMappingURL=directive.symbol.js.map