daxle_gen 0.3.0
daxle_gen: ^0.3.0 copied to clipboard
AST code generator and compile-time validation hook for Daxle.
0.3.1 (Preview) #
-
NEW FEATURES (PREVIEW & EXPERIMENTAL):
- State Machine Generation (
@StateMachine):- Synthesizes
_$ClassNameMachinemixin for declarative, compile-time verified state machine workflows. - Generates compile-time verified static transition table (
_$transitions) restricting valid transitions. - Synthesizes
FutureOr<void> on<State>(TransitionScope<State> scope, Event event)flow handler stubs for async flow roots. - Provides concrete default implementations for synchronous, trivial, or single-target transitions.
- Implements epoch-based cancellation (
_daxleEpoch) to invalidate stale asynchronous transition scopes when newer events arrive. - Generates pattern-matching
dispatch(Event event)with fail-fastInvalidFlowExceptionvalidation against illegal transitions. - Supports explicit generics (
@StateMachine<TState, TEvent>) and automatic type inference from declared flows orBlocsupertypes. - Supports self-loop state transitions (
Flow(from: State, to: State)).
- Synthesizes
- Sensitive Field Redaction (
@redact/Redact):- Generates sanitized
toString()representations preventing secrets, passwords, tokens, and PII from leaking into logs. - Synthesizes dedicated
toDebugMap()method with configurable masks (mask,preserveLength), while keeping standard wire-formattoMap()unmodified.
- Generates sanitized
- State Machine Generation (
-
DOCUMENTATION:
- Marked
StateMachinegeneration as preview and experimental across documentation and guides. - Documented setup instructions, CLI commands, state machine workflow patterns, and sensitive field redaction in
README.md.
- Marked
0.3.0 - 2026-09-30 #
-
BREAKING CHANGES:
- Removed legacy
SerializeEnumandDeserializeEnumannotations. Use unified@Serialize()and@Deserialize()annotations for enum declarations.
- Removed legacy
-
NEW FEATURES:
- Dart 3 Record Serialization & Deserialization:
- Full serialization and deserialization support for Dart 3 record types in model fields and top-level record typedefs.
- Positional records serialize as lists (
[a, b]) and deserialize using<name>FromListfunctions and.to<Name>()extensions onList<dynamic>. - Named records serialize as key-value maps (
{'name': a, 'age': b}) and deserialize using<name>FromMapfunctions and.to<Name>()extensions onMap<String, dynamic>. - Generated standalone top-level record typedef extensions (
${alias}ToListExtension,${alias}ListExtension,${alias}ToMapExtension,${alias}MapExtension). - Full AST parser support for nested record signatures in
ParsedType.
- CLI Enhancements:
- Added
--clean(-c) flag to remove all generated.daxle.dartfiles recorded in.dart_tool/daxle_gen/manifest.json. - Added
--forceflag to force regeneration of all files ignoring cached content hashes. - Enhanced
--watchfile change reactivity and debouncing, invalidating cache upon source modifications to ensure instantaneous rebuilds.
- Added
- Dart 3 Record Serialization & Deserialization:
-
PERFORMANCE & REFACTORING:
- Re-architected parser into an AST visitor (
DaxleFileVisitor) subclassing analyzer'sRecursiveAstVisitorfor scalable, modular syntax tree inspection. - Modularized annotation parsing into standalone
AnnotationHandlerimplementations registered withinAnnotationRegistry.
- Re-architected parser into an AST visitor (
-
DOCUMENTATION:
- Overhauled
README.mdwith complete documentation covering CLI flags, Native Assets hooks, records, deepcopyWithproxies, equality tiering,AnnotationBundle, and member annotations. - Added thorough Effective Dart documentation comments to library root and exposed complete public API exports.
- Overhauled
0.2.1 - 2026-09-28 #
- BUG FIXES:
- Fixed annotation configuration parameters (such as
ignoreFieldsandcaseStyle) being dropped when expandingAnnotationBundle. - Removed lingering debug print statements.
- Fixed annotation configuration parameters (such as
0.2.0 - 2026-09-28 #
- NEW FEATURES:
- Deep / Proxied
copyWith:- Generated
$ClassNameCopyWithProxy<$Res>allowing fluent chained mutation across nested models (e.g.,user.copyWith.address.city(name: 'NYC')) returning the root type. - Identity checks in
copyWithinvocations to avoid unnecessary object allocations when fields remain identical. - Added
copyWithNull({bool field = false})method to explicitly set nullable properties tonull.
- Generated
- Bundled / Composite Annotations (
AnnotationBundle):- Added support for combining multiple annotations into a single reusable constant (e.g.,
const DataClass = AnnotationBundle([Serialize(), Deserialize(), CopyWith(), EqualsAndHashCode(), Stringify()])).
- Added support for combining multiple annotations into a single reusable constant (e.g.,
- Part-File Support:
- Generator automatically detects and resolves source files that declare
part of '<library>.dart', walking up to the library root and generating properpart ofdeclarations.
- Generator automatically detects and resolves source files that declare
- Deep / Proxied
0.1.2 - 2026-09-28 #
- NEW FEATURES:
- Added support for non-string map keys (e.g.,
Map<int, String>,Map<DateTime, Object>, etc.) in functional serialization and deserialization. - Extracted deep collection equality utilities (
$listEquals,$setEquals,$mapEquals,$deepEquals,$listHashCode,$setHashCode,$mapHashCode,$deepHashCode).
- Added support for non-string map keys (e.g.,
0.1.1 - 2026-09-27 #
- NEW FEATURES:
- Added Extension Type serialization and deserialization (
extension type Id(String value)). - Cross-file enum resolution: properly resolve enum types defined across different files in the project.
- Added Extension Type serialization and deserialization (
- REFACTORING:
- Removed legacy class annotation aliases to unify configuration around
@Serializeand@Deserialize. - Added MIT
LICENSE.
- Removed legacy class annotation aliases to unify configuration around
0.1.0 - 2026-09-27 #
- INITIAL RELEASE:
- Initial standalone release of
daxle_gendecoupled from the coredaxleruntime package. - Zero-dependency functional code generator designed for Dart 3 switch pattern matching and primary constructors.
- Generates
<name>FromMap,<name>ToMap, and${name}ToMapExtension. - Sealed class polymorphism support with default (
'type') or custom discriminators and subclass tags. - Enum mapping with
<enum>ToValue,<enum>FromValue, private lookup maps (const _<enum>EnumMap), and entry-level overrides. - Member annotations:
@SerializedValue(wire names, alternative aliases, customDaxleJsonConverter),@Fallback,@Flatten, and@Ignore/@ignore. - Value equality (
operator ==) andhashCodegeneration with tiered field sorting (cheap primitives, objects, collections last). - Stringify (
toString()) generation for classes and enums (@Stringify). - Comprehensive
FormatExceptiondiagnostics with expected types, actual types, andsourceJSON payload. - SHA-256 content caching and CLI runner with glob filtering and
--checkdrift validation. - Native Assets build hook integration (
hook/build.dart).
- Initial standalone release of