gather-ts
Version:
A powerful code analysis and packaging tool designed for creating AI-friendly code representations for javascript and typescript projects.
38 lines (37 loc) • 1.56 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from "events";
import { IContainer, IServiceIdentifier, IServiceFactory } from "./interfaces/IContainer";
import { IService } from "@/types/services";
export declare class Container extends EventEmitter implements IContainer {
private static instance;
private services;
isInitialized: boolean;
private readonly debug;
private constructor();
static getInstance(debug?: boolean): Container;
private logDebug;
initialize(): Promise<void>;
cleanup(): void;
private handleError;
register<T extends IService>(token: IServiceIdentifier, instance: T): void;
registerFactory<T extends IService>(token: IServiceIdentifier, factory: IServiceFactory<T>): void;
resolve<T extends IService>(token: IServiceIdentifier): T;
hasService(token: IServiceIdentifier): boolean;
clear(): void;
}
export declare const ServiceTokens: {
readonly CONFIG_MANAGER: "ConfigManager";
readonly IGNORE_HANDLER: "IgnoreHandler";
readonly TOKEN_COUNTER: "TokenCounter";
readonly ERROR_HANDLER: "ErrorHandler";
readonly ERROR_UTILS: "ErrorUtils";
readonly FILE_SYSTEM: "FileSystem";
readonly DEPENDENCY_ANALYZER: "DependencyAnalyzer";
readonly LOGGER: "Logger";
readonly TOKEN_CACHE: "TokenCache";
readonly COMPILER: "Compiler";
readonly VALIDATOR: "Validator";
readonly ARGUMENT_PARSER: "ArgumentParser";
readonly TEMPLATE_MANAGER: "TemplateManager";
};
export type ServiceToken = (typeof ServiceTokens)[keyof typeof ServiceTokens];