fis-auto-packager
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -25,2 +25,3 @@ | ||
* {"common_asnyc_js" : [pkg1,pkg2]} | ||
* todo : 添加 **.js | ||
*/ | ||
@@ -105,3 +106,3 @@ function createPackConf(resources, sourceDir, outputDir, moduels, projectName){ | ||
} | ||
for(var k=0; j<asyncStatics.length; k++){ | ||
for(var k=0; k<asyncStatics.length; k++){ | ||
var resource = resources[asyncStatics[k]]; | ||
@@ -114,2 +115,4 @@ if(resource){ | ||
} | ||
//统计静态资源的pv | ||
packageReport.printStaticPv(resources, outputDir, projectName); | ||
var staticUrlMapFile = packageReport.createStaticUrlMap(resources, records, outputDir, projectName); | ||
@@ -116,0 +119,0 @@ //资源过滤需要在打包阶段来做,getResource阶段需要拿到完整的列表分析文件间的依赖关系 |
@@ -92,2 +92,37 @@ //todo : 是否需要产出收益分析文档报表 | ||
/** | ||
* 打印出静态资源的使用次数 | ||
* @param resources | ||
*/ | ||
module.exports.printStaticPv = function(resources, outputDir, projectName){ | ||
var statics = {}, | ||
file = outputDir + "/" + projectName + "/" + projectName + "_staticPv.txt", | ||
staticPvStr = ""; | ||
util.map(resources, function(id, resource){ | ||
var type = resource.get("type"); | ||
if(type == "css" || type == "js"){ | ||
if(!statics[resource.get("module")]){ | ||
statics[resource.get("module")] = []; | ||
} | ||
statics[resource.get("module")].push({ | ||
"id" : id, | ||
"pv" : resource.get("pv") | ||
}); | ||
} | ||
}); | ||
util.map(statics, function(module, moduleStatics){ | ||
moduleStatics.sort(function(a, b){ | ||
return b.pv - a.pv; | ||
}); | ||
}); | ||
util.map(statics, function(module, moduleStatics){ | ||
staticPvStr += "模块 " + module + "\n"; | ||
util.map(moduleStatics, function(index, resource){ | ||
staticPvStr += "\t" + resource.id + " : " + resource.pv + "\n"; | ||
}); | ||
}); | ||
util.write(file, staticPvStr); | ||
} | ||
/** | ||
* 产出预测打包后的结果报表 | ||
@@ -94,0 +129,0 @@ * @param records : record对象的数组 |
{ | ||
"name": "fis-auto-packager", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "fis-auto-packager", | ||
@@ -5,0 +5,0 @@ "main": "fis-auto-packager.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
219042
1906