import type { DeckConfig, DeckOptions, Runtime } from './types.js'; /** * `electronDeck(config, options?)` 是 framework 唯一入口(见 README §3)。 * * - Invalid config → reject `TypeError`,phase 不前进 * - Valid config → 装配 runtime + 调 `config.setup(runtime)` await 完成 → * resolve。不接 Electron 时,resolve 后 framework 仍持有运行时; * 接 Electron app lifecycle 后,由 Electron event loop 撑住进程, * `electronDeck()` 同样 resolve(host 的 main 文件不需 await 阻塞)。 * * backend host(如 devtools)走 `electronDeck({ backend })`——backend 是 * {@link DeckConfig} 的字段,不再需要空 `{}` + options。 * * `options` 是测试 / 非 Electron 环境用的注入点(见 {@link DeckOptions})。 * 生产路径不传 options:framework `await import('electron')` 取真 `ipcMain` / * `BrowserWindow` / `WebContentsView`。 */ export declare function electronDeck(config: DeckConfig, options?: DeckOptions): Promise; /** * Synchronous launch handle for `electronDeck`. * * `electronDeck(config)` is `async` and internally `await app.start()` → * `await app.whenReady()`. A host ESM main entry doing `await electronDeck(config)` * SUSPENDS module evaluation on the whenReady gate — but Electron's `ready` only * fires once module evaluation finishes, so the gate never resolves: HARD DEADLOCK. * * `startElectronDeck` returns a plain handle SYNCHRONOUSLY (NOT a thenable), so a * host's top-level `await handle.ready` never sits on the whenReady gate. Assembly * still runs STRICTLY AFTER `app.whenReady()` resolves (gating intact inside * `app.start()`); `handle.ready` resolves with the {@link Runtime}; `handle.dispose()` * tears the app down even if called before the in-flight start finished. * * Invalid config throws a `TypeError` synchronously (matching `electronDeck`'s * validate-first contract) — the error surfaces, never silently deadlocks. * * `@experimental` No production consumer yet — the only caller in this repo is * `packages/devtools/spike/popout/harness.mjs`; devtools' real entry * (`launch.ts`) uses `electronDeck({ backend })` instead. Contract may change * until a second real consumer adopts it. */ export declare function startElectronDeck(config: DeckConfig, options?: DeckOptions): { ready: Promise; dispose(): Promise; }; /** * Pure validation:不依赖 Electron / IPC / 任何 framework state,可单独 unit * test。每一条检查对应 doc §3.3 字段约束。 * * 验证语义保证:通过 validateConfig 的 config 不会在 framework Bind 阶段被拒。 * 含 HostEvent 来源、source 互斥、map vs array 等所有"shape 就绪"检查。 * * @internal exported for tests */ export declare function validateConfig(config: DeckConfig): void; /** * publish-time guard:HostEvent 未在 `config.events` 中显式列出时阻止 publish。 * 避免 module-load-order 隐式注册。 * * @internal exported for tests */ export declare function assertEventDeclared(declared: ReadonlySet, eventName: string): void; //# sourceMappingURL=electron-deck.d.ts.map