收口移动壳能力诊断日志

移动壳 HostBridge 能力失败日志只记录稳定阶段标签

更新 badge notification haptics network share navigation 失败测试断言

扩展移动壳配置门禁禁止能力日志打印原生 error 对象

补充 Expo 与 Tauri 宿主壳方案中的移动诊断日志边界
This commit is contained in:
2026-06-20 23:09:49 +08:00
parent 568010b31b
commit 05d278f8f7
15 changed files with 39 additions and 26 deletions
@@ -161,6 +161,31 @@ const bridgeSourceFiles = fs
const hostBridgeSource = bridgeSourceFiles
.map((file) => fs.readFileSync(file, 'utf8'))
.join('\n');
function assertLabelOnlyMobileHostBridgeDiagnostics(source, label, message) {
if (source.includes(`console.warn(\`${message} \${label}\`, error)`)) {
throw new Error(`${label} diagnostics must not log native error objects`);
}
if (!source.includes(`console.warn(\`${message} \${label}\`)`)) {
throw new Error(`${label} diagnostics must use stable label-only logging`);
}
}
for (const [source, label, message] of [
[badgeSource, 'mobile app badge', 'mobile app badge failed for'],
[clipboardSource, 'mobile clipboard', 'mobile clipboard failed for'],
[hapticsSource, 'mobile haptics', 'mobile haptics failed for'],
[
hostBridgeNavigationSource,
'mobile HostBridge navigation',
'mobile HostBridge navigation failed for',
],
[hostBridgeNetworkSource, 'mobile network', 'mobile network failed for'],
[notificationsSource, 'mobile notification', 'mobile notification failed for'],
[shareSource, 'mobile share', 'mobile share failed for'],
]) {
assertLabelOnlyMobileHostBridgeDiagnostics(source, label, message);
}
const urlPath = new URL('../src/shell/url.ts', import.meta.url);
const urlSource = fs.readFileSync(urlPath, 'utf8');
const urlTestPath = new URL('../src/shell/url.test.ts', import.meta.url);