/** * The devframe actions that need a Node host: opening a source file in the * developer's editor, writing a snapshot of the session to disk, and reading * the Custom Elements Manifests the project and its dependencies ship. Only * Node hosts (the Vite plugin, `lit-devtools dev`) create these and hand * them to the definition, which stays loadable in a browser; a host without * them reports neither capability. * * Imports nothing from `node:` at module scope, so a bundler that follows it * from a Node host's graph pulls in nothing until an action runs. */ import type { OpenServiceApi } from '@devframes/service-open'; import type { FeatureSettings, SettingsOverride } from '../../types/timeline.js'; import type { SessionSnapshot } from '../../types/snapshot.js'; import type { SourceLocator } from '../source-locator.js'; import type { SourceDocsIndex } from '../component-docs/source-index.js'; import type { ComponentDocsArgs, ComponentDocsResult, ExportSnapshotArgs, ExportSnapshotResult, OpenSourceArgs, OpenSourceResult } from './protocol.js'; export interface NodeActionsOptions { /** * Resolves the injected `ElementSource.file` paths for `open-source` and * confines opens to its roots (the Vite host's root and * `server.fs.allow`). Read per call, since a host only knows its roots once * its dev server is up. Without one, or before it has roots, the process's * working directory is the only root. */ sourceLocator?: () => SourceLocator | undefined; /** * The editor key the developer named in config or env * (`sourceOverlay.editor`), or `undefined` when they never did. Read per * call. `open-source` maps it, or the panel's override of it, to a * `launch-editor` command; without either the editor is auto-detected. */ configuredEditor?: () => string | undefined; /** * Docs the dev server read from the project's own source as it * transformed it. Asked before any manifest: the source is what is * running, while a manifest may be stale. */ sourceDocs?: () => SourceDocsIndex | undefined; } export interface NodeActions { openSource(args: OpenSourceArgs, host: { /** The hub's open service; nothing opens without one. */ service: OpenServiceApi | undefined; /** The panel's settings override, for its editor choice. */ override: SettingsOverride | undefined; }): Promise; exportSnapshot(args: ExportSnapshotArgs, snapshot: SessionSnapshot, build: { features: FeatureSettings | null; clientAssets?: string; }): Promise; componentDocs(args: ComponentDocsArgs): Promise; /** Call `listener` when a manifest `componentDocs` has read changes. */ onComponentDocsChanged(listener: () => void): void; } export declare const createNodeActions: (options?: NodeActionsOptions) => NodeActions; //# sourceMappingURL=node-actions.d.ts.map