From 0f0403a8359f316ece009442f2b3803e897cc9f1 Mon Sep 17 00:00:00 2001 From: eric thul Date: Sun, 13 Mar 2016 10:00:17 -0400 Subject: Defers to the plugin for writing PureScript output --- bower.json | 3 +-- docs/PursLoader/Plugin.md | 2 +- src/PursLoader/Loader.purs | 14 +++----------- src/PursLoader/Plugin.purs | 2 +- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/bower.json b/bower.json index 681612d..761c24c 100644 --- a/bower.json +++ b/bower.json @@ -5,7 +5,6 @@ "purescript-aff": "^0.13.0", "purescript-foreign": "^0.7.0", "purescript-unsafe-coerce": "~0.1.0", - "purescript-nullable": "~0.2.1", - "purescript-node-process": "~0.4.1" + "purescript-nullable": "~0.2.1" } } diff --git a/docs/PursLoader/Plugin.md b/docs/PursLoader/Plugin.md index 9f9f852..7a524da 100644 --- a/docs/PursLoader/Plugin.md +++ b/docs/PursLoader/Plugin.md @@ -3,7 +3,7 @@ #### `Compile` ``` purescript -type Compile eff = Nullable Error -> DependencyGraph -> String -> Eff eff Unit +type Compile eff = Nullable Error -> DependencyGraph -> Eff eff Unit ``` #### `Context` 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 , loaderFn ) where -import Prelude (Unit(), ($), (>>=), (<$>), (<*>), (++), (<<<), bind, const, id, pure, unit, void) +import Prelude (Unit(), ($), (>>=), (<$>), (<*>), (++), (<<<), bind, const, id, pure, unit) import Control.Bind (join) import Control.Monad.Eff (Eff(), foreachE) import Control.Monad.Eff.Console (CONSOLE()) -import Control.Monad.Eff.Exception (EXCEPTION(), Error(), error, message) +import Control.Monad.Eff.Exception (EXCEPTION(), Error(), error) import Data.Array ((!!)) import Data.Either (Either(..), either) @@ -19,10 +19,6 @@ import Data.Maybe (maybe) import Data.Nullable (toMaybe) import Data.String.Regex (Regex(), match, noFlags, regex) -import Node.Encoding (Encoding(UTF8)) -import Node.Process (stderr) -import Node.Stream (writeString) - import Unsafe.Coerce (unsafeCoerce) import PursLoader.LoaderRef @@ -57,15 +53,11 @@ loader ref source = do pluginContext = (unsafeCoerce ref).purescriptWebpackPluginContext compile :: AsyncCallback (Effects eff) -> Plugin.Compile (Effects_ eff) - compile callback error' graph output = do + compile callback error' graph = do either (const $ pure unit) (\a -> debug ("Adding PureScript dependency " ++ a)) name addDependency ref (resourcePath ref) - void $ writeString stderr UTF8 output (pure unit) - - maybe (pure unit) (\a -> void $ writeString stderr UTF8 (message a) (pure unit)) (toMaybe error') - either (const $ callback (pure fixedError) "") id (handle <$> name <*> dependencies <*> exports) 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(..)) import Data.Function (Fn4(), runFn4) import Data.Nullable (Nullable()) -type Compile eff = Nullable Error -> DependencyGraph -> String -> Eff eff Unit +type Compile eff = Nullable Error -> DependencyGraph -> Eff eff Unit type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } -- cgit v1.2.3