Merge branch 'master' into feat/agc-use-ui-design
This commit is contained in:
@@ -3608,7 +3608,7 @@ function extractDocumentMethodTable(source) {
|
||||
throw new Error('native shell plan method table missing end marker');
|
||||
}
|
||||
|
||||
return [...source.slice(start, end).matchAll(/^\| `([^`]+)` \|/gm)].map(
|
||||
return [...source.slice(start, end).matchAll(/^\|\s*`([^`]+)`\s*\|/gm)].map(
|
||||
(entry) => entry[1],
|
||||
);
|
||||
}
|
||||
@@ -3831,7 +3831,7 @@ function assertNativeShellCapabilityPlan() {
|
||||
],
|
||||
]) {
|
||||
for (const snippet of snippets) {
|
||||
if (!source.includes(snippet)) {
|
||||
if (!sourceIncludesSnippet(source, snippet)) {
|
||||
throw new Error(
|
||||
`${label} must derive unsupported methods from shared method list`,
|
||||
);
|
||||
@@ -4118,7 +4118,7 @@ function assertWechatMiniProgramRouteParity() {
|
||||
"readWebViewSourceQueryValue('clientType')",
|
||||
"readWebViewSourceQueryValue('clientRuntime')",
|
||||
]) {
|
||||
if (!webViewShellSource.includes(snippet)) {
|
||||
if (!sourceIncludesSnippet(webViewShellSource, snippet)) {
|
||||
throw new Error(
|
||||
'wechat request headers must read runtime markers from WEB_VIEW_SOURCE_QUERY',
|
||||
);
|
||||
@@ -4136,11 +4136,22 @@ function assertWechatMiniProgramRouteParity() {
|
||||
|
||||
function assertFileIncludesSnippet(filePath, snippet, label) {
|
||||
const source = fs.readFileSync(filePath, 'utf8');
|
||||
if (!source.includes(snippet)) {
|
||||
if (!sourceIncludesSnippet(source, snippet)) {
|
||||
throw new Error(`${label} must include ${snippet} in ${filePath}`);
|
||||
}
|
||||
}
|
||||
|
||||
function sourceIncludesSnippet(source, snippet) {
|
||||
const compact = (value) =>
|
||||
value
|
||||
.replace(/\s+/g, ' ')
|
||||
.replace(/\s*([()[\]{}])\s*/g, '$1')
|
||||
.replace(/\s*,\s*/g, ',')
|
||||
.replace(/,\)/g, ')')
|
||||
.trim();
|
||||
return source.includes(snippet) || compact(source).includes(compact(snippet));
|
||||
}
|
||||
|
||||
function assertWechatMiniProgramCapabilityFlows() {
|
||||
const protocol = requireCommonJsModule('miniprogram/host-bridge/protocol.js');
|
||||
const declaredCapabilities = protocol.WECHAT_HOST_CAPABILITIES ?? [];
|
||||
@@ -4461,7 +4472,7 @@ function assertWechatAuthFailureBoundaries() {
|
||||
"console.warn('[web-view] read mini program env failed')",
|
||||
'logMiniProgramEnvReadFailure(error)',
|
||||
]) {
|
||||
if (!webViewShellSource.includes(snippet)) {
|
||||
if (!sourceIncludesSnippet(webViewShellSource, snippet)) {
|
||||
throw new Error(
|
||||
`wechat web-view env diagnostics must include ${snippet}`,
|
||||
);
|
||||
@@ -4497,7 +4508,7 @@ function assertWechatAuthFailureBoundaries() {
|
||||
'errorMessage: WECHAT_BIND_PHONE_UNAVAILABLE_MESSAGE',
|
||||
'errorMessage: WECHAT_BIND_PHONE_AUTH_REQUIRED_MESSAGE',
|
||||
]) {
|
||||
if (!webViewShellSource.includes(snippet)) {
|
||||
if (!sourceIncludesSnippet(webViewShellSource, snippet)) {
|
||||
throw new Error(`wechat auth shell must include ${snippet}`);
|
||||
}
|
||||
}
|
||||
@@ -4566,7 +4577,7 @@ function assertWechatWebViewPageEventBoundaries() {
|
||||
"logWebViewPageFailure('load failed', event.detail)",
|
||||
"logWebViewPageEvent('message', event.detail)",
|
||||
]) {
|
||||
if (!webViewShellSource.includes(snippet)) {
|
||||
if (!sourceIncludesSnippet(webViewShellSource, snippet)) {
|
||||
throw new Error(
|
||||
`wechat web-view page event diagnostics must include ${snippet}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user