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

borschik

Package Overview
Dependencies
Maintainers
4
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

borschik - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

15

lib/freeze.js

@@ -21,3 +21,3 @@ var CRYPTO = require('crypto'),

*/
exports.processImage = function(filePath) {
exports.processPath = function(filePath) {
return freeze(realpathSync(filePath));

@@ -300,10 +300,15 @@ };

// Freezable test extensions
var freezableExts = (process.env.BORSCHIK_FREEZABLE_EXTS ||
'jpg jpeg gif ico png swf svg ttf eot otf woff').split(' '),
freezableRe = new RegExp('\\.(' + freezableExts.join('|') + ')$');
/**
* Check if URL is image URL — jpeg, png, etc.
* Check if URL is freezable.
*
* @param {String} url URL to check.
* @returns {boolean} True if it is image URL, otherwise false.
* @returns {boolean} True if URL is freezable, otherwise false.
*/
var isImageUrl = exports.isImageUrl = function(url) {
return /\.(jpe?g|gif|ico|png|swf|svg)$/.test(url);
exports.isFreezableUrl = function(url) {
return freezableRe.test(url);
};

@@ -310,0 +315,0 @@

@@ -16,5 +16,2 @@ var INHERIT = require('inherit'),

processLink: function(path) {
if (!this.tech.opts.freeze) return this.path;
var url = this.path,

@@ -24,3 +21,3 @@ i = url.indexOf('?'),

if (i > 0) {
if (i > -1) {
postUrl = url.substring(i);

@@ -30,13 +27,11 @@ url = url.substring(0, i);

if (FREEZE.isImageUrl(url)) {
var frozen = FREEZE.processImage(url),
resolved = FREEZE.resolveUrl2(frozen, '');
url = (frozen == resolved? PATH.relative(PATH.dirname(path), resolved) : resolved) + postUrl;
} else {
url = this.pathFrom(path);
if (this.tech.opts.freeze && FREEZE.isFreezableUrl(url)) {
url = FREEZE.processPath(url);
}
var resolved = FREEZE.resolveUrl2(url);
url = (resolved == url ? PATH.relative(PATH.dirname(path), url) : resolved) + postUrl;
return JSON.stringify(url);
}

@@ -43,0 +38,0 @@

@@ -13,3 +13,3 @@ var INHERIT = require('inherit'),

exports.Tech = INHERIT(cssbase.Tech, {
File: INHERIT(cssbase.File, {
File: exports.File = INHERIT(cssbase.File, {

@@ -16,0 +16,0 @@ parseInclude: function(content) {

var INHERIT = require('inherit'),
base = require('../tech'),
FS = require('../fs'),
UJS = require('uglify-js');
PATH = require('path');

@@ -70,3 +70,5 @@ exports.Tech = INHERIT(base.Tech, {

var processed = this.child('include', item.file).process(baseFile);
parsed[i] = (item.type === 'comment'? processed : JSON.stringify(processed));
parsed[i] = (item.type === 'comment'?
commentsWrap(processed, PATH.relative(PATH.dirname(baseFile), item.file)) :
JSON.stringify(processed));
}

@@ -79,1 +81,9 @@

});
function commentsWrap(content, file) {
return '/* ' + file + ' begin */\n' +
content +
'\n/* ' + file + ' end */\n';
}
{
"name": "borschik",
"description": "Extendable builder for text-based file formats",
"version": "0.2.4",
"version": "0.2.5",
"homepage": "http://github.com/veged/borschik",

@@ -6,0 +6,0 @@ "author": "Sergey Berezhnoy <veged@ya.ru> (http://github.com/veged)",

@@ -94,13 +94,18 @@ var BORSCHIK = require('..'),

describe('isImageUrl', function() {
describe('isFreezableUrl', function() {
it('isImageUrl ok', function() {
ASSERT.ok(FREEZE.isImageUrl('xxx.jpg'));
ASSERT.ok(FREEZE.isImageUrl('xxx.jpeg'));
ASSERT.ok(FREEZE.isImageUrl('xxx.ico'));
ASSERT.ok(FREEZE.isImageUrl('xxx.png'));
ASSERT.ok(FREEZE.isImageUrl('xxx.gif'));
ASSERT.ok(FREEZE.isImageUrl('xxx.svg'));
ASSERT.ok(FREEZE.isImageUrl('xxx.swf'));
it('isFreezableUrl ok', function() {
ASSERT.ok(FREEZE.isFreezableUrl('xxx.jpg'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.jpeg'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.ico'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.png'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.gif'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.svg'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.swf'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.ttf'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.eot'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.otf'));
ASSERT.ok(FREEZE.isFreezableUrl('xxx.woff'));
});
});

@@ -107,0 +112,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