cacache 12.0.2 → 13.0.1

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 CHANGED
@@ -2,6 +2,105 @@
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
+ ### [13.0.1](https://github.com/npm/cacache/compare/v13.0.0...v13.0.1) (2019-09-30)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **fix-owner:** chownr.sync quits on non-root uid ([08801be](https://github.com/npm/cacache/commit/08801be))
11
+
12
+ ## [13.0.0](https://github.com/npm/cacache/compare/v12.0.3...v13.0.0) (2019-09-25)
13
+
14
+
15
+ ### ⚠ BREAKING CHANGES
16
+
17
+ * This subtly changes the streaming interface of
18
+ everything in cacache that streams, which is, well, everything in
19
+ cacache. Most users will probably not notice, but any code that
20
+ depended on stream behavior always being deferred until next tick will
21
+ need to adjust.
22
+
23
+ The mississippi methods 'to', 'from', 'through', and so on, have been
24
+ replaced with their Minipass counterparts, and streaming interaction
25
+ with the file system is done via fs-minipass.
26
+
27
+ The following modules are of interest here:
28
+
29
+ - [minipass](http://npm.im/minipass) The core stream library.
30
+
31
+ - [fs-minipass](http://npm.im/fs-minipass) Note that the 'WriteStream'
32
+ class from fs-minipass is _not_ a Minipass stream, but rather a plain
33
+ old EventEmitter that duck types as a Writable.
34
+
35
+ - [minipass-collect](http://npm.im/minipass-collect) Gather up all the
36
+ data from a stream. Cacache only uses Collect.PassThrough, which is a
37
+ basic Minipass passthrough stream which emits a 'collect' event with
38
+ the completed data just before the 'end' event.
39
+
40
+ - [minipass-pipeline](http://npm.im/minipass-pipeline) Connect one or
41
+ more streams into a pipe chain. Errors anywhere in the pipeline are
42
+ proxied down the chain and then up to the Pipeline object itself.
43
+ Writes go into the head, reads go to the tail. Used in place of
44
+ pump() and pumpify().
45
+
46
+ - [minipass-flush](http://npm.im/minipass-flush) A Minipass passthrough
47
+ stream that defers its 'end' event until after a flush() method has
48
+ completed (either calling the supplied callback, or returning a
49
+ promise.) Use in place of flush-write-stream (aka mississippi.to).
50
+
51
+ Streams from through2, concat-stream, and the behavior provided by
52
+ end-of-stream are all implemented in Minipass itself.
53
+
54
+ Features of interest to cacache, which make Minipass a particularly good
55
+ fit:
56
+
57
+ - All of the 'endish' events are normalized, so we can just listen on
58
+ 'end' and know that finish, prefinish, and close will be handled as
59
+ well.
60
+ - Minipass doesn't waste time [containing
61
+ zalgo](https://blog.izs.me/2013/08/designing-apis-for-asynchrony).
62
+ - Minipass has built-in support for promises that indicate the end or
63
+ error: stream.promise(), stream.collect(), and stream.concat().
64
+ - With reliable and consistent timing guarantees, much less
65
+ error-checking logic is required. We can be more confident that an
66
+ error is being thrown or emitted in the correct place, rather than in
67
+ a callback which is deferred, resulting in a hung promise or
68
+ uncaughtException.
69
+
70
+ The biggest downside of Minipass is that it lacks some of the internal
71
+ characteristics of node-core streams, which many community modules use
72
+ to identify streams. They have no _writableState or _readableState
73
+ objects, or _read or _write methods. As a result, the is-stream module
74
+ (at least, at the time of this commit) doesn't recognize Minipass
75
+ streams as readable or writable streams.
76
+
77
+ All in all, the changes required of downstream users should be minimal,
78
+ but are unlikely to be zero. Hence the semver major change.
79
+
80
+ ### Features
81
+
82
+ * replace all streams with Minipass streams ([f4c0962](https://github.com/npm/cacache/commit/f4c0962))
83
+ * **deps:** Add minipass and minipass-pipeline ([a6545a9](https://github.com/npm/cacache/commit/a6545a9))
84
+ * **promise:** converted .resolve to native promise, converted .map and .reduce to native ([220c56d](https://github.com/npm/cacache/commit/220c56d))
85
+ * **promise:** individually promisifing functions as needed ([74b939e](https://github.com/npm/cacache/commit/74b939e))
86
+ * **promise:** moved .reject from bluebird to native promise ([1d56da1](https://github.com/npm/cacache/commit/1d56da1))
87
+ * **promise:** removed .fromNode, removed .join ([9c457a0](https://github.com/npm/cacache/commit/9c457a0))
88
+ * **promise:** removed .map, replaced with p-map. removed .try ([cc3ee05](https://github.com/npm/cacache/commit/cc3ee05))
89
+ * **promise:** removed .tap ([0260f12](https://github.com/npm/cacache/commit/0260f12))
90
+ * **promise:** removed .using/.disposer ([5d832f3](https://github.com/npm/cacache/commit/5d832f3))
91
+ * **promise:** removed bluebird ([c21298c](https://github.com/npm/cacache/commit/c21298c))
92
+ * **promise:** removed bluebird specific .catch calls ([28aeeac](https://github.com/npm/cacache/commit/28aeeac))
93
+ * **promise:** replaced .reduce and .mapSeries ([478f5cb](https://github.com/npm/cacache/commit/478f5cb))
94
+
95
+ ### [12.0.3](https://github.com/npm/cacache/compare/v12.0.2...v12.0.3) (2019-08-19)
96
+
97
+
98
+ ### Bug Fixes
99
+
100
+ * do not chown if not running as root ([2d80af9](https://github.com/npm/cacache/commit/2d80af9))
101
+
102
+
103
+
5
104
  ### [12.0.2](https://github.com/npm/cacache/compare/v12.0.1...v12.0.2) (2019-07-19)
6
105
 
7
106
 
@@ -56,7 +155,7 @@ chown everything to root.
56
155
  The solution is for the user to create a folder, make it user-owned, and
57
156
  use that, rather than relying on cacache to create the root cache folder.
58
157
 
59
- If we decide to restore the uid/gid opts, and use ownership inferrence
158
+ If we decide to restore the uid/gid opts, and use ownership inference
60
159
  only when uid/gid are unset, then take care to also make rm take an
61
160
  option object, and pass it through to entry-index.js.
62
161
 
package/README.md CHANGED
@@ -40,7 +40,6 @@ _Translations: [español](README.es.md)_
40
40
  * [`rm.entry`](#rm-entry)
41
41
  * [`rm.content`](#rm-content)
42
42
  * Utilities
43
- * [`setLocale`](#set-locale)
44
43
  * [`clearMemoized`](#clear-memoized)
45
44
  * [`tmp.mkdir`](#tmp-mkdir)
46
45
  * [`tmp.withTmp`](#with-tmp)
@@ -52,7 +51,7 @@ _Translations: [español](README.es.md)_
52
51
  ### Example
53
52
 
54
53
  ```javascript
55
- const cacache = require('cacache/en')
54
+ const cacache = require('cacache')
56
55
  const fs = require('fs')
57
56
 
58
57
  const tarball = '/path/to/mytar.tgz'
@@ -113,21 +112,6 @@ Happy hacking!
113
112
 
114
113
  ### API
115
114
 
116
- #### <a name="localized-api"></a> Using localized APIs
117
-
118
- cacache includes a complete API in English, with the same features as other
119
- translations. To use the English API as documented in this README, use
120
- `require('cacache/en')`. This is also currently the default if you do
121
- `require('cacache')`, but may change in the future.
122
-
123
- cacache also supports other languages! You can find the list of currently
124
- supported ones by looking in `./locales` in the source directory. You can use
125
- the API in that language with `require('cacache/<lang>')`.
126
-
127
- Want to add support for a new language? Please go ahead! You should be able to
128
- copy `./locales/en.js` and `./locales/en.json` and fill them in. Translating the
129
- `README.md` is a bit more work, but also appreciated if you get around to it. 👍🏼
130
-
131
115
  #### <a name="ls"></a> `> cacache.ls(cache) -> Promise<Object>`
132
116
 
133
117
  Lists info for all entries currently in the cache as a single large object. Each
@@ -478,14 +462,6 @@ cacache.rm.content(cachePath, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => {
478
462
  })
479
463
  ```
480
464
 
481
- #### <a name="set-locale"></a> `> cacache.setLocale(locale)`
482
-
483
- Configure the language/locale used for messages and errors coming from cacache.
484
- The list of available locales is in the `./locales` directory in the project
485
- root.
486
-
487
- _Interested in contributing more languages! [Submit a PR](CONTRIBUTING.md)!_
488
-
489
465
  #### <a name="clear-memoized"></a> `> cacache.clearMemoized()`
490
466
 
491
467
  Completely resets the in-memory entry cache.
@@ -537,8 +513,8 @@ cacache.tmp.mkdir(cache).then(dir => {
537
513
 
538
514
  Creates a temporary directory with [`tmp.mkdir()`](#tmp-mkdir) and calls `cb`
539
515
  with it. The created temporary directory will be removed when the return value
540
- of `cb()` resolves -- that is, if you return a Promise from `cb()`, the tmp
541
- directory will be automatically deleted once that promise completes.
516
+ of `cb()` resolves, the tmp directory will be automatically deleted once that
517
+ promise completes.
542
518
 
543
519
  The same caveats apply when it comes to managing permissions for the tmp dir's
544
520
  contents.
package/get.js CHANGED
@@ -1,15 +1,18 @@
1
1
  'use strict'
2
2
 
3
- const BB = require('bluebird')
3
+ const util = require('util')
4
4
 
5
5
  const figgyPudding = require('figgy-pudding')
6
6
  const fs = require('fs')
7
7
  const index = require('./lib/entry-index')
8
8
  const memo = require('./lib/memoization')
9
- const pipe = require('mississippi').pipe
10
- const pipeline = require('mississippi').pipeline
11
9
  const read = require('./lib/content/read')
12
- const through = require('mississippi').through
10
+
11
+ const Minipass = require('minipass')
12
+ const Collect = require('minipass-collect')
13
+ const Pipeline = require('minipass-pipeline')
14
+
15
+ const writeFile = util.promisify(fs.writeFile)
13
16
 
14
17
  const GetOpts = figgyPudding({
15
18
  integrity: {},
@@ -23,44 +26,53 @@ module.exports = function get (cache, key, opts) {
23
26
  module.exports.byDigest = function getByDigest (cache, digest, opts) {
24
27
  return getData(true, cache, digest, opts)
25
28
  }
29
+
26
30
  function getData (byDigest, cache, key, opts) {
27
31
  opts = GetOpts(opts)
28
- const memoized = (
29
- byDigest
30
- ? memo.get.byDigest(cache, key, opts)
31
- : memo.get(cache, key, opts)
32
- )
32
+ const memoized = byDigest
33
+ ? memo.get.byDigest(cache, key, opts)
34
+ : memo.get(cache, key, opts)
33
35
  if (memoized && opts.memoize !== false) {
34
- return BB.resolve(byDigest ? memoized : {
35
- metadata: memoized.entry.metadata,
36
- data: memoized.data,
37
- integrity: memoized.entry.integrity,
38
- size: memoized.entry.size
39
- })
36
+ return Promise.resolve(
37
+ byDigest
38
+ ? memoized
39
+ : {
40
+ metadata: memoized.entry.metadata,
41
+ data: memoized.data,
42
+ integrity: memoized.entry.integrity,
43
+ size: memoized.entry.size
44
+ }
45
+ )
40
46
  }
41
- return (
42
- byDigest ? BB.resolve(null) : index.find(cache, key, opts)
43
- ).then(entry => {
44
- if (!entry && !byDigest) {
45
- throw new index.NotFoundError(cache, key)
46
- }
47
- return read(cache, byDigest ? key : entry.integrity, {
48
- integrity: opts.integrity,
49
- size: opts.size
50
- }).then(data => byDigest ? data : {
51
- metadata: entry.metadata,
52
- data: data,
53
- size: entry.size,
54
- integrity: entry.integrity
55
- }).then(res => {
56
- if (opts.memoize && byDigest) {
57
- memo.put.byDigest(cache, key, res, opts)
58
- } else if (opts.memoize) {
59
- memo.put(cache, entry, res.data, opts)
47
+ return (byDigest ? Promise.resolve(null) : index.find(cache, key, opts)).then(
48
+ (entry) => {
49
+ if (!entry && !byDigest) {
50
+ throw new index.NotFoundError(cache, key)
60
51
  }
61
- return res
62
- })
63
- })
52
+ return read(cache, byDigest ? key : entry.integrity, {
53
+ integrity: opts.integrity,
54
+ size: opts.size
55
+ })
56
+ .then((data) =>
57
+ byDigest
58
+ ? data
59
+ : {
60
+ metadata: entry.metadata,
61
+ data: data,
62
+ size: entry.size,
63
+ integrity: entry.integrity
64
+ }
65
+ )
66
+ .then((res) => {
67
+ if (opts.memoize && byDigest) {
68
+ memo.put.byDigest(cache, key, res, opts)
69
+ } else if (opts.memoize) {
70
+ memo.put(cache, entry, res.data, opts)
71
+ }
72
+ return res
73
+ })
74
+ }
75
+ )
64
76
  }
65
77
 
66
78
  module.exports.sync = function get (cache, key, opts) {
@@ -69,33 +81,30 @@ module.exports.sync = function get (cache, key, opts) {
69
81
  module.exports.sync.byDigest = function getByDigest (cache, digest, opts) {
70
82
  return getDataSync(true, cache, digest, opts)
71
83
  }
84
+
72
85
  function getDataSync (byDigest, cache, key, opts) {
73
86
  opts = GetOpts(opts)
74
- const memoized = (
75
- byDigest
76
- ? memo.get.byDigest(cache, key, opts)
77
- : memo.get(cache, key, opts)
78
- )
87
+ const memoized = byDigest
88
+ ? memo.get.byDigest(cache, key, opts)
89
+ : memo.get(cache, key, opts)
79
90
  if (memoized && opts.memoize !== false) {
80
- return byDigest ? memoized : {
81
- metadata: memoized.entry.metadata,
82
- data: memoized.data,
83
- integrity: memoized.entry.integrity,
84
- size: memoized.entry.size
85
- }
91
+ return byDigest
92
+ ? memoized
93
+ : {
94
+ metadata: memoized.entry.metadata,
95
+ data: memoized.data,
96
+ integrity: memoized.entry.integrity,
97
+ size: memoized.entry.size
98
+ }
86
99
  }
87
100
  const entry = !byDigest && index.find.sync(cache, key, opts)
88
101
  if (!entry && !byDigest) {
89
102
  throw new index.NotFoundError(cache, key)
90
103
  }
91
- const data = read.sync(
92
- cache,
93
- byDigest ? key : entry.integrity,
94
- {
95
- integrity: opts.integrity,
96
- size: opts.size
97
- }
98
- )
104
+ const data = read.sync(cache, byDigest ? key : entry.integrity, {
105
+ integrity: opts.integrity,
106
+ size: opts.size
107
+ })
99
108
  const res = byDigest
100
109
  ? data
101
110
  : {
@@ -113,97 +122,93 @@ function getDataSync (byDigest, cache, key, opts) {
113
122
  }
114
123
 
115
124
  module.exports.stream = getStream
125
+
126
+ const getMemoizedStream = (memoized) => {
127
+ const stream = new Minipass()
128
+ stream.on('newListener', function (ev, cb) {
129
+ ev === 'metadata' && cb(memoized.entry.metadata)
130
+ ev === 'integrity' && cb(memoized.entry.integrity)
131
+ ev === 'size' && cb(memoized.entry.size)
132
+ })
133
+ stream.end(memoized.data)
134
+ return stream
135
+ }
136
+
116
137
  function getStream (cache, key, opts) {
117
138
  opts = GetOpts(opts)
118
- let stream = through()
119
139
  const memoized = memo.get(cache, key, opts)
120
140
  if (memoized && opts.memoize !== false) {
121
- stream.on('newListener', function (ev, cb) {
122
- ev === 'metadata' && cb(memoized.entry.metadata)
123
- ev === 'integrity' && cb(memoized.entry.integrity)
124
- ev === 'size' && cb(memoized.entry.size)
125
- })
126
- stream.write(memoized.data, () => stream.end())
127
- return stream
141
+ return getMemoizedStream(memoized)
128
142
  }
129
- index.find(cache, key).then(entry => {
130
- if (!entry) {
131
- return stream.emit(
132
- 'error', new index.NotFoundError(cache, key)
133
- )
134
- }
135
- let memoStream
136
- if (opts.memoize) {
137
- let memoData = []
138
- let memoLength = 0
139
- memoStream = through((c, en, cb) => {
140
- memoData && memoData.push(c)
141
- memoLength += c.length
142
- cb(null, c, en)
143
- }, cb => {
144
- memoData && memo.put(cache, entry, Buffer.concat(memoData, memoLength), opts)
145
- cb()
143
+
144
+ const stream = new Pipeline()
145
+ index
146
+ .find(cache, key)
147
+ .then((entry) => {
148
+ if (!entry) {
149
+ throw new index.NotFoundError(cache, key)
150
+ }
151
+ stream.emit('metadata', entry.metadata)
152
+ stream.emit('integrity', entry.integrity)
153
+ stream.emit('size', entry.size)
154
+ stream.on('newListener', function (ev, cb) {
155
+ ev === 'metadata' && cb(entry.metadata)
156
+ ev === 'integrity' && cb(entry.integrity)
157
+ ev === 'size' && cb(entry.size)
146
158
  })
147
- } else {
148
- memoStream = through()
149
- }
150
- stream.emit('metadata', entry.metadata)
151
- stream.emit('integrity', entry.integrity)
152
- stream.emit('size', entry.size)
153
- stream.on('newListener', function (ev, cb) {
154
- ev === 'metadata' && cb(entry.metadata)
155
- ev === 'integrity' && cb(entry.integrity)
156
- ev === 'size' && cb(entry.size)
159
+
160
+ const src = read.readStream(
161
+ cache,
162
+ entry.integrity,
163
+ opts.concat({
164
+ size: opts.size == null ? entry.size : opts.size
165
+ })
166
+ )
167
+
168
+ if (opts.memoize) {
169
+ const memoStream = new Collect.PassThrough()
170
+ memoStream.on('collect', data => memo.put(cache, entry, data, opts))
171
+ stream.unshift(memoStream)
172
+ }
173
+ stream.unshift(src)
157
174
  })
158
- pipe(
159
- read.readStream(cache, entry.integrity, opts.concat({
160
- size: opts.size == null ? entry.size : opts.size
161
- })),
162
- memoStream,
163
- stream
164
- )
165
- }).catch(err => stream.emit('error', err))
175
+ .catch((err) => stream.emit('error', err))
176
+
166
177
  return stream
167
178
  }
168
179
 
169
180
  module.exports.stream.byDigest = getStreamDigest
181
+
170
182
  function getStreamDigest (cache, integrity, opts) {
171
183
  opts = GetOpts(opts)
172
184
  const memoized = memo.get.byDigest(cache, integrity, opts)
173
185
  if (memoized && opts.memoize !== false) {
174
- const stream = through()
175
- stream.write(memoized, () => stream.end())
186
+ const stream = new Minipass()
187
+ stream.end(memoized)
176
188
  return stream
177
189
  } else {
178
- let stream = read.readStream(cache, integrity, opts)
179
- if (opts.memoize) {
180
- let memoData = []
181
- let memoLength = 0
182
- const memoStream = through((c, en, cb) => {
183
- memoData && memoData.push(c)
184
- memoLength += c.length
185
- cb(null, c, en)
186
- }, cb => {
187
- memoData && memo.put.byDigest(
188
- cache,
189
- integrity,
190
- Buffer.concat(memoData, memoLength),
191
- opts
192
- )
193
- cb()
194
- })
195
- stream = pipeline(stream, memoStream)
190
+ const stream = read.readStream(cache, integrity, opts)
191
+ if (!opts.memoize) {
192
+ return stream
196
193
  }
197
- return stream
194
+ const memoStream = new Collect.PassThrough()
195
+ memoStream.on('collect', data => memo.put.byDigest(
196
+ cache,
197
+ integrity,
198
+ data,
199
+ opts
200
+ ))
201
+ return new Pipeline(stream, memoStream)
198
202
  }
199
203
  }
200
204
 
201
205
  module.exports.info = info
206
+
202
207
  function info (cache, key, opts) {
203
208
  opts = GetOpts(opts)
204
209
  const memoized = memo.get(cache, key, opts)
205
210
  if (memoized && opts.memoize !== false) {
206
- return BB.resolve(memoized.entry)
211
+ return Promise.resolve(memoized.entry)
207
212
  } else {
208
213
  return index.find(cache, key)
209
214
  }
@@ -211,37 +216,51 @@ function info (cache, key, opts) {
211
216
 
212
217
  module.exports.hasContent = read.hasContent
213
218
 
214
- module.exports.copy = function cp (cache, key, dest, opts) {
219
+ function cp (cache, key, dest, opts) {
215
220
  return copy(false, cache, key, dest, opts)
216
221
  }
217
- module.exports.copy.byDigest = function cpDigest (cache, digest, dest, opts) {
222
+
223
+ module.exports.copy = cp
224
+
225
+ function cpDigest (cache, digest, dest, opts) {
218
226
  return copy(true, cache, digest, dest, opts)
219
227
  }
228
+
229
+ module.exports.copy.byDigest = cpDigest
230
+
220
231
  function copy (byDigest, cache, key, dest, opts) {
221
232
  opts = GetOpts(opts)
222
233
  if (read.copy) {
223
- return (
224
- byDigest ? BB.resolve(null) : index.find(cache, key, opts)
225
- ).then(entry => {
234
+ return (byDigest
235
+ ? Promise.resolve(null)
236
+ : index.find(cache, key, opts)
237
+ ).then((entry) => {
226
238
  if (!entry && !byDigest) {
227
239
  throw new index.NotFoundError(cache, key)
228
240
  }
229
- return read.copy(
230
- cache, byDigest ? key : entry.integrity, dest, opts
231
- ).then(() => byDigest ? key : {
232
- metadata: entry.metadata,
233
- size: entry.size,
234
- integrity: entry.integrity
235
- })
241
+ return read
242
+ .copy(cache, byDigest ? key : entry.integrity, dest, opts)
243
+ .then(() => {
244
+ return byDigest
245
+ ? key
246
+ : {
247
+ metadata: entry.metadata,
248
+ size: entry.size,
249
+ integrity: entry.integrity
250
+ }
251
+ })
236
252
  })
237
- } else {
238
- return getData(byDigest, cache, key, opts).then(res => {
239
- return fs.writeFileAsync(dest, byDigest ? res : res.data)
240
- .then(() => byDigest ? key : {
253
+ }
254
+
255
+ return getData(byDigest, cache, key, opts).then((res) => {
256
+ return writeFile(dest, byDigest ? res : res.data).then(() => {
257
+ return byDigest
258
+ ? key
259
+ : {
241
260
  metadata: res.metadata,
242
261
  size: res.size,
243
262
  integrity: res.integrity
244
- })
263
+ }
245
264
  })
246
- }
265
+ })
247
266
  }
package/index.js CHANGED
@@ -1,3 +1,41 @@
1
1
  'use strict'
2
2
 
3
- module.exports = require('./locales/en.js')
3
+ const ls = require('./ls.js')
4
+ const get = require('./get.js')
5
+ const put = require('./put.js')
6
+ const rm = require('./rm.js')
7
+ const verify = require('./verify.js')
8
+ const { clearMemoized } = require('./lib/memoization.js')
9
+ const tmp = require('./lib/util/tmp.js')
10
+
11
+ module.exports.ls = ls
12
+ module.exports.ls.stream = ls.stream
13
+
14
+ module.exports.get = get
15
+ module.exports.get.byDigest = get.byDigest
16
+ module.exports.get.sync = get.sync
17
+ module.exports.get.sync.byDigest = get.sync.byDigest
18
+ module.exports.get.stream = get.stream
19
+ module.exports.get.stream.byDigest = get.stream.byDigest
20
+ module.exports.get.copy = get.copy
21
+ module.exports.get.copy.byDigest = get.copy.byDigest
22
+ module.exports.get.info = get.info
23
+ module.exports.get.hasContent = get.hasContent
24
+ module.exports.get.hasContent.sync = get.hasContent.sync
25
+
26
+ module.exports.put = put
27
+ module.exports.put.stream = put.stream
28
+
29
+ module.exports.rm = rm.entry
30
+ module.exports.rm.all = rm.all
31
+ module.exports.rm.entry = module.exports.rm
32
+ module.exports.rm.content = rm.content
33
+
34
+ module.exports.clearMemoized = clearMemoized
35
+
36
+ module.exports.tmp = {}
37
+ module.exports.tmp.mkdir = tmp.mkdir
38
+ module.exports.tmp.withTmp = tmp.withTmp
39
+
40
+ module.exports.verify = verify
41
+ module.exports.verify.lastRun = verify.lastRun
@@ -11,16 +11,18 @@ const ssri = require('ssri')
11
11
  // ~/.my-cache/content-v2/sha512/ba/da/55deadbeefc0ffee
12
12
  //
13
13
  module.exports = contentPath
14
+
14
15
  function contentPath (cache, integrity) {
15
16
  const sri = ssri.parse(integrity, { single: true })
16
17
  // contentPath is the *strongest* algo given
17
- return path.join.apply(path, [
18
- contentDir(cache),
19
- sri.algorithm
20
- ].concat(hashToSegments(sri.hexDigest())))
18
+ return path.join.apply(
19
+ path,
20
+ [contentDir(cache), sri.algorithm].concat(hashToSegments(sri.hexDigest()))
21
+ )
21
22
  }
22
23
 
23
- module.exports._contentDir = contentDir
24
+ module.exports.contentDir = contentDir
25
+
24
26
  function contentDir (cache) {
25
27
  return path.join(cache, `content-v${contentVer}`)
26
28
  }