From b489244e031b927bd6d7b313e91b7fccfeb283c3 Mon Sep 17 00:00:00 2001 From: kdletters Date: Tue, 1 Sep 2026 17:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8E=9F=E7=94=9F=E5=A3=B3?= =?UTF-8?q?=20CI=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 放宽移动壳能力数组导出解析的空白匹配 兼容格式化后的移动壳源码断言换行 放宽桌面壳能力数组导出解析的空白匹配 --- apps/desktop-shell/scripts/check-config.mjs | 2 +- apps/mobile-shell/scripts/check-config.mjs | 26 ++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/apps/desktop-shell/scripts/check-config.mjs b/apps/desktop-shell/scripts/check-config.mjs index dbdef848b..e3d46e2c0 100644 --- a/apps/desktop-shell/scripts/check-config.mjs +++ b/apps/desktop-shell/scripts/check-config.mjs @@ -1005,7 +1005,7 @@ function extractStringArrayExport(source, exportName, seen = new Set()) { } const match = source.match( - new RegExp(`export const ${exportName}[^=]*= \\[([\\s\\S]*?)\\][^;]*;`), + new RegExp(`export const ${exportName}[^=]*=\\s*\\[([\\s\\S]*?)\\][^;]*;`), ); if (!match) { throw new Error(`unable to read ${exportName}`); diff --git a/apps/mobile-shell/scripts/check-config.mjs b/apps/mobile-shell/scripts/check-config.mjs index c9d812194..7e2ac1249 100644 --- a/apps/mobile-shell/scripts/check-config.mjs +++ b/apps/mobile-shell/scripts/check-config.mjs @@ -479,7 +479,7 @@ function extractStringArrayExport(source, exportName, seen = new Set()) { } const match = source.match( - new RegExp(`export const ${exportName}[^=]*= \\[([\\s\\S]*?)\\][^;]*;`), + new RegExp(`export const ${exportName}[^=]*=\\s*\\[([\\s\\S]*?)\\][^;]*;`), ); if (!match) { throw new Error(`unable to read ${exportName}`); @@ -499,6 +499,18 @@ function extractStringArrayExport(source, exportName, seen = new Set()) { return entries; } +function sourceIncludes(source, snippet) { + if (source.includes(snippet)) { + return true; + } + const compact = (value) => + value + .replace(/\s+/g, ' ') + .replace(/\s*([()[\]{}])\s*/g, '$1') + .replace(/,\)/g, ')'); + return compact(source).includes(compact(snippet)); +} + function extractStringConstExport(source, exportName) { const match = source.match( new RegExp(`export const ${exportName}\\s*=\\s*'([^']+)';`), @@ -1844,7 +1856,8 @@ for (const snippet of [ 'thirdPartyCookiesEnabled={false}', 'sharedCookiesEnabled={false}', 'webviewDebuggingEnabled={false}', - 'injectedJavaScriptBeforeContentLoaded={MOBILE_WEBVIEW_BEFORE_CONTENT_SCRIPT}', + 'injectedJavaScriptBeforeContentLoaded={', + 'MOBILE_WEBVIEW_BEFORE_CONTENT_SCRIPT', 'handleBlockedFileDownload', 'logMobileShellDownloadBlocked(event)', 'onFileDownload={handleBlockedFileDownload}', @@ -1853,7 +1866,7 @@ for (const snippet of [ 'mobile shell navigation failed for', 'external_navigation.open', ]) { - if (!shellAppSource.includes(snippet)) { + if (!sourceIncludes(shellAppSource, snippet)) { throw new Error(`mobile shell ShellApp missing ${snippet}`); } } @@ -3056,7 +3069,8 @@ if ( !hapticsSource.includes( '(request.payload as HapticsImpactPayload | undefined)?.style', ) || - !hapticsSource.includes( + !sourceIncludes( + hapticsSource, "invalidRequest('haptics impact style must be light, medium, or heavy')", ) || !hapticsSource.includes('Haptics.ImpactFeedbackStyle.Heavy') || @@ -3317,7 +3331,7 @@ for (const snippet of [ "not.toContain('app.setBadgeCount')", "expect(getMobileRuntimePlatform()).toBe('android')", ]) { - if (!hostBridgeRuntimeTestSource.includes(snippet)) { + if (!sourceIncludes(hostBridgeRuntimeTestSource, snippet)) { throw new Error(`mobile shell runtime tests missing ${snippet}`); } } @@ -3423,7 +3437,7 @@ for (const snippet of [ "not.toContain('auth.requestLogin')", "not.toContain('payment.request')", ]) { - if (!capabilitiesTestSource.includes(snippet)) { + if (!sourceIncludes(capabilitiesTestSource, snippet)) { throw new Error(`mobile shell capability profile test missing ${snippet}`); } }