lib/config-generator.js
function(file) {
        var self = this;

        var ext;

        if (!self._options.keepExtension) {
            ext = self._options.extension || path.extname(file);
        }

        var fileName = path.basename(file, ext);

        if (self._options.format) {
            var formatRegex = self._options.format[0].split('/');
            formatRegex = new RegExp(formatRegex[1], formatRegex[2]);

            var replaceValue = self._options.format[1];

            fileName = fileName.replace(formatRegex, replaceValue);
        }

        var moduleConfig = {
            name: '',
            version: '1.0.0'
        };

        if (self._options.moduleConfig) {
            if (typeof self._options.moduleConfig === 'string') {
                var fileModuleConfig = path.resolve(self._options.moduleConfig);

                if (fs.existsSync(fileModuleConfig)) {
                    moduleConfig = require(fileModuleConfig);
                }
            } else {
                moduleConfig = self._options.moduleConfig;
            }
        }

        fileName = path.join(path.dirname(file), fileName);

        var moduleName = '';

        if (moduleConfig.name) {
            moduleName = moduleConfig.name + '@' + moduleConfig.version;
        }

        moduleName = path.join(moduleName, fileName.substring(self._options.moduleRoot.length));

        if (self._options.lowerCase) {
            moduleName = moduleName.toLowerCase();
        }

        return upath.toUnix(moduleName);
    }
function(file) {
        var self = this;

        var ext;

        if (!self._options.keepExtension) {
            ext = self._options.extension || path.extname(file);
        }

        var fileName = path.basename(file, ext);

        if (self._options.format) {
            var formatRegex = self._options.format[0].split('/');
            formatRegex = new RegExp(formatRegex[1], formatRegex[2]);

            var replaceValue = self._options.format[1];

            fileName = fileName.replace(formatRegex, replaceValue);
        }

        var moduleConfig = {
            name: '',
            version: '1.0.0'
        };

        if (self._options.moduleConfig) {
            if (typeof self._options.moduleConfig === 'string') {
                var fileModuleConfig = path.resolve(self._options.moduleConfig);

                if (fs.existsSync(fileModuleConfig)) {
                    moduleConfig = require(fileModuleConfig);
                }
            } else {
                moduleConfig = self._options.moduleConfig;
            }
        }

        fileName = path.join(path.dirname(file), fileName);

        var moduleName = '';

        if (moduleConfig.name) {
            moduleName = moduleConfig.name + '@' + moduleConfig.version;
        }

        moduleName = path.join(moduleName, fileName.substring(self._options.moduleRoot.length));

        if (self._options.lowerCase) {
            moduleName = moduleName.toLowerCase();
        }

        return upath.toUnix(moduleName);
    }
function ( file ) { var self = this ; var ext ; if ( ! self . _options . keepExtension ) { ext = self . _options . extension || path . extname ( file ) ; } var fileName = path . basename ( file , ext ) ; if ( self . _options . format ) { var formatRegex = self . _options . format [ 0 ] . split ( '/' ) ; formatRegex = new RegExp ( formatRegex [ 1 ] , formatRegex [ 2 ] ) ; var replaceValue = self . _options . format [ 1 ] ; fileName = fileName . replace ( formatRegex , replaceValue ) ; } var moduleConfig = { name : '' , version : '1.0.0' } ; if ( self . _options . moduleConfig ) { if ( typeof self . _options . moduleConfig === 'string' ) { var fileModuleConfig = path . resolve ( self . _options . moduleConfig ) ; if ( fs . existsSync ( fileModuleConfig ) ) { moduleConfig = require ( fileModuleConfig ) ; } } else { moduleConfig = self . _options . moduleConfig ; } } fileName = path . join ( path . dirname ( file ) , fileName ) ; var moduleName = '' ; if ( moduleConfig . name ) { moduleName = moduleConfig . name + '@' + moduleConfig . version ; } moduleName = path . join ( moduleName , fileName . substring ( self . _options . moduleRoot . length ) ) ; if ( self . _options . lowerCase ) { moduleName = moduleName . toLowerCase ( ) ; } return upath . toUnix ( moduleName ) ; }
Generates a module name in case it is not present in the AMD definition.

@method _generateModuleName
@protected
@param {String} file The file path to be processed and module name to be generated
@return {String} The generated module name
Generates a module name in case it is not present in the AMD definition .