Comparing version 0.7.10 to 0.8.0
var fsLib = require("fs"); | ||
var isUtf8 = require("is-utf8"); | ||
var iconv = require("iconv-lite"); | ||
var minimatch = require("minimatch"); | ||
@@ -36,29 +37,30 @@ /* 读取文件并返回Unicode编码的字符串,以便在Node.js环境下进行文本处理 */ | ||
exports.wrapper = function (compiled, _url, param) { | ||
var result = ''; | ||
var wrapper = param.define; | ||
var anonymous = param.anonymous; | ||
var packageName = '"' + exports.filteredUrl(_url, param.filter) + '"'; | ||
exports.matchPath = function (path, rules) { | ||
var ret = false; | ||
if (wrapper) { | ||
result = wrapper + '('; | ||
if (rules && rules.length) { | ||
var positive = [], negative = []; | ||
if (!anonymous) { | ||
result += packageName + ','; | ||
} | ||
rules.forEach(function (rule) { | ||
if (/^\!/.test(rule)) { | ||
negative.push(rule); | ||
} | ||
else { | ||
positive.push(rule); | ||
} | ||
}); | ||
if (wrapper == "define") { | ||
result += "function(require,exports,module){module.exports="; | ||
if (positive.length) { | ||
ret = positive.some(function (rule) { | ||
return minimatch(path, rule); | ||
}); | ||
} | ||
else { | ||
result += "function(){return "; | ||
if (negative.length) { | ||
ret &= negative.every(function (rule) { | ||
return minimatch(path, rule); | ||
}); | ||
} | ||
result += compiled + "});"; | ||
} | ||
else { | ||
result = "window[" + packageName + "]=" + compiled; | ||
} | ||
return result; | ||
} | ||
return ret; | ||
}; |
{ | ||
"name": "dac", | ||
"version": "0.7.10", | ||
"version": "0.8.0", | ||
"description": "Dynamic Assets Compiler", | ||
@@ -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
12455
373