]> git.immae.eu Git - github/fretlink/purs-loader.git/blame - src/PursLoader/Options.purs
Updating bundle output option name
[github/fretlink/purs-loader.git] / src / PursLoader / Options.purs
CommitLineData
c194f84c 1module PursLoader.Options
63d6a244 2 ( Options()
3 , runOptions
c194f84c 4 ) where
5
63d6a244 6import Prelude ((<$>), (<<<), id)
03b840cb 7
63d6a244 8import Data.Foreign.Class (IsForeign, readProp)
9import Data.Foreign.NullOrUndefined (runNullOrUndefined)
10import Data.Maybe (maybe)
c194f84c 11
63d6a244 12import PursLoader.Path (joinPath)
c194f84c 13
d7811214 14newtype Options = Options { bundleOutput :: String }
c194f84c 15
d7811214 16type Options_ = { bundleOutput :: String }
c194f84c 17
63d6a244 18runOptions :: Options -> Options_
19runOptions (Options options) = options
2b620717 20
c194f84c 21instance isForeignOptions :: IsForeign Options where
63d6a244 22 read obj =
d7811214 23 Options <$> ({ bundleOutput: _ }
24 <$> (maybe bundleOutputDefault id <<< runNullOrUndefined <$> readProp bundleOutput obj))
63d6a244 25 where
d7811214 26 bundleOutput :: String
27 bundleOutput = "bundleOutput"
63d6a244 28
d7811214 29 bundleOutputDefault :: String
30 bundleOutputDefault = joinPath "output" "bundle.js"