mirror of https://github.com/status-im/metro.git
[React-Native] Update jstransform/esprima
This commit is contained in:
parent
382e1553af
commit
e781e469d1
|
@ -16,18 +16,26 @@ var staticTypeSyntax =
|
||||||
var visitorList = reactVisitors;
|
var visitorList = reactVisitors;
|
||||||
|
|
||||||
|
|
||||||
function transform(transformSets, srcTxt, options) {
|
function transform(transformSets, srcTxt) {
|
||||||
options = options || {};
|
var options = {
|
||||||
|
es3: true,
|
||||||
|
sourceType: 'nonStrictModule'
|
||||||
|
};
|
||||||
|
|
||||||
// These tranforms mostly just erase type annotations and static typing
|
// These tranforms mostly just erase type annotations and static typing
|
||||||
// related statements, but they were conflicting with other tranforms.
|
// related statements, but they were conflicting with other tranforms.
|
||||||
// Running them first solves that problem
|
// Running them first solves that problem
|
||||||
var staticTypeSyntaxResult = jstransform(
|
var staticTypeSyntaxResult = jstransform(
|
||||||
staticTypeSyntax,
|
staticTypeSyntax,
|
||||||
srcTxt
|
srcTxt,
|
||||||
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
return jstransform(visitorList, staticTypeSyntaxResult.code);
|
return jstransform(
|
||||||
|
visitorList,
|
||||||
|
staticTypeSyntaxResult.code,
|
||||||
|
options
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function(data, callback) {
|
module.exports = function(data, callback) {
|
||||||
|
@ -35,8 +43,7 @@ module.exports = function(data, callback) {
|
||||||
try {
|
try {
|
||||||
result = transform(
|
result = transform(
|
||||||
data.transformSets,
|
data.transformSets,
|
||||||
data.sourceCode,
|
data.sourceCode
|
||||||
data.options
|
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
|
|
Loading…
Reference in New Issue