1. add debug logs for diy component lifecycle and data flow 2. add required HAR dependency declarations for mp-harmony entry module 3. add har-deps config, validation script and documentation
63 lines
2.9 KiB
Plaintext
63 lines
2.9 KiB
Plaintext
{
|
|
// ============================================================================
|
|
// 鸿蒙元服务 entry 模块的必需 HAR 依赖白名单
|
|
//
|
|
// 背景:
|
|
// mp-harmony 项目把 uniapp 编译产物拆成了 6 个鸿蒙模块:
|
|
// - entry (主入口 HAP, 由 DevEco 编译)
|
|
// - components_diy (50+ diy-* 组件的 pack.js, shared HAR)
|
|
// - pages_goods (商品分类/详情/列表/购物车, shared HAR)
|
|
// - pages_order (订单相关页面, shared HAR)
|
|
// - pages_promotion (分销/积分/商户等营销页面, shared HAR)
|
|
// - pages_tool (会员/支付/客服/工具页, shared HAR)
|
|
//
|
|
// entry 的 module.json 默认只会声明 oh-package.json5 里 dependencies 中的 HAR
|
|
// 作为 module dependencies。如果这里不显式声明, 鸿蒙运行时会找不到
|
|
// components-diy/diy-group.pack.js 等子包 chunk,
|
|
// DIY 首页 / 商品分类 / 订单 / 营销页 全部被 componentPlaceholder fallback 成 <view>,
|
|
// 表现为: 首页 DIY 内容不显示, 12s splash 兜底超时, TabBar 点击无反应。
|
|
//
|
|
// 必须:
|
|
// entry/oh-package.json5 的 dependencies 必须保留以下 5 个 file: 依赖。
|
|
// 不要轻易删除, 删除前请先和 ascf 子包负责人对齐。
|
|
//
|
|
// 验证:
|
|
// 执行 `node scripts/check-har-deps.js` 校验当前 module.json 是否包含这些依赖。
|
|
// ============================================================================
|
|
requiredHarDeps: [
|
|
"components_diy",
|
|
"pages_goods",
|
|
"pages_order",
|
|
"pages_promotion",
|
|
"pages_tool",
|
|
],
|
|
|
|
// oh-package.json5 里依赖声明的预期 source 字符串
|
|
// (DevEco/ohpm 解析后会规范化, 这里保留原始声明便于核对)
|
|
expectedDependencySources: {
|
|
components_diy: "file:../ascf/ascf_build/components_diy",
|
|
pages_goods: "file:../ascf/ascf_build/pages_goods",
|
|
pages_order: "file:../ascf/ascf_build/pages_order",
|
|
pages_promotion: "file:../ascf/ascf_build/pages_promotion",
|
|
pages_tool: "file:../ascf/ascf_build/pages_tool",
|
|
},
|
|
|
|
// 校验脚本要扫描的产物路径 (相对 entry 目录)
|
|
buildArtifacts: {
|
|
moduleJson: "build/default/intermediates/package/default/module.json",
|
|
},
|
|
|
|
// oh_modules 子包内 rawfile 根目录映射 (用于 --rawfile 检查)
|
|
// 子包 HAR 通过 ohpm 同步后落在 entry/oh_modules/<pkg>/src/main/resources/rawfile/<root>/
|
|
// HAR 资源在运行时由鸿蒙端通过 HAR 共享机制加载, 不是 entry 的 rawfile 路径
|
|
ohModulesRoots: {
|
|
components_diy: {
|
|
pkg: "components_diy",
|
|
root: "components-diy",
|
|
},
|
|
pages_goods: { pkg: "pages_goods", root: "pages_goods" },
|
|
pages_order: { pkg: "pages_order", root: "pages_order" },
|
|
pages_promotion:{ pkg: "pages_promotion",root: "pages_promotion" },
|
|
pages_tool: { pkg: "pages_tool", root: "pages_tool" },
|
|
},
|
|
} |