Skip to content
Permalink
Browse files
deps: upgrade npm to 8.4.1
PR-URL: #41836
Reviewed-By: Ruy Adorno <ruyadorno@github.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
  • Loading branch information
npm-robot authored and ruyadorno committed Feb 8, 2022
1 parent 1ae6485 commit 28650eca00680b7f81cc8028d3d92205244469a0
Showing with 3,692 additions and 830 deletions.
  1. +4 −0 deps/npm/docs/content/configuring-npm/package-json.md
  2. +2 −0 deps/npm/docs/content/using-npm/config.md
  3. +1 −1 deps/npm/docs/output/commands/npm-ls.html
  4. +1 −1 deps/npm/docs/output/commands/npm.html
  5. +3 −0 deps/npm/docs/output/configuring-npm/package-json.html
  6. +1 −0 deps/npm/docs/output/using-npm/config.html
  7. +5 −1 deps/npm/lib/commands/access.js
  8. +24 −0 deps/npm/lib/commands/ci.js
  9. +3 −0 deps/npm/lib/commands/deprecate.js
  10. +2 −0 deps/npm/lib/commands/diff.js
  11. +4 −1 deps/npm/lib/commands/dist-tag.js
  12. +5 −1 deps/npm/lib/commands/hook.js
  13. +2 −1 deps/npm/lib/commands/logout.js
  14. +8 −3 deps/npm/lib/commands/outdated.js
  15. +5 −1 deps/npm/lib/commands/owner.js
  16. +1 −1 deps/npm/lib/commands/ping.js
  17. +4 −4 deps/npm/lib/commands/profile.js
  18. +1 −1 deps/npm/lib/commands/publish.js
  19. +3 −1 deps/npm/lib/commands/star.js
  20. +2 −1 deps/npm/lib/commands/team.js
  21. +1 −1 deps/npm/lib/commands/token.js
  22. +1 −1 deps/npm/lib/commands/unpublish.js
  23. +2 −1 deps/npm/lib/commands/whoami.js
  24. +2 −0 deps/npm/lib/utils/config/definitions.js
  25. +29 −0 deps/npm/lib/utils/validate-lockfile.js
  26. +1 −1 deps/npm/man/man1/npm-access.1
  27. +1 −1 deps/npm/man/man1/npm-adduser.1
  28. +1 −1 deps/npm/man/man1/npm-audit.1
  29. +1 −1 deps/npm/man/man1/npm-bin.1
  30. +1 −1 deps/npm/man/man1/npm-bugs.1
  31. +1 −1 deps/npm/man/man1/npm-cache.1
  32. +1 −1 deps/npm/man/man1/npm-ci.1
  33. +1 −1 deps/npm/man/man1/npm-completion.1
  34. +1 −1 deps/npm/man/man1/npm-config.1
  35. +1 −1 deps/npm/man/man1/npm-dedupe.1
  36. +1 −1 deps/npm/man/man1/npm-deprecate.1
  37. +1 −1 deps/npm/man/man1/npm-diff.1
  38. +1 −1 deps/npm/man/man1/npm-dist-tag.1
  39. +1 −1 deps/npm/man/man1/npm-docs.1
  40. +1 −1 deps/npm/man/man1/npm-doctor.1
  41. +1 −1 deps/npm/man/man1/npm-edit.1
  42. +1 −1 deps/npm/man/man1/npm-exec.1
  43. +1 −1 deps/npm/man/man1/npm-explain.1
  44. +1 −1 deps/npm/man/man1/npm-explore.1
  45. +1 −1 deps/npm/man/man1/npm-find-dupes.1
  46. +1 −1 deps/npm/man/man1/npm-fund.1
  47. +1 −1 deps/npm/man/man1/npm-help-search.1
  48. +1 −1 deps/npm/man/man1/npm-help.1
  49. +1 −1 deps/npm/man/man1/npm-hook.1
  50. +1 −1 deps/npm/man/man1/npm-init.1
  51. +1 −1 deps/npm/man/man1/npm-install-ci-test.1
  52. +1 −1 deps/npm/man/man1/npm-install-test.1
  53. +1 −1 deps/npm/man/man1/npm-install.1
  54. +1 −1 deps/npm/man/man1/npm-link.1
  55. +1 −1 deps/npm/man/man1/npm-logout.1
  56. +2 −2 deps/npm/man/man1/npm-ls.1
  57. +1 −1 deps/npm/man/man1/npm-org.1
  58. +1 −1 deps/npm/man/man1/npm-outdated.1
  59. +1 −1 deps/npm/man/man1/npm-owner.1
  60. +1 −1 deps/npm/man/man1/npm-pack.1
  61. +1 −1 deps/npm/man/man1/npm-ping.1
  62. +1 −1 deps/npm/man/man1/npm-pkg.1
  63. +1 −1 deps/npm/man/man1/npm-prefix.1
  64. +1 −1 deps/npm/man/man1/npm-profile.1
  65. +1 −1 deps/npm/man/man1/npm-prune.1
  66. +1 −1 deps/npm/man/man1/npm-publish.1
  67. +1 −1 deps/npm/man/man1/npm-rebuild.1
  68. +1 −1 deps/npm/man/man1/npm-repo.1
  69. +1 −1 deps/npm/man/man1/npm-restart.1
  70. +1 −1 deps/npm/man/man1/npm-root.1
  71. +1 −1 deps/npm/man/man1/npm-run-script.1
  72. +1 −1 deps/npm/man/man1/npm-search.1
  73. +1 −1 deps/npm/man/man1/npm-set-script.1
  74. +1 −1 deps/npm/man/man1/npm-shrinkwrap.1
  75. +1 −1 deps/npm/man/man1/npm-star.1
  76. +1 −1 deps/npm/man/man1/npm-stars.1
  77. +1 −1 deps/npm/man/man1/npm-start.1
  78. +1 −1 deps/npm/man/man1/npm-stop.1
  79. +1 −1 deps/npm/man/man1/npm-team.1
  80. +1 −1 deps/npm/man/man1/npm-test.1
  81. +1 −1 deps/npm/man/man1/npm-token.1
  82. +1 −1 deps/npm/man/man1/npm-uninstall.1
  83. +1 −1 deps/npm/man/man1/npm-unpublish.1
  84. +1 −1 deps/npm/man/man1/npm-unstar.1
  85. +1 −1 deps/npm/man/man1/npm-update.1
  86. +1 −1 deps/npm/man/man1/npm-version.1
  87. +1 −1 deps/npm/man/man1/npm-view.1
  88. +1 −1 deps/npm/man/man1/npm-whoami.1
  89. +2 −2 deps/npm/man/man1/npm.1
  90. +1 −1 deps/npm/man/man1/npx.1
  91. +1 −1 deps/npm/man/man5/folders.5
  92. +1 −1 deps/npm/man/man5/install.5
  93. +1 −1 deps/npm/man/man5/npm-shrinkwrap-json.5
  94. +1 −1 deps/npm/man/man5/npmrc.5
  95. +5 −1 deps/npm/man/man5/package-json.5
  96. +1 −1 deps/npm/man/man5/package-lock-json.5
  97. +3 −1 deps/npm/man/man7/config.7
  98. +1 −1 deps/npm/man/man7/developers.7
  99. +1 −1 deps/npm/man/man7/logging.7
  100. +1 −1 deps/npm/man/man7/orgs.7
  101. +1 −1 deps/npm/man/man7/registry.7
  102. +1 −1 deps/npm/man/man7/removal.7
  103. +1 −1 deps/npm/man/man7/scope.7
  104. +1 −1 deps/npm/man/man7/scripts.7
  105. +1 −1 deps/npm/man/man7/workspaces.7
  106. +17 −1 deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
  107. +7 −2 deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
  108. +18 −0 deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
  109. +7 −2 deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
  110. +2 −2 deps/npm/node_modules/@npmcli/arborist/package.json
  111. +2 −0 deps/npm/node_modules/@npmcli/fs/LICENSE.md
  112. +2 −1 deps/npm/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js
  113. +15 −0 deps/npm/node_modules/@npmcli/fs/lib/cp/LICENSE
  114. +22 −0 deps/npm/node_modules/@npmcli/fs/lib/cp/index.js
  115. +428 −0 deps/npm/node_modules/@npmcli/fs/lib/cp/polyfill.js
  116. +129 −0 deps/npm/node_modules/@npmcli/fs/lib/errors.js
  117. +1 −0 deps/npm/node_modules/@npmcli/fs/lib/index.js
  118. +2 −1 deps/npm/node_modules/@npmcli/fs/lib/rm/polyfill.js
  119. +12 −7 deps/npm/node_modules/@npmcli/fs/package.json
  120. +6 −6 deps/npm/node_modules/{object-assign/license → @tootallnate/once/LICENSE}
  121. +4 −11 deps/npm/node_modules/@tootallnate/once/dist/index.d.ts
  122. +21 −36 deps/npm/node_modules/@tootallnate/once/dist/index.js
  123. +1 −1 deps/npm/node_modules/@tootallnate/once/dist/index.js.map
  124. +231 −0 deps/npm/node_modules/@tootallnate/once/dist/overloaded-parameters.d.ts
  125. +3 −0 deps/npm/node_modules/@tootallnate/once/dist/overloaded-parameters.js
  126. +1 −0 deps/npm/node_modules/@tootallnate/once/dist/overloaded-parameters.js.map
  127. +17 −0 deps/npm/node_modules/@tootallnate/once/dist/types.d.ts
  128. +3 −0 deps/npm/node_modules/@tootallnate/once/dist/types.js
  129. +1 −0 deps/npm/node_modules/@tootallnate/once/dist/types.js.map
  130. +22 −15 deps/npm/node_modules/@tootallnate/once/package.json
  131. +4 −5 deps/npm/node_modules/cli-table3/package.json
  132. +4 −3 deps/npm/node_modules/cli-table3/src/layout-manager.js
  133. +4 −5 deps/npm/node_modules/cli-table3/src/utils.js
  134. +10 −9 deps/npm/node_modules/debug/LICENSE
  135. +6 −6 deps/npm/node_modules/debug/package.json
  136. +1 −1 deps/npm/node_modules/debug/src/common.js
  137. +1 −1 deps/npm/node_modules/graceful-fs/package.json
  138. +4 −2 deps/npm/node_modules/graceful-fs/polyfills.js
  139. +3 −3 deps/npm/node_modules/http-proxy-agent/dist/agent.js
  140. +1 −1 deps/npm/node_modules/http-proxy-agent/dist/agent.js.map
  141. +4 −4 deps/npm/node_modules/http-proxy-agent/package.json
  142. +5 −5 deps/npm/node_modules/is-core-module/core.json
  143. +7 −7 deps/npm/node_modules/is-core-module/package.json
  144. +2 −2 deps/npm/node_modules/libnpmaccess/package.json
  145. +1 −1 deps/npm/node_modules/libnpmexec/package.json
  146. +2 −2 deps/npm/node_modules/libnpmhook/package.json
  147. +2 −2 deps/npm/node_modules/libnpmorg/package.json
  148. +4 −4 deps/npm/node_modules/libnpmpublish/package.json
  149. +2 −2 deps/npm/node_modules/libnpmsearch/package.json
  150. +2 −2 deps/npm/node_modules/libnpmteam/package.json
  151. +1 −1 deps/npm/node_modules/make-fetch-happen/LICENSE
  152. +21 −12 deps/npm/node_modules/make-fetch-happen/lib/agent.js
  153. +65 −31 deps/npm/node_modules/make-fetch-happen/lib/cache/entry.js
  154. +1 −0 deps/npm/node_modules/make-fetch-happen/lib/cache/errors.js
  155. +8 −4 deps/npm/node_modules/make-fetch-happen/lib/cache/index.js
  156. +21 −21 deps/npm/node_modules/make-fetch-happen/lib/cache/policy.js
  157. +40 −22 deps/npm/node_modules/make-fetch-happen/lib/fetch.js
  158. +13 −9 deps/npm/node_modules/make-fetch-happen/lib/options.js
  159. +12 −6 deps/npm/node_modules/make-fetch-happen/lib/remote.js
  160. +18 −19 deps/npm/node_modules/make-fetch-happen/package.json
  161. +5 −0 deps/npm/node_modules/negotiator/HISTORY.md
  162. +4 −46 deps/npm/node_modules/negotiator/index.js
  163. +3 −3 deps/npm/node_modules/negotiator/lib/language.js
  164. +8 −8 deps/npm/node_modules/negotiator/package.json
  165. +14 −0 deps/npm/node_modules/node-gyp/node_modules/@tootallnate/once/dist/index.d.ts
  166. +39 −0 deps/npm/node_modules/node-gyp/node_modules/@tootallnate/once/dist/index.js
  167. +1 −0 deps/npm/node_modules/node-gyp/node_modules/@tootallnate/once/dist/index.js.map
  168. +45 −0 deps/npm/node_modules/node-gyp/node_modules/@tootallnate/once/package.json
  169. +32 −0 deps/npm/node_modules/node-gyp/node_modules/http-proxy-agent/dist/agent.d.ts
  170. +145 −0 deps/npm/node_modules/node-gyp/node_modules/http-proxy-agent/dist/agent.js
  171. +1 −0 deps/npm/node_modules/node-gyp/node_modules/http-proxy-agent/dist/agent.js.map
  172. +21 −0 deps/npm/node_modules/node-gyp/node_modules/http-proxy-agent/dist/index.d.ts
  173. +14 −0 deps/npm/node_modules/node-gyp/node_modules/http-proxy-agent/dist/index.js
  174. +1 −0 deps/npm/node_modules/node-gyp/node_modules/http-proxy-agent/dist/index.js.map
  175. +57 −0 deps/npm/node_modules/node-gyp/node_modules/http-proxy-agent/package.json
  176. +16 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/LICENSE
  177. +194 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/agent.js
  178. +460 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/entry.js
  179. +10 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/errors.js
  180. +45 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/index.js
  181. +17 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/key.js
  182. +161 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/policy.js
  183. +100 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/fetch.js
  184. +40 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/index.js
  185. +44 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/options.js
  186. +102 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/lib/remote.js
  187. +76 −0 deps/npm/node_modules/node-gyp/node_modules/make-fetch-happen/package.json
  188. +0 −15 deps/npm/node_modules/npm-profile/LICENSE
  189. +20 −0 deps/npm/node_modules/npm-profile/LICENSE.md
  190. +23 −19 deps/npm/node_modules/npm-profile/{ → lib}/index.js
  191. +18 −12 deps/npm/node_modules/npm-profile/package.json
  192. +15 −11 deps/npm/node_modules/npm-registry-fetch/LICENSE.md
  193. +9 −7 deps/npm/node_modules/npm-registry-fetch/{ → lib}/auth.js
  194. +12 −4 deps/npm/node_modules/npm-registry-fetch/{ → lib}/check-response.js
  195. +1 −1 deps/npm/node_modules/npm-registry-fetch/{ → lib}/default-opts.js
  196. +3 −2 deps/npm/node_modules/npm-registry-fetch/{ → lib}/errors.js
  197. +37 −18 deps/npm/node_modules/npm-registry-fetch/{ → lib}/index.js
  198. 0 deps/npm/node_modules/npm-registry-fetch/{ → lib}/silentlog.js
  199. +16 −14 deps/npm/node_modules/npm-registry-fetch/package.json
  200. +0 −90 deps/npm/node_modules/object-assign/index.js
  201. +0 −42 deps/npm/node_modules/object-assign/package.json
  202. +0 −61 deps/npm/node_modules/object-assign/readme.md
  203. +2 −2 deps/npm/node_modules/pacote/package.json
  204. +2 −2 deps/npm/node_modules/socks-proxy-agent/package.json
  205. +4 −0 deps/npm/node_modules/spdx-license-ids/index.json
  206. +5 −6 deps/npm/node_modules/spdx-license-ids/package.json
  207. 0 deps/npm/node_modules/wide-align/LICENSE
  208. 0 deps/npm/node_modules/wide-align/align.js
  209. +5 −5 deps/npm/node_modules/wide-align/package.json
  210. +15 −15 deps/npm/package.json
  211. +11 −0 deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs
  212. +13 −0 deps/npm/tap-snapshots/test/lib/commands/ci.js.test.cjs
  213. +6 −0 deps/npm/tap-snapshots/test/lib/commands/outdated.js.test.cjs
  214. +2 −0 deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs
  215. +2 −0 deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
  216. +35 −0 deps/npm/tap-snapshots/test/lib/utils/validate-lockfile.js.test.cjs
  217. +3 −2 deps/npm/test/lib/commands/access.js
  218. +84 −1 deps/npm/test/lib/commands/ci.js
  219. +10 −0 deps/npm/test/lib/commands/deprecate.js
  220. +2 −1 deps/npm/test/lib/commands/diff.js
  221. +13 −1 deps/npm/test/lib/commands/dist-tag.js
  222. +42 −21 deps/npm/test/lib/commands/hook.js
  223. +9 −6 deps/npm/test/lib/commands/logout.js
  224. +25 −0 deps/npm/test/lib/commands/outdated.js
  225. +20 −6 deps/npm/test/lib/commands/owner.js
  226. +6 −3 deps/npm/test/lib/commands/ping.js
  227. +13 −7 deps/npm/test/lib/commands/publish.js
  228. +25 −19 deps/npm/test/lib/commands/star.js
  229. +82 −0 deps/npm/test/lib/utils/validate-lockfile.js
@@ -838,6 +838,10 @@ include any versions, as that information is specified in `dependencies`.
If this is spelled `"bundleDependencies"`, then that is also honored.
Alternatively, `"bundledDependencies"` can be defined as a boolean value. A
value of `true` will bundle all dependencies, a value of `false` will bundle
none.
### optionalDependencies
If a dependency can be used, but you would like npm to proceed if it cannot
@@ -1190,6 +1190,8 @@ When package package-locks are disabled, automatic pruning of extraneous
modules will also be disabled. To remove extraneous modules with
package-locks disabled use `npm prune`.

This configuration does not affect `npm ci`.

<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

@@ -160,7 +160,7 @@ <h3 id="description">Description</h3>
the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For
example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
<pre lang="bash"><code>npm@8.3.2 /path/to/npm
<pre lang="bash"><code>npm@8.4.1 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
@@ -149,7 +149,7 @@ <h2 id="table-of-contents">Table of contents</h2>
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>8.3.2</p>
<p>8.4.1</p>
<h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
@@ -774,6 +774,9 @@ <h3 id="bundleddependencies">bundledDependencies</h3>
can be installed in a new project by executing <code>npm install awesome-web-framework-1.0.0.tgz</code>. Note that the package names do not
include any versions, as that information is specified in <code>dependencies</code>.</p>
<p>If this is spelled <code>"bundleDependencies"</code>, then that is also honored.</p>
<p>Alternatively, <code>"bundledDependencies"</code> can be defined as a boolean value. A
value of <code>true</code> will bundle all dependencies, a value of <code>false</code> will bundle
none.</p>
<h3 id="optionaldependencies">optionalDependencies</h3>
<p>If a dependency can be used, but you would like npm to proceed if it cannot
be found or fails to install, then you may put it in the
@@ -1100,6 +1100,7 @@ <h4 id="package-lock"><code>package-lock</code></h4>
<p>When package package-locks are disabled, automatic pruning of extraneous
modules will also be disabled. To remove extraneous modules with
package-locks disabled use <code>npm prune</code>.</p>
<p>This configuration does not affect <code>npm ci</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="package-lock-only"><code>package-lock-only</code></h4>
@@ -3,6 +3,7 @@ const path = require('path')
const libaccess = require('libnpmaccess')
const readPackageJson = require('read-package-json-fast')

const log = require('../utils/log-shim.js')
const otplease = require('../utils/otplease.js')
const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
@@ -76,7 +77,10 @@ class Access extends BaseCommand {
throw this.usageError(`${cmd} is not a recognized subcommand.`)
}

return this[cmd](args, this.npm.flatOptions)
return this[cmd](args, {
...this.npm.flatOptions,
log,
})
}

public ([pkg], opts) {
@@ -6,6 +6,7 @@ const runScript = require('@npmcli/run-script')
const fs = require('fs')
const readdir = util.promisify(fs.readdir)
const log = require('../utils/log-shim.js')
const validateLockfile = require('../utils/validate-lockfile.js')

const removeNodeModules = async where => {
const rimrafOpts = { glob: false }
@@ -37,6 +38,7 @@ class CI extends ArboristWorkspaceCmd {
const where = this.npm.prefix
const opts = {
...this.npm.flatOptions,
packageLock: true, // npm ci should never skip lock files
path: where,
log,
save: false, // npm ci should never modify the lockfile or package.json
@@ -55,6 +57,28 @@ class CI extends ArboristWorkspaceCmd {
}),
removeNodeModules(where),
])

// retrieves inventory of packages from loaded virtual tree (lock file)
const virtualInventory = new Map(arb.virtualTree.inventory)

// build ideal tree step needs to come right after retrieving the virtual
// inventory since it's going to erase the previous ref to virtualTree
await arb.buildIdealTree()

// verifies that the packages from the ideal tree will match
// the same versions that are present in the virtual tree (lock file)
// throws a validation error in case of mismatches
const errors = validateLockfile(virtualInventory, arb.idealTree.inventory)
if (errors.length) {
throw new Error(
'`npm ci` can only install packages when your package.json and ' +
'package-lock.json or npm-shrinkwrap.json are in sync. Please ' +
'update your lock file with `npm install` ' +
'before continuing.\n\n' +
errors.join('\n') + '\n'
)
}

await arb.reify(opts)

const ignoreScripts = this.npm.config.get('ignore-scripts')
@@ -1,4 +1,5 @@
const fetch = require('npm-registry-fetch')
const log = require('../utils/log-shim.js')
const otplease = require('../utils/otplease.js')
const npa = require('npm-package-arg')
const semver = require('semver')
@@ -50,6 +51,7 @@ class Deprecate extends BaseCommand {
...this.npm.flatOptions,
spec: p,
query: { write: true },
log,
})

Object.keys(packument.versions)
@@ -64,6 +66,7 @@ class Deprecate extends BaseCommand {
method: 'PUT',
body: packument,
ignoreBody: true,
log,
}))
}
}
@@ -61,6 +61,7 @@ class Diff extends BaseCommand {
...this.npm.flatOptions,
diffFiles: args,
where: this.top,
log,
})
return this.npm.output(res)
}
@@ -193,6 +194,7 @@ class Diff extends BaseCommand {
const packument = await pacote.packument(spec, {
...this.npm.flatOptions,
preferOnline: true,
log,
})
bSpec = pickManifest(
packument,
@@ -29,7 +29,10 @@ class DistTag extends BaseCommand {
}

async exec ([cmdName, pkg, tag]) {
const opts = this.npm.flatOptions
const opts = {
...this.npm.flatOptions,
log,
}

if (['add', 'a', 'set', 's'].includes(cmdName)) {
return this.add(pkg, tag, opts)
@@ -2,6 +2,7 @@ const hookApi = require('libnpmhook')
const otplease = require('../utils/otplease.js')
const relativeDate = require('tiny-relative-date')
const Table = require('cli-table3')
const log = require('../utils/log-shim.js')

const BaseCommand = require('../base-command.js')
class Hook extends BaseCommand {
@@ -20,7 +21,10 @@ class Hook extends BaseCommand {
]

async exec (args) {
return otplease(this.npm.flatOptions, (opts) => {
return otplease({
...this.npm.flatOptions,
log,
}, (opts) => {
switch (args[0]) {
case 'add':
return this.add(args[1], args[2], args[3], opts)
@@ -1,4 +1,4 @@
const getAuth = require('npm-registry-fetch/auth.js')
const getAuth = require('npm-registry-fetch/lib/auth.js')
const npmFetch = require('npm-registry-fetch')
const log = require('../utils/log-shim')
const BaseCommand = require('../base-command.js')
@@ -25,6 +25,7 @@ class Logout extends BaseCommand {
...this.npm.flatOptions,
method: 'DELETE',
ignoreBody: true,
log,
})
} else if (auth.isBasicAuth) {
log.verbose('logout', `clearing user credentials for ${reg}`)
@@ -193,7 +193,12 @@ class Outdated extends ArboristWorkspaceCmd {
}

async getOutdatedInfo (edge) {
const spec = npa(edge.name)
let alias = false
try {
alias = npa(edge.spec).subSpec
} catch (err) {
}
const spec = npa(alias ? alias.name : edge.name)
const node = edge.to || edge
const { path, location } = node
const { version: current } = node.package || {}
@@ -217,7 +222,7 @@ class Outdated extends ArboristWorkspaceCmd {

try {
const packument = await this.getPackument(spec)
const expected = edge.spec
const expected = alias ? alias.fetchSpec : edge.spec
// if it's not a range, version, or tag, skip it
try {
if (!npa(`${edge.name}@${edge.spec}`).registry) {
@@ -239,7 +244,7 @@ class Outdated extends ArboristWorkspaceCmd {
: 'global'

this.list.push({
name: edge.name,
name: alias ? edge.spec.replace('npm', edge.name) : edge.name,
path,
type,
current,
@@ -57,7 +57,10 @@ class Owner extends BaseCommand {
}

async exec ([action, ...args]) {
const opts = this.npm.flatOptions
const opts = {
...this.npm.flatOptions,
log,
}
switch (action) {
case 'ls':
case 'list':
@@ -195,6 +198,7 @@ class Owner extends BaseCommand {
method: 'PUT',
body,
spec,
log,
})
})

@@ -10,7 +10,7 @@ class Ping extends BaseCommand {
async exec (args) {
log.notice('PING', this.npm.config.get('registry'))
const start = Date.now()
const details = await pingUtil(this.npm.flatOptions)
const details = await pingUtil({ ...this.npm.flatOptions, log })
const time = Date.now() - start
log.notice('PONG', `${time}ms`)
if (this.npm.config.get('json')) {
@@ -108,7 +108,7 @@ class Profile extends BaseCommand {
async get (args) {
const tfa = 'two-factor auth'
const info = await pulseTillDone.withPromise(
npmProfile.get(this.npm.flatOptions)
npmProfile.get({ ...this.npm.flatOptions, log })
)

if (!info.cidr_whitelist) {
@@ -170,7 +170,7 @@ class Profile extends BaseCommand {
}

async set (args) {
const conf = this.npm.flatOptions
const conf = { ...this.npm.flatOptions, log }
const prop = (args[0] || '').toLowerCase().trim()

let value = args.length > 1 ? args.slice(1).join(' ') : null
@@ -285,7 +285,7 @@ class Profile extends BaseCommand {
if (auth.basic) {
log.info('profile', 'Updating authentication to bearer token')
const result = await npmProfile.createToken(
auth.basic.password, false, [], this.npm.flatOptions
auth.basic.password, false, [], { ...this.npm.flatOptions, log }
)

if (!result.token) {
@@ -309,7 +309,7 @@ class Profile extends BaseCommand {

log.info('profile', 'Determine if tfa is pending')
const userInfo = await pulseTillDone.withPromise(
npmProfile.get(this.npm.flatOptions)
npmProfile.get({ ...this.npm.flatOptions, log })
)

const conf = { ...this.npm.flatOptions }
@@ -61,7 +61,7 @@ class Publish extends BaseCommand {
throw new Error('Tag name must not be a valid SemVer range: ' + defaultTag.trim())
}

const opts = { ...this.npm.flatOptions }
const opts = { ...this.npm.flatOptions, log }

// you can publish name@version, ./foo.tgz, etc.
// even though the default is the 'file:.' cwd.
@@ -29,12 +29,13 @@ class Star extends BaseCommand {
const pkgs = args.map(npa)
for (const pkg of pkgs) {
const [username, fullData] = await Promise.all([
getIdentity(this.npm, this.npm.flatOptions),
getIdentity(this.npm, { ...this.npm.flatOptions, log }),
fetch.json(pkg.escapedName, {
...this.npm.flatOptions,
spec: pkg,
query: { write: true },
preferOnline: true,
log,
}),
])

@@ -63,6 +64,7 @@ class Star extends BaseCommand {
spec: pkg,
method: 'PUT',
body,
log,
})

this.npm.output(show + ' ' + pkg.name)
@@ -1,6 +1,7 @@
const columns = require('cli-columns')
const libteam = require('libnpmteam')

const log = require('../utils/log-shim.js')
const otplease = require('../utils/otplease.js')

const BaseCommand = require('../base-command.js')
@@ -42,7 +43,7 @@ class Team extends BaseCommand {
// XXX: "description" option to libnpmteam is used as a description of the
// team, but in npm's options, this is a boolean meaning "show the
// description in npm search output". Hence its being set to null here.
await otplease(this.npm.flatOptions, opts => {
await otplease({ ...this.npm.flatOptions, log }, opts => {
entity = entity.replace(/^@/, '')
switch (cmd) {
case 'create': return this.create(entity, opts)
@@ -168,7 +168,7 @@ class Token extends BaseCommand {
}

config () {
const conf = { ...this.npm.flatOptions }
const conf = { ...this.npm.flatOptions, log }
const creds = this.npm.config.getCredentialsByURI(conf.registry)
if (creds.token) {
conf.auth = { token: creds.token }
@@ -32,7 +32,7 @@ class Unpublish extends BaseCommand {
return []
}

const opts = this.npm.flatOptions
const opts = { ...this.npm.flatOptions, log }
const username = await getIdentity(this.npm, { ...opts }).catch(() => null)
if (!username) {
return []
@@ -1,4 +1,5 @@
const getIdentity = require('../utils/get-identity.js')
const log = require('../utils/log-shim.js')

const BaseCommand = require('../base-command.js')
class Whoami extends BaseCommand {
@@ -7,7 +8,7 @@ class Whoami extends BaseCommand {
static params = ['registry']

async exec (args) {
const username = await getIdentity(this.npm, this.npm.flatOptions)
const username = await getIdentity(this.npm, { ...this.npm.flatOptions, log })
this.npm.output(
this.npm.config.get('json') ? JSON.stringify(username) : username
)
@@ -1417,6 +1417,8 @@ define('package-lock', {
When package package-locks are disabled, automatic pruning of extraneous
modules will also be disabled. To remove extraneous modules with
package-locks disabled use \`npm prune\`.
This configuration does not affect \`npm ci\`.
`,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)

0 comments on commit 28650ec

Please sign in to comment.