Release package#21
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@codama/spec@1.6.0
Minor Changes
4a46ebfThanks @lorisleiva! - Add a'docs'TypeExprkind for documentation arrays. Thedocs()semantic alias now returns{ kind: 'docs' }rather than desugaring toarray(string()), preserving the documentation intent in the encoded spec. Each codegen target maps the new kind to the language's idiomatic documentation array type (e.g.Array<string>in TypeScript,Vec<String>in Rust).Expose the authoring API at the new
@codama/spec/apisubpath. Consumers building hand-authored specs (typically test fixtures or future tooling) can now importdefineNode,attribute,optionalAttribute, primitives (u32,string,boolean, …), compounds (array,tuple),defineUnion,defineEnumeration, andvariantdirectly. The default@codama/specentrypoint continues to expose the latest version's spec data and types only.The
gen-ts-node-typesgenerator now emits arrays asArray<T>rather thanT[], so a literal-union element type (e.g.array(literalUnion(true, 'either'))) doesn't need extra parentheses to preserve precedence with|. The generator also collapsesliteralUnion(true, false, …)toboolean | …when bothtrueandfalseare present — a TypeScript-only readability normalisation; the encoded spec keeps the explicittrue | falserepresentation so other codegen targets can still emit a multi-variant enum.70febc6Thanks @lorisleiva! - Reshape the spec meta-model into per-category groups, replace the top-levelnestedTypeNodeWrapperslist with a flexibleNestedUnionSpecconstruct, and type alldocs?fields asreadonly string[].Specno longer carries flatnodes,unions,enumerations, andnestedTypeNodeWrapperslists. Instead,Spec.categories: readonly CategorySpec[]groups related entities together — eachCategorySpeccarries its ownnodes,unions,enumerations, andnestedUnions. Category names are arbitrary strings; codegen targets pick how to honour them. The v1 spec uses'type','value','link','pdaSeed','count','discriminator','contextualValue','shared', and'topLevel'.NestedUnionSpecreplaces the implicitnestedTypeNodeWrapperslist with an explicit, named recursive type alias. EachNestedUnionSpeccarries aname, abase: TypeExpr, and awrappers: readonly string[]list. The v1 spec declares one such alias (NestedTypeNode) under thetypecategory. ThenestedTypeNode(name)TypeExprconstructor is renamed tonestedUnion(alias, innerKind)to make the alias reference explicit, opening the door to further recursive families in future spec versions.All
docs?fields onAttributeSpec,NodeSpec,UnionSpec,EnumerationSpec,EnumerationVariantSpec,CategorySpec, andNestedUnionSpecnow takereadonly string[]— one paragraph per array element. This brings the meta-model into alignment with the generatedDocs = Array<string>shape and lets codegen targets render multi-paragraph documentation natively.New authoring helpers:
defineCategory(name, options)anddefineNestedUnion(name, options). Thegen-ts-node-typesgenerator is updated to walk the new structure, renders one alias file perNestedUnionSpec, and maps each spec category to its TypeScript-monorepo subdirectory via a small renderer-side table.cb59ce7Thanks @lorisleiva! - Two spec changes that adjust the encoded shape:Identifier casing. All spec identifiers are now camelCase. Enumerations, unions, and nested-union aliases that were PascalCase (
TypeNode,BytesEncoding,NestedTypeNode, …) are renamed to camelCase (typeNode,bytesEncoding,nestedTypeNode, …).validate.tsnow enforces camelCase on unions, enumerations, and nested unions alongside the existing node-kind check.New
addresstype-expression kind. A new primitive{ kind: 'address' }(plus anaddress()factory) replacesstring()on attributes that hold a Solana address. Applied toprogramNode.publicKey,publicKeyValueNode.publicKey, andpdaNode.programId. Attribute names and node kinds are unchanged; only the type expression changes. Codegen targets can now render these as a dedicated address type (e.g.Addressin Rust) rather than collapsing to a generic string.#20
55d06e2Thanks @lorisleiva! - First stable release of@codama/spec. The v1 spec shape settled across the1.6.0-rc.*line is now published as1.6.0. Reference implementations in TypeScript and Rust consume this package to render their own node types, factories, visitors, and validators from a single source of truth. Future Codama majors will land alongside thev1entrypoint asv2,v3, …, with the default@codama/specentrypoint tracking the latest stable.Patch Changes
f345ba3Thanks @lorisleiva! - Disablesplittingin the tsup build config.Multi-entry ESM builds (
index+v1) were causing tsup's automatic code splitting to lift shared modules into hashedchunk-*.mjsfiles. Those chunks were not listed inpackage.json#files, so the published tarball shipped entrypoints that re-exported from missing modules and ESM consumers failed at import time withCannot find module '...chunk-XXXXX.node.mjs'. Disabling splitting makes each entry inline its dependencies and the publisheddist/self-contained.