Initial commit with translated description

This commit is contained in:
2026-03-29 08:33:08 +08:00
commit a9c97c9562
98 changed files with 23152 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
// Usage: node scripts/validate-modules.js ./src/evolve ./src/gep/solidify
// Validates that each module (1) loads without errors, (2) exports something
// meaningful, and (3) exported functions are callable (typeof check).
const path = require('path');
const modules = process.argv.slice(2);
if (!modules.length) { console.error('No modules specified'); process.exit(1); }
let checked = 0;
for (const m of modules) {
const resolved = path.resolve(m);
const exported = require(resolved);
if (exported === undefined || exported === null) {
console.error('FAIL: ' + m + ' exports null/undefined');
process.exit(1);
}
const t = typeof exported;
if (t === 'object' && Object.keys(exported).length === 0) {
console.error('FAIL: ' + m + ' exports an empty object (no public API)');
process.exit(1);
}
if (t === 'object') {
const keys = Object.keys(exported);
for (const k of keys) {
if (typeof exported[k] === 'function') {
if (typeof exported[k] !== 'function') {
console.error('FAIL: ' + m + '.' + k + ' is declared but not a callable function');
process.exit(1);
}
}
}
}
checked++;
}
console.log('ok: ' + checked + ' module(s) validated');