/** * The page channel over a `chrome.runtime.Port`, for the browser extension: * the page runtime's traffic reaches the DevTools panel through a port the * extension relays, and the panel runs the Lit devframe in-process (see * `local-host.ts`) instead of dialling a dev server. * * Both ends speak one message shape, {@link PortMessage}: the * {@link PageTransport} channel name and its payload, nothing else. Chrome * JSON-serializes everything posted on a port, so a payload has to survive * `JSON.stringify` -- which every `lit:*` message already does, since the * Vite HMR channel has the same constraint. * * Nothing here imports `chrome`: a port is anything shaped like {@link PortLike}, * which keeps this testable with a fake pair and usable over any relay * (a content script forwarding `window.postMessage`, say). */ import type { PageTransport } from '../runtime/page-transport.js'; import { type PortLike } from './port-message.js'; import type { KeyValueStorage, LocalDevframeClient } from './local-host.js'; import type { DefineSourceResolver, TemplateLocator } from './define-sources.js'; import type { CreateLitDevframeOptions } from './definition.js'; export type { PortLike } from './port-message.js'; /** * Either end of a port as a {@link PageTransport}: the page's, for * `pageChannel.attach()`, and the panel's, for its codec. One port is one * page. */ export declare const portPageTransport: (port: PortLike) => PageTransport; export interface LocalLitHostOptions { /** The panel's end of the port to the inspected page. */ port: PortLike; /** Surfaced by `get-meta`, as on every host. */ version: string; /** Where the panel's settings persist; in memory when omitted. */ storage?: KeyValueStorage; /** * Where a component the plugin never stamped is defined, from its define * call's stack; see `createStandaloneLitDevframe`. */ resolveDefineSource?: DefineSourceResolver; /** Where an unstamped element is rendered; see `createStandaloneLitDevframe`. */ locateTemplate?: TemplateLocator; /** Component docs from the manifests the page links to. */ docsSource?: CreateLitDevframeOptions['docsSource']; /** See {@link CreateLitDevframeOptions.onDocsSourceChanged}. */ onDocsSourceChanged?: CreateLitDevframeOptions['onDocsSourceChanged']; } /** * The whole panel-side host for one inspected page: the Lit devframe, fed by * the page on `port`, running in this realm. Hand the result to the panel * with `useLocalClient()` (`panel/client.ts`). * * Resolve this before the page end attaches: the runtime announces itself on * attach, and messages that arrive before the definition's `setup()` has * finished are dropped, as on every other host. */ export declare const createLocalLitHost: (options: LocalLitHostOptions) => Promise; //# sourceMappingURL=port-link.d.ts.map