Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/public-falcons-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@codama/fragments': minor
---

Introduce `@codama/fragments`, a public package that bundles Codama's composable code-generation primitives. The root entrypoint exposes the language-agnostic core (`BaseFragment`, `createFragmentTemplate`, `mapFragmentContent`, `setFragmentContent`) plus a small framework of shared helpers: casing utilities (`camelCase`, `pascalCase`, `snakeCase`, `kebabCase`, `titleCase`, `capitalize`), filesystem and path helpers (`writeFile`, `readFile`, `joinPath`, `pathDirectory`, `relativePath`, …), and the `RenderMap` data structure with its pure data operations (`createRenderMap`, `addToRenderMap`, `mergeRenderMaps`, `mapRenderMapContent`, `writeRenderMap`, …). The casing helpers return plain `string`; the branded `CamelCaseString` / `PascalCaseString` / … types stay in `@codama/node-types` for spec-validation purposes.

JavaScript- and Rust-flavored `Fragment`, `ImportMap`, and `fragment` tagged-template helpers live under the `@codama/fragments/javascript` and `@codama/fragments/rust` subpaths. Both subpaths also expose `getDocblockFragment`, which now accepts `undefined` (in addition to `readonly string[]`) so generators can thread a node's optional `docs` attribute straight through without a ternary guard; the helper still returns `undefined` for empty or absent input, composing naturally with the `fragment` tagged template's optional-interpolation behaviour.

The package ships at `0.1.0` to signal pre-stability while the renderer stack settles around it.
5 changes: 5 additions & 0 deletions .changeset/whole-bobcats-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@codama/renderers-core': patch
---

Re-export the language-agnostic fragment primitives, path helpers, filesystem helpers, and `RenderMap` data operations from `@codama/fragments`. The implementations have moved to that package so they can be shared with code generators and other consumers outside the renderers stack; existing importers of `@codama/renderers-core` continue to see every public name at the same import path with no behaviour change. `writeRenderMapVisitor` stays in `renderers-core` since it depends on the visitor + node infrastructure that `@codama/fragments` deliberately does not pull in.
1 change: 1 addition & 0 deletions packages/fragments/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
5 changes: 5 additions & 0 deletions packages/fragments/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/
test/e2e/
test-ledger/
target/
CHANGELOG.md
Loading
Loading