From 6e4a64976dc9a359b97413cd725e93caa1f0fc28 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Wed, 1 Feb 2023 15:30:13 -0800 Subject: [PATCH] deps: pacote@15.0.8 --- mock-registry/package.json | 2 +- node_modules/.gitignore | 3 + .../pacote/node_modules/fs-minipass/LICENSE | 15 + .../node_modules/fs-minipass/lib/index.js | 443 ++++++++++++++++++ .../node_modules/fs-minipass/package.json | 53 +++ node_modules/pacote/package.json | 8 +- package-lock.json | 32 +- package.json | 2 +- workspaces/arborist/package.json | 2 +- workspaces/libnpmdiff/package.json | 2 +- workspaces/libnpmexec/package.json | 2 +- workspaces/libnpmpack/package.json | 2 +- 12 files changed, 546 insertions(+), 20 deletions(-) create mode 100644 node_modules/pacote/node_modules/fs-minipass/LICENSE create mode 100644 node_modules/pacote/node_modules/fs-minipass/lib/index.js create mode 100644 node_modules/pacote/node_modules/fs-minipass/package.json diff --git a/mock-registry/package.json b/mock-registry/package.json index d381765da5c1c..9d5dce996185b 100644 --- a/mock-registry/package.json +++ b/mock-registry/package.json @@ -49,7 +49,7 @@ "@npmcli/template-oss": "4.11.3", "nock": "^13.2.9", "npm-package-arg": "^10.1.0", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "tap": "^16.3.2" } } diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 3de9a6f67f260..76e9c118ffaa2 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -214,6 +214,9 @@ !/once !/p-map !/pacote +!/pacote/node_modules/ +/pacote/node_modules/* +!/pacote/node_modules/fs-minipass !/parse-conflict-json !/path-is-absolute !/postcss-selector-parser diff --git a/node_modules/pacote/node_modules/fs-minipass/LICENSE b/node_modules/pacote/node_modules/fs-minipass/LICENSE new file mode 100644 index 0000000000000..19129e315fe59 --- /dev/null +++ b/node_modules/pacote/node_modules/fs-minipass/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 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. diff --git a/node_modules/pacote/node_modules/fs-minipass/lib/index.js b/node_modules/pacote/node_modules/fs-minipass/lib/index.js new file mode 100644 index 0000000000000..f9d5082a4d642 --- /dev/null +++ b/node_modules/pacote/node_modules/fs-minipass/lib/index.js @@ -0,0 +1,443 @@ +'use strict' +const MiniPass = require('minipass') +const EE = require('events').EventEmitter +const fs = require('fs') + +const writev = fs.writev + +const _autoClose = Symbol('_autoClose') +const _close = Symbol('_close') +const _ended = Symbol('_ended') +const _fd = Symbol('_fd') +const _finished = Symbol('_finished') +const _flags = Symbol('_flags') +const _flush = Symbol('_flush') +const _handleChunk = Symbol('_handleChunk') +const _makeBuf = Symbol('_makeBuf') +const _mode = Symbol('_mode') +const _needDrain = Symbol('_needDrain') +const _onerror = Symbol('_onerror') +const _onopen = Symbol('_onopen') +const _onread = Symbol('_onread') +const _onwrite = Symbol('_onwrite') +const _open = Symbol('_open') +const _path = Symbol('_path') +const _pos = Symbol('_pos') +const _queue = Symbol('_queue') +const _read = Symbol('_read') +const _readSize = Symbol('_readSize') +const _reading = Symbol('_reading') +const _remain = Symbol('_remain') +const _size = Symbol('_size') +const _write = Symbol('_write') +const _writing = Symbol('_writing') +const _defaultFlag = Symbol('_defaultFlag') +const _errored = Symbol('_errored') + +class ReadStream extends MiniPass { + constructor (path, opt) { + opt = opt || {} + super(opt) + + this.readable = true + this.writable = false + + if (typeof path !== 'string') { + throw new TypeError('path must be a string') + } + + this[_errored] = false + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_path] = path + this[_readSize] = opt.readSize || 16 * 1024 * 1024 + this[_reading] = false + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity + this[_remain] = this[_size] + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + if (typeof this[_fd] === 'number') { + this[_read]() + } else { + this[_open]() + } + } + + get fd () { + return this[_fd] + } + + get path () { + return this[_path] + } + + write () { + throw new TypeError('this is a readable stream') + } + + end () { + throw new TypeError('this is a readable stream') + } + + [_open] () { + fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (er) { + this[_onerror](er) + } else { + this[_fd] = fd + this.emit('open', fd) + this[_read]() + } + } + + [_makeBuf] () { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])) + } + + [_read] () { + if (!this[_reading]) { + this[_reading] = true + const buf = this[_makeBuf]() + /* istanbul ignore if */ + if (buf.length === 0) { + return process.nextTick(() => this[_onread](null, 0, buf)) + } + fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => + this[_onread](er, br, b)) + } + } + + [_onread] (er, br, buf) { + this[_reading] = false + if (er) { + this[_onerror](er) + } else if (this[_handleChunk](br, buf)) { + this[_read]() + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) + } + } + + [_onerror] (er) { + this[_reading] = true + this[_close]() + this.emit('error', er) + } + + [_handleChunk] (br, buf) { + let ret = false + // no effect if infinite + this[_remain] -= br + if (br > 0) { + ret = super.write(br < buf.length ? buf.slice(0, br) : buf) + } + + if (br === 0 || this[_remain] <= 0) { + ret = false + this[_close]() + super.end() + } + + return ret + } + + emit (ev, data) { + switch (ev) { + case 'prefinish': + case 'finish': + break + + case 'drain': + if (typeof this[_fd] === 'number') { + this[_read]() + } + break + + case 'error': + if (this[_errored]) { + return + } + this[_errored] = true + return super.emit(ev, data) + + default: + return super.emit(ev, data) + } + } +} + +class ReadStreamSync extends ReadStream { + [_open] () { + let threw = true + try { + this[_onopen](null, fs.openSync(this[_path], 'r')) + threw = false + } finally { + if (threw) { + this[_close]() + } + } + } + + [_read] () { + let threw = true + try { + if (!this[_reading]) { + this[_reading] = true + do { + const buf = this[_makeBuf]() + /* istanbul ignore next */ + const br = buf.length === 0 ? 0 + : fs.readSync(this[_fd], buf, 0, buf.length, null) + if (!this[_handleChunk](br, buf)) { + break + } + } while (true) + this[_reading] = false + } + threw = false + } finally { + if (threw) { + this[_close]() + } + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.closeSync(fd) + this.emit('close') + } + } +} + +class WriteStream extends EE { + constructor (path, opt) { + opt = opt || {} + super(opt) + this.readable = false + this.writable = true + this[_errored] = false + this[_writing] = false + this[_ended] = false + this[_needDrain] = false + this[_queue] = [] + this[_path] = path + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode + this[_pos] = typeof opt.start === 'number' ? opt.start : null + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== null ? 'r+' : 'w' + this[_defaultFlag] = opt.flags === undefined + this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags + + if (this[_fd] === null) { + this[_open]() + } + } + + emit (ev, data) { + if (ev === 'error') { + if (this[_errored]) { + return + } + this[_errored] = true + } + return super.emit(ev, data) + } + + get fd () { + return this[_fd] + } + + get path () { + return this[_path] + } + + [_onerror] (er) { + this[_close]() + this[_writing] = true + this.emit('error', er) + } + + [_open] () { + fs.open(this[_path], this[_flags], this[_mode], + (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && er.code === 'ENOENT') { + this[_flags] = 'w' + this[_open]() + } else if (er) { + this[_onerror](er) + } else { + this[_fd] = fd + this.emit('open', fd) + if (!this[_writing]) { + this[_flush]() + } + } + } + + end (buf, enc) { + if (buf) { + this.write(buf, enc) + } + + this[_ended] = true + + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && !this[_queue].length && + typeof this[_fd] === 'number') { + this[_onwrite](null, 0) + } + return this + } + + write (buf, enc) { + if (typeof buf === 'string') { + buf = Buffer.from(buf, enc) + } + + if (this[_ended]) { + this.emit('error', new Error('write() after end()')) + return false + } + + if (this[_fd] === null || this[_writing] || this[_queue].length) { + this[_queue].push(buf) + this[_needDrain] = true + return false + } + + this[_writing] = true + this[_write](buf) + return true + } + + [_write] (buf) { + fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => + this[_onwrite](er, bw)) + } + + [_onwrite] (er, bw) { + if (er) { + this[_onerror](er) + } else { + if (this[_pos] !== null) { + this[_pos] += bw + } + if (this[_queue].length) { + this[_flush]() + } else { + this[_writing] = false + + if (this[_ended] && !this[_finished]) { + this[_finished] = true + this[_close]() + this.emit('finish') + } else if (this[_needDrain]) { + this[_needDrain] = false + this.emit('drain') + } + } + } + } + + [_flush] () { + if (this[_queue].length === 0) { + if (this[_ended]) { + this[_onwrite](null, 0) + } + } else if (this[_queue].length === 1) { + this[_write](this[_queue].pop()) + } else { + const iovec = this[_queue] + this[_queue] = [] + writev(this[_fd], iovec, this[_pos], + (er, bw) => this[_onwrite](er, bw)) + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) + } + } +} + +class WriteStreamSync extends WriteStream { + [_open] () { + let fd + // only wrap in a try{} block if we know we'll retry, to avoid + // the rethrow obscuring the error's source frame in most cases. + if (this[_defaultFlag] && this[_flags] === 'r+') { + try { + fd = fs.openSync(this[_path], this[_flags], this[_mode]) + } catch (er) { + if (er.code === 'ENOENT') { + this[_flags] = 'w' + return this[_open]() + } else { + throw er + } + } + } else { + fd = fs.openSync(this[_path], this[_flags], this[_mode]) + } + + this[_onopen](null, fd) + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.closeSync(fd) + this.emit('close') + } + } + + [_write] (buf) { + // throw the original, but try to close if it fails + let threw = true + try { + this[_onwrite](null, + fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])) + threw = false + } finally { + if (threw) { + try { + this[_close]() + } catch { + // ok error + } + } + } + } +} + +exports.ReadStream = ReadStream +exports.ReadStreamSync = ReadStreamSync + +exports.WriteStream = WriteStream +exports.WriteStreamSync = WriteStreamSync diff --git a/node_modules/pacote/node_modules/fs-minipass/package.json b/node_modules/pacote/node_modules/fs-minipass/package.json new file mode 100644 index 0000000000000..cba0d0cbc2dd8 --- /dev/null +++ b/node_modules/pacote/node_modules/fs-minipass/package.json @@ -0,0 +1,53 @@ +{ + "name": "fs-minipass", + "version": "3.0.1", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap", + "posttest": "npm run lint" + }, + "keywords": [], + "author": "GitHub Inc.", + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/fs-minipass.git" + }, + "bugs": { + "url": "https://github.com/npm/fs-minipass/issues" + }, + "homepage": "https://github.com/npm/fs-minipass#readme", + "description": "fs read and write streams based on minipass", + "dependencies": { + "minipass": "^4.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^4.0.1", + "@npmcli/template-oss": "4.11.3", + "mutate-fs": "^2.1.1", + "tap": "^16.3.2" + }, + "files": [ + "bin/", + "lib/" + ], + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.11.3" + } +} diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index 7767513409985..ae4e871690eaa 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "15.0.7", + "version": "15.0.8", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { @@ -27,7 +27,7 @@ "devDependencies": { "@npmcli/arborist": "^6.0.0 || ^6.0.0-pre.0", "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.10.0", + "@npmcli/template-oss": "4.11.0", "hosted-git-info": "^6.0.0", "mutate-fs": "^2.1.1", "nock": "^13.2.4", @@ -49,7 +49,7 @@ "@npmcli/promise-spawn": "^6.0.1", "@npmcli/run-script": "^6.0.0", "cacache": "^17.0.0", - "fs-minipass": "^2.1.0", + "fs-minipass": "^3.0.0", "minipass": "^4.0.0", "npm-package-arg": "^10.0.0", "npm-packlist": "^7.0.0", @@ -71,7 +71,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.10.0", + "version": "4.11.0", "windowsCI": false } } diff --git a/package-lock.json b/package-lock.json index 11d78d934de9f..97bd0ef824ba7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,7 +135,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "^7.0.1", "p-map": "^4.0.0", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "parse-conflict-json": "^3.0.0", "proc-log": "^3.0.0", "qrcode-terminal": "^0.12.0", @@ -212,7 +212,7 @@ "@npmcli/template-oss": "4.11.3", "nock": "^13.2.9", "npm-package-arg": "^10.1.0", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "tap": "^16.3.2" }, "engines": { @@ -9478,9 +9478,9 @@ } }, "node_modules/pacote": { - "version": "15.0.7", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.0.7.tgz", - "integrity": "sha512-OFf4dl3SM1PpsZvi1zk4vvMA0EplnyO0Ajbrtoyx6E3dXOWBoPnMapnLgQdInEfqPkNT8mrd2bY6c5t8JZ69sQ==", + "version": "15.0.8", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.0.8.tgz", + "integrity": "sha512-UlcumB/XS6xyyIMwg/WwMAyUmga+RivB5KgkRwA1hZNtrx+0Bt41KxHCvg1kr0pZ/ZeD8qjhW4fph6VaYRCbLw==", "inBundle": true, "dependencies": { "@npmcli/git": "^4.0.0", @@ -9488,7 +9488,7 @@ "@npmcli/promise-spawn": "^6.0.1", "@npmcli/run-script": "^6.0.0", "cacache": "^17.0.0", - "fs-minipass": "^2.1.0", + "fs-minipass": "^3.0.0", "minipass": "^4.0.0", "npm-package-arg": "^10.0.0", "npm-packlist": "^7.0.0", @@ -9508,6 +9508,18 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/pacote/node_modules/fs-minipass": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.1.tgz", + "integrity": "sha512-MhaJDcFRTuLidHrIttu0RDGyyXs/IYHVmlcxfLAEFIWjc1vdLAkdwT7Ace2u7DbitWC0toKMl5eJZRYNVreIMw==", + "inBundle": true, + "dependencies": { + "minipass": "^4.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -14414,7 +14426,7 @@ "npm-pick-manifest": "^8.0.1", "npm-registry-fetch": "^14.0.3", "npmlog": "^7.0.1", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "parse-conflict-json": "^3.0.0", "proc-log": "^3.0.0", "promise-all-reject-late": "^1.0.0", @@ -14494,7 +14506,7 @@ "diff": "^5.1.0", "minimatch": "^5.1.1", "npm-package-arg": "^10.1.0", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "tar": "^6.1.13" }, "devDependencies": { @@ -14516,7 +14528,7 @@ "ci-info": "^3.7.0", "npm-package-arg": "^10.1.0", "npmlog": "^7.0.1", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "proc-log": "^3.0.0", "read": "^1.0.7", "read-package-json-fast": "^3.0.1", @@ -14595,7 +14607,7 @@ "@npmcli/arborist": "^6.2.0", "@npmcli/run-script": "^6.0.0", "npm-package-arg": "^10.1.0", - "pacote": "^15.0.7" + "pacote": "^15.0.8" }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", diff --git a/package.json b/package.json index 1953dab2d1dbf..bca9126fc6468 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "^7.0.1", "p-map": "^4.0.0", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "parse-conflict-json": "^3.0.0", "proc-log": "^3.0.0", "qrcode-terminal": "^0.12.0", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 72ba4af4262ef..b6a040213be42 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -26,7 +26,7 @@ "npm-pick-manifest": "^8.0.1", "npm-registry-fetch": "^14.0.3", "npmlog": "^7.0.1", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "parse-conflict-json": "^3.0.0", "proc-log": "^3.0.0", "promise-all-reject-late": "^1.0.0", diff --git a/workspaces/libnpmdiff/package.json b/workspaces/libnpmdiff/package.json index 5c8202998c326..79d15b405c51e 100644 --- a/workspaces/libnpmdiff/package.json +++ b/workspaces/libnpmdiff/package.json @@ -54,7 +54,7 @@ "diff": "^5.1.0", "minimatch": "^5.1.1", "npm-package-arg": "^10.1.0", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "tar": "^6.1.13" }, "templateOSS": { diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json index c6ed4c7337d1b..a488c2488ae0c 100644 --- a/workspaces/libnpmexec/package.json +++ b/workspaces/libnpmexec/package.json @@ -67,7 +67,7 @@ "ci-info": "^3.7.0", "npm-package-arg": "^10.1.0", "npmlog": "^7.0.1", - "pacote": "^15.0.7", + "pacote": "^15.0.8", "proc-log": "^3.0.0", "read": "^1.0.7", "read-package-json-fast": "^3.0.1", diff --git a/workspaces/libnpmpack/package.json b/workspaces/libnpmpack/package.json index 63c683dbd1726..ed3165d2e6848 100644 --- a/workspaces/libnpmpack/package.json +++ b/workspaces/libnpmpack/package.json @@ -39,7 +39,7 @@ "@npmcli/arborist": "^6.2.0", "@npmcli/run-script": "^6.0.0", "npm-package-arg": "^10.1.0", - "pacote": "^15.0.7" + "pacote": "^15.0.8" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0"