livescript-transform-top-level-await
v1.0.2
Published
Enables use of await in top level scope.
Downloads
8
Readme
Transform plugin for livescript
Enables use of await in top level block.
This isn't real plugin because livescript doesn't have support for it. It's more like a hack thats is mutating AST generated by livescript.
Usage
Assuming you have file name app.ls
simple use
require! <[ livescript livescript-transform-top-level-await]>
foo = Promise.resolve \foo
bar = Promise.resolve \bar
foo-bar = "#{await foo} #{await bar}"
installing inside custom livescript implementation
require! <[ livescript livescript-transform-top-level-await/lib/plugin]>
plugin.install livescript
livescript.compile source-code
CLI
Please stop using cli for any serious task, write scripts in real languages (there are so many to choose) e.g.
lsc serious-task.ls
node serious-task.js
python serious-task.py
If you really must to use cli just add require plugin file to the command.
But don't say I didn't warn you!
compiling
lsc -cr livescript-transform-top-level-await app.ls
running
lsc -r livescript-transform-top-level-await app.ls