转换文件地址 执行顺序：ignore > map > normalize
960114
function (file) {
        if (!this.ignore(file)) {
            file = this.map(file);
            file = utils.normalize(file);
            return file;
        }
    }
1318915
function normalize(result) {
  return {
    relevance: result.relevance || 0,
    language: result.language || null,
    value: result.value || []
  }
}
597375
function normalizeLinks(base, input) {
  if (!input) return;
  if (!Array.isArray(input)) input = [ input ];

  return flatten(input).filter(Boolean).map(function (link) {
    return normalizeLink(base, link);
  });
}
161330
function (files) {
  return files.reduce(function (filesMap, file) {
    let fileName = path.parse(file).name;
    filesMap[fileName] = readFile(file, 'utf8');

    return filesMap;
  }, {});
}
53062
function normalizeUrl(url, options)
{
	var portSuffix;
	url = parseUrl(url, options);
	
	// Remove default port
	if (url.extra.portIsDefault===true && url.port!==null)
	{
		if (isString(url.host) === true)
		{
			portSuffix = ":" + url.port;
			
			// Remove ":123" suffix from host
			if (url.host.substr(-portSuffix.length) === portSuffix)
			{
				url.host = url.host.slice(0, -portSuffix.length);
			}
		}
		
		url.port = null;
	}
	
	url.extra.directory = normalizeDirs(url.extra.directory, url.extra.directoryLeadingSlash).dir;
	
	url.pathname = formatPathname(url);
	
	// Remove empty query
	if (url.search === "?")
	{
		url.search = null;
		
		if (url.query==="?" || url.query==="") url.query = null;
	}
	
	// TODO :: remove empty hashes ("path#") ?
	
	url.path = formatPath(url);
	
	url.href = urllib.format(url);
	
	return url;
}
283842
function replaceUrlHandler(p, options, buildInfo, destMaps, filepath) {
        var tmp = p;
        //去除?之后面路径
        if(p.indexOf('?') > -1) tmp = p.substr(0, p.indexOf('?'));
        
        var ext = path.extname(tmp);
        var dest = destMaps[ext] || options.destPath;
        var fpath = path.normalize(path.join(dest, tmp));
        var info = buildInfo[fpath];
        if(!info) {
            fpath = path.join(options.destPath, tmp);
            info = buildInfo[fpath];
        }

        //如果上面的都不可以，则有可能是相对路径，
        if(!buildInfo[fpath] && filepath) {
            fpath = path.normalize(path.join(path.dirname(filepath), tmp));
            info = buildInfo[fpath];
        }

        if(info && info.path) {
            tmp =  path.dirname(tmp) + '/' + path.basename(info.path);
            //如果后续还有?部门，也截取到tmp中
            if(p.indexOf('?') > -1) {
                tmp += p.substr(p.indexOf('?'));
            }
        }

        //如果有md5码，且路径中需要替换md5,则替换。
        if(info && info.md5 && tmp.indexOf('{md5}') > -1) {
            tmp = tmp.replace('{md5}', info.md5);
        }

        //只有找到相关信息才采用更改后的
        if(info) p = tmp;

        p = replaceUrlMap(p, options.urlMaps);
        return p;
    }
885298
static public String normalize(String path, int format) {

        // if normalize is off, just return
        if (NORMALIZE_OFF == format || null == path) {
            return path;
        }
        String normalizedString = path;
        int len = path.length();
        // if there's no data, just return
        if (0 != len) {
            char[] buf = new char[len];
            path.getChars(0, len, buf, 0);
            for (int index = 0; index < len; index++) {
                buf[index] = normalize(buf[index], format);
            }
            normalizedString = new String(buf, 0, len);
        }

        return normalizedString;
    }
470250
function(sources, reg) {
        /*如果原文件中有责返回该文件*/
        if (src[reg]) {
            return [src[reg]];
        } else if (reg === '**') {
            // do nothing
        } else if (typeof reg === 'string') {
            reg = _.glob(reg);
        }
        return sources.filter(function(file) {
            reg.lastIndex = 0;
            return (reg === '**' ||
            reg.test(file.subpath))
        });
    }
1218178
function ( map, files ) {
            var arr = [];

            files.forEach( function ( file ) {
              arr.push( '\'' + file + '\'=>\'' + map[ file ] + '\'' );
            });

            var out = '<?php\n\n$files = [\n\t' + arr.join( ',\n\t' ) + '\n];\n';

            grunt.file.write( 'tmp/map.php', out );
            grunt.file.write( 'tmp/map.json', JSON.stringify( map ) );
          }
643257
function normalizeUrl(url, pathStripRe) {
  if (url.indexOf('/') !== -1) {
    return url.replace(/^file\:\/\//, '').replace(pathStripRe, '');
  } else {
    return '/' + url;
  }
}
1283778
function (output) {
              // Manually convert paths to relative, because LESS
              // can make tose absolute for complex cases.
              var map = JSON.parse(output);
              var dir = path.dirname(context.pathname);
              map.sources.forEach(function (file, idx) {
                var rel = path.relative(dir, file);
                if (path.sep === '\\') { rel = rel.replace('\\', '/'); }
                map.sources[idx] = rel;
              });

              self.map = JSON.stringify(map);
            }
982144
function(subPath, tokenMap, ignoreRegex) {
                if (typeof subPath !== 'string' || subPath.length === 0) {
                    return _folderPath;
                }
                tokenMap = tokenMap || {};
                ignoreRegex = !! ignoreRegex;

                var transform = _utils.getTransformer(tokenMap, ignoreRegex);
                subPath = transform(subPath);
                return _path.join(_folderPath, subPath);
            }
727003
function normalize( id, baseId ) {
        if ( !id ) {
            return '';
        }

        baseId = baseId || '';
        var idInfo = parseId( id );
        if ( !idInfo ) {
            return id;
        }

        var resourceId = idInfo.resource;
        var moduleId = relative2absolute( idInfo.module, baseId );

        each(
            packagesIndex,
            function ( packageConf ) {
                var name = packageConf.name;
                if ( name === moduleId ) {
                    moduleId = name + '/' + packageConf.main;
                    return false;
                }
            }
        );

        // 根据config中的map配置进行module id mapping
        each(
            mappingIdIndex,
            function ( item ) {
                if ( item.reg.test( baseId ) ) {

                    each( item.v, function ( mapData ) {
                        var key = mapData.k;
                        var rule = createPrefixRegexp( key );

                        if ( rule.test( moduleId ) ) {
                            moduleId = moduleId.replace( key, mapData.v );
                            return false;
                        }
                    } );

                    return false;
                }
            }
        );

        if ( resourceId ) {
            var module = modGetModuleExports( moduleId );
            resourceId = module.normalize
                ? module.normalize(
                    resourceId,
                    function ( resId ) {
                        return normalize( resId, baseId );
                    }
                  )
                : normalize( resourceId, baseId );

            moduleId += '!' + resourceId;
        }

        return moduleId;
    }
433133
function normalizeUrl(url, pathStripRe) {
  const normUrl = url.replace(/^file\:\/\//, '').replace(pathStripRe, '');
  if (normUrl.indexOf('/') !== 0) {
    return 'app:///' + normUrl;
  }
  return 'app://' + normUrl;
}
103024
function map(opts, callback) {
    if(utils.isArray(opts)) {
        mapWithArrayInput(opts, callback);
        return;
    }
    opts = normalize(opts);
    // Assume that the root is a folder
    var root = new fp.Folder(opts.path);

    var sent = false;
    root.__listen('error', function (err) {
        if (!sent) {
            callback(err);
            sent = true;
        }
    });
    root.__listen('missing', function (err) {
        if (!sent) {
            callback(err);
            sent = true;
        }
    });
    root.__stats(function (err, stats) {
        if (err) {
            if (!sent) {
                callback(err);
            }
            return;
        }

        // If the root is a file simply return it
        if (!stats.isDirectory()) {
            callback(null, new fp.File(opts.path));
            return;
        }

        // Add functions
        addMaping(root);

        if(typeof opts.simple !== 'number' || !opts.recursive) {
            root.__map(opts, callback);
        } else {
            var lvls = opts.simple;
            var type = opts.type;
            var ext = opts.ext;
            opts.recursive = false;
            opts.simple = true;
            if(opts.type === 'file') {
                delete opts.type;
            }
            if(opts.ext) {
                delete opts.ext;
            }
            root.__map(opts, function (err, map) {
                if(err) {
                    callback(err);
                    return;
                }

                simpleMap(map, lvls, opts, type, ext, callback);
            });
        }
    });
}
189399
function () {
            var args = S.makeArray(arguments);
            return Path.normalize(S.filter(args,function (p) {
                return p && (typeof p == 'string');
            }).join('/'));
        }
1178545
function removeOtherFile(TPL,ctx)
{
    let params = TPL.params;
    let files = ctx.files;
    for(let item in files){
        if(!params[item]){
            fs.unlink(files[item].path,(err)=>{
                err && console.error('删除文件失败',files[f])
            });//异步清除临时目录中的上传文件
        }
    }
}