packages feed

servant-static-th 0.2.0.1 → 0.2.1.0

raw patch · 4 files changed

+70/−14 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Servant.Static.TH: data GEXF
+ Servant.Static.TH: data JSON
+ Servant.Static.TH: data XML
+ Servant.Static.TH.Internal.Mime: data GEXF
+ Servant.Static.TH.Internal.Mime: data JSON
+ Servant.Static.TH.Internal.Mime: data XML
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.GEXF
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.JSON
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.Accept Servant.Static.TH.Internal.Mime.XML
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.GEXF Data.ByteString.Internal.ByteString
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.JSON Data.ByteString.Internal.ByteString
+ Servant.Static.TH.Internal.Mime: instance Servant.API.ContentTypes.MimeRender Servant.Static.TH.Internal.Mime.XML Data.ByteString.Internal.ByteString

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog +## v0.2.1.0++-   This adds MIME types for json, xml, gex.  Thanks [delanoe](https://github.com/delanoe)!  [#5](https://github.com/cdepillabout/servant-static-th/pull/5)+ ## v0.2.0.1  -   In v0.2.0.0, the new MIME types were not being exported from `Servant.Static.TH`.  This fixes that.
servant-static-th.cabal view
@@ -1,5 +1,5 @@ name:                servant-static-th-version:             0.2.0.1+version:             0.2.1.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.hs view
@@ -106,18 +106,21 @@     -- <https://github.com/cdepillabout/servant-static-th/pulls PR>.   , CSS   , EOT+  , GEXF   , GIF   , HTML   , Html   , ICO   , JPEG   , JS+  , JSON   , PNG   , SVG   , TTF   , TXT   , WOFF   , WOFF2+  , XML     -- * Easy-To-Use Names and Paths      -- | The functions in this section pick defaults for the template@@ -146,9 +149,11 @@ import Servant.Static.TH.Internal   ( CSS   , EOT+  , GEXF   , GIF   , ICO   , JPEG+  , JSON   , JS   , PNG   , SVG@@ -156,6 +161,7 @@   , TXT   , WOFF   , WOFF2+  , XML   , createApiDec   , createApiType   , createServerDec
src/Servant/Static/TH/Internal/Mime.hs view
@@ -90,21 +90,24 @@ -- that extension. extensionMimeTypeMap :: Map String MimeTypeInfo extensionMimeTypeMap =-  [ ("css", MimeTypeInfo [t|CSS|] [t|ByteString|] byteStringToExp)-  , ("gif", MimeTypeInfo [t|GIF|] [t|ByteString|] byteStringToExp)-  , ("htm", MimeTypeInfo [t|HTML|] [t|Html|] htmlToExp)-  , ("html", MimeTypeInfo [t|HTML|] [t|Html|] htmlToExp)+  [ ("css",  MimeTypeInfo [t|CSS|]  [t|ByteString|] byteStringToExp)+  , ("gif",  MimeTypeInfo [t|GIF|]  [t|ByteString|] byteStringToExp)+  , ("htm",  MimeTypeInfo [t|HTML|] [t|Html|]             htmlToExp)+  , ("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)+  , ("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)+  , ("woff2",MimeTypeInfo [t|WOFF2|][t|ByteString|] byteStringToExp)+  , ("json", MimeTypeInfo [t|JSON|] [t|ByteString|] byteStringToExp)+  , ("xml",  MimeTypeInfo [t|XML|]  [t|ByteString|] byteStringToExp)+  , ("gexf", MimeTypeInfo [t|GEXF|] [t|ByteString|] byteStringToExp)   ]  -- | Just like 'extensionToMimeTypeInfo', but throw an error using 'fail' if@@ -170,6 +173,8 @@   mimeRender :: Proxy JPEG -> ByteString -> LByteString.ByteString   mimeRender _ = LByteString.fromStrict ++ -- ICO  -- | @since 0.2.0.0@@ -291,3 +296,44 @@ instance MimeRender WOFF2 ByteString where   mimeRender :: Proxy WOFF2 -> ByteString -> LByteString.ByteString   mimeRender _ = LByteString.fromStrict+++-- | JSON file+data JSON deriving Typeable++-- | @application\/json@+instance Accept JSON where+  contentType :: Proxy JSON -> MediaType+  contentType _ = "application" // "json"++instance MimeRender JSON ByteString where+  mimeRender :: Proxy JSON -> ByteString -> LByteString.ByteString+  mimeRender _ = LByteString.fromStrict+++-- | XML file+data XML deriving Typeable++-- | @application\/xml@+instance Accept XML where+  contentType :: Proxy XML -> MediaType+  contentType _ = "application" // "xml"++instance MimeRender XML ByteString where+  mimeRender :: Proxy XML -> ByteString -> LByteString.ByteString+  mimeRender _ = LByteString.fromStrict+++-- | GEXF file (xml for graph application)+data GEXF deriving Typeable++-- | @application\/gexf@+instance Accept GEXF where+  contentType :: Proxy GEXF -> MediaType+  contentType _ = "application" // "gexf"++instance MimeRender GEXF ByteString where+  mimeRender :: Proxy GEXF -> ByteString -> LByteString.ByteString+  mimeRender _ = LByteString.fromStrict++