packages feed

herringbone-wai 0.1.0 → 0.1.1

raw patch · 2 files changed

+13/−17 lines, 2 filesdep +textPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: text

API changes (from Hackage documentation)

- Web.Herringbone.Adapter.Wai: ambiguousSources :: [FilePath] -> File
- Web.Herringbone.Adapter.Wai: assetCompileError :: CompileError -> File
- Web.Herringbone.Adapter.Wai: class ToLazyByteString a
- Web.Herringbone.Adapter.Wai: fileError :: ByteString -> Piece -> File
- Web.Herringbone.Adapter.Wai: instance ToLazyByteString ByteString
- Web.Herringbone.Adapter.Wai: instance ToLazyByteString FilePath
- Web.Herringbone.Adapter.Wai: lookupFile :: Herringbone -> Pieces -> IO LookupResult
- Web.Herringbone.Adapter.Wai: toEpochTime :: UTCTime -> EpochTime
- Web.Herringbone.Adapter.Wai: toFile :: FilePath -> FilePath -> Piece -> IO File
- Web.Herringbone.Adapter.Wai: toLazyByteString :: ToLazyByteString a => a -> ByteString
- Web.Herringbone.Adapter.Wai: toLogicalPath :: Pieces -> LogicalPath

Files

Web/Herringbone/Adapter/Wai.hs view
@@ -1,8 +1,11 @@-module Web.Herringbone.Adapter.Wai where+module Web.Herringbone.Adapter.Wai (toApplication) where  import Control.Monad import qualified Data.ByteString as B-import qualified Data.ByteString.Lazy as BL+import qualified Data.ByteString.Lazy as BL hiding (pack)+import qualified Data.ByteString.Lazy.Char8 as BL+import qualified Data.Text.Encoding as T+import qualified Data.Text.Lazy as T import Data.Time import Data.Time.Clock.POSIX import System.Posix.Types (EpochTime)@@ -20,16 +23,7 @@  import Web.Herringbone -class ToLazyByteString a where-    toLazyByteString :: a -> BL.ByteString -instance ToLazyByteString FilePath where-    toLazyByteString = toLazyByteString . F.encode--instance ToLazyByteString B.ByteString where-    toLazyByteString = BL.fromChunks . (: [])-- -- | Convert a 'Herringbone' to a WAI 'Application'. toApplication :: Herringbone -> Application toApplication hb@(hbDestDir -> dest) =@@ -82,14 +76,17 @@  assetCompileError :: CompileError -> File assetCompileError err =-    fileError (toLazyByteString err) (unsafeToPiece "compile-error.html")+    fileError (BL.fromStrict err) (unsafeToPiece "compile-error.html")  ambiguousSources :: [FilePath] -> File ambiguousSources sources =-    let body = "<h1>Ambiguous asset source</h1>" <>+    let toLazyBS = BL.pack . F.encodeString+        htmlListItem item = "<li>" <> toLazyBS item <> "</li>"+        htmlList items = BL.concat (map htmlListItem items)+        body = "<h1>Ambiguous asset source</h1>" <>                 "<p>List of possible asset sources:</p>" <>                 "<ul>" <>-                BL.concat (map (\s -> "<li>" <> toLazyByteString s <> "</li>") sources) <>+                htmlList sources <>                 "</ul>"     in fileError body (unsafeToPiece "error-ambiguous-source.html") 
herringbone-wai.cabal view
@@ -1,15 +1,13 @@ name:                herringbone-wai-version:             0.1.0+version:             0.1.1 synopsis:            Wai adapter for the Herringbone web asset preprocessor. description:         Wai adapter for the Herringbone web asset preprocessor. license:             MIT license-file:        LICENSE author:              Harry Garrood maintainer:          harry@garrood.me--- copyright: category:            Web build-type:          Simple--- extra-source-files: cabal-version:       >=1.10  library@@ -22,6 +20,7 @@                        system-filepath,                        system-fileio,                        bytestring,+                       text,                        http-types   default-extensions:  OverloadedStrings,                        ViewPatterns