cacache 15.0.3 → 15.1.0

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/README.md CHANGED
@@ -36,6 +36,8 @@ just as easily be used on its own.
36
36
  * [`rm.all`](#rm-all)
37
37
  * [`rm.entry`](#rm-entry)
38
38
  * [`rm.content`](#rm-content)
39
+ * [`index.compact`](#index-compact)
40
+ * [`index.insert`](#index-insert)
39
41
  * Utilities
40
42
  * [`clearMemoized`](#clear-memoized)
41
43
  * [`tmp.mkdir`](#tmp-mkdir)
@@ -489,6 +491,25 @@ cacache.rm.content(cachePath, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => {
489
491
  })
490
492
  ```
491
493
 
494
+ #### <a name="index-compact"></a> `> cacache.index.compact(cache, key, matchFn) -> Promise`
495
+
496
+ Uses `matchFn`, which must be a synchronous function that accepts two entries
497
+ and returns a boolean indicating whether or not the two entries match, to
498
+ deduplicate all entries in the cache for the given `key`.
499
+
500
+ The deduplicated list of entries is both written to the index, replacing the
501
+ existing content, and returned in the Promise.
502
+
503
+ #### <a name="index-insert"></a> `> cacache.index.insert(cache, key, integrity, opts) -> Promise`
504
+
505
+ Writes an index entry to the cache for the given `key` without writing content.
506
+
507
+ It is assumed if you are using this method, you have already stored the content
508
+ some other way and you only wish to add a new index to that content. The `metadata`
509
+ and `size` properties are read from `opts` and used as part of the index entry.
510
+
511
+ Returns a Promise resolving to the newly added entry.
512
+
492
513
  #### <a name="clear-memoized"></a> `> cacache.clearMemoized()`
493
514
 
494
515
  Completely resets the in-memory entry cache.
package/index.js CHANGED
@@ -7,6 +7,11 @@ const rm = require('./rm.js')
7
7
  const verify = require('./verify.js')
8
8
  const { clearMemoized } = require('./lib/memoization.js')
9
9
  const tmp = require('./lib/util/tmp.js')
10
+ const index = require('./lib/entry-index.js')
11
+
12
+ module.exports.index = {}
13
+ module.exports.index.compact = index.compact
14
+ module.exports.index.insert = index.insert
10
15
 
11
16
  module.exports.ls = ls
12
17
  module.exports.ls.stream = ls.stream
@@ -1,20 +1,25 @@
1
1
  'use strict'
2
2
 
3
3
  const util = require('util')
4
-
5
4
  const crypto = require('crypto')
6
5
  const fs = require('fs')
7
6
  const Minipass = require('minipass')
8
7
  const path = require('path')
9
8
  const ssri = require('ssri')
9
+ const uniqueFilename = require('unique-filename')
10
+
11
+ const { disposer } = require('./util/disposer')
10
12
  const contentPath = require('./content/path')
11
13
  const fixOwner = require('./util/fix-owner')
12
14
  const hashToSegments = require('./util/hash-to-segments')
13
15
  const indexV = require('../package.json')['cache-version'].index
16
+ const moveFile = require('@npmcli/move-file')
17
+ const rimraf = util.promisify(require('rimraf'))
14
18
 
15
19
  const appendFile = util.promisify(fs.appendFile)
16
20
  const readFile = util.promisify(fs.readFile)
17
21
  const readdir = util.promisify(fs.readdir)
22
+ const writeFile = util.promisify(fs.writeFile)
18
23
 
19
24
  module.exports.NotFoundError = class NotFoundError extends Error {
20
25
  constructor (cache, key) {
@@ -25,6 +30,64 @@ module.exports.NotFoundError = class NotFoundError extends Error {
25
30
  }
26
31
  }
27
32
 
33
+ module.exports.compact = compact
34
+
35
+ async function compact (cache, key, matchFn, opts = {}) {
36
+ const bucket = bucketPath(cache, key)
37
+ const entries = await bucketEntries(bucket)
38
+ // reduceRight because the bottom-most result is the newest
39
+ // since we add new entries with appendFile
40
+ const newEntries = entries.reduceRight((acc, newEntry) => {
41
+ if (!acc.find((oldEntry) => matchFn(oldEntry, newEntry))) {
42
+ acc.push(newEntry)
43
+ }
44
+
45
+ return acc
46
+ }, [])
47
+
48
+ const newIndex = '\n' + newEntries.map((entry) => {
49
+ const stringified = JSON.stringify(entry)
50
+ const hash = hashEntry(stringified)
51
+ return `${hash}\t${stringified}`
52
+ }).join('\n')
53
+
54
+ const setup = async () => {
55
+ const target = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix)
56
+ await fixOwner.mkdirfix(cache, path.dirname(target))
57
+ return {
58
+ target,
59
+ moved: false
60
+ }
61
+ }
62
+
63
+ const teardown = async (tmp) => {
64
+ if (!tmp.moved) {
65
+ return rimraf(tmp.target)
66
+ }
67
+ }
68
+
69
+ const write = async (tmp) => {
70
+ await writeFile(tmp.target, newIndex, { flag: 'wx' })
71
+ await fixOwner.mkdirfix(cache, path.dirname(bucket))
72
+ // we use @npmcli/move-file directly here because we
73
+ // want to overwrite the existing file
74
+ await moveFile(tmp.target, bucket)
75
+ tmp.moved = true
76
+ try {
77
+ await fixOwner.chownr(cache, bucket)
78
+ } catch (err) {
79
+ if (err.code !== 'ENOENT') {
80
+ throw err
81
+ }
82
+ }
83
+ }
84
+
85
+ // write the file atomically
86
+ await disposer(setup(), teardown, write)
87
+
88
+ return newEntries.map((entry) => formatEntry(cache, entry, true))
89
+ }
90
+
28
91
  module.exports.insert = insert
29
92
 
30
93
  function insert (cache, key, integrity, opts = {}) {
@@ -209,10 +272,14 @@ function ls (cache) {
209
272
  )
210
273
  }
211
274
 
275
+ module.exports.bucketEntries = bucketEntries
276
+
212
277
  function bucketEntries (bucket, filter) {
213
278
  return readFile(bucket, 'utf8').then((data) => _bucketEntries(data, filter))
214
279
  }
215
280
 
281
+ module.exports.bucketEntries.sync = bucketEntriesSync
282
+
216
283
  function bucketEntriesSync (bucket, filter) {
217
284
  const data = fs.readFileSync(bucket, 'utf8')
218
285
  return _bucketEntries(data, filter)
@@ -279,15 +346,15 @@ function hash (str, digest) {
279
346
  .digest('hex')
280
347
  }
281
348
 
282
- function formatEntry (cache, entry) {
349
+ function formatEntry (cache, entry, keepAll) {
283
350
  // Treat null digests as deletions. They'll shadow any previous entries.
284
- if (!entry.integrity) {
351
+ if (!entry.integrity && !keepAll) {
285
352
  return null
286
353
  }
287
354
  return {
288
355
  key: entry.key,
289
356
  integrity: entry.integrity,
290
- path: contentPath(cache, entry.integrity),
357
+ path: entry.integrity ? contentPath(cache, entry.integrity) : undefined,
291
358
  size: entry.size,
292
359
  time: entry.time,
293
360
  metadata: entry.metadata
@@ -5,7 +5,7 @@ const util = require('util')
5
5
  const chmod = util.promisify(fs.chmod)
6
6
  const unlink = util.promisify(fs.unlink)
7
7
  const stat = util.promisify(fs.stat)
8
- const move = require('move-file')
8
+ const move = require('@npmcli/move-file')
9
9
  const pinflight = require('promise-inflight')
10
10
 
11
11
  module.exports = moveFile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cacache",
3
- "version": "15.0.3",
3
+ "version": "15.1.0",
4
4
  "cache-version": {
5
5
  "content": "2",
6
6
  "index": "5"
@@ -58,21 +58,21 @@
58
58
  ],
59
59
  "license": "ISC",
60
60
  "dependencies": {
61
+ "@npmcli/move-file": "^1.0.1",
61
62
  "chownr": "^2.0.0",
62
63
  "fs-minipass": "^2.0.0",
63
64
  "glob": "^7.1.4",
64
65
  "infer-owner": "^1.0.4",
65
- "lru-cache": "^5.1.1",
66
+ "lru-cache": "^6.0.0",
66
67
  "minipass": "^3.1.1",
67
68
  "minipass-collect": "^1.0.2",
68
69
  "minipass-flush": "^1.0.5",
69
70
  "minipass-pipeline": "^1.2.2",
70
71
  "mkdirp": "^1.0.3",
71
- "move-file": "^2.0.0",
72
72
  "p-map": "^4.0.0",
73
73
  "promise-inflight": "^1.0.1",
74
74
  "rimraf": "^3.0.2",
75
- "ssri": "^8.0.0",
75
+ "ssri": "^8.0.1",
76
76
  "tar": "^6.0.2",
77
77
  "unique-filename": "^1.1.1"
78
78
  },
@@ -83,7 +83,7 @@
83
83
  "standard": "^14.3.1",
84
84
  "standard-version": "^7.1.0",
85
85
  "tacks": "^1.3.0",
86
- "tap": "^14.10.6"
86
+ "tap": "^15.0.9"
87
87
  },
88
88
  "tap": {
89
89
  "100": true,
package/CHANGELOG.md DELETED
@@ -1,785 +0,0 @@
1
- # Changelog
2
-
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
-
5
- ### [15.0.3](https://github.com/npm/cacache/compare/v15.0.2...v15.0.3) (2020-04-28)
6
-
7
-
8
- ### Bug Fixes
9
-
10
- * actually remove move-concurrently dep ([29e6eec](https://github.com/npm/cacache/commit/29e6eec9fee73444ee09daf1c1be06ddd5fe57f6))
11
-
12
- ### [15.0.2](https://github.com/npm/cacache/compare/v15.0.1...v15.0.2) (2020-04-28)
13
-
14
-
15
- ### Bug Fixes
16
-
17
- * tacks should be a dev dependency ([93ec158](https://github.com/npm/cacache/commit/93ec15852f0fdf1753ea7f75b4b8926daf8a7565))
18
-
19
- ## [15.0.1](https://github.com/npm/cacache/compare/v15.0.0...v15.0.1) (2020-04-27)
20
-
21
- * **deps:** Use move-file instead of move-file-concurrently. ([92b125](https://github.com/npm/cacache/commit/92b1251a11b9848878b6c0d101b18bd8845acaa6))
22
-
23
- ## [15.0.0](https://github.com/npm/cacache/compare/v14.0.0...v15.0.0) (2020-02-18)
24
-
25
-
26
- ### ⚠ BREAKING CHANGES
27
-
28
- * drop figgy-pudding and use canonical option names.
29
-
30
- ### Features
31
-
32
- * remove figgy-pudding ([57d11bc](https://github.com/npm/cacache/commit/57d11bce34f979247d1057d258acc204c4944491))
33
-
34
- ## [14.0.0](https://github.com/npm/cacache/compare/v13.0.1...v14.0.0) (2020-01-28)
35
-
36
-
37
- ### ⚠ BREAKING CHANGES
38
-
39
- * **deps:** bumps engines to >= 10
40
-
41
- * **deps:** tar v6 and mkdirp v1 ([5a66e7a](https://github.com/npm/cacache/commit/5a66e7a))
42
-
43
- ### [13.0.1](https://github.com/npm/cacache/compare/v13.0.0...v13.0.1) (2019-09-30)
44
-
45
-
46
- ### Bug Fixes
47
-
48
- * **fix-owner:** chownr.sync quits on non-root uid ([08801be](https://github.com/npm/cacache/commit/08801be))
49
-
50
- ## [13.0.0](https://github.com/npm/cacache/compare/v12.0.3...v13.0.0) (2019-09-25)
51
-
52
-
53
- ### ⚠ BREAKING CHANGES
54
-
55
- * This subtly changes the streaming interface of
56
- everything in cacache that streams, which is, well, everything in
57
- cacache. Most users will probably not notice, but any code that
58
- depended on stream behavior always being deferred until next tick will
59
- need to adjust.
60
-
61
- The mississippi methods 'to', 'from', 'through', and so on, have been
62
- replaced with their Minipass counterparts, and streaming interaction
63
- with the file system is done via fs-minipass.
64
-
65
- The following modules are of interest here:
66
-
67
- - [minipass](http://npm.im/minipass) The core stream library.
68
-
69
- - [fs-minipass](http://npm.im/fs-minipass) Note that the 'WriteStream'
70
- class from fs-minipass is _not_ a Minipass stream, but rather a plain
71
- old EventEmitter that duck types as a Writable.
72
-
73
- - [minipass-collect](http://npm.im/minipass-collect) Gather up all the
74
- data from a stream. Cacache only uses Collect.PassThrough, which is a
75
- basic Minipass passthrough stream which emits a 'collect' event with
76
- the completed data just before the 'end' event.
77
-
78
- - [minipass-pipeline](http://npm.im/minipass-pipeline) Connect one or
79
- more streams into a pipe chain. Errors anywhere in the pipeline are
80
- proxied down the chain and then up to the Pipeline object itself.
81
- Writes go into the head, reads go to the tail. Used in place of
82
- pump() and pumpify().
83
-
84
- - [minipass-flush](http://npm.im/minipass-flush) A Minipass passthrough
85
- stream that defers its 'end' event until after a flush() method has
86
- completed (either calling the supplied callback, or returning a
87
- promise.) Use in place of flush-write-stream (aka mississippi.to).
88
-
89
- Streams from through2, concat-stream, and the behavior provided by
90
- end-of-stream are all implemented in Minipass itself.
91
-
92
- Features of interest to cacache, which make Minipass a particularly good
93
- fit:
94
-
95
- - All of the 'endish' events are normalized, so we can just listen on
96
- 'end' and know that finish, prefinish, and close will be handled as
97
- well.
98
- - Minipass doesn't waste time [containing
99
- zalgo](https://blog.izs.me/2013/08/designing-apis-for-asynchrony).
100
- - Minipass has built-in support for promises that indicate the end or
101
- error: stream.promise(), stream.collect(), and stream.concat().
102
- - With reliable and consistent timing guarantees, much less
103
- error-checking logic is required. We can be more confident that an
104
- error is being thrown or emitted in the correct place, rather than in
105
- a callback which is deferred, resulting in a hung promise or
106
- uncaughtException.
107
-
108
- The biggest downside of Minipass is that it lacks some of the internal
109
- characteristics of node-core streams, which many community modules use
110
- to identify streams. They have no _writableState or _readableState
111
- objects, or _read or _write methods. As a result, the is-stream module
112
- (at least, at the time of this commit) doesn't recognize Minipass
113
- streams as readable or writable streams.
114
-
115
- All in all, the changes required of downstream users should be minimal,
116
- but are unlikely to be zero. Hence the semver major change.
117
-
118
- ### Features
119
-
120
- * replace all streams with Minipass streams ([f4c0962](https://github.com/npm/cacache/commit/f4c0962))
121
- * **deps:** Add minipass and minipass-pipeline ([a6545a9](https://github.com/npm/cacache/commit/a6545a9))
122
- * **promise:** converted .resolve to native promise, converted .map and .reduce to native ([220c56d](https://github.com/npm/cacache/commit/220c56d))
123
- * **promise:** individually promisifing functions as needed ([74b939e](https://github.com/npm/cacache/commit/74b939e))
124
- * **promise:** moved .reject from bluebird to native promise ([1d56da1](https://github.com/npm/cacache/commit/1d56da1))
125
- * **promise:** removed .fromNode, removed .join ([9c457a0](https://github.com/npm/cacache/commit/9c457a0))
126
- * **promise:** removed .map, replaced with p-map. removed .try ([cc3ee05](https://github.com/npm/cacache/commit/cc3ee05))
127
- * **promise:** removed .tap ([0260f12](https://github.com/npm/cacache/commit/0260f12))
128
- * **promise:** removed .using/.disposer ([5d832f3](https://github.com/npm/cacache/commit/5d832f3))
129
- * **promise:** removed bluebird ([c21298c](https://github.com/npm/cacache/commit/c21298c))
130
- * **promise:** removed bluebird specific .catch calls ([28aeeac](https://github.com/npm/cacache/commit/28aeeac))
131
- * **promise:** replaced .reduce and .mapSeries ([478f5cb](https://github.com/npm/cacache/commit/478f5cb))
132
-
133
- ### [12.0.3](https://github.com/npm/cacache/compare/v12.0.2...v12.0.3) (2019-08-19)
134
-
135
-
136
- ### Bug Fixes
137
-
138
- * do not chown if not running as root ([2d80af9](https://github.com/npm/cacache/commit/2d80af9))
139
-
140
-
141
-
142
- ### [12.0.2](https://github.com/npm/cacache/compare/v12.0.1...v12.0.2) (2019-07-19)
143
-
144
-
145
-
146
- ### [12.0.1](https://github.com/npm/cacache/compare/v12.0.0...v12.0.1) (2019-07-19)
147
-
148
- * **deps** Abstracted out `lib/util/infer-owner.js` to
149
- [@npmcli/infer-owner](https://www.npmjs.com/package/@npmcli/infer-owner)
150
- so that it could be more easily used in other parts of the npm CLI.
151
-
152
-
153
- ## [12.0.0](https://github.com/npm/cacache/compare/v11.3.3...v12.0.0) (2019-07-15)
154
-
155
-
156
- ### Features
157
-
158
- * infer uid/gid instead of accepting as options ([ac84d14](https://github.com/npm/cacache/commit/ac84d14))
159
- * **i18n:** add another error message ([676cb32](https://github.com/npm/cacache/commit/676cb32))
160
-
161
-
162
- ### BREAKING CHANGES
163
-
164
- * the uid gid options are no longer respected or
165
- necessary. As of this change, cacache will always match the cache
166
- contents to the ownership of the cache directory (or its parent
167
- directory), regardless of what the caller passes in.
168
-
169
- Reasoning:
170
-
171
- The number one reason to use a uid or gid option was to keep root-owned
172
- files from causing problems in the cache. In npm's case, this meant
173
- that CLI's ./lib/command.js had to work out the appropriate uid and gid,
174
- then pass it to the libnpmcommand module, which had to in turn pass the
175
- uid and gid to npm-registry-fetch, which then passed it to
176
- make-fetch-happen, which passed it to cacache. (For package fetching,
177
- pacote would be in that mix as well.)
178
-
179
- Added to that, `cacache.rm()` will actually _write_ a file into the
180
- cache index, but has no way to accept an option so that its call to
181
- entry-index.js will write the index with the appropriate uid/gid.
182
- Little ownership bugs were all over the place, and tricky to trace
183
- through. (Why should make-fetch-happen even care about accepting or
184
- passing uids and gids? It's an http library.)
185
-
186
- This change allows us to keep the cache from having mixed ownership in
187
- any situation.
188
-
189
- Of course, this _does_ mean that if you have a root-owned but
190
- user-writable folder (for example, `/tmp`), then the cache will try to
191
- chown everything to root.
192
-
193
- The solution is for the user to create a folder, make it user-owned, and
194
- use that, rather than relying on cacache to create the root cache folder.
195
-
196
- If we decide to restore the uid/gid opts, and use ownership inference
197
- only when uid/gid are unset, then take care to also make rm take an
198
- option object, and pass it through to entry-index.js.
199
-
200
-
201
-
202
- ### [11.3.3](https://github.com/npm/cacache/compare/v11.3.2...v11.3.3) (2019-06-17)
203
-
204
-
205
- ### Bug Fixes
206
-
207
- * **audit:** npm audit fix ([200a6d5](https://github.com/npm/cacache/commit/200a6d5))
208
- * **config:** Add ssri config 'error' option ([#146](https://github.com/npm/cacache/issues/146)) ([47de8f5](https://github.com/npm/cacache/commit/47de8f5))
209
- * **deps:** npm audit fix ([481a7dc](https://github.com/npm/cacache/commit/481a7dc))
210
- * **standard:** standard --fix ([7799149](https://github.com/npm/cacache/commit/7799149))
211
- * **write:** avoid another cb never called situation ([5156561](https://github.com/npm/cacache/commit/5156561))
212
-
213
-
214
-
215
- <a name="11.3.2"></a>
216
- ## [11.3.2](https://github.com/npm/cacache/compare/v11.3.1...v11.3.2) (2018-12-21)
217
-
218
-
219
- ### Bug Fixes
220
-
221
- * **get:** make sure to handle errors in the .then ([b10bcd0](https://github.com/npm/cacache/commit/b10bcd0))
222
-
223
-
224
-
225
- <a name="11.3.1"></a>
226
- ## [11.3.1](https://github.com/npm/cacache/compare/v11.3.0...v11.3.1) (2018-11-05)
227
-
228
-
229
- ### Bug Fixes
230
-
231
- * **get:** export hasContent.sync properly ([d76c920](https://github.com/npm/cacache/commit/d76c920))
232
-
233
-
234
-
235
- <a name="11.3.0"></a>
236
- # [11.3.0](https://github.com/npm/cacache/compare/v11.2.0...v11.3.0) (2018-11-05)
237
-
238
-
239
- ### Features
240
-
241
- * **get:** add sync API for reading ([db1e094](https://github.com/npm/cacache/commit/db1e094))
242
-
243
-
244
-
245
- <a name="11.2.0"></a>
246
- # [11.2.0](https://github.com/npm/cacache/compare/v11.1.0...v11.2.0) (2018-08-08)
247
-
248
-
249
- ### Features
250
-
251
- * **read:** add sync support to other internal read.js fns ([fe638b6](https://github.com/npm/cacache/commit/fe638b6))
252
-
253
-
254
-
255
- <a name="11.1.0"></a>
256
- # [11.1.0](https://github.com/npm/cacache/compare/v11.0.3...v11.1.0) (2018-08-01)
257
-
258
-
259
- ### Features
260
-
261
- * **read:** add sync support for low-level content read ([b43af83](https://github.com/npm/cacache/commit/b43af83))
262
-
263
-
264
-
265
- <a name="11.0.3"></a>
266
- ## [11.0.3](https://github.com/npm/cacache/compare/v11.0.2...v11.0.3) (2018-08-01)
267
-
268
-
269
- ### Bug Fixes
270
-
271
- * **config:** add ssri config options ([#136](https://github.com/npm/cacache/issues/136)) ([10d5d9a](https://github.com/npm/cacache/commit/10d5d9a))
272
- * **perf:** refactor content.read to avoid lstats ([c5ac10e](https://github.com/npm/cacache/commit/c5ac10e))
273
- * **test:** oops when removing safe-buffer ([1950490](https://github.com/npm/cacache/commit/1950490))
274
-
275
-
276
-
277
- <a name="11.0.2"></a>
278
- ## [11.0.2](https://github.com/npm/cacache/compare/v11.0.1...v11.0.2) (2018-05-07)
279
-
280
-
281
- ### Bug Fixes
282
-
283
- * **verify:** size param no longer lost in a verify ([#131](https://github.com/npm/cacache/issues/131)) ([c614a19](https://github.com/npm/cacache/commit/c614a19)), closes [#130](https://github.com/npm/cacache/issues/130)
284
-
285
-
286
-
287
- <a name="11.0.1"></a>
288
- ## [11.0.1](https://github.com/npm/cacache/compare/v11.0.0...v11.0.1) (2018-04-10)
289
-
290
-
291
-
292
- <a name="11.0.0"></a>
293
- # [11.0.0](https://github.com/npm/cacache/compare/v10.0.4...v11.0.0) (2018-04-09)
294
-
295
-
296
- ### Features
297
-
298
- * **opts:** use figgy-pudding for opts ([#128](https://github.com/npm/cacache/issues/128)) ([33d4eed](https://github.com/npm/cacache/commit/33d4eed))
299
-
300
-
301
- ### meta
302
-
303
- * drop support for node@4 ([529f347](https://github.com/npm/cacache/commit/529f347))
304
-
305
-
306
- ### BREAKING CHANGES
307
-
308
- * node@4 is no longer supported
309
-
310
-
311
-
312
- <a name="10.0.4"></a>
313
- ## [10.0.4](https://github.com/npm/cacache/compare/v10.0.3...v10.0.4) (2018-02-16)
314
-
315
-
316
-
317
- <a name="10.0.3"></a>
318
- ## [10.0.3](https://github.com/npm/cacache/compare/v10.0.2...v10.0.3) (2018-02-16)
319
-
320
-
321
- ### Bug Fixes
322
-
323
- * **content:** rethrow aggregate errors as ENOENT ([fa918f5](https://github.com/npm/cacache/commit/fa918f5))
324
-
325
-
326
-
327
- <a name="10.0.2"></a>
328
- ## [10.0.2](https://github.com/npm/cacache/compare/v10.0.1...v10.0.2) (2018-01-07)
329
-
330
-
331
- ### Bug Fixes
332
-
333
- * **ls:** deleted entries could cause a premature stream EOF ([347dc36](https://github.com/npm/cacache/commit/347dc36))
334
-
335
-
336
-
337
- <a name="10.0.1"></a>
338
- ## [10.0.1](https://github.com/npm/cacache/compare/v10.0.0...v10.0.1) (2017-11-15)
339
-
340
-
341
- ### Bug Fixes
342
-
343
- * **move-file:** actually use the fallback to `move-concurrently` (#110) ([073fbe1](https://github.com/npm/cacache/commit/073fbe1))
344
-
345
-
346
-
347
- <a name="10.0.0"></a>
348
- # [10.0.0](https://github.com/npm/cacache/compare/v9.3.0...v10.0.0) (2017-10-23)
349
-
350
-
351
- ### Features
352
-
353
- * **license:** relicense to ISC (#111) ([fdbb4e5](https://github.com/npm/cacache/commit/fdbb4e5))
354
-
355
-
356
- ### Performance Improvements
357
-
358
- * more copyFile benchmarks ([63787bb](https://github.com/npm/cacache/commit/63787bb))
359
-
360
-
361
- ### BREAKING CHANGES
362
-
363
- * **license:** the license has been changed from CC0-1.0 to ISC.
364
-
365
-
366
-
367
- <a name="9.3.0"></a>
368
- # [9.3.0](https://github.com/npm/cacache/compare/v9.2.9...v9.3.0) (2017-10-07)
369
-
370
-
371
- ### Features
372
-
373
- * **copy:** added cacache.get.copy api for fast copies (#107) ([067b5f6](https://github.com/npm/cacache/commit/067b5f6))
374
-
375
-
376
-
377
- <a name="9.2.9"></a>
378
- ## [9.2.9](https://github.com/npm/cacache/compare/v9.2.8...v9.2.9) (2017-06-17)
379
-
380
-
381
-
382
- <a name="9.2.8"></a>
383
- ## [9.2.8](https://github.com/npm/cacache/compare/v9.2.7...v9.2.8) (2017-06-05)
384
-
385
-
386
- ### Bug Fixes
387
-
388
- * **ssri:** bump ssri for bugfix ([c3232ea](https://github.com/npm/cacache/commit/c3232ea))
389
-
390
-
391
-
392
- <a name="9.2.7"></a>
393
- ## [9.2.7](https://github.com/npm/cacache/compare/v9.2.6...v9.2.7) (2017-06-05)
394
-
395
-
396
- ### Bug Fixes
397
-
398
- * **content:** make verified content completely read-only (#96) ([4131196](https://github.com/npm/cacache/commit/4131196))
399
-
400
-
401
-
402
- <a name="9.2.6"></a>
403
- ## [9.2.6](https://github.com/npm/cacache/compare/v9.2.5...v9.2.6) (2017-05-31)
404
-
405
-
406
- ### Bug Fixes
407
-
408
- * **node:** update ssri to prevent old node 4 crash ([5209ffe](https://github.com/npm/cacache/commit/5209ffe))
409
-
410
-
411
-
412
- <a name="9.2.5"></a>
413
- ## [9.2.5](https://github.com/npm/cacache/compare/v9.2.4...v9.2.5) (2017-05-25)
414
-
415
-
416
- ### Bug Fixes
417
-
418
- * **deps:** fix lockfile issues and bump ssri ([84e1d7e](https://github.com/npm/cacache/commit/84e1d7e))
419
-
420
-
421
-
422
- <a name="9.2.4"></a>
423
- ## [9.2.4](https://github.com/npm/cacache/compare/v9.2.3...v9.2.4) (2017-05-24)
424
-
425
-
426
- ### Bug Fixes
427
-
428
- * **deps:** bumping deps ([bbccb12](https://github.com/npm/cacache/commit/bbccb12))
429
-
430
-
431
-
432
- <a name="9.2.3"></a>
433
- ## [9.2.3](https://github.com/npm/cacache/compare/v9.2.2...v9.2.3) (2017-05-24)
434
-
435
-
436
- ### Bug Fixes
437
-
438
- * **rm:** stop crashing if content is missing on rm ([ac90bc0](https://github.com/npm/cacache/commit/ac90bc0))
439
-
440
-
441
-
442
- <a name="9.2.2"></a>
443
- ## [9.2.2](https://github.com/npm/cacache/compare/v9.2.1...v9.2.2) (2017-05-14)
444
-
445
-
446
- ### Bug Fixes
447
-
448
- * **i18n:** lets pretend this didn't happen ([519b4ee](https://github.com/npm/cacache/commit/519b4ee))
449
-
450
-
451
-
452
- <a name="9.2.1"></a>
453
- ## [9.2.1](https://github.com/npm/cacache/compare/v9.2.0...v9.2.1) (2017-05-14)
454
-
455
-
456
- ### Bug Fixes
457
-
458
- * **docs:** fixing translation messup ([bb9e4f9](https://github.com/npm/cacache/commit/bb9e4f9))
459
-
460
-
461
-
462
- <a name="9.2.0"></a>
463
- # [9.2.0](https://github.com/npm/cacache/compare/v9.1.0...v9.2.0) (2017-05-14)
464
-
465
-
466
- ### Features
467
-
468
- * **i18n:** add Spanish translation for API ([531f9a4](https://github.com/npm/cacache/commit/531f9a4))
469
-
470
-
471
-
472
- <a name="9.1.0"></a>
473
- # [9.1.0](https://github.com/npm/cacache/compare/v9.0.0...v9.1.0) (2017-05-14)
474
-
475
-
476
- ### Features
477
-
478
- * **i18n:** Add Spanish translation and i18n setup (#91) ([323b90c](https://github.com/npm/cacache/commit/323b90c))
479
-
480
-
481
-
482
- <a name="9.0.0"></a>
483
- # [9.0.0](https://github.com/npm/cacache/compare/v8.0.0...v9.0.0) (2017-04-28)
484
-
485
-
486
- ### Bug Fixes
487
-
488
- * **memoization:** actually use the LRU ([0e55dc9](https://github.com/npm/cacache/commit/0e55dc9))
489
-
490
-
491
- ### Features
492
-
493
- * **memoization:** memoizers can be injected through opts.memoize (#90) ([e5614c7](https://github.com/npm/cacache/commit/e5614c7))
494
-
495
-
496
- ### BREAKING CHANGES
497
-
498
- * **memoization:** If you were passing an object to opts.memoize, it will now be used as an injected memoization object. If you were only passing booleans and other non-objects through that option, no changes are needed.
499
-
500
-
501
-
502
- <a name="8.0.0"></a>
503
- # [8.0.0](https://github.com/npm/cacache/compare/v7.1.0...v8.0.0) (2017-04-22)
504
-
505
-
506
- ### Features
507
-
508
- * **read:** change hasContent to return {sri, size} (#88) ([bad6c49](https://github.com/npm/cacache/commit/bad6c49)), closes [#87](https://github.com/npm/cacache/issues/87)
509
-
510
-
511
- ### BREAKING CHANGES
512
-
513
- * **read:** hasContent now returns an object with `{sri, size}` instead of `sri`. Use `result.sri` anywhere that needed the old return value.
514
-
515
-
516
-
517
- <a name="7.1.0"></a>
518
- # [7.1.0](https://github.com/npm/cacache/compare/v7.0.5...v7.1.0) (2017-04-20)
519
-
520
-
521
- ### Features
522
-
523
- * **size:** handle content size info (#49) ([91230af](https://github.com/npm/cacache/commit/91230af))
524
-
525
-
526
-
527
- <a name="7.0.5"></a>
528
- ## [7.0.5](https://github.com/npm/cacache/compare/v7.0.4...v7.0.5) (2017-04-18)
529
-
530
-
531
- ### Bug Fixes
532
-
533
- * **integrity:** new ssri with fixed integrity stream ([6d13e8e](https://github.com/npm/cacache/commit/6d13e8e))
534
- * **write:** wrap stuff in promises to improve errors ([3624fc5](https://github.com/npm/cacache/commit/3624fc5))
535
-
536
-
537
-
538
- <a name="7.0.4"></a>
539
- ## [7.0.4](https://github.com/npm/cacache/compare/v7.0.3...v7.0.4) (2017-04-15)
540
-
541
-
542
- ### Bug Fixes
543
-
544
- * **fix-owner:** throw away ENOENTs on chownr ([d49bbcd](https://github.com/npm/cacache/commit/d49bbcd))
545
-
546
-
547
-
548
- <a name="7.0.3"></a>
549
- ## [7.0.3](https://github.com/npm/cacache/compare/v7.0.2...v7.0.3) (2017-04-05)
550
-
551
-
552
- ### Bug Fixes
553
-
554
- * **read:** fixing error message for integrity verification failures ([9d4f0a5](https://github.com/npm/cacache/commit/9d4f0a5))
555
-
556
-
557
-
558
- <a name="7.0.2"></a>
559
- ## [7.0.2](https://github.com/npm/cacache/compare/v7.0.1...v7.0.2) (2017-04-03)
560
-
561
-
562
- ### Bug Fixes
563
-
564
- * **integrity:** use EINTEGRITY error code and update ssri ([8dc2e62](https://github.com/npm/cacache/commit/8dc2e62))
565
-
566
-
567
-
568
- <a name="7.0.1"></a>
569
- ## [7.0.1](https://github.com/npm/cacache/compare/v7.0.0...v7.0.1) (2017-04-03)
570
-
571
-
572
- ### Bug Fixes
573
-
574
- * **docs:** fix header name conflict in readme ([afcd456](https://github.com/npm/cacache/commit/afcd456))
575
-
576
-
577
-
578
- <a name="7.0.0"></a>
579
- # [7.0.0](https://github.com/npm/cacache/compare/v6.3.0...v7.0.0) (2017-04-03)
580
-
581
-
582
- ### Bug Fixes
583
-
584
- * **test:** fix content.write tests when running in docker ([d2e9b6a](https://github.com/npm/cacache/commit/d2e9b6a))
585
-
586
-
587
- ### Features
588
-
589
- * **integrity:** subresource integrity support (#78) ([b1e731f](https://github.com/npm/cacache/commit/b1e731f))
590
-
591
-
592
- ### BREAKING CHANGES
593
-
594
- * **integrity:** The entire API has been overhauled to use SRI hashes instead of digest/hashAlgorithm pairs. SRI hashes follow the Subresource Integrity standard and support strings and objects compatible with [`ssri`](https://npm.im/ssri).
595
-
596
- * This change bumps the index version, which will invalidate all previous index entries. Content entries will remain intact, and existing caches will automatically reuse any content from before this breaking change.
597
-
598
- * `cacache.get.info()`, `cacache.ls()`, and `cacache.ls.stream()` will now return objects that looks like this:
599
-
600
- ```
601
- {
602
- key: String,
603
- integrity: '<algorithm>-<base64hash>',
604
- path: ContentPath,
605
- time: Date<ms>,
606
- metadata: Any
607
- }
608
- ```
609
-
610
- * `opts.digest` and `opts.hashAlgorithm` are obsolete for any API calls that used them.
611
-
612
- * Anywhere `opts.digest` was accepted, `opts.integrity` is now an option. Any valid SRI hash is accepted here -- multiple hash entries will be resolved according to the standard: first, the "strongest" hash algorithm will be picked, and then each of the entries for that algorithm will be matched against the content. Content will be validated if *any* of the entries match (so, a single integrity string can be used for multiple "versions" of the same document/data).
613
-
614
- * `put.byDigest()`, `put.stream.byDigest`, `get.byDigest()` and `get.stream.byDigest()` now expect an SRI instead of a `digest` + `opts.hashAlgorithm` pairing.
615
-
616
- * `get.hasContent()` now expects an integrity hash instead of a digest. If content exists, it will return the specific single integrity hash that was found in the cache.
617
-
618
- * `verify()` has learned to handle integrity-based caches, and forgotten how to handle old-style cache indices due to the format change.
619
-
620
- * `cacache.rm.content()` now expects an integrity hash instead of a hex digest.
621
-
622
-
623
-
624
- <a name="6.3.0"></a>
625
- # [6.3.0](https://github.com/npm/cacache/compare/v6.2.0...v6.3.0) (2017-04-01)
626
-
627
-
628
- ### Bug Fixes
629
-
630
- * **fixOwner:** ignore EEXIST race condition from mkdirp ([4670e9b](https://github.com/npm/cacache/commit/4670e9b))
631
- * **index:** ignore index removal races when inserting ([b9d2fa2](https://github.com/npm/cacache/commit/b9d2fa2))
632
- * **memo:** use lru-cache for better mem management (#75) ([d8ac5aa](https://github.com/npm/cacache/commit/d8ac5aa))
633
-
634
-
635
- ### Features
636
-
637
- * **dependencies:** Switch to move-concurrently (#77) ([dc6482d](https://github.com/npm/cacache/commit/dc6482d))
638
-
639
-
640
-
641
- <a name="6.2.0"></a>
642
- # [6.2.0](https://github.com/npm/cacache/compare/v6.1.2...v6.2.0) (2017-03-15)
643
-
644
-
645
- ### Bug Fixes
646
-
647
- * **index:** additional bucket entry verification with checksum (#72) ([f8e0f25](https://github.com/npm/cacache/commit/f8e0f25))
648
- * **verify:** return fixOwner.chownr promise ([6818521](https://github.com/npm/cacache/commit/6818521))
649
-
650
-
651
- ### Features
652
-
653
- * **tmp:** safe tmp dir creation/management util (#73) ([c42da71](https://github.com/npm/cacache/commit/c42da71))
654
-
655
-
656
-
657
- <a name="6.1.2"></a>
658
- ## [6.1.2](https://github.com/npm/cacache/compare/v6.1.1...v6.1.2) (2017-03-13)
659
-
660
-
661
- ### Bug Fixes
662
-
663
- * **index:** set default hashAlgorithm ([d6eb2f0](https://github.com/npm/cacache/commit/d6eb2f0))
664
-
665
-
666
-
667
- <a name="6.1.1"></a>
668
- ## [6.1.1](https://github.com/npm/cacache/compare/v6.1.0...v6.1.1) (2017-03-13)
669
-
670
-
671
- ### Bug Fixes
672
-
673
- * **coverage:** bumping coverage for verify (#71) ([0b7faf6](https://github.com/npm/cacache/commit/0b7faf6))
674
- * **deps:** glob should have been a regular dep :< ([0640bc4](https://github.com/npm/cacache/commit/0640bc4))
675
-
676
-
677
-
678
- <a name="6.1.0"></a>
679
- # [6.1.0](https://github.com/npm/cacache/compare/v6.0.2...v6.1.0) (2017-03-12)
680
-
681
-
682
- ### Bug Fixes
683
-
684
- * **coverage:** more coverage for content reads (#70) ([ef4f70a](https://github.com/npm/cacache/commit/ef4f70a))
685
- * **tests:** use safe-buffer because omfg (#69) ([6ab8132](https://github.com/npm/cacache/commit/6ab8132))
686
-
687
-
688
- ### Features
689
-
690
- * **rm:** limited rm.all and fixed bugs (#66) ([d5d25ba](https://github.com/npm/cacache/commit/d5d25ba)), closes [#66](https://github.com/npm/cacache/issues/66)
691
- * **verify:** tested, working cache verifier/gc (#68) ([45ad77a](https://github.com/npm/cacache/commit/45ad77a))
692
-
693
-
694
-
695
- <a name="6.0.2"></a>
696
- ## [6.0.2](https://github.com/npm/cacache/compare/v6.0.1...v6.0.2) (2017-03-11)
697
-
698
-
699
- ### Bug Fixes
700
-
701
- * **index:** segment cache items with another subbucket (#64) ([c3644e5](https://github.com/npm/cacache/commit/c3644e5))
702
-
703
-
704
-
705
- <a name="6.0.1"></a>
706
- ## [6.0.1](https://github.com/npm/cacache/compare/v6.0.0...v6.0.1) (2017-03-05)
707
-
708
-
709
- ### Bug Fixes
710
-
711
- * **docs:** Missed spots in README ([8ffb7fa](https://github.com/npm/cacache/commit/8ffb7fa))
712
-
713
-
714
-
715
- <a name="6.0.0"></a>
716
- # [6.0.0](https://github.com/npm/cacache/compare/v5.0.3...v6.0.0) (2017-03-05)
717
-
718
-
719
- ### Bug Fixes
720
-
721
- * **api:** keep memo cache mostly-internal ([2f72d0a](https://github.com/npm/cacache/commit/2f72d0a))
722
- * **content:** use the rest of the string, not the whole string ([fa8f3c3](https://github.com/npm/cacache/commit/fa8f3c3))
723
- * **deps:** removed `format-number@2.0.2` ([1187791](https://github.com/npm/cacache/commit/1187791))
724
- * **deps:** removed inflight@1.0.6 ([0d1819c](https://github.com/npm/cacache/commit/0d1819c))
725
- * **deps:** rimraf@2.6.1 ([9efab6b](https://github.com/npm/cacache/commit/9efab6b))
726
- * **deps:** standard@9.0.0 ([4202cba](https://github.com/npm/cacache/commit/4202cba))
727
- * **deps:** tap@10.3.0 ([aa03088](https://github.com/npm/cacache/commit/aa03088))
728
- * **deps:** weallcontribute@1.0.8 ([ad4f4dc](https://github.com/npm/cacache/commit/ad4f4dc))
729
- * **docs:** add security note to hashKey ([03f81ba](https://github.com/npm/cacache/commit/03f81ba))
730
- * **hashes:** change default hashAlgorithm to sha512 ([ea00ba6](https://github.com/npm/cacache/commit/ea00ba6))
731
- * **hashes:** missed a spot for hashAlgorithm defaults ([45997d8](https://github.com/npm/cacache/commit/45997d8))
732
- * **index:** add length header before JSON for verification ([fb8cb4d](https://github.com/npm/cacache/commit/fb8cb4d))
733
- * **index:** change index filenames to sha1s of keys ([bbc5fca](https://github.com/npm/cacache/commit/bbc5fca))
734
- * **index:** who cares about race conditions anyway ([b1d3888](https://github.com/npm/cacache/commit/b1d3888))
735
- * **perf:** bulk-read get+read for massive speed ([d26cdf9](https://github.com/npm/cacache/commit/d26cdf9))
736
- * **perf:** use bulk file reads for index reads ([79a8891](https://github.com/npm/cacache/commit/79a8891))
737
- * **put-stream:** remove tmp file on stream insert error ([65f6632](https://github.com/npm/cacache/commit/65f6632))
738
- * **put-stream:** robustified and predictibilized ([daf9e08](https://github.com/npm/cacache/commit/daf9e08))
739
- * **put-stream:** use new promise API for moves ([1d36013](https://github.com/npm/cacache/commit/1d36013))
740
- * **readme:** updated to reflect new default hashAlgo ([c60a2fa](https://github.com/npm/cacache/commit/c60a2fa))
741
- * **verify:** tiny typo fix ([db22d05](https://github.com/npm/cacache/commit/db22d05))
742
-
743
-
744
- ### Features
745
-
746
- * **api:** converted external api ([7bf032f](https://github.com/npm/cacache/commit/7bf032f))
747
- * **cacache:** exported clearMemoized() utility ([8d2c5b6](https://github.com/npm/cacache/commit/8d2c5b6))
748
- * **cache:** add versioning to content and index ([31bc549](https://github.com/npm/cacache/commit/31bc549))
749
- * **content:** collate content files into subdirs ([c094d9f](https://github.com/npm/cacache/commit/c094d9f))
750
- * **deps:** `@npmcorp/move@1.0.0` ([bdd00bf](https://github.com/npm/cacache/commit/bdd00bf))
751
- * **deps:** `bluebird@3.4.7` ([3a17aff](https://github.com/npm/cacache/commit/3a17aff))
752
- * **deps:** `promise-inflight@1.0.1` ([a004fe6](https://github.com/npm/cacache/commit/a004fe6))
753
- * **get:** added memoization support for get ([c77d794](https://github.com/npm/cacache/commit/c77d794))
754
- * **get:** export hasContent ([2956ec3](https://github.com/npm/cacache/commit/2956ec3))
755
- * **index:** add hashAlgorithm and format insert ret val ([b639746](https://github.com/npm/cacache/commit/b639746))
756
- * **index:** collate index files into subdirs ([e8402a5](https://github.com/npm/cacache/commit/e8402a5))
757
- * **index:** promisify entry index ([cda3335](https://github.com/npm/cacache/commit/cda3335))
758
- * **memo:** added memoization lib ([da07b92](https://github.com/npm/cacache/commit/da07b92))
759
- * **memo:** export memoization api ([954b1b3](https://github.com/npm/cacache/commit/954b1b3))
760
- * **move-file:** add move fallback for weird errors ([5cf4616](https://github.com/npm/cacache/commit/5cf4616))
761
- * **perf:** bulk content write api ([51b536e](https://github.com/npm/cacache/commit/51b536e))
762
- * **put:** added memoization support to put ([b613a70](https://github.com/npm/cacache/commit/b613a70))
763
- * **read:** switched to promises ([a869362](https://github.com/npm/cacache/commit/a869362))
764
- * **rm:** added memoization support to rm ([4205cf0](https://github.com/npm/cacache/commit/4205cf0))
765
- * **rm:** switched to promises ([a000d24](https://github.com/npm/cacache/commit/a000d24))
766
- * **util:** promise-inflight ownership fix requests ([9517cd7](https://github.com/npm/cacache/commit/9517cd7))
767
- * **util:** use promises for api ([ae204bb](https://github.com/npm/cacache/commit/ae204bb))
768
- * **verify:** converted to Promises ([f0b3974](https://github.com/npm/cacache/commit/f0b3974))
769
-
770
-
771
- ### BREAKING CHANGES
772
-
773
- * cache: index/content directories are now versioned. Previous caches are no longer compatible and cannot be migrated.
774
- * util: fix-owner now uses Promises instead of callbacks
775
- * index: Previously-generated index entries are no longer compatible and the index must be regenerated.
776
- * index: The index format has changed and previous caches are no longer compatible. Existing caches will need to be regenerated.
777
- * hashes: Default hashAlgorithm changed from sha1 to sha512. If you
778
- rely on the prior setting, pass `opts.hashAlgorithm` in explicitly.
779
- * content: Previously-generated content directories are no longer compatible
780
- and must be regenerated.
781
- * verify: API is now promise-based
782
- * read: Switches to a Promise-based API and removes callback stuff
783
- * rm: Switches to a Promise-based API and removes callback stuff
784
- * index: this changes the API to work off promises instead of callbacks
785
- * api: this means we are going all in on promises now
Binary file
Binary file