Comparing version 13.0.1 to 14.0.0
@@ -5,2 +5,11 @@ # Changelog | ||
## [14.0.0](https://github.com/npm/cacache/compare/v13.0.1...v14.0.0) (2020-01-28) | ||
### ⚠ BREAKING CHANGES | ||
* **deps:** bumps engines to >= 10 | ||
* **deps:** tar v6 and mkdirp v1 ([5a66e7a](https://github.com/npm/cacache/commit/5a66e7a)) | ||
### [13.0.1](https://github.com/npm/cacache/compare/v13.0.0...v13.0.1) (2019-09-30) | ||
@@ -7,0 +16,0 @@ |
@@ -18,5 +18,6 @@ 'use strict' | ||
// contentPath is the *strongest* algo given | ||
return path.join.apply( | ||
path, | ||
[contentDir(cache), sri.algorithm].concat(hashToSegments(sri.hexDigest())) | ||
return path.join( | ||
contentDir(cache), | ||
sri.algorithm, | ||
...hashToSegments(sri.hexDigest()) | ||
) | ||
@@ -23,0 +24,0 @@ } |
@@ -130,2 +130,3 @@ 'use strict' | ||
if (err.code === 'EPERM') { | ||
/* istanbul ignore else */ | ||
if (process.platform !== 'win32') { | ||
@@ -155,2 +156,3 @@ throw err | ||
if (err.code === 'EPERM') { | ||
/* istanbul ignore else */ | ||
if (process.platform !== 'win32') { | ||
@@ -180,3 +182,3 @@ throw err | ||
return Promise | ||
.all(sri[sri.pickAlgorithm()].map((meta) => { | ||
.all(digests.map((meta) => { | ||
return withContentSri(cache, meta, fn) | ||
@@ -207,6 +209,3 @@ .catch((err) => { | ||
// Throw generic error | ||
const genericError = results.find((r) => r instanceof Error) | ||
if (genericError) { | ||
throw genericError | ||
} | ||
throw results.find((r) => r instanceof Error) | ||
}) | ||
@@ -238,3 +237,3 @@ } | ||
let lastErr = null | ||
for (const meta of sri[sri.pickAlgorithm()]) { | ||
for (const meta of digests) { | ||
try { | ||
@@ -246,5 +245,3 @@ return withContentSriSync(cache, meta, fn) | ||
} | ||
if (lastErr) { | ||
throw lastErr | ||
} | ||
throw lastErr | ||
} | ||
@@ -251,0 +248,0 @@ } |
@@ -13,7 +13,5 @@ 'use strict' | ||
return hasContent(cache, integrity).then((content) => { | ||
if (content) { | ||
const sri = content.sri | ||
if (sri) { | ||
return rimraf(contentPath(cache, sri)).then(() => true) | ||
} | ||
// ~pretty~ sure we can't end up with a content lacking sri, but be safe | ||
if (content && content.sri) { | ||
return rimraf(contentPath(cache, content.sri)).then(() => true) | ||
} else { | ||
@@ -20,0 +18,0 @@ return false |
@@ -6,3 +6,3 @@ 'use strict' | ||
const chownr = util.promisify(require('chownr')) | ||
const mkdirp = util.promisify(require('mkdirp')) | ||
const mkdirp = require('mkdirp') | ||
const inflight = require('promise-inflight') | ||
@@ -9,0 +9,0 @@ const inferOwner = require('infer-owner') |
@@ -14,2 +14,5 @@ 'use strict' | ||
function moveFile (src, dest) { | ||
const isWindows = global.__CACACHE_TEST_FAKE_WINDOWS__ || | ||
process.platform === 'win32' | ||
// This isn't quite an fs.rename -- the assumption is that | ||
@@ -27,11 +30,20 @@ // if `dest` already exists, and we get certain errors while | ||
if (err) { | ||
if (err.code === 'EEXIST' || err.code === 'EBUSY') { | ||
if (isWindows && err.code === 'EPERM') { | ||
// XXX This is a really weird way to handle this situation, as it | ||
// results in the src file being deleted even though the dest | ||
// might not exist. Since we pretty much always write files to | ||
// deterministic locations based on content hash, this is likely | ||
// ok (or at worst, just ends in a future cache miss). But it would | ||
// be worth investigating at some time in the future if this is | ||
// really what we want to do here. | ||
return resolve() | ||
} else if (err.code === 'EEXIST' || err.code === 'EBUSY') { | ||
// file already exists, so whatever | ||
} else if (err.code === 'EPERM' && process.platform === 'win32') { | ||
// file handle stayed open even past graceful-fs limits | ||
return resolve() | ||
} else { | ||
return reject(err) | ||
} | ||
} else { | ||
return resolve() | ||
} | ||
return resolve() | ||
}) | ||
@@ -43,3 +55,3 @@ }) | ||
unlink(src), | ||
process.platform !== 'win32' && chmod(dest, '0444') | ||
!isWindows && chmod(dest, '0444') | ||
]) | ||
@@ -46,0 +58,0 @@ }) |
@@ -53,3 +53,3 @@ 'use strict' | ||
.reduce((promise, step, i) => { | ||
const label = step.name || `step #${i}` | ||
const label = step.name | ||
const start = new Date() | ||
@@ -212,2 +212,3 @@ return promise.then((stats) => { | ||
for (const k in entries) { | ||
/* istanbul ignore else */ | ||
if (hasOwnProperty(entries, k)) { | ||
@@ -214,0 +215,0 @@ const hashed = index.hashKey(k) |
{ | ||
"name": "cacache", | ||
"version": "13.0.1", | ||
"version": "14.0.0", | ||
"cache-version": { | ||
@@ -72,3 +72,3 @@ "content": "2", | ||
"minipass-pipeline": "^1.2.2", | ||
"mkdirp": "^0.5.1", | ||
"mkdirp": "^1.0.3", | ||
"move-concurrently": "^1.0.1", | ||
@@ -79,2 +79,3 @@ "p-map": "^3.0.0", | ||
"ssri": "^7.0.0", | ||
"tar": "^6.0.0", | ||
"unique-filename": "^1.1.1" | ||
@@ -94,5 +95,8 @@ }, | ||
}, | ||
"tap": { | ||
"100": true | ||
}, | ||
"engines": { | ||
"node": ">= 8" | ||
"node": ">= 10" | ||
} | ||
} |
@@ -15,4 +15,2 @@ # cacache [![npm version](https://img.shields.io/npm/v/cacache.svg)](https://npm.im/cacache) [![license](https://img.shields.io/npm/l/cacache.svg)](https://npm.im/cacache) [![Travis](https://img.shields.io/travis/npm/cacache.svg)](https://travis-ci.org/npm/cacache) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/npm/cacache?svg=true)](https://ci.appveyor.com/project/npm/cacache) [![Coverage Status](https://coveralls.io/repos/github/npm/cacache/badge.svg?branch=latest)](https://coveralls.io/github/npm/cacache?branch=latest) | ||
_Translations: [español](README.es.md)_ | ||
## Install | ||
@@ -19,0 +17,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99805
1674
19
616
+ Addedtar@^6.0.0
+ Addedchownr@2.0.0(transitive)
+ Addedminipass@5.0.0(transitive)
+ Addedminizlib@2.1.2(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedtar@6.2.1(transitive)
Updatedmkdirp@^1.0.3