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

transformers

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

transformers - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

37

lib/shared.js

@@ -5,2 +5,3 @@ var Promise = require('promise');

var normalize = path.normalize;
var clone = require('clone');

@@ -16,3 +17,3 @@

}
}
};

@@ -49,3 +50,3 @@ var minifiers = {};

return str;
}
};
}

@@ -80,3 +81,3 @@ }

return str;
}
};
Transformer.prototype.renderSync = function (str, options) {

@@ -96,7 +97,7 @@ options = options || {};

if (err) throw err;
else if (res != undefined) return this.minify(res, options);
else if (res !== undefined) return this.minify(res, options);
else if (typeof this.sudoSync === 'string') throw new Error(this.sudoSync.replace(/FILENAME/g, options.filename || ''));
else throw new Error('There was a problem transforming ' + (options.filename || '') + ' syncronously using ' + this.name);
else throw new Error('There was a problem transforming ' + (options.filename || '') + ' synchronously using ' + this.name);
} else {
throw new Error(this.name + ' does not support transforming syncronously.');
throw new Error(this.name + ' does not support transforming synchronously.');
}

@@ -113,3 +114,3 @@ };

else resolve(self.minify(val, options));
})
});
} else {

@@ -132,3 +133,3 @@ resolve(self.renderSync(str, options));

else resolve(data);
})
});
})

@@ -146,25 +147,9 @@ .then(function (str) {

function fixString(str) {
if (str == null) return str;
if (str === null) return str;
//convert buffer to string
str = str.toString();
// Strip UTF-8 BOM if it exists
str = (0xFEFF == str.charCodeAt(0)
? str.substring(1)
: str);
str = (0xFEFF === str.charCodeAt(0) ? str.substring(1) : str);
//remove `\r` added by windows
return str.replace(/\r/g, '');
}
function clone(obj) {
if (Array.isArray(obj)) {
return obj.map(clone);
} else if (obj && typeof obj === 'object') {
var res = {};
for (var key in obj) {
res[key] = clone(obj[key]);
}
return res;
} else {
return obj;
}
}
var dirname = require('path').dirname;
var Transformer = require('./shared');
var clone = require('clone');
/**
* minifiers must be first in order to be incorporated inside instances of respective output formats
* minifiers must be first in order to be incorporated inside instances of
* respective output formats
*/
var uglifyJS = require('uglify-js');

@@ -18,2 +21,3 @@ exports.uglify = exports.uglifyJS = exports['uglify-js'] = new Transformer({

});
var uglifyCSS = require('css');

@@ -26,3 +30,3 @@ exports.uglifyCSS = exports['uglify-css'] = new Transformer({

sync: function (str, options) {
options.compress = options.compress != false && options.beautify != true;
options.compress = options.compress !== false && options.beautify !== true;
return this.cache(options) || this.cache(options, uglifyCSS.stringify(uglifyCSS.parse(str), options));

@@ -42,5 +46,4 @@ }

/**
* Syncronous Templating Languages
* Synchronous Templating Languages
*/

@@ -53,2 +56,11 @@

exports.live = exports.LiveScript = exports.ls = exports.livescript = new Transformer({
name: 'LiveScript',
engines: ['LiveScript'],
outputFormat: 'js',
sync: function (str, options) {
return this.cache(options) || this.cache(options, this.engine.compile(str, options));
}
});
exports.swig = new Transformer({

@@ -170,2 +182,5 @@ name: 'swig',

}
for (var helper in options.helpers) {
this.engine.registerHelper(helper, options.helpers[helper]);
}
var tmpl = this.cache(options) || this.cache(options, this.engine.compile(str, options));

@@ -257,3 +272,3 @@ return tmpl(options);

/**
* Asyncronous Templating Languages
* Asynchronous Templating Languages
*/

@@ -277,3 +292,3 @@

outputFormat: 'xml',
sudoSync: true, // Always runs syncronously
sudoSync: true, // Always runs synchronously
async: function (str, options, cb) {

@@ -290,3 +305,3 @@ var ECT = this.engine;

outputFormat: 'xml',
sudoSync: 'The jade file FILENAME could not be rendered syncronously. N.B. then-jade does not support syncronous rendering.',
sudoSync: 'The jade file FILENAME could not be rendered synchronously. N.B. then-jade does not support synchronous rendering.',
async: function (str, options, cb) {

@@ -296,3 +311,3 @@ this.cache(options, true);//jade handles this.cache internally

}
})
});

@@ -305,4 +320,4 @@ exports.dust = new Transformer({

async: function (str, options, cb) {
var ext = 'dust'
, views = '.';
var ext = 'dust',
views = '.';

@@ -316,3 +331,3 @@ if (options) {

this.engine.onLoad = function(path, callback){
if ('' == extname(path)) path += '.' + ext;
if ('' === extname(path)) path += '.' + ext;
if ('/' !== path[0]) path = views + '/' + path;

@@ -357,3 +372,3 @@ read(path, options, callback);

/**
* Stylsheet Languages
* Stylesheet Languages
*/

@@ -365,3 +380,3 @@

outputFormat: 'css',
sudoSync: 'The less file FILENAME could not be rendered syncronously. This is usually because the file contains `@import url` statements.',
sudoSync: 'The less file FILENAME could not be rendered synchronously. This is usually because the file contains `@import url` statements.',
async: function (str, options, cb) {

@@ -404,3 +419,3 @@ var self = this;

outputFormat: 'css',
sudoSync: true,// always runs syncronously
sudoSync: true,// always runs synchronously
async: function (str, options, cb) {

@@ -418,10 +433,2 @@ var self = this;

// Utility function for cloning objects
function clone(obj){
if (obj == null || typeof(obj) != 'object') return obj;
var tmp = new obj.constructor();
for (var key in obj) tmp[key] = clone(obj[key]);
return tmp;
}
var initial = this.engine(str);

@@ -432,3 +439,3 @@

// runs initial.define('foo', 'bar').define('baz', 'quux')
var allowed = ['set', 'include', 'import', 'define', 'use'];

@@ -457,3 +464,3 @@ var special = {}

}
})
});

@@ -475,3 +482,3 @@ exports.sass = new Transformer({

/**
* Miscelaneous
* Miscellaneous
*/

@@ -490,3 +497,2 @@

exports.coffee = exports['coffee-script'] = exports.coffeescript = exports.coffeeScript = new Transformer({

@@ -584,3 +590,2 @@ name: 'coffee-script',

/**

@@ -607,3 +612,1 @@ * Marker transformers (they don't actually apply a transformation, but let you declare the 'outputFormat')

});
{
"name": "transformers",
"version": "3.0.0",
"version": "3.0.1",
"description": "String/Data transformations for use in templating libraries, static site generators and web frameworks",

@@ -60,9 +60,11 @@ "main": "lib/transformers.js",

"component-builder": "*",
"highlight.js": "*"
"highlight.js": "*",
"LiveScript": "*"
},
"dependencies": {
"promise": "~2.0",
"css": "~1.0.8",
"css": "~1.6.0",
"clone": "~0.1.9",
"uglify-js": "~2.2.5"
}
}

@@ -1,2 +0,2 @@

[![Build Status](https://travis-ci.org/ForbesLindesay/transformers.png?branch=master)](https://travis-ci.org/ForbesLindesay/transformers)
[![Build Status](https://img.shields.io/travis/ForbesLindesay/transformers/master.svg)](https://travis-ci.org/ForbesLindesay/transformers)
# transformers

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