@@ -11,6 +11,7 @@ module Generate.Output
1111 where
1212
1313
14+import Control.Concurrent.MVar (MVar, putMVar)
1415import Control.Monad.Trans (liftIO)
1516import qualified Data.ByteString.Builder as B
1617import qualified Data.Map as Map
@@ -81,7 +82,7 @@ generateMonolith (Options mode target maybeOutput) (Summary.Summary _ project _
8182 Obj.None ->
8283 return ()
8384
84− Obj.Some name names builder ->
85+ Obj.Some name _names builder ->
8586 let
8687 monolith =
8788 "(function(scope){\n'use strict';"
@@ -92,22 +93,22 @@ generateMonolith (Options mode target maybeOutput) (Summary.Summary _ project _
9293 Nothing ->
9394 IO.writeBuilder "elm.js" monolith
9495
95− Just None ->
96− return ()
96+ Just output_ ->
97+ case output_ of
98+ None ->
99+ return ()
100+
101+ JavaScript maybeDir fileName ->
102+ do path <- toWritablePath maybeDir fileName
103+ IO.writeBuilder path monolith
97104
98− Just (JavaScript maybeDir fileName) ->
99− do path <- toWritablePath maybeDir fileName
100− IO.writeBuilder path monolith
105+ HtmlBuilder mvar ->
106+ putMVar mvar (Html.sandwich name monolith)
101107
102− Just (Html maybeDir fileName) ->
103− case names of
104− [] ->
108+ Html maybeDir fileName ->
105109 do path <- toWritablePath maybeDir fileName
106110 IO.writeBuilder path (Html.sandwich name monolith)
107111
108− _:_ ->
109− return ()
110−
111112
112113
113114-- GENERATE REPL MONOLITH
@@ -181,6 +182,7 @@ data Output
181182 = None
182183 | Html (Maybe FilePath) FilePath
183184 | JavaScript (Maybe FilePath) FilePath
185+ | HtmlBuilder (MVar B.Builder)
184186
185187
186188toWritablePath :: Maybe FilePath -> FilePath -> IO FilePath