AuraContext context = Aura.getContextService().getCurrentContext();
BaseComponent<?, ?> component = context.getCurrentComponent();
String desc = (String) component.getAttributes().getValue("descriptor");
DefType defType = DefType.valueOf(((String) component.getAttributes().getValue("defType")).toUpperCase());
DefinitionService definitionService = Aura.getDefinitionService();
DefDescriptor<?> descriptor = definitionService.getDefDescriptor(desc, defType.getPrimaryInterface());
Definition def = descriptor.getDef();
ReferenceTreeModel.assertAccess(def);
Map<DefType, List<DefModel>> depsMap = Maps.newEnumMap(DefType.class);
Set<DefDescriptor<?>> deps = Sets.newHashSet();
def.appendDependencies(deps);
for (DefDescriptor<?> dep : deps) {
DefType type = dep.getDefType();
List<DefModel> depsList = depsMap.get(type);
if (depsList == null) {
depsList = Lists.newArrayList();
depsMap.put(type, depsList);