cacache 20.0.2 → 20.0.4

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.
@@ -10,7 +10,7 @@ const Pipeline = require('minipass-pipeline')
10
10
  const Flush = require('minipass-flush')
11
11
  const path = require('path')
12
12
  const ssri = require('ssri')
13
- const uniqueFilename = require('unique-filename')
13
+ const { tmpName } = require('../util/tmp')
14
14
  const fsm = require('fs-minipass')
15
15
 
16
16
  module.exports = write
@@ -152,7 +152,7 @@ async function pipeToTmp (inputStream, cache, tmpTarget, opts) {
152
152
  }
153
153
 
154
154
  async function makeTmp (cache, opts) {
155
- const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix)
155
+ const tmpTarget = tmpName(cache, opts.tmpPrefix)
156
156
  await fs.mkdir(path.dirname(tmpTarget), { recursive: true })
157
157
  return {
158
158
  target: tmpTarget,
@@ -12,7 +12,7 @@ const {
12
12
  const { Minipass } = require('minipass')
13
13
  const path = require('path')
14
14
  const ssri = require('ssri')
15
- const uniqueFilename = require('unique-filename')
15
+ const { tmpName } = require('./util/tmp')
16
16
 
17
17
  const contentPath = require('./content/path')
18
18
  const hashToSegments = require('./util/hash-to-segments')
@@ -69,7 +69,7 @@ async function compact (cache, key, matchFn, opts = {}) {
69
69
  }).join('\n')
70
70
 
71
71
  const setup = async () => {
72
- const target = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix)
72
+ const target = tmpName(cache, opts.tmpPrefix)
73
73
  await mkdir(path.dirname(target), { recursive: true })
74
74
  return {
75
75
  target,
package/lib/util/tmp.js CHANGED
@@ -1,11 +1,17 @@
1
1
  'use strict'
2
2
 
3
+ const crypto = require('crypto')
3
4
  const { withTempDir } = require('@npmcli/fs')
4
5
  const fs = require('fs/promises')
5
6
  const path = require('path')
6
7
 
7
8
  module.exports.mkdir = mktmpdir
8
9
 
10
+ module.exports.tmpName = function tmpName (cache, tmpPrefix) {
11
+ const id = crypto.randomUUID()
12
+ return path.join(cache, 'tmp', tmpPrefix ? `${tmpPrefix}-${id}` : id)
13
+ }
14
+
9
15
  async function mktmpdir (cache, opts = {}) {
10
16
  const { tmpPrefix } = opts
11
17
  const tmpDir = path.join(cache, 'tmp')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cacache",
3
- "version": "20.0.2",
3
+ "version": "20.0.4",
4
4
  "cache-version": {
5
5
  "content": "2",
6
6
  "index": "5"
@@ -46,21 +46,20 @@
46
46
  ],
47
47
  "license": "ISC",
48
48
  "dependencies": {
49
- "@npmcli/fs": "^4.0.0",
49
+ "@npmcli/fs": "^5.0.0",
50
50
  "fs-minipass": "^3.0.0",
51
- "glob": "^11.0.3",
51
+ "glob": "^13.0.0",
52
52
  "lru-cache": "^11.1.0",
53
53
  "minipass": "^7.0.3",
54
54
  "minipass-collect": "^2.0.1",
55
55
  "minipass-flush": "^1.0.5",
56
56
  "minipass-pipeline": "^1.2.4",
57
57
  "p-map": "^7.0.2",
58
- "ssri": "^13.0.0",
59
- "unique-filename": "^4.0.0"
58
+ "ssri": "^13.0.0"
60
59
  },
61
60
  "devDependencies": {
62
- "@npmcli/eslint-config": "^5.0.0",
63
- "@npmcli/template-oss": "4.25.0",
61
+ "@npmcli/eslint-config": "^6.0.1",
62
+ "@npmcli/template-oss": "4.29.0",
64
63
  "tap": "^16.0.0"
65
64
  },
66
65
  "engines": {
@@ -69,7 +68,7 @@
69
68
  "templateOSS": {
70
69
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
71
70
  "windowsCI": false,
72
- "version": "4.25.0",
71
+ "version": "4.29.0",
73
72
  "publish": "true"
74
73
  },
75
74
  "author": "GitHub Inc.",