Parses a resource name into its component parts. Resource names
look like: module/name.ext
@param {String} name the resource name
@returns {Object} with properties "moduleName", "ext".
function parseName(name) {
        var modName = undefined,
            ext = undefined,
            temp = undefined,
            index = name.indexOf('.'),
            isRelative = name.indexOf('./') === 0 || name.indexOf('../') === 0;

        if (index !== -1 && (!isRelative || index > 1)) {
            modName = name.substring(0, index);
            ext = name.substring(index + 1, name.length);
        } else {
            modName = name;
        }

        temp = ext || modName;
        index = temp.indexOf('!');
        if (index !== -1) {
            temp = temp.substring(0, index);
            if (ext) {
                ext = temp;
            } else {
                modName = temp;
            }
        }

        return {
            moduleName: modName,
            ext: ext
        };
    }