Huge News!Announcing our $40M Series B led by Abstract Ventures.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.8.6 to 0.9.0

25

api.js

@@ -98,16 +98,3 @@ var urlLib = require("url");

},
engines: [
{
rule: "\\.less$|\\.less\\.css$",
func: require("./engines/less")
},
{
rule: "\\.scss$|\\.scss\\.css$",
func: require("./engines/sass")
},
{
rule: "\\.jpl$|\\.html.js$|\\.tpl.js$",
func: require("./engines/jpl")
}
],
engines: [],
addEngine: function (rule, func) {

@@ -196,3 +183,3 @@ if (rule && typeof func == "function") {

buildRequestOption: function (url) {
if (this.req.headers["x-via"] == "flex-combo") {
if (this.req.headers["x-broker"] == "flex-combo") {
return false;

@@ -216,2 +203,6 @@ }

if (reqHostIP == reqHostName && this.req.url.match(/favicon\.ico$/)) {
return false;
}
var requestOption = {

@@ -224,3 +215,3 @@ protocol: protocol,

headers: {
"x-via": "flex-combo",
"x-broker": "flex-combo",
host: reqHostName

@@ -398,2 +389,2 @@ }

exports = module.exports = FlexCombo;
module.exports = FlexCombo;

@@ -9,6 +9,4 @@ /**

var fcInst = new FlexCombo();
// 自定义URL解析规则
fcInst.defineParser(function (url) {
FlexCombo.prototype.defineParser(function (url) {
return [];

@@ -19,4 +17,4 @@ });

// 例如要加入stylus支持,首先要在配置文件supportedFile中加入相应后缀匹配\\.styl$,然后通过addEngine添加动态编译逻辑
fcInst.addEngine("\\.styl$", function (absPath, url) {
return null;
FlexCombo.prototype.addEngine("\\.styl$", function (absPath, url, param, callback) {
callback(err, text, filepath);
});

@@ -26,3 +24,3 @@

.createServer(function (req, res) {
fcInst = new FlexCombo();
var fcInst = new FlexCombo();
fcInst.handle(req, res, function () {

@@ -29,0 +27,0 @@ res.writeHead(404, {"Content-Type": "text/plain"});

@@ -6,4 +6,7 @@ /**

var FlexCombo = require("./api");
var DAC = require("dac");
FlexCombo.prototype.addEngine("\\.less$|\\.less\\.css$", DAC.less);
FlexCombo.prototype.addEngine("\\.jpl$", DAC.jpl);
module.exports = function (param, dir) {
exports = module.exports = function (param, dir) {
return function () {

@@ -42,2 +45,37 @@ var fcInst = new FlexCombo(param, dir);

}
};
exports.engine = function(param, dir) {
param = param || {};
var through = require("through2");
var pathLib = require("path");
var fcInst = new FlexCombo(param, dir);
fcInst.param.traceRule = false;
return through.obj(function (file, enc, cb) {
var self = this;
if (file.isNull()) {
self.emit("error", "isNull");
cb(null, file);
return;
}
if (file.isStream()) {
self.emit("error", "Streaming not supported");
cb(null, file);
return;
}
var url = file.path.replace(pathLib.join(process.cwd(), fcInst.param.rootdir), '');
fcInst.engineHandler(url, function() {
var buff = fcInst.result[url];
if (buff) {
file.contents = buff;
}
self.push(file);
cb();
});
});
};
{
"name": "flex-combo",
"version": "0.8.6",
"version": "0.9.0",
"description": "A combo tool designed for web front-end developer, which support various kinds of combo format by modify configuration(eg. yahoo combo).",
"main": "index.js",
"scripts": {
"postinstall": "node ./scripts/asksass.js"
},
"bin": {

@@ -15,8 +12,8 @@ "flex-combo": "./bin/flex-combo"

"commander": "~2.5.0",
"dac": "~0.2.0",
"iconv-lite": "~0.4.4",
"is-utf8": "~0.2.0",
"juicer": "~0.6.6-stable",
"less": "~2.2.0",
"mace": "~2.0.0",
"mime": "~1.2.11"
"mime": "~1.2.11",
"through2": "~0.6.3"
},

@@ -23,0 +20,0 @@ "repository": {

@@ -262,7 +262,5 @@ # Flex Combo 介绍

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

@@ -272,14 +270,15 @@

// 例如要加入stylus支持,首先要在配置文件supportedFile中加入相应后缀匹配\\.styl$,然后通过addEngine添加动态编译逻辑
fcInst.addEngine("\\.styl$", function(absPath, url) {
return null;
FlexCombo.prototype.addEngine("\\.styl$", function (absPath, url, param, callback) {
callback(err, text, filepath);
});
http.createServer(function(req, res) {
fcInst = new FlexCombo([param], [dir]);
fcInst.handle(req, res, function() {
res.writeHead(404, {"Content-Type": "text/plain"});
res.end("Your combo file not found.");
http
.createServer(function (req, res) {
var 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);
```

@@ -286,0 +285,0 @@

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