fix bug with json output
This commit is contained in:
parent
a9536edce6
commit
5ab047cbed
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue