aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/Plugin.purs
blob: 8bb53bec5e0b44b48c70abd21edd3ecd5a1c9263 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module PursLoader.Plugin
  ( Compile()
  , Context()
  , Options()
  , DependencyGraph()
  , dependenciesOf
  ) where

import Prelude (Unit())

import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Exception (Error())

import Data.Either (Either(..))
import Data.Function (Fn4(), runFn4)
import Data.Nullable (Nullable())

type Compile eff = Nullable Error -> DependencyGraph -> String -> Eff eff Unit

type Context eff = { compile :: Compile eff -> Eff eff Unit, options :: Options }

type Options = { bundle :: Boolean, output :: String, bundleOutput :: String }

dependenciesOf :: DependencyGraph -> String -> Either Error (Array String)
dependenciesOf = runFn4 dependenciesOfFn Left Right

foreign import data DependencyGraph :: *

foreign import dependenciesOfFn
  :: Fn4 (Error -> Either Error (Array String))
         (Array String -> Either Error (Array String))
         DependencyGraph
         String
         (Either Error (Array String))