aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authoreric <thul.eric@gmail.com>2016-03-13 10:07:58 -0400
committereric <thul.eric@gmail.com>2016-03-13 10:07:58 -0400
commit7a70d4eb331b60186e3800d15efd9115462c6a80 (patch)
tree9af0a5120593adeb47229d6a564fee86ab9f0856 /src
parentcfd5d2afba83a0082a3be638a05d1768ee73335e (diff)
parent1a7a07b7a4fa93a55a600ca9d466020f3e11ab5a (diff)
downloadpurs-loader-7a70d4eb331b60186e3800d15efd9115462c6a80.tar.gz
purs-loader-7a70d4eb331b60186e3800d15efd9115462c6a80.tar.zst
purs-loader-7a70d4eb331b60186e3800d15efd9115462c6a80.zip
Merge pull request #44 from ethul/topic/output-only-once
Topic/output only once
Diffstat (limited to 'src')
-rw-r--r--src/PursLoader/Loader.purs14
-rw-r--r--src/PursLoader/Plugin.purs2
2 files changed, 4 insertions, 12 deletions
diff --git a/src/PursLoader/Loader.purs b/src/PursLoader/Loader.purs
index c50c63c..97954f6 100644
--- a/src/PursLoader/Loader.purs
+++ b/src/PursLoader/Loader.purs
@@ -5,12 +5,12 @@ module PursLoader.Loader
5 , loaderFn 5 , loaderFn
6 ) where 6 ) where
7 7
8import Prelude (Unit(), ($), (>>=), (<$>), (<*>), (++), (<<<), bind, const, id, pure, unit, void) 8import Prelude (Unit(), ($), (>>=), (<$>), (<*>), (++), (<<<), bind, const, id, pure, unit)
9 9
10import Control.Bind (join) 10import Control.Bind (join)
11import Control.Monad.Eff (Eff(), foreachE) 11import Control.Monad.Eff (Eff(), foreachE)
12import Control.Monad.Eff.Console (CONSOLE()) 12import Control.Monad.Eff.Console (CONSOLE())
13import Control.Monad.Eff.Exception (EXCEPTION(), Error(), error, message) 13import Control.Monad.Eff.Exception (EXCEPTION(), Error(), error)
14 14
15import Data.Array ((!!)) 15import Data.Array ((!!))
16import Data.Either (Either(..), either) 16import Data.Either (Either(..), either)
@@ -19,10 +19,6 @@ import Data.Maybe (maybe)
19import Data.Nullable (toMaybe) 19import Data.Nullable (toMaybe)
20import Data.String.Regex (Regex(), match, noFlags, regex) 20import Data.String.Regex (Regex(), match, noFlags, regex)
21 21
22import Node.Encoding (Encoding(UTF8))
23import Node.Process (stderr)
24import Node.Stream (writeString)
25
26import Unsafe.Coerce (unsafeCoerce) 22import Unsafe.Coerce (unsafeCoerce)
27 23
28import PursLoader.LoaderRef 24import PursLoader.LoaderRef
@@ -57,15 +53,11 @@ loader ref source = do
57 pluginContext = (unsafeCoerce ref).purescriptWebpackPluginContext 53 pluginContext = (unsafeCoerce ref).purescriptWebpackPluginContext
58 54
59 compile :: AsyncCallback (Effects eff) -> Plugin.Compile (Effects_ eff) 55 compile :: AsyncCallback (Effects eff) -> Plugin.Compile (Effects_ eff)
60 compile callback error' graph output = do 56 compile callback error' graph = do
61 either (const $ pure unit) (\a -> debug ("Adding PureScript dependency " ++ a)) name 57 either (const $ pure unit) (\a -> debug ("Adding PureScript dependency " ++ a)) name
62 58
63 addDependency ref (resourcePath ref) 59 addDependency ref (resourcePath ref)
64 60
65 void $ writeString stderr UTF8 output (pure unit)
66
67 maybe (pure unit) (\a -> void $ writeString stderr UTF8 (message a) (pure unit)) (toMaybe error')
68
69 either (const $ callback (pure fixedError) "") id 61 either (const $ callback (pure fixedError) "") id
70 (handle <$> name <*> dependencies <*> exports) 62 (handle <$> name <*> dependencies <*> exports)
71 where 63 where
diff --git a/src/PursLoader/Plugin.purs b/src/PursLoader/Plugin.purs
index 8bb53be..c798c83 100644
--- a/src/PursLoader/Plugin.purs
+++ b/src/PursLoader/Plugin.purs
@@ -15,7 +15,7 @@ import Data.Either (Either(..))
15import Data.Function (Fn4(), runFn4) 15import Data.Function (Fn4(), runFn4)
16import Data.Nullable (Nullable()) 16import Data.Nullable (Nullable())
17 17
18type Compile eff = Nullable Error -> DependencyGraph -> String -> Eff eff Unit 18type Compile eff = Nullable Error -> DependencyGraph -> Eff eff Unit
19 19
20type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } 20type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options }
21 21