@taiga-ui/cdk
Version:
Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance
14 lines (13 loc) • 781 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getComponentFromIdentifier = void 0;
const ng_morph_1 = require("ng-morph");
function getComponentFromIdentifier(identifier) {
var _a;
const [rootImportDeclaration] = (0, ng_morph_1.getImports)(identifier.getSourceFile().getFilePath(), {
namedImports: [identifier.getText()],
});
const rootComponentPath = ((_a = rootImportDeclaration === null || rootImportDeclaration === void 0 ? void 0 : rootImportDeclaration.getModuleSpecifierSourceFile()) === null || _a === void 0 ? void 0 : _a.getFilePath()) || '';
return (0, ng_morph_1.getNgComponents)(rootComponentPath, { name: identifier.getText() })[0];
}
exports.getComponentFromIdentifier = getComponentFromIdentifier;