fix bug with json output

This commit is contained in:
ido 2015-01-12 15:02:10 +02:00
parent a9536edce6
commit 5ab047cbed
3 changed files with 6 additions and 10 deletions

View File

@ -1,13 +1,10 @@
'use strict'; 'use strict';
/** /**
* @typedef {{color: boolean, cwd: string, report: function(string), warn: function(string), getMessages: function():Array.<MESSAGE>}} * @typedef {{color: boolean, cwd: string, report: function(string), warn: function(string), getMessages: function():Array.<MESSAGE>}} CONTEXT
*/ */
/*eslint no-unused-vars:0*/
var CONTEXT = null;
/** /**
* @typedef {{msg: string, level: MESSAGE_LEVEL, file: string}} * @typedef {{msg: string, level: MESSAGE_LEVEL, file: string}} MESSAGE
*/ */
var MESSAGE = null;
/** /**
* Enum for tri-state values. * Enum for tri-state values.

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
var fs = require('fs'); var fs = require('fs');
//var path = require('path');
/** /**
* @param {string} source * @param {string} source

View File

@ -383,14 +383,14 @@ function convertTemplateToReact(html, options) {
var data = {body: body, injectedFunctions: '', requireNames: requireVars, requirePaths: requirePaths, vars: vars, name: options.name}; var data = {body: body, injectedFunctions: '', requireNames: requireVars, requirePaths: requirePaths, vars: vars, name: options.name};
data.injectedFunctions = context.injectedFunctions.join('\n'); data.injectedFunctions = context.injectedFunctions.join('\n');
var code = generate(data, options); var code = generate(data, options);
try { //try {
var tree = esprima.parse(code, {range: true, tokens: true, comment: true}); var tree = esprima.parse(code, {range: true, tokens: true, comment: true});
tree = escodegen.attachComments(tree, tree.comments, tree.tokens); tree = escodegen.attachComments(tree, tree.comments, tree.tokens);
code = escodegen.generate(tree, {comment: true}); code = escodegen.generate(tree, {comment: true});
} catch (e) { //} catch (e) {
// TODO error handling // TODO error handling
console.log(e); //console.log(e);
} //}
return code; return code;
} }