flex-combo
Advanced tools
Comparing version 0.10.2 to 0.10.3
26
api.js
@@ -23,2 +23,3 @@ var urlLib = require("url"); | ||
this.param = Helper.clone(require("./lib/param")); | ||
this.query = {}; | ||
this.cacheDir = pathLib.join(process.cwd(), ".cache"); | ||
@@ -68,3 +69,3 @@ this.result = {}; | ||
return filelist.map(function (i) { | ||
return pathLib.join(base, i).replace(/\\|\/{1,}/g, '/'); | ||
return pathLib.join(base, i); | ||
}); | ||
@@ -96,4 +97,18 @@ } | ||
this.HOST = (req.protocol || "http") + "://" + (req.hostname || req.host || req.headers.host); | ||
// 不用.pathname的原因是由于??combo形式的url,parse方法解析有问题 | ||
this.URL = urlLib.parse(req.url).path.replace(/([^\?])\?[^\?].*$/, "$1"); | ||
this.URL = urlLib.parse(req.url).path.replace(/([^\?])\?[^\?].*$/, function (all, $1, pos, input) { | ||
input.slice(pos + $1.length + 1).split('&').map(function (i) { | ||
var matched = i.match(/(.+)=(.{0,})/); | ||
if (matched) { | ||
this.query[matched[1]] = | ||
(matched[2] == '' || isNaN(matched[2])) | ||
? matched[2] | ||
: matched[2] - 0; | ||
} | ||
}.bind(this)); | ||
return $1; | ||
}.bind(this)); | ||
this.MIME = mime.lookup(this.URL); | ||
@@ -215,3 +230,8 @@ | ||
var engine = this.engines[matchedIndex]; | ||
engine.func(absPath, filteredURL, this.param[engine.path] || {}, function (e, result, realPath, MIME) { | ||
this.query = Helper.merge(true, this.param[engine.path] || {}, this.query); | ||
Helper.Log.color("blue", "\nParams Applied:"); | ||
Helper.Log.color("blue", JSON.stringify(this.query, null, 2)); | ||
engine.func(absPath, filteredURL, this.query, function (e, result, realPath, MIME) { | ||
if (!e) { | ||
@@ -218,0 +238,0 @@ this.MIME = MIME; |
@@ -98,9 +98,14 @@ var fsLib = require("fs"); | ||
var _color = colors[color]; | ||
if (typeof _color == "undefined") { | ||
_color = colors.grey; | ||
} | ||
return [ | ||
wrap ? '·' + new Array(10 - str.length).join(' ') : '', | ||
style ? (prefix + style[0] + 'm') : '', | ||
prefix, color[0], 'm', | ||
prefix, _color[0], 'm', | ||
str, | ||
prefix, color[1], 'm', | ||
prefix, _color[1], 'm', | ||
style ? (prefix + style[1] + 'm') : '', | ||
@@ -116,2 +121,5 @@ wrap ? ' ' : '' | ||
return { | ||
color: function(color, str) { | ||
console.log(colorFull(color, str)); | ||
}, | ||
request: function (host, files) { | ||
@@ -127,3 +135,3 @@ utilLib.info("=> %s %o", host, files); | ||
error: function (input) { | ||
utilLib.logue("%s %s", colorFull(colors.red, "[Error]", colors.inverse), colorFull(colors.red, input)); | ||
utilLib.logue("%s %s", colorFull("red", "[Error]", "inverse"), colorFull("red", input)); | ||
}, | ||
@@ -130,0 +138,0 @@ local: function (url, input) { |
{ | ||
"name": "flex-combo", | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"description": "A combo tool designed for web front-end developer, which support various kinds of combo format by modify configuration(eg. yahoo combo).", | ||
@@ -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
48788
697