import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' import { parse, compileScript, compileTemplate } from '@vue/compiler-sfc' const files = [ 'src/modules/cockpit/components/MapCanvas.vue', 'src/modules/cockpit/components/PipeEnhancement.vue', 'src/modules/cockpit/CockpitShell.vue', ] for (const file of files) { const source = readFileSync(file, 'utf8') const { descriptor } = parse(source, { filename: file }) const script = compileScript(descriptor, { id: `t23-${file}` }) const template = compileTemplate({ source: descriptor.template.content, filename: file, id: `t23-${file}`, compilerOptions: { bindingMetadata: script.bindings } }) assert.deepEqual(template.errors, [], `${file} template errors`) console.log(`PASS ${file}`) } const shellSource = readFileSync('src/modules/cockpit/CockpitShell.vue', 'utf8') assert.match(shellSource, /@pipeline-pick="selectPipeEnhancement"/) assert.match(shellSource, /]*:plan="pipeEnhancementPlan"[^>]*@close="closePipeEnhancement"\s*\/>/) assert.match(shellSource, /visiblePipes: modeLayerPlan\.value\.pipelines/) assert.match(shellSource, /visibleComponents: modeLayerPlan\.value\.facilities/) assert.match(shellSource, /usePipeEnhancementStore/) assert.match(shellSource, /pipeEnhancementStore\.clear\(\)/) console.log('PASS CockpitShell Three.js and Pinia public seam') const enhancementSource = readFileSync('src/modules/cockpit/components/PipeEnhancement.vue', 'utf8') assert.match(enhancementSource, /mountGeneration/) assert.match(enhancementSource, /generation !== mountGeneration/) assert.match(enhancementSource, /JSON\.stringify\(\[props\.plan\.object/) console.log('PASS Pinia selection and async mount guards') console.log(`T23 SFC compile: ${files.length + 2}/${files.length + 2}`)