import type { Context } from '../../context.js';
import type { PreviewRuntimePreambleOptions, PreviewRuntimeStoryFile } from './preamble.js';
export { PREVIEW_STORY_ENTRY_ID_PREFIX, RESOLVED_PREVIEW_STORY_ENTRY_ID_PREFIX } from './story-entries.js';
/**
 * Options of {@link buildPreviewRuntimeSource}: everything the emitted runtime
 * needs, already resolved. Kept separate from {@link previewRuntime} so the
 * source can be generated (and parsed in tests) without touching the module
 * resolver or a real {@link Context}.
 */
export interface PreviewRuntimeSourceOptions {
    /**
     * True when Vitest and its mocker packages resolve from the project root.
     * Toggles the mocker imports and the real `ensureVitestPreviewEnvironment`
     * body; without it the runtime boots without any Vitest global.
     */
    hasVitestPreview: boolean;
    /** True when the book configures at least one frame plugin (see the preamble option). */
    hasFramePlugins: boolean;
    /** Resolved id of `@vitest/spy` (only used when `hasVitestPreview`). */
    vitestSpyId: string | null;
    /** Resolved id of `@vitest/mocker/browser` (only used when `hasVitestPreview`). */
    vitestMockerBrowserId: string | null;
    /** Resolved id of the `@histoire/shared` runtime entry. */
    histoireSharedId: string;
    /** Resolved id of the variant test session module. */
    variantTestSessionId: string;
    /** Resolved id of the static (build mode) mock runtime module. */
    staticMockRuntimeId: string;
    /** Resolved optional accessibility modules, omitted when disabled or unavailable. */
    accessibilityRuntime?: PreviewRuntimePreambleOptions['accessibilityRuntime'];
    /** Resolved sandbox entry of the bundled `@histoire/app` build. */
    histoireAppSandboxId: string;
    /** Already resolved browser vendors keep virtual imports out of consumer root. */
    histoireVendorIds: PreviewRuntimePreambleOptions['histoireVendorIds'];
    /** Story metadata baked into the runtime at transform time. */
    files: PreviewRuntimeStoryFile[];
    /** Maximum time allowed for one variant mount. */
    mountTimeoutMs: number;
    /** Emitted `"<story id>": () => import("<module id>")` loader entries. */
    loaders: string[];
    /** Emitted per-story entry loaders; switches the runtime to lazy story metadata. */
    storyEntryLoaders?: string[];
}
/**
 * Builds the emitted module loader entries, one
 * `"<story id>": version => import("<module id>")` per story file (see
 * {@link buildStoryModuleLoader}). The object key goes through
 * `JSON.stringify` so a story id containing a quote, a backslash or a backtick
 * cannot break out of the literal it is baked into.
 * @param files Story files to emit a loader for.
 * @param options Loader options.
 * @param options.hmr Enables the cache-busting form.
 */
export declare function buildStoryModuleLoaders(files: PreviewRuntimeStoryFile[], { hmr }?: {
    hmr?: boolean;
}): string[];
/**
 * Composes the preview runtime source from its sections. Each section owns one
 * coherent part of the emitted module and they are concatenated in the order
 * the runtime executes them, separated by a single blank line.
 *
 * The sections share one module scope, which is the contract between them:
 * every binding a section uses but does not declare comes from an earlier one,
 * and everything shared (the baked `files`/`moduleLoaders`, the imported
 * helpers, `selectionState`, `storyFileCache`, the message-type constants) is
 * declared by the preamble. Function declarations hoist, so a later section may
 * be *called* earlier — but a `const` read during another section's top-level
 * execution must be declared before it, or it is in its temporal dead zone.
 */
export declare function buildPreviewRuntimeSource(options: PreviewRuntimeSourceOptions): string;
/**
 * Bakes the story metadata the generated runtimes embed.
 * @param ctx Histoire context holding the collected story files.
 */
export declare function getRuntimeStoryFiles(ctx: Context): PreviewRuntimeStoryFile[];
/**
 * Generates the `virtual:$histoire-preview-runtime` module: the runtime that
 * boots inside Histoire's preview iframe (sandbox). It bakes the collected
 * story metadata and module loaders, so the dev server invalidates this module
 * on every collection.
 */
export declare function previewRuntime(ctx: Context): string;
/**
 * Generates a `virtual:$histoire-preview-story:<id>` entry module from the
 * current collection (see `story-entries.ts`).
 * @param ctx Histoire context holding the collected story files.
 * @param id Resolved entry module id.
 */
export declare function previewStoryEntry(ctx: Context, id: string): string;
//# sourceMappingURL=index.d.ts.map