diff --git a/ets2panda/bindings/src/common/ui_plugins_driver.ts b/ets2panda/bindings/src/common/ui_plugins_driver.ts index 464cd6b396dc8ef61bd9036fdb0dd07084331c12..f6dd9860ddc4bef0f3c0e49e6ab53657e60689f1 100644 --- a/ets2panda/bindings/src/common/ui_plugins_driver.ts +++ b/ets2panda/bindings/src/common/ui_plugins_driver.ts @@ -14,6 +14,7 @@ */ import { KNativePointer } from './InteropTypes'; +import { LANGUAGE_VERSION } from './preDefine'; import { BuildConfig } from './types'; export enum PluginHook { @@ -60,12 +61,57 @@ type RawPlugins = { init: PluginInitFunction | undefined; }; +export interface DependentModuleConfig { + packageName: string; + moduleName: string; + moduleType: string; + modulePath: string; + sourceRoots: string[]; + entryFile: string; + language: string; + declFilesPath?: string; + dependencies?: string[]; + abcPath?: string; + declgenV1OutPath?: string; + declgenV2OutPath?: string; + declgenBridgeCodePath?: string; + byteCodeHar: boolean; +} + +export class FileManager { + private static instance: FileManager | undefined = undefined; + static arkTSModuleMap: Map = new Map(); + static staticApiPath: Set = new Set(); + static dynamicApiPath: Set = new Set(); + static buildConfig: BuildConfig; + private constructor() { } + + static setInstance(instance: FileManager | undefined): void { + if (instance === undefined) { + FileManager.instance = new FileManager(); + } + FileManager.instance = instance; + } + + static getInstance(): FileManager { + if (!FileManager.instance) { + FileManager.instance = new FileManager(); + } + return FileManager.instance; + } + + getLanguageVersionByFilePath(filePath: string): string { + return LANGUAGE_VERSION.ARKTS_1_2; + } +} + class PluginContext { private ast: object | undefined; private program: object | undefined; private projectConfig: object | undefined; private contextPtr: KNativePointer | undefined; private codingFilePath: string | undefined; + private fileManager: FileManager | undefined; constructor() { this.ast = undefined; @@ -75,6 +121,10 @@ class PluginContext { this.codingFilePath = undefined; } + public getFileManager(): FileManager | undefined { + return this.fileManager; + } + public setArkTSAst(ast: object): void { this.ast = ast; }