diff options
author | eric <thul.eric@gmail.com> | 2016-03-13 10:07:58 -0400 |
---|---|---|
committer | eric <thul.eric@gmail.com> | 2016-03-13 10:07:58 -0400 |
commit | 7a70d4eb331b60186e3800d15efd9115462c6a80 (patch) | |
tree | 9af0a5120593adeb47229d6a564fee86ab9f0856 /src/PursLoader | |
parent | cfd5d2afba83a0082a3be638a05d1768ee73335e (diff) | |
parent | 1a7a07b7a4fa93a55a600ca9d466020f3e11ab5a (diff) | |
download | purs-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/PursLoader')
-rw-r--r-- | src/PursLoader/Loader.purs | 14 | ||||
-rw-r--r-- | src/PursLoader/Plugin.purs | 2 |
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 | ||
8 | import Prelude (Unit(), ($), (>>=), (<$>), (<*>), (++), (<<<), bind, const, id, pure, unit, void) | 8 | import Prelude (Unit(), ($), (>>=), (<$>), (<*>), (++), (<<<), bind, const, id, pure, unit) |
9 | 9 | ||
10 | import Control.Bind (join) | 10 | import Control.Bind (join) |
11 | import Control.Monad.Eff (Eff(), foreachE) | 11 | import Control.Monad.Eff (Eff(), foreachE) |
12 | import Control.Monad.Eff.Console (CONSOLE()) | 12 | import Control.Monad.Eff.Console (CONSOLE()) |
13 | import Control.Monad.Eff.Exception (EXCEPTION(), Error(), error, message) | 13 | import Control.Monad.Eff.Exception (EXCEPTION(), Error(), error) |
14 | 14 | ||
15 | import Data.Array ((!!)) | 15 | import Data.Array ((!!)) |
16 | import Data.Either (Either(..), either) | 16 | import Data.Either (Either(..), either) |
@@ -19,10 +19,6 @@ import Data.Maybe (maybe) | |||
19 | import Data.Nullable (toMaybe) | 19 | import Data.Nullable (toMaybe) |
20 | import Data.String.Regex (Regex(), match, noFlags, regex) | 20 | import Data.String.Regex (Regex(), match, noFlags, regex) |
21 | 21 | ||
22 | import Node.Encoding (Encoding(UTF8)) | ||
23 | import Node.Process (stderr) | ||
24 | import Node.Stream (writeString) | ||
25 | |||
26 | import Unsafe.Coerce (unsafeCoerce) | 22 | import Unsafe.Coerce (unsafeCoerce) |
27 | 23 | ||
28 | import PursLoader.LoaderRef | 24 | import 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(..)) | |||
15 | import Data.Function (Fn4(), runFn4) | 15 | import Data.Function (Fn4(), runFn4) |
16 | import Data.Nullable (Nullable()) | 16 | import Data.Nullable (Nullable()) |
17 | 17 | ||
18 | type Compile eff = Nullable Error -> DependencyGraph -> String -> Eff eff Unit | 18 | type Compile eff = Nullable Error -> DependencyGraph -> Eff eff Unit |
19 | 19 | ||
20 | type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } | 20 | type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } |
21 | 21 | ||