Skip to content

Commit

Permalink
deps: cacache@17.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed May 17, 2023
1 parent afb936c commit afc38a5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
32 changes: 23 additions & 9 deletions node_modules/cacache/lib/content/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const fsm = require('fs-minipass')

module.exports = write

// Cache of move operations in process so we don't duplicate
const moveOperations = new Map()

async function write (cache, data, opts = {}) {
const { algorithms, size, integrity } = opts

Expand Down Expand Up @@ -159,16 +162,27 @@ async function makeTmp (cache, opts) {
async function moveToDestination (tmp, cache, sri, opts) {
const destination = contentPath(cache, sri)
const destDir = path.dirname(destination)

await fs.mkdir(destDir, { recursive: true })
try {
await moveFile(tmp.target, destination, { overwrite: false })
tmp.moved = true
} catch (err) {
if (!err.message.startsWith('The destination file exists')) {
throw Object.assign(err, { code: 'EEXIST' })
}
if (moveOperations.has(destination)) {
return moveOperations.get(destination)
}
moveOperations.set(
destination,
fs.mkdir(destDir, { recursive: true })
.then(async () => {
await moveFile(tmp.target, destination, { overwrite: false })
tmp.moved = true
return tmp.moved
})
.catch(err => {
if (!err.message.startsWith('The destination file exists')) {
throw Object.assign(err, { code: 'EEXIST' })
}
}).finally(() => {
moveOperations.delete(destination)
})

)
return moveOperations.get(destination)
}

function sizeError (expected, found) {
Expand Down
6 changes: 3 additions & 3 deletions node_modules/cacache/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cacache",
"version": "17.1.0",
"version": "17.1.2",
"cache-version": {
"content": "2",
"index": "5"
Expand Down Expand Up @@ -60,7 +60,7 @@
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.14.1",
"@npmcli/template-oss": "4.15.1",
"tap": "^16.0.0"
},
"engines": {
Expand All @@ -69,7 +69,7 @@
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"windowsCI": false,
"version": "4.14.1",
"version": "4.15.1",
"publish": "true"
},
"author": "GitHub Inc.",
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"@npmcli/run-script": "^6.0.2",
"abbrev": "^2.0.0",
"archy": "~1.0.0",
"cacache": "^17.1.0",
"cacache": "^17.1.2",
"chalk": "^4.1.2",
"ci-info": "^3.8.0",
"cli-columns": "^4.0.0",
Expand Down Expand Up @@ -3288,9 +3288,9 @@
}
},
"node_modules/cacache": {
"version": "17.1.0",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.0.tgz",
"integrity": "sha512-hXpFU+Z3AfVmNuiLve1qxWHMq0RSIt5gjCKAHi/M6DktwFwDdAXAtunl1i4WSKaaVcU9IsRvXFg42jTHigcC6Q==",
"version": "17.1.2",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.2.tgz",
"integrity": "sha512-VcRDUtZd9r7yfGDpdm3dBDBSQbLd19IqWs9q1tuB9g6kmxYLwIjfLngRKMCfDHxReuf0SBclRuYn66Xds7jzUQ==",
"inBundle": true,
"dependencies": {
"@npmcli/fs": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@npmcli/run-script": "^6.0.2",
"abbrev": "^2.0.0",
"archy": "~1.0.0",
"cacache": "^17.1.0",
"cacache": "^17.1.2",
"chalk": "^4.1.2",
"ci-info": "^3.8.0",
"cli-columns": "^4.0.0",
Expand Down

0 comments on commit afc38a5

Please sign in to comment.