chore: 重新整理依赖及revert lang.js
This commit is contained in:
@@ -489,27 +489,36 @@ function isBundleComplete(tree) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2) tree 不能是空对象(空对象没有任何可用文案, 显然不可用)
|
// 2) tree 不能是空对象(空对象没有 common 也没有 components, 显然不可用)
|
||||||
const treeKeys = Object.keys(tree);
|
const treeKeys = Object.keys(tree);
|
||||||
if (treeKeys.length === 0) {
|
if (treeKeys.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// === 粗粒度校验(与上方设计哲学一致) ===
|
// 3) tree 必须有 common 节点(基础文案, 几乎所有 UI 都依赖)
|
||||||
// 不再硬性要求 common / components 节点必须同时存在。
|
if (!tree.common || typeof tree.common !== 'object') {
|
||||||
// 远端可能在某些时刻少发某个节点(部署期间、缓存未刷新、租户未配置 common 等),
|
return false;
|
||||||
// 此时仍应让 boot 成功写入 remoteTreeCache, 缺失字段由 $lang() 自然回落为空,
|
|
||||||
// UI 降级显示(空文案/空按钮文字), 而不是让整个 boot 失败导致整站变英文 / raw key。
|
|
||||||
|
|
||||||
// 软校验: components.privacyPopup(节点存在才检查, 避免 tree.components 为 undefined 时报错)
|
|
||||||
const privacyPopup = tree.components && tree.components.privacyPopup;
|
|
||||||
if (privacyPopup && typeof privacyPopup === 'object') {
|
|
||||||
// defaultAppNameMp 存在性仅作诊断, 不阻止 boot
|
|
||||||
if (typeof privacyPopup.defaultAppNameMp !== 'string' || !privacyPopup.defaultAppNameMp) {
|
|
||||||
// 软校验不阻止 boot, 仅记录(暂无控制台输出, 避免污染生产)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4) tree 必须有 components 节点(组件级文案)
|
||||||
|
if (!tree.components || typeof tree.components !== 'object') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === 以下为软校验(只 warn 不 return false) ===
|
||||||
|
// 设计: 不再因为"缺某个 key"就让整个 boot 失败
|
||||||
|
// 缺失的字段让 $lang() 自然返回空, UI 降级显示
|
||||||
|
|
||||||
|
// 软校验 1: components.privacyPopup
|
||||||
|
const privacyPopup = tree.components.privacyPopup;
|
||||||
|
if (!privacyPopup || typeof privacyPopup !== 'object') {
|
||||||
|
// 软校验不阻止 boot, 仅记录(暂无控制台输出, 避免污染生产)
|
||||||
|
} else if (typeof privacyPopup.defaultAppNameMp !== 'string' || !privacyPopup.defaultAppNameMp) {
|
||||||
|
// 软校验不阻止 boot, 仅记录(暂无控制台输出, 避免污染生产)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 软校验 2: 哪些 key 看起来像隐私弹窗,但在错误位置?(诊断)
|
||||||
|
// 此处仅保留注释说明, 不在生产代码中输出
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,7 @@
|
|||||||
"zion-uniapp-mp-load-package": "^1.0.13"
|
"zion-uniapp-mp-load-package": "^1.0.13"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jweixin-module": "^1.6.0",
|
"jweixin-module": "^1.6.0"
|
||||||
"playwright-core": "^1.63.0"
|
|
||||||
},
|
},
|
||||||
"uni-app": {
|
"uni-app": {
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user