// Design-contract checks, not a substitute for browser acceptance. const fs=require('node:fs'),path=require('node:path'),assert=require('node:assert/strict'); const root=path.resolve(__dirname,'../..'),compiler=require(path.join(root,'ruoyi-ui/node_modules/vue-template-compiler')); const read=p=>fs.readFileSync(path.join(root,'ruoyi-ui/src',p),'utf8'); const targets=['components/BusinessPageHeader/index.vue','views/businessHome/index.vue','views/project/info/index.vue','views/project/detail/index.vue','components/ProjectWorkspace/index.vue','components/ProjectWorkspace/Budget.vue','components/ProjectWorkspace/Costs.vue','components/ProjectLoans/index.vue','components/BomEditor/ProjectProducts.vue','components/SupplierPicker/index.vue','components/Production/ActionDialog.vue','components/Production/ActionHistory.vue','components/Production/BatchActions.vue','components/Production/StockOperations.vue','views/warehouse/pending/index.vue','views/warehouse/loans/index.vue','views/warehouse/suppliers/index.vue','views/warehouse/inRecord/index.vue','views/warehouse/outRecord/index.vue','views/warehouse/stock/index.vue','views/warehouse/purchase/index.vue','views/warehouse/arrival/index.vue','views/warehouse/product/index.vue','views/warehouse/area/index.vue','views/warehouse/stockCheck/index.vue','views/production/product/index.vue','views/production/bom/index.vue','views/production/tasks/index.vue','views/production/cost/index.vue','views/production/operations/index.vue','views/system/businessDictionaries/index.vue','views/system/initialization/index.vue','views/system/user/index.vue','views/system/role/index.vue','views/system/menu/index.vue','views/monitor/operlog/index.vue']; targets.push('components/InventoryAssistant/index.vue','components/BomEditor/index.vue','components/BomEditor/ProductPicker.vue'); assert.ok(!read('layout/components/AppMain.vue').includes('name="fade-transform"'),'business pages must not animate flex/min-height while entering'); for(const p of targets){const parsed=compiler.parseComponent(read(p));assert.ok(parsed.template,p+' template missing');const result=compiler.compile(parsed.template.content);assert.equal(result.errors.length,0,p+': '+result.errors.join(';'));} const workspace=read('components/ProjectWorkspace/index.vue'); for(const label of ['总览','分类预算','产品与BOM','采购','库存','借用与归还','生产','成本与损耗'])assert.ok(workspace.includes(`label="${label}"`),'missing tab '+label); for(const component of ['project-budget','project-products','purchase-page','stock-page','project-loans','production-tasks','project-costs'])assert.ok(workspace.includes('<'+component),'missing embedded business '+component); assert.ok(!workspace.includes('查看 / 维护项目产品与BOM')); const purchase=read('views/warehouse/purchase/index.vue');assert.ok(!purchase.includes('@row-click="openDetail"'));assert.ok(!purchase.includes('