mp-lens
Version:
微信小程序分析工具 (Unused Code, Dependencies, Visualization)
28 lines (27 loc) • 1.02 kB
TypeScript
import { AnalyzerOptions } from '../types/command-options';
/**
* FileParser: Orchestrates parsing of different file types in a WeChat Mini Program.
* Handles file reading and path resolution, then delegates text analysis to specialized parsers.
*/
export declare class FileParser {
private pathResolver;
private javaScriptParser;
private wxmlParser;
private wxssParser;
private jsonParser;
constructor(projectRoot: string, options: AnalyzerOptions);
/**
* Parses a single file by reading its content and delegating text analysis to the appropriate parser.
* Handles path resolution centrally.
* Returns a list of absolute paths to the file's dependencies.
*/
parseFile(filePath: string): Promise<string[]>;
/**
* Resolves a raw dependency path to an absolute path based on file type context
*/
private resolveDependencyPath;
/**
* Determines if a path refers to an image file based on its extension
*/
private isImagePath;
}