diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-05-12 05:50:23 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-05-26 04:55:18 +0300 |
commit | 3d629fb91cb82b74b15c4e7bdafa826c399d99af (patch) | |
tree | b84c4f4deb40f743f19eaf103ee95a7fb801d57c /node_modules | |
parent | 1edca81bf03713c2a5b1da2e0c21b8ecf98fc270 (diff) |
pacote@2.7.10
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/pacote/CHANGELOG.md | 11 | ||||
-rw-r--r-- | node_modules/pacote/extract.js | 4 | ||||
-rw-r--r-- | node_modules/pacote/lib/finalize-manifest.js | 1 | ||||
-rw-r--r-- | node_modules/pacote/manifest.js | 2 | ||||
-rw-r--r-- | node_modules/pacote/node_modules/tar-stream/README.md | 39 | ||||
-rw-r--r-- | node_modules/pacote/node_modules/tar-stream/extract.js | 2 | ||||
-rw-r--r-- | node_modules/pacote/node_modules/tar-stream/headers.js | 27 | ||||
-rw-r--r-- | node_modules/pacote/node_modules/tar-stream/package.json | 15 | ||||
-rw-r--r-- | node_modules/pacote/package.json | 24 | ||||
-rw-r--r-- | node_modules/pacote/prefetch.js | 2 |
10 files changed, 87 insertions, 40 deletions
diff --git a/node_modules/pacote/CHANGELOG.md b/node_modules/pacote/CHANGELOG.md index 24c962687..b7814874a 100644 --- a/node_modules/pacote/CHANGELOG.md +++ b/node_modules/pacote/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +<a name="2.7.10"></a> +## [2.7.10](https://github.com/zkat/pacote/compare/v2.7.9...v2.7.10) (2017-05-12) + + +### Bug Fixes + +* **logging:** shhhhhhh ([e7ea56e](https://github.com/zkat/pacote/commit/e7ea56e)) +* **manifest:** _resolved is the only main field we do not overwrite ([4c12421](https://github.com/zkat/pacote/commit/4c12421)) + + + <a name="2.7.9"></a> ## [2.7.9](https://github.com/zkat/pacote/compare/v2.7.8...v2.7.9) (2017-05-09) diff --git a/node_modules/pacote/extract.js b/node_modules/pacote/extract.js index 696aa5e1d..79a410167 100644 --- a/node_modules/pacote/extract.js +++ b/node_modules/pacote/extract.js @@ -62,7 +62,7 @@ function extractByDigest (start, spec, dest, opts) { const xtractor = extractStream(dest, opts) const cached = cacache.get.stream.byDigest(opts.cache, opts.integrity, opts) return pipe(cached, xtractor).then(() => { - opts.log.verbose('pacote', `${spec} extracted to ${dest} by content address ${Date.now() - start}ms`) + opts.log.silly('pacote', `${spec} extracted to ${dest} by content address ${Date.now() - start}ms`) }) } @@ -75,7 +75,7 @@ function extractByManifest (start, spec, dest, opts) { } return pipe(fetch.tarball(spec, opts), xtractor) }).then(() => { - opts.log.verbose('pacote', `${spec} extracted in ${Date.now() - start}ms`) + opts.log.silly('pacote', `${spec} extracted in ${Date.now() - start}ms`) }) } diff --git a/node_modules/pacote/lib/finalize-manifest.js b/node_modules/pacote/lib/finalize-manifest.js index 7631b7f03..cd303a9fa 100644 --- a/node_modules/pacote/lib/finalize-manifest.js +++ b/node_modules/pacote/lib/finalize-manifest.js @@ -162,6 +162,7 @@ function tarballedProps (pkg, spec, opts) { needsExtract && pipe(tarStream, gunzip(), extracted), (sr, mani, paths, hash) => { const extraProps = mani || {} + delete extraProps._resolved // drain out the rest of the tarball tarStream.unpipe() tarStream.on('data', () => {}) diff --git a/node_modules/pacote/manifest.js b/node_modules/pacote/manifest.js index 15df3e639..81373ab0f 100644 --- a/node_modules/pacote/manifest.js +++ b/node_modules/pacote/manifest.js @@ -31,7 +31,7 @@ function manifest (spec, opts) { manifest._where = opts.where } const elapsedTime = Date.now() - startTime - opts.log.verbose('pacote', `${spec.type} manifest for ${spec.name}@${spec.saveSpec || spec.fetchSpec} fetched in ${elapsedTime}ms`) + opts.log.silly('pacote', `${spec.type} manifest for ${spec.name}@${spec.saveSpec || spec.fetchSpec} fetched in ${elapsedTime}ms`) return manifest }) }) diff --git a/node_modules/pacote/node_modules/tar-stream/README.md b/node_modules/pacote/node_modules/tar-stream/README.md index 8d0a094b1..96abbca1b 100644 --- a/node_modules/pacote/node_modules/tar-stream/README.md +++ b/node_modules/pacote/node_modules/tar-stream/README.md @@ -9,6 +9,7 @@ npm install tar-stream ``` [![build status](https://secure.travis-ci.org/mafintosh/tar-stream.png)](http://travis-ci.org/mafintosh/tar-stream) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) ## Usage @@ -50,18 +51,18 @@ pack.pipe(process.stdout) ## Extracting -To extract a stream use `tar.extract()` and listen for `extract.on('entry', header, stream, callback)` +To extract a stream use `tar.extract()` and listen for `extract.on('entry', (header, stream, next) )` ``` js var extract = tar.extract() -extract.on('entry', function(header, stream, callback) { +extract.on('entry', function(header, stream, next) { // header is the tar header // stream is the content body (might be an empty stream) // call next when you are done with this entry stream.on('end', function() { - callback() // ready for next entry + next() // ready for next entry }) stream.resume() // just auto drain the stream @@ -74,6 +75,8 @@ extract.on('finish', function() { pack.pipe(extract) ``` +The tar archive is streamed sequentially, meaning you **must** drain each entry's stream as you get them or else the main extract stream will receive backpressure and stop reading. + ## Headers The header object using in `entry` should contain the following properties. @@ -126,6 +129,36 @@ oldTarballStream.pipe(extract) pack.pipe(newTarballStream) ``` +## Saving tarball to fs + + +``` js +var fs = require('fs') +var tar = require('tar-stream') + +var pack = tar.pack() // pack is a streams2 stream +var path = 'YourTarBall.tar' +var yourTarball = fs.createWriteStream(path) + +// add a file called YourFile.txt with the content "Hello World!" +pack.entry({name: 'YourFile.txt'}, 'Hello World!', function (err) { + if (err) throw err + pack.finalize() +}) + +// pipe the pack stream to your file +pack.pipe(yourTarball) + +yourTarball.on('close', function () { + console.log(path + ' has been written') + fs.stat(path, function(err, stats) { + if (err) throw err + console.log(stats) + console.log('Got file info successfully!') + }) +}) +``` + ## Performance [See tar-fs for a performance comparison with node-tar](https://github.com/mafintosh/tar-fs/blob/master/README.md#performance) diff --git a/node_modules/pacote/node_modules/tar-stream/extract.js b/node_modules/pacote/node_modules/tar-stream/extract.js index 6b3b9bf44..8be2a472c 100644 --- a/node_modules/pacote/node_modules/tar-stream/extract.js +++ b/node_modules/pacote/node_modules/tar-stream/extract.js @@ -166,7 +166,7 @@ var Extract = function (opts) { self._locked = true - if (!header.size) { + if (!header.size || header.type === 'directory') { self._parse(512, onheader) self.emit('entry', header, emptyStream(self, offset), onunlock) return diff --git a/node_modules/pacote/node_modules/tar-stream/headers.js b/node_modules/pacote/node_modules/tar-stream/headers.js index 8c75edcc4..8aab8b561 100644 --- a/node_modules/pacote/node_modules/tar-stream/headers.js +++ b/node_modules/pacote/node_modules/tar-stream/headers.js @@ -1,4 +1,5 @@ var ZEROS = '0000000000000000000' +var SEVENS = '7777777777777777777' var ZERO_OFFSET = '0'.charCodeAt(0) var USTAR = 'ustar\x0000' var MASK = parseInt('7777', 8) @@ -92,7 +93,8 @@ var cksum = function (block) { var encodeOct = function (val, n) { val = val.toString(8) - return ZEROS.slice(0, n - val.length) + val + ' ' + if (val.length > n) return SEVENS.slice(0, n) + ' ' + else return ZEROS.slice(0, n - val.length) + val + ' ' } /* Copied from the node-tar repo and modified to meet @@ -130,10 +132,13 @@ function parse256 (buf) { return positive ? sum : -1 * sum } -var decodeOct = function (val, offset) { +var decodeOct = function (val, offset, length) { + val = val.slice(offset, offset + length) + offset = 0 + // If prefixed with 0x80 then parse as a base-256 integer if (val[offset] & 0x80) { - return parse256(val.slice(offset, offset + 8)) + return parse256(val) } else { // Older versions of tar can prefix with spaces while (offset < val.length && val[offset] === 32) offset++ @@ -239,17 +244,17 @@ exports.decode = function (buf) { var typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET var name = decodeStr(buf, 0, 100) - var mode = decodeOct(buf, 100) - var uid = decodeOct(buf, 108) - var gid = decodeOct(buf, 116) - var size = decodeOct(buf, 124) - var mtime = decodeOct(buf, 136) + var mode = decodeOct(buf, 100, 8) + var uid = decodeOct(buf, 108, 8) + var gid = decodeOct(buf, 116, 8) + var size = decodeOct(buf, 124, 12) + var mtime = decodeOct(buf, 136, 12) var type = toType(typeflag) var linkname = buf[157] === 0 ? null : decodeStr(buf, 157, 100) var uname = decodeStr(buf, 265, 32) var gname = decodeStr(buf, 297, 32) - var devmajor = decodeOct(buf, 329) - var devminor = decodeOct(buf, 337) + var devmajor = decodeOct(buf, 329, 8) + var devminor = decodeOct(buf, 337, 8) if (buf[345]) name = decodeStr(buf, 345, 155) + '/' + name @@ -262,7 +267,7 @@ exports.decode = function (buf) { if (c === 8 * 32) return null // valid checksum - if (c !== decodeOct(buf, 148)) throw new Error('Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?') + if (c !== decodeOct(buf, 148, 8)) throw new Error('Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?') return { name: name, diff --git a/node_modules/pacote/node_modules/tar-stream/package.json b/node_modules/pacote/node_modules/tar-stream/package.json index 348e36641..fca15656f 100644 --- a/node_modules/pacote/node_modules/tar-stream/package.json +++ b/node_modules/pacote/node_modules/tar-stream/package.json @@ -1,7 +1,8 @@ { "_from": "tar-stream@^1.5.2", - "_id": "tar-stream@1.5.2", - "_integrity": "sha1-+8bG6DwaGdTLSMfZYXH8JI7/x78=", + "_id": "tar-stream@1.5.4", + "_inBundle": false, + "_integrity": "sha1-NlSc8E7RrumyowwBQyUiONr5QBY=", "_location": "/pacote/tar-stream", "_phantomChildren": { "once": "1.4.0", @@ -21,16 +22,14 @@ "/pacote", "/pacote/tar-fs" ], - "_resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.2.tgz", - "_shasum": "fbc6c6e83c1a19d4cb48c7d96171fc248effc7bf", - "_shrinkwrap": null, + "_resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.4.tgz", + "_shasum": "36549cf04ed1aee9b2a30c0143252238daf94016", "_spec": "tar-stream@^1.5.2", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote", "author": { "name": "Mathias Buus", "email": "mathiasbuus@gmail.com" }, - "bin": null, "bugs": { "url": "https://github.com/mafintosh/tar-stream/issues" }, @@ -78,8 +77,6 @@ "license": "MIT", "main": "index.js", "name": "tar-stream", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/mafintosh/tar-stream.git" @@ -87,5 +84,5 @@ "scripts": { "test": "standard && tape test/*.js" }, - "version": "1.5.2" + "version": "1.5.4" } diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index 283fc8f5c..63c61b305 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,8 +1,8 @@ { - "_from": "pacote@latest", - "_id": "pacote@2.7.9", + "_from": "pacote@~2.7.9", + "_id": "pacote@2.7.10", "_inBundle": false, - "_integrity": "sha512-kAcvLbHgpr5dJil6r8CuRzXZZT0qC3U4Nia0tPRP1ggX1qEkNZXArHco4pn1ARJw/qXuuoR/tMA+nqz7j1knyQ==", + "_integrity": "sha512-XW+bJC7y7foWYtaD0rkMi04mhktBG8I2y0N/vEUQN2R25dqVM7iV+fIdnUmNcnVDQHUIWK1XnodKEFIC4K+C6A==", "_location": "/pacote", "_phantomChildren": { "cacache": "9.0.0", @@ -18,23 +18,23 @@ "ssri": "4.1.2" }, "_requested": { - "type": "tag", + "type": "range", "registry": true, - "raw": "pacote@latest", + "raw": "pacote@~2.7.9", "name": "pacote", "escapedName": "pacote", - "rawSpec": "latest", + "rawSpec": "~2.7.9", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "~2.7.9" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/pacote/-/pacote-2.7.9.tgz", - "_shasum": "bdc5414e1c18f4a4b80ef6c99ed2734d1378854a", - "_spec": "pacote@latest", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/pacote/-/pacote-2.7.10.tgz", + "_shasum": "f5bb5994ff0c7b6f2e5164dd4fab996556231b99", + "_spec": "pacote@~2.7.9", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -119,5 +119,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "2.7.9" + "version": "2.7.10" } diff --git a/node_modules/pacote/prefetch.js b/node_modules/pacote/prefetch.js index 683662f32..60ddd624d 100644 --- a/node_modules/pacote/prefetch.js +++ b/node_modules/pacote/prefetch.js @@ -52,7 +52,7 @@ function prefetchByManifest (start, spec, opts) { stream.on('integrity', i => { integrity = i }) return finished(stream) }).then(() => { - opts.log.verbose('prefetch', `${spec} done in ${Date.now() - start}ms`) + opts.log.silly('prefetch', `${spec} done in ${Date.now() - start}ms`) return { manifest, spec, |