/**
 * Build-time expansion of Hot.include(path, literalArgs) calls.
 *
 * Given a partial path and a JSON-serializable args object, this module
 * compiles the partial via the legacy HotFile.parseContent pipeline and
 * executes it inside a Node-side sandbox with a minimal Hot global that
 *
 *   - echoUnsafe(str) / echo(str): appends to an Output buffer
 *   - include(path, args): recursive, reuses the same sandbox
 *   - Cookies, CurrentPage, Data: no-op stubs
 *   - getJSON / fetch / anything network: throws so the caller can
 *     detect "this partial has runtime dependencies" and fall back.
 *
 * The output HTML is fully static: interleaved `<* for/if *>` control
 * flow unrolled, `${TITLE}` substitutions resolved, nested partials
 * expanded recursively. Matches the admin-panel shape end to end.
 *
 * When execution throws, the caller falls back to the HS090-15 raw-
 * template-inline behaviour and emits a warning so the site author can
 * refactor or declare the route as staticRender: true.
 */
import { Node } from "ts-morph";
/**
 * Collector the builder passes in so module shims can record assets
 * for hoisting into the shell `<head>` (HS090-7 / HS090-8 integration
 * with the admin-panel's module manifest).
 */
export interface AssetCollector {
    addCss(href: string): void;
    addJs(src: string): void;
    addComponents(componentLibrary: string, componentNames: string[]): void;
}
export interface ExpandPartialOptions {
    /** Absolute path of the partial .hott file. */
    absPath: string;
    /** Args object — must already be JSON-serialisable. */
    args: Record<string, any>;
    /**
     * Resolver for nested Hot.include calls. Receives the nested path
     * exactly as written (module-prefix, ./rel, etc.) and returns the
     * resolved absolute path, or throws if it can't be resolved.
     */
    resolve: (requestedPath: string, fromFile: string) => string;
    /**
     * The app's publicDir on disk. The sandbox's Hot.import looks up
     * installed modules under `<publicDir>/hotstaq_modules/<name>/index.js`
     * (the hotstaq module-install convention) to populate HotModule
     * instances with their css/js/html/component manifests.
     */
    publicDir?: string;
    /**
     * Optional shared registry of already-loaded modules. Callers who
     * expand multiple partials in one build can pass the same map to
     * amortise the module-load cost and keep name→path entries visible
     * across sibling expansions.
     */
    moduleRegistry?: Map<string, SandboxModule>;
    /**
     * Optional collector the builder uses to hoist module assets
     * (<link>/<script> references emitted by module.outputCSS/JS)
     * into the shell <head> instead of leaving them embedded inside
     * the template stash. Matches the legacy SSR behaviour more
     * closely: admin-panel CSS and JS load once on page entry, not
     * per-route-mount.
     */
    assets?: AssetCollector;
}
/** One completed expansion. */
export interface ExpandResult {
    /** Rendered HTML. */
    html: string;
    /** Partials transitively visited. */
    visited: string[];
}
/**
 * Shape of an installed hotstaq module after its index.js has run in
 * the sandbox. Mirrors the real HotModule class (src/HotModule.ts) but
 * declared inline so build-expand doesn't pull in SSR-only imports.
 */
export interface SandboxModule {
    name: string;
    js: string[];
    css: string[];
    html: Array<{
        name: string;
        path: string;
    }>;
    componentLibrary: string;
    components: string[];
}
/**
 * Render a partial at build time with the given literal args bound.
 *
 * Throws (with a descriptive message) when the partial's preamble
 * touches a runtime-only API (getJSON, fetch, Hot.API.*, etc.), when
 * the sandbox exceeds a cycle limit, or when the compiled .hott raises
 * a SyntaxError the sandbox can't wrap.
 */
export declare function expandPartial(opts: ExpandPartialOptions): Promise<ExpandResult>;
/**
 * Remove <!doctype html>, <html>, <head>, <body> wrappers from a rendered
 * fragment so it embeds cleanly into a <template> stash. Content inside
 * the wrappers (links, scripts, style, actual body markup) is preserved.
 *
 * Intentionally conservative: only strips wrappers when the fragment
 * actually starts like a full document. Leaves ordinary fragments
 * untouched.
 */
export declare function stripDocumentWrappers(html: string): string;
/**
 * Execute an installed hotstaq_modules/<name>/index.js to produce a
 * SandboxModule. The legacy index.js expects `HotStaqWeb.HotModule` to
 * be globally available — we provide a minimal class that captures the
 * name/css/js/html/components assignments and returns itself.
 */
export declare function evalInstalledModuleIndex(indexPath: string, moduleName: string): Promise<SandboxModule>;
/**
 * Determine whether an AST node is a literal JSON-compatible expression.
 * Strings, numbers, booleans, null, arrays of literals, object literals
 * whose values are literals, NoSubstitutionTemplateLiterals.
 */
export declare function isLiteralAst(node: Node): boolean;
/**
 * Materialise a literal-AST node as a plain JS value. Undefined
 * behaviour if `isLiteralAst(node)` is false — callers must gate.
 */
export declare function materialiseLiteral(node: Node): any;
//# sourceMappingURL=build-expand.d.ts.map