How to use the oc.js.compileModules function in oc

To help you get started, we’ve selected a few oc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vladfolts / oberonjs / src / nodejs.js View on Github external
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);

oc

A framework for developing and distributing html components

MIT
Latest version published 2 months ago

Package Health Score

75 / 100
Full package analysis