补齐原生壳方法表门禁

补齐 HostBridge 方法表中的图片导出能力

原生壳总门禁校验方案方法表与共享契约一致

修正 Expo 壳未来 SDK 接入口径

同步验收清单和共享决策记录
This commit is contained in:
2026-06-19 01:12:45 +08:00
parent 224f985688
commit d7d3fdfa95
3 changed files with 46 additions and 3 deletions
+42
View File
@@ -331,6 +331,22 @@ function extractDocumentCapabilityList(source, marker) {
return [...sentence.matchAll(/`([^`]+)`/g)].map((entry) => entry[1]);
}
function extractDocumentMethodTable(source) {
const start = source.indexOf('首批 method');
if (start === -1) {
throw new Error('native shell plan missing HostBridge method table');
}
const end = source.indexOf('每个 method 都必须', start);
if (end === -1) {
throw new Error('native shell plan method table missing end marker');
}
return [...source.slice(start, end).matchAll(/^\| `([^`]+)` \|/gm)].map(
(entry) => entry[1],
);
}
function assertNativeShellCapabilityPlan() {
const planSource = fs.readFileSync(nativeShellPlanPath, 'utf8');
if (
@@ -341,6 +357,14 @@ function assertNativeShellCapabilityPlan() {
'native shell plan must not document core:default as a desktop capability permission',
);
}
if (
planSource.includes('三端生产壳临时替身词扫描') ||
!planSource.includes('H5 HostBridge 真实调用链的临时替身词扫描')
) {
throw new Error(
'native shell plan must document production scaffold scanning for the H5 HostBridge call chain',
);
}
const mobileCapabilitySource = fs.readFileSync(
'apps/mobile-shell/src/host-bridge/capabilities.ts',
@@ -354,6 +378,10 @@ function assertNativeShellCapabilityPlan() {
mobileCapabilitySource,
'MOBILE_HOST_CAPABILITIES',
);
const sharedMethods = extractTsStringArray(
fs.readFileSync(sharedHostBridgeContractPath, 'utf8'),
'HOST_BRIDGE_METHODS',
);
const iosMobileCapabilities = extractTsStringArray(
mobileCapabilitySource,
'IOS_MOBILE_HOST_CAPABILITIES',
@@ -363,6 +391,20 @@ function assertNativeShellCapabilityPlan() {
);
const desktopCapabilities = extractRustCapabilities(desktopCapabilitySource);
assertSameList(
extractDocumentMethodTable(planSource),
[
...sharedMethods.slice(0, 8),
'app.lifecycle',
'navigation.canGoBack',
...sharedMethods.slice(8, 12),
'network.statusChanged',
...sharedMethods.slice(12, 21),
'file.imageDropped',
...sharedMethods.slice(21),
],
'native shell documented method table',
);
assertSameList(
extractDocumentCapabilityList(planSource, capabilityListMarkers.mobile),
mobileCapabilities,