fix(uniapp): 修复pages.json虚拟分包导致的微信开发者工具丢失wxml错误,确保13个原生页面物理文件对齐

这个提交包含在:
xcbyy
2026-10-10 08:43:02 +08:00
父节点 c6049f64d9
当前提交 d23975aa3a
共有 2 个文件被更改,包括 15 次插入 和 87 次删除

查看文件

@@ -125,77 +125,6 @@
}
}
],
"subPackages": [
{
"root": "subpackages/expert",
"name": "expert-subpkg",
"pages": [
{
"path": "workspace",
"style": {
"navigationBarTitleText": "大神接单工作台",
"navigationBarBackgroundColor": "#0A0F1D",
"navigationBarTextStyle": "white",
"backgroundColor": "#0A0F1D"
}
},
{
"path": "radar",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "我要接单",
"navigationBarBackgroundColor": "#0A0F1D",
"navigationBarTextStyle": "white",
"backgroundColor": "#0A0F1D"
}
},
{
"path": "hall",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "接单大厅",
"navigationBarBackgroundColor": "#0A0F1D",
"navigationBarTextStyle": "white",
"backgroundColor": "#0A0F1D"
}
}
]
},
{
"root": "subpackages/activity",
"name": "activity-subpkg",
"pages": [
{
"path": "create",
"style": {
"navigationBarTitleText": "我要发单 / 发起组队",
"navigationBarBackgroundColor": "#0A0F1D",
"navigationBarTextStyle": "white",
"backgroundColor": "#0A0F1D"
}
},
{
"path": "my-ticket",
"style": {
"navigationBarTitleText": "我的活动门票",
"navigationBarBackgroundColor": "#0A0F1D",
"navigationBarTextStyle": "white",
"backgroundColor": "#0A0F1D"
}
}
]
}
],
"preloadRule": {
"pages/index/index": {
"network": "all",
"packages": ["subpackages/activity"]
},
"pages/user/index": {
"network": "all",
"packages": ["subpackages/expert"]
}
},
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "陪玩中心",

查看文件

@@ -123,29 +123,28 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安
});
});
describe('4. 小程序主包与分包架构配置规范性验证 (pages.json)', () => {
describe('4. 小程序页面架构配置与文件完整性门禁验证 (pages.json)', () => {
const pagesJsonPath = path.join(rootDir, 'pwuniapp', 'pages.json');
it('pages.json 必须显式配置 subPackages 分包结构', () => {
it('pages.json 注册的所有页面必须在源码目录物理存在,杜绝模拟器启动丢失 wxml 崩溃', () => {
const raw = fs.readFileSync(pagesJsonPath, 'utf-8');
const config = JSON.parse(raw);
expect(Array.isArray(config.subPackages)).toBe(true);
expect(config.subPackages.length).toBeGreaterThanOrEqual(2);
expect(Array.isArray(config.pages)).toBe(true);
expect(config.pages.length).toBe(13);
const roots = config.subPackages.map((s: any) => s.root);
expect(roots).toContain('subpackages/expert');
expect(roots).toContain('subpackages/activity');
for (const pageItem of config.pages) {
const vueFilePath = path.join(rootDir, 'pwuniapp', `${pageItem.path}.vue`);
expect({
path: pageItem.path,
exists: fs.existsSync(vueFilePath)
}).toEqual({
path: pageItem.path,
exists: true
});
}
});
it('必须配置主包向分包的智能预加载规则 preloadRule', () => {
const raw = fs.readFileSync(pagesJsonPath, 'utf-8');
const config = JSON.parse(raw);
expect(config.preloadRule).toBeDefined();
expect(config.preloadRule['pages/index/index']).toBeDefined();
expect(config.preloadRule['pages/user/index']).toBeDefined();
});
it('主包核心 TabBar 页面保持精炼', () => {
it('主包核心 TabBar 页面保持精炼且四大主页全部就绪', () => {
const raw = fs.readFileSync(pagesJsonPath, 'utf-8');
const config = JSON.parse(raw);
const tabPaths = config.tabBar.list.map((t: any) => t.pagePath);