Open capaj opened 6 years ago
Hello Jirko @capaj , we do not use any transpilers but I do agree that it needs some improvements in readability.
There's maybe another way how to hide the ugly part. We are using JetBrains IDEs (PhpStorm and IntelliJ), I remember that in times when Java had no closures, the IDE had been making anonymous classes look like a closure. In our case, it would optically replace await me(() => E(), ...)
with await ...
.
Would it be a sufficient solution?
@zatziky well this was just a suggestion, not really a "github issue" in the true sense of the word. I'll close it and who knows-maybe some day I'll make the plugin myself.
@capaj Don't worry, I understood it was a suggestion and a good one. I like it and will reopen the issue. Maybe someone else will implement a PR.
100% needs to be a babel plugin!
we made it a babel plugin in our preset https://github.com/tobiipro/babel-preset-firecloud/blob/master/plugins/babel-plugin-firecloud-await-trace.js
at the moment, I'm short on time for a PR, etc
PS: I've just made a fix so that we don't loose this
when transpiling https://github.com/tobiipro/babel-preset-firecloud/commit/a84a45cfcf36c5e2927f3d0a5a12ea7b62844832
Good job @andreineculau We are moving our projects to Node 12 that should already cover the async stack traces. Check it out. If you ever find time I will happily merge your PR.
@zatziky true that, but we decided to still go ahead with this babel plugin because most of the js work at https://github.com/tobiipro is target AWS Lambdas which has only a few days ago started supporting nodejs10.x . We could use layers and use node 12, but that has another set of disadvantages...
using this directly in my code make is quite ugly and much harder to read. We need a babel plugin to hide this mess away.