import { n as ContainerConfig, t as Container } from "./lib.js"; /** * A framework provider that owns a managed container and can rebuild it during a hot swap. * * @remarks * Registered by framework integrations (for example the React `ContainerProvider`) * for every managed container while it is committed. The swap orchestrator reads * the current container, tears it down, constructs a replacement through * {@link HotSwapOwner.create}, and hands it back through {@link HotSwapOwner.commit}. * * @group Hot */ interface HotSwapOwner { /** * Container currently committed by the owner. * * @remarks * Mutated by the orchestrator after a swap so parent-chain lookups in a later * swap see the live container. */ container: Container; /** * Config the current container was constructed from. * * @remarks * Class references inside may be stale after module replacement. The orchestrator remaps * them to their newest generations before calling {@link HotSwapOwner.create}, then writes * the remapped config back here so the owner describes the container it now holds. * * Register one long-lived owner object rather than a fresh one per render: an owner * recreated from the original config would read as outdated on every later swap and rebuild * its container needlessly. */ config: ContainerConfig; /** * Constructs a replacement container from a remapped config. * * @param config - Remapped config with up-to-date classes and parent. * @returns Replacement container. */ create(config: ContainerConfig): Container; /** * Commits the replacement container to the owner's view layer. * * @param container - Replacement container to publish. */ commit(container: Container): void; } /** * Registers a provider as the hot-swap owner of its managed container. * * @group Hot * * @param owner - Owner registration for one managed container. * @returns Callback that removes the registration. */ declare function registerHotSwapOwner(owner: HotSwapOwner): () => void; /** * Marks the start of a hot module's evaluation. * * @group Hot * * @param moduleId - Stable module identifier, usually the root-relative path. */ declare function openHotModule(moduleId: string): void; /** * Marks the end of a hot module's evaluation and registers the classes it declared. * * @remarks * Injected by the dev bundler plugin as the last statement of a module. Registration * follows {@link registerHotModule}, so a replaced class becomes available to the next * {@link requestHotSwap} and a disappeared class requests a page reload. * * @group Hot * * @returns Whether the module declares, or previously declared, hot-swappable classes. * The plugin footer accepts the module's own hot updates only in that case. */ declare function closeHotModule(): boolean; /** * Registers injectable classes from an evaluated hot module. * * @remarks * The first registration establishes each class identity. Later registrations with * the same names make their replacements available to the next {@link requestHotSwap}. * If a registered name disappears, the next request reloads the page because retained * configs may still refer to it. Registration does not modify the constructors. * * This is the explicit form. Transformed modules register through {@link openHotModule} * and {@link closeHotModule} instead, letting `@Injectable()` collect the classes. * * @group Hot * * @param moduleId - Stable module identifier, usually the root-relative path. * @param classes - Classes keyed by their registration name. */ declare function registerHotModule(moduleId: string, classes: Record): void; /** * Returns whether a hot swap is executing right now. * * @remarks * True only inside the synchronous swap block. A React integration uses it to * replace a confusing missing-binding error with a clear diagnostic when * something forces rendering from inside a lifecycle handler during a swap. * * @group Hot * * @returns Whether containers are being swapped at this moment. */ declare function isHotSwapping(): boolean; /** * Requests a hot swap for every container whose classes went stale. * * @remarks * Called by the dev-plugin footer from a module's self-accept callback. The * swap itself runs in a microtask so that every module of one HMR batch * registers its replacement classes first, and then executes as one synchronous * block: teardown deepest-first, rebuild root-first, commit. Nothing can render * between those steps, so no component ever resolves against a torn-down * container. * * @group Hot */ declare function requestHotSwap(): void; export { type HotSwapOwner, closeHotModule, isHotSwapping, openHotModule, registerHotModule, registerHotSwapOwner, requestHotSwap };