diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-11-28 06:36:42 +0300 |
---|---|---|
committer | Kat Marchán <kzm@sykosomatic.org> | 2017-11-28 06:36:54 +0300 |
commit | 7ae3c4c683faeb33a3d6459bb84456c813b93937 (patch) | |
tree | 33d6f099dbb4af733228d5a59514a94950349100 /node_modules/tar | |
parent | 14f3be4925eee1f66ee1465c8d198ebf33d14ad3 (diff) |
Revert tar@4.1.0
Diffstat (limited to 'node_modules/tar')
-rw-r--r-- | node_modules/tar/README.md | 31 | ||||
-rw-r--r-- | node_modules/tar/lib/create.js | 23 | ||||
-rw-r--r-- | node_modules/tar/lib/extract.js | 45 | ||||
-rw-r--r-- | node_modules/tar/lib/list.js | 12 | ||||
-rw-r--r-- | node_modules/tar/lib/pack.js | 12 | ||||
-rw-r--r-- | node_modules/tar/lib/replace.js | 40 | ||||
-rw-r--r-- | node_modules/tar/lib/unpack.js | 134 | ||||
-rw-r--r-- | node_modules/tar/lib/write-entry.js | 44 | ||||
-rw-r--r-- | node_modules/tar/node_modules/fs-minipass/LICENSE | 15 | ||||
-rw-r--r-- | node_modules/tar/node_modules/fs-minipass/README.md | 70 | ||||
-rw-r--r-- | node_modules/tar/node_modules/fs-minipass/index.js | 383 | ||||
-rw-r--r-- | node_modules/tar/node_modules/fs-minipass/package.json | 62 | ||||
-rw-r--r-- | node_modules/tar/package.json | 29 |
13 files changed, 158 insertions, 742 deletions
diff --git a/node_modules/tar/README.md b/node_modules/tar/README.md index 62916d713..a356a78da 100644 --- a/node_modules/tar/README.md +++ b/node_modules/tar/README.md @@ -226,10 +226,6 @@ The following options are supported: - `noPax` Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly. -- `noMtime` Set to true to omit writing `mtime` values for entries. - Note that this prevents using other mtime-based features like - `tar.update` or the `keepNewer` option with the resulting tar archive. - [Alias: `m`, `no-mtime`] The following options are mostly internal, but can be modified in some advanced use cases, such as re-using caches between runs. @@ -314,8 +310,6 @@ The following options are supported: specified group id, regardless of the `gid` field in the archive. Cannot be used along with `preserveOwner`. Requires also setting a `uid` option. -- `noMtime` Set to true to omit writing `mtime` value for extracted - entries. [Alias: `m`, `no-mtime`] The following options are mostly internal, but can be modified in some advanced use cases, such as re-using caches between runs. @@ -411,10 +405,6 @@ The following options are supported: - `noPax` Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly. -- `noMtime` Set to true to omit writing `mtime` values for entries. - Note that this prevents using other mtime-based features like - `tar.update` or the `keepNewer` option with the resulting tar archive. - [Alias: `m`, `no-mtime`] ### tar.r(options, fileList, callback) [alias: tar.replace] @@ -460,11 +450,6 @@ The following options are supported: - `noPax` Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly. -- `noMtime` Set to true to omit writing `mtime` values for entries. - Note that this prevents using other mtime-based features like - `tar.update` or the `keepNewer` option with the resulting tar archive. - [Alias: `m`, `no-mtime`] - ## Low-Level API @@ -511,10 +496,6 @@ The following options are supported: - `noPax` Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly. -- `noMtime` Set to true to omit writing `mtime` values for entries. - Note that this prevents using other mtime-based features like - `tar.update` or the `keepNewer` option with the resulting tar archive. - #### add(path) @@ -602,8 +583,6 @@ Most unpack errors will cause a `warn` event to be emitted. If the specified group id, regardless of the `gid` field in the archive. Cannot be used along with `preserveOwner`. Requires also setting a `uid` option. -- `noMtime` Set to true to omit writing `mtime` value for extracted - entries. ### class tar.Unpack.Sync @@ -714,10 +693,6 @@ It has the following fields: - `noPax` Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly. -- `noMtime` Set to true to omit writing `mtime` values for entries. - Note that this prevents using other mtime-based features like - `tar.update` or the `keepNewer` option with the resulting tar archive. - #### constructor(path, options) @@ -746,9 +721,6 @@ The following options are supported: replace `\` with `/`. - `onwarn` A function that will get called with `(message, data)` for any warnings encountered. -- `noMtime` Set to true to omit writing `mtime` values for entries. - Note that this prevents using other mtime-based features like - `tar.update` or the `keepNewer` option with the resulting tar archive. #### warn(message, data) @@ -780,9 +752,6 @@ The following options are supported: - `strict` Treat warnings as crash-worthy errors. Default false. - `onwarn` A function that will get called with `(message, data)` for any warnings encountered. -- `noMtime` Set to true to omit writing `mtime` values for entries. - Note that this prevents using other mtime-based features like - `tar.update` or the `keepNewer` option with the resulting tar archive. ### class tar.Header diff --git a/node_modules/tar/lib/create.js b/node_modules/tar/lib/create.js index a37aa52e6..5d46b3ba7 100644 --- a/node_modules/tar/lib/create.js +++ b/node_modules/tar/lib/create.js @@ -5,7 +5,6 @@ const hlo = require('./high-level-opt.js') const Pack = require('./pack.js') const fs = require('fs') -const fsm = require('fs-minipass') const t = require('./list.js') const path = require('path') @@ -37,18 +36,24 @@ const c = module.exports = (opt_, files, cb) => { const createFileSync = (opt, files) => { const p = new Pack.Sync(opt) - const stream = new fsm.WriteStreamSync(opt.file, { - mode: opt.mode || 0o666 - }) - p.pipe(stream) - addFilesSync(p, files) + + let threw = true + let fd + try { + fd = fs.openSync(opt.file, 'w', opt.mode || 0o666) + p.on('data', chunk => fs.writeSync(fd, chunk, 0, chunk.length)) + p.on('end', _ => fs.closeSync(fd)) + addFilesSync(p, files) + threw = false + } finally { + if (threw) + try { fs.closeSync(fd) } catch (er) {} + } } const createFile = (opt, files, cb) => { const p = new Pack(opt) - const stream = new fsm.WriteStream(opt.file, { - mode: opt.mode || 0o666 - }) + const stream = fs.createWriteStream(opt.file, { mode: opt.mode || 0o666 }) p.pipe(stream) const promise = new Promise((res, rej) => { diff --git a/node_modules/tar/lib/extract.js b/node_modules/tar/lib/extract.js index cbb458a0a..53ecf6789 100644 --- a/node_modules/tar/lib/extract.js +++ b/node_modules/tar/lib/extract.js @@ -4,7 +4,6 @@ const hlo = require('./high-level-opt.js') const Unpack = require('./unpack.js') const fs = require('fs') -const fsm = require('fs-minipass') const path = require('path') const x = module.exports = (opt_, files, cb) => { @@ -65,15 +64,28 @@ const extractFileSync = opt => { const file = opt.file let threw = true let fd - const stat = fs.statSync(file) - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation - const readSize = opt.maxReadSize || 16*1024*1024 - const stream = new fsm.ReadStreamSync(file, { - readSize: readSize, - size: stat.size - }) - stream.pipe(u) + try { + const stat = fs.statSync(file) + const readSize = opt.maxReadSize || 16*1024*1024 + if (stat.size < readSize) + u.end(fs.readFileSync(file)) + else { + let pos = 0 + const buf = Buffer.allocUnsafe(readSize) + fd = fs.openSync(file, 'r') + while (pos < stat.size) { + let bytesRead = fs.readSync(fd, buf, 0, readSize, pos) + pos += bytesRead + u.write(buf.slice(0, bytesRead)) + } + u.end() + fs.closeSync(fd) + } + threw = false + } finally { + if (threw && fd) + try { fs.closeSync(fd) } catch (er) {} + } } const extractFile = (opt, cb) => { @@ -85,15 +97,18 @@ const extractFile = (opt, cb) => { u.on('error', reject) u.on('close', resolve) - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation fs.stat(file, (er, stat) => { if (er) reject(er) + else if (stat.size < readSize) + fs.readFile(file, (er, data) => { + if (er) + return reject(er) + u.end(data) + }) else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size + const stream = fs.createReadStream(file, { + highWaterMark: readSize }) stream.on('error', reject) stream.pipe(u) diff --git a/node_modules/tar/lib/list.js b/node_modules/tar/lib/list.js index 9da3f812c..1f5e70bd3 100644 --- a/node_modules/tar/lib/list.js +++ b/node_modules/tar/lib/list.js @@ -7,7 +7,6 @@ const hlo = require('./high-level-opt.js') const Parser = require('./parse.js') const fs = require('fs') -const fsm = require('fs-minipass') const path = require('path') const t = module.exports = (opt_, files, cb) => { @@ -112,10 +111,15 @@ const listFile = (opt, cb) => { fs.stat(file, (er, stat) => { if (er) reject(er) + else if (stat.size < readSize) + fs.readFile(file, (er, data) => { + if (er) + return reject(er) + parse.end(data) + }) else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size + const stream = fs.createReadStream(file, { + highWaterMark: readSize }) stream.on('error', reject) stream.pipe(parse) diff --git a/node_modules/tar/lib/pack.js b/node_modules/tar/lib/pack.js index ef6ea81a1..09b6ac590 100644 --- a/node_modules/tar/lib/pack.js +++ b/node_modules/tar/lib/pack.js @@ -88,7 +88,6 @@ const Pack = warner(class Pack extends MiniPass { this.portable = !!opt.portable this.noDirRecurse = !!opt.noDirRecurse this.follow = !!opt.follow - this.noMtime = !!opt.noMtime this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true @@ -292,17 +291,17 @@ const Pack = warner(class Pack extends MiniPass { strict: this.strict, portable: this.portable, linkCache: this.linkCache, - statCache: this.statCache, - noMtime: this.noMtime + statCache: this.statCache } } [ENTRY] (job) { this[JOBS] += 1 try { - return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)) - .on('end', () => this[JOBDONE](job)) - .on('error', er => this.emit('error', er)) + return new this[WRITEENTRYCLASS]( + job.path, this[ENTRYOPT](job)).on('end', _ => { + this[JOBDONE](job) + }).on('error', er => this.emit('error', er)) } catch (er) { this.emit('error', er) } @@ -379,6 +378,7 @@ class PackSync extends Pack { job.path.slice(this.prefix.length + 1) || './' : job.path + const base = p === './' ? '' : p.replace(/\/*$/, '/') this[ADDFSENTRY](base + entry) }) diff --git a/node_modules/tar/lib/replace.js b/node_modules/tar/lib/replace.js index 44126d1f8..aac6b57fa 100644 --- a/node_modules/tar/lib/replace.js +++ b/node_modules/tar/lib/replace.js @@ -5,7 +5,6 @@ const hlo = require('./high-level-opt.js') const Pack = require('./pack.js') const Parse = require('./parse.js') const fs = require('fs') -const fsm = require('fs-minipass') const t = require('./list.js') const path = require('path') @@ -40,8 +39,6 @@ const replaceSync = (opt, files) => { let threw = true let fd - let position - try { try { fd = fs.openSync(opt.file, 'r+') @@ -54,6 +51,7 @@ const replaceSync = (opt, files) => { const st = fs.fstatSync(fd) const headBuf = Buffer.alloc(512) + let position POSITION: for (position = 0; position < st.size; position += 512) { for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { @@ -80,24 +78,21 @@ const replaceSync = (opt, files) => { if (opt.mtimeCache) opt.mtimeCache.set(h.path, h.mtime) } - threw = false - streamSync(opt, p, position, fd, files) + p.on('data', c => { + fs.writeSync(fd, c, 0, c.length, position) + position += c.length + }) + p.on('end', _ => fs.closeSync(fd)) + + addFilesSync(p, files) + threw = false } finally { if (threw) try { fs.closeSync(fd) } catch (er) {} } } -const streamSync = (opt, p, position, fd, files) => { - const stream = new fsm.WriteStreamSync(opt.file, { - fd: fd, - start: position - }) - p.pipe(stream) - addFilesSync(p, files) -} - const replace = (opt, files, cb) => { files = Array.from(files) const p = new Pack(opt) @@ -155,24 +150,21 @@ const replace = (opt, files, cb) => { const promise = new Promise((resolve, reject) => { p.on('error', reject) - let flag = 'r+' const onopen = (er, fd) => { - if (er && er.code === 'ENOENT' && flag === 'r+') { - flag = 'w+' - return fs.open(opt.file, flag, onopen) - } - - if (er) + if (er) { + if (er.code === 'ENOENT') + return fs.open(opt.file, 'w+', onopen) return reject(er) - + } fs.fstat(fd, (er, st) => { if (er) return reject(er) getPos(fd, st.size, (er, position) => { if (er) return reject(er) - const stream = new fsm.WriteStream(opt.file, { + const stream = fs.createWriteStream(opt.file, { fd: fd, + flags: 'r+', start: position }) p.pipe(stream) @@ -182,7 +174,7 @@ const replace = (opt, files, cb) => { }) }) } - fs.open(opt.file, flag, onopen) + fs.open(opt.file, 'r+', onopen) }) return cb ? promise.then(cb, cb) : promise diff --git a/node_modules/tar/lib/unpack.js b/node_modules/tar/lib/unpack.js index fcc765313..e8c80c6fd 100644 --- a/node_modules/tar/lib/unpack.js +++ b/node_modules/tar/lib/unpack.js @@ -4,7 +4,6 @@ const assert = require('assert') const EE = require('events').EventEmitter const Parser = require('./parse.js') const fs = require('fs') -const fsm = require('fs-minipass') const path = require('path') const mkdir = require('./mkdir.js') const mkdirSync = mkdir.sync @@ -33,12 +32,6 @@ const DOCHOWN = Symbol('doChown') const UID = Symbol('uid') const GID = Symbol('gid') -// this.gid, entry.gid, this.processUid -const uint32 = (a, b, c) => - a === a >>> 0 ? a - : b === b >>> 0 ? b - : c - class Unpack extends Parser { constructor (opt) { if (!opt) @@ -231,46 +224,40 @@ class Unpack extends Parser { } [UID] (entry) { - return uint32(this.uid, entry.uid, this.processUid) + return typeof this.uid === 'number' ? this.uid + : typeof entry.uid === 'number' ? entry.uid + : this.processUid } [GID] (entry) { - return uint32(this.gid, entry.gid, this.processGid) + return typeof this.gid === 'number' ? this.gid + : typeof entry.gid === 'number' ? entry.gid + : this.processGid } [FILE] (entry) { const mode = entry.mode & 0o7777 || this.fmode - const stream = new fsm.WriteStream(entry.absolute, { - mode: mode, - autoClose: false - }) + const stream = fs.createWriteStream(entry.absolute, { mode: mode }) stream.on('error', er => this[ONERROR](er, entry)) - let actions = 1 - const done = er => { - if (er) { - this[ONERROR](er, entry) - actions = 1 - } - - if (--actions === 0) - fs.close(stream.fd, _ => this[UNPEND]()) + const queue = [] + const processQueue = _ => { + const action = queue.shift() + if (action) + action(processQueue) + else + this[UNPEND]() } - stream.on('finish', _ => { - if (entry.mtime && !this.noMtime) { - actions++ - fs.futimes(stream.fd, entry.atime || new Date(), entry.mtime, done) - } - - if (this[DOCHOWN](entry)) { - actions++ - fs.fchown(stream.fd, this[UID](entry), this[GID](entry), done) - } - - done() + stream.on('close', _ => { + if (entry.mtime && !this.noMtime) + queue.push(cb => + fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, cb)) + if (this[DOCHOWN](entry)) + queue.push(cb => + fs.chown(entry.absolute, this[UID](entry), this[GID](entry), cb)) + processQueue() }) - entry.pipe(stream) } @@ -280,25 +267,25 @@ class Unpack extends Parser { if (er) return this[ONERROR](er, entry) - let actions = 1 - const done = _ => { - if (--actions === 0) { + const queue = [] + const processQueue = _ => { + const action = queue.shift() + if (action) + action(processQueue) + else { this[UNPEND]() entry.resume() } } - if (entry.mtime && !this.noMtime) { - actions++ - fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, done) - } - - if (this[DOCHOWN](entry)) { - actions++ - fs.chown(entry.absolute, this[UID](entry), this[GID](entry), done) - } + if (entry.mtime && !this.noMtime) + queue.push(cb => + fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, cb)) + if (this[DOCHOWN](entry)) + queue.push(cb => + fs.chown(entry.absolute, this[UID](entry), this[GID](entry), cb)) - done() + processQueue() }) } @@ -424,42 +411,23 @@ class UnpackSync extends Unpack { [FILE] (entry) { const mode = entry.mode & 0o7777 || this.fmode - - const oner = er => { - try { fs.closeSync(fd) } catch (_) {} - this[ONERROR](er, entry) - } - - let stream - let fd try { - fd = fs.openSync(entry.absolute, 'w', mode) - } catch (er) { - return oner(er) - } - - entry.on('data', chunk => { - try { - fs.writeSync(fd, chunk, 0, chunk.length) - } catch (er) { - oner(er) - } - }) - - entry.on('end', _ => { - try { - if (entry.mtime && !this.noMtime) - fs.futimesSync(fd, entry.atime || new Date(), entry.mtime) - - if (this[DOCHOWN](entry)) - fs.fchownSync(fd, this[UID](entry), this[GID](entry)) - - fs.closeSync(fd) - } catch (er) { - return oner(er) - } - }) - + const fd = fs.openSync(entry.absolute, 'w', mode) + entry.on('data', buf => fs.writeSync(fd, buf, 0, buf.length, null)) + entry.on('end', _ => { + if (entry.mtime && !this.noMtime) { + try { + fs.futimesSync(fd, entry.atime || new Date(), entry.mtime) + } catch (er) {} + } + if (this[DOCHOWN](entry)) { + try { + fs.fchownSync(fd, this[UID](entry), this[GID](entry)) + } catch (er) {} + } + try { fs.closeSync(fd) } catch (er) { this[ONERROR](er, entry) } + }) + } catch (er) { this[ONERROR](er, entry) } } [DIRECTORY] (entry) { diff --git a/node_modules/tar/lib/write-entry.js b/node_modules/tar/lib/write-entry.js index ad6d36caf..f562bf138 100644 --- a/node_modules/tar/lib/write-entry.js +++ b/node_modules/tar/lib/write-entry.js @@ -44,8 +44,6 @@ const WriteEntry = warner(class WriteEntry extends MiniPass { this.cwd = opt.cwd || process.cwd() this.strict = !!opt.strict this.noPax = !!opt.noPax - this.noMtime = !!opt.noMtime - if (typeof opt.onwarn === 'function') this.on('warn', opt.onwarn) @@ -103,9 +101,6 @@ const WriteEntry = warner(class WriteEntry extends MiniPass { } [HEADER] () { - if (this.type === 'Directory' && this.portable) - this.noMtime = true - this.header = new Header({ path: this.path, linkpath: this.linkpath, @@ -115,7 +110,8 @@ const WriteEntry = warner(class WriteEntry extends MiniPass { uid: this.portable ? null : this.stat.uid, gid: this.portable ? null : this.stat.gid, size: this.stat.size, - mtime: this.noMtime ? null : this.stat.mtime, + mtime: this.type === 'Directory' && this.portable + ? null : this.stat.mtime, type: this.type, uname: this.portable ? null : this.stat.uid === this.myuid ? this.myuser : '', @@ -128,7 +124,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass { atime: this.portable ? null : this.header.atime, ctime: this.portable ? null : this.header.ctime, gid: this.portable ? null : this.header.gid, - mtime: this.noMtime ? null : this.header.mtime, + mtime: this.header.mtime, path: this.path, linkpath: this.linkpath, size: this.header.size, @@ -298,30 +294,28 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass { constructor (readEntry, opt) { opt = opt || {} super(opt) - this.preservePaths = !!opt.preservePaths - this.portable = !!opt.portable - this.strict = !!opt.strict - this.noPax = !!opt.noPax - this.noMtime = !!opt.noMtime - this.readEntry = readEntry this.type = readEntry.type - if (this.type === 'Directory' && this.portable) - this.noMtime = true - this.path = readEntry.path this.mode = readEntry.mode if (this.mode) this.mode = this.mode & 0o7777 - this.uid = this.portable ? null : readEntry.uid - this.gid = this.portable ? null : readEntry.gid - this.uname = this.portable ? null : readEntry.uname - this.gname = this.portable ? null : readEntry.gname + this.uid = readEntry.uid + this.gid = readEntry.gid + this.uname = readEntry.uname + this.gname = readEntry.gname this.size = readEntry.size - this.mtime = this.noMtime ? null : readEntry.mtime - this.atime = this.portable ? null : readEntry.atime - this.ctime = this.portable ? null : readEntry.ctime + this.mtime = readEntry.mtime + this.atime = readEntry.atime + this.ctime = readEntry.ctime this.linkpath = readEntry.linkpath + this.uname = readEntry.uname + this.gname = readEntry.gname + + this.preservePaths = !!opt.preservePaths + this.portable = !!opt.portable + this.strict = !!opt.strict + this.noPax = !!opt.noPax if (typeof opt.onwarn === 'function') this.on('warn', opt.onwarn) @@ -347,7 +341,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass { uid: this.portable ? null : this.uid, gid: this.portable ? null : this.gid, size: this.size, - mtime: this.noMtime ? null : this.mtime, + mtime: this.mtime, type: this.type, uname: this.portable ? null : this.uname, atime: this.portable ? null : this.atime, @@ -359,7 +353,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass { atime: this.portable ? null : this.atime, ctime: this.portable ? null : this.ctime, gid: this.portable ? null : this.gid, - mtime: this.noMtime ? null : this.mtime, + mtime: this.mtime, path: this.path, linkpath: this.linkpath, size: this.size, diff --git a/node_modules/tar/node_modules/fs-minipass/LICENSE b/node_modules/tar/node_modules/fs-minipass/LICENSE deleted file mode 100644 index 19129e315..000000000 --- a/node_modules/tar/node_modules/fs-minipass/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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/tar/node_modules/fs-minipass/README.md b/node_modules/tar/node_modules/fs-minipass/README.md deleted file mode 100644 index 1e61241cf..000000000 --- a/node_modules/tar/node_modules/fs-minipass/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# fs-minipass - -Filesystem streams based on [minipass](http://npm.im/minipass). - -4 classes are exported: - -- ReadStream -- ReadStreamSync -- WriteStream -- WriteStreamSync - -When using `ReadStreamSync`, all of the data is made available -immediately upon consuming the stream. Nothing is buffered in memory -when the stream is constructed. If the stream is piped to a writer, -then it will synchronously `read()` and emit data into the writer as -fast as the writer can consume it. (That is, it will respect -backpressure.) If you call `stream.read()` then it will read the -entire file and return the contents. - -When using `WriteStreamSync`, every write is flushed to the file -synchronously. If your writes all come in a single tick, then it'll -write it all out in a single tick. It's as synchronous as you are. - -The async versions work much like their node builtin counterparts, -with the exception of introducing significantly less Stream machinery -overhead. - -## USAGE - -It's just streams, you pipe them or read() them or write() to them. - -```js -const fsm = require('fs-minipass') -const readStream = new fsm.ReadStream('file.txt') -const writeStream = new fsm.WriteStream('output.txt') -writeStream.write('some file header or whatever\n') -readStream.pipe(writeStream) -``` - -## ReadStream(path, options) - -Path string is required, but somewhat irrelevant if an open file -descriptor is passed in as an option. - -Options: - -- `fd` Pass in a numeric file descriptor, if the file is already open. -- `readSize` The size of reads to do, defaults to 16MB -- `size` The size of the file, if known. Prevents zero-byte read() - call at the end. -- `autoClose` Set to `false` to prevent the file descriptor from being - closed when the file is done being read. - -## WriteStream(path, options) - -Path string is required, but somewhat irrelevant if an open file -descriptor is passed in as an option. - -Options: - -- `fd` Pass in a numeric file descriptor, if the file is already open. -- `mode` The mode to create the file with. Defaults to `0o666`. -- `start` The position in the file to start reading. If not - specified, then the file will start writing at position zero, and be - truncated by default. -- `autoClose` Set to `false` to prevent the file descriptor from being - closed when the stream is ended. -- `flags` Flags to use when opening the file. Irrelevant if `fd` is - passed in, since file won't be opened in that case. Defaults to - `'a'` if a `pos` is specified, or `'w'` otherwise. diff --git a/node_modules/tar/node_modules/fs-minipass/index.js b/node_modules/tar/node_modules/fs-minipass/index.js deleted file mode 100644 index 07f0f513c..000000000 --- a/node_modules/tar/node_modules/fs-minipass/index.js +++ /dev/null @@ -1,383 +0,0 @@ -'use strict' -const MiniPass = require('minipass') -const EE = require('events').EventEmitter -const fs = require('fs') - -// for writev -const binding = process.binding('fs') -const writeBuffers = binding.writeBuffers -const FSReqWrap = binding.FSReqWrap - -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') - -class ReadStream extends MiniPass { - constructor (path, opt) { - opt = opt || {} - super(opt) - - this.writable = false - - if (typeof path !== 'string') - throw new TypeError('path must be a string') - - 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]() - fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) => - this[_onread](er, br, buf)) - } - } - - [_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') { - fs.close(this[_fd], _ => this.emit('close')) - this[_fd] = null - } - } - - [_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 - - 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]() - const br = 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') { - try { - fs.closeSync(this[_fd]) - } catch (er) {} - this[_fd] = null - this.emit('close') - } - } -} - -class WriteStream extends EE { - constructor (path, opt) { - opt = opt || {} - super(opt) - this.readable = 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]() - } - - 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) - 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) - } - - write (buf, enc) { - if (typeof buf === 'string') - buf = new Buffer(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') { - fs.close(this[_fd], _ => this.emit('close')) - this[_fd] = null - } - } -} - -class WriteStreamSync extends WriteStream { - [_open] () { - let fd - try { - fd = fs.openSync(this[_path], this[_flags], this[_mode]) - } catch (er) { - if (this[_defaultFlag] && - this[_flags] === 'r+' && - er && er.code === 'ENOENT') { - this[_flags] = 'w' - return this[_open]() - } else - throw er - } - this[_onopen](null, fd) - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - try { - fs.closeSync(this[_fd]) - } catch (er) {} - this[_fd] = null - this.emit('close') - } - } - - [_write] (buf) { - try { - this[_onwrite](null, - fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])) - } catch (er) { - this[_onwrite](er, 0) - } - } -} - -const writev = (fd, iovec, pos, cb) => { - const done = (er, bw) => cb(er, bw, iovec) - const req = new FSReqWrap() - req.oncomplete = done - binding.writeBuffers(fd, iovec, pos, req) -} - -exports.ReadStream = ReadStream -exports.ReadStreamSync = ReadStreamSync - -exports.WriteStream = WriteStream -exports.WriteStreamSync = WriteStreamSync diff --git a/node_modules/tar/node_modules/fs-minipass/package.json b/node_modules/tar/node_modules/fs-minipass/package.json deleted file mode 100644 index 172af3b20..000000000 --- a/node_modules/tar/node_modules/fs-minipass/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "fs-minipass@^1.2.3", - "_id": "fs-minipass@1.2.3", - "_inBundle": false, - "_integrity": "sha512-u1pHCXDx+CElfM6CuIeHDTKvb1Ya9ZhsMk7xTHTh6zHSRLK6O0DTVBN+E3wg8fruxAFp4oE07owrrzQfDA0b5Q==", - "_location": "/tar/fs-minipass", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "fs-minipass@^1.2.3", - "name": "fs-minipass", - "escapedName": "fs-minipass", - "rawSpec": "^1.2.3", - "saveSpec": null, - "fetchSpec": "^1.2.3" - }, - "_requiredBy": [ - "/tar" - ], - "_resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.3.tgz", - "_shasum": "633ee214389dede91c4ec446a34891f964805973", - "_spec": "fs-minipass@^1.2.3", - "_where": "/Users/zkat/Documents/code/npm/node_modules/tar", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/npm/fs-minipass/issues" - }, - "bundleDependencies": false, - "dependencies": { - "minipass": "^2.2.1" - }, - "deprecated": false, - "description": "fs read and write streams based on minipass", - "devDependencies": { - "mutate-fs": "^2.0.1", - "tap": "^10.7.2" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/npm/fs-minipass#readme", - "keywords": [], - "license": "ISC", - "main": "index.js", - "name": "fs-minipass", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/fs-minipass.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100 -J" - }, - "version": "1.2.3" -} diff --git a/node_modules/tar/package.json b/node_modules/tar/package.json index e267cb273..d68b63a66 100644 --- a/node_modules/tar/package.json +++ b/node_modules/tar/package.json @@ -1,28 +1,28 @@ { - "_from": "tar@latest", - "_id": "tar@4.1.0", + "_from": "tar@4.0.2", + "_id": "tar@4.0.2", "_inBundle": false, - "_integrity": "sha512-xQoupzP/LFDSz3llXIS86u6PHAqzc+AUVJLLcaKg898rQ8c71cmklu0G05NQpIKqh8XNF+Pv+EptKySI7rseNw==", + "_integrity": "sha512-4lWN4uAEWzw8aHyBUx9HWXvH3vIFEhOyvN22HfBzWpE07HaTBXM8ttSeCQpswRo5On4q3nmmYmk7Tomn0uhUaw==", "_location": "/tar", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "tar@latest", + "raw": "tar@4.0.2", "name": "tar", "escapedName": "tar", - "rawSpec": "latest", + "rawSpec": "4.0.2", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "4.0.2" }, "_requiredBy": [ "#USER", "/", "/pacote" ], - "_resolved": "https://registry.npmjs.org/tar/-/tar-4.1.0.tgz", - "_shasum": "3344ed174eb2c6c3749cc1bbee391395962256d9", - "_spec": "tar@latest", + "_resolved": "https://registry.npmjs.org/tar/-/tar-4.0.2.tgz", + "_shasum": "e8e22bf3eec330e5c616d415a698395e294e8fad", + "_spec": "tar@4.0.2", "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Isaac Z. Schlueter", @@ -35,7 +35,6 @@ "bundleDependencies": false, "dependencies": { "chownr": "^1.0.1", - "fs-minipass": "^1.2.3", "minipass": "^2.2.1", "minizlib": "^1.0.4", "mkdirp": "^0.5.0", @@ -47,9 +46,9 @@ "chmodr": "^1.0.2", "end-of-stream": "^1.4.0", "events-to-array": "^1.1.2", - "mutate-fs": "^2.1.1", + "mutate-fs": "^1.1.0", "rimraf": "^2.6.2", - "tap": "^11.0.0-rc.3", + "tap": "^10.7.2", "tar-fs": "^1.16.0", "tar-stream": "^1.5.2" }, @@ -73,7 +72,7 @@ "postpublish": "git push origin --all; git push origin --tags", "postversion": "npm publish", "preversion": "npm test", - "test": "tap test/*.js --100 -J --coverage-report=text -c" + "test": "tap test/*.js --100 -J --coverage-report=text" }, - "version": "4.1.0" + "version": "4.0.2" } |