Skip to content

preprocess

preprocess(options): Promise<PreprocessResult>

Defined in: preprocess/pipeline.ts:63

Preprocess a specification document

Loads configuration (if provided) and resolves all includes to produce a PreprocessedSpec ready for parsing.

PreprocessOptions

Preprocess options

Promise<PreprocessResult>

PreprocessResult with spec and diagnostics

const result = await preprocess({
entry: '/specs/my-spec/format.md',
configPath: '/specs/my-spec/config.respec.json',
fileProvider: new NodeFileProvider(),
});
if (result.hasErrors) {
console.error('Preprocess errors:', result.diagnostics);
} else {
// result.result contains PreprocessedSpec
for (const unit of result.result.source.units) {
console.log(`Processing: ${unit.file}`);
}
}