/** * Line-preserving projection of a .sdoc file into a virtual Svelte document. * * Every authored line keeps its exact (line, column) in the virtual text, so * editor position mapping is the identity function. Block syntax the Svelte * compiler must not see becomes blank lines; sub-block openers are rewritten * IN PLACE to `{#snippet …(args)}` wrappers — byte-compatible with the shape * the build pipeline generates at runtime — and a trailer appended past the * authored end renders every snippet and references previewed components, so * nothing draws unused-import noise. Diagnostics on trailer lines * (line >= sourceLineCount) are generated, never authored. */ import type { SdocFile } from './scanner.js'; export type ProjectedLineKind = 'verbatim' | 'blank' | 'wrapper' | 'masked' | 'recomposed'; /** The column range of authored content a 'recomposed' line preserves at its * exact authored columns — positions inside it map 1:1 between the authored * and virtual documents; everything outside it is generated tag text. */ export interface RecomposedSpan { start: number; end: number; } export interface SdocProjection { /** The virtual Svelte document text */ text: string; /** Authored line count; virtual lines at or past this are generated */ sourceLineCount: number; /** Per authored line: how it was projected */ lineKinds: ProjectedLineKind[]; /** Per authored line, set exactly where lineKinds is 'recomposed': the * authored-content span of that line. Sparse; absent for projections that * never recompose (the base projection). */ contentSpans?: (RecomposedSpan | undefined)[]; } export declare function projectSdoc(file: SdocFile): SdocProjection; /** A per-block (or per-entity) projection for content that declares its own *