Repository navigation
codama@2.0.0-rc.0
Pre-releaseMajor 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. -
#1248
7f8bedaThanks @lorisleiva! - Support Codama v2 IDLs and keep exporting thecamelCase,capitalize,kebabCase,pascalCase,snakeCaseandtitleCasehelpers, now re-exported from@codama/fragmentssince@codama/nodesno longer provides them.BREAKING CHANGES
1.x IDLs are rejected.
createFromRootandcreateFromJsonnow expect IDLs on the 2.x major and throw aCODAMA_ERROR__VERSION_MISMATCHerror for 1.x IDLs. Upgrade them first, either once with the newcodama upgradecommand or on the fly with@codama/upgrade.+ import { upgradeFromJson } from '@codama/upgrade'; - const codama = createFromJson(v1Json); + const codama = createFromRoot(upgradeFromJson(v1Json));
Casing helpers return plain strings. The casing helpers return
stringrather than branded types such asCamelCaseString, and split words following the Codama v2 casing rules, e.g.titleCase('HTTPServer')now returnsHttp Server. -
#1264
909960fThanks @lorisleiva! - Trim public exports that were only meant for internal use, so the public API only exposes what consumers need.BREAKING CHANGES
@codama/errorsno longer exportssafeCaptureStackTrace. It was unused, even byCodamaError, and is also gone fromcodama, which re-exports it. CallError.captureStackTracedirectly if you need it.@codama/fragments/javascriptno longer exportspreferIncoming. UsemergeImportMapsoraddToImportMap, which apply the same conflict-resolution rule.@codama/dynamic-address-resolutionno longer exportsOPTIONAL_NODE_KINDS. Check the type node kind directly, e.g.isNode(type, ['optionTypeNode', 'remainderOptionTypeNode', 'zeroableOptionTypeNode']).@codama/nodes-from-anchoronly exports its root and program converters. The per-node converters, their options types and the generics helpers are now internal. Convert whole IDLs withrootNodeFromAnchor(orrootNodeFromAnchorV00,rootNodeFromAnchorV01,programNodeFromAnchorV00andprogramNodeFromAnchorV01) and pick the nodes you need from the result. The removed exports are:accountNodeFromAnchorV00,arrayTypeNodeFromAnchorV00,constantNodeFromAnchorV00,definedTypeNodeFromAnchorV00,enumTypeNodeFromAnchorV00,enumVariantTypeNodeFromAnchorV00,errorNodeFromAnchorV00,eventNodeFromAnchorV00,instructionAccountNodeFromAnchorV00,instructionAccountNodesFromAnchorV00,instructionNodeFromAnchorV00,mapTypeNodeFromAnchorV00,optionTypeNodeFromAnchorV00,pdaNodeFromAnchorV00,pdaSeedTypeNodeFromAnchorV00,setTypeNodeFromAnchorV00,structFieldTypeNodeFromAnchorV00,structTypeNodeFromAnchorV00,tupleTypeNodeFromAnchorV00,typeNodeFromAnchorV00andInstructionAccountNodeFromAnchorV00Options.accountNodeFromAnchorV01,arrayTypeNodeFromAnchorV01,constantNodeFromAnchorV01,definedTypeNodeFromAnchorV01,enumTypeNodeFromAnchorV01,enumVariantTypeNodeFromAnchorV01,errorNodeFromAnchorV01,eventNodeFromAnchorV01,instructionAccountNodeFromAnchorV01,instructionAccountNodesFromAnchorV01,instructionNodeFromAnchorV01,optionTypeNodeFromAnchorV01,pdaSeedNodeFromAnchorV01,structFieldTypeNodeFromAnchorV01,structTypeNodeFromAnchorV01,tupleTypeNodeFromAnchorV01,typeNodeFromAnchorV01,unwrapGenericTypeFromAnchorV01,extractGenerics,GenericsV01,InstructionAccountNodeFromAnchorV01OptionsandPdaSeedNodeFromAnchorV01Options.extractPdasFromProgram: useextractPdasVisitorinstead.
- import { accountNodeFromAnchorV01 } from '@codama/nodes-from-anchor'; - const account = accountNodeFromAnchorV01(idl.accounts[0], idl.types, generics); + import { rootNodeFromAnchor } from '@codama/nodes-from-anchor'; + const account = rootNodeFromAnchor(idl).program.accounts?.[0];
@codama/visitors-coreno longer exportsLINKABLE_NODES,getDependenciesandassertNodePathHasProgram. These are also gone from@codama/visitorsandcodama, which re-export it. UsefindProgramNodeFromPathto check that a path has a program, andgetResolvedInstructionInputsVisitorto resolve instruction input dependencies. -
#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.
Patch Changes
- Updated dependencies [
cedeb1e,1f0fb88,3f76a7f,e1cce0d,64d52eb,e92df74,7f8beda,7f8beda,cedeb1e,7f8beda,7f8beda,909960f,3f76a7f,eb01f83,23a8cbd,bb09077,bb09077,3ad402a,7f8beda,7f8beda,7f8beda,b869cef,23a8cbd,7f8beda,7f8beda,08d72e7,7f8beda,7f8beda]:- @codama/visitors@2.0.0-rc.0
- @codama/errors@2.0.0-rc.0
- @codama/fragments@2.0.0-rc.0
- @codama/nodes@2.0.0-rc.0
- @codama/cli@2.0.0-rc.0
- @codama/validators@2.0.0-rc.0