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

hrt

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hrt - npm Package Compare versions

Comparing version 1.0.24 to 1.0.25

2

package.json
{
"name": "hrt",
"version": "1.0.24",
"version": "1.0.25",
"description": "HTTP Rewrite Tool",

@@ -5,0 +5,0 @@ "author": "Longhao Luo <lhluo@tudou.com>",

@@ -34,5 +34,4 @@ var Fs = require('fs');

var root = path.replace(/^(.*?)[\\\/](src|build|dist)[\\\/].*$/, '$1');
var relativePath = path.split(Path.sep).join('/').replace(/^.+\/src\/js\//, '');
var relativePath = path.split(Path.sep).join('/').replace(/^.+\/src\//, '');
var mid = relativePath.replace(/\.js$/, '');
function fixDep(s, format) {

@@ -138,3 +137,3 @@ if (format) {

dumpLineNumbers : 'comments',
paths : ['.', root + '/src/css'],
paths : ['.', root + '/src'],
filename : path,

@@ -152,3 +151,3 @@ });

if (!/src\/js\/(lib|lite|loader)\.js$/.test(newPath) && /src\/js\/.+\.js$/.test(newPath)) {
if (!/src(\/[^\/]+)+\/(lib|lite|loader)\.js$/.test(newPath) && /src(\/[^\/]+)+\/.+\.js$/.test(newPath)) {
var str = Util.readFileSync(path, 'utf-8');

@@ -166,76 +165,4 @@ str = fixModule(path, str);

// 合并TUI2文件
function mergeTui2(path, callback) {
var root = this.config.serverRoot;
var subDir = /\.css$/.test(path) ? 'skin' : 'js';
var pathMap = {};
function grepPath(src) {
var regExp = /(?:\*|\\\\) +@import +([\/\w\-\.]+)/ig;
var match;
while((match = regExp.exec(src))) {
var filePath = match[1];
if (!/^(js|skin)\//.test(filePath)) {
filePath = subDir + '/' + filePath;
}
var path = root + '/' + filePath;
if (typeof pathMap[filePath] == 'undefined') {
var encoding = /\.tpl$/.test(filePath) ? 'utf8' : 'gbk';
var fileStr = Util.readFileSync(path, encoding);
if (/\.(js|css)$/.test(filePath)) {
grepPath(fileStr);
}
pathMap[filePath] = fileStr;
}
}
}
// 二进制文件
if (!/(\.js|\.css|\.tpl)$/.test(path)) {
var contentType = Mime.lookup(path);
var buffer = Util.readFileSync(path);
return callback(contentType, buffer);
}
// 文本文件
var src = Util.readFileSync(path, 'gbk');
grepPath(src);
var dist = '';
Util.each(pathMap, function(filePath, fileStr) {
if (/\.tpl$/.test(filePath)) {
var varName = filePath.replace(/^js\/|\.tpl$/g, '');
varName = 'tpl_' + varName.replace(/\//g, '_');
fileStr = fileStr.replace(/(\r\n|\r|\n)\s*/g, ' ').replace(/'/g, "\\'");
dist += 'var ' + varName + " = '" + fileStr + "';\n";
} else {
dist += fileStr + '\n';
}
});
dist += '\n' + src;
dist = Iconv.toEncoding(dist, 'gbk');
callback(/\.css$/.test(path) ? 'text/css' : 'application/javascript', dist);
}
exports.stripVersionInfo = stripVersionInfo;
exports.cssToLess = cssToLess;
exports.merge = merge;
exports.mergeTui2 = mergeTui2;
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