收口原生壳能力来源

新增共享 HostBridge capability profile,区分 Expo 移动通用、iOS 额外和 Tauri 桌面能力

移动壳能力清单改为引用共享 profile,入口 URL 类型支持 readonly 能力数组

两端配置检查和原生壳总门禁改为反查共享 profile,桌面 Rust 清单保持运行时镜像

补充 HostBridge profile 单测和 H5 readonly 能力合并类型兼容

同步 Expo/Tauri 壳方案、HostBridge 协议文档和项目决策记录
This commit is contained in:
2026-06-19 02:02:15 +08:00
parent a54210b0d1
commit 75cd4f1abc
12 changed files with 192 additions and 68 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ function normalizeHostCapabilities(values: unknown): HostBridgeCapability[] {
}
function mergeHostCapabilities(
...capabilityLists: Array<HostBridgeCapability[] | null | undefined>
...capabilityLists: Array<readonly HostBridgeCapability[] | null | undefined>
) {
return Array.from(
new Set(capabilityLists.flatMap((capabilities) => capabilities ?? [])),
@@ -179,11 +179,13 @@ describe('nativeAppHostBridge', () => {
test('Tauri invoke 超时后的迟到回包不改变已拒绝结果', async () => {
vi.useFakeTimers();
let resolveInvoke:
| ((response: HostBridgeResponse<{ handled: boolean }>) => void)
| null = null;
let resolveInvoke: (
response: HostBridgeResponse<{ handled: boolean }>,
) => void = () => {
throw new Error('Tauri invoke promise was not created');
};
const invoke = vi.fn(
() =>
(_command: string, _args?: Record<string, unknown>) =>
new Promise<HostBridgeResponse<{ handled: boolean }>>((resolve) => {
resolveInvoke = resolve;
}),
@@ -206,7 +208,7 @@ describe('nativeAppHostBridge', () => {
const request = (invoke.mock.calls[0]?.[1] as { request: HostBridgeRequest })
.request;
resolveInvoke?.({
resolveInvoke({
bridge: HOST_BRIDGE_PROTOCOL,
version: HOST_BRIDGE_VERSION,
id: request.id,