Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flex-combo

Package Overview
Dependencies
Maintainers
1
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.3.0 to 0.3.1

.npmignore

54

flex-combo.js

@@ -10,5 +10,8 @@ var http = require('http')

, crypto = require('crypto')
, parse = require('url').parse
, parse = require('url').parse
, beautify = require('./beautify.js').js_beautify
, mime = require('mime');
var debug = require('debug')('flex-combo:comboServer');
/**

@@ -66,3 +69,3 @@ Yahoo Combo:

function readFromLocal (fullPath) {
console.log('local file:'+ fullPath);
debug('local file:'+ fullPath);
var map = param.urls, charset = param.charset;

@@ -84,3 +87,3 @@ fullPath = filterUrl(fullPath);

var absPath = path.normalize(path.join(param.prjDir, dir, revPath));
console.log('read file:'+ absPath);
debug('read file:'+ absPath);
if(fs.existsSync(absPath)){

@@ -108,5 +111,5 @@ var buff = fs.readFileSync(absPath);

var lastDir = absPath.slice(0, absPath.lastIndexOf('/'));
console.log(lastDir);
debug(lastDir);
if(!fs.existsSync(lastDir)){
console.log(' is not exist');
debug(' is not exist');
mkdirp(lastDir, function(){

@@ -134,11 +137,21 @@ fs.writeFileSync(absPath, content, encode);

exports = module.exports = function(prjDir, urls, options){
if(urls){
param.urls = merge(param.urls, urls);
}
var userHome = process.env.HOME || process.env.HOMEPATH;//兼容windows
param.cacheDir = cacheDir = path.join(userHome, '.flex-combo/cache');
var cacheDir = path.join(userHome, '.flex-combo/cache');
if(!fs.existsSync(cacheDir)){
mkdirp(cacheDir);
}
var userConfigPath = path.join(userHome, '.flex-combo/config.json');
if(!fs.existsSync(userConfigPath)){
fs.writeFileSync(userConfigPath, beautify(JSON.stringify(param)));
}
else{
var paramStr = fs.readFileSync(userConfigPath);
paramStr.toString().replace(/[\n\r]/g, '');
param = JSON.parse(paramStr);
}
param.cacheDir = cacheDir;
if(urls){
param.urls = merge(param.urls, urls);
}
if(options){

@@ -149,3 +162,6 @@ options.urls = param.urls;

param.prjDir = prjDir;
console.log(param);
debug(param);
var fileReg = new RegExp(param.supportedFile);

@@ -183,3 +199,3 @@ return function(req, res, next) {

//本地没有,从服务器获取
console.log('send http request:'+ param.host+ url);
debug('send http request:'+ param.host+ url);
http.get({host: param.host, port: 80, path: url}, function(resp) {

@@ -213,3 +229,3 @@ var buffs = [];

}).on('error',function(e){
console.log('Networking error:' + e.message);
debug('Networking error:' + e.message);
return;

@@ -220,5 +236,5 @@ });

prefix = url.substring(0, prefix);
console.log(prefix+'|'+param.servlet);
debug(prefix+'|'+param.servlet);
var files = url.substring(prefix.length + param.servlet.length + 1, url.length);
console.log(files);
debug(files);
files = files.split(param.seperator, 1000);

@@ -241,3 +257,3 @@

if(!fileContent){
console.log('file not in local"'+fullPath);
debug('file not in local"'+fullPath);
if(prevNeedHttp){

@@ -261,3 +277,3 @@ needHttpGet += ',' + file;

}
console.log('array size: '+reqArray.length);
debug('array size: '+reqArray.length);

@@ -278,3 +294,3 @@ var reqPath = prefix + param.servlet + '?';

(function(id) {
console.log('define request: '+ reqArray[i].file);
debug('define request: '+ reqArray[i].file);
http.get({host: param.host, port: 80, path: reqPath + reqArray[id].file}, function(resp) {

@@ -289,3 +305,3 @@ if(resp.statusCode !== 200){

var buffs = [];
console.log('request: ' + reqPath + reqArray[id].file);
debug('request: ' + reqPath + reqArray[id].file);
resp.on('data', function(chunk) {

@@ -314,3 +330,3 @@ buffs.push(chunk);

}).on('error',function(e){
console.log('Networking error:' + e.message);
debug('Networking error:' + e.message);
});

@@ -317,0 +333,0 @@ })(i);

{
"name": "flex-combo",
"version": "0.3.0",
"version": "0.3.1",
"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": "flex-combo.js",

Sorry, the diff of this file is not supported yet

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