import type { ModuleFilePath, Schema, SelectorSource, SerializedSchema } from "@valbuild/core"; import type { JSONValue } from "@valbuild/core/patch"; /** * Update from the site, for a proposal with code (valbuild/home * `docs/hosted-publishing.md` step 8.2, slice 1b): what content hands over, * what the builder tab makes of it, and what Val's server reads -- one * definition of each for the three. */ /** Content a schema does not allow, by path in the module. */ export type SchemaError = { path: string[]; message: string; }; /** Content's `merge-trees` answer. */ export type MergeTrees = { base: string | null; siteHead: string | null; proposalHead: string | null; upToDate: boolean; builds: { base: string; site: string; }; trees: { site: Record; base: Record; proposal: Record; }; modules: Record; sources: Record; }; /** Which tree: where the proposal started, the site, or the proposal. */ export type Side = "base" | "site" | "proposal"; /** A module, as evaluating its tree in the tab gave it. */ export type EvaluatedModule = { schema: SerializedSchema; /** The content its file's text holds. */ written: JSONValue; /** The errors of the module's Source under this schema. */ errors: SchemaError[]; }; export type Evaluated = Record; /** A side's files: the site's tree, the base's changes over it, the proposal's over that. */ export declare function sideFiles(trees: MergeTrees, side: Side): Record; /** A side's Source of a module, from content's index; `null` when it has none. */ export declare function sideSource(trees: MergeTrees, side: Side, moduleFilePath: ModuleFilePath): JSONValue | null; /** * What a schema reports about this content, without the errors the server * fixes on its own (those with `fixes`): run on the schema instance that * evaluating the module made, so custom rules take part. */ export declare function schemaErrorsOf(schema: Schema, moduleFilePath: ModuleFilePath, source: JSONValue | undefined): SchemaError[];