diff --git a/node_modules/cacache/CHANGELOG.md b/node_modules/cacache/CHANGELOG.md index a9aeb3bc1fbe3..ec9174f80d76c 100644 --- a/node_modules/cacache/CHANGELOG.md +++ b/node_modules/cacache/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [11.2.0](https://github.com/zkat/cacache/compare/v11.1.0...v11.2.0) (2018-08-08) + + +### Features + +* **read:** add sync support to other internal read.js fns ([fe638b6](https://github.com/zkat/cacache/commit/fe638b6)) + + + # [11.1.0](https://github.com/zkat/cacache/compare/v11.0.3...v11.1.0) (2018-08-01) diff --git a/node_modules/cacache/lib/content/read.js b/node_modules/cacache/lib/content/read.js index e308ead92b8b5..8f1acc06d8d9d 100644 --- a/node_modules/cacache/lib/content/read.js +++ b/node_modules/cacache/lib/content/read.js @@ -73,8 +73,10 @@ function readStream (cache, integrity, opts) { let copyFileAsync if (fs.copyFile) { module.exports.copy = copy + module.exports.copy.sync = copySync copyFileAsync = BB.promisify(fs.copyFile) } + function copy (cache, integrity, dest, opts) { opts = ReadOpts(opts) return withContentSri(cache, integrity, (cpath, sri) => { @@ -82,11 +84,18 @@ function copy (cache, integrity, dest, opts) { }) } +function copySync (cache, integrity, dest, opts) { + opts = ReadOpts(opts) + return withContentSriSync(cache, integrity, (cpath, sri) => { + return fs.copyFileSync(cpath, dest) + }) +} + module.exports.hasContent = hasContent function hasContent (cache, integrity) { if (!integrity) { return BB.resolve(false) } return withContentSri(cache, integrity, (cpath, sri) => { - return lstatAsync(cpath).then(stat => ({size: stat.size, sri})) + return lstatAsync(cpath).then(stat => ({size: stat.size, sri, stat})) }).catch(err => { if (err.code === 'ENOENT') { return false } if (err.code === 'EPERM') { @@ -99,6 +108,26 @@ function hasContent (cache, integrity) { }) } +module.exports.hasContent.sync = hasContentSync +function hasContentSync (cache, integrity) { + if (!integrity) { return false } + return withContentSriSync(cache, integrity, (cpath, sri) => { + try { + const stat = fs.lstatSync(cpath) + return {size: stat.size, sri, stat} + } catch (err) { + if (err.code === 'ENOENT') { return false } + if (err.code === 'EPERM') { + if (process.platform !== 'win32') { + throw err + } else { + return false + } + } + } + }) +} + function withContentSri (cache, integrity, fn) { return BB.try(() => { const sri = ssri.parse(integrity) diff --git a/node_modules/cacache/package.json b/node_modules/cacache/package.json index 01e20c1346d0f..bf13242f80eb5 100644 --- a/node_modules/cacache/package.json +++ b/node_modules/cacache/package.json @@ -1,19 +1,19 @@ { - "_from": "cacache@latest", - "_id": "cacache@11.1.0", + "_from": "cacache@11.2.0", + "_id": "cacache@11.2.0", "_inBundle": false, - "_integrity": "sha512-wFLexxfPdlvoUlpHIaU4y4Vm+Im/otOPCg1ov5g9/HRfUhVA8GpDdQL66SWBgRpgNC+5ebMT1Vr1RyPaFrJVqw==", + "_integrity": "sha512-IFWl6lfK6wSeYCHUXh+N1lY72UDrpyrYQJNIVQf48paDuWbv5RbAtJYf/4gUQFObTCHZwdZ5sI8Iw7nqwP6nlQ==", "_location": "/cacache", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "cacache@latest", + "raw": "cacache@11.2.0", "name": "cacache", "escapedName": "cacache", - "rawSpec": "latest", + "rawSpec": "11.2.0", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "11.2.0" }, "_requiredBy": [ "#USER", @@ -21,9 +21,9 @@ "/make-fetch-happen", "/pacote" ], - "_resolved": "https://registry.npmjs.org/cacache/-/cacache-11.1.0.tgz", - "_shasum": "3d76dbc2e9da413acaad2557051960a4dad3e1a4", - "_spec": "cacache@latest", + "_resolved": "https://registry.npmjs.org/cacache/-/cacache-11.2.0.tgz", + "_shasum": "617bdc0b02844af56310e411c0878941d5739965", + "_spec": "cacache@11.2.0", "_where": "/Users/zkat/Documents/code/work/npm", "author": { "name": "Kat Marchán", @@ -124,5 +124,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "11.1.0" + "version": "11.2.0" } diff --git a/package-lock.json b/package-lock.json index da11c0f1e0cca..569cc7d5ab178 100644 --- a/package-lock.json +++ b/package-lock.json @@ -346,9 +346,9 @@ "integrity": "sha512-JGC3EV2bCzJH/ENSh3afyJrH4vwxbHTuO5ljLoI5+2iJOcEpMgP8T782jH9b5qGxf2mSUIp1lfGnfKNrRHpvVg==" }, "cacache": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-11.1.0.tgz", - "integrity": "sha512-wFLexxfPdlvoUlpHIaU4y4Vm+Im/otOPCg1ov5g9/HRfUhVA8GpDdQL66SWBgRpgNC+5ebMT1Vr1RyPaFrJVqw==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-11.2.0.tgz", + "integrity": "sha512-IFWl6lfK6wSeYCHUXh+N1lY72UDrpyrYQJNIVQf48paDuWbv5RbAtJYf/4gUQFObTCHZwdZ5sI8Iw7nqwP6nlQ==", "requires": { "bluebird": "^3.5.1", "chownr": "^1.0.1", diff --git a/package.json b/package.json index a13ba6f33ec56..7ad6851d949c1 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "bin-links": "^1.1.2", "bluebird": "~3.5.1", "byte-size": "^4.0.3", - "cacache": "^11.1.0", + "cacache": "^11.2.0", "call-limit": "~1.1.0", "chownr": "~1.0.1", "cli-columns": "^3.1.2",