Features
- ✨ Add
templatesoption to generate localization keys for the enumnameand item fields via user-defined templates, with improved type inference for localize template definitions. Templates can be strings using the{name},{key},{value}, and{raw}tokens, or functions that receive a context{ type: 'name' | 'item', options, item?, metaField? }and return a localization key. Template results take precedence over declared strings1 : thenametemplate overridesoptions.name, and anitemstemplate overrides the item's raw meta field value.templates.name— defines the localization template for the enum name.templates.items— defines the localization templates for enum item fields, such aslabeland custom meta fields.
- ✨ Fields declared in instance-level
templates.itemsare automatically added to the enum items, so the generated meta fields are typed and accessible even when raw enum items do not declare them.
1. Templates take precedence over raw declared strings, but not functions. Raw declared functions return the final localization result directly, so they have the highest priority and are not overridden by templates. So the order of precedence is: raw functions > instance templates > global templates > raw strings.
Deprecations
- 🚫
autoLabel,labelPrefix, andautoLocalizeMetaare deprecated and will be removed in the next major version. Usetemplatesinstead.
Tests & Quality
- ✅ Migrate core unit tests to Vitest with node + browser projects and raise code coverage to 100% across statements, branches, functions, and lines.
- ✅ Add tests for localize templates.
- ✅ Refine reviewed enum test cases.
Chores / CI
- 🔧 Add CodeRabbit configuration.
- 🔧 Make codegraph prepare cross-platform.
- 🔧 Update Node.js version matrix to include 26.x.