cacache 11.3.2 → 11.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/README.es.md +1 -1
- package/README.md +1 -1
- package/lib/content/path.js +1 -1
- package/lib/content/read.js +6 -6
- package/lib/content/write.js +4 -4
- package/lib/entry-index.js +4 -4
- package/lib/util/fix-owner.js +2 -2
- package/lib/verify.js +4 -4
- package/locales/en.json +3 -2
- package/package.json +11 -11
- package/put.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
3
|
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.
|
|
4
4
|
|
|
5
|
+
### [11.3.3](https://github.com/zkat/cacache/compare/v11.3.2...v11.3.3) (2019-06-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **audit:** npm audit fix ([200a6d5](https://github.com/zkat/cacache/commit/200a6d5))
|
|
11
|
+
* **config:** Add ssri config 'error' option ([#146](https://github.com/zkat/cacache/issues/146)) ([47de8f5](https://github.com/zkat/cacache/commit/47de8f5))
|
|
12
|
+
* **deps:** npm audit fix ([481a7dc](https://github.com/zkat/cacache/commit/481a7dc))
|
|
13
|
+
* **standard:** standard --fix ([7799149](https://github.com/zkat/cacache/commit/7799149))
|
|
14
|
+
* **write:** avoid another cb never called situation ([5156561](https://github.com/zkat/cacache/commit/5156561))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
<a name="11.3.2"></a>
|
|
6
19
|
## [11.3.2](https://github.com/zkat/cacache/compare/v11.3.1...v11.3.2) (2018-12-21)
|
|
7
20
|
|
package/README.es.md
CHANGED
|
@@ -287,7 +287,7 @@ entrada si existe.
|
|
|
287
287
|
|
|
288
288
|
* `key` - Clave de la entrada. Igual al argumento `clave`.
|
|
289
289
|
* `integrity` - [hacheo de Subresource Integrity](#integrity) del contenido al que se refiere esta entrada.
|
|
290
|
-
* `path` - Dirección del fichero de datos almacenados,
|
|
290
|
+
* `path` - Dirección del fichero de datos almacenados, unida al argumento `cache`.
|
|
291
291
|
* `time` - Hora de creación de la entrada
|
|
292
292
|
* `metadata` - Metadatos asignados a esta entrada por el usuario
|
|
293
293
|
|
package/README.md
CHANGED
|
@@ -290,7 +290,7 @@ one exists.
|
|
|
290
290
|
|
|
291
291
|
* `key` - Key the entry was looked up under. Matches the `key` argument.
|
|
292
292
|
* `integrity` - [Subresource Integrity hash](#integrity) for the content this entry refers to.
|
|
293
|
-
* `path` - Filesystem path
|
|
293
|
+
* `path` - Filesystem path where content is stored, joined with `cache` argument.
|
|
294
294
|
* `time` - Timestamp the entry was first added on.
|
|
295
295
|
* `metadata` - User-assigned metadata associated with the entry/content.
|
|
296
296
|
|
package/lib/content/path.js
CHANGED
|
@@ -12,7 +12,7 @@ const ssri = require('ssri')
|
|
|
12
12
|
//
|
|
13
13
|
module.exports = contentPath
|
|
14
14
|
function contentPath (cache, integrity) {
|
|
15
|
-
const sri = ssri.parse(integrity, {single: true})
|
|
15
|
+
const sri = ssri.parse(integrity, { single: true })
|
|
16
16
|
// contentPath is the *strongest* algo given
|
|
17
17
|
return path.join.apply(path, [
|
|
18
18
|
contentDir(cache),
|
package/lib/content/read.js
CHANGED
|
@@ -54,8 +54,8 @@ function readStream (cache, integrity, opts) {
|
|
|
54
54
|
opts = ReadOpts(opts)
|
|
55
55
|
const stream = new PassThrough()
|
|
56
56
|
withContentSri(cache, integrity, (cpath, sri) => {
|
|
57
|
-
return lstatAsync(cpath).then(stat => ({cpath, sri, stat}))
|
|
58
|
-
}).then(({cpath, sri, stat}) => {
|
|
57
|
+
return lstatAsync(cpath).then(stat => ({ cpath, sri, stat }))
|
|
58
|
+
}).then(({ cpath, sri, stat }) => {
|
|
59
59
|
return pipe(
|
|
60
60
|
fs.createReadStream(cpath),
|
|
61
61
|
ssri.integrityStream({
|
|
@@ -95,7 +95,7 @@ module.exports.hasContent = hasContent
|
|
|
95
95
|
function hasContent (cache, integrity) {
|
|
96
96
|
if (!integrity) { return BB.resolve(false) }
|
|
97
97
|
return withContentSri(cache, integrity, (cpath, sri) => {
|
|
98
|
-
return lstatAsync(cpath).then(stat => ({size: stat.size, sri, stat}))
|
|
98
|
+
return lstatAsync(cpath).then(stat => ({ size: stat.size, sri, stat }))
|
|
99
99
|
}).catch(err => {
|
|
100
100
|
if (err.code === 'ENOENT') { return false }
|
|
101
101
|
if (err.code === 'EPERM') {
|
|
@@ -114,7 +114,7 @@ function hasContentSync (cache, integrity) {
|
|
|
114
114
|
return withContentSriSync(cache, integrity, (cpath, sri) => {
|
|
115
115
|
try {
|
|
116
116
|
const stat = fs.lstatSync(cpath)
|
|
117
|
-
return {size: stat.size, sri, stat}
|
|
117
|
+
return { size: stat.size, sri, stat }
|
|
118
118
|
} catch (err) {
|
|
119
119
|
if (err.code === 'ENOENT') { return false }
|
|
120
120
|
if (err.code === 'EPERM') {
|
|
@@ -141,12 +141,12 @@ function withContentSri (cache, integrity, fn) {
|
|
|
141
141
|
} else {
|
|
142
142
|
return BB.any(sri[sri.pickAlgorithm()].map(meta => {
|
|
143
143
|
return withContentSri(cache, meta, fn)
|
|
144
|
-
}, {concurrency: 1}))
|
|
144
|
+
}, { concurrency: 1 }))
|
|
145
145
|
.catch(err => {
|
|
146
146
|
if ([].some.call(err, e => e.code === 'ENOENT')) {
|
|
147
147
|
throw Object.assign(
|
|
148
148
|
new Error('No matching content found for ' + sri.toString()),
|
|
149
|
-
{code: 'ENOENT'}
|
|
149
|
+
{ code: 'ENOENT' }
|
|
150
150
|
)
|
|
151
151
|
} else {
|
|
152
152
|
throw err[0]
|
package/lib/content/write.js
CHANGED
|
@@ -36,11 +36,11 @@ function write (cache, data, opts) {
|
|
|
36
36
|
}
|
|
37
37
|
return BB.using(makeTmp(cache, opts), tmp => (
|
|
38
38
|
writeFileAsync(
|
|
39
|
-
tmp.target, data, {flag: 'wx'}
|
|
39
|
+
tmp.target, data, { flag: 'wx' }
|
|
40
40
|
).then(() => (
|
|
41
41
|
moveToDestination(tmp, cache, sri, opts)
|
|
42
42
|
))
|
|
43
|
-
)).then(() => ({integrity: sri, size: data.length}))
|
|
43
|
+
)).then(() => ({ integrity: sri, size: data.length }))
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
module.exports.stream = writeStream
|
|
@@ -111,8 +111,8 @@ function pipeToTmp (inputStream, cache, tmpTarget, opts, errCheck) {
|
|
|
111
111
|
})
|
|
112
112
|
errCheck()
|
|
113
113
|
return pipe(inputStream, hashStream, outStream).then(() => {
|
|
114
|
-
return {integrity, size}
|
|
115
|
-
}
|
|
114
|
+
return { integrity, size }
|
|
115
|
+
}).catch(err => {
|
|
116
116
|
return rimraf(tmpTarget).then(() => { throw err })
|
|
117
117
|
})
|
|
118
118
|
})
|
package/lib/entry-index.js
CHANGED
|
@@ -64,7 +64,7 @@ function insert (cache, key, integrity, opts) {
|
|
|
64
64
|
)
|
|
65
65
|
}).then(
|
|
66
66
|
() => fixOwner.chownr(bucket, opts.uid, opts.gid)
|
|
67
|
-
).catch({code: 'ENOENT'}, () => {
|
|
67
|
+
).catch({ code: 'ENOENT' }, () => {
|
|
68
68
|
// There's a class of race conditions that happen when things get deleted
|
|
69
69
|
// during fixOwner, or between the two mkdirfix/chownr calls.
|
|
70
70
|
//
|
|
@@ -178,7 +178,7 @@ function lsStream (cache) {
|
|
|
178
178
|
const formatted = formatEntry(cache, entry)
|
|
179
179
|
formatted && stream.push(formatted)
|
|
180
180
|
}
|
|
181
|
-
}).catch({code: 'ENOENT'}, nop)
|
|
181
|
+
}).catch({ code: 'ENOENT' }, nop)
|
|
182
182
|
})
|
|
183
183
|
})
|
|
184
184
|
}).then(() => {
|
|
@@ -282,8 +282,8 @@ function formatEntry (cache, entry) {
|
|
|
282
282
|
|
|
283
283
|
function readdirOrEmpty (dir) {
|
|
284
284
|
return readdirAsync(dir)
|
|
285
|
-
.catch({code: 'ENOENT'}, () => [])
|
|
286
|
-
.catch({code: 'ENOTDIR'}, () => [])
|
|
285
|
+
.catch({ code: 'ENOENT' }, () => [])
|
|
286
|
+
.catch({ code: 'ENOTDIR' }, () => [])
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
function nop () {
|
package/lib/util/fix-owner.js
CHANGED
|
@@ -27,7 +27,7 @@ function fixOwner (filepath, uid, gid) {
|
|
|
27
27
|
filepath,
|
|
28
28
|
typeof uid === 'number' ? uid : process.getuid(),
|
|
29
29
|
typeof gid === 'number' ? gid : process.getgid()
|
|
30
|
-
).catch({code: 'ENOENT'}, () => null)
|
|
30
|
+
).catch({ code: 'ENOENT' }, () => null)
|
|
31
31
|
)
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -65,7 +65,7 @@ function mkdirfix (p, uid, gid, cb) {
|
|
|
65
65
|
if (made) {
|
|
66
66
|
return fixOwner(made, uid, gid).then(() => made)
|
|
67
67
|
}
|
|
68
|
-
}).catch({code: 'EEXIST'}, () => {
|
|
68
|
+
}).catch({ code: 'EEXIST' }, () => {
|
|
69
69
|
// There's a race in mkdirp!
|
|
70
70
|
return fixOwner(p, uid, gid).then(() => null)
|
|
71
71
|
})
|
package/lib/verify.js
CHANGED
|
@@ -130,7 +130,7 @@ function garbageCollect (cache, opts) {
|
|
|
130
130
|
})
|
|
131
131
|
})
|
|
132
132
|
}
|
|
133
|
-
}, {concurrency: opts.concurrency}))
|
|
133
|
+
}, { concurrency: opts.concurrency }))
|
|
134
134
|
})
|
|
135
135
|
})
|
|
136
136
|
}
|
|
@@ -150,7 +150,7 @@ function verifyContent (filepath, sri) {
|
|
|
150
150
|
contentInfo.valid = false
|
|
151
151
|
})
|
|
152
152
|
}).then(() => contentInfo)
|
|
153
|
-
}).catch({code: 'ENOENT'}, () => ({size: 0, valid: false}))
|
|
153
|
+
}).catch({ code: 'ENOENT' }, () => ({ size: 0, valid: false }))
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
function rebuildIndex (cache, opts) {
|
|
@@ -183,7 +183,7 @@ function rebuildIndex (cache, opts) {
|
|
|
183
183
|
}
|
|
184
184
|
return BB.map(Object.keys(buckets), key => {
|
|
185
185
|
return rebuildBucket(cache, buckets[key], stats, opts)
|
|
186
|
-
}, {concurrency: opts.concurrency}).then(() => stats)
|
|
186
|
+
}, { concurrency: opts.concurrency }).then(() => stats)
|
|
187
187
|
})
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -200,7 +200,7 @@ function rebuildBucket (cache, bucket, stats, opts) {
|
|
|
200
200
|
metadata: entry.metadata,
|
|
201
201
|
size: entry.size
|
|
202
202
|
}).then(() => { stats.totalEntries++ })
|
|
203
|
-
}).catch({code: 'ENOENT'}, () => {
|
|
203
|
+
}).catch({ code: 'ENOENT' }, () => {
|
|
204
204
|
stats.rejectedEntries++
|
|
205
205
|
stats.missingContent++
|
|
206
206
|
})
|
package/locales/en.json
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
"No cache entry for `%s` found in `%s`": "No cache entry for %s found in %s",
|
|
3
3
|
"Integrity verification failed for %s (%s)": "Integrity verification failed for %s (%s)",
|
|
4
4
|
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Bad data size: expected inserted data to be %s bytes, but got %s instead",
|
|
5
|
-
"Cache input stream was empty": "Cache input stream was empty"
|
|
6
|
-
|
|
5
|
+
"Cache input stream was empty": "Cache input stream was empty",
|
|
6
|
+
"Integrity check failed:\n Wanted: %s\n Found: %s": "Integrity check failed:\n Wanted: %s\n Found: %s"
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cacache",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.3",
|
|
4
4
|
"cache-version": {
|
|
5
5
|
"content": "2",
|
|
6
6
|
"index": "5"
|
|
@@ -58,32 +58,32 @@
|
|
|
58
58
|
],
|
|
59
59
|
"license": "ISC",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"bluebird": "^3.5.
|
|
61
|
+
"bluebird": "^3.5.5",
|
|
62
62
|
"chownr": "^1.1.1",
|
|
63
63
|
"figgy-pudding": "^3.5.1",
|
|
64
|
-
"glob": "^7.1.
|
|
64
|
+
"glob": "^7.1.4",
|
|
65
65
|
"graceful-fs": "^4.1.15",
|
|
66
66
|
"lru-cache": "^5.1.1",
|
|
67
67
|
"mississippi": "^3.0.0",
|
|
68
68
|
"mkdirp": "^0.5.1",
|
|
69
69
|
"move-concurrently": "^1.0.1",
|
|
70
70
|
"promise-inflight": "^1.0.1",
|
|
71
|
-
"rimraf": "^2.6.
|
|
71
|
+
"rimraf": "^2.6.3",
|
|
72
72
|
"ssri": "^6.0.1",
|
|
73
73
|
"unique-filename": "^1.1.1",
|
|
74
74
|
"y18n": "^4.0.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"benchmark": "^2.1.4",
|
|
78
|
-
"chalk": "^2.
|
|
78
|
+
"chalk": "^2.4.2",
|
|
79
79
|
"cross-env": "^5.1.4",
|
|
80
|
-
"require-inject": "^1.4.
|
|
81
|
-
"standard": "^
|
|
82
|
-
"standard-version": "^
|
|
83
|
-
"tacks": "^1.
|
|
84
|
-
"tap": "^12.
|
|
80
|
+
"require-inject": "^1.4.4",
|
|
81
|
+
"standard": "^12.0.1",
|
|
82
|
+
"standard-version": "^6.0.1",
|
|
83
|
+
"tacks": "^1.3.0",
|
|
84
|
+
"tap": "^12.7.0",
|
|
85
85
|
"weallbehave": "^1.2.0",
|
|
86
|
-
"weallcontribute": "^1.0.
|
|
86
|
+
"weallcontribute": "^1.0.9"
|
|
87
87
|
},
|
|
88
88
|
"config": {
|
|
89
89
|
"nyc": {
|
package/put.js
CHANGED
|
@@ -20,6 +20,7 @@ const PutOpts = figgyPudding({
|
|
|
20
20
|
gid: {},
|
|
21
21
|
single: {},
|
|
22
22
|
sep: {},
|
|
23
|
+
error: {},
|
|
23
24
|
strict: {}
|
|
24
25
|
})
|
|
25
26
|
|
|
@@ -28,7 +29,7 @@ function putData (cache, key, data, opts) {
|
|
|
28
29
|
opts = PutOpts(opts)
|
|
29
30
|
return write(cache, data, opts).then(res => {
|
|
30
31
|
return index.insert(
|
|
31
|
-
cache, key, res.integrity, opts.concat({size: res.size})
|
|
32
|
+
cache, key, res.integrity, opts.concat({ size: res.size })
|
|
32
33
|
).then(entry => {
|
|
33
34
|
if (opts.memoize) {
|
|
34
35
|
memo.put(cache, entry, data, opts)
|
|
@@ -63,7 +64,7 @@ function putStream (cache, key, opts) {
|
|
|
63
64
|
})
|
|
64
65
|
}, cb => {
|
|
65
66
|
contentStream.end(() => {
|
|
66
|
-
index.insert(cache, key, integrity, opts.concat({size})).then(entry => {
|
|
67
|
+
index.insert(cache, key, integrity, opts.concat({ size })).then(entry => {
|
|
67
68
|
if (opts.memoize) {
|
|
68
69
|
memo.put(cache, entry, Buffer.concat(memoData, memoTotal), opts)
|
|
69
70
|
}
|