macro_kit 0.8.2
macro_kit: ^0.8.2 copied to clipboard
A development-time macro system for Dart that generates code instantly for fast iteration without build_runner.
0.8.2 #
- Add ShaderReloaderMacro documentation
0.8.1 #
-
New: asset macro push events for running apps
- The macro server now sends a
generated_filesmessage to connected clients whenever an asset macro successfully generates files (compiled shader bundles, embedded assets, generated code files...). Each event is delivered only to clients whose registered packages own the generated files; if no known context owns them (e.g. no analyzer plugin connected), it falls back to notifying every client - New public API: listen to
onMacroFilesGenerated(aStream<List<String>>of absolute file paths) after connecting viasetupMacro()/runMacro()— works in bothautoRunMacromodes, since the stream only concerns receiving events, not executing generation:
onMacroFilesGenerated.listen((files) { // react without watching the file system, e.g. hot reload shaders: // final bytes = await File(bundlePath).readAsBytes(); // library.reinitializeFromBytes(ByteData.sublistView(bytes)); }); - The macro server now sends a
-
New builtin:
ShaderReloaderMacro- An asset macro that compiles Flutter GPU shader bundles: it locates every
*.shaderbundle.jsonmanifest in the watched directory and re-runsimpellerc(found via explicit config override,FLUTTER_ROOT, or the project's platform-specific ephemeral config) whenever a shader source changes. Pure Dart (dart:io+ process spawn) — no Flutter dependency. - Pair it with
onMacroFilesGeneratedto hot-reload compiled bundles into a running app:
assetMacros: { 'shaders': [ AssetMacroInfo( macroName: 'ShaderReloaderMacro', extension: '.vert,.frag,.json', output: 'build/shaderbundles', config: const ShaderReloaderConfig().toJson(), ), ], }, - An asset macro that compiles Flutter GPU shader bundles: it locates every
-
New: per-class
fieldRenameforDataClassMacro- The naming strategy for JSON map keys can now be set on the annotation itself:
@Macro(DataClassMacro(fieldRename: FieldRename.snake)), not only globally via"field_rename"inmacro.json. - Resolution order: annotation value → global config →
FieldRename.none. A field-level@JsonKey(name:)still wins over both. - Also fixes the documented global values:
"field_rename"accepts the exactFieldRenameenum names (none,camelCase,kebab,snake,pascal,screamingSnake) — the previously documentedsnake_case/kebab_casestyle strings were silently ignored.
- The naming strategy for JSON map keys can now be set on the annotation itself:
0.8.0 #
-
ComputeMacro can now generate types at compile time: set
ComputeModifier(isDeclaration: true)and return [DartCode] from the compute body — the result is embedded verbatim as top-level code (classes, enums, mixins, extensions, functions...) instead of being wrapped in a variable declaration:@Macro(ComputeMacro(modifier: ComputeModifier(isDeclaration: true))) final _userModelMacro = compute<DartCode>( () => DartCode('class UserModel { final String name; const UserModel(this.name); }'), );
0.7.7 #
- Documentation fixes for ComputeMacro:
- Clarify that any change to a tracked file dependency (
deps: ['assets/data.json']) re-generates the compute macro on the next generation pass or an explicitmacro rebuild - Document that identifier deps and file deps both feed into the combined hash, and that compute bodies execute with the working directory set to the project root
- Clarify that any change to a tracked file dependency (
- Fix broken link to the renamed
doc/compute_macro.mdand register the "Compute Macro" dartdoc topic
0.7.6 #
- Fix release for github
0.7.5 #
- Add documentation topic for ComputeMacro
0.7.4 #
- ComputeMacro now honors forced rebuilds:
always_rebuild_on_connectre-executes all compute bodies even when nothing changed in the source, instead of serving cached results - Added
rebuild [target]CLI command to force regeneration of macro generated code — without a target every registered context is rebuilt; with a package name/id or path only matching contexts are rebuilt - ComputeMacro
depsnow supports file dependencies: string entries containing/(e.g.deps: ['assets/data.json']) are hashed relative to the project root and invalidate the variable when the file content changes - ComputeMacro bodies now execute with the working directory set to the project root, so
relative paths inside the body (e.g.
File('assets/config.json')) resolve from the project root
0.7.3 #
- Update analyzer constraint to >=13.3.0 <14.0.0
0.7.2 #
- Add documentation for ComputeMacro
0.7.1 #
- Added ComputeMacro for executing code at compile time and materializing the result into a
generated top-level variable:
- Annotate a top-level variable with
@Macro(ComputeMacro())and initialize it withcompute(() => ...), e.g.final _versionMacro = compute(() => '1.0.0');generatesconst version = '1.0.0'; - Generates
constby default; useComputeModifier(isFinal: true),isVarorisPrivateto control the generated declaration - Custom serialization of runtime values via
encode/decodecallbacks - Embed raw Dart source into generated code using
DartCode - Incremental caching: only re-execute when the body or listed
depschange, or build once forever withdeps: macroBuildOnce
- Annotate a top-level variable with
0.7.0 #
- Update analyzer version
0.6.4 #
- Add documentation for EmbedMacro
0.6.3 #
- Support analyzer 9.0.0
0.6.2 #
- Added
EmbedMacroto embed asset files directly into Dart code as byte arrays.
0.6.1 #
- Added support for applying metadata annotations to individual record fields
0.6.0 #
- Added support for applying macros to record definitions
- Enabled automatic encoding/decoding of record fields in classes when using
DataClassMacro - Improved generic handling for certain edge cases
- Renamed
MacroProperty.getTypeParametertoMacroProperty.buildTypeParameter - Displayed version information in the plugin title
0.5.10 #
- Exposed abstract information for getter and setter properties (
isGetterPropertyAbstract,isSetterPropertyAbstract)
0.5.9 #
- Add ignore comment for unused variable in generated code
0.5.8 #
- Added CLI commands to restart the macro server and analysis context
- Improved CLI help and error handling
0.5.7 #
- Add ignore comment for generated file
0.5.6 #
- Enable automatic context discovery across workspace packages
- Refactor & Improve API
0.5.5 #
- Add a new option to MacroCapability to target only annotated fields and methods.
0.5.4 #
- Fix timeout issue when running
macro_context.dartvia the Flutter runner
0.5.3 #
- Fix formatting
0.5.2 #
- Added support for handling duplicate contexts (package names) by defining an
idin the pubspec and passing it toPackageInfo, for example:PackageInfo('my_package::123') - Added support for using a
fromJsonfactory from an external class via the@JsonKeyannotation - Fixed an issue where an extra generic argument was added to
toJsonfor a generic field that does not use the class type parameter
0.5.1 #
- Fixed an issue where the watched asset directory was removed incorrectly
0.5.0 #
- Add top-level function capability to macros.
- Handle auto rebuild correctly when plugin is not connected yet.
0.4.10 #
- Fixed race condition in file creation by switching from
createtocreateSync
0.4.9 #
- Optimized rebuild file listing to only include actively watched files
0.4.8 #
- Fix: avoid redundant rebuilds when clients reconnect
0.4.7 #
- Fix: synchronize global macro configuration before execution
0.4.6 #
- Add helper to generate part file
0.4.5 #
- Fixing incorrect value passed as root context
0.4.4 #
- Export helper function: buildGeneratedFileInfoFor
0.4.3 #
- Expose context root & base relative directory used to rewrite generated files
0.4.2 #
- Expose base relative directory used to rewrite generated files
0.4.1 #
- Fixed signal handler problems on Windows
0.4.0 #
- Automatic Macro Generation: Added support for running macro generation independently without
requiring the app to be running through
macro_context.dart. - New Global Config: Added
skip_connect_rebuild_with_auto_run_macrooption to prevent redundant rebuilds when automatic macro generation is enabled via external processes - Rename Configuration File: Renamed global configuration file from
.macro.jsontomacro.json - Watch Logs Command: Added new command to watch macro generation logs from terminal.
- Fix web compatibility by handling 'dart:io' imports with conditional exports
0.3.6 #
- Add support for assigning null values to nullable fields in
copyWithmethods by wrapping parameters inOption<T>. This allows distinguishing between "not provided" (keep existing value) and "explicitly set to null" (update to null).- Enable globally via
copy_with_as_option: truein configuration for DataClassMacro - Enable per-class via
@Macro(@DataClassMacro(copyWithAsOption: true)) - Enable per-field via
@JsonKey(copyWithAsOption: true)
- Enable globally via
0.3.5 #
- Added configurable serialization method names:
use_map_conventionoption to generatefromMap/toMapinstead offromJson/toJson.- When
false(default): GeneratesfromJson/toJsonmethods - When
true: GeneratesfromMap/toMapmethods - This is configured globally to ensure consistency across nested data classes
- When
0.3.4 #
- Add documentation topic for pub
0.3.3 #
- Fix pub analysis point
0.3.2 #
- Add documentation
0.3.1 #
- Added individual log files for each plugin instance loaded in different analysis contexts
0.3.0 #
- Breaking Change: Migrated Macro plugin to the new plugin system. To upgrade:
- Create an empty file named
macro_context.dartin yourlibdirectory - Add the
macro_kitto thepluginssection in youranalysis_options.yaml:
- Create an empty file named
plugins:
macro_kit: ^latest version
0.2.9 #
- Fix issue where macro server was unable to start automatically on Windows
0.2.8 #
- Fix example folder to use
libdirectory - Use LocalAppData in windows
0.2.7 #
- Add support for Dart
Typeinformation in macros - Fix metadata extraction from const variable annotations
- Refactor and improve internal API structure
- Change macro server to opt-out behavior: starts by default unless disabled
0.2.6 #
- Add logging for regeneration
0.2.5 #
- Force plugin to always connect to MacroServer
0.2.4 #
- Fixing release tool
0.2.3 #
- Add automatic macro server upgrade
0.2.2 #
- Add target file path to
MacroState
0.2.1 #
- Disable linter and formatter for generated files
- Add additional logging for client messages sent by server
0.2.0 #
- Introduced a new API for defining project-level global macro configurations.
- Added support for skipping serialization/deserialization using
asLiteralin@JsonKey, or by defining globalas_literal_typesinmacro.jsonfor type configurations. - Enabled adding dynamic analysis contexts via project paths, useful for CI environments and testing setups.
- Improved performance and reliability when rebuilding the entire project.
- Add more documentation
0.1.4 #
- Improve watch context and remove duplicate event
0.1.3 #
- fix import from macro.dart to macro_kit.dart
0.1.2 #
- add generatedType to differentiate macro-generated code for proper combining
0.1.1 #
- Fixed version constraint
0.1.0 #
- Import and library information for macro class declarations
- Import resolution for inspected types
- Field initializer inspection capability
- Enhanced data class macro with generics, default values, super formal parameters, and inheritance support
- Fixed asset macro path generation on Windows
- Use internal analysis API to provide memory store
- Better preparation of system paths for macro server startup
- Skip files containing only empty class declarations
- Added API for regeneration when connecting to server
- Fixed Object.hash parameter limit issue for classes with 20+ fields (thanks @jainam-bhavasar, #2)
- Improved documentation coverage
- Expanded test suite
0.0.12 #
- remove returning
MacroManagerinrunMacrofunction
0.0.11 #
- allow customizing class name for AssetPathMacro
0.0.10 #
- fix: crashing on iOS fixed
0.0.9 #
- fix: missing doc & set sdk constraints
0.0.8 #
- fix: remove default value for asset configuration
0.0.7 #
- fix: handle invalid value for the asset path macro configuration
0.0.6 #
- Adding Asset Path Generation
0.0.5 #
- Initial version released