import type es from 'estree'; import { ErrorSeverity, ErrorType, InternalRuntimeError, SourceErrorWithNode } from '../errors/base'; import type { Node } from '../types'; import type { Chapter } from '../langs'; import type { ModuleDeclarationWithSource } from './moduleTypes'; /** * Error thrown at runtime when loading amodule throws an unhandled error. */ export declare class ModuleInternalError extends InternalRuntimeError { readonly moduleName: string; readonly error?: any | undefined; constructor(moduleName: string, node: ModuleDeclarationWithSource, error?: any | undefined); elaborate(): string; } declare abstract class ImportError extends SourceErrorWithNode { type: ErrorType; severity: ErrorSeverity; } /** * Error thrown at Import time when the configured modules server can't be reached. */ export declare class ModuleConnectionError extends ImportError { private static message; private static elaboration; explain(): string; elaborate(): string; } /** * Error thrown at import time when the requested module can't be found on the configured modules * server. If this error is thrown, it means that the modules server is reachable. */ export declare class ModuleNotFoundError extends ImportError { readonly moduleName: string; constructor(moduleName: string, node?: ModuleDeclarationWithSource); explain(): string; elaborate(): string; } /** * Error thrown when the given module has a chapter restriction and the current * evaluation context is not of a high enough chapter */ export declare class WrongChapterForModuleError extends ImportError { readonly moduleName: string; readonly required: Chapter; readonly actual: Chapter; constructor(moduleName: string, required: Chapter, actual: Chapter, node?: ModuleDeclarationWithSource); explain(): string; elaborate(): string; } /** * Nodes that directly import and declare an export from another module */ type ImportingNodes = Exclude | es.ImportDeclaration['specifiers'][number] | es.ExportSpecifier; /** * Error thrown when the module being imported doesn't actually export any symbols */ export declare class UndefinedNamespaceImportError extends ImportError { readonly moduleName: string; constructor(moduleName: string, node?: T); explain(): string; elaborate(): string; } /** * Error thrown when the module being imported doesn't export a symbol with the given name */ export declare class UndefinedImportError extends UndefinedNamespaceImportError { /** * Symbol that is being imported */ readonly symbol: string; constructor( /** * Symbol that is being imported */ symbol: string, moduleName: string, node?: es.ImportDeclaration['specifiers'][number] | es.ExportSpecifier); explain(): string; } export declare class UndefinedDefaultImportError extends UndefinedImportError { constructor(moduleName: string, node?: es.ImportDeclaration['specifiers'][number] | es.ExportSpecifier); explain(): string; } /** * Error thrown when together, the imports by a group of files * causes an import cycle. */ export declare class CircularImportError extends ImportError { readonly filePathsInCycle: string[]; constructor(filePathsInCycle: string[]); explain(): string; elaborate(): string; } export declare abstract class InvalidFilePathError extends ImportError { readonly filePath: string; constructor(filePath: string); } export declare class IllegalCharInFilePathError extends InvalidFilePathError { explain(): string; elaborate(): string; } export declare class ConsecutiveSlashesInFilePathError extends InvalidFilePathError { explain(): string; elaborate(): string; } export declare class DuplicateImportNameError extends ImportError { readonly nodes: Node[]; readonly locString: string; get location(): es.SourceLocation; constructor(nodes: Node[]); explain(): string; elaborate(): string; } export {};