yarn-lock 0.6.1 → 0.6.2
raw patch · 5 files changed
+43/−16 lines, 5 filesdep ~megaparsec
Dependency ranges changed: megaparsec
Files
- CHANGELOG.md +9/−0
- src/Yarn/Lock/File.hs +7/−5
- src/Yarn/Lock/Types.hs +6/−0
- tests/TestFile.hs +16/−6
- yarn-lock.cabal +5/−5
CHANGELOG.md view
@@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.6.2] - 2019-12-22++- `megaparsec` `0.8` is compatible as well as `0.7`.+- Support for local and remote file source remotes without hashes. Some old versions of might have these. `FileRemoteNoIntegrity` and `FileLocalNoIntegrity`.++## [0.6.1] - 2019-11-03++- Update `megaparsec` dependency to `0.7`.+ ## [0.6.0] - 2018-12-19 ### Added
src/Yarn/Lock/File.hs view
@@ -155,18 +155,20 @@ checkFileLocal = do resolved <- vToM $ getField text "resolved" fs let (file, mayHash) = findUrlHash resolved- fileLocalSha1 <- mayHash fileLocalPath <- if "file:" `Text.isPrefixOf` file then Just $ noPrefix "file:" file else Nothing- pure $ T.FileLocal{..}+ case mayHash of+ Just hash -> pure (T.FileLocal fileLocalPath hash)+ Nothing -> pure (T.FileLocalNoIntegrity fileLocalPath) checkFile :: Maybe T.Remote checkFile = do resolved <- vToM (getField text "resolved" fs)- let (fileUrl, mayFileSha1) = findUrlHash resolved- fileSha1 <- mayFileSha1- pure $ T.FileRemote{..}+ let (fileUrl, mayHash) = findUrlHash resolved+ case mayHash of+ Just hash -> pure (T.FileRemote fileUrl hash)+ Nothing -> pure (T.FileRemoteNoIntegrity fileUrl) -- | ensure the prefix is removed noPrefix :: Text -> Text -> Text
src/Yarn/Lock/Types.hs view
@@ -69,6 +69,9 @@ , fileSha1 :: Text -- ^ sha1 hash of the file (attached to the link) }+ | FileRemoteNoIntegrity+ { fileNoIntegrityUrl :: Text -- ^ URL to a remote file+ } | GitRemote { gitRepoUrl :: Text -- ^ valid git remote URL , gitRev :: Text -- ^ git tree-ish (commit, branch, &c.)@@ -77,4 +80,7 @@ | FileLocal { fileLocalPath :: Text -- ^ (relative) path to file on the local machine , fileLocalSha1 :: Text -- ^ sha1 hash of the file (attached to the link)+ }+ | FileLocalNoIntegrity+ { fileLocalNoIntegrityPath :: Text -- ^ (relative) path to file on the local machine } deriving (Eq, Show)
tests/TestFile.hs view
@@ -51,28 +51,38 @@ let sha = "helloimref" good = minimalAst $ [ ("resolved", Left $ "https://gnu.org/stallmanstoe#" <> sha) ]- bad = minimalAst [ ("resolved", Left "https://nohash") ]+ goodNoIntegrity = minimalAst $+ [ ("resolved", Left $ "https://gnu.org/stallmanstoe") ] astToPackageSuccess good <&> T.remote >>= \case- T.FileRemote{..} -> assertEqual "file sha" sha fileSha1+ T.FileRemote{..} -> do+ assertEqual "remote url" "https://gnu.org/stallmanstoe" fileUrl+ assertEqual "file sha" sha fileSha1 a -> assertFailure ("should be FileRemote, is " <> show a)- astToPackageFailureWith (pure File.UnknownRemoteType) bad+ astToPackageSuccess goodNoIntegrity+ <&> T.remote >>= \case+ T.FileRemoteNoIntegrity{..} -> assertEqual "remote url" "https://gnu.org/stallmanstoe" fileNoIntegrityUrl+ a -> assertFailure ("should be FileRemote, is " <> show a) case_fileLocal :: Assertion case_fileLocal = do let good = minimalAst $ [ ("resolved" , Left $ "file:../extensions/jupyterlab-toc-0.6.0.tgz#393fe") ]- bad = minimalAst $+ goodNoIntegrity = minimalAst $ [ ("resolved"- , Left $ "\"file:some/file/nohash\"") ]+ , Left $ "file:../extensions/jupyterlab-toc-0.6.0.tgz") ] astToPackageSuccess good <&> T.remote >>= \case T.FileLocal{..} -> do assertEqual "file path" "../extensions/jupyterlab-toc-0.6.0.tgz" fileLocalPath assertEqual "file sha" "393fe" fileLocalSha1 a -> assertFailure ("should be FileLocal, is " <> show a)- astToPackageFailureWith (pure File.UnknownRemoteType) bad+ astToPackageSuccess goodNoIntegrity+ <&> T.remote >>= \case+ T.FileLocalNoIntegrity{..} -> do+ assertEqual "file path" "../extensions/jupyterlab-toc-0.6.0.tgz" fileLocalNoIntegrityPath+ a -> assertFailure ("should be FileLocal, is " <> show a) case_missingField :: Assertion case_missingField = do
yarn-lock.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.2.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: d82313ce33d9f08b44f33c038434abea15c408bbc42e3798603a87412d1cb0ed+-- hash: dc2ffdfc08b066957d4928034489010aacd67ec2a4833ddf99497364bbd82670 name: yarn-lock-version: 0.6.1+version: 0.6.2 synopsis: Represent and parse yarn.lock files description: Types and parser for the lock file format of the npm successor yarn. All modules should be imported qualified. category: Data@@ -42,7 +42,7 @@ base ==4.* , containers , either >=4 && <6- , megaparsec ==7.*+ , megaparsec >=7 && <9 , protolude ==0.2.* , text default-language: Haskell2010@@ -63,7 +63,7 @@ , base ==4.* , containers , either >=4 && <6- , megaparsec ==7.*+ , megaparsec >=7 && <9 , neat-interpolation >=0.3 , protolude , quickcheck-instances ==0.3.*