import { CodeEditor, Hooks } from "../editor"; import { FileConstructor, ICodeFile } from "../libs/interfaces/editor"; /** * dts关系清单 */ export interface DtsManifest { /** 由npm包名到dts文件名的映射 */ imports: { [key: string]: string; }; /** npm包到npm包所依赖的其它npm包名数组的映射 */ dependencies?: { [key: string]: string; }; } export interface TSHooks extends Hooks { /** 加载相对路径的ts文件 */ loadTSFiles(files: string[]): Promise<{ name: string; content: string; }[]>; /** 加载npm包的类型声明文件 */ loadTSPackages(packages: string[]): Promise<{ name: string; content: string; }[]>; /** 获取dts关系清单 */ getDtsManifest(): Promise; } /** TypeScript代码编辑器 */ export declare class TSEditor extends CodeEditor { /** 已加载的外部包的名称集合 */ private loadedLibs; protected fileConstructor(): FileConstructor; /** * 为项目附加三方包 * @param content 包内容 * @param libName 包名 */ private addExtraLib; private loadPackages; /** * (根据依赖关系)获取全部需要加载的npm包的包名 * @param npms npm包名数组 * @returns 所有需要加载的包名 */ private getAllDeptNpmPkgName; private loadFiles; /** * 实例化文件对象 * @param path 文件路径 * @param content 文件内容 */ protected init(path: string, content?: string): Promise; private getNpmCompletionItems; constructor(element: HTMLElement, hooks: TSHooks); }