fjs 3.0.0
fjs: ^3.0.0 copied to clipboard
A high-performance JavaScript runtime for Flutter applications, built with Rust and powered by QuickJS.
Changelog #
3.0.0 #
- BREAKING:
JsEngine,JsBytecode,JsRuntime,JsContext,JsAsyncRuntime, andJsAsyncContextmethods now throw a typedJsErrorinstead ofAnyhowException; catch withon JsErrorand matchcode()or the freezed variants - BREAKING:
JsError.memoryLimitnow carries a message string instead ofcurrent/limitbyte counts (those fields were never populated) - BREAKING:
JsEngine.close()now succeeds whileinit()is still in flight; the interruptedinit()reports the failure instead - FEATURE: Real QuickJS exceptions are classified into structured
JsErrorvariants —syntax(with line/column),type,reference,stackOverflow,memoryLimit— with full message and stack text preserved - FEATURE:
rquickjserror mapping now producesconversion,module,io, andmemoryLimitvariants instead of flattening everything intoruntime - FEATURE: Added public
JsEngine.drainUnhandledJobErrors()to observe background JavaScript failures without failing an unrelated engine call; works in every engine state, including afterclose() - PERF: Replaced the 5 ms background driver poll loop with an event-driven design (runtime schedular wakes + foreground notifications + 1 s defensive fallback); idle runtimes no longer consume CPU and detached timers fire on time
- PERF: Bytecode bundle validation reuses a single scratch QuickJS runtime for all modules; engine bytecode evaluation/bundle paths no longer validate or decode payloads twice
- FIX: Dropping
JsAsyncRuntime/JsAsyncContextno longer blocks the calling thread (often the Dart main thread); cleanup now runs detached on the JS executor whileclose()stays deterministic - FIX: Lock poisoning in driver/module/engine state no longer panics across the FFI boundary; locks recover the inner state instead
- FIX: Converting plain JavaScript objects no longer leaves a stale pending
TypeErroron the context (the previousArrayBufferprobe threw internally for every non-ArrayBuffer object); detachedArrayBuffer/TypedArray/DataViewvalues now raise a clear conversion error instead of silently producing empty bytes - FIX: Background error acknowledgements are bounded: a handled promise rejection only removes its own queued error, so a recycled promise address can no longer swallow an unrelated background failure
- INTERNAL: Collapsed the six engine module declaration/evaluation methods into shared helpers; unified relative-specifier normalization; macro-ized typed-array byte extraction
- INTERNAL: Regenerated Flutter Rust Bridge bindings with
flutter_rust_bridge_codegen 2.12.0
2.2.0 #
- BREAKING: Renamed runtime and engine factory APIs from
withOptions(...)tocreate(...) - BREAKING: Renamed factory parameters from
builtin/additionaltobuiltins/modules - FEATURE: Added
JsEngineRuntimeOptionsfor engine-owned runtime limits and metadata during construction - FEATURE: Added runtime control proxies on
JsEngine, including memory, GC, stack, scheduler, and info APIs - FIX: Kept
JsEngineas the sole owner of its runtime/context while restoring access to runtime-level safety controls - FIX: Corrected engine integration tests to validate engine-owned runtime behavior instead of unrelated standalone runtimes
- FIX: Restored and expanded lifecycle regression coverage for engine initialization and close state transitions
- DOCS: Updated README, README_zh, FRB-generated API docs, and example app code to the final
create(...)API - INTERNAL: Regenerated Flutter Rust Bridge bindings with
flutter_rust_bridge_codegen 2.12.0 - INTERNAL: Cleaned remaining Rust test warnings caused by unused async test contexts
2.1.0 #
- BREAKING: Renamed
clearNewModules()toclearPendingModules()to match its actual semantics; only not-yet-loaded dynamic modules can be cleared - IMPROVEMENT: Upgraded LLRT dependencies to revision
a2e1640 - IMPROVEMENT: Added more LLRT-backed runtime capabilities, including
dgram,https,intl, andtemporal - IMPROVEMENT: Added module inventory APIs to inspect all available modules, including builtins and additional configured modules
- IMPROVEMENT: Clarified dynamic module lifecycle with
clearPendingModules(), which only clears not-yet-loaded registrations - FEATURE: Added QuickJS bytecode APIs for ES modules, module bundles, and classic scripts, with compile, validate, declare, and evaluate workflows
- FIX: Moved bytecode compile and validate onto generated FRB APIs outside
JsEngine, with both sync and async variants - FIX: Made module bytecode compilation side-effect free and added eager bytecode validation before declaration/evaluation
- FIX: Prevented redefinition of dynamically loaded modules inside the same context lifecycle
- FIX: Corrected relative resolution for dynamically declared modules
- FIX: Hardened
JsEnginelifecycle with an explicit initializing state, sorunningonly becomes true after successful initialization - FIX: Stabilized
dispose()semantics to detach the bridge, drain pending runtime work, run GC, and leave ownership of the underlying context/runtime unchanged - FIX: Rejected duplicate module names in bulk
declareNewModules()anddeclareNewBytecodeModules()requests instead of silently overriding entries - FIX: Hardened
JsValueconversions forDate,BigInt, safe integers, and typed arrays - FIX: Removed implicit runtime draining from hot execution paths; pending jobs now advance only through explicit runtime APIs
- DOCS: Updated README, README_zh, generated API docs, and example code to match the current production API and module semantics
2.0.1 #
- IMPROVEMENT: Upgraded LLRT dependencies from revision 77edb18 to d375ad0
- IMPROVEMENT: Added webpki-roots feature to llrt_fetch for enhanced TLS certificate validation
- IMPROVEMENT: Added comprehensive test suite to libfjs with 10 test modules
- IMPROVEMENT: Updated sysinfo dependency from 0.37.2 to 0.38.0
- IMPROVEMENT: Updated windows crates from 0.61.x to 0.62.x
- FIX: Fixed example fetch URL to use httpbin.org for proper HTML response testing
2.0.0 #
- BREAKING: Renamed
JsEngineCoretoJsEnginefor clearer naming convention - BREAKING: Removed
JsActionsystem - direct API methods are now available onJsEngine - BREAKING: Removed
exec()method - use direct methods likeeval(),call(),declareNewModule()instead - BREAKING: Changed
eval()parameter from positional to named parametersource:for better clarity - BREAKING: Changed
declareNewModule()parameter to named parametermodule: - BREAKING: Changed
declareNewModules()parameter to named parametermodules: - BREAKING: Removed
engine.freezed.dart-JsEngineis now a regular abstract class - FEATURE: Added
call()method to invoke exported module functions directly - FEATURE: Added
evaluateModule()method to execute modules immediately - FEATURE: Added
isModuleDeclared()method to check module existence - FEATURE: Added
clearNewModules()method to remove all dynamically declared modules - FEATURE: Added
initWithoutBridge()method for engines that don't need bridge communication - FEATURE: Added
contextgetter to access underlyingJsAsyncContext - FEATURE: Added
disposedgetter to check engine disposal status - FEATURE: Added comprehensive API documentation with examples for all public methods
- IMPROVEMENT: Migrated to named parameters throughout
JsEngineAPI for better code clarity - IMPROVEMENT: Updated all example screens to use new API
- IMPROVEMENT: Enhanced integration tests with new API coverage
- IMPROVEMENT: Simplified engine lifecycle management with direct methods
- IMPROVEMENT: Better error messages with detailed documentation
- DOCS: Fixed README.md and README_zh.md to match actual API signatures
- DOCS: Added detailed parameter descriptions and examples to all API methods
- CI/CD: Added GitHub Actions workflow for building all platforms
1.4.0 #
- BREAKING: Restructured API modules - removed deprecated
jsmodule, addedengine,error,runtime, andsourcemodules for better organization - FIX: Fixed Promise result unwrapping - QuickJS's
JS_EVAL_FLAG_ASYNCwraps Promise results in{value: xxx}format, now properly detected and unwrapped by checking for objects with exactly onevalueproperty - FIX: Fixed nested Promise handling to correctly await and unwrap chained Promises
- FIX: Fixed
undefinedvalue handling in Promise results - now correctly returnsJsValue.none()instead of the wrapper object - FIX: Fixed
DynamicModuleResolverto properly check module existence before resolving - FIX: Fixed
build_loaders()to properly include additional modules in resolver and loader chains - FIX: Fixed
GlobalAttachmentto correctly initialize each context independently using context-level userdata - PERFORMANCE: Optimized BigInt conversion using native rquickjs API instead of JavaScript evaluation
- PERFORMANCE: Improved Symbol description extraction using native rquickjs Symbol API
- PERFORMANCE: Simplified file reading with direct
tokio::fs::read()call - IMPROVEMENT: Added comprehensive integration tests (130+ test cases) covering Promise edge cases, boundary conditions, bridge call scenarios, and memory management
- IMPROVEMENT: Updated example app with new API screens for engine, error, runtime, and source modules
- IMPROVEMENT: Added widgets directory for reusable UI components in example app
- INTERNAL: Improved Promise result detection logic using object key enumeration instead of direct property access
- INTERNAL: Removed unused variable in bridge call function
- INTERNAL: Improved code clarity and reduced redundant logic
1.3.0 #
- FEATURE: Added
JsCode.bytes()variant for directUint8Listsupport from Dart - FEATURE: Added
JsModule.bytes()constructor for creating modules from bytes - PERFORMANCE: Significant performance improvement when JavaScript code is already in bytes format
- PERFORMANCE: Eliminated unnecessary UTF-8 String conversions for network and file-based JavaScript code
- PERFORMANCE: Direct bytes-to-rquickjs pipeline using
Into<Vec<u8>>API compatibility - IMPROVEMENT: Optimized dynamic module storage from
HashMap<String, String>toHashMap<String, Vec<u8>> - IMPROVEMENT: Enhanced
get_raw_source_code()to returnVec<u8>instead ofString - IMPROVEMENT: Updated file reading operations to use
read_to_end()instead ofread_to_string()for better efficiency - DOCS: Enhanced API documentation with bytes-specific usage patterns and examples
- DOCS: Added detailed bytes usage examples to README.md and README_zh.md
1.2.0 #
- BREAKING: Complete refactor of example application architecture
- FEATURE: Added asset-based JavaScript example system with dynamic loading
- FEATURE: Implemented comprehensive example categorization with 12 distinct categories
- FEATURE: Created modular example management with 93 individual JavaScript files
- FEATURE: Added automatic file caching mechanism for improved performance
- FEATURE: Added module declaration management actions to JavaScript engine
- FEATURE: Added
getDeclaredModules()method to retrieve all dynamically declared modules - FEATURE: Added
isModuleDeclared()method to check if a specific module is declared - IMPROVEMENT: Enhanced module tracking and introspection capabilities
- IMPROVEMENT: Standardized all JavaScript examples to use
console.log()instead ofexportstatements - IMPROVEMENT: Removed Chinese comments, all code uses clean English documentation
- REMOVED: Eliminated all events-related examples to simplify the codebase
1.1.0 #
- FEATURE: Enhanced API design with improved high-level interface
- FEATURE: Advanced example application with interactive playground, responsive layout, haptic feedback, and local storage
- FEATURE: New module management methods
declareNewModule,declareNewModules, andclearNewModulesfor better module handling - FEATURE: Built-in modules are now configured during runtime creation via
JsAsyncRuntime.withOptions() - DEPRECATED: Removed
enableBuiltinModule()method - use runtime options instead - DEPRECATED: Removed
declareModule()method - usedeclareNewModule()instead - DEPRECATED: Removed
importModule()method - DOCS: Comprehensive documentation updates with detailed examples and API reference
- DOCS: Enhanced quick start guide and advanced usage examples
- PERF: Improved memory management and garbage collection controls
- PERF: Better error handling and recovery mechanisms
- INTERNAL: Updated dependencies for better compatibility
- INTERNAL: Enhanced build system for faster development cycles
- INTERNAL: Improved Rust FFI bindings and async runtime support
- INTERNAL: Added comprehensive error types and proper error propagation
1.0.9 #
- Bug fixes and stability improvements
- INTERNAL: Fixed module resolution edge cases
- INTERNAL: Improved async context synchronization
1.0.3 #
- Precompiled binaries support for macOS, iOS, Linux, Windows, and Android
- INTERNAL: Enhanced cargo configuration for better cross-platform builds
1.0.2 #
- INTERNAL: Improved flate2 configuration with zlib-rs backend
- INTERNAL: Fixed build configuration for Windows targets
1.0.1 #
- FIX: Resolved memory management issues in long-running scripts
- FIX: Fixed module loading edge cases and circular dependencies
- FIX: Improved error messages for better debugging
- INTERNAL: Added comprehensive test suite for JavaScript runtime operations
- INTERNAL: Enhanced async runtime performance and stability
1.0.0 #
- BREAKING CHANGE: First stable release with enhanced compatibility
- IMPROVEMENT: Improved cross-platform support with better build configuration
- IMPROVEMENT: Stabilized API interface and error handling
- IMPROVEMENT: Enhanced module system with dynamic loading capabilities
- INTERNAL: Migrated to Rust-based build system for better performance
- INTERNAL: Improved FFI bindings for async runtime operations
0.0.1 #
- Initial release with basic functionality
- INTERNAL: Core JavaScript runtime integration with Flutter
- INTERNAL: Basic module loading and execution support