test/widget-main/bower_components/base/scripts/require-widget.js
// converts module path relative to it's index.html to path relative to portal's static dir
converts module path relative to it's index.html to path relative to portal's static dir
converts module path relative to it ' s index . html to path relative to portal ' s static dir
function normalizePath(rootPath, staticPath, path) {
        try {
            path = trim(path);
            var isAbsolute = new RegExp('^((https?|file)://|/)', 'i');
            if (!isAbsolute.test(path)) {
                path = path.replace(/.js$/, '');
            }
            path = rootPath
                .replace(/[^\/]*$/, '')
                .replace(new RegExp('^' + staticPath), '') + path;
        } catch (err) {
            console.log('Error while normalizing module path.');
            throw err;
        }
        return path;
    }
function normalizePath ( rootPath , staticPath , path ) { try { path = trim ( path ) ; var isAbsolute = new RegExp ( '^((https?|file)://|/)' , 'i' ) ; if ( ! isAbsolute . test ( path ) ) { path = path . replace ( / .js$ / , '' ) ; } path = rootPath . replace ( / [^\/]*$ / , '' ) . replace ( new RegExp ( '^' + staticPath ) , '' ) + path ; } catch ( err ) { console . log ( 'Error while normalizing module path.' ) ; throw err ; } return path ; }
converts module path relative to it's index.html to path relative to portal's static dir
converts module path relative to it ' s index . html to path relative to portal ' s static dir
// remove .js from the module path if path is not absolute // remove slashes from the end of path // remove static dir from absolute path