From 767ff6eee7fa3a0f42ad677dedc0ec1f0dc15e7c Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Wed, 6 Sep 2017 15:09:21 -0700 Subject: pacote@6.0.2 Credit: @zkat Reviewed-By: @iarna PR-URL: https://github.com/zkat/pacote/pull/117 Fixes: #18396 Fixes: #18399 Fixes: #18324 --- node_modules/pacote/CHANGELOG.md | 15 +++++++++++++++ node_modules/pacote/lib/extract-stream.js | 12 ++++++++++-- node_modules/pacote/lib/util/git.js | 15 ++++++++++----- .../pacote/node_modules/make-fetch-happen/CHANGELOG.md | 15 +++++++++++++++ .../pacote/node_modules/make-fetch-happen/agent.js | 15 +++++++++++++-- .../pacote/node_modules/make-fetch-happen/index.js | 13 +++++++++++++ .../pacote/node_modules/make-fetch-happen/package.json | 17 +++++++++-------- node_modules/pacote/package.json | 12 +++++------- package-lock.json | 14 +++++++------- package.json | 2 +- 10 files changed, 98 insertions(+), 32 deletions(-) diff --git a/node_modules/pacote/CHANGELOG.md b/node_modules/pacote/CHANGELOG.md index d09a5cbe4..3d9ac9dc2 100644 --- a/node_modules/pacote/CHANGELOG.md +++ b/node_modules/pacote/CHANGELOG.md @@ -2,6 +2,21 @@ 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. + +## [6.0.2](https://github.com/zkat/pacote/compare/v6.0.1...v6.0.2) (2017-09-06) + + +### Bug Fixes + +* **extract:** preserve executable perms on extracted files ([19b3dfd](https://github.com/zkat/pacote/commit/19b3dfd)) + + +### Performance Improvements + +* replace some calls to .match() with .starts/endsWith() (#115) ([192a02f](https://github.com/zkat/pacote/commit/192a02f)) + + + ## [6.0.1](https://github.com/zkat/pacote/compare/v6.0.0...v6.0.1) (2017-08-22) diff --git a/node_modules/pacote/lib/extract-stream.js b/node_modules/pacote/lib/extract-stream.js index 117531948..b3c720b07 100644 --- a/node_modules/pacote/lib/extract-stream.js +++ b/node_modules/pacote/lib/extract-stream.js @@ -4,6 +4,12 @@ const path = require('path') const tar = require('tar') module.exports = extractStream +module.exports._computeMode = computeMode + +function computeMode (fileMode, optMode, umask) { + return (fileMode | optMode) & ~(umask || 0) +} + function extractStream (dest, opts) { opts = opts || {} const sawIgnores = new Set() @@ -16,9 +22,11 @@ function extractStream (dest, opts) { gid: opts.gid, onentry (entry) { if (entry.type.toLowerCase() === 'file') { - entry.mode = opts.fmode & ~(opts.umask || 0) + entry.mode = computeMode(entry.mode, opts.fmode, opts.umask) } else if (entry.type.toLowerCase() === 'directory') { - entry.mode = opts.dmode & ~(opts.umask || 0) + entry.mode = computeMode(entry.mode, opts.dmode, opts.umask) + } else { + entry.mode = computeMode(entry.mode, 0, opts.umask) } // Note: This mirrors logic in the fs read operations that are diff --git a/node_modules/pacote/lib/util/git.js b/node_modules/pacote/lib/util/git.js index ed1b49d56..a24edccdd 100644 --- a/node_modules/pacote/lib/util/git.js +++ b/node_modules/pacote/lib/util/git.js @@ -25,6 +25,7 @@ const GOOD_ENV_VARS = new Set([ 'GIT_SSL_NO_VERIFY' ]) +const GIT_ = 'GIT_' let GITENV function gitEnv () { if (GITENV) { return GITENV } @@ -35,7 +36,7 @@ function gitEnv () { GIT_TEMPLATE_DIR: tmpName } Object.keys(process.env).forEach(k => { - if (GOOD_ENV_VARS.has(k) || !k.match(/^GIT_/)) { + if (GOOD_ENV_VARS.has(k) || !k.startsWith(GIT_)) { GITENV[k] = process.env[k] } }) @@ -93,6 +94,7 @@ function headSha (repo, opts) { }) } +const CARET_BRACES = '^{}' const REVS = new LRU({ max: 100, maxAge: 5 * 60 * 1000 @@ -122,7 +124,7 @@ function revs (repo, opts) { const sha = split[0].trim() const ref = split[1].trim().match(/(?:refs\/[^/]+\/)?(.*)/)[1] if (!ref) { return revs } // ??? - if (ref.match(/\^\{\}$/)) { return revs } // refs/tags/x^{} crap + if (ref.endsWith(CARET_BRACES)) { return revs } // refs/tags/x^{} crap const type = refType(line) const doc = {sha, ref, type} @@ -202,12 +204,15 @@ function checkGit () { } } +const REFS_TAGS = '/refs/tags/' +const REFS_HEADS = '/refs/heads/' +const HEAD = 'HEAD' function refType (ref) { - return ref.match(/refs\/tags\/.*$/) + return ref.indexOf(REFS_TAGS) !== -1 ? 'tag' - : ref.match(/refs\/heads\/.*$/) + : ref.indexOf(REFS_HEADS) !== -1 ? 'branch' - : ref.match(/HEAD$/) + : ref.endsWith(HEAD) ? 'head' : 'other' } diff --git a/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md b/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md index a8ed4ca56..59698d1c2 100644 --- a/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md +++ b/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md @@ -2,6 +2,21 @@ 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. + +# [2.5.0](https://github.com/zkat/make-fetch-happen/compare/v2.4.13...v2.5.0) (2017-08-24) + + +### Bug Fixes + +* **agent:** support timeout durations greater than 30 seconds ([04875ae](https://github.com/zkat/make-fetch-happen/commit/04875ae)), closes [#35](https://github.com/zkat/make-fetch-happen/issues/35) + + +### Features + +* **cache:** export cache deletion functionality (#40) ([3da4250](https://github.com/zkat/make-fetch-happen/commit/3da4250)) + + + ## [2.4.13](https://github.com/zkat/make-fetch-happen/compare/v2.4.12...v2.4.13) (2017-06-29) diff --git a/node_modules/pacote/node_modules/make-fetch-happen/agent.js b/node_modules/pacote/node_modules/make-fetch-happen/agent.js index a3c910eb9..69bfab664 100644 --- a/node_modules/pacote/node_modules/make-fetch-happen/agent.js +++ b/node_modules/pacote/node_modules/make-fetch-happen/agent.js @@ -44,16 +44,26 @@ function getAgent (uri, opts) { } else if (!isHttps && !HttpAgent) { HttpAgent = require('agentkeepalive') } + + // If opts.timeout is zero, set the agentTimeout to zero as well. A timeout + // of zero disables the timeout behavior (OS limits still apply). Else, if + // opts.timeout is a non-zero value, set it to timeout + 1, to ensure that + // the node-fetch-npm timeout will always fire first, giving us more + // consistent errors. + const agentTimeout = opts.timeout === 0 ? 0 : opts.timeout + 1 + const agent = isHttps ? new HttpsAgent({ maxSockets: opts.maxSockets || 15, ca: opts.ca, cert: opts.cert, key: opts.key, localAddress: opts.localAddress, - rejectUnauthorized: opts.strictSSL + rejectUnauthorized: opts.strictSSL, + timeout: agentTimeout }) : new HttpAgent({ maxSockets: opts.maxSockets || 15, - localAddress: opts.localAddress + localAddress: opts.localAddress, + timeout: agentTimeout }) AGENT_CACHE.set(key, agent) return agent @@ -130,6 +140,7 @@ function getProxy (proxyUrl, opts, isHttps) { ca: opts.ca, cert: opts.cert, key: opts.key, + timeout: opts.timeout === 0 ? 0 : opts.timeout + 1, localAddress: opts.localAddress, maxSockets: opts.maxSockets || 15, rejectUnauthorized: opts.strictSSL diff --git a/node_modules/pacote/node_modules/make-fetch-happen/index.js b/node_modules/pacote/node_modules/make-fetch-happen/index.js index 18a289353..d82811b63 100644 --- a/node_modules/pacote/node_modules/make-fetch-happen/index.js +++ b/node_modules/pacote/node_modules/make-fetch-happen/index.js @@ -42,9 +42,22 @@ cachingFetch.defaults = function (_uri, _opts) { } defaultedFetch.defaults = fetch.defaults + defaultedFetch.delete = fetch.delete return defaultedFetch } +cachingFetch.delete = cacheDelete +function cacheDelete (uri, opts) { + opts = configureOptions(opts) + if (opts.cacheManager) { + const req = new fetch.Request(uri, { + method: opts.method, + headers: opts.headers + }) + return opts.cacheManager.delete(req, opts) + } +} + function initializeCache (opts) { if (typeof opts.cacheManager === 'string') { if (!Cache) { diff --git a/node_modules/pacote/node_modules/make-fetch-happen/package.json b/node_modules/pacote/node_modules/make-fetch-happen/package.json index fe7a3f374..f900c0d52 100644 --- a/node_modules/pacote/node_modules/make-fetch-happen/package.json +++ b/node_modules/pacote/node_modules/make-fetch-happen/package.json @@ -1,8 +1,8 @@ { "_from": "make-fetch-happen@^2.4.13", - "_id": "make-fetch-happen@2.4.13", + "_id": "make-fetch-happen@2.5.0", "_inBundle": false, - "_integrity": "sha512-73CsTlMRSLdGr7VvOE8iYl/ejOSIxyfRYg7jZhepGGEqIlgdq6FLe2DEAI5bo813Jdg5fS/Ku62SRQ/UpT6NJA==", + "_integrity": "sha512-JPD5R43T02wIkcxjcmZuR7D06nB20fMR8aC9VEyYsSBXvJa5hOR/QhCxKY+5SXhy3uU5OUY/r+A6r+fJ2mFndA==", "_location": "/pacote/make-fetch-happen", "_phantomChildren": { "safe-buffer": "5.1.1" @@ -20,10 +20,10 @@ "_requiredBy": [ "/pacote" ], - "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.4.13.tgz", - "_shasum": "3139ba2f4230a8384e7ba394534816c872ecbf4b", + "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.5.0.tgz", + "_shasum": "08c22d499f4f30111addba79fe87c98cf01b6bc8", "_spec": "make-fetch-happen@^2.4.13", - "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote", + "_where": "/Users/rebecca/code/npm/node_modules/pacote", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -50,9 +50,10 @@ "devDependencies": { "bluebird": "^3.5.0", "mkdirp": "^0.5.1", - "nock": "^9.0.6", + "nock": "^9.0.14", "npmlog": "^4.1.2", "nyc": "^11.0.3", + "require-inject": "^1.4.2", "rimraf": "^2.5.4", "safe-buffer": "^5.1.1", "standard": "^10.0.1", @@ -88,9 +89,9 @@ "prerelease": "npm t", "pretest": "standard lib test *.js", "release": "standard-version -s", - "test": "nyc --all -- tap -J test/*.js", + "test": "nyc --all -- tap --timeout=35 -J test/*.js", "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.4.13" + "version": "2.5.0" } diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index 944aa7a33..6050cc624 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,15 +1,13 @@ { "_from": "pacote@latest", - "_id": "pacote@6.0.1", + "_id": "pacote@6.0.2", "_inBundle": false, - "_integrity": "sha512-BvGf8BnnkMcTqJk7MLimR8GWOsG/BJ+st4LS+Q82LoetVUQ1bqwoDw/WEjbUgfKdLIG/wKk9OWk9Zce8sNbPIw==", + "_integrity": "sha512-PsnzsjS/rNjY0fojY8QNy6Zq1XvTA3X0vhtfNtExAf1h/746f4MaSatHEU6jiAb9yqvzdThnFGAy+t5VtKwgjg==", "_location": "/pacote", "_phantomChildren": { "cacache": "9.2.9", - "chownr": "1.0.1", "lru-cache": "4.1.1", "mississippi": "1.3.0", - "mkdirp": "0.5.1", "npm-package-arg": "5.1.2", "retry": "0.10.1", "safe-buffer": "5.1.1", @@ -30,8 +28,8 @@ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/pacote/-/pacote-6.0.1.tgz", - "_shasum": "4428b8d763f9a141ad32123948eedd5f697449b5", + "_resolved": "https://registry.npmjs.org/pacote/-/pacote-6.0.2.tgz", + "_shasum": "c618a3c08493aeb390e79aa73f95af331ffc6171", "_spec": "pacote@latest", "_where": "/Users/rebecca/code/npm", "author": { @@ -119,5 +117,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": "6.0.1" + "version": "6.0.2" } diff --git a/package-lock.json b/package-lock.json index 09375d56d..05384a35e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2306,15 +2306,15 @@ } }, "pacote": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-6.0.1.tgz", - "integrity": "sha512-BvGf8BnnkMcTqJk7MLimR8GWOsG/BJ+st4LS+Q82LoetVUQ1bqwoDw/WEjbUgfKdLIG/wKk9OWk9Zce8sNbPIw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-6.0.2.tgz", + "integrity": "sha512-PsnzsjS/rNjY0fojY8QNy6Zq1XvTA3X0vhtfNtExAf1h/746f4MaSatHEU6jiAb9yqvzdThnFGAy+t5VtKwgjg==", "requires": { "bluebird": "3.5.0", "cacache": "9.2.9", "glob": "7.1.2", "lru-cache": "4.1.1", - "make-fetch-happen": "2.4.13", + "make-fetch-happen": "2.5.0", "minimatch": "3.0.4", "mississippi": "1.3.0", "normalize-package-data": "2.4.0", @@ -2334,9 +2334,9 @@ }, "dependencies": { "make-fetch-happen": { - "version": "2.4.13", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.4.13.tgz", - "integrity": "sha512-73CsTlMRSLdGr7VvOE8iYl/ejOSIxyfRYg7jZhepGGEqIlgdq6FLe2DEAI5bo813Jdg5fS/Ku62SRQ/UpT6NJA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.5.0.tgz", + "integrity": "sha512-JPD5R43T02wIkcxjcmZuR7D06nB20fMR8aC9VEyYsSBXvJa5hOR/QhCxKY+5SXhy3uU5OUY/r+A6r+fJ2mFndA==", "requires": { "agentkeepalive": "3.3.0", "cacache": "9.2.9", diff --git a/package.json b/package.json index 206256850..5972f75d0 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "once": "~1.4.0", "opener": "~1.4.3", "osenv": "~0.1.4", - "pacote": "~6.0.1", + "pacote": "~6.0.2", "path-is-inside": "~1.0.2", "promise-inflight": "~1.0.1", "read": "~1.0.7", -- cgit v1.2.3