Last active
April 26, 2018 07:18
-
-
Save swernerx/7ca748fcddab4c672193b614e62cc73e to your computer and use it in GitHub Desktop.
Showcasing babel+fast-async issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
[ "@babel/env", { | |
// "loose": true, | |
"exclude": | |
["transform-regenerator", "transform-async-to-generator"] | |
} | |
] | |
], | |
"plugins": [ | |
"module:fast-async" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function executeTasks(tasks) { | |
for (const taskName of tasks) { | |
try { | |
await executeCommands() | |
} catch (error) { | |
console.error("Error") | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
function executeTasks(tasks) { | |
return new Promise(function ($return, $error) { | |
var _iterator, _isArray, _i, _ref, taskName; | |
_iterator = tasks, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); | |
var $Loop_2_trampoline; | |
function $Loop_2() { | |
if (true) { | |
if (_isArray) { | |
if (_i >= _iterator.length) return [1]; | |
_ref = _iterator[_i++]; | |
} else { | |
_i = _iterator.next(); | |
if (_i.done) return [1]; | |
_ref = _i.value; | |
} | |
taskName = _ref; | |
var $Try_1_Post = function () { | |
try { | |
return $Loop_2; | |
} catch ($boundEx) { | |
return $error($boundEx); | |
} | |
}; | |
var $Try_1_Catch = function (error) { | |
try { | |
console.error("Error"); | |
return $Try_1_Post(); | |
} catch ($boundEx) { | |
return $error($boundEx); | |
} | |
}; | |
try { | |
return Promise.resolve(executeCommands()).then(function ($await_4) { | |
try { | |
return $Try_1_Post(); | |
} catch ($boundEx) { | |
return $Try_1_Catch($boundEx); | |
} | |
}, $Try_1_Catch); | |
} catch (error) { | |
$Try_1_Catch(error) | |
} | |
} else return [1]; | |
} | |
return ($Loop_2_trampoline = function (q) { | |
while (q) { | |
if (q.then) return void q.then($Loop_2_trampoline, $error); | |
try { | |
if (q.pop) { | |
if (q.length) return q.pop() ? $Loop_2_exit.call(this) : q;else q = $Loop_2; | |
} else q = q.call(this); | |
} catch (_exception) { | |
return $error(_exception); | |
} | |
} | |
}.bind(this))($Loop_2); | |
function $Loop_2_exit() { | |
return $return(); | |
} | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test-async-babel", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"@babel/cli": "^7.0.0-beta.46", | |
"@babel/core": "^7.0.0-beta.46", | |
"@babel/preset-env": "^7.0.0-beta.46", | |
"fast-async": "^7.0.5", | |
"nodent-transform": "^3.2.3" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TypeError: Cannot read property 'length' of undefined | |
at Buffer._append (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/buffer.js:115:26) | |
at Buffer.append (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/buffer.js:81:10) | |
at Generator._append (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/printer.js:202:52) | |
at Generator.word (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/printer.js:126:10) | |
at Generator.Identifier (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/generators/types.js:43:8) | |
at /Users/swerner/test-async-babel/node_modules/@babel/generator/lib/printer.js:315:23 | |
at Buffer.withSource (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/buffer.js:178:28) | |
at Generator.withSource (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/printer.js:182:15) | |
at Generator.print (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/printer.js:314:10) | |
at Generator.printJoin (/Users/swerner/test-async-babel/node_modules/@babel/generator/lib/printer.js:382:12) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment