build/generate.js
function processProto(protoFile, root, imported = []) {
    const protPath = path.format({
        dir: root,
        base: protoFile
    });
    const parser = new ProtoBuf.DotProto.Parser(fs.readFileSync(protPath));
    const protoAst = parser.parse();

    imported.push(protoFile);
    protoAst.imports.forEach(file => {
        if (imported.indexOf(file) === -1) {
            processProto(file, root, imported);
        }
    });

    return Namespace.getNamespace(protoAst.package).update(protoAst);
}
function processProto(protoFile, root, imported = []) {
    const protPath = path.format({
        dir: root,
        base: protoFile
    });
    const parser = new ProtoBuf.DotProto.Parser(fs.readFileSync(protPath));
    const protoAst = parser.parse();

    imported.push(protoFile);
    protoAst.imports.forEach(file => {
        if (imported.indexOf(file) === -1) {
            processProto(file, root, imported);
        }
    });

    return Namespace.getNamespace(protoAst.package).update(protoAst);
}
function processProto ( protoFile , root , imported = [ ] ) { const protPath = path . format ( { dir : root , base : protoFile } ) ; const parser = new ProtoBuf . DotProto . Parser ( fs . readFileSync ( protPath ) ) ; const protoAst = parser . parse ( ) ; imported . push ( protoFile ) ; protoAst . imports . forEach ( file => { if ( imported . indexOf ( file ) === - 1 ) { processProto ( file , root , imported ) ; } } ) ; return Namespace . getNamespace ( protoAst . package ) . update ( protoAst ) ; }
Parses protofile recursively, resolving all imports

To create Nampespace that can be used for generation

@param protoFile
@returns {Namespace}
Parses protofile recursively resolving all imports