New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flex-combo

Package Overview
Dependencies
Maintainers
4
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-combo - npm Package Compare versions

Comparing version 0.6.13 to 0.6.16

7

api.js

@@ -92,8 +92,3 @@ var urlLib = require("url");

var sass = require("./engines/sass");
try {
return sass.compile.call(this, xcssfile);
}
catch (e) {
return "/* SASS Module ERROR */";
}
return sass.compile.call(this, xcssfile);
}

@@ -100,0 +95,0 @@

102

engines/jstpl.js

@@ -5,61 +5,61 @@ var helper = require("../lib/util");

var method_body = [
"var __escapehtml = {",
"escapehash: {",
"'<': '&lt;',",
"'>': '&gt;',",
"'&': '&amp;',",
"'\"': '&quot;',",
"\"'\": '&#x27;',",
"'/': '&#x2f;'",
"},",
"escapereplace: function(k) {",
"return __escapehtml.escapehash[k];",
"},",
"escaping: function(str) {",
"return typeof(str) !== 'string' ? str : str.replace(/[&<>\"]/igm, this.escapereplace);",
"},",
"detection: function(data) {",
"return typeof(data) === 'undefined' ? '' : data;",
"}",
"};",
"var __escapehtml = {",
"escapehash: {",
"'<': '&lt;',",
"'>': '&gt;',",
"'&': '&amp;',",
"'\"': '&quot;',",
"\"'\": '&#x27;',",
"'/': '&#x2f;'",
"},",
"escapereplace: function(k) {",
"return __escapehtml.escapehash[k];",
"},",
"escaping: function(str) {",
"return typeof(str) !== 'string' ? str : str.replace(/[&<>\"]/igm, this.escapereplace);",
"},",
"detection: function(data) {",
"return typeof(data) === 'undefined' ? '' : data;",
"}",
"};",
"var __throw = function(error) {",
"throw(error);",
"};",
"var __throw = function(error) {",
"throw(error);",
"};",
"_method = _method || {};",
"_method.__escapehtml = __escapehtml;",
"_method.__throw = __throw;"
"_method = _method || {};",
"_method.__escapehtml = __escapehtml;",
"_method.__throw = __throw;"
].join('');
exports.compile = function(htmlfile, _url) {
htmlfile = htmlfile.replace(/\.js$/, '');
exports.compile = function (htmlfile, _url) {
htmlfile = htmlfile.replace(/\.js$/, '');
var tpl = helper.getUnicode(htmlfile);
if (tpl) {
try {
var compiled = juicer(tpl)._render.toString().replace(/^function anonymous[^{]*?{([\s\S]*?)}$/igm, function ($, fn_body) {
return "function(_, _method) {" + method_body + fn_body + "};\n";
});
}
catch (e) {
return null;
}
var tpl = helper.getUnicode(htmlfile);
if (tpl) {
try {
var compiled = juicer(tpl)._render.toString().replace(/^function anonymous[^{]*?{([\s\S]*?)}$/igm, function ($, fn_body) {
return "function(_, _method) {" + method_body + fn_body + "};\n";
});
}
catch (e) {
return null;
}
var wrapper = this.param.define;
var packageName = helper.filteredUrl(_url, this.param.filter);
if (!wrapper || "string" !== typeof wrapper || !!~["window", "global", "self", "parent", "Window", "Global"].indexOf(wrapper)) {
return "window[\"" + packageName + "\"] = " + compiled;
}
else {
if (this.param.anonymous) {
return wrapper + "(function(){return " + compiled + "});";
}
else {
return wrapper + "(\"" + packageName + "\", function () {return " + compiled + "});";
}
}
var wrapper = this.param.define;
var packageName = helper.filteredUrl(_url, this.param.filter);
if (!wrapper || "string" !== typeof wrapper || !!~["window", "global", "self", "parent", "Window", "Global"].indexOf(wrapper)) {
return "window[\"" + packageName + "\"] = " + compiled;
}
else {
if (this.param.anonymous) {
return wrapper + "(function(){return " + compiled + "});";
}
else {
return wrapper + "(\"" + packageName + "\", function () {return " + compiled + "});";
}
}
}
return null;
return null;
};

@@ -1,87 +0,87 @@

var helper = require("../lib/util");
var helper = require("../lib/util");
var pathLib = require("path");
var less = require("less");
var less = require("less");
var utilLib = require("mace")(module);
function Loader() {
this.TREE = {};
this.TREE = {};
this.vars = [];
this.func = [];
this.vars = [];
this.func = [];
}
Loader.prototype = {
constructor: Loader,
check : function (son, parent) {
if (this.TREE[parent] && this.TREE[parent] == -1) {
return true;
constructor: Loader,
check: function (son, parent) {
if (this.TREE[parent] && this.TREE[parent] == -1) {
return true;
}
else if (son == parent) {
return false;
}
else {
return this.check(son, this.TREE[parent]);
}
},
fetch: function (xcssfile, parent) {
if (parent) {
this.TREE[xcssfile] = parent;
}
else {
this.TREE[xcssfile] = -1;
}
var self = this;
var lesstxt = helper.getUnicode(xcssfile);
lesstxt.replace(/^\s{0,}@(.+)\:|^\s{0,}\.(.+)\s{0,}\(.{0,}\)\s{0,}\{[\s\S]*?\}/g, function ($0, $1, $2) {
if ($1) {
if (self.vars.indexOf($1) == -1) {
self.vars.push($1);
}
else if (son == parent) {
return false;
}
else {
return this.check(son, this.TREE[parent]);
utilLib.warn("variable %s is defined!", $1);
}
},
fetch: function (xcssfile, parent) {
if (parent) {
this.TREE[xcssfile] = parent;
}
if ($2) {
if (self.func.indexOf($2) == -1) {
self.func.push($2);
}
else {
this.TREE[xcssfile] = -1;
utilLib.warn("function %s is defined!", $2);
}
}
});
var self = this;
var lesstxt = helper.getUnicode(xcssfile);
lesstxt = lesstxt.replace(/@import\s+(["'])(\S+?)\1;?/mg, function (t, f, relpath) {
var filepath = pathLib.join(pathLib.dirname(xcssfile), relpath);
if (!/\.[a-z]{1,}$/i.test(filepath)) {
filepath += ".less";
}
lesstxt.replace(/^\s{0,}@(.+)\:|^\s{0,}\.(.+)\s{0,}\(.{0,}\)\s{0,}\{[\s\S]*?\}/g, function($0, $1, $2) {
if ($1) {
if (self.vars.indexOf($1) == -1) {
self.vars.push($1);
}
else {
utilLib.warn("variable %s is defined!", $1);
}
}
if ($2) {
if (self.func.indexOf($2) == -1) {
self.func.push($2);
}
else {
utilLib.warn("function %s is defined!", $2);
}
}
});
if (self.check(filepath, xcssfile)) {
return self.fetch(filepath, xcssfile);
}
else {
return "/* Overflow: " + filepath + " */";
}
});
lesstxt = lesstxt.replace(/@import\s+(["'])(\S+?)\1;?/mg, function(t, f, relpath) {
var filepath = pathLib.join(pathLib.dirname(xcssfile), relpath);
if (!/\.[a-z]{1,}$/i.test(filepath)) {
filepath += ".less";
}
if (self.check(filepath, xcssfile)) {
return self.fetch(filepath, xcssfile);
}
else {
return "/* Overflow: "+filepath+" */";
}
});
return lesstxt;
}
return lesstxt;
}
};
exports.compile = function(xcssfile) {
var loader = new Loader();
var lesstxt = loader.fetch(xcssfile);
if (lesstxt) {
return new (less.Parser)({processImports: false})
.parse(lesstxt, function(e, tree) {
if (e) {
return "/* ["+xcssfile+"] LESS COMPILE ERROR! */";
}
return tree.toCSS();
}) + "\n";
}
exports.compile = function (xcssfile) {
var loader = new Loader();
var lesstxt = loader.fetch(xcssfile);
if (lesstxt) {
return new (less.Parser)({processImports: false})
.parse(lesstxt, function (e, tree) {
if (e) {
return "/* [" + xcssfile + "] LESS COMPILE ERROR! */";
}
return tree.toCSS();
}) + "\n";
}
return null;
return null;
};
var helper = require("../lib/util");
var sass = require("node-sass");
exports.compile = function(xcssfile) {
try {
var sass = require("node-sass");
exports.compile = function(xcssfile) {
var sasstxt = helper.getUnicode(xcssfile);
if (sasstxt) {
return sass.renderSync({
data: sasstxt
}) + "\n";
return sass.renderSync({
data: sasstxt
}) + "\n";
}
return null;
};
};
}
catch(e) {
exports.compile = function(xcssfile) {
return "/* node-sass isn't installed\n *"+xcssfile+" ERROR!\n */";
};
}

@@ -12,4 +12,4 @@ /**

// 自定义URL解析规则
fcInst.defineParser(function(url) {
return [];
fcInst.defineParser(function (url) {
return [];
});

@@ -19,13 +19,13 @@

// 例如要加入stylus支持,首先要在配置文件supportedFile中加入相应后缀匹配\\.styl$,然后通过addEngine添加动态编译逻辑
fcInst.addEngine("\\.styl$", function(absPath, url) {
return null;
fcInst.addEngine("\\.styl$", function (absPath, url) {
return null;
});
http.createServer(function(req, res) {
fcInst = new FlexCombo();
fcInst.handle(req, res, function() {
res.writeHead(404, {"Content-Type": "text/plain"});
res.end("Your combo file not found.");
});
http.createServer(function (req, res) {
fcInst = new FlexCombo();
fcInst.handle(req, res, function () {
res.writeHead(404, {"Content-Type": "text/plain"});
res.end("Your combo file not found.");
});
})
.listen(1234);
.listen(1234);

@@ -10,58 +10,58 @@ /**

exports = module.exports = function(cwd, urls, param) {
param = utilLib.merge(true, param, {urls:urls});
exports = module.exports = function (cwd, urls, param) {
param = utilLib.merge(true, param, {urls: urls});
var userHome = process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH; // 兼容windows
var dir = pathLib.join(userHome, ".flex-combo");
var userHome = process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH; // 兼容windows
var dir = pathLib.join(userHome, ".flex-combo");
var fcInst = new FlexCombo(param, dir);
var fcInst;
return function(req, res, next) {
fcInst = new FlexCombo(param, dir);
return function (req, res, next) {
fcInst = new FlexCombo(param, dir);
try {
fcInst.handle(req, res, next);
}
catch (e) {
next();
}
};
try {
fcInst.handle(req, res, next);
}
catch (e) {
next();
}
};
};
exports.enhanced = function(param, dir) {
var fcInst = new FlexCombo(param, dir);
exports.enhanced = function (param, dir) {
var fcInst;
return function() {
fcInst = new FlexCombo(param, dir);
return function () {
fcInst = new FlexCombo(param, dir);
var req, res, next;
switch (arguments.length) {
case 1:
req = this.req;
res = this.res;
next = arguments[0];
break;
case 3:
req = arguments[0];
res = arguments[1];
next = arguments[2];
break;
default:
next = function() {
console.log("Unknown Web Container!");
};
}
var req, res, next;
switch (arguments.length) {
case 1:
req = this.req;
res = this.res;
next = arguments[0];
break;
case 3:
req = arguments[0];
res = arguments[1];
next = arguments[2];
break;
default:
next = function () {
console.log("Unknown Web Container!");
};
}
try {
if (req && res && next) {
fcInst.handle(req, res, next);
}
else {
next();
}
}
catch (e) {
next();
}
try {
if (req && res && next) {
fcInst.handle(req, res, next);
}
else {
next();
}
}
catch (e) {
next();
}
}
};
module.exports = {
urls: {},
hosts: {
"a.tbcdn.cn": "115.238.23.240",
"g.tbcdn.cn": "115.238.23.250",
"s.tbcdn.cn": "115.238.23.198"
},
headers: {},
servlet: '?',
seperator: ',',
charset: "utf-8",
urlBasedCharset: {},
supportedFile: "\\.js$|\\.css$|\\.png$|\\.gif$|\\.jpg$|\\.ico$|\\.swf$|\\.xml$|\\.less$|\\.scss$|\\.svg$|\\.ttf$|\\.eot$|\\.woff$|\\.mp3$",
filter: {
"\\?.+": '',
"-min\\.js$": ".js",
"-min\\.css$": ".css"
},
define: "KISSY.add",
anonymous: false,
debug: false
urls: {},
hosts: {
"a.tbcdn.cn": "115.238.23.240",
"g.tbcdn.cn": "115.238.23.250",
"s.tbcdn.cn": "115.238.23.198"
},
headers: {},
servlet: '?',
seperator: ',',
charset: "utf-8",
urlBasedCharset: {},
supportedFile: "\\.js$|\\.css$|\\.png$|\\.gif$|\\.jpg$|\\.ico$|\\.swf$|\\.xml$|\\.less$|\\.scss$|\\.svg$|\\.ttf$|\\.eot$|\\.woff$|\\.mp3$",
filter: {
"\\?.+": '',
"-min\\.js$": ".js",
"-min\\.css$": ".css"
},
define: "KISSY.add",
anonymous: false,
debug: false
};

@@ -1,4 +0,4 @@

var fsLib = require("fs");
var fsLib = require("fs");
var isUtf8 = require("is-utf8");
var iconv = require("iconv-lite");
var iconv = require("iconv-lite");
var utilLib = require("mace")(module);

@@ -8,23 +8,23 @@

exports.getUnicode = function (filePath) {
if (fsLib.existsSync(filePath)) {
var buff = fsLib.readFileSync(filePath);
return isUtf8(buff) ? buff.toString() : iconv.decode(buff, "gbk");
}
else {
return '';
}
if (fsLib.existsSync(filePath)) {
var buff = fsLib.readFileSync(filePath);
return isUtf8(buff) ? buff.toString() : iconv.decode(buff, "gbk");
}
else {
return '';
}
};
/* 获取应用filter规则后的url */
exports.filteredUrl = function(_url, filter, debug) {
filter = filter || {};
var regx;
for (var fk in filter) {
regx = new RegExp(fk);
if (_url.match(regx)) {
_url = _url.replace(regx, filter[fk]);
debug && utilLib.logue("%s %s Applied: %s", "[Filter]", regx, _url);
}
exports.filteredUrl = function (_url, filter, debug) {
filter = filter || {};
var regx;
for (var fk in filter) {
regx = new RegExp(fk);
if (_url.match(regx)) {
_url = _url.replace(regx, filter[fk]);
debug && utilLib.logue("%s %s Applied: %s", "[Filter]", regx, _url);
}
return _url;
}
return _url;
};
{
"name": "flex-combo",
"version": "0.6.13",
"version": "0.6.16",
"description": "The Flex-combo is combo tool designed for web front-end developer. It support various kinds of combo format by modify configuration(eg. yahoo combo).",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -10,3 +10,3 @@ var readline = require("readline");

rl.question("Do you want to install node-sass? [y/N]", function(answer) {
rl.question(" - Do you want to install node-sass? [y/N]", function(answer) {
if (answer.toLowerCase() == 'y') {

@@ -13,0 +13,0 @@ console.log("node-sass is installing");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc