lib/factories/uipart.factory.js
function getUiPart(modulePath, options) {
        var rootDir = this.injector.rootDir;
        var tplDir = (options && options.tplDir) || 'dist' + delim + 'tpls';
        var pathParts = modulePath.split(delim);
        var appName = pathParts[1];
        var len = modulePath.length;
        var filePath, fullModulePath, uipart, viewObj;

        // filePath has .js, modulePath does not
        if (modulePath.substring(len - 3) === '.js') {
            filePath = rootDir + delim + modulePath;
            fullModulePath = rootDir + delim + modulePath.substring(0, len - 3);
        }
        else {
            filePath = rootDir + delim + modulePath + '.js';
            fullModulePath = rootDir + delim + modulePath;
        }

        // if exists, get it
        if (fs.existsSync(filePath)) {
            uipart = this.injector.require(fullModulePath);
        }
        // else if in an app folder, try the common folder
        else if (appName !== 'common') {
            fullModulePath = fullModulePath.replace(delim + appName + delim, delim + 'common' + delim);
            uipart = this.injector.require(fullModulePath);
            appName = 'common';
        }

        // if no view, check to see if precompiled in tpl dir
        var viewFile = fullModulePath.replace(
            delim + 'app' + delim + appName + delim,
            delim + tplDir + delim + appName + delim
        );
        if (!uipart.view && fs.existsSync(viewFile + '.js')) {
            viewObj = this.injector.require(viewFile);
            uipart.view = function () {
                return viewObj;
            };
        }

        return uipart;
    }
function getUiPart(modulePath, options) {
        var rootDir = this.injector.rootDir;
        var tplDir = (options && options.tplDir) || 'dist' + delim + 'tpls';
        var pathParts = modulePath.split(delim);
        var appName = pathParts[1];
        var len = modulePath.length;
        var filePath, fullModulePath, uipart, viewObj;

        // filePath has .js, modulePath does not
        if (modulePath.substring(len - 3) === '.js') {
            filePath = rootDir + delim + modulePath;
            fullModulePath = rootDir + delim + modulePath.substring(0, len - 3);
        }
        else {
            filePath = rootDir + delim + modulePath + '.js';
            fullModulePath = rootDir + delim + modulePath;
        }

        // if exists, get it
        if (fs.existsSync(filePath)) {
            uipart = this.injector.require(fullModulePath);
        }
        // else if in an app folder, try the common folder
        else if (appName !== 'common') {
            fullModulePath = fullModulePath.replace(delim + appName + delim, delim + 'common' + delim);
            uipart = this.injector.require(fullModulePath);
            appName = 'common';
        }

        // if no view, check to see if precompiled in tpl dir
        var viewFile = fullModulePath.replace(
            delim + 'app' + delim + appName + delim,
            delim + tplDir + delim + appName + delim
        );
        if (!uipart.view && fs.existsSync(viewFile + '.js')) {
            viewObj = this.injector.require(viewFile);
            uipart.view = function () {
                return viewObj;
            };
        }

        return uipart;
    }
function getUiPart ( modulePath , options ) { var rootDir = this . injector . rootDir ; var tplDir = ( options && options . tplDir ) || 'dist' + delim + 'tpls' ; var pathParts = modulePath . split ( delim ) ; var appName = pathParts [ 1 ] ; var len = modulePath . length ; var filePath , fullModulePath , uipart , viewObj ; // filePath has .js, modulePath does not if ( modulePath . substring ( len - 3 ) === '.js' ) { filePath = rootDir + delim + modulePath ; fullModulePath = rootDir + delim + modulePath . substring ( 0 , len - 3 ) ; } else { filePath = rootDir + delim + modulePath + '.js' ; fullModulePath = rootDir + delim + modulePath ; } // if exists, get it if ( fs . existsSync ( filePath ) ) { uipart = this . injector . require ( fullModulePath ) ; } // else if in an app folder, try the common folder else if ( appName !== 'common' ) { fullModulePath = fullModulePath . replace ( delim + appName + delim , delim + 'common' + delim ) ; uipart = this . injector . require ( fullModulePath ) ; appName = 'common' ; } // if no view, check to see if precompiled in tpl dir var viewFile = fullModulePath . replace ( delim + 'app' + delim + appName + delim , delim + tplDir + delim + appName + delim ) ; if ( ! uipart . view && fs . existsSync ( viewFile + '.js' ) ) { viewObj = this . injector . require ( viewFile ) ; uipart . view = function ( ) { return viewObj ; } ; } return uipart ; }
Get a UI Part
@param modulePath
@param options
@returns {*}
Get a UI Part