flutter_fjs 0.1.7
flutter_fjs: ^0.1.7 copied to clipboard
JS/TS runtime for Flutter. Embeds QuickJS-ng with direct JSI-style JS<->C++ calls, runs source or bytecode bundles, and renders HTML-like JS tags as Flutter widgets.
0.1.7 #
- release / profile 包不再带调试器模块(spec 115):0.1.6 的 Android release APK
每个 ABI 多带一个
libfjs_debugger.so(arm64 495 KB,三个 ABI 共约 1.3 MB), 鸿蒙 release HAP 同样带着(433 KB)。Android 端jniLibs.excludes被 AGP 忽略, 现在调试器放在单独的abi/primjs/android-debugger/,只挂到debug源集;鸿蒙端插件 以源码依赖接入时插件侧过滤不生效,改由宿主entry/build-profile.json5过滤 (@ufjs/cli托管的宿主自动补上,其它宿主见docs/toolchain.md)。 libfjs.so瘦身约三成(spec 116):Android / 鸿蒙的引擎库只导出fjs_*和调试器 模块实际用到的符号(此前 PrimJS 内部 2800 多个符号全部导出),并开启--gc-sections。 arm64 primjs 1.94 → 1.34 MB、armeabi-v7a 1.22 → 0.81 MB、x86_64 1.93 → 1.34 MB;quickjs arm64 1.41 → 1.19 MB;鸿蒙 primjs 1.90 → 1.26 MB。行为不变,debug 构建照常可附加调试器。
0.1.6 #
- 默认 JS 引擎换成 PrimJS 4.1.1(specs/088–091):带内置 Chrome DevTools
协议调试器,
fjs debug可断点、看 Elements / Network。quickjs-ng 0.9.0 作为 第二个 flavor 保留,两份预编译产物都在abi/{primjs,quickjs}/下随包发布。 字节码不跨引擎:bundle 头带引擎 id,必须用同 flavor 的fjsc编(@ufjs/cli0.1.6 起按引擎自动挑选,spec 114)。旧版 CLI 编出的 quickjs 字节码在默认 PrimJS 下会被拒绝加载。 - 引擎切换不再改写插件目录(spec 105/112):Android 的 gradle、iOS/macOS 的
podspec 按
FJS_JS_ENGINE(环境变量或--dart-define)直接选用对应产物;dart run flutter_fjs:engine <flavor>负责鸿蒙ohos/libs与宿主 pods 失效。 iOS/macOS 来回切换后仍链接旧引擎的问题已修(Xcode 缓存递归清理)。 - 调试器是可插拔模块(spec 090):非 debug 构建物理剔除
libfjs_debugger, release 包里没有 CDP 入口;调试通道对非本机连接做 token 质询(spec 107)。 - 未处理的 Promise 拒绝在两个引擎上都打
[fjs] unhandled promise rejection, 顺带修掉 PrimJS 未处理拒绝列表的内存泄漏(spec 111)。 FjsEngine新增assetBundle,正式构建的资源可改从网络读取。- 布局与交互修复:flex 主轴百分比参照(spec 106)、fixed + transition 盒内
height: 100%(spec 101)、touch-action: none不再吞@tap(spec 097)、 image 位置类 mode 与heightFix(spec 102)、vant 组件两端对拍(specs/068–077)。 - 性能:导航挂载窗口内跳过同步
flushLayout(spec 086);热更新只留页面与整包 两档(spec 095)。
0.1.5 #
- 修 Flutter 3.44 编译错误:官方 3.44 把
CupertinoPageTransitionsBuilder从 material 挪进 cupertino(breaking change decouple-page-transition-builders),fjs-slide的过渡声明在 3.44+ 上报 undefined。现在同时 import 两端, 3.38(本包下限)到最新 stable 都能编过。本机若装的是 3.41 系 ohos fork (类还在 material),此前本地flutter analyze不会复现。 - pub.flutter-io.cn 体检修复(specs/067):补
example/(FjsEngine+FjsApp的最小宿主);flutter_fjs库与CanvasChunkReader公开成员补 dartdoc; 全包过dart format;清理全部弃用 API(withOpacity/withValues、onPop/onPopWithResult、activeColor/activeThumbColor、颜色.value/.opacity/.red等 getter 换新访问器)。静态分析、依赖下限、 文档三项 pub 满分。
0.1.4 #
- 最低 Flutter 版本提到 3.38.0(Dart 3.10)。 更低的版本编译不过:WebGL 模块
依赖的 flutter_angle 0.4.x 用私有
@Native函数接 TypedData.address, Dart 3.10 之前的 CFE 会崩在Crash when compiling: Null check operator used on a null value。Flutter 3.35(Dart 3.9)同样受影响,升级要一步到 3.38+。 flutter_angle依赖从核心移到@ufjs/webgl模块(spec 022)。不用getContext('webgl')的应用不再拉 ANGLE。ffi提到^2.2.0;cached_network_image放宽成>=3.4.1 <5.0.0,这样在 Flutter ≥3.44 上会自动用 4.x,而不必在这里锁死一个更高的 SDK 下限。- Android 侧固定
ndkVersion,避免宿主和插件解析到不同的 NDK。 - 鸿蒙(OpenHarmony/HarmonyOS NEXT)平台适配:新增
ohos/平台目录,fjs devices/fjs run支持鸿蒙设备,fjs build --hap打包(specs/066)。 WebGL 画布补 ohos 后端,官方 Flutter 用户不受影响。 - 吸顶布局(specs 052/053/054):
<sticky-header>/<sticky-section>吸顶组件;样式级position: sticky全端生效;scroll-into-view置空可重触发, sticky 目标落在分组起点。 <page-container>页面容器组件,三端同源(spec 065)。- WebGL:接 three.js / glTF(spec 023),iOS 真机黑屏修复(spec 026), 模型双指缩放(spec 029);canvas/webgl 指令字节去掉 fromList 包 sublist 的双重拷贝。
<rich-text>富文本组件,嵌套 text 变行内片段(spec 034);一个段落一个 节点,长文节点 486 → 91(spec 035)。- CSS(specs 040/041/043/044/045):
@media响应式样式,窗口尺寸通道 两端打通;伪类补全与单边边框;百分比扩展到盒模型间距与定位偏移; transition 背景色/尺寸插值。 - safe-area:
edges属性三端同源,NavBar 自带顶部安全区;Android 系统 栏透明可穿透,二级页内容可滚到指示条下。 - JSI:二进制句柄跨越 JSI,fetch 请求/响应体告别 base64-in-JSON
(spec 038);
invokeHostAsync异步宿主调用,fetch 范式通用化(spec 039)。 - 导航:
onPageSettled+<canvas defer-resize>,重活不再压在路由转场 上(spec 027);JS UI 帧上不再重建 Navigator.pages(spec 024); fjs-slide 底页视差跟随(spec 025)。 - dev:模块级 HMR,共享模块热替换不再重建 VM(spec 037);连接退避 重试与公网探测授权弹窗(spec 030)。
<swiper>:直接子节点必须是 swiper-item,三端编译期校验(spec 051)。
0.1.3 #
<canvas>: a Canvas 2D host. JS sends a display list of drawing commands and Dart replays it into aCustomPainter— paths, fills and strokes, gradients and patterns, text, images, clipping, transforms, and per-frame state. The op protocol is at version 4; an older host simply never receives the newer commands.- A partial
clearRectis now correct: a chunk flaggedNEEDS_LAYERis replayed into its ownsaveLayer, instead of erasing whatever sits under the canvas into a black band. A full-canvasclearRectremains the signal that discards the retained display list; going 240 frames without one warns once. arcTois a corner fillet between two segments, which Flutter's SVG-stylearcToPointcannot express — a rounded rectangle came out as a barrel. The tangent points are computed in JS now, so the host only ever receiveslineTo+arc.PathCmd.arcTokeeps its slot (the numbering is fixed incanvas_ops.dart, andfjs devcan attach any older bundle to any client): it warns once and draws the corner as a polyline.height: 100%resolves inside a column whose height is known. Flutter'sFlexhands children unbounded main-axis constraints by design, so a percentage resolved againstinfinityand degraded toauto— and a child that degraded while containing its own flex (a<canvas>surface, a nested column) hit "RenderFlex children have non-zero flex but incoming height constraints are unbounded".buildFlexnow passes its own content box down to children that declare a main-axis percentage; children without one keep the unbounded constraints, and an unbounded box (inside a scroller) still degrades toauto.- Percentages resolve for absolutely positioned children too.
RenderStackhandsBoxConstraints()unless an opposite edge or an explicit size is set, soposition: absolutewithwidth/height: 100%collapsed a full-screen overlay to one line of text; sizes are now resolved in place against the space the positioned box was given. ExpandedbecameFlexible(fit: bounded ? tight : loose). A tight fit is only legal when there is free space to hand out, so it asserted inside a shrink-wrapping column; CSS has no such failure —flex-growwith no free space simply does nothing.- Style lengths accept
%andcalc()onwidth/height/min-*/max-*. The expression reduces to a px term plus a percentage term and is resolved in aLayoutBuilder; an unbounded axis degrades toauto, as in CSS. Percentages on other properties are still unsupported. - Local images:
<image src>resolves project assets, from thefjs devserver in development and from the bundled asset in release. MirrorNodeis exported frompackage:flutter_fjs/flutter_fjs.dart. Writing aComponentBuilder— the Flutter widget behind a JS tag — means reading the node it is handed, so the type is now part of the public surface. This is what an fjs module's widget extension is built on.FjsEngine.devUri/devFetch(path)expose the connectedfjs devserver, andfetch(url)/fetchString(url)make one-off requests over the same HttpClient that backs JSfetch(). A module that ships a build-time file (an icon set, a language pack) can now read it from the dev server in dev and from its asset in release without anFJS_DEVdart-define or an HttpClient of its own. One engine now means oneHttpClient: the dev-server connection shares it too, instead of opening a second one to the same host.
0.1.1 #
- Android natives are now 16 KB page aligned, as required by Android 15+ devices
with 16 KB memory pages.
tool/build-android.shrefuses NDKs older than r28, which is where that alignment became the default.
0.1.0 #
- First release.
- QuickJS-ng embedded via Dart FFI, JSI-style direct JS↔C++ calls.
- Source bundles and precompiled QuickJS bytecode bundles.
- HTML-like JS tags rendered as Flutter widgets; Vue 3 custom renderer support
through the
@ufjs/runtimenpm package. - Ships prebuilt natives:
libfjs.soforarmeabi-v7a,arm64-v8a,x86_64, andfjs.xcframeworkfor iOS device, iOS simulator, and macOS — no NDK, CMake, or native compile step in consumer builds.