/** * Materialization-neutral semantic graph contracts and validation. Providers * normalize authoring inputs here before build planning chooses concrete * entries, Documents, and runtime delivery. */ import { type StaticJsonValue } from "../../serialization/static-json.js"; import type { ClientReferenceNode, ComponentModel, HydrationMode, PprConfig, PrerenderConfig, RenderMode, ServerFunctionNode, ServerReferenceNode, ServerRouteNode } from "../contracts.js"; import { type PageMetadata } from "../page/metadata.js"; /** Built-in source provider for materialization-neutral positive `page.*` anchors. */ export declare const PAGE_ANCHOR_PROVIDER_ID = "@evjs/provider/page-anchor"; /** Built-in source provider for explicit SPA route-tree input. */ export declare const CONFIG_ROUTE_PROVIDER_ID = "@evjs/provider/config-route"; export type ApplicationId = string; export type PageId = string; export type RouteId = string; export type DocumentId = string; /** * Canonical semantic source of truth for Applications, Pages, client Routes, * Documents, plugin settings, and server analysis facts. Record keys match node * ids and each Application stores complete inverse indexes for its owned nodes. */ export interface CoreGraph { rootDir: string; applications: Record; pages: Record; routes: CoreRouteNode[]; documents: Record; plugins: CorePluginCatalogSnapshot; serverFunctions: ServerFunctionNode[]; serverRoutes: ServerRouteNode[]; clientReferences?: ClientReferenceNode[]; serverReferences?: ServerReferenceNode[]; } export interface CoreApplicationNode { id: ApplicationId; root: string; routingMode: "spa" | "mpa"; /** Application-level React layout shared by its Page routes. */ layout?: string; pageIds: PageId[]; routeIds: RouteId[]; documentIds: DocumentId[]; plugins: CoreApplicationPluginSettings; provenance: CoreNodeProvenance; } export interface CorePageNode { id: PageId; applicationId: ApplicationId; source: CorePageSource; render: RenderMode; componentModel?: ComponentModel; /** Author-selected hydration policy. CSR Pages must omit this field. */ hydrate?: HydrationMode; prerender?: PrerenderConfig; ppr?: PprConfig; metadata?: PageMetadata; plugins: CorePagePluginSettings; provenance: CoreNodeProvenance; } export interface CorePageSource { module: string; /** Build-only canonical Page config module, when one was authored. */ config?: string; scope: CorePageScope; provider: string; } export type CorePageScope = { kind: "module"; file: string; } | { kind: "directory"; root: string; }; export type CoreRouteNode = CoreClientRouteNode; export interface CoreClientRouteNode { id: RouteId; applicationId: ApplicationId; parentId?: RouteId; pattern: CoreRoutePattern; target: CoreClientRouteTarget; facets: CoreRouteFacets; provenance: CoreNodeProvenance; } export interface CoreRoutePattern { /** * Absolute semantic route pattern. Root is an empty list, splats are * terminal, and terminal patterns are unique per Application by shape rather * than parameter name. */ segments: CoreRouteSegment[]; } export type CoreRouteSegment = { kind: "static"; value: string; } | { kind: "param"; name: string; } | { kind: "splat"; name: string; }; export type CoreClientRouteTarget = { kind: "page"; pageId: PageId; } | { kind: "redirect"; to: CoreRouteLocation; } | { kind: "group"; }; export type CoreRouteLocation = { kind: "route"; pattern: CoreRoutePattern; } | { kind: "url"; href: string; }; export interface CoreRouteFacets { layout?: string | false; error?: string; notFound?: string; wrappers: string[]; } /** * A materialized HTML Document. Ownership determines which output projection * receives it; bootstrap independently selects the client entry it starts. * Outputs and aliases are globally unique across Documents. */ export interface CoreDocumentNode { id: DocumentId; template: string; output: string; /** * Additional static output paths that contain the same transformed Document. * * Aliases do not create Routes or additional semantic Documents. */ aliases?: string[]; applicationId: ApplicationId; owner: CoreDocumentOwner; mount?: string; bootstrap?: CoreDocumentBootstrap; provenance: CoreNodeProvenance; } export type CoreDocumentOwner = { kind: "application"; } | { kind: "page"; pageId: PageId; } | { kind: "plugin"; pluginId: string; }; export type CoreDocumentBootstrap = { kind: "application"; } | { kind: "page"; pageId: PageId; }; /** * Installed plugin contract metadata captured with the graph. Each entry is * keyed by the plugin's canonical id; per-owner settings use the same id. */ export interface CorePluginCatalogSnapshot { entries: Record; } export interface CorePluginCatalogEntrySnapshot { application?: CorePluginApplicationContractSnapshot; page?: CorePluginPageContractSnapshot; } export interface CorePluginApplicationContractSnapshot { schemaVersion?: string; } export interface CorePluginPageContractSnapshot { schemaVersion?: string; defaultable: boolean; } export type CoreApplicationPluginSettings = Record; export interface CoreApplicationPluginSetting { enabled: boolean; } export type CorePagePluginSettings = Record; export type CorePagePluginSetting = { enabled: false; options?: never; } | { enabled: true; options: Record; }; export interface CoreNodeProvenance { producer: CoreProvenanceProducer; source?: string; } export interface CoreProvenanceProducer { kind: "core" | "provider" | "plugin"; id: string; } /** * Resolve the Page whose declared source scope owns a project-local module. * * Exact module scopes win over directory scopes. Directory ownership uses the * deepest matching root so a nested Page can carve its directory out of a * parent Page scope. Application layouts and Route facet modules are * deliberately outside Page source ownership even when they are colocated * below a Page directory. */ export declare function resolveCorePageOwner(graph: CoreGraph, sourcePath: string): CorePageNode | undefined; /** * Validate the complete normalized CoreGraph contract: strict data shape, * project paths, ids and inverse indexes, Page scope ownership, Route hierarchy * and terminal-shape uniqueness, Document output ownership, plugin * registration, provenance, and server analysis facts. */ export declare function assertCoreGraph(value: unknown, source?: string): asserts value is CoreGraph; /** Validate the canonical short id shared by plugin options, graph, and IR. */ export declare function assertPluginId(value: unknown, source?: string): asserts value is string; //# sourceMappingURL=core.d.ts.map