Skip to content

Commit 335c645

Browse files
ewanharrissgtcoolguy
authored andcommitted
refactor: use sync babel methods
Babel has deprecated the synchronous if no callback nature of these function so we should move to the sync variants now to avoid any problems in the future
1 parent 014abf2 commit 335c645

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Alloy/commands/compile/sourceMapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ exports.generateCodeAndSourceMap = function(generator, compileConfig) {
112112
// options.sourceMapTarget = target.filename;
113113
// options.inputSourceMap = mapper.toJSON();
114114
}
115-
var outputResult = babel.transformFromAst(ast, genMap.code, options);
115+
var outputResult = babel.transformFromAstSync(ast, genMap.code, options);
116116

117117
// write the generated controller code
118118
var outfile = target.filepath;
@@ -197,7 +197,7 @@ exports.generateSourceMap = function(generator, compileConfig) {
197197
// sourceMapTarget: compiledFileName,
198198
// inputSourceMap: mapper.toJSON()
199199
});
200-
var outputResult = babel.transformFromAst(ast, genMap.code, options);
200+
var outputResult = babel.transformFromAstSync(ast, genMap.code, options);
201201

202202
// write source map for the generated file
203203
var relativeOutfile = path.relative(compileConfig.dir.project, target.filepath);

test/specs/optimizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('optimizer.js', function() {
122122
var options = _.extend(_.clone(sourceMapper.OPTIONS_OUTPUT), {
123123
plugins: [['./Alloy/commands/compile/ast/optimizer-plugin', {platform: platform}]]
124124
});
125-
var result = babel.transformFromAst(ast, null, options);
125+
var result = babel.transformFromAstSync(ast, null, options);
126126
ast = result.ast;
127127
code = result.code.replace(/\s*$/,'');
128128
};

0 commit comments

Comments
 (0)