From 87145c4d29e9ab45d04c62d19e8697527728549f Mon Sep 17 00:00:00 2001 From: eric thul Date: Tue, 8 Mar 2016 21:58:55 -0500 Subject: Handle optional bundling by the compiler Resolves ethul/purescript-webpack-plugin#9 --- src/PursLoader/Plugin.purs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/PursLoader/Plugin.purs') diff --git a/src/PursLoader/Plugin.purs b/src/PursLoader/Plugin.purs index 23f8600..520c786 100644 --- a/src/PursLoader/Plugin.purs +++ b/src/PursLoader/Plugin.purs @@ -2,6 +2,7 @@ module PursLoader.Plugin ( Result() , Compile() , Context() + , Options() , ImmutableMap() , DependencyGraph() , get @@ -22,7 +23,9 @@ type Result = { srcMap :: ImmutableMap String String, ffiMap :: ImmutableMap Str type Compile eff = Nullable Error -> Result -> Eff eff Unit -type Context eff = { compile :: Compile eff -> Eff eff Unit } +type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } + +type Options = { bundle :: Boolean, output :: String, bundleOutput :: String } get :: forall key value. ImmutableMap key value -> key -> Maybe value get = runFn4 getFn Nothing Just -- cgit v1.2.3 From 845f3ec3c5b13a47d60b9ff2be14bf41fb5c4734 Mon Sep 17 00:00:00 2001 From: eric thul Date: Sat, 12 Mar 2016 14:33:55 -0500 Subject: Handling dependencies --- src/PursLoader/Plugin.purs | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src/PursLoader/Plugin.purs') diff --git a/src/PursLoader/Plugin.purs b/src/PursLoader/Plugin.purs index 520c786..c798c83 100644 --- a/src/PursLoader/Plugin.purs +++ b/src/PursLoader/Plugin.purs @@ -1,11 +1,8 @@ module PursLoader.Plugin - ( Result() - , Compile() + ( Compile() , Context() , Options() - , ImmutableMap() , DependencyGraph() - , get , dependenciesOf ) where @@ -16,34 +13,19 @@ import Control.Monad.Eff.Exception (Error()) import Data.Either (Either(..)) import Data.Function (Fn4(), runFn4) -import Data.Maybe (Maybe(..)) import Data.Nullable (Nullable()) -type Result = { srcMap :: ImmutableMap String String, ffiMap :: ImmutableMap String String, graph :: DependencyGraph } - -type Compile eff = Nullable Error -> Result -> Eff eff Unit +type Compile eff = Nullable Error -> DependencyGraph -> Eff eff Unit type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options } type Options = { bundle :: Boolean, output :: String, bundleOutput :: String } -get :: forall key value. ImmutableMap key value -> key -> Maybe value -get = runFn4 getFn Nothing Just - dependenciesOf :: DependencyGraph -> String -> Either Error (Array String) dependenciesOf = runFn4 dependenciesOfFn Left Right -foreign import data ImmutableMap :: * -> * -> * - foreign import data DependencyGraph :: * -foreign import getFn - :: forall key value. Fn4 (Maybe value) - (value -> Maybe value) - (ImmutableMap key value) - key - (Maybe value) - foreign import dependenciesOfFn :: Fn4 (Error -> Either Error (Array String)) (Array String -> Either Error (Array String)) -- cgit v1.2.3