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!
34 lines (33 loc) • 1.46 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgramRepository = void 0;
var typescript_1 = __importDefault(require("typescript"));
var TsConfigProvider_1 = require("../ts-config-path-provider/TsConfigProvider");
var ProgramRepository = /** @class */ (function () {
function ProgramRepository() {
}
ProgramRepository.initProgram = function (contextPaths) {
var compilerOptions = typescript_1.default.parseJsonConfigFileContent(TsConfigProvider_1.TsConfigProvider.tsConfig, typescript_1.default.sys, './');
compilerOptions.options.noResolve = true;
compilerOptions.options.noLib = true;
var newProgram = typescript_1.default.createProgram(contextPaths, compilerOptions.options);
//SETTING PARENT PROPERTY OF ALL NODES
newProgram.getTypeChecker();
this._program = newProgram;
};
Object.defineProperty(ProgramRepository, "program", {
get: function () {
if (this._program === undefined) {
throw new Error('Trying to access new program before program initialization');
}
return this._program;
},
enumerable: false,
configurable: true
});
return ProgramRepository;
}());
exports.ProgramRepository = ProgramRepository;