on master help sign in
drop blaze-builder dependency for wai-app-static
commit8bda706c039453d4b5b38242c37f50266274c5ab authorMichael Karg <mgoremeier@gmail.com> dateTue 13 Mar 2018, 13:53 (9 years ago) parent9ebe0d6
6 files changed+15−13
wai-app-static/ChangeLog.md+4 wai-app-static/Network/Wai/Application/Static.hs+2−2 wai-app-static/WaiAppStatic/Storage/Embedded/Runtime.hs+3−3 wai-app-static/WaiAppStatic/Storage/Embedded/TH.hs+2−2 wai-app-static/WaiAppStatic/Types.hs+1−2 wai-app-static/wai-app-static.cabal+3−4
wai-app-static/ChangeLog.md+4
@@ -1,3 +1,7 @@
1+## 3.1.6.2
2+
3+* Drop dependency on blaze-builder
4+
15## 3.1.6.1
26
37* Add `<>` import
wai-app-static/Network/Wai/Application/Static.hs+2−2
@@ -34,7 +34,7 @@ import qualified Data.ByteString.Lazy as L
3434import Data.ByteString.Lazy.Char8 ()
3535import Control.Monad.IO.Class (liftIO)
3636
37−import Blaze.ByteString.Builder (toByteString)
37+import Data.ByteString.Builder (toLazyByteString)
3838
3939import Data.FileEmbed (embedFile)
4040
@@ -262,7 +262,7 @@ staticAppPieces ss rawPieces req sendResponse = liftIO $ do
262262 ] lbs
263263
264264 response (Redirect pieces' mHash) = do
265− let loc = (ssMkRedirect ss) pieces' $ toByteString (H.encodePathSegments $ map fromPiece pieces')
265+ let loc = ssMkRedirect ss pieces' $ L.toStrict $ toLazyByteString (H.encodePathSegments $ map fromPiece pieces')
266266 let qString = case mHash of
267267 Just hash -> replace "etag" (Just hash) (W.queryString req)
268268 Nothing -> remove "etag" (W.queryString req)
wai-app-static/WaiAppStatic/Storage/Embedded/Runtime.hs+3−3
@@ -8,7 +8,7 @@ import WaiAppStatic.Types
88import Data.ByteString (ByteString)
99import Control.Arrow ((&&&), second)
1010import Data.List
11−import Blaze.ByteString.Builder (fromByteString)
11+import Data.ByteString.Builder (byteString)
1212import qualified Network.Wai as W
1313import qualified Data.Map as Map
1414import Data.Function (on)
@@ -50,7 +50,7 @@ toEntry :: (Piece, EmbeddedEntry) -> Either FolderName File
5050toEntry (name, EEFolder{}) = Left name
5151toEntry (name, EEFile bs) = Right File
5252 { fileGetSize = fromIntegral $ S.length bs
53− , fileToResponse = \s h -> W.responseBuilder s h $ fromByteString bs
53+ , fileToResponse = \s h -> W.responseBuilder s h $ byteString bs
5454 , fileName = name
5555 , fileGetHash = return $ Just $ runHash bs
5656 , fileGetModified = Nothing
@@ -87,7 +87,7 @@ toEmbedded fps =
8787bsToFile :: Piece -> ByteString -> File
8888bsToFile name bs = File
8989 { fileGetSize = fromIntegral $ S.length bs
90− , fileToResponse = \s h -> W.responseBuilder s h $ fromByteString bs
90+ , fileToResponse = \s h -> W.responseBuilder s h $ byteString bs
9191 , fileName = name
9292 , fileGetHash = return $ Just $ runHash bs
9393 , fileGetModified = Nothing
wai-app-static/WaiAppStatic/Storage/Embedded/TH.hs+2−2
@@ -5,7 +5,7 @@ module WaiAppStatic.Storage.Embedded.TH(
55 , mkSettings
66) where
77
8−import Blaze.ByteString.Builder.ByteString (insertByteString)
8+import Data.ByteString.Builder.Extra (byteStringInsert)
99import Codec.Compression.GZip (compress)
1010import Control.Applicative
1111import Data.ByteString.Unsafe (unsafePackAddressLen)
@@ -130,7 +130,7 @@ embeddedToFile entry = File
130130 let h' = if embCompressed entry
131131 then h ++ [("Content-Encoding", "gzip")]
132132 else h
133− in W.responseBuilder s h' $ insertByteString $ embContent entry
133+ in W.responseBuilder s h' $ byteStringInsert $ embContent entry
134134
135135 -- Usually the fileName should just be the filename not the entire path,
136136 -- but we need the whole path to make the lookup within lookupMime
wai-app-static/WaiAppStatic/Types.hs+1−2
@@ -1,4 +1,3 @@
1−{-# LANGUAGE OverloadedStrings #-}
21module WaiAppStatic.Types
32 ( -- * Pieces
43 Piece
@@ -25,7 +24,7 @@ import qualified Network.Wai as W
2524import Data.ByteString (ByteString)
2625import System.Posix.Types (EpochTime)
2726import qualified Data.Text as T
28−import Blaze.ByteString.Builder (Builder)
27+import Data.ByteString.Builder (Builder)
2928import Network.Mime (MimeType)
3029
3130-- | An individual component of a path, or of a filepath.
wai-app-static/wai-app-static.cabal+3−4
@@ -1,5 +1,5 @@
11name: wai-app-static
2−version: 3.1.6.1
2+version: 3.1.6.2
33license: MIT
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -27,7 +27,7 @@ Flag print
2727library
2828 build-depends: base >= 4 && < 5
2929 , wai >= 3.0 && < 3.3
30− , bytestring >= 0.9.1.4
30+ , bytestring >= 0.10.4
3131 , http-types >= 0.7
3232 , transformers >= 0.2.2
3333 , unix-compat >= 0.2
@@ -37,7 +37,6 @@ library
3737 , old-locale >= 1.0.0.2
3838 , file-embed >= 0.0.3.1
3939 , text >= 0.7
40− , blaze-builder >= 0.2.1.4
4140 , cryptonite >= 0.6
4241 , memory >= 0.7
4342 , http-date
@@ -74,7 +73,7 @@ Executable warp
7473 , wai-app-static
7574 , directory >= 1.0
7675 , containers >= 0.2
77− , bytestring >= 0.9.1.4
76+ , bytestring >= 0.10.4
7877 , text >= 0.7
7978 , mime-types >= 0.1 && < 0.2
8079