@notjustcoders/ioc-arise
Version:
Arise type-safe IoC containers from your code. Zero overhead, zero coupling.
41 lines • 1.75 kB
TypeScript
/**
* Utility class for preserving user content from existing container files.
* Handles parsing existing containers to extract and preserve custom onInit logic and its dependencies.
*/
export declare class ContainerPreservationUtils {
private static astParser;
/**
* Extracts the body of the onInit function from an existing container file.
* @param containerPath Path to the existing container file
* @returns The body content of the onInit function, or undefined if not found
*/
static extractOnInitBody(containerPath: string): string | undefined;
/**
* Extracts imports that are used within the onInit function.
* @param containerPath Path to the existing container file
* @returns Array of import statements that are referenced in onInit
*/
static extractOnInitRelatedImports(containerPath: string): string[];
/**
* Extracts identifiers (class names, function names, etc.) from an import statement.
* @param importStatement The import statement text
* @returns Array of imported identifiers
*/
private static extractImportedIdentifiers;
/**
* Checks if a container file exists at the given path.
* @param containerPath Path to check for container file
* @returns True if the file exists
*/
static containerExists(containerPath: string): boolean;
/**
* Extracts preserved content for container regeneration.
* @param containerPath Path to the existing container file
* @returns Object containing preserved content
*/
static extractPreservedContent(containerPath: string): {
onInitBody?: string;
onInitImports?: string[];
};
}
//# sourceMappingURL=container-preservation-utils.d.ts.map