Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function compile(sources, language, handleErrors, includeDirs, outDir, importDir){
var rtlCodeWatcher = new RtlCodeUsingWatcher();
var rtl = new makeRTL(language.rtl, rtlCodeWatcher.using.bind(rtlCodeWatcher));
var moduleCode = function(name, imports){
return new ModuleGenerator(name, imports, importDir);};
var compiledFilesStack = [];
var failToCompile = {};
return oc.compileModules(
sources,
function(name){
var fileName = name;
if (!path.extname(fileName).length)
fileName += ".ob";
var alreadyFail = failToCompile[fileName];
if (alreadyFail)
throw new Errors.Error("'" + fileName + "': error " + alreadyFail);
compiledFilesStack.push(fileName);
var readPath = fileName;
var i = 0;
while (!fs.existsSync(readPath) && i < includeDirs.length){
readPath = path.join(includeDirs[i], fileName);