Repository navigation
Conversation
管线:of(ctx) -> pre pipes(改写参数/blockWith 阻断)-> switchMap(调用) -> post pipes(改写结果/埋点/catchError) - invoke$ 返回冷流,订阅才发起调用;invoke 返回 Promise(急切订阅) - 回调作为旁路观察者,看到的是同样归一/改写后的结果 - task 类同步返回 task,结果经 post 管道后再触发回调 - AbortSignal:未发起即取消 / in-flight 取消(task 类自动 task.abort()) - setPipe/setGlobalPipes 返回 MpPipeHandle,dispose() 精确撤销本次注册 - MpPipeRegistry 改 root 注入,新增 MP_API_PIPES 多 provider 声明式注册 - MpEventBus.on$ 可订阅形态 - 删除 interceptor-registry.ts / MpApiInterceptor
- setPipe/setGlobalPipes/removePipe/clearGlobalPipes/getEventChannel 等纯转发方法去掉返回标注 - extractCallbacks 去掉内联对象返回类型;callObservable/invokeTask/dispatch/callSync/runInAngular 同样交由推导 - pipeThrough 去掉泛型与返回标注,reduce 直接推 - MpEventBus.on$ 去掉 Observable<T> 标注 保留非冗余标注:invoke$(内部 any,不标会退化)、invoke(多态返回)、 getRawApi(保留函数签名)、rawCall(刻意从 any 收窄为 unknown)、 register(handle 契约锚点)
- getBLEDeviceRSSI({deviceId}) -> {rssi}
- setBLEMTU({deviceId, mtu})
- preloadPage / unPreloadPage({url}),复用 MpNavigateOptions
统一名直接问平台会误报:setNavigationBarTitle 在支付宝真名是 setNavigationBar,探测返回 false 导致业务静默走降级分支。 - 解析 protocol.name / protocol.probe 后再探测 - custom 协议新增 probe 声明合成所用的平台 API,全部就位才算支持 - 平台无 canIUse 或抛错时,落到目标函数存在性判断
引入 valibot 声明式校验,命中规则的 API 在开发期检查拼写、 必填、类型、枚举,只告警不阻断。 关键实现约束(均为实测得出): - 具名导入 valibot:`import * as v` 整包无法 tree-shake(278KB vs 4.6KB) - 守卫必须内联 `typeof ngDevMode !== 'undefined' && ngDevMode`: 包成 helper 函数后打包器无法证明分支已死 - schema 必须函数惰性构建:模块顶层调用 valibot 会被当作模块副作用保留 三者齐备后实测:dev 103KB -> prod 88KB,schema 残留 0。 架构: - 校验以 core pipe 形式注入,跑在用户管道之前,报开发者原始入参 - clearGlobalPipes() 不影响 core 层 - MP_API_SCHEMAS multi token 支持业务覆盖内置规则 - signal 等框架键在校验前摘除
7 条 any 全部接上具名类型,map 35 条已无 any: - MpDeviceInfo / MpAppBaseInfo / MpWindowInfo - MpEnhancedSystemInfo(原始字段透传 + 归一字段,保留索引签名) - MpMenuButtonRect / MpSafeArea / MpSafeAreaInsets / MpDeviceType - getStorageSync 改 unknown:存什么取什么,编译期无从得知, 要类型走 getStorageSync<T>(key) system-info.ts 的构建函数补上对应返回类型标注 —— 这里是契约定义处, 非冗余标注。 新增编译期断言(Eq 元组赋值式)覆盖 map -> MpResultOf -> 服务方法 整条推导链,任一环节断裂则编译报错。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.