接入移动壳文本文件导出能力

Expo 移动壳通过文件系统写入缓存文本并调用系统分享保存面板

补充移动壳导出能力依赖、配置守卫和 HostBridge 单测

更新宿主壳能力协议、方案文档和共享决策记录
This commit is contained in:
2026-06-17 23:32:00 +08:00
parent 87cdb8bfba
commit eb9981e67d
9 changed files with 209 additions and 7 deletions

View File

@@ -6,6 +6,10 @@ const appConfigPath = new URL('../app.json', import.meta.url);
const appConfig = JSON.parse(fs.readFileSync(appConfigPath, 'utf8')).expo;
const appPath = new URL('../App.tsx', import.meta.url);
const appSource = fs.readFileSync(appPath, 'utf8');
const bridgePath = new URL('../src/mobileHostBridge.ts', import.meta.url);
const bridgeSource = fs.readFileSync(bridgePath, 'utf8');
const packagePath = new URL('../package.json', import.meta.url);
const packageConfig = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
const iconPath = new URL('../assets/icon.png', import.meta.url);
const icon = PNG.sync.read(fs.readFileSync(iconPath));
@@ -48,3 +52,19 @@ for (const snippet of [
throw new Error(`mobile shell App missing ${snippet}`);
}
}
for (const dependency of ['expo-file-system', 'expo-sharing']) {
if (!packageConfig.dependencies?.[dependency]) {
throw new Error(`mobile shell package missing ${dependency}`);
}
}
for (const snippet of [
'file.exportText',
'Sharing.shareAsync',
'normalizeHostBridgeExportFileName',
]) {
if (!bridgeSource.includes(snippet)) {
throw new Error(`mobile shell HostBridge missing ${snippet}`);
}
}