diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-02-08 21:56:46 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2021-02-08 23:24:47 +0300 |
commit | f8dd557865ff69c2320f9a768209d051faca89de (patch) | |
tree | a846a0092e570b3c4466d4c3c2da4ae1e40e4f4d /node_modules/@npmcli | |
parent | 616c560a9a1f2b89c8aa448cf02ecef2215965ae (diff) |
@npmcli/arborist@2.2.1
Diffstat (limited to 'node_modules/@npmcli')
11 files changed, 9 insertions, 422 deletions
diff --git a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index ae92b74ce..4c2665021 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -398,6 +398,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { if (this[_global] && (this[_updateAll] || this[_updateNames].length)) { const nm = resolve(this.path, 'node_modules') for (const name of await readdir(nm)) { + tree.package.dependencies = tree.package.dependencies || {} if (this[_updateAll] || this[_updateNames].includes(name)) tree.package.dependencies[name] = '*' } diff --git a/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/LICENSE b/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/LICENSE deleted file mode 100644 index 20a476254..000000000 --- a/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. 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/@npmcli/arborist/node_modules/read-package-json-fast/README.md b/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/README.md deleted file mode 100644 index 5ab6adbec..000000000 --- a/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# read-package-json-fast - -Like [`read-package-json`](http://npm.im/read-package-json), but faster and -more accepting of "missing" data. - -This is only suitable for reading package.json files in a node_modules -tree, since it doesn't do the various cleanups, normalization, and warnings -that are beneficial at the root level in a package being published. - -## USAGE - -```js -const rpj = require('read-package-json-fast') - -// typical promisey type API -rpj('/path/to/package.json') - .then(data => ...) - .catch(er => ...) - -// or just normalize a package manifest -const normalized = rpj.normalize(packageJsonObject) -``` - -Errors raised from parsing will use -[`json-parse-even-better-errors`](http://npm.im/json-parse-even-better-errors), -so they'll be of type `JSONParseError` and have a `code: 'EJSONPARSE'` -property. Errors will also always have a `path` member referring to the -path originally passed into the function. - -## Indentation - -To preserve indentation when the file is saved back to disk, use -`data[Symbol.for('indent')]` as the third argument to `JSON.stringify`, and -if you want to preserve windows `\r\n` newlines, replace the `\n` chars in -the string with `data[Symbol.for('newline')]`. - -For example: - -```js -const data = await readPackageJsonFast('./package.json') -const indent = Symbol.for('indent') -const newline = Symbol.for('newline') -// .. do some stuff to the data .. -const string = JSON.stringify(data, null, data[indent]) + '\n' -const eolFixed = data[newline] === '\n' ? string - : string.replace(/\n/g, data[newline]) -await writeFile('./package.json', eolFixed) -``` - -Indentation is determined by looking at the whitespace between the initial -`{` and the first `"` that follows it. If you have lots of weird -inconsistent indentation, then it won't track that or give you any way to -preserve it. Whether this is a bug or a feature is debatable ;) - -## WHAT THIS MODULE DOES - -- Parse JSON -- Normalize `bundledDependencies`/`bundleDependencies` naming to just - `bundleDependencies` (without the extra `d`) -- Handle `true`, `false`, or object values passed to `bundleDependencies` -- Normalize `funding: <string>` to `funding: { url: <string> }` -- Remove any `scripts` members that are not a string value. -- Normalize a string `bin` member to `{ [name]: bin }`. -- Fold `optionalDependencies` into `dependencies`. -- Set the `_id` property if name and version are set. (This is - load-bearing in a few places within the npm CLI.) - -## WHAT THIS MODULE DOES NOT DO - -- Warn about invalid/missing name, version, repository, etc. -- Extract a description from the `README.md` file, or attach the readme to - the parsed data object. -- Read the `HEAD` value out of the `.git` folder. -- Warn about potentially typo'ed scripts (eg, `tset` instead of `test`) -- Check to make sure that all the files in the `files` field exist and are - valid files. -- Fix bundleDependencies that are not listed in `dependencies`. -- Fix `dependencies` fields that are not strictly objects of string values. -- Anything involving the `directories` field (ie, bins, mans, and so on). diff --git a/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/index.js b/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/index.js deleted file mode 100644 index bfef5d6ab..000000000 --- a/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/index.js +++ /dev/null @@ -1,82 +0,0 @@ -const {promisify} = require('util') -const fs = require('fs') -const readFile = promisify(fs.readFile) -const parse = require('json-parse-even-better-errors') -const rpj = path => readFile(path, 'utf8') - .then(data => normalize(parse(data))) - .catch(er => { - er.path = path - throw er - }) -const normalizePackageBin = require('npm-normalize-package-bin') - -const normalize = data => { - add_id(data) - fixBundled(data) - foldinOptionalDeps(data) - fixScripts(data) - fixFunding(data) - normalizePackageBin(data) - return data -} - -rpj.normalize = normalize - -const add_id = data => { - if (data.name && data.version) - data._id = `${data.name}@${data.version}` - return data -} - -const foldinOptionalDeps = data => { - const od = data.optionalDependencies - if (od && typeof od === 'object') { - data.dependencies = data.dependencies || {} - for (const [name, spec] of Object.entries(od)) { - data.dependencies[name] = spec - } - } - return data -} - -const fixBundled = data => { - const bdd = data.bundledDependencies - const bd = data.bundleDependencies === undefined ? bdd - : data.bundleDependencies - - if (bd === false) - data.bundleDependencies = [] - else if (bd === true) - data.bundleDependencies = Object.keys(data.dependencies || {}) - else if (bd && typeof bd === 'object') { - if (!Array.isArray(bd)) - data.bundleDependencies = Object.keys(bd) - else - data.bundleDependencies = bd - } else - delete data.bundleDependencies - - delete data.bundledDependencies - return data -} - -const fixScripts = data => { - if (!data.scripts || typeof data.scripts !== 'object') { - delete data.scripts - return data - } - - for (const [name, script] of Object.entries(data.scripts)) { - if (typeof script !== 'string') - delete data.scripts[name] - } - return data -} - -const fixFunding = data => { - if (data.funding && typeof data.funding === 'string') - data.funding = { url: data.funding } - return data -} - -module.exports = rpj diff --git a/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/package.json b/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/package.json deleted file mode 100644 index a59a3b2e8..000000000 --- a/node_modules/@npmcli/arborist/node_modules/read-package-json-fast/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "read-package-json-fast", - "version": "1.2.1", - "description": "Like read-package-json, but faster", - "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", - "license": "ISC", - "scripts": { - "test": "tap", - "snap": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" - }, - "tap": { - "check-coverage": true - }, - "devDependencies": { - "tap": "^14.10.1" - }, - "dependencies": { - "json-parse-even-better-errors": "^2.3.0", - "npm-normalize-package-bin": "^1.0.1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/read-package-json-fast.git" - }, - "files": [ - "index.js" - ] -} diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index fa2f18493..6e88b9cbb 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,15 +1,15 @@ { "name": "@npmcli/arborist", - "version": "2.2.0", + "version": "2.2.1", "description": "Manage node_modules trees", "dependencies": { - "@npmcli/installed-package-contents": "^1.0.5", - "@npmcli/map-workspaces": "^1.0.1", + "@npmcli/installed-package-contents": "^1.0.6", + "@npmcli/map-workspaces": "^1.0.2", "@npmcli/metavuln-calculator": "^1.0.1", "@npmcli/move-file": "^1.1.0", "@npmcli/name-from-folder": "^1.0.1", "@npmcli/node-gyp": "^1.0.1", - "@npmcli/run-script": "^1.8.1", + "@npmcli/run-script": "^1.8.2", "bin-links": "^2.2.1", "cacache": "^15.0.3", "common-ancestor-path": "^1.0.1", @@ -20,11 +20,11 @@ "npm-package-arg": "^8.1.0", "npm-pick-manifest": "^6.1.0", "npm-registry-fetch": "^9.0.0", - "pacote": "^11.2.5", + "pacote": "^11.2.6", "parse-conflict-json": "^1.1.1", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", - "read-package-json-fast": "^1.2.1", + "read-package-json-fast": "^2.0.1", "readdir-scoped-modules": "^1.1.0", "semver": "^7.3.4", "tar": "^6.1.0", diff --git a/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/LICENSE b/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/LICENSE deleted file mode 100644 index 20a476254..000000000 --- a/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. 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/@npmcli/map-workspaces/node_modules/read-package-json-fast/README.md b/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/README.md deleted file mode 100644 index 5ab6adbec..000000000 --- a/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# read-package-json-fast - -Like [`read-package-json`](http://npm.im/read-package-json), but faster and -more accepting of "missing" data. - -This is only suitable for reading package.json files in a node_modules -tree, since it doesn't do the various cleanups, normalization, and warnings -that are beneficial at the root level in a package being published. - -## USAGE - -```js -const rpj = require('read-package-json-fast') - -// typical promisey type API -rpj('/path/to/package.json') - .then(data => ...) - .catch(er => ...) - -// or just normalize a package manifest -const normalized = rpj.normalize(packageJsonObject) -``` - -Errors raised from parsing will use -[`json-parse-even-better-errors`](http://npm.im/json-parse-even-better-errors), -so they'll be of type `JSONParseError` and have a `code: 'EJSONPARSE'` -property. Errors will also always have a `path` member referring to the -path originally passed into the function. - -## Indentation - -To preserve indentation when the file is saved back to disk, use -`data[Symbol.for('indent')]` as the third argument to `JSON.stringify`, and -if you want to preserve windows `\r\n` newlines, replace the `\n` chars in -the string with `data[Symbol.for('newline')]`. - -For example: - -```js -const data = await readPackageJsonFast('./package.json') -const indent = Symbol.for('indent') -const newline = Symbol.for('newline') -// .. do some stuff to the data .. -const string = JSON.stringify(data, null, data[indent]) + '\n' -const eolFixed = data[newline] === '\n' ? string - : string.replace(/\n/g, data[newline]) -await writeFile('./package.json', eolFixed) -``` - -Indentation is determined by looking at the whitespace between the initial -`{` and the first `"` that follows it. If you have lots of weird -inconsistent indentation, then it won't track that or give you any way to -preserve it. Whether this is a bug or a feature is debatable ;) - -## WHAT THIS MODULE DOES - -- Parse JSON -- Normalize `bundledDependencies`/`bundleDependencies` naming to just - `bundleDependencies` (without the extra `d`) -- Handle `true`, `false`, or object values passed to `bundleDependencies` -- Normalize `funding: <string>` to `funding: { url: <string> }` -- Remove any `scripts` members that are not a string value. -- Normalize a string `bin` member to `{ [name]: bin }`. -- Fold `optionalDependencies` into `dependencies`. -- Set the `_id` property if name and version are set. (This is - load-bearing in a few places within the npm CLI.) - -## WHAT THIS MODULE DOES NOT DO - -- Warn about invalid/missing name, version, repository, etc. -- Extract a description from the `README.md` file, or attach the readme to - the parsed data object. -- Read the `HEAD` value out of the `.git` folder. -- Warn about potentially typo'ed scripts (eg, `tset` instead of `test`) -- Check to make sure that all the files in the `files` field exist and are - valid files. -- Fix bundleDependencies that are not listed in `dependencies`. -- Fix `dependencies` fields that are not strictly objects of string values. -- Anything involving the `directories` field (ie, bins, mans, and so on). diff --git a/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/index.js b/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/index.js deleted file mode 100644 index bfef5d6ab..000000000 --- a/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/index.js +++ /dev/null @@ -1,82 +0,0 @@ -const {promisify} = require('util') -const fs = require('fs') -const readFile = promisify(fs.readFile) -const parse = require('json-parse-even-better-errors') -const rpj = path => readFile(path, 'utf8') - .then(data => normalize(parse(data))) - .catch(er => { - er.path = path - throw er - }) -const normalizePackageBin = require('npm-normalize-package-bin') - -const normalize = data => { - add_id(data) - fixBundled(data) - foldinOptionalDeps(data) - fixScripts(data) - fixFunding(data) - normalizePackageBin(data) - return data -} - -rpj.normalize = normalize - -const add_id = data => { - if (data.name && data.version) - data._id = `${data.name}@${data.version}` - return data -} - -const foldinOptionalDeps = data => { - const od = data.optionalDependencies - if (od && typeof od === 'object') { - data.dependencies = data.dependencies || {} - for (const [name, spec] of Object.entries(od)) { - data.dependencies[name] = spec - } - } - return data -} - -const fixBundled = data => { - const bdd = data.bundledDependencies - const bd = data.bundleDependencies === undefined ? bdd - : data.bundleDependencies - - if (bd === false) - data.bundleDependencies = [] - else if (bd === true) - data.bundleDependencies = Object.keys(data.dependencies || {}) - else if (bd && typeof bd === 'object') { - if (!Array.isArray(bd)) - data.bundleDependencies = Object.keys(bd) - else - data.bundleDependencies = bd - } else - delete data.bundleDependencies - - delete data.bundledDependencies - return data -} - -const fixScripts = data => { - if (!data.scripts || typeof data.scripts !== 'object') { - delete data.scripts - return data - } - - for (const [name, script] of Object.entries(data.scripts)) { - if (typeof script !== 'string') - delete data.scripts[name] - } - return data -} - -const fixFunding = data => { - if (data.funding && typeof data.funding === 'string') - data.funding = { url: data.funding } - return data -} - -module.exports = rpj diff --git a/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/package.json b/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/package.json deleted file mode 100644 index a59a3b2e8..000000000 --- a/node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "read-package-json-fast", - "version": "1.2.1", - "description": "Like read-package-json, but faster", - "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", - "license": "ISC", - "scripts": { - "test": "tap", - "snap": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" - }, - "tap": { - "check-coverage": true - }, - "devDependencies": { - "tap": "^14.10.1" - }, - "dependencies": { - "json-parse-even-better-errors": "^2.3.0", - "npm-normalize-package-bin": "^1.0.1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/read-package-json-fast.git" - }, - "files": [ - "index.js" - ] -} diff --git a/node_modules/@npmcli/map-workspaces/package.json b/node_modules/@npmcli/map-workspaces/package.json index 2a66a7424..df509648d 100644 --- a/node_modules/@npmcli/map-workspaces/package.json +++ b/node_modules/@npmcli/map-workspaces/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/map-workspaces", - "version": "1.0.1", + "version": "1.0.2", "files": [ "index.js" ], @@ -52,6 +52,6 @@ "@npmcli/name-from-folder": "^1.0.1", "glob": "^7.1.6", "minimatch": "^3.0.4", - "read-package-json-fast": "^1.2.1" + "read-package-json-fast": "^2.0.1" } } |