nitro_generator 0.1.3
nitro_generator: ^0.1.3 copied to clipboard
Code generator for Nitro Modules (Nitrogen). Converts *.native.dart specs to Dart FFI, Kotlin, Swift, and C++ bindings.
0.1.3 #
- Swift generator: fixed
@_cdeclString type crash (EXC_BAD_ACCESS) —Stringparameters now useUnsafePointer<CChar>?(Cconst char*) and return values useUnsafeMutablePointer<CChar>?(malloc'dchar*), withString(cString:)conversion at the boundary andstrdup()for returns so Dart'stoDartStringWithFree()/free()pairs correctly. Fixes an immediate crash on any method that takes or returns aString. - Swift generator: async
String-returning methods useDispatchSemaphore+Task.detachedwith astrdup(result)return, matching the synchronous C ABI required by@_cdecl. - Swift generator:
Stringproperty getters returnstrdup-allocated C strings; setters acceptUnsafePointer<CChar>?and convert withString(cString:). - Swift generator: default fallback value for
Stringreturns changed from""tostrdup("")to maintain consistent allocator pairing. - Updated README: fixed the
@_cdecl("_call_processFile")example to show the correct C pointer types instead of the old (crashing)Stringparam/return pattern; added link to newdocs/swift-type-mapping.md.
0.1.2 #
- Swift generator: replaced
@objc public static func _call_*pattern with top-level@_cdecl("_call_*") public funcstubs. Swift structs and Swift-only protocols cannot cross the Objective-C boundary;@_cdeclexports plain C symbols that the generated C++ shim can call withextern "C". - Swift generator:
boolreturn type now maps toInt8(matching C'sint8_t) instead ofBool. - Swift generator: struct-returning functions now return
UnsafeMutableRawPointer?(heap-allocated, caller frees) instead ofAny?. - Swift generator: async struct functions use
DispatchSemaphore+Task.detachedto bridge async Swift to the synchronous C ABI required by@_cdecl. - Swift generator:
NitroBatteryRegistry(and all registries) no longer inheritNSObjector use@objc— pure Swift classes. - Added 10 new
SwiftGeneratortests covering the above patterns. - Fixed failing test that expected the old
@objc public static func _call_add(pattern.
0.1.1 #
- Renamed package from
nitrogentonitro_generatorto avoid a naming conflict onpub.dev.
0.1.0 #
- Initial release of Nitro code generator.
- Generates Dart FFI, Kotlin, Swift, and C++ bindings.
- Support for
HybridObject,HybridStruct, andHybridEnum. - Support for
@nitroAsyncmethods. - Support for
@NitroStreamwith Backpressure strategies.