in script/build.ts [47:76]
async function getModeCollectionForType(type: string, toSkip: string[]): Promise<ModeCollection> {
let prefix = type
const prefixFile = path.join(dataDir, type, 'prefix')
if (fs.existsSync(prefixFile)) {
prefix = fs.readFileSync(prefixFile, 'utf8').trim()
}
const collection = new ModeCollection(type, prefix)
const indexFile = path.join(dataDir, type, 'index.ts')
// TODO: log error if file doesn't exist
if (fs.existsSync(indexFile)) {
// TODO: check that modes is an object
const {default: modes} = require(indexFile)
for (const mode in modes) {
if (toSkip.includes(mode)) {
continue
}
const vars = new VariableCollection(mode, prefix, null)
vars.addFromObject(modes[mode])
collection.add(mode, vars)
}
}
collection.finalize()
return collection
}