Skip to content

Commit

Permalink
More optimizations and fix for JSXTransformer build
Browse files Browse the repository at this point in the history
* Dropped dependency on emulation of Node.js native modules.
* Added deamdify step for JSXTransformer build.
  • Loading branch information
RReverser committed Jan 31, 2014
1 parent bff9731 commit f1b7db9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions grunt/config/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

'use strict';

var deamdify = require('deamdify');
var envify = require('envify/custom');
var grunt = require('grunt');
var UglifyJS = require('uglify-js');
Expand Down Expand Up @@ -80,6 +81,7 @@ var transformer = {
outfile: './build/JSXTransformer.js',
debug: false,
standalone: 'JSXTransformer',
transforms: [deamdify],
after: [simpleBannerify]
};

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"devDependencies": {
"benchmark": "~1.0.0",
"coverify": "~1.0.4",
"deamdify": "~0.1.1",
"envify": "~1.0.1",
"es5-shim": "~2.3.0",
"grunt": "~0.4.2",
Expand All @@ -59,7 +60,7 @@
"phantomjs": "~1.9",
"platform": "~1.0.0",
"populist": "~0.1.6",
"pure-cjs": "~1.8.0",
"pure-cjs": "~1.8.3",
"recast": "~0.5.6",
"sauce-tunnel": "~1.1.0",
"semver": "~2.2.1",
Expand Down
7 changes: 5 additions & 2 deletions vendor/browser-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
var runScripts;
var headEl;

var buffer = require('buffer');
var transform = require('jstransform').transform;
var visitors = require('./fbtransform/visitors').transformVisitors;
var docblock = require('jstransform/src/docblock');
Expand Down Expand Up @@ -97,6 +96,10 @@ var transformCode = function(code, source) {
throw e;
}

if (typeof btoa === 'undefined') {
return transformed.code;
}

var map = transformed.sourceMap.toJSON();
if (source == null) {
source = "Inline JSX script";
Expand All @@ -111,7 +114,7 @@ var transformCode = function(code, source) {
return (
transformed.code +
'//# sourceMappingURL=data:application/json;base64,' +
buffer.Buffer(JSON.stringify(map)).toString('base64')
btoa(unescape(encodeURIComponent(JSON.stringify(map))))
);
} else {
return code;
Expand Down

0 comments on commit f1b7db9

Please sign in to comment.