import type { ArkFile } from './ArkFile'; import type { FileDepGraph } from '../graph/FileDepGraph'; import type { Scene } from '../../Scene'; /** * Numeric identifier for an {@link ArkModule}, allocated by the module Canonicalizer. */ export type ModuleID = number; /** * Lifecycle state of an {@link ArkModule}. Stored in the low 3 bits of {@link ArkModule.tags}. * * Progression: NOT_LOADED → INDEX → SIGNATURES → BODIES. * INDEX is downgrade-only (hollow export-reachable IR); never a direct loadModule target. */ export declare enum ModuleLoadState { NOT_LOADED = 0, /** Hollow export-reachable ArkFile IR (bodies/AST stripped, non-exports pruned). */ INDEX = 1, /** Classes/method signatures without method bodies. */ SIGNATURES = 2, /** SIGNATURES + method bodies (ArkBody, CFG, Stmt/Expr). */ BODIES = 3 } /** * Category of an {@link ArkModule}. Stored in bits 3-4 of {@link ArkModule.tags}. */ export declare enum ModuleType { /** In-project module (HAP/HSP/HAR) from build-profile.json5. */ PROJECT = 0, /** SDK sub-module from the SDK directory (e.g. openharmony/ets/api, ets/kits). */ SDK = 1, /** Third-party dependency module under oh_modules. */ OH_MODULES = 2 } /** * ArkModule is the new layer between {@link Scene} and {@link ArkFile}, corresponding to a single * module (HAP/HSP/HAR) of an OpenHarmony application. * * `loadState` and `moduleType` share a single `number` bit-field (`tags`), read/written via * {@link setTagValue}/{@link getTagValue}, following the pattern in `ArkBaseModel.tags`. * The default `tags` value `0` means `ModuleLoadState.NOT_LOADED | ModuleType.PROJECT`. * * @category core/model */ export declare class ArkModule { /** Absolute path of the module (primary identifier). */ private modulePath; /** Module name from oh-package.json5 (e.g. "@ohos/entry"); auxiliary field. */ private moduleName; /** key: {@link FileSignature.toMapKey} */ private filesMap; /** * Alias-to-id mapping for dependencies, defined at the use site. * key: alias in this module's oh-package.json5 dependencies (e.g. "@ohos/library"). * value: ModuleID of the depended-on module. */ private dependencyAliasToId; /** * Unresolved dependencies (not participating in inter-module topological sort). * key: alias, value: version or path. */ private unresolvedDependencies; /** * Intra-module file dependency graph, built during import/export analysis on the * way to SIGNATURES. Undefined until {@link analyzeFileDependencies} has run. */ private fileDepGraph?; /** * Bit-field encoding loadState (bits 0-2) and moduleType (bits 3-4). * Default 0 = ModuleLoadState.NOT_LOADED | ModuleType.PROJECT. */ private tags; /** Back reference to the owning Scene. */ private scene; constructor(scene: Scene); /** Returns the owning {@link Scene} of this module. */ getScene(): Scene; private setTagValue; private getTagValue; getModulePath(): string; setModulePath(modulePath: string): void; getModuleName(): string; setModuleName(moduleName: string): void; getFilesMap(): Map; getLoadState(): ModuleLoadState; setLoadState(state: ModuleLoadState): void; getModuleType(): ModuleType; setModuleType(type: ModuleType): void; /** * Returns the list of modules this module directly depends on (successor dependencies). * Reads from the module dependency graph maintained by the Scene. * Returns an empty array when the dependency graph has not been built yet. */ getDependencies(): ArkModule[]; /** * Returns the list of modules that directly depend on this module (predecessor dependents). * Reads from the module dependency graph maintained by the Scene. * Returns an empty array when the dependency graph has not been built yet. */ getDependents(): ArkModule[]; /** * Record an alias for a depended-on module within this module. * For example, given dependencies: { "@ohos/library": "file:../library" } in oh-package.json5, * alias = "@ohos/library", depId = ModuleID of the library module. */ addDependencyAlias(alias: string, depId: ModuleID): void; /** * Resolve the ModuleID of a depended-on module by its alias defined in this module. */ resolveDependencyAlias(alias: string): ModuleID | undefined; getDependencyAliasToId(): Map; addUnresolvedDependency(alias: string, value: string): void; getUnresolvedDependencies(): Map; /** The intra-module file dependency graph, or undefined before analysis. */ getFileDepGraph(): FileDepGraph | undefined; setFileDepGraph(graph: FileDepGraph | undefined): void; /** Whether file dependency analysis has produced a topological order. */ hasFileTopoOrder(): boolean; addFile(arkFile: ArkFile): void; clearFilesMap(): void; /** * Returns the absolute path of this module's oh-package.json5. * Derived from the module path, not stored persistently. */ getOhPkgPath(): string; /** * Reads and parses oh-package.json5 on demand (not stored persistently). * Used only during the build phase. Returns `{}` if the file does not exist. */ readOhPkgContent(): { [k: string]: unknown; }; } //# sourceMappingURL=ArkModule.d.ts.map