@o3r/schematics
Version:
Schematics module of the Otter framework
33 lines • 1.29 kB
TypeScript
import { SchematicContext, Tree } from '@angular-devkit/schematics';
import * as ts from 'typescript';
/**
* File information in schematics context
*/
export interface FileInfo {
/** Relative path to app module file */
moduleFilePath: string | undefined;
/** App module file as ts nodes structure */
sourceFile: ts.SourceFile | undefined;
/** NgModule metadata as ts nodes structure */
ngModulesMetadata: ts.Node[] | undefined;
/** File content as string */
appModuleFile: string | undefined;
/** Starting index of the module decorator in the file content */
moduleIndex: number;
/** In case of standalone, we are referencing a component instead of a module */
isStandalone: boolean;
}
/**
* Get the module index of the decorator in a file (supports both standalone and module)
* @param sourceFile
* @param sourceContent
*/
export declare function getModuleIndex(sourceFile: ts.SourceFile, sourceContent: string): Pick<FileInfo, 'ngModulesMetadata' | 'moduleIndex' | 'isStandalone'>;
/**
* Get file information in schematics context
* @param tree
* @param context
* @param projectName
*/
export declare function getFileInfo(tree: Tree, context: SchematicContext, projectName?: string): FileInfo;
//# sourceMappingURL=file-info.d.ts.map