import * as BundledReact from "react"; import type { RuntimeAdapter } from "../../../platform/adapters/base.js"; import type { VeryfrontConfig } from "../../../config/index.js"; import type { LayoutItem, MdxBundle, MDXComponents } from "../../../types/index.js"; import type { ImportMapConfig } from "../../../modules/import-map/types.js"; import { loadComponentFromSource } from "../../../modules/react-loader/component-loader.js"; import type { RenderModes } from "../../context/render-context.js"; import { type DependencyPinningSourceInput } from "../../../transforms/esm/package-registry.js"; type AppRouterDocumentLayoutFunction = (props: { children?: BundledReact.ReactNode; }) => BundledReact.ReactNode; export interface LayoutComponentCache { get(key: string): BundledReact.ComponentType | undefined; set(key: string, value: BundledReact.ComponentType): void; delete(key: string): void; clear(): void; clearForProject?(projectId: string): void; } interface LoadTSXComponentDeps { loadComponentFromSource: typeof loadComponentFromSource; } export declare function createLayoutComponentCache(maxEntries?: number, perProjectMaxEntries?: number): LayoutComponentCache; export declare function shouldUnwrapAppRouterDocumentLayout(componentPath: string | undefined, projectDir: string, appDirectory?: string): boolean; export declare function unwrapAppRouterDocumentLayout(React: typeof BundledReact, LayoutComponent: AppRouterDocumentLayoutFunction): BundledReact.FunctionComponent<{ children?: BundledReact.ReactNode; }>; export declare function loadTSXComponent(componentPath: string, projectDir: string, cache: LayoutComponentCache, adapter: RuntimeAdapter, projectId: string, projectSlug: string, contentSourceId: string, modes: RenderModes, reactVersion?: string, deps?: LoadTSXComponentDeps, dependencyPinningCacheKey?: string, dependencyPinningDependencies?: Readonly>, dependencyPinningSource?: DependencyPinningSourceInput, moduleServerOrigin?: string, serverExternalPackages?: readonly string[], signal?: AbortSignal): Promise; /** * Inputs shared by every MDX layout module load. * * These are named rather than positional because the chain is long enough that * a value in the wrong slot still type-checks. `modes` in particular carries * two vocabularies that are both mode-shaped and disagree on a hosted preview * render, so it travels as the pair and is unpacked at the one seam that * consumes it. */ export interface MDXLayoutModuleOptions { bundle: MdxBundle; projectDir: string; adapter: RuntimeAdapter; projectId: string; projectSlug: string; contentSourceId: string; /** * Compile and request vocabularies for this render. `compileMode` selects the * compile mode of the layout's own `/_vf_modules/*` imports. `environment` * has no consumer below this seam today and is carried so that no caller has * to choose between the two, which is the choice that type-checks when made * wrongly. */ modes: RenderModes; reactVersion?: string; dependencyPinningCacheKey?: string; dependencyPinningDependencies?: Readonly>; dependencyPinningSource?: DependencyPinningSourceInput; moduleServerOrigin?: string; config?: VeryfrontConfig; isLocalProject?: boolean; /** * Request cancellation. The import-map preloader and ESM module loader do * not take a signal themselves, so each stage is guarded and the module wait * is raced against cancellation. */ signal?: AbortSignal; } /** Inputs for {@link loadMDXLayout}. */ export interface LoadMDXLayoutOptions extends MDXLayoutModuleOptions { preloadedImportMap?: ImportMapConfig; } /** Load an MDX layout module from a bundle. */ export declare function loadMDXLayout(options: LoadMDXLayoutOptions): Promise | undefined>; /** * Preload an MDX layout module into cache for faster subsequent loads. * * The preload resolves the import map itself, so it takes no * `preloadedImportMap`. */ export declare function preloadMDXLayoutModule(options: MDXLayoutModuleOptions): Promise; export declare function applyTSXLayout(element: BundledReact.ReactElement, item: LayoutItem, tsxLayoutModuleCache: LayoutComponentCache, projectDir: string, adapter: RuntimeAdapter, props: Record | undefined, projectId: string, projectSlug: string, contentSourceId: string, modes: RenderModes, reactVersion?: string, dependencyPinningCacheKey?: string, dependencyPinningDependencies?: Readonly>, dependencyPinningSource?: DependencyPinningSourceInput, moduleServerOrigin?: string, serverExternalPackages?: readonly string[], signal?: AbortSignal): Promise; /** Inputs for {@link applyMDXLayout}. */ export interface ApplyMDXLayoutOptions extends LoadMDXLayoutOptions { element: BundledReact.ReactElement; mergedComponents: MDXComponents; } export declare function applyMDXLayout(options: ApplyMDXLayoutOptions): Promise; export {}; //# sourceMappingURL=component-loader.d.ts.map