Skip to content

preprocess

preprocess(options): Promise<PreprocessedSpec>

Defined in: packages/speculator/src/preprocess/pipeline.ts:77

Preprocess a specification document

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

PreprocessOptions

Preprocess options

Promise<PreprocessedSpec>

PreprocessedSpec with config and source

PreprocessError on failure

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