packages feed

hsass 0.7.0 → 0.8.0

raw patch · 7 files changed

+39/−29 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Text.Sass.Functions: [importBase] :: SassImport -> Maybe FilePath
+ Text.Sass: def :: Default a => a
+ Text.Sass.Functions: [importAbsolutePath] :: SassImport -> Maybe FilePath
- Text.Sass.Functions: makePathImport :: String -> String -> SassImport
+ Text.Sass.Functions: makePathImport :: String -> SassImport
- Text.Sass.Functions: type SassFunctionType = SassValue Arguments of the function ('SassList'). -> IO SassValue Result of the computation.
+ Text.Sass.Functions: type SassFunctionType = SassValue " Arguments of the function ('SassList')." -> IO SassValue " Result of the computation."
- Text.Sass.Functions: type SassHeaderType = String Absolute path to the file being processed. -> IO [SassImport] Imports.
+ Text.Sass.Functions: type SassHeaderType = String " Absolute path to the file being processed." -> IO [SassImport] " Imports."
- Text.Sass.Functions: type SassImporterType = String Path to the import that needs to be loaded. -> String Absolute path to the importing file. -> IO [SassImport] Imports.
+ Text.Sass.Functions: type SassImporterType = String " Path to the import that needs to be loaded." -> String " Absolute path to the importing file." -> IO [SassImport] " Imports."
- Text.Sass.Options: data SassOutputStyle :: *
+ Text.Sass.Options: data SassOutputStyle
- Text.Sass.Values: data SassSeparator :: *
+ Text.Sass.Values: data SassSeparator
- Text.Sass.Values.Utils: data SassOp :: *
+ Text.Sass.Values.Utils: data SassOp

Files

CHANGELOG.md view
@@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.8.0] - 2018-11-25+### Changed+- Fix invalid usage of `sass_make_import` and fix `SassImport`. This is a+  breaking change. Fixes [#12](https://github.com/jakubfijalkowski/hsass/issues/12).+ ## [0.7.0] - 2018-04-02 ### Changed - This library uses UTF-8 to encode/decode all `CString`s (paths included!)@@ -79,3 +84,4 @@ [0.5.0]: https://github.com/jakubfijalkowski/hsass/compare/v0.4.2...v0.5.0 [0.6.0]: https://github.com/jakubfijalkowski/hsass/compare/v0.5.0...v0.6.0 [0.7.0]: https://github.com/jakubfijalkowski/hsass/compare/v0.6.0...v0.7.0+[0.8.0]: https://github.com/jakubfijalkowski/hsass/compare/v0.7.0...v0.8.0
Text/Sass/Functions.hs view
@@ -32,14 +32,18 @@ -- | Represents a sass import - a sass content with additional metadata. -- -- Even though this ADT has four fields, you may just provide either--- 'importPath' and 'importBase' and leave loading to the library, or provide--- 'importSource' and do not provide 'importPath' nor 'importBase'.+-- 'importPath' and 'importAbsolutePath' and leave loading to the library, or+-- provide 'importSource' and do not provide 'importAbsolutePath'. -- Nevertheless, you are free to provide all of the fields. data SassImport = SassImport {-    importPath      :: Maybe FilePath, -- ^ Path to the import, relative to base.-    importBase      :: Maybe FilePath, -- ^ Base path.-    importSource    :: Maybe String,   -- ^ Import's source.-    importSourceMap :: Maybe String    -- ^ Source map of the import.+    -- | Path to the import, as requested by the import statement.+    importPath         :: Maybe FilePath +    -- | Absolute path to the file.+  , importAbsolutePath :: Maybe FilePath +    -- | Import's source.+  , importSource       :: Maybe String+    -- | Source map of the import.+  , importSourceMap    :: Maybe String }  -- | Type of the function that acts like an importer.@@ -47,11 +51,11 @@ -- You may return the empty list in order to tell libsass to handle the import by -- itself. type SassImporterType =-       String-       -- ^ Path to the import that needs to be loaded.-    -> String-       -- ^ Absolute path to the importing file.-    -> IO [SassImport] -- ^ Imports.+     String+     -- ^ Path to the import that needs to be loaded.+  -> String+     -- ^ Absolute path to the importing file.+  -> IO [SassImport] -- ^ Imports.  -- | Description of the importer. data SassImporter = SassImporter {@@ -75,7 +79,7 @@ makeSourceImport :: String -> SassImport makeSourceImport s = SassImport Nothing Nothing (Just s) Nothing --- | 'makePathImport' @p b@ is equivalent to 'SassImport'--- @(Just p) (Just b) Nothing Nothing@.-makePathImport :: String -> String -> SassImport-makePathImport p b = SassImport (Just p) (Just b) Nothing Nothing+-- | 'makePathImport' @p@ is equivalent to 'SassImport'+-- @(Just p) (Just p) Nothing Nothing@.+makePathImport :: String -> SassImport+makePathImport p = SassImport (Just p) (Just p) Nothing Nothing
Text/Sass/Functions/Internal.hs view
@@ -69,12 +69,12 @@  -- | Converts 'SassImport' into native representation. makeNativeImport :: SassImport -> IO Lib.SassImportEntry-makeNativeImport el = do-    path <- maybeNew newUTF8CString $ importPath el-    base <- maybeNew newUTF8CString $ importPath el-    source <- maybeNew newUTF8CString $ importSource el-    srcmap <- maybeNew newUTF8CString $ importSourceMap el-    Lib.sass_make_import path base source srcmap+makeNativeImport el =+    maybeWith withUTF8CString (importPath el) $ \path ->+        maybeWith withUTF8CString (importAbsolutePath el) $ \absPath -> do+            source <- maybeNew newUTF8CString $ importSource el+            srcmap <- maybeNew newUTF8CString $ importSourceMap el+            Lib.sass_make_import path absPath source srcmap  -- | Frees native representation of 'SassImport'. freeNativeImport :: Lib.SassImportEntry -> IO ()
Text/Sass/Marshal/Internal.hs view
@@ -17,23 +17,23 @@ import qualified GHC.IO.Encoding          as E  -- | Marshal a NUL terminated C string (UTF-8 encoded) into Haskell string.--- | It is equivalent to 'peekCString' but with different encoding.+-- It is equivalent to 'peekCString' but with different encoding. peekUTF8CString :: CString -> IO String peekUTF8CString = GHC.peekCString E.utf8  -- | Marshal a Haskell string into a NUL terminated C string (UTF-8 encoded).--- | It is equivalent to 'newCString' but with different encoding.+-- It is equivalent to 'newCString' but with different encoding. newUTF8CString :: String -> IO CString newUTF8CString = GHC.newCString E.utf8 --- | Marshal a Haskell string into a C string (ie, character array)+-- | Marshal a Haskell string into a C string (i.e., character array) -- in temporary storage, with explicit length information.--- | It is equivalent to 'withCString' but with different encoding.+-- It is equivalent to 'withCString' but with different encoding. withUTF8CString :: String -> (CString -> IO a) -> IO a withUTF8CString = GHC.withCString E.utf8  -- | Copies 'ByteString' to newly allocated 'CString'. The result must be--- | explicitly freed using 'free' or 'finalizerFree'.+-- explicitly freed using 'free' or 'finalizerFree'. newCStringFromBS :: ByteString -> IO CString newCStringFromBS (BI.PS fp o l) = do   buf <- mallocBytes (l + 1)
Text/Sass/Utils.hs view
@@ -33,7 +33,7 @@     put $! f s #endif --- | 'withOptionalCString' @str action@, if @str@ is 'Nothing', @action@ is not+-- | 'withOptionalCString' @str action@, if @str@ is @Nothing@, @action@ is not -- invoked, otherwise behaves like 'withCString'. withOptionalUTF8CString :: Maybe String -> (CString -> IO ()) -> IO () withOptionalUTF8CString (Just str) action = withUTF8CString str action
hsass.cabal view
@@ -1,5 +1,5 @@ name:                hsass-version:             0.7.0+version:             0.8.0 license:             MIT license-file:        LICENSE author:              Jakub Fijałkowski <fiolek94@gmail.com>
test/Text/Sass/EncodingSpec.hs view
@@ -50,7 +50,7 @@  importFunction :: FilePath -> String -> String -> IO [SassImport] importFunction _ "src"  _ = return [makeSourceImport testInput]-importFunction p "path" _ = return [makePathImport p "."]+importFunction p "path" _ = return [makePathImport p] importFunction _ _ _      = fail "Unknown import"  importers :: FilePath -> [SassImporter]