Transform viewer
The input and the output of the Babel preset of the library for five examples.
The examples
Select an example. The left pane shows the input. The right pane shows the output of the preset. The build of this site makes the output with the real preset of the repository.
What to look for
- Each async function becomes a generator function that
coroutine()wraps. Eachawaitbecomes ayield. - The function keeps its name and its parameters. A declaration stays a declaration, so it stays hoisted.
- A generator gives
bindGenerator(...). The body moves into an inner generator. - The output imports
coroutineandbindGeneratorfromasync-browser-context/runtime.
The transform page tells what the runtime does at each step.