import type { AddressInfo } from 'node:net'; import { type Plugin, type ViteDevServer } from 'vite'; import { type LitPluginOptions } from './lib/plugin.js'; export interface LitAstroOptions extends LitPluginOptions { /** * Render Lit components on the server and hydrate them, as Astro's * renderer for Lit. Needs `@lit-labs/ssr` and `@lit-labs/ssr-client`. * Turn it off to keep another Lit renderer and take only HMR and the * DevTools ({@link litDevtools} does that). Defaults to `true`. */ render?: boolean; /** * Attach declarative shadow roots in browsers that can't parse them, * before any component is defined, so the server's HTML still hydrates. * Every current browser parses them natively. Defaults to `false`. */ shadowRootPolyfill?: boolean; /** * Put the Lit panel in Astro's dev toolbar. Needs the panel, so it does * nothing with `timeline: false`. Defaults to `true`. */ toolbar?: boolean; } interface AstroLogger { info(message: string): void; } /** The slices of Astro's integration hook arguments this integration uses. */ interface ConfigSetup { command: 'dev' | 'build' | 'preview' | 'sync'; config: { root: URL; }; updateConfig: (config: { vite: { plugins?: Plugin[]; optimizeDeps?: { include: string[]; }; }; }) => unknown; addRenderer: (renderer: { name: string; serverEntrypoint: string; clientEntrypoint: string; }) => void; injectScript: (stage: 'page' | 'before-hydration', content: string) => void; addDevToolbarApp: (app: { id: string; name: string; icon: string; entrypoint: string; }) => void; } interface ServerSetup { server: ViteDevServer; toolbar: { send(event: string, payload: unknown): void; on(event: string, callback: (payload: unknown) => void): void; }; } interface ServerStart { address: AddressInfo; logger: AstroLogger; } export interface LitAstroIntegration { name: string; hooks: { 'astro:config:setup': (options: ConfigSetup) => void; 'astro:server:setup': (options: ServerSetup) => void; 'astro:server:start': (options: ServerStart) => void; }; } /** * Lit in Astro: renders Lit components on the server and hydrates them, * hot-patches them in dev, and puts the Lit panel in the dev toolbar. */ export declare const lit: (options?: LitAstroOptions) => LitAstroIntegration; /** * HMR and the Lit panel, without the renderer: for a site that keeps * another Lit renderer, such as `@awesome.me/astro-lit`. */ export declare const litDevtools: (options?: Omit) => LitAstroIntegration; /** For Astro's container API: the renderer, as `renderers` takes it. */ export declare const getContainerRenderer: () => { name: string; serverEntrypoint: string; }; export default lit; //# sourceMappingURL=astro.d.ts.map