Minor Changes
-
#292
27d7495Thanks @lorisleiva! - Add afileNamename transformer controlling the names of generated files and their re-exports from the barrel files. It defaults to the camelCase name used so far, so nothing changes unless it is overridden, e.g.nameTransformers: { fileName: (name, { kebabCase }) => kebabCase(name) }writesmy-account.tsinstead ofmyAccount.ts. Documentation blocks also now split their items on line breaks, so multi-line documentation strings render as several lines rather than a single line containing a line break. -
#244
9893423Thanks @plutohan! - Honor custom variant discriminators when rendering enums. Scalar enums with a customdiscriminatoron any variant are declared with explicit member values and encoded withuseValuesAsDiscriminators, and discriminated unions map their prefix to the custom values, so the generated codecs match the on-chain layout instead of numbering variants from zero.
Patch Changes
-
#288
51d57dfThanks @lorisleiva! - Derive every name in generated code from the camelCase form of the node names, so that IDLs whose names are not camelCase — e.g. hand-written JSON IDLs using snake_case — render the same code as their camelCase equivalent. Previously, a few names leaked their raw spelling into generated code (struct value defaults, PDA seed values and theprogramNameof identification errors), name conflicts between instruction accounts and arguments were only detected on exact spelling, and errors and constants were sorted by raw name. The keys of thelinkOverridesoption are now matched regardless of their casing too — e.g.counter_account,counterAccountandCounterAccountall refer to the same node — as thecustomAccountData,customInstructionData,internalNodes,nonScalarEnumsandasyncResolversoptions already did. -
#293
0092eb9Thanks @lorisleiva! - ThrowCodamaErrors instead of plain errors when an IDL cannot be rendered, so that callers can identify them by code:CODAMA_ERROR__DISCRIMINATOR_FIELD_NOT_FOUNDandCODAMA_ERROR__DISCRIMINATOR_FIELD_HAS_NO_DEFAULT_VALUEfor field discriminators that do not match a field with a default value (previously a single plain error), andCODAMA_ERROR__RENDERERS__UNSUPPORTED_NODEfor instruction input default values the renderer does not support yet, i.e.accountFieldValueNodeandinjectedValueNode. The messages of these errors change accordingly.