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

node-cube

Package Overview
Dependencies
Maintainers
1
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-cube - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

.covignore

9

cube.js

@@ -25,2 +25,3 @@ /*!

Cube.CHARSET = 'utf-8';
Cube.VERSION = new Date().getTime();
Cube.init = function (config) {

@@ -33,5 +34,11 @@ if (config.base && config.base !== '/') {

}
if (config.version) {
this.VERSION = config.version;
}
return this;
};
Cube.use = function (mod, cb) {
if (!mod) {
throw new Error('Cube.use(moduleName) moduleName is undefined!');
}
var ll = new Cube();

@@ -197,3 +204,3 @@ ll.load(mod, function (module, exports, require) {

script.charset = this.charset;
var _src = [ this.base, name, '?m=1&', Cube.V];
var _src = [ this.base, name, '?m=1&', Cube.VERSION];
script.src = _src.join('');

@@ -200,0 +207,0 @@ }

@@ -11,6 +11,7 @@ /*!

var JsProcessor = require('./controller/js_processor');
var LessProcessor = require('./controller/less_processor');
var CssProcessor = require('./controller/css_processor');
var JsTransfer = require('./lib/jstransfer');
var CssTransfer = require('./lib/csscombine');
var CssTransfer = require('./lib/csstransfer');
var ug = require('uglify-js');
var xfs = require('xfs');
var app;

@@ -21,9 +22,10 @@ /**

* - port listen port [optional]
* - app the connect object
* - connect the connect object
* - root static root
* - router http path
* - router http path
* - honeyComb for honeyComb
*/
exports.init = function (config) {
JsProcessor.init(config);
LessProcessor.init(config);
CssProcessor.init(config);
function processQuery(req, res, next) {

@@ -38,3 +40,5 @@ var q = url.parse(req.url, true);

case '.css':
next();
case '.less':
case '.sass':
CssProcessor(req, res, next);
break;

@@ -44,5 +48,2 @@ case '.js':

break;
case '.less':
LessProcessor(req, res, next);
break;
default:

@@ -83,4 +84,38 @@ next();

};
/**
* [processDir description]
* @param {abspath} source [description]
* @param {[type]} dest [description]
* @param {[type]} compress [description]
* @param {Function} cb [description]
* @return {[type]} [description]
*/
exports.processDir = function (source, dest, compress, cb) {
compress = compress === undefined ? true : compress;
if (!source) {
dest = source + '-min';
}
xfs.walk(source, function (err, sourceFile) {
console.log('process file:', sourceFile);
var relFile = sourceFile.substr(source.length);
if (/^(\\|\/)/.test(relFile)) {
relFile.substr(1);
}
var destFile = path.join(dest, relFile);
var fileName = path.basename(relFile);
if (/\.min\.(css|js)$/.test(fileName) || !/\.(js|css|less|sass)$/.test(fileName)) {
// copy file
xfs.sync().save(destFile, xfs.readFileSync(sourceFile));
} else if (/\.js$/.test(fileName)) {
JsTransfer.init({root: source});
var code = JsTransfer.transferFile(relFile, compress);
console.log(destFile);
xfs.sync().save(destFile, code);
} else if (/\.(css|less|sass)$/.test(fileName)) {
var code = CssTransfer.transferFile(sourceFile, compress);
xfs.sync().save(destFile, code);
}
}, cb);
};
/**
* transfer js module to browserify node

@@ -87,0 +122,0 @@ * @param {[type]} file [description]

12

package.json

@@ -5,3 +5,3 @@ {

"description": "a new way to write js in browser",
"version": "0.0.4",
"version": "0.0.5",
"homepage": "https://github.com/fishbar/cube",

@@ -13,7 +13,8 @@ "repository": {

"main": "index.js",
"bin": {
"bin": {
"cube": "./bin/cube"
},
"scripts": {
"test": "mocha -r jscoverage test"
"test": "node_modules/.bin/mocha -r jscoverage test",
"build": "node_modules/.bin/uglifyjs cube.js -c -o cube.min.js"
},

@@ -27,4 +28,5 @@ "engines": {

"uglify-js" : "2.4.13",
"less" : "1.7.0",
"xfs" : "0.1.8"
"less": "1.7.0",
"css": "1.6.0",
"xfs" : "0.1.9"
},

@@ -31,0 +33,0 @@ "devDependencies": {

@@ -47,3 +47,3 @@ Cube

root: '/wwwroot', // static resource path, like wwwwroot below
app: app, // connect app object
connect: app, // connect app object
router: '/res/' // static resource url router

@@ -94,3 +94,2 @@ });

进入生产环境之前,模块都会被预编译、压缩成一个个小文件,然后发布到线上(cdn服务器、云存储 或 其他)
进入生产环境之前,模块都会被预编译、压缩成一个个小文件,然后发布到线上(cdn服务器、云存储 或 其他)

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