VulpesOS/tools/amd-module-range.cjs
OverSu 1311bed5e9 Release Preview 20 shared desktop, Android and Sargo updates
Restore Gaia settings and media workflows, extend native network adapters, and align the APK payload. Generate French/English changelogs and website entries from the simplified JSON source.

Validation: shared JS and Tundra unit tests; desktop workflows and persistence; signed APK payload parity; Sargo RAM and installed startup with boot readback. Android runtime qualification is recorded separately.
2026-10-13 00:19:45 +02:00

14 lines
780 B
JavaScript

// Locate an AMD definition without swallowing surrounding require() callbacks.
const fs=require('node:fs'), esprima=require('esprima');
const [path,name]=process.argv.slice(2), source=fs.readFileSync(path,'utf8');
let result;
function visit(node) {
if(!node || typeof node!=='object')return;
if(node.type==='CallExpression' && node.callee.type==='Identifier' && node.callee.name==='define' && node.arguments[0]?.value===name)result=node.range;
for(const [key,value] of Object.entries(node))if(key!=='range') {
if(Array.isArray(value))value.forEach(visit);else visit(value);
}
}
visit(esprima.parseScript(source,{range:true}));
if(result)while(result[1]<source.length && /[;\s]/.test(source[result[1]]))result[1]++;
process.stdout.write(JSON.stringify(result||null));