Skip to content

Commit 8495b7c

Browse files
committed
deps: cacache@18.0.2
1 parent 796d1c7 commit 8495b7c

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

node_modules/cacache/lib/content/read.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@ async function read (cache, integrity, opts = {}) {
1313
const { size } = opts
1414
const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => {
1515
// get size
16-
const stat = await fs.stat(cpath)
16+
const stat = size ? { size } : await fs.stat(cpath)
1717
return { stat, cpath, sri }
1818
})
19-
if (typeof size === 'number' && stat.size !== size) {
20-
throw sizeError(size, stat.size)
21-
}
2219

2320
if (stat.size > MAX_SINGLE_READ_SIZE) {
2421
return readPipeline(cpath, stat.size, sri, new Pipeline()).concat()
2522
}
2623

2724
const data = await fs.readFile(cpath, { encoding: null })
25+
26+
if (stat.size !== data.length) {
27+
throw sizeError(stat.size, data.length)
28+
}
29+
2830
if (!ssri.checkData(data, sri)) {
2931
throw integrityError(sri, cpath)
3032
}
@@ -55,13 +57,10 @@ function readStream (cache, integrity, opts = {}) {
5557
// Set all this up to run on the stream and then just return the stream
5658
Promise.resolve().then(async () => {
5759
const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => {
58-
// just stat to ensure it exists
59-
const stat = await fs.stat(cpath)
60+
// get size
61+
const stat = size ? { size } : await fs.stat(cpath)
6062
return { stat, cpath, sri }
6163
})
62-
if (typeof size === 'number' && size !== stat.size) {
63-
return stream.emit('error', sizeError(size, stat.size))
64-
}
6564

6665
return readPipeline(cpath, stat.size, sri, stream)
6766
}).catch(err => stream.emit('error', err))

node_modules/cacache/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cacache",
3-
"version": "18.0.1",
3+
"version": "18.0.2",
44
"cache-version": {
55
"content": "2",
66
"index": "5"
@@ -16,7 +16,7 @@
1616
"snap": "tap",
1717
"coverage": "tap",
1818
"test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test",
19-
"lint": "eslint \"**/*.js\"",
19+
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
2020
"npmclilint": "npmcli-lint",
2121
"lintfix": "npm run lint -- --fix",
2222
"postsnap": "npm run lintfix --",
@@ -60,7 +60,7 @@
6060
},
6161
"devDependencies": {
6262
"@npmcli/eslint-config": "^4.0.0",
63-
"@npmcli/template-oss": "4.19.0",
63+
"@npmcli/template-oss": "4.21.3",
6464
"tap": "^16.0.0"
6565
},
6666
"engines": {
@@ -69,7 +69,7 @@
6969
"templateOSS": {
7070
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
7171
"windowsCI": false,
72-
"version": "4.19.0",
72+
"version": "4.21.3",
7373
"publish": "true"
7474
},
7575
"author": "GitHub Inc.",

package-lock.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"@sigstore/tuf": "^2.2.0",
101101
"abbrev": "^2.0.0",
102102
"archy": "~1.0.0",
103-
"cacache": "^18.0.1",
103+
"cacache": "^18.0.2",
104104
"chalk": "^5.3.0",
105105
"ci-info": "^4.0.0",
106106
"cli-columns": "^4.0.0",
@@ -3109,9 +3109,9 @@
31093109
}
31103110
},
31113111
"node_modules/cacache": {
3112-
"version": "18.0.1",
3113-
"resolved": "https://registry.npmjs.org/cacache/-/cacache-18.0.1.tgz",
3114-
"integrity": "sha512-g4Uf2CFZPaxtJKre6qr4zqLDOOPU7bNVhWjlNhvzc51xaTOx2noMOLhfFkTAqwtrAZAKQUuDfyjitzilpA8WsQ==",
3112+
"version": "18.0.2",
3113+
"resolved": "https://registry.npmjs.org/cacache/-/cacache-18.0.2.tgz",
3114+
"integrity": "sha512-r3NU8h/P+4lVUHfeRw1dtgQYar3DZMm4/cm2bZgOvrFC/su7budSOeqh52VJIC4U4iG1WWwV6vRW0znqBvxNuw==",
31153115
"inBundle": true,
31163116
"dependencies": {
31173117
"@npmcli/fs": "^3.1.0",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@sigstore/tuf": "^2.2.0",
6363
"abbrev": "^2.0.0",
6464
"archy": "~1.0.0",
65-
"cacache": "^18.0.1",
65+
"cacache": "^18.0.2",
6666
"chalk": "^5.3.0",
6767
"ci-info": "^4.0.0",
6868
"cli-columns": "^4.0.0",

0 commit comments

Comments
 (0)