UNPKG

dependency-injection-cat

Version:

DI Cat is a truly clean DI-container, which allows you not to pollute your business logic with decorators from DI/IOC libraries!

29 lines (28 loc) 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reportAboutCyclicDependencies = void 0; var DependencyGraph_1 = require("../connect-dependencies/DependencyGraph"); var CompilationContext_1 = require("../../compilation-context/CompilationContext"); var reportAboutCyclicDependencies = function (contextDescriptor) { var cycle = DependencyGraph_1.DependencyGraph.getCycle(); cycle.forEach(function (cycles, contextName) { if (contextDescriptor.name !== contextName) { return; } cycles.forEach(function (cycle) { var names = []; var nodes = []; cycle.forEach(function (it) { names.push(it.classMemberName); nodes.push(it.node); }); CompilationContext_1.CompilationContext.reportErrorWithMultipleNodes({ nodes: nodes, message: "Cyclic dependencies detected in context \"" + contextName + "\" for Beans: " + names.join(' <—> '), filePath: contextDescriptor.absolutePath, relatedContextPath: contextDescriptor.absolutePath, }); }); }); }; exports.reportAboutCyclicDependencies = reportAboutCyclicDependencies;