/** XHS owns its existing tool catalog. No cross-platform import or regeneration. */ import fs from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' import vm from 'node:vm' const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..') const tool = path.join(root, 'tool') for (const file of ['portal-data.js', 'book/book-data.js', 'book/markdown.js', 'icons']) { if (!fs.existsSync(path.join(tool, file))) throw new Error(`Missing XHS-owned input: ${file}; restore the XHS source, never import a sibling project`) } const context = {} vm.runInNewContext(fs.readFileSync(path.join(tool, 'portal-data.js'), 'utf8'), context, { timeout: 1000 }) if (!context.PORTAL_DATA || !context.PORTAL_DATA.nav || !context.PORTAL_DATA.book) throw new Error('Invalid XHS portal catalog') console.log('[xhs] Local portal/book catalogs validated; no other project read or modified.')