Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-11-28 04:11:50 +0300
committerKat Marchán <kzm@sykosomatic.org>2017-11-28 04:12:05 +0300
commit39ba4aa7479220e61573c0c1977124c2199f49d0 (patch)
tree69c3303351a37e7fb93a6c03d610725dca562d34 /node_modules/tar
parent2906bc6efa498a7c3e86bd65dee7304e1e64290a (diff)
tar@4.1.0
Diffstat (limited to 'node_modules/tar')
-rw-r--r--node_modules/tar/README.md31
-rw-r--r--node_modules/tar/lib/create.js23
-rw-r--r--node_modules/tar/lib/extract.js45
-rw-r--r--node_modules/tar/lib/list.js12
-rw-r--r--node_modules/tar/lib/pack.js12
-rw-r--r--node_modules/tar/lib/replace.js40
-rw-r--r--node_modules/tar/lib/unpack.js134
-rw-r--r--node_modules/tar/lib/write-entry.js44
-rw-r--r--node_modules/tar/node_modules/fs-minipass/LICENSE15
-rw-r--r--node_modules/tar/node_modules/fs-minipass/README.md70
-rw-r--r--node_modules/tar/node_modules/fs-minipass/index.js383
-rw-r--r--node_modules/tar/node_modules/fs-minipass/package.json62
-rw-r--r--node_modules/tar/package.json32
13 files changed, 744 insertions, 159 deletions
diff --git a/node_modules/tar/README.md b/node_modules/tar/README.md
index a356a78da..62916d713 100644
--- a/node_modules/tar/README.md
+++ b/node_modules/tar/README.md
@@ -226,6 +226,10 @@ 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.
@@ -310,6 +314,8 @@ 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.
@@ -405,6 +411,10 @@ 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]
@@ -450,6 +460,11 @@ 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
@@ -496,6 +511,10 @@ 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)
@@ -583,6 +602,8 @@ 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
@@ -693,6 +714,10 @@ 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)
@@ -721,6 +746,9 @@ 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)
@@ -752,6 +780,9 @@ 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 5d46b3ba7..a37aa52e6 100644
--- a/node_modules/tar/lib/create.js
+++ b/node_modules/tar/lib/create.js
@@ -5,6 +5,7 @@ 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')
@@ -36,24 +37,18 @@ const c = module.exports = (opt_, files, cb) => {
const createFileSync = (opt, files) => {
const p = new Pack.Sync(opt)
-
- 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 stream = new fsm.WriteStreamSync(opt.file, {
+ mode: opt.mode || 0o666
+ })
+ p.pipe(stream)
+ addFilesSync(p, files)
}
const createFile = (opt, files, cb) => {
const p = new Pack(opt)
- const stream = fs.createWriteStream(opt.file, { mode: opt.mode || 0o666 })
+ const stream = new fsm.WriteStream(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 53ecf6789..cbb458a0a 100644
--- a/node_modules/tar/lib/extract.js
+++ b/node_modules/tar/lib/extract.js
@@ -4,6 +4,7 @@
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) => {
@@ -64,28 +65,15 @@ const extractFileSync = opt => {
const file = opt.file
let threw = true
let fd
- 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 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)
}
const extractFile = (opt, cb) => {
@@ -97,18 +85,15 @@ 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 = fs.createReadStream(file, {
- highWaterMark: readSize
+ const stream = new fsm.ReadStream(file, {
+ readSize: readSize,
+ size: stat.size
})
stream.on('error', reject)
stream.pipe(u)
diff --git a/node_modules/tar/lib/list.js b/node_modules/tar/lib/list.js
index 1f5e70bd3..9da3f812c 100644
--- a/node_modules/tar/lib/list.js
+++ b/node_modules/tar/lib/list.js
@@ -7,6 +7,7 @@
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) => {
@@ -111,15 +112,10 @@ 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 = fs.createReadStream(file, {
- highWaterMark: readSize
+ const stream = new fsm.ReadStream(file, {
+ readSize: readSize,
+ size: stat.size
})
stream.on('error', reject)
stream.pipe(parse)
diff --git a/node_modules/tar/lib/pack.js b/node_modules/tar/lib/pack.js
index 09b6ac590..ef6ea81a1 100644
--- a/node_modules/tar/lib/pack.js
+++ b/node_modules/tar/lib/pack.js
@@ -88,6 +88,7 @@ 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
@@ -291,17 +292,17 @@ const Pack = warner(class Pack extends MiniPass {
strict: this.strict,
portable: this.portable,
linkCache: this.linkCache,
- statCache: this.statCache
+ statCache: this.statCache,
+ noMtime: this.noMtime
}
}
[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)
}
@@ -378,7 +379,6 @@ 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 aac6b57fa..44126d1f8 100644
--- a/node_modules/tar/lib/replace.js
+++ b/node_modules/tar/lib/replace.js
@@ -5,6 +5,7 @@ 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')
@@ -39,6 +40,8 @@ const replaceSync = (opt, files) => {
let threw = true
let fd
+ let position
+
try {
try {
fd = fs.openSync(opt.file, 'r+')
@@ -51,7 +54,6 @@ 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) {
@@ -78,21 +80,24 @@ const replaceSync = (opt, files) => {
if (opt.mtimeCache)
opt.mtimeCache.set(h.path, h.mtime)
}
-
- 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
+
+ streamSync(opt, p, position, fd, files)
} 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)
@@ -150,21 +155,24 @@ const replace = (opt, files, cb) => {
const promise = new Promise((resolve, reject) => {
p.on('error', reject)
+ let flag = 'r+'
const onopen = (er, fd) => {
- if (er) {
- if (er.code === 'ENOENT')
- return fs.open(opt.file, 'w+', onopen)
- return reject(er)
+ if (er && er.code === 'ENOENT' && flag === 'r+') {
+ flag = 'w+'
+ return fs.open(opt.file, flag, onopen)
}
+
+ if (er)
+ 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 = fs.createWriteStream(opt.file, {
+ const stream = new fsm.WriteStream(opt.file, {
fd: fd,
- flags: 'r+',
start: position
})
p.pipe(stream)
@@ -174,7 +182,7 @@ const replace = (opt, files, cb) => {
})
})
}
- fs.open(opt.file, 'r+', onopen)
+ fs.open(opt.file, flag, 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 e8c80c6fd..fcc765313 100644
--- a/node_modules/tar/lib/unpack.js
+++ b/node_modules/tar/lib/unpack.js
@@ -4,6 +4,7 @@ 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
@@ -32,6 +33,12 @@ 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)
@@ -224,40 +231,46 @@ class Unpack extends Parser {
}
[UID] (entry) {
- return typeof this.uid === 'number' ? this.uid
- : typeof entry.uid === 'number' ? entry.uid
- : this.processUid
+ return uint32(this.uid, entry.uid, this.processUid)
}
[GID] (entry) {
- return typeof this.gid === 'number' ? this.gid
- : typeof entry.gid === 'number' ? entry.gid
- : this.processGid
+ return uint32(this.gid, entry.gid, this.processGid)
}
[FILE] (entry) {
const mode = entry.mode & 0o7777 || this.fmode
- const stream = fs.createWriteStream(entry.absolute, { mode: mode })
+ const stream = new fsm.WriteStream(entry.absolute, {
+ mode: mode,
+ autoClose: false
+ })
stream.on('error', er => this[ONERROR](er, entry))
- const queue = []
- const processQueue = _ => {
- const action = queue.shift()
- if (action)
- action(processQueue)
- else
- this[UNPEND]()
+ let actions = 1
+ const done = er => {
+ if (er) {
+ this[ONERROR](er, entry)
+ actions = 1
+ }
+
+ if (--actions === 0)
+ fs.close(stream.fd, _ => this[UNPEND]())
}
- 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()
+ 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()
})
+
entry.pipe(stream)
}
@@ -267,25 +280,25 @@ class Unpack extends Parser {
if (er)
return this[ONERROR](er, entry)
- const queue = []
- const processQueue = _ => {
- const action = queue.shift()
- if (action)
- action(processQueue)
- else {
+ let actions = 1
+ const done = _ => {
+ if (--actions === 0) {
this[UNPEND]()
entry.resume()
}
}
- 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))
+ 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)
+ }
- processQueue()
+ done()
})
}
@@ -411,23 +424,42 @@ 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 {
- 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) }
+ 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)
+ }
+ })
+
}
[DIRECTORY] (entry) {
diff --git a/node_modules/tar/lib/write-entry.js b/node_modules/tar/lib/write-entry.js
index f562bf138..ad6d36caf 100644
--- a/node_modules/tar/lib/write-entry.js
+++ b/node_modules/tar/lib/write-entry.js
@@ -44,6 +44,8 @@ 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)
@@ -101,6 +103,9 @@ 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,
@@ -110,8 +115,7 @@ 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.type === 'Directory' && this.portable
- ? null : this.stat.mtime,
+ mtime: this.noMtime ? null : this.stat.mtime,
type: this.type,
uname: this.portable ? null :
this.stat.uid === this.myuid ? this.myuser : '',
@@ -124,7 +128,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.header.mtime,
+ mtime: this.noMtime ? null : this.header.mtime,
path: this.path,
linkpath: this.linkpath,
size: this.header.size,
@@ -294,28 +298,30 @@ 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 = readEntry.uid
- this.gid = readEntry.gid
- this.uname = readEntry.uname
- this.gname = readEntry.gname
+ 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.size = readEntry.size
- this.mtime = readEntry.mtime
- this.atime = readEntry.atime
- this.ctime = readEntry.ctime
+ this.mtime = this.noMtime ? null : readEntry.mtime
+ this.atime = this.portable ? null : readEntry.atime
+ this.ctime = this.portable ? null : 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)
@@ -341,7 +347,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.mtime,
+ mtime: this.noMtime ? null : this.mtime,
type: this.type,
uname: this.portable ? null : this.uname,
atime: this.portable ? null : this.atime,
@@ -353,7 +359,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.mtime,
+ mtime: this.noMtime ? null : 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
new file mode 100644
index 000000000..19129e315
--- /dev/null
+++ b/node_modules/tar/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/tar/node_modules/fs-minipass/README.md b/node_modules/tar/node_modules/fs-minipass/README.md
new file mode 100644
index 000000000..1e61241cf
--- /dev/null
+++ b/node_modules/tar/node_modules/fs-minipass/README.md
@@ -0,0 +1,70 @@
+# 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
new file mode 100644
index 000000000..07f0f513c
--- /dev/null
+++ b/node_modules/tar/node_modules/fs-minipass/index.js
@@ -0,0 +1,383 @@
+'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
new file mode 100644
index 000000000..172af3b20
--- /dev/null
+++ b/node_modules/tar/node_modules/fs-minipass/package.json
@@ -0,0 +1,62 @@
+{
+ "_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 bf3140dbe..e267cb273 100644
--- a/node_modules/tar/package.json
+++ b/node_modules/tar/package.json
@@ -1,27 +1,28 @@
{
- "_from": "tar@4.0.2",
- "_id": "tar@4.0.2",
+ "_from": "tar@latest",
+ "_id": "tar@4.1.0",
"_inBundle": false,
- "_integrity": "sha512-4lWN4uAEWzw8aHyBUx9HWXvH3vIFEhOyvN22HfBzWpE07HaTBXM8ttSeCQpswRo5On4q3nmmYmk7Tomn0uhUaw==",
+ "_integrity": "sha512-xQoupzP/LFDSz3llXIS86u6PHAqzc+AUVJLLcaKg898rQ8c71cmklu0G05NQpIKqh8XNF+Pv+EptKySI7rseNw==",
"_location": "/tar",
"_phantomChildren": {},
"_requested": {
- "type": "version",
+ "type": "tag",
"registry": true,
- "raw": "tar@4.0.2",
+ "raw": "tar@latest",
"name": "tar",
"escapedName": "tar",
- "rawSpec": "4.0.2",
+ "rawSpec": "latest",
"saveSpec": null,
- "fetchSpec": "4.0.2"
+ "fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
- "/"
+ "/",
+ "/pacote"
],
- "_resolved": "https://registry.npmjs.org/tar/-/tar-4.0.2.tgz",
- "_shasum": "e8e22bf3eec330e5c616d415a698395e294e8fad",
- "_spec": "tar@4.0.2",
+ "_resolved": "https://registry.npmjs.org/tar/-/tar-4.1.0.tgz",
+ "_shasum": "3344ed174eb2c6c3749cc1bbee391395962256d9",
+ "_spec": "tar@latest",
"_where": "/Users/zkat/Documents/code/npm",
"author": {
"name": "Isaac Z. Schlueter",
@@ -34,6 +35,7 @@
"bundleDependencies": false,
"dependencies": {
"chownr": "^1.0.1",
+ "fs-minipass": "^1.2.3",
"minipass": "^2.2.1",
"minizlib": "^1.0.4",
"mkdirp": "^0.5.0",
@@ -45,9 +47,9 @@
"chmodr": "^1.0.2",
"end-of-stream": "^1.4.0",
"events-to-array": "^1.1.2",
- "mutate-fs": "^1.1.0",
+ "mutate-fs": "^2.1.1",
"rimraf": "^2.6.2",
- "tap": "^10.7.2",
+ "tap": "^11.0.0-rc.3",
"tar-fs": "^1.16.0",
"tar-stream": "^1.5.2"
},
@@ -71,7 +73,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"
+ "test": "tap test/*.js --100 -J --coverage-report=text -c"
},
- "version": "4.0.2"
+ "version": "4.1.0"
}