// SPDX-FileCopyrightText: 2026 Scientific Computing Studio, LLC // SPDX-License-Identifier: Apache-2.0 /** * The engine modules this repository owns, and the file of each that the course receives: * src/engines//.js as written, or dist/engines//.js for a module written in * TypeScript. Shared by engines-diff and engines-export. */ import fs from 'node:fs'; import path from 'node:path'; export const ENGINE_DIRS = ['pseudo', 'asm86', 'shared']; /** Every engine module: { dir, file, label, ours, built }. */ export function engineModules(root) { const out = []; for (const dir of ENGINE_DIRS) { const src = path.join(root, 'src/engines', dir); for (const f of fs.readdirSync(src).sort()) { if (f.endsWith('.js')) out.push({ dir, file: f, label: `src/engines/${dir}/${f}`, ours: path.join(src, f), built: false }); else if (f.endsWith('.ts') && !f.endsWith('.d.ts')) { const js = f.replace(/\.ts$/, '.js'); out.push({ dir, file: js, label: `src/engines/${dir}/${f}`, ours: path.join(root, 'dist/engines', dir, js), built: true }); } } } return out; }