From 95ca1aef4077c8e68d9f4dce37f6ba49b591c4ca Mon Sep 17 00:00:00 2001 From: Audrey Eschright Date: Wed, 30 Jan 2019 12:13:47 -0800 Subject: [PATCH] pacote@9.4.1 --- node_modules/.gitignore | 1 - node_modules/pacote/CHANGELOG.md | 10 +++++++++ node_modules/pacote/lib/fetchers/directory.js | 5 +++-- node_modules/pacote/lib/finalize-manifest.js | 3 ++- node_modules/pacote/lib/util/read-json.js | 15 +++++++++++++ node_modules/pacote/package.json | 22 +++++++++---------- package-lock.json | 6 ++--- package.json | 2 +- 8 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 node_modules/pacote/lib/util/read-json.js diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 06e52612ce876..ac8c182e8fdc7 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -1,5 +1,4 @@ ## Automatically generated dev dependency ignores -/@types /@types/caseless /@types/form-data /@types/node diff --git a/node_modules/pacote/CHANGELOG.md b/node_modules/pacote/CHANGELOG.md index 50a0dbde402cb..a7784d9bb1193 100644 --- a/node_modules/pacote/CHANGELOG.md +++ b/node_modules/pacote/CHANGELOG.md @@ -2,6 +2,16 @@ 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. + +## [9.4.1](https://github.com/zkat/pacote/compare/v9.4.0...v9.4.1) (2019-01-24) + + +### Bug Fixes + +* **directory, finalize-manifest:** strip byte order marker from JSON ([723ad63](https://github.com/zkat/pacote/commit/723ad63)) + + + # [9.4.0](https://github.com/zkat/pacote/compare/v9.3.0...v9.4.0) (2019-01-14) diff --git a/node_modules/pacote/lib/fetchers/directory.js b/node_modules/pacote/lib/fetchers/directory.js index 83f3d7d558cb1..3d4ec24c83f27 100644 --- a/node_modules/pacote/lib/fetchers/directory.js +++ b/node_modules/pacote/lib/fetchers/directory.js @@ -5,6 +5,7 @@ const BB = require('bluebird') const Fetcher = require('../fetch') const glob = BB.promisify(require('glob')) const packDir = require('../util/pack-dir') +const readJson = require('../util/read-json') const path = require('path') const pipe = BB.promisify(require('mississippi').pipe) const through = require('mississippi').through @@ -34,11 +35,11 @@ Fetcher.impl(fetchDirectory, { const pkgPath = path.join(spec.fetchSpec, 'package.json') const srPath = path.join(spec.fetchSpec, 'npm-shrinkwrap.json') return BB.join( - readFileAsync(pkgPath).then(JSON.parse).catch({ code: 'ENOENT' }, err => { + readFileAsync(pkgPath).then(readJson).catch({ code: 'ENOENT' }, err => { err.code = 'ENOPACKAGEJSON' throw err }), - readFileAsync(srPath).then(JSON.parse).catch({ code: 'ENOENT' }, () => null), + readFileAsync(srPath).then(readJson).catch({ code: 'ENOENT' }, () => null), (pkg, sr) => { pkg._shrinkwrap = sr pkg._hasShrinkwrap = !!sr diff --git a/node_modules/pacote/lib/finalize-manifest.js b/node_modules/pacote/lib/finalize-manifest.js index 80b379898fe4c..f047517945192 100644 --- a/node_modules/pacote/lib/finalize-manifest.js +++ b/node_modules/pacote/lib/finalize-manifest.js @@ -13,6 +13,7 @@ const path = require('path') const pipe = BB.promisify(require('mississippi').pipe) const ssri = require('ssri') const tar = require('tar') +const readJson = require('./util/read-json') // `finalizeManifest` takes as input the various kinds of manifests that // manifest handlers ('lib/fetchers/*.js#manifest()') return, and makes sure @@ -212,7 +213,7 @@ function jsonFromStream (filename, dataStream) { entry.on('error', cb) finished(entry).then(() => { try { - cb(null, JSON.parse(data)) + cb(null, readJson(data)) } catch (err) { cb(err) } diff --git a/node_modules/pacote/lib/util/read-json.js b/node_modules/pacote/lib/util/read-json.js new file mode 100644 index 0000000000000..32fffbc53746b --- /dev/null +++ b/node_modules/pacote/lib/util/read-json.js @@ -0,0 +1,15 @@ +'use strict' + +module.exports = function (content) { + // Code also yanked from read-package-json. + function stripBOM (content) { + content = content.toString() + // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + // because the buffer-to-string conversion in `fs.readFileSync()` + // translates it to FEFF, the UTF-16 BOM. + if (content.charCodeAt(0) === 0xFEFF) return content.slice(1) + return content + } + + return JSON.parse(stripBOM(content)) +} diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index 32e8a07b094e1..96ae38bd682a6 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,8 +1,8 @@ { - "_from": "pacote@9.4.0", - "_id": "pacote@9.4.0", + "_from": "pacote@9.4.1", + "_id": "pacote@9.4.1", "_inBundle": false, - "_integrity": "sha512-WQ1KL/phGMkedYEQx9ODsjj7xvwLSpdFJJdEXrLyw5SILMxcTNt5DTxT2Z93fXuLFYJBlZJdnwdalrQdB/rX5w==", + "_integrity": "sha512-YKSRsQqmeHxgra0KCdWA2FtVxDPUlBiCdmew+mSe44pzlx5t1ViRMWiQg18T+DREA+vSqYfKzynaToFR4hcKHw==", "_location": "/pacote", "_phantomChildren": { "safe-buffer": "5.1.2" @@ -10,12 +10,12 @@ "_requested": { "type": "version", "registry": true, - "raw": "pacote@9.4.0", + "raw": "pacote@9.4.1", "name": "pacote", "escapedName": "pacote", - "rawSpec": "9.4.0", + "rawSpec": "9.4.1", "saveSpec": null, - "fetchSpec": "9.4.0" + "fetchSpec": "9.4.1" }, "_requiredBy": [ "#USER", @@ -23,10 +23,10 @@ "/libcipm", "/libnpm" ], - "_resolved": "https://registry.npmjs.org/pacote/-/pacote-9.4.0.tgz", - "_shasum": "af979abdeb175cd347c3e33be3241af1ed254807", - "_spec": "pacote@9.4.0", - "_where": "/Users/aeschright/code/cli", + "_resolved": "https://registry.npmjs.org/pacote/-/pacote-9.4.1.tgz", + "_shasum": "f0af2a52d241bce523d39280ac810c671db62279", + "_spec": "pacote@9.4.1", + "_where": "/Users/aeschright/code/npm-release", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -116,5 +116,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": "9.4.0" + "version": "9.4.1" } diff --git a/package-lock.json b/package-lock.json index f3b0c3b605b71..91cf495c35d7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6145,9 +6145,9 @@ } }, "pacote": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-9.4.0.tgz", - "integrity": "sha512-WQ1KL/phGMkedYEQx9ODsjj7xvwLSpdFJJdEXrLyw5SILMxcTNt5DTxT2Z93fXuLFYJBlZJdnwdalrQdB/rX5w==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-9.4.1.tgz", + "integrity": "sha512-YKSRsQqmeHxgra0KCdWA2FtVxDPUlBiCdmew+mSe44pzlx5t1ViRMWiQg18T+DREA+vSqYfKzynaToFR4hcKHw==", "requires": { "bluebird": "^3.5.3", "cacache": "^11.3.2", diff --git a/package.json b/package.json index 31d5ebcbe6b92..30635ff3c8f8e 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "once": "~1.4.0", "opener": "^1.5.1", "osenv": "^0.1.5", - "pacote": "^9.4.0", + "pacote": "^9.4.1", "path-is-inside": "~1.0.2", "promise-inflight": "~1.0.1", "qrcode-terminal": "^0.12.0",