diff options
Diffstat (limited to 'stdlib/source/lux/tool/compiler/meta/packager/js.lux')
-rw-r--r-- | stdlib/source/lux/tool/compiler/meta/packager/js.lux | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/stdlib/source/lux/tool/compiler/meta/packager/js.lux b/stdlib/source/lux/tool/compiler/meta/packager/js.lux new file mode 100644 index 000000000..e4c52af5a --- /dev/null +++ b/stdlib/source/lux/tool/compiler/meta/packager/js.lux @@ -0,0 +1,36 @@ +(.module: + [lux #* + [control + [pipe (#+ case>)] + ["." function]] + [data + [binary (#+ Binary)] + ["." product] + ["." text + ["." encoding]] + [collection + ["." row] + ["." list ("#@." monad fold)]]] + [target + ["_" js]] + [tool + [compiler + [phase + [generation (#+ Output)]]]]]) + +(def: #export (package outputs) + (-> (Output _.Statement) Binary) + (|> outputs + row.to-list + (list@map (|>> product.right + row.to-list + (list@map product.right))) + list@join + (case> (#.Cons head tail) + (|> (list@fold (function.flip _.then) head tail) + (: _.Statement) + _.code + encoding.to-utf8) + + #.Nil + (encoding.to-utf8 "")))) |