rune-langium / codegen/src / generate
Function: generate()
ts
function generate(documents, options?): GeneratorOutput[];Defined in: packages/codegen/src/index.ts:45
Generate code from one or more parsed Langium documents.
This is the primary entry point for the code generator. It accepts a single document or an array of documents and normalizes them before passing to the internal generator pipeline.
Parameters
| Parameter | Type | Description |
|---|---|---|
documents | LangiumDocument<AstNode> | LangiumDocument<AstNode>[] | One or more parsed Langium documents with resolved ASTs. |
options? | GeneratorOptions | Optional generator options (target, strict, headerComment). |
Returns
Array of GeneratorOutput sorted by relativePath ascending.
Throws
GeneratorError when strict mode is enabled and any error diagnostic is produced.
Example
ts
import { generate } from '@rune-langium/codegen';
const outputs = generate(doc, { target: 'zod' });