import { BuiltinLanguageId, FeatureId } from './registry'; import { MonacoThemeMode } from './theme'; import { LanguageInput, MonacoApi, MonacoLanguageModule } from './types'; type ExternalLanguage = { id: string; load: () => Promise; }; /** * A memoized async factory, keyed by string. The promise is stored * synchronously — before the factory's own first `await` — so two concurrent * callers for the same key share one in-flight attempt instead of each * starting the work (and, for Monaco registrations, racing to register the * same language id, which throws). A rejection removes the entry so the next * call gets a fresh attempt instead of replaying a cached failure forever. */ export declare function createAsyncCache(): { get(key: string, factory: () => Promise): Promise; clear(): void; }; /** Test seam. Monaco's own globals are not reset — only this module's bookkeeping. */ export declare function resetLoaderStateForTests(): void; export interface PartitionedLanguages { builtins: BuiltinLanguageId[]; externals: ExternalLanguage[]; unknown: string[]; } /** * Sort requested languages into built-ins, external loaders, and ids that match * neither. Unknown ids are reported rather than thrown: a missing grammar should * degrade to plain text, not blank the page. * * A built-in string and an external `{ id, load }` sharing the same id are * mutually exclusive: both are tracked in the same `seen` set keyed by id, so * whichever appears first in `inputs` wins and the other is dropped silently. */ export declare function partitionLanguages(inputs: LanguageInput[]): PartitionedLanguages; export interface LoadMonacoOptions { languages: LanguageInput[]; features?: FeatureId[]; mode: MonacoThemeMode; } export declare function loadMonaco({ languages, features, mode, }: LoadMonacoOptions): Promise; export {};