Comparing version 1.1.4 to 1.1.5
@@ -40,3 +40,3 @@ var esprima = require('esprima'); | ||
function addWrapper(ast, vname) { | ||
var ns = alp.config.get('ns'), | ||
@@ -49,5 +49,5 @@ wrapper = [], | ||
//vname && wrapper.push('var ' + vname + '= '+exports+' = {};' + exports + '=' + vname + 'Extend(' + exports + ',' + vname + ');function ' + vname + 'Extend(target,source){target = target || {};source =source || {};for(var i in source){target[i] = source[i];}return target;}') | ||
vname && wrapper.push(exports+' = '+exports+' || {};'); | ||
vname && wrapper.push(exports + ' = ' + exports + ' || {};'); | ||
wrapper.push('})(' + ns + ');'); | ||
@@ -339,13 +339,13 @@ | ||
exports = buildExportsAst(_eId); | ||
exports = buildExportsAst(_eId); | ||
exportStr = ns + '.' + _eId; | ||
exportStr = ns + '.' + _eId; | ||
/*if (pType === Syntax.MemberExpression) { | ||
/*if (pType === Syntax.MemberExpression) { | ||
return buildExportsAst(null,_eId); | ||
return buildExportsAst(null,_eId); | ||
}*/ | ||
}*/ | ||
return exports; | ||
return exports; | ||
@@ -412,3 +412,3 @@ //} | ||
var content, isMinifile = alp.config.get('optimizer'); | ||
var escodegenOptions = {}; | ||
if (obj.content) { | ||
@@ -419,3 +419,14 @@ content = obj.content; | ||
//content = escodegen.generate(obj.ast).replace(/;;/gi, ""); | ||
content = escodegen.generate(obj.ast); | ||
if (isMinifile) { | ||
escodegenOptions = { | ||
format: { | ||
indent: { | ||
style: '', | ||
base: 0 | ||
}, | ||
newline: '' | ||
} | ||
} | ||
} | ||
content = escodegen.generate(obj.ast,escodegenOptions); | ||
content = content.replace(/(,\s*(<<<require>>>)\s*(?=;?))|(<<<require>>>\s*,?)/gim, ""); | ||
@@ -426,8 +437,10 @@ | ||
if (isMinifile) { | ||
if (!_.is(minCb, 'function')) { | ||
/*if (!_.is(minCb, 'function')) { | ||
minCb = minFile; | ||
} | ||
content = content.replace(/(;,)/gi, ""); | ||
return minCb(content, !!obj.content); | ||
}*/ | ||
content = content.replace(/[;,][\s\n\r]*(?=[;,])/gi,""); | ||
return content; | ||
//return minCb(content, !!obj.content); | ||
} else { | ||
@@ -434,0 +447,0 @@ return content.replace(/([\s\n\r]+);/gi, ""); |
{ | ||
"name": "alpaca-sm", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "分析Html文件依赖的js文件和css文件", | ||
@@ -5,0 +5,0 @@ "main": "index.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
40136
1360