Skip to content

Commit

Permalink
deps: cacache@17.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed May 3, 2023
1 parent 7a2ce3f commit 3eec56e
Show file tree
Hide file tree
Showing 77 changed files with 11,376 additions and 91 deletions.
8 changes: 8 additions & 0 deletions node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
!/buffer
!/builtins
!/cacache
!/cacache/node_modules/
/cacache/node_modules/*
!/cacache/node_modules/foreground-child
!/cacache/node_modules/glob
!/cacache/node_modules/jackspeak
!/cacache/node_modules/minimatch
!/cacache/node_modules/minipass
!/cacache/node_modules/signal-exit
!/chalk
!/chownr
!/ci-info
Expand Down
36 changes: 21 additions & 15 deletions node_modules/cacache/lib/content/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const events = require('events')

const contentPath = require('./path')
const fs = require('fs/promises')
const moveFile = require('../util/move-file')
const Minipass = require('minipass')
const { moveFile } = require('@npmcli/fs')
const { Minipass } = require('minipass')
const Pipeline = require('minipass-pipeline')
const Flush = require('minipass-flush')
const path = require('path')
Expand All @@ -17,9 +17,6 @@ module.exports = write

async function write (cache, data, opts = {}) {
const { algorithms, size, integrity } = opts
if (algorithms && algorithms.length > 1) {
throw new Error('opts.algorithms only supports a single algorithm for now')
}

if (typeof size === 'number' && data.length !== size) {
throw sizeError(size, data.length)
Expand All @@ -30,16 +27,19 @@ async function write (cache, data, opts = {}) {
throw checksumError(integrity, sri)
}

const tmp = await makeTmp(cache, opts)
try {
await fs.writeFile(tmp.target, data, { flag: 'wx' })
await moveToDestination(tmp, cache, sri, opts)
return { integrity: sri, size: data.length }
} finally {
if (!tmp.moved) {
await fs.rm(tmp.target, { recursive: true, force: true })
for (const algo in sri) {
const tmp = await makeTmp(cache, opts)
const hash = sri[algo].toString()
try {
await fs.writeFile(tmp.target, data, { flag: 'wx' })
await moveToDestination(tmp, cache, hash, opts)
} finally {
if (!tmp.moved) {
await fs.rm(tmp.target, { recursive: true, force: true })
}
}
}
return { integrity: sri, size: data.length }
}

module.exports.stream = writeStream
Expand Down Expand Up @@ -161,8 +161,14 @@ async function moveToDestination (tmp, cache, sri, opts) {
const destDir = path.dirname(destination)

await fs.mkdir(destDir, { recursive: true })
await moveFile(tmp.target, destination)
tmp.moved = true
try {
await moveFile(tmp.target, destination, { overwrite: false })
tmp.moved = true
} catch (err) {
if (!err.message.startsWith('The destination file exists')) {
throw Object.assign(err, { code: 'EEXIST' })
}
}
}

function sizeError (expected, found) {
Expand Down
6 changes: 3 additions & 3 deletions node_modules/cacache/lib/entry-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
rm,
writeFile,
} = require('fs/promises')
const Minipass = require('minipass')
const { Minipass } = require('minipass')
const path = require('path')
const ssri = require('ssri')
const uniqueFilename = require('unique-filename')
Expand Down Expand Up @@ -109,12 +109,12 @@ async function compact (cache, key, matchFn, opts = {}) {
module.exports.insert = insert

async function insert (cache, key, integrity, opts = {}) {
const { metadata, size } = opts
const { metadata, size, time } = opts
const bucket = bucketPath(cache, key)
const entry = {
key,
integrity: integrity && ssri.stringify(integrity),
time: Date.now(),
time: time || Date.now(),
size,
metadata,
}
Expand Down
2 changes: 1 addition & 1 deletion node_modules/cacache/lib/get.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const Collect = require('minipass-collect')
const Minipass = require('minipass')
const { Minipass } = require('minipass')
const Pipeline = require('minipass-pipeline')

const index = require('./entry-index')
Expand Down
2 changes: 1 addition & 1 deletion node_modules/cacache/lib/util/glob.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const glob = require('glob')
const { glob } = require('glob')

const globify = (pattern) => pattern.split('//').join('/')
module.exports = (path, options) => glob(globify(path), options)
56 changes: 0 additions & 56 deletions node_modules/cacache/lib/util/move-file.js

This file was deleted.

7 changes: 6 additions & 1 deletion node_modules/cacache/lib/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ async function garbageCollect (cache, opts) {
return
}

liveContent.add(entry.integrity.toString())
// integrity is stringified, re-parse it so we can get each hash
const integrity = ssri.parse(entry.integrity)
for (const algo in integrity) {
liveContent.add(integrity[algo].toString())
}
})
await new Promise((resolve, reject) => {
indexStream.on('end', resolve).on('error', reject)
Expand Down Expand Up @@ -220,6 +224,7 @@ async function rebuildBucket (cache, bucket, stats, opts) {
await index.insert(cache, entry.key, entry.integrity, {
metadata: entry.metadata,
size: entry.size,
time: entry.time,
})
stats.totalEntries++
} catch (err) {
Expand Down
15 changes: 15 additions & 0 deletions node_modules/cacache/node_modules/foreground-child/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
The ISC License

Copyright (c) 2015-2023 Isaac Z. Schlueter and Contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.allSignals = void 0;
const node_constants_1 = __importDefault(require("node:constants"));
exports.allSignals =
// this is the full list of signals that Node will let us do anything with
Object.keys(node_constants_1.default).filter(k => k.startsWith('SIG') &&
// https://github.com/tapjs/signal-exit/issues/21
k !== 'SIGPROF' &&
// no sense trying to listen for SIGKILL, it's impossible
k !== 'SIGKILL');
// These are some obscure signals that are reported by kill -l
// on macOS, Linux, or Windows, but which don't have any mapping
// in Node.js. No sense trying if they're just going to throw
// every time on every platform.
//
// 'SIGEMT',
// 'SIGLOST',
// 'SIGPOLL',
// 'SIGRTMAX',
// 'SIGRTMAX-1',
// 'SIGRTMAX-10',
// 'SIGRTMAX-11',
// 'SIGRTMAX-12',
// 'SIGRTMAX-13',
// 'SIGRTMAX-14',
// 'SIGRTMAX-15',
// 'SIGRTMAX-2',
// 'SIGRTMAX-3',
// 'SIGRTMAX-4',
// 'SIGRTMAX-5',
// 'SIGRTMAX-6',
// 'SIGRTMAX-7',
// 'SIGRTMAX-8',
// 'SIGRTMAX-9',
// 'SIGRTMIN',
// 'SIGRTMIN+1',
// 'SIGRTMIN+10',
// 'SIGRTMIN+11',
// 'SIGRTMIN+12',
// 'SIGRTMIN+13',
// 'SIGRTMIN+14',
// 'SIGRTMIN+15',
// 'SIGRTMIN+16',
// 'SIGRTMIN+2',
// 'SIGRTMIN+3',
// 'SIGRTMIN+4',
// 'SIGRTMIN+5',
// 'SIGRTMIN+6',
// 'SIGRTMIN+7',
// 'SIGRTMIN+8',
// 'SIGRTMIN+9',
// 'SIGSTKFLT',
// 'SIGUNUSED',
//# sourceMappingURL=all-signals.js.map
Loading

0 comments on commit 3eec56e

Please sign in to comment.