@samitouri / QOS-React-2 / commits / 2b38795769

Rebased on master

Andrew Davey committed May 18, 2014 at 17:51 UTC 2b387957693f68dea876e77d1fc6f8cee3ed9354
1 file changed +12 -3
main.js
+12 -3
@@ -8,7 +8,8 @@ module.exports = {
8 React: React,
9 transform: function(input, options) {
10 options = options || {};
11 - var result = transform(visitors.react, input, options);
11 + var visitorList = getVisitors(options.harmony);
12 + var result = transform(visitorList, input, options);
13 var output = result.code;
14 if (options.sourceMap) {
15 var map = inlineSourceMap(
@@ -22,10 +23,18 @@ module.exports = {
23 }
24 };
25
26 +function getVisitors(harmony) {
27 + if (harmony) {
28 + return visitors.getAllVisitors();
29 + } else {
30 + return visitors.transformVisitors.react;
31 + }
32 +}
33 +
34 function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
35 var json = sourceMap.toJSON();
27 - json.sources = [ sourceFilename ];
28 - json.sourcesContent = [ sourceCode ];
36 + json.sources = [sourceFilename];
37 + json.sourcesContent = [sourceCode];
38 var base64 = Buffer(JSON.stringify(json)).toString('base64');
39 return '//# sourceMappingURL=data:application/json;base64,' +
40 base64;