From a1c192d175f13cdb3e69b3ca5985d0d5ecf0fe93 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 19 Jul 2021 19:50:14 -0400 Subject: Made the default JS file-system promise-based so it works well on Node. --- stdlib/source/program/compositor.lux | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'stdlib/source/program') diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 6c0f700c2..bc96e7ae0 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -2,9 +2,10 @@ [library [lux (#- Module) [type (#+ :share)] + ["@" target] ["." debug] [abstract - [monad (#+ Monad do)]] + [monad (#+ do)]] [control ["." io (#+ IO io)] ["." try (#+ Try)] @@ -83,14 +84,14 @@ (format "Duration: ")))]] (wrap output))) -(def: (package! monad fs [packager package] static archive context) - (All [!] (-> (Monad !) (file.System !) [Packager file.Path] Static Archive Context (! (Try Any)))) +(def: (package! fs [packager package] static archive context) + (-> (file.System Promise) [Packager file.Path] Static Archive Context (Promise (Try Any))) (case (packager archive context) (#try.Success content) (\ fs write content package) (#try.Failure error) - (\ monad wrap (#try.Failure error)))) + (\ promise.monad wrap (#try.Failure error)))) (with_expansions [ (as_is anchor expression artifact)] (def: #export (compiler static @@ -135,7 +136,13 @@ (:assume (platform.compile import static expander platform compilation [archive state]))) _ (ioW.freeze (get@ #platform.&file_system platform) static archive) program_context (promise\wrap ($/program.context archive)) - _ (promise.future (..package! io.monad file.default packager,package static archive program_context))] + _ (..package! (for {@.old (file.async file.default) + @.jvm (file.async file.default) + @.js file.default}) + packager,package + static + archive + program_context)] (wrap (debug.log! "Compilation complete!")))) (#/cli.Export export) -- cgit v1.2.3