Automerge backed Markdown editor for the Atmosphere
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778import type { PluginManifest } from '../types'import type { Plugin } from '../plugin'
/** * Plugin lifecycle states. */export type PluginState = | 'unloaded' // Manifest known, module not imported | 'loading' // import() in progress | 'loaded' // Module imported, not instantiated | 'enabling' // Instance created, onload() running | 'active' // Fully enabled and running | 'disabling' // onunload() running | 'disabled' // Explicitly disabled by user | 'error' // Failed to load or threw during lifecycle
/** * Internal plugin record maintained by PluginLoader. */export interface PluginRecord { /** Plugin manifest */ manifest: PluginManifest /** Current state */ state: PluginState /** Plugin instance (when loaded and enabled) */ instance: Plugin | null /** Module entry point URL */ entryUrl: string /** Cached module (result of import()) */ module: PluginModule | null /** Error if state is 'error' */ error: Error | null}
/** * Result of dynamic import() - module with default Plugin class export. */export interface PluginModule { default: new (...args: ConstructorParameters<typeof Plugin>) => Plugin}
/** * Plugin source entry for registration. */export interface PluginSource { /** Host-owned admission receipt; never inferred from plugin ID. */ catalogAdmitted?: boolean waitForMetadata?: boolean /** Plugin manifest */ manifest: PluginManifest /** Module entry point URL (relative, absolute, or blob:) */ entryUrl: string}
/** * Events emitted by PluginLoader. * @internal Host-internal event map. Not part of the plugin-facing API. */export interface PluginLoaderEvents { /** Host-owned removal excludes enables until durable deletion has settled. */ 'plugin-uninstall-change': [pluginId: string, uninstalling: boolean] /** Emitted when plugin state changes */ 'plugin-state-change': [pluginId: string, newState: PluginState, oldState: PluginState] /** Emitted when plugin is enabled */ 'plugin-enabled': [pluginId: string, instance: Plugin] /** Emitted when plugin is disabled */ 'plugin-disabled': [pluginId: string] /** Emitted when plugin fails */ 'plugin-error': [pluginId: string, error: Error]}
/** * Module importer function type. * Abstracted for testability - production uses dynamic import(), * tests inject mock modules. */export type ModuleImporter = (url: string) => Promise<PluginModule>