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

jade

Package Overview
Dependencies
Maintainers
4
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jade - npm Package Compare versions

Comparing version 1.9.2 to 1.10.0

64

bin/jade.js

@@ -36,2 +36,3 @@ #!/usr/bin/env node

.option('-E, --extension <ext>', 'specify the output file extension')
.option('-H, --hierarchy', 'keep directory hierarchy when a directory is specified')
.option('--name-after-file', 'Name the template after the last section of the file path (requires --client and overriden by --name)')

@@ -123,2 +124,5 @@ .option('--doctype <str>', 'Specify the doctype on the command line (useful if it is not specified by the template)')

// function for rendering
var render = program.watch ? tryRender : renderFile;
// compile files

@@ -132,6 +136,6 @@

});
files.forEach(tryRender);
} else {
files.forEach(renderFile);
}
files.forEach(function (file) {
render(file);
});
process.on('exit', function () {

@@ -150,3 +154,3 @@ console.log();

*/
function watchFile(path, base) {
function watchFile(path, base, rootPath) {
path = normalize(path);

@@ -161,3 +165,3 @@ if (watchList.indexOf(path) !== -1) return;

if (curr.mtime.getTime() === prev.mtime.getTime()) return;
tryRender(base || path);
tryRender(base || path, rootPath);
});

@@ -180,5 +184,5 @@ watchList.push(path);

*/
function tryRender(path) {
function tryRender(path, rootPath) {
try {
renderFile(path);
renderFile(path, rootPath);
} catch (e) {

@@ -217,8 +221,13 @@ // keep watching when error occured.

var hierarchyWarned = false;
/**
* Process the given path, compiling the jade files found.
* Always walk the subdirectories.
*
* @param path path of the file, might be relative
* @param rootPath path relative to the directory specified in the command
*/
function renderFile(path) {
function renderFile(path, rootPath) {
var re = /\.jade$/;

@@ -228,13 +237,14 @@ var stat = fs.lstatSync(path);

if (stat.isFile() && re.test(path)) {
if (options.watch) watchFile(path);
var str = fs.readFileSync(path, 'utf8');
options.filename = path;
// Try to watch the file if needed. watchFile takes care of duplicates.
if (options.watch) watchFile(path, null, rootPath);
if (program.nameAfterFile) {
options.name = getNameFromFileName(path);
}
var fn = options.client ? jade.compileClient(str, options) : jade.compile(str, options);
var fn = options.client
? jade.compileFileClient(path, options)
: jade.compileFile(path, options);
if (options.watch && fn.dependencies) {
// watch dependencies, and recompile the base
fn.dependencies.forEach(function (dep) {
watchFile(dep, path);
watchFile(dep, path, rootPath);
});

@@ -244,8 +254,24 @@ }

// --extension
if (program.extension) var extname = '.' + program.extension;
else if (options.client) var extname = '.js';
else var extname = '.html';
var extname;
if (program.extension) extname = '.' + program.extension;
else if (options.client) extname = '.js';
else extname = '.html';
// path: foo.jade -> foo.<ext>
path = path.replace(re, extname);
if (program.out) path = join(program.out, basename(path));
if (program.out) {
// prepend output directory
if (rootPath && program.hierarchy) {
// replace the rootPath of the resolved path with output directory
path = resolve(path).replace(new RegExp('^' + resolve(rootPath)), '');
path = join(program.out, path);
} else {
if (rootPath && !hierarchyWarned) {
console.warn('In Jade 2.0.0 --hierarchy will become the default.');
hierarchyWarned = true;
}
// old behavior or if no rootPath handling is needed
path = join(program.out, basename(path));
}
}
var dir = resolve(dirname(path));

@@ -261,3 +287,5 @@ mkdirp.sync(dir, 0755);

return path + '/' + filename;
}).forEach(renderFile);
}).forEach(function (file) {
render(file, rootPath || path);
});
}

@@ -264,0 +292,0 @@ }

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

"description": "Jade template runtime",
"version": "1.9.2",
"version": "1.10.0",
"keywords": [

@@ -17,2 +17,2 @@ "template"

"main": "lib/runtime.js"
}
}

@@ -0,1 +1,10 @@

1.10.0 / 2015-05-25
==================
* Now supports jstransformers, which allows improved handling of embedded languages such as Coffee-Script, and deprecated Transformers support in filters - to be removed in 2.0.0 ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* CLI: added a flag to keep directory hierarchy when a directory is specified - this behavior will be the default in 2.0.0 ([@TimothyGu](https://github.com/TimothyGu))
* disabled 'compileDebug' flag by default when used with express in production mode ([Andreas Lubbe](https://github.com/alubbe))
* Fixed a memory leak on modern versions of Chrome as well as node 0.12 and iojs ([Andreas Lubbe](https://github.com/alubbe))
* update website ([@GarthDB](https://github.com/GarthDB))
1.9.2 / 2015-01-18

@@ -2,0 +11,0 @@ ==================

@@ -198,7 +198,7 @@ 'use strict';

if (debug) {
this.buf.push('jade_debug.unshift({ lineno: ' + node.line
+ ', filename: ' + (node.filename
this.buf.push('jade_debug.unshift(new jade.DebugItem( ' + node.line
+ ', ' + (node.filename
? utils.stringify(node.filename)
: 'jade_debug[0].filename')
+ ' });');
+ ' ));');
}

@@ -205,0 +205,0 @@

'use strict';
var transformers = require('transformers');
var jstransformer = require('jstransformer');
var uglify = require('uglify-js');
var CleanCSS = require('clean-css');
var warned = {};
var alternatives = {
uglifyJS: 'uglify-js',
uglify: 'uglify-js',
uglifyCSS: 'clean-css',
'uglify-css': 'clean-css' ,
uglifyJSON: 'json',
'uglify-json': 'json',
live: 'livescript',
LiveScript: 'livescript',
ls: 'livescript',
// TODO: remove if we add support for coffeekup
coffeekup: 'coffeecup',
// The `style` transformer is not the same as the `stylus` jstransformer
styl: 'stylus',
coffee: 'coffee-script',
coffeescript: 'coffee-script',
coffeeScript: 'coffee-script',
// these marker transformers haven't made sense in a long time
css: 'verbatim',
js: 'verbatim',
};
var deprecated = ['jqtpl', 'jazz'];
function getMarkdownImplementation() {
var implementations = ['marked', 'supermarked', 'markdown-js', 'markdown'];
while (implementations.length) {
try {
require(implementations[0]);
return implementations[0];
} catch (ex) {
implementations.shift();
}
}
return 'markdown-it';
}
module.exports = filter;

@@ -9,7 +48,50 @@ function filter(name, str, options) {

return filter[name](str, options);
} else if (transformers[name]) {
return transformers[name].renderSync(str, options);
} else {
throw new Error('unknown filter ":' + name + '"');
var tr;
try {
tr = jstransformer(require('jstransformer-' + name));
} catch (ex) {}
if (tr) {
// TODO: we may want to add a way for people to separately specify "locals"
var result = tr.render(str, options, options).body;
if (options && options.minify) {
try {
switch (tr.outputFormat) {
case 'js':
result = uglify.minify(result, {fromString: true}).code;
break;
case 'css':
result = new CleanCSS().minify(result).styles;
break;
}
} catch (ex) {
// better to fail to minify than output nothing
}
}
return result;
} else if (transformers[name]) {
if (!warned[name]) {
warned[name] = true;
if (name === 'md' || name === 'markdown') {
var implementation = getMarkdownImplementation();
console.log('Transformers.' + name + ' is deprecated, you must replace the :' +
name + ' jade filter, with :' +
implementation + ' and install jstransformer-' +
implementation + ' before you update to jade@2.0.0.');
} else if (alternatives[name]) {
console.log('Transformers.' + name + ' is deprecated, you must replace the :' +
name + ' jade filter, with :' +
alternatives[name] + ' and install jstransformer-' +
alternatives[name] + ' before you update to jade@2.0.0.');
} else {
console.log('Transformers.' + name + ' is deprecated, to continue using the :' +
name + ' jade filter after jade@2.0.0, you will need to install jstransformer-' +
name.toLowerCase() + '.');
}
}
return transformers[name].renderSync(str, options);
} else {
throw new Error('unknown filter ":' + name + '"');
}
}
}

@@ -208,3 +208,3 @@ 'use strict';

fn = [
'var jade_debug = [{ lineno: 1, filename: ' + filename + ' }];'
'var jade_debug = [ new jade.DebugItem( 1, ' + filename + ' ) ];'
, 'try {'

@@ -260,3 +260,3 @@ , parsed.body

fn = [
'var jade_debug = [{ lineno: 1, filename: ' + filename + ' }];'
'var jade_debug = [ new jade.DebugItem( 1, ' + filename + ' ) ];'
, 'try {'

@@ -402,3 +402,3 @@ , parsed.body

if (options.cache && exports.cache[key]) {
return exports.cache[key];
return exports.cache[key];
}

@@ -416,2 +416,7 @@

exports.__express = exports.renderFile;
exports.__express = function(path, options, fn) {
if(options.compileDebug == undefined && process.env.NODE_ENV === 'production') {
options.compileDebug = false;
}
exports.renderFile(path, options, fn);
}

@@ -233,1 +233,6 @@ 'use strict';

};
exports.DebugItem = function DebugItem(lineno, filename) {
this.lineno = lineno;
this.filename = filename;
}
{
"name": "jade",
"description": "A clean, whitespace-sensitive template language for writing HTML",
"version": "1.9.2",
"version": "1.10.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -13,3 +13,4 @@ "maintainers": [

"Hemanth <hemanth.hm@gmail.com>",
"Timothy Gu <timothygu99@gmail.com>"
"Timothy Gu <timothygu99@gmail.com>",
"Andreas Lubbe <git@lubbe.org>"
],

@@ -27,6 +28,9 @@ "license": "MIT",

"character-parser": "1.2.1",
"clean-css": "^3.1.9",
"commander": "~2.6.0",
"constantinople": "~3.0.1",
"jstransformer": "0.0.2",
"mkdirp": "~0.5.0",
"transformers": "2.1.0",
"uglify-js": "^2.4.19",
"void-elements": "~2.0.1",

@@ -36,30 +40,35 @@ "with": "~4.0.0"

"devDependencies": {
"browserify": "*",
"browserify-middleware": "~4.1.0",
"code-mirror": "~3.22.0",
"coffee-script": "*",
"coveralls": "^2.11.2",
"mocha": "*",
"istanbul": "*",
"markdown": "*",
"stylus": "*",
"should": "*",
"less": "<2.0.0",
"uglify-js": "*",
"browserify": "*",
"linify": "*",
"less-file": "0.0.9",
"express": "~4.10.4",
"browserify-middleware": "~4.1.0",
"twbs": "0.0.6",
"github-basic": "^4.1.2",
"handle": "~1.0.0",
"highlight-codemirror": "~4.1.0",
"inconsolata": "0.0.2",
"istanbul": "*",
"jade-code-mirror": "~1.0.5",
"code-mirror": "~3.22.0",
"handle": "~1.0.0",
"jade-highlighter": "~1.0.5",
"marked": "~0.3.2",
"stop": "^3.0.0-rc1",
"jstransformer-cdata": "0.0.3",
"jstransformer-coffee-script": "0.0.2",
"jstransformer-less": "^1.0.0",
"jstransformer-marked": "0.0.1",
"jstransformer-stylus": "0.0.1",
"jstransformer-verbatim": "0.0.2",
"less": "<2.0.0",
"less-file": "0.0.9",
"linify": "*",
"lsr": "^1.0.0",
"marked": "~0.3.3",
"mocha": "*",
"opener": "^1.3.0",
"github-basic": "^4.1.2",
"pull-request": "^3.0.0",
"lsr": "^1.0.0",
"rimraf": "^2.2.8"
"rimraf": "^2.2.8",
"should": "*",
"stop": "^3.0.0-rc1",
"stylus": "*",
"twbs": "0.0.6",
"uglify-js": "*"
},

@@ -88,2 +97,2 @@ "component": {

"homepage": "http://jade-lang.com"
}
}

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

# [![Jade - Node Template Engine](http://jade-lang.com/logos/JadeBlack.svg)](http://jade-lang.com/)
# [![Jade - Node Template Engine](http://garthdb.com/img/jade_branding/jade-01.svg)](http://jade-lang.com/)

@@ -149,2 +149,3 @@ Full documentation is at [jade-lang.com](http://jade-lang.com/)

- [html2jade](https://github.com/donpark/html2jade) converter
- [jade2php](https://github.com/SE7ENSKY/jade2php) converter
- [Jade Server](https://github.com/ded/jade-server) Ideal for building local prototypes apart from any application

@@ -151,0 +152,0 @@

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jade=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jade = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

@@ -235,2 +235,7 @@

exports.DebugItem = function DebugItem(lineno, filename) {
this.lineno = lineno;
this.filename = filename;
}
},{"fs":2}],2:[function(require,module,exports){

@@ -237,0 +242,0 @@

Sorry, the diff of this file is too big to display

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