[ast] 1b: Extract rendered-text builders into utils/codegen.ts
enhancement@kubb/core
Part of #3572 (Epic 1: separate concerns in the `@kubb/ast` utils layer).
## Goal
Move the helpers that assemble rendered source text out of `utils/index.ts` into `src/utils/codegen.ts`.
## Functions to move (from `src/utils/index.ts`)
- `buildJSDoc`
- `buildObject`
- `buildList`
- `objectKey`
- `indentLines` (currently private; keep it **internal** to the new module, do not export it)
Note: `buildObject`/`buildList` use `indentLines` and `INDENT` from `../constants.ts`; keep those imports.
## Files
- New: `packages/ast/src/utils/codegen.ts` (+ `codegen.test.ts`).
- Edit: `packages/ast/src/utils/index.ts` — re-export `buildJSDoc`, `buildObject`, `buildList`, `objectKey`.
## Acceptance
- `@kubb/ast/utils` still exports `buildJSDoc`, `buildObject`, `buildList`, `objectKey`; `indentLines` stays internal.
- `@kubb/ast` green; plugin snapshots byte-identical.
## Dependencies
None. Parallel-safe with other Epic 1 sub-issues.
关闭于 2026-06-14 0 条评论