Major Changes
-
#1262
e1cce0dThanks @lorisleiva! - Remove the deprecated node kind aliases, theProgramVersiontype and the duplicate node path formatters. Each has a canonical replacement that was already exported.BREAKING CHANGES
Node kind aliases removed. The legacy
*_NODESaliases of@codama/nodesare removed in favour of the*_NODE_KINDSconstants generated from the spec.- import { CONTEXTUAL_VALUE_NODES, COUNT_NODES, DISCRIMINATOR_NODES, INSTRUCTION_INPUT_VALUE_NODES } from '@codama/nodes'; - import { LINK_NODES, PDA_SEED_NODES, TYPE_NODES, VALUE_NODES } from '@codama/nodes'; + import { CONTEXTUAL_VALUE_NODE_KINDS, COUNT_NODE_KINDS, DISCRIMINATOR_NODE_KINDS, INSTRUCTION_INPUT_VALUE_NODE_KINDS } from '@codama/nodes'; + import { LINK_NODE_KINDS, PDA_SEED_NODE_KINDS, TYPE_NODE_KINDS, VALUE_NODE_KINDS } from '@codama/nodes';
ProgramVersionremoved. Use theVersiontype instead.- import type { ProgramVersion } from '@codama/node-types'; + import type { Version } from '@codama/node-types';
Node path formatters removed.
nodePathToStringandnodePathToStringArrayare removed from@codama/visitors-core. UsegetNodePathStringfrom@codama/errors, which renders paths the way error messages do, orNodeStack#toStringfor the current path of a stack.- import { nodePathToString, nodePathToStringArray } from '@codama/visitors-core'; + import { getNodePathString } from '@codama/errors'; - nodePathToString(path); + getNodePathString(path); - nodePathToStringArray(path); + path.map(node => getNodePathString([node]));
-
#1157
64d52ebThanks @codama-releases! - Release Codama v2, supporting IDLs of the v2 standard. Upgrade v1 IDLs with thecodama upgradecommand or the@codama/upgradepackage. -
#1260
3ad402aThanks @lorisleiva! - Require Node.js 22.12.0 or later.BREAKING CHANGES
Node.js 20 is no longer supported. Every package now declares
"engines": { "node": ">=22.12.0" }, the first Node.js 22 release that supportsrequire(esm)by default. Node.js 20 reached its end of life in April 2026, and some dependencies (e.g.commander) already require Node.js 22.12.0. -
#1248
7f8bedaThanks @lorisleiva! - Remove the casing helpers and casing brands in favour of@codama/fragments/casing, drop the helpers of removed v1 nodes, and add helpers for interpolated intents, text nodes, transforms and the spec's branded strings.New in
@codama/nodes:parseInterpolatedIntent(template)splits an intent into literal text and the contextual value nodes its placeholders stand for (${data.config.fees[0]}→dataValueNode,${accounts.mint}→accountValueNode,${accounts.mint.data.decimals}→accountDataValueNode), throwingCODAMA_ERROR__INVALID_INTERPOLATED_INTENT_PLACEHOLDERon malformed placeholders.printInterpolatedIntent(parts)is its inverse, andInterpolatedIntentPartthe type of the parts.getTextNodeContent(value)reads the plain text of anystring | TextNodeattribute, e.g.docs, labels orinstructionStatusNode.message.addTypeNodeTransforms(typeNode, transforms)appends transforms after those a type node already carries, e.g. to carry the transforms of a replaced type node across.identifierString,namespaceString,pathString,integerStringanddecimalStringvalidate a string against the spec's grammar and return it branded asIdentifierString,NamespaceString,PathString,IntegerStringorDecimalString(new in@codama/node-types), throwingCODAMA_ERROR__INVALID_BRANDED_STRINGotherwise.
BREAKING CHANGES
Casing helpers moved to
@codama/fragments/casing.capitalize,titleCase,pascalCase,camelCase,kebabCaseandsnakeCaseare removed from@codama/nodes. Their replacements return a plainstringand split words as the spec does (see the@codama/fragmentschangelog).- import { camelCase } from '@codama/nodes'; + import { camelCase } from '@codama/fragments/casing';
Casing brands removed.
CamelCaseString,PascalCaseString,KebabCaseString,SnakeCaseStringandTitleCaseStringare removed from@codama/node-types(and their re-exports from@codama/nodes), since identifiers no longer mandate a casing. UseIdentifierStringfor node identifiers, or a plainstringfor derived names.Helpers of removed nodes dropped. The following
@codama/nodeshelpers are removed along with the nodes they served:resolveNestedTypeNode,transformNestedTypeNode,isNestedTypeNodeandassertIsNestedTypeNode, since wrapper type nodes are replaced bytransforms. Read or appendtypeNode.transformsinstead, e.g. withaddTypeNodeTransforms.isSignedInteger,isUnsignedInteger,isIntegerandisDecimal, sincenumberTypeNodeis split intointegerTypeNodeandfloatTypeNode. Check the node kind orformatinstead.getAllInstructionArguments,structTypeNodeFromInstructionArgumentNodesandstructFieldTypeNodeFromInstructionArgumentNode, since instruction arguments now live ininstructionNode.data.- The
ENUM_VARIANT_TYPE_NODESalias, since the three enum variant nodes are now a singleenumVariantTypeNode.
Docs,DocsInputandparseDocsremoved.docsattributes are now a singlestring | TextNoderather than an array of paragraphs, so theDocstype of@codama/node-typesand theDocsInputtype andparseDocshelper of@codama/nodesare removed. Constructors storedocsas given; join paragraphs into one Markdown string instead.- definedTypeNode({ name: 'counter', type, docs: ['A counter.', 'Second paragraph.'] }); + definedTypeNode({ identifier: 'counter', type, docs: 'A counter.\n\nSecond paragraph.' });
-
#1158
08d72e7Thanks @lorisleiva! - Regenerate the node types, constructors and core visitors from the Codama v2 spec (@codama/spec@2).The node model changes substantially from v1:
name→identifier. Every named node (programNode,accountNode,instructionNode, links, …) now carriesidentifierinstead ofname, and identifiers preserve their casing — v2 no longer mandates camelCase (transfer_tokensandtransferTokensare both valid; uniqueness is resolved by case-folding).- Numeric system rework.
numberTypeNode/numberValueNodesplit intointegerTypeNode/floatTypeNodeandintegerValueNode/floatValueNode(numeric values are string-encoded to stay lossless through JSON).amountTypeNode/solAmountTypeNodebecomefixedPointTypeNode; newdurationTypeNode;dateTimeTypeNode/durationTypeNodecarryticksPerSecond. - Flat transforms. The wrapper type nodes (
fixedSizeTypeNode,sizePrefixTypeNode,pre/postOffsetTypeNode,sentinelTypeNode,hiddenPrefix/SuffixTypeNode) are removed; every type node instead carries an optionaltransforms: transformNode[]applied innermost-first. - Instruction data.
instructionArgumentNode,instructionArgumentLinkNode,resolverValueNodeandinstructionNode.arguments/extraArgumentsare removed; instruction arguments live ininstructionNode.data, reached via path expressions.argumentValueNode→dataValueNode;accountFieldValueNode→accountDataValueNode. - Enum variants unified. The three variant nodes collapse into a single
enumVariantTypeNodewith an optionaldata. - Text and docs.
docsand text-bearing attributes are the unionstring | textNode; atextNodecarries structured metadata (plugins). NewtextNode. - Universal plugins. Every node gains an optional
plugins: pluginNode[]base attribute — the extension point for renderer-specific or not-yet-standardised metadata. - Other.
programNode.originremoved (provenance moves to plugins);pluginNode.name→pluginNode.namespace;sentinelCountNodeadded; path expressions for field references and discriminators.
Node factory ergonomics: trailing optional parameters now live in the constructor's
optionsbag (e.g.constantNode(identifier, type, value, { docs }),accountLinkNode(identifier, { program })).