import { Files, type FileText } from "scripted-yaml/core"; import type { Override } from "./override.js"; import type { PipelineDefinition } from "./pipeline-definition.js"; import type { PipelineSpec } from "./spec.js"; /** The DSL every pipeline is checked against, wherever the file is: `$dsl: ./pipeline.dsl.yml`. */ export declare const DSL_FILE = "pipeline.dsl.yml"; export interface PipelineSourceOptions { /** The default for `name:`. The CLI passes the file's base name. */ name?: string; /** What the text is called: problems name it, and its `$extends` paths start from it. */ file?: string; /** Reads what `$extends` names, by name or path. Undefined: `files` is asked. The DSL is always found. */ read?: Reader; /** Where a name `read` leaves goes next, such as the disk (`DiskFiles`). None: there is no such file. */ files?: Files; } /** The text a name stands for, or undefined when someone else should look. */ export type Reader = (path: string, from: string | undefined) => FileText | undefined; type Raw = Record; /** Where a value sits in the pipeline: `["stages", 2, "when"]`. */ export type Path = Array; /** * A pipeline's text, loaded with scripted-yaml and checked into a * `PipelineDefinition`: the parser under the CLI's `PipelineFile` and the * package's `Pipelines`. It reads no file, unless `read` leaves a path to the * disk, so a Worker runs the same checks as the CLI. Every mistake is a * `PipelineError`, with the line and key it is about when the text has them. */ export declare class PipelineSource { private readonly source; private readonly options; private readonly lines; private yamlDocument?; private definitions; constructor(source: string, options?: PipelineSourceOptions); get file(): string; definition(overrides?: Override[]): PipelineDefinition; spec(overrides?: Override[]): PipelineSpec; /** The YAML with `$extends` and overrides applied: one file that runs on its own. */ text(overrides?: Override[]): string; private build; /** A warning stops a pipeline too: a field the DSL does not know is a typo. `lines` false: the text is not this file's own. */ private load; private apply; private files; private scripted; /** The DSL wherever a file names it; anything else as the options read it, checked for the old format first. */ private read; /** The file with `$extends` applied, keys as written. A formula cannot hold a marked `base`: that is the file's mistake. */ private merged; /** scripted-yaml's problems as pipeline errors. Only this text's own problems have a line here. */ private problems; private static say; private raw; private yaml; private fail; /** The line of the deepest part of `at` this text has. A stage is found by its id, so the line holds when `$extends` moved it. */ private lineOf; /** `when!` and `run!sh` are the keys `when` and `run`. */ private static named; /** `stages.tests.timeout`, as scripted-yaml names a place: a stage by its id, else by its number. */ static keyOf(at: Path): string; private static extends; private static namesDsl; /** `$dsl` first, or right after the `---` that starts the document. */ private static withDsl; static isRecord(value: unknown): value is Raw; } export {};