servant-static-th 0.1.0.6 → 0.2.0.0
raw patch · 3 files changed
+83/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Servant.Static.TH.Internal.Mime: data EOT
+ Servant.Static.TH.Internal.Mime: data ICO
+ Servant.Static.TH.Internal.Mime: data TTF
+ Servant.Static.TH.Internal.Mime: data WOFF
+ Servant.Static.TH.Internal.Mime: data WOFF2
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.EOT
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.ICO
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.TTF
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.WOFF
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.WOFF2
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.EOT Data.ByteString.Internal.ByteString
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.ICO Data.ByteString.Internal.ByteString
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.TTF Data.ByteString.Internal.ByteString
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.WOFF Data.ByteString.Internal.ByteString
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.WOFF2 Data.ByteString.Internal.ByteString
Files
- CHANGELOG.md +7/−1
- servant-static-th.cabal +1/−1
- src/Servant/Static/TH/Internal/Mime.hs +75/−0
CHANGELOG.md view
@@ -1,6 +1,12 @@ # Changelog -## v1.0.1.6+## v0.2.0.0++- Add+ [support](https://github.com/cdepillabout/servant-static-th/pull/4#pullrequestreview-102307694)+ for ico, eot, ttf, woff, and woff2 file. Thanks [Alex](https://github.com/delanoe)!++## v0.1.0.6 - Make it more efficient to embed bytestring filetypes. - Make everything other than HTML files be embedded as bytestrings. Don't
servant-static-th.cabal view
@@ -1,5 +1,5 @@ name: servant-static-th-version: 0.1.0.6+version: 0.2.0.0 synopsis: Embed a directory of static files in your Servant server description: Please see <https://github.com/cdepillabout/servant-static-th#readme README.md>. homepage: https://github.com/cdepillabout/servant-static-th
src/Servant/Static/TH/Internal/Mime.hs view
@@ -96,10 +96,15 @@ , ("html", MimeTypeInfo [t|HTML|] [t|Html|] htmlToExp) , ("jpeg", MimeTypeInfo [t|JPEG|] [t|ByteString|] byteStringToExp) , ("jpg", MimeTypeInfo [t|JPEG|] [t|ByteString|] byteStringToExp)+ , ("ico", MimeTypeInfo [t|ICO|] [t|ByteString|] byteStringToExp) , ("js", MimeTypeInfo [t|JS|] [t|ByteString|] byteStringToExp) , ("png", MimeTypeInfo [t|PNG|] [t|ByteString|] byteStringToExp) , ("svg", MimeTypeInfo [t|SVG|] [t|ByteString|] byteStringToExp) , ("txt", MimeTypeInfo [t|TXT|] [t|ByteString|] byteStringToExp)+ , ("eot", MimeTypeInfo [t|EOT|] [t|ByteString|] byteStringToExp)+ , ("ttf", MimeTypeInfo [t|TTF|] [t|ByteString|] byteStringToExp)+ , ("woff", MimeTypeInfo [t|WOFF|] [t|ByteString|] byteStringToExp)+ , ("woff2", MimeTypeInfo [t|WOFF2|] [t|ByteString|] byteStringToExp) ] -- | Just like 'extensionToMimeTypeInfo', but throw an error using 'fail' if@@ -165,6 +170,20 @@ mimeRender :: Proxy JPEG -> ByteString -> LByteString.ByteString mimeRender _ = LByteString.fromStrict +-- ICO++-- | @since 0.2.0.0+data ICO deriving Typeable++-- | @icon\/ico@+instance Accept ICO where+ contentType :: Proxy ICO -> MediaType+ contentType _ = "image" // "x-icon"++instance MimeRender ICO ByteString where+ mimeRender :: Proxy ICO -> ByteString -> LByteString.ByteString+ mimeRender _ = LByteString.fromStrict+ -- JS data JS deriving Typeable@@ -215,4 +234,60 @@ instance MimeRender TXT ByteString where mimeRender :: Proxy TXT -> ByteString -> LByteString.ByteString+ mimeRender _ = LByteString.fromStrict++-- EOT++-- | @since 0.2.0.0+data EOT deriving Typeable++-- | @fonts\/eot@+instance Accept EOT where+ contentType :: Proxy EOT -> MediaType+ contentType _ = "application" // "vnd.ms-fontobject"++instance MimeRender EOT ByteString where+ mimeRender :: Proxy EOT -> ByteString -> LByteString.ByteString+ mimeRender _ = LByteString.fromStrict++-- TTF++-- | @since 0.2.0.0+data TTF deriving Typeable++-- | @fonts\/ttf@+instance Accept TTF where+ contentType :: Proxy TTF -> MediaType+ contentType _ = "application" // "x-font-truetype"++instance MimeRender TTF ByteString where+ mimeRender :: Proxy TTF -> ByteString -> LByteString.ByteString+ mimeRender _ = LByteString.fromStrict++-- WOFF++-- | @since 0.2.0.0+data WOFF deriving Typeable++-- | @fonts\/woff@+instance Accept WOFF where+ contentType :: Proxy WOFF -> MediaType+ contentType _ = "font" // "woff"++instance MimeRender WOFF ByteString where+ mimeRender :: Proxy WOFF -> ByteString -> LByteString.ByteString+ mimeRender _ = LByteString.fromStrict++-- WOFF2++-- | @since 0.2.0.0+data WOFF2 deriving Typeable++-- | @fonts\/woff2@+instance Accept WOFF2 where+ contentType :: Proxy WOFF2 -> MediaType+ contentType _ = "font" // "woff2"++instance MimeRender WOFF2 ByteString where+ mimeRender :: Proxy WOFF2 -> ByteString -> LByteString.ByteString mimeRender _ = LByteString.fromStrict