{-# LANGUAGE OverloadedStrings #-}
module Media.TS (compileTypeScriptCompiler) where

import           Control.Monad ((>=>))
import           Hakyll

compileTypeScriptCompiler :: Compiler (Item String)
compileTypeScriptCompiler :: Compiler (Item String)
compileTypeScriptCompiler = Compiler (Item String)
getResourceString Compiler (Item String)
-> (Item String -> Compiler (Item String))
-> Compiler (Item String)
forall a b. Compiler a -> (a -> Compiler b) -> Compiler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (String -> Compiler String)
-> Item String -> Compiler (Item String)
forall a b. (a -> Compiler b) -> Item a -> Compiler (Item b)
withItemBody String -> Compiler String
compileTS
  where
    compileTS :: String -> Compiler String
compileTS = String -> [String] -> String -> Compiler String
unixFilter String
"tools/ts-stdin-compile.sh" [] (String -> Compiler String)
-> (String -> Compiler String) -> String -> Compiler String
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> String -> [String] -> String -> Compiler String
unixFilter String
"npx" [String
"terser", String
"--compress", String
"--mangle", String
"--format", String
"comments=false", String
"--ecma", String
"6", String
"--"]