UNPKG

@prism-lang/core

Version:

A programming language for uncertainty

45 lines 1.25 kB
import { ImportStatement, ExportStatement } from './ast'; import { Runtime, Value } from './runtime'; export interface ModuleExports { default?: Value; named: Map<string, Value>; } export interface Module { path: string; exports: ModuleExports; environment: any; isExecuted: boolean; isExecuting: boolean; } export declare class ModuleSystem { private modules; private currentModulePath; private fileReader; constructor(fileReader?: (path: string) => string); /** * Resolve a module path relative to the current module */ private resolvePath; /** * Load and execute a module */ loadModule(modulePath: string, runtime: Runtime): Promise<Module>; /** * Execute a module's code */ private executeModule; /** * Handle import statement execution */ executeImport(importStmt: ImportStatement, runtime: any): Promise<void>; /** * Handle export statement execution */ executeExport(exportStmt: ExportStatement, runtime: any): Promise<void>; /** * Clear module cache (useful for testing) */ clearCache(): void; } export declare const moduleSystem: ModuleSystem; //# sourceMappingURL=module-system.d.ts.map