summaryrefslogtreecommitdiff
path: root/deps/node/deps/npm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'deps/node/deps/npm/lib')
-rw-r--r--deps/node/deps/npm/lib/access.js198
-rw-r--r--deps/node/deps/npm/lib/adduser.js49
-rw-r--r--deps/node/deps/npm/lib/audit.js302
-rw-r--r--deps/node/deps/npm/lib/auth/legacy.js79
-rw-r--r--deps/node/deps/npm/lib/auth/oauth.js7
-rw-r--r--deps/node/deps/npm/lib/auth/saml.js7
-rw-r--r--deps/node/deps/npm/lib/auth/sso.js73
-rw-r--r--deps/node/deps/npm/lib/bin.js23
-rw-r--r--deps/node/deps/npm/lib/bugs.js31
-rw-r--r--deps/node/deps/npm/lib/build.js140
-rw-r--r--deps/node/deps/npm/lib/cache.js137
-rw-r--r--deps/node/deps/npm/lib/ci.js19
-rw-r--r--deps/node/deps/npm/lib/completion.js248
-rw-r--r--deps/node/deps/npm/lib/config.js286
-rw-r--r--deps/node/deps/npm/lib/config/bin-links.js32
-rw-r--r--deps/node/deps/npm/lib/config/clear-credentials-by-uri.js16
-rw-r--r--deps/node/deps/npm/lib/config/cmd-list.js135
-rw-r--r--deps/node/deps/npm/lib/config/core.js429
-rw-r--r--deps/node/deps/npm/lib/config/defaults.js433
-rw-r--r--deps/node/deps/npm/lib/config/fetch-opts.js77
-rw-r--r--deps/node/deps/npm/lib/config/figgy-config.js87
-rw-r--r--deps/node/deps/npm/lib/config/gentle-fs.js32
-rw-r--r--deps/node/deps/npm/lib/config/get-credentials-by-uri.js78
-rw-r--r--deps/node/deps/npm/lib/config/lifecycle.js31
-rw-r--r--deps/node/deps/npm/lib/config/load-cafile.js32
-rw-r--r--deps/node/deps/npm/lib/config/load-prefix.js51
-rw-r--r--deps/node/deps/npm/lib/config/load-uid.js15
-rw-r--r--deps/node/deps/npm/lib/config/nerf-dart.js23
-rw-r--r--deps/node/deps/npm/lib/config/set-credentials-by-uri.js39
-rw-r--r--deps/node/deps/npm/lib/config/set-user.js29
-rw-r--r--deps/node/deps/npm/lib/dedupe.js160
-rw-r--r--deps/node/deps/npm/lib/deprecate.js72
-rw-r--r--deps/node/deps/npm/lib/dist-tag.js163
-rw-r--r--deps/node/deps/npm/lib/docs.js41
-rw-r--r--deps/node/deps/npm/lib/doctor.js113
-rw-r--r--deps/node/deps/npm/lib/doctor/check-files-permission.js57
-rw-r--r--deps/node/deps/npm/lib/doctor/check-ping.js16
-rw-r--r--deps/node/deps/npm/lib/doctor/get-git-path.js13
-rw-r--r--deps/node/deps/npm/lib/doctor/get-latest-nodejs-version.js27
-rw-r--r--deps/node/deps/npm/lib/doctor/get-latest-npm-version.js14
-rw-r--r--deps/node/deps/npm/lib/doctor/verify-cached-files.js19
-rw-r--r--deps/node/deps/npm/lib/edit.js49
-rw-r--r--deps/node/deps/npm/lib/explore.js59
-rw-r--r--deps/node/deps/npm/lib/fetch-package-metadata.js118
-rw-r--r--deps/node/deps/npm/lib/fetch-package-metadata.md37
-rw-r--r--deps/node/deps/npm/lib/get.js12
-rw-r--r--deps/node/deps/npm/lib/help-search.js212
-rw-r--r--deps/node/deps/npm/lib/help.js247
-rw-r--r--deps/node/deps/npm/lib/hook.js152
-rw-r--r--deps/node/deps/npm/lib/init.js85
-rw-r--r--deps/node/deps/npm/lib/install-ci-test.js26
-rw-r--r--deps/node/deps/npm/lib/install-test.js26
-rw-r--r--deps/node/deps/npm/lib/install.js1016
-rw-r--r--deps/node/deps/npm/lib/install/access-error.js8
-rw-r--r--deps/node/deps/npm/lib/install/action/build.js13
-rw-r--r--deps/node/deps/npm/lib/install/action/extract-worker.js18
-rw-r--r--deps/node/deps/npm/lib/install/action/extract.js139
-rw-r--r--deps/node/deps/npm/lib/install/action/fetch.js16
-rw-r--r--deps/node/deps/npm/lib/install/action/finalize.js106
-rw-r--r--deps/node/deps/npm/lib/install/action/global-install.js17
-rw-r--r--deps/node/deps/npm/lib/install/action/global-link.js8
-rw-r--r--deps/node/deps/npm/lib/install/action/install.js8
-rw-r--r--deps/node/deps/npm/lib/install/action/move.js96
-rw-r--r--deps/node/deps/npm/lib/install/action/postinstall.js8
-rw-r--r--deps/node/deps/npm/lib/install/action/preinstall.js8
-rw-r--r--deps/node/deps/npm/lib/install/action/prepare.js27
-rw-r--r--deps/node/deps/npm/lib/install/action/refresh-package-json.js45
-rw-r--r--deps/node/deps/npm/lib/install/action/remove.js85
-rw-r--r--deps/node/deps/npm/lib/install/action/unbuild.js16
-rw-r--r--deps/node/deps/npm/lib/install/actions.js192
-rw-r--r--deps/node/deps/npm/lib/install/and-add-parent-to-errors.js13
-rw-r--r--deps/node/deps/npm/lib/install/and-finish-tracker.js16
-rw-r--r--deps/node/deps/npm/lib/install/and-ignore-errors.js9
-rw-r--r--deps/node/deps/npm/lib/install/audit.js279
-rw-r--r--deps/node/deps/npm/lib/install/check-permissions.js69
-rw-r--r--deps/node/deps/npm/lib/install/copy-tree.js30
-rw-r--r--deps/node/deps/npm/lib/install/decompose-actions.js79
-rw-r--r--deps/node/deps/npm/lib/install/deps.js816
-rw-r--r--deps/node/deps/npm/lib/install/diff-trees.js260
-rw-r--r--deps/node/deps/npm/lib/install/exists.js27
-rw-r--r--deps/node/deps/npm/lib/install/flatten-tree.js42
-rw-r--r--deps/node/deps/npm/lib/install/get-requested.js12
-rw-r--r--deps/node/deps/npm/lib/install/has-modern-meta.js20
-rw-r--r--deps/node/deps/npm/lib/install/inflate-bundled.js18
-rw-r--r--deps/node/deps/npm/lib/install/inflate-shrinkwrap.js233
-rw-r--r--deps/node/deps/npm/lib/install/is-dev-dep.js8
-rw-r--r--deps/node/deps/npm/lib/install/is-extraneous.js27
-rw-r--r--deps/node/deps/npm/lib/install/is-fs-access-available.js22
-rw-r--r--deps/node/deps/npm/lib/install/is-only-dev.js36
-rw-r--r--deps/node/deps/npm/lib/install/is-only-optional.js20
-rw-r--r--deps/node/deps/npm/lib/install/is-opt-dep.js8
-rw-r--r--deps/node/deps/npm/lib/install/is-prod-dep.js9
-rw-r--r--deps/node/deps/npm/lib/install/module-staging-path.js8
-rw-r--r--deps/node/deps/npm/lib/install/mutate-into-logical-tree.js140
-rw-r--r--deps/node/deps/npm/lib/install/node.js77
-rw-r--r--deps/node/deps/npm/lib/install/read-shrinkwrap.js108
-rw-r--r--deps/node/deps/npm/lib/install/realize-shrinkwrap-specifier.js22
-rw-r--r--deps/node/deps/npm/lib/install/report-optional-failure.js31
-rw-r--r--deps/node/deps/npm/lib/install/save.js189
-rw-r--r--deps/node/deps/npm/lib/install/update-package-json.js56
-rw-r--r--deps/node/deps/npm/lib/install/validate-args.js73
-rw-r--r--deps/node/deps/npm/lib/install/validate-tree.js95
-rw-r--r--deps/node/deps/npm/lib/install/writable.js35
-rw-r--r--deps/node/deps/npm/lib/link.js197
-rw-r--r--deps/node/deps/npm/lib/logout.js44
-rw-r--r--deps/node/deps/npm/lib/ls.js548
-rw-r--r--deps/node/deps/npm/lib/npm.js476
-rw-r--r--deps/node/deps/npm/lib/org.js151
-rw-r--r--deps/node/deps/npm/lib/outdated.js433
-rw-r--r--deps/node/deps/npm/lib/owner.js242
-rw-r--r--deps/node/deps/npm/lib/pack.js361
-rw-r--r--deps/node/deps/npm/lib/ping.js47
-rw-r--r--deps/node/deps/npm/lib/prefix.js15
-rw-r--r--deps/node/deps/npm/lib/profile.js334
-rw-r--r--deps/node/deps/npm/lib/prune.js68
-rw-r--r--deps/node/deps/npm/lib/publish.js167
-rw-r--r--deps/node/deps/npm/lib/rebuild.js78
-rw-r--r--deps/node/deps/npm/lib/repo.js50
-rw-r--r--deps/node/deps/npm/lib/restart.js1
-rw-r--r--deps/node/deps/npm/lib/root.js15
-rw-r--r--deps/node/deps/npm/lib/run-script.js185
-rw-r--r--deps/node/deps/npm/lib/search.js114
-rw-r--r--deps/node/deps/npm/lib/search/all-package-metadata.js313
-rw-r--r--deps/node/deps/npm/lib/search/all-package-search.js50
-rw-r--r--deps/node/deps/npm/lib/search/format-package-stream.js172
-rw-r--r--deps/node/deps/npm/lib/search/package-filter.js41
-rw-r--r--deps/node/deps/npm/lib/set.js13
-rw-r--r--deps/node/deps/npm/lib/shrinkwrap.js275
-rw-r--r--deps/node/deps/npm/lib/star.js77
-rw-r--r--deps/node/deps/npm/lib/stars.js37
-rw-r--r--deps/node/deps/npm/lib/start.js1
-rw-r--r--deps/node/deps/npm/lib/stop.js1
-rw-r--r--deps/node/deps/npm/lib/substack.js22
-rw-r--r--deps/node/deps/npm/lib/team.js171
-rw-r--r--deps/node/deps/npm/lib/test.js16
-rw-r--r--deps/node/deps/npm/lib/token.js230
-rw-r--r--deps/node/deps/npm/lib/unbuild.js132
-rw-r--r--deps/node/deps/npm/lib/uninstall.js79
-rw-r--r--deps/node/deps/npm/lib/unpublish.js110
-rw-r--r--deps/node/deps/npm/lib/update.js72
-rw-r--r--deps/node/deps/npm/lib/utils/ansi-trim.js7
-rw-r--r--deps/node/deps/npm/lib/utils/child-path.js10
-rwxr-xr-xdeps/node/deps/npm/lib/utils/completion.sh61
-rw-r--r--deps/node/deps/npm/lib/utils/completion/file-completion.js24
-rw-r--r--deps/node/deps/npm/lib/utils/completion/installed-deep.js52
-rw-r--r--deps/node/deps/npm/lib/utils/completion/installed-shallow.js87
-rw-r--r--deps/node/deps/npm/lib/utils/correct-mkdir.js123
-rw-r--r--deps/node/deps/npm/lib/utils/deep-sort-object.js14
-rw-r--r--deps/node/deps/npm/lib/utils/depr-check.js23
-rw-r--r--deps/node/deps/npm/lib/utils/did-you-mean.js17
-rw-r--r--deps/node/deps/npm/lib/utils/error-handler.js252
-rw-r--r--deps/node/deps/npm/lib/utils/error-message.js367
-rw-r--r--deps/node/deps/npm/lib/utils/escape-arg.js27
-rw-r--r--deps/node/deps/npm/lib/utils/escape-exec-path.js30
-rw-r--r--deps/node/deps/npm/lib/utils/gently-rm.js21
-rw-r--r--deps/node/deps/npm/lib/utils/git.js50
-rw-r--r--deps/node/deps/npm/lib/utils/gunzip-maybe.js22
-rw-r--r--deps/node/deps/npm/lib/utils/is-registry.js11
-rw-r--r--deps/node/deps/npm/lib/utils/is-windows-bash.js4
-rw-r--r--deps/node/deps/npm/lib/utils/is-windows-shell.js4
-rw-r--r--deps/node/deps/npm/lib/utils/is-windows.js2
-rw-r--r--deps/node/deps/npm/lib/utils/lifecycle-cmd.js18
-rw-r--r--deps/node/deps/npm/lib/utils/lifecycle.js14
-rw-r--r--deps/node/deps/npm/lib/utils/link.js8
-rw-r--r--deps/node/deps/npm/lib/utils/locker.js73
-rw-r--r--deps/node/deps/npm/lib/utils/metrics-launch.js40
-rw-r--r--deps/node/deps/npm/lib/utils/metrics.js77
-rw-r--r--deps/node/deps/npm/lib/utils/module-name.js31
-rw-r--r--deps/node/deps/npm/lib/utils/move.js12
-rw-r--r--deps/node/deps/npm/lib/utils/no-progress-while-running.js23
-rw-r--r--deps/node/deps/npm/lib/utils/open-url.js16
-rw-r--r--deps/node/deps/npm/lib/utils/otplease.js27
-rw-r--r--deps/node/deps/npm/lib/utils/output.js8
-rw-r--r--deps/node/deps/npm/lib/utils/package-id.js15
-rw-r--r--deps/node/deps/npm/lib/utils/parse-json.js25
-rw-r--r--deps/node/deps/npm/lib/utils/perf.js26
-rw-r--r--deps/node/deps/npm/lib/utils/pick-manifest-from-registry-metadata.js26
-rw-r--r--deps/node/deps/npm/lib/utils/pulse-till-done.js38
-rw-r--r--deps/node/deps/npm/lib/utils/read-local-package.js12
-rw-r--r--deps/node/deps/npm/lib/utils/read-user-info.js73
-rw-r--r--deps/node/deps/npm/lib/utils/save-stack.js16
-rw-r--r--deps/node/deps/npm/lib/utils/spawn.js50
-rw-r--r--deps/node/deps/npm/lib/utils/temp-filename.js7
-rw-r--r--deps/node/deps/npm/lib/utils/umask.js17
-rw-r--r--deps/node/deps/npm/lib/utils/unix-format-path.js5
-rw-r--r--deps/node/deps/npm/lib/utils/unsupported.js53
-rw-r--r--deps/node/deps/npm/lib/utils/usage.js27
-rw-r--r--deps/node/deps/npm/lib/utils/warn-deprecated.js23
-rw-r--r--deps/node/deps/npm/lib/version.js345
-rw-r--r--deps/node/deps/npm/lib/view.js512
-rw-r--r--deps/node/deps/npm/lib/visnup.js43
-rw-r--r--deps/node/deps/npm/lib/whoami.js63
-rw-r--r--deps/node/deps/npm/lib/xmas.js59
193 files changed, 0 insertions, 17897 deletions
diff --git a/deps/node/deps/npm/lib/access.js b/deps/node/deps/npm/lib/access.js
deleted file mode 100644
index 4bb93fda..00000000
--- a/deps/node/deps/npm/lib/access.js
+++ /dev/null
@@ -1,198 +0,0 @@
-'use strict'
-/* eslint-disable standard/no-callback-literal */
-
-const BB = require('bluebird')
-
-const figgyPudding = require('figgy-pudding')
-const libaccess = require('libnpm/access')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const otplease = require('./utils/otplease.js')
-const path = require('path')
-const prefix = require('./npm.js').prefix
-const readPackageJson = BB.promisify(require('read-package-json'))
-const usage = require('./utils/usage.js')
-const whoami = require('./whoami.js')
-
-module.exports = access
-
-access.usage = usage(
- 'npm access',
- 'npm access public [<package>]\n' +
- 'npm access restricted [<package>]\n' +
- 'npm access grant <read-only|read-write> <scope:team> [<package>]\n' +
- 'npm access revoke <scope:team> [<package>]\n' +
- 'npm access 2fa-required [<package>]\n' +
- 'npm access 2fa-not-required [<package>]\n' +
- 'npm access ls-packages [<user>|<scope>|<scope:team>]\n' +
- 'npm access ls-collaborators [<package> [<user>]]\n' +
- 'npm access edit [<package>]'
-)
-
-access.subcommands = [
- 'public', 'restricted', 'grant', 'revoke',
- 'ls-packages', 'ls-collaborators', 'edit',
- '2fa-required', '2fa-not-required'
-]
-
-const AccessConfig = figgyPudding({
- json: {}
-})
-
-function UsageError (msg = '') {
- throw Object.assign(new Error(
- (msg ? `\nUsage: ${msg}\n\n` : '') +
- access.usage
- ), {code: 'EUSAGE'})
-}
-
-access.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
- if (argv.length === 2) {
- return cb(null, access.subcommands)
- }
-
- switch (argv[2]) {
- case 'grant':
- if (argv.length === 3) {
- return cb(null, ['read-only', 'read-write'])
- } else {
- return cb(null, [])
- }
- case 'public':
- case 'restricted':
- case 'ls-packages':
- case 'ls-collaborators':
- case 'edit':
- case '2fa-required':
- case '2fa-not-required':
- return cb(null, [])
- case 'revoke':
- return cb(null, [])
- default:
- return cb(new Error(argv[2] + ' not recognized'))
- }
-}
-
-function access ([cmd, ...args], cb) {
- return BB.try(() => {
- const fn = access.subcommands.includes(cmd) && access[cmd]
- if (!cmd) { UsageError('Subcommand is required.') }
- if (!fn) { UsageError(`${cmd} is not a recognized subcommand.`) }
-
- return fn(args, AccessConfig(npmConfig()))
- }).then(
- x => cb(null, x),
- err => err.code === 'EUSAGE' ? cb(err.message) : cb(err)
- )
-}
-
-access.public = ([pkg], opts) => {
- return modifyPackage(pkg, opts, libaccess.public)
-}
-
-access.restricted = ([pkg], opts) => {
- return modifyPackage(pkg, opts, libaccess.restricted)
-}
-
-access.grant = ([perms, scopeteam, pkg], opts) => {
- return BB.try(() => {
- if (!perms || (perms !== 'read-only' && perms !== 'read-write')) {
- UsageError('First argument must be either `read-only` or `read-write.`')
- }
- if (!scopeteam) {
- UsageError('`<scope:team>` argument is required.')
- }
- const [, scope, team] = scopeteam.match(/^@?([^:]+):(.*)$/) || []
- if (!scope && !team) {
- UsageError(
- 'Second argument used incorrect format.\n' +
- 'Example: @example:developers'
- )
- }
- return modifyPackage(pkg, opts, (pkgName, opts) => {
- return libaccess.grant(pkgName, scopeteam, perms, opts)
- })
- })
-}
-
-access.revoke = ([scopeteam, pkg], opts) => {
- return BB.try(() => {
- if (!scopeteam) {
- UsageError('`<scope:team>` argument is required.')
- }
- const [, scope, team] = scopeteam.match(/^@?([^:]+):(.*)$/) || []
- if (!scope || !team) {
- UsageError(
- 'First argument used incorrect format.\n' +
- 'Example: @example:developers'
- )
- }
- return modifyPackage(pkg, opts, (pkgName, opts) => {
- return libaccess.revoke(pkgName, scopeteam, opts)
- })
- })
-}
-
-access['2fa-required'] = access.tfaRequired = ([pkg], opts) => {
- return modifyPackage(pkg, opts, libaccess.tfaRequired, false)
-}
-
-access['2fa-not-required'] = access.tfaNotRequired = ([pkg], opts) => {
- return modifyPackage(pkg, opts, libaccess.tfaNotRequired, false)
-}
-
-access['ls-packages'] = access.lsPackages = ([owner], opts) => {
- return (
- owner ? BB.resolve(owner) : BB.fromNode(cb => whoami([], true, cb))
- ).then(owner => {
- return libaccess.lsPackages(owner, opts)
- }).then(pkgs => {
- // TODO - print these out nicely (breaking change)
- output(JSON.stringify(pkgs, null, 2))
- })
-}
-
-access['ls-collaborators'] = access.lsCollaborators = ([pkg, usr], opts) => {
- return getPackage(pkg).then(pkgName =>
- libaccess.lsCollaborators(pkgName, usr, opts)
- ).then(collabs => {
- // TODO - print these out nicely (breaking change)
- output(JSON.stringify(collabs, null, 2))
- })
-}
-
-access['edit'] = () => BB.reject(new Error('edit subcommand is not implemented yet'))
-
-function modifyPackage (pkg, opts, fn, requireScope = true) {
- return getPackage(pkg, requireScope).then(pkgName =>
- otplease(opts, opts => fn(pkgName, opts))
- )
-}
-
-function getPackage (name, requireScope = true) {
- return BB.try(() => {
- if (name && name.trim()) {
- return name.trim()
- } else {
- return readPackageJson(
- path.resolve(prefix, 'package.json')
- ).then(
- data => data.name,
- err => {
- if (err.code === 'ENOENT') {
- throw new Error('no package name passed to command and no package.json found')
- } else {
- throw err
- }
- }
- )
- }
- }).then(name => {
- if (requireScope && !name.match(/^@[^/]+\/.*$/)) {
- UsageError('This command is only available for scoped packages.')
- } else {
- return name
- }
- })
-}
diff --git a/deps/node/deps/npm/lib/adduser.js b/deps/node/deps/npm/lib/adduser.js
deleted file mode 100644
index e1c22103..00000000
--- a/deps/node/deps/npm/lib/adduser.js
+++ /dev/null
@@ -1,49 +0,0 @@
-module.exports = adduser
-
-var log = require('npmlog')
-var npm = require('./npm.js')
-var usage = require('./utils/usage')
-var crypto
-
-try {
- crypto = require('crypto')
-} catch (ex) {}
-
-adduser.usage = usage(
- 'adduser',
- 'npm adduser [--registry=url] [--scope=@orgname] [--auth-type=legacy] [--always-auth]'
-)
-
-function adduser (args, cb) {
- if (!crypto) {
- return cb(new Error(
- 'You must compile node with ssl support to use the adduser feature'
- ))
- }
-
- var registry = npm.config.get('registry')
- var scope = npm.config.get('scope')
- var creds = npm.config.getCredentialsByURI(npm.config.get('registry'))
-
- if (scope) {
- var scopedRegistry = npm.config.get(scope + ':registry')
- var cliRegistry = npm.config.get('registry', 'cli')
- if (scopedRegistry && !cliRegistry) registry = scopedRegistry
- }
-
- log.disableProgress()
-
- try {
- var auth = require('./auth/' + npm.config.get('auth-type'))
- } catch (e) {
- return cb(new Error('no such auth module'))
- }
- auth.login(creds, registry, scope, function (err, newCreds) {
- if (err) return cb(err)
-
- npm.config.del('_token', 'user') // prevent legacy pollution
- if (scope) npm.config.set(scope + ':registry', registry, 'user')
- npm.config.setCredentialsByURI(registry, newCreds)
- npm.config.save('user', cb)
- })
-}
diff --git a/deps/node/deps/npm/lib/audit.js b/deps/node/deps/npm/lib/audit.js
deleted file mode 100644
index 2cabef9d..00000000
--- a/deps/node/deps/npm/lib/audit.js
+++ /dev/null
@@ -1,302 +0,0 @@
-'use strict'
-
-const Bluebird = require('bluebird')
-
-const audit = require('./install/audit.js')
-const figgyPudding = require('figgy-pudding')
-const fs = require('graceful-fs')
-const Installer = require('./install.js').Installer
-const lockVerify = require('lock-verify')
-const log = require('npmlog')
-const npa = require('libnpm/parse-arg')
-const npm = require('./npm.js')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const parseJson = require('json-parse-better-errors')
-
-const readFile = Bluebird.promisify(fs.readFile)
-
-const AuditConfig = figgyPudding({
- also: {},
- 'audit-level': {},
- deepArgs: 'deep-args',
- 'deep-args': {},
- dev: {},
- force: {},
- 'dry-run': {},
- global: {},
- json: {},
- only: {},
- parseable: {},
- prod: {},
- production: {},
- registry: {},
- runId: {}
-})
-
-module.exports = auditCmd
-
-const usage = require('./utils/usage')
-auditCmd.usage = usage(
- 'audit',
- '\nnpm audit [--json]' +
- '\nnpm audit fix ' +
- '[--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]'
-)
-
-auditCmd.completion = function (opts, cb) {
- const argv = opts.conf.argv.remain
-
- switch (argv[2]) {
- case 'audit':
- return cb(null, [])
- default:
- return cb(new Error(argv[2] + ' not recognized'))
- }
-}
-
-class Auditor extends Installer {
- constructor (where, dryrun, args, opts) {
- super(where, dryrun, args, opts)
- this.deepArgs = (opts && opts.deepArgs) || []
- this.runId = opts.runId || ''
- this.audit = false
- }
-
- loadAllDepsIntoIdealTree (cb) {
- Bluebird.fromNode(cb => super.loadAllDepsIntoIdealTree(cb)).then(() => {
- if (this.deepArgs && this.deepArgs.length) {
- this.deepArgs.forEach(arg => {
- arg.reduce((acc, child, ii) => {
- if (!acc) {
- // We might not always be able to find `target` through the given
- // path. If we can't we'll just ignore it.
- return
- }
- const spec = npa(child)
- const target = (
- acc.requires.find(n => n.package.name === spec.name) ||
- acc.requires.find(
- n => audit.scrub(n.package.name, this.runId) === spec.name
- )
- )
- if (target && ii === arg.length - 1) {
- target.loaded = false
- // This kills `hasModernMeta()` and forces a re-fetch
- target.package = {
- name: spec.name,
- version: spec.fetchSpec,
- _requested: target.package._requested
- }
- delete target.fakeChild
- let parent = target.parent
- while (parent) {
- parent.loaded = false
- parent = parent.parent
- }
- target.requiredBy.forEach(par => {
- par.loaded = false
- delete par.fakeChild
- })
- }
- return target
- }, this.idealTree)
- })
- return Bluebird.fromNode(cb => super.loadAllDepsIntoIdealTree(cb))
- }
- }).nodeify(cb)
- }
-
- // no top level lifecycles on audit
- runPreinstallTopLevelLifecycles (cb) { cb() }
- runPostinstallTopLevelLifecycles (cb) { cb() }
-}
-
-function maybeReadFile (name) {
- const file = `${npm.prefix}/${name}`
- return readFile(file)
- .then((data) => {
- try {
- return parseJson(data)
- } catch (ex) {
- ex.code = 'EJSONPARSE'
- throw ex
- }
- })
- .catch({code: 'ENOENT'}, () => null)
- .catch((ex) => {
- ex.file = file
- throw ex
- })
-}
-
-function filterEnv (action, opts) {
- const includeDev = opts.dev ||
- (!/^prod(uction)?$/.test(opts.only) && !opts.production) ||
- /^dev(elopment)?$/.test(opts.only) ||
- /^dev(elopment)?$/.test(opts.also)
- const includeProd = !/^dev(elopment)?$/.test(opts.only)
- const resolves = action.resolves.filter(({dev}) => {
- return (dev && includeDev) || (!dev && includeProd)
- })
- if (resolves.length) {
- return Object.assign({}, action, {resolves})
- }
-}
-
-function auditCmd (args, cb) {
- const opts = AuditConfig(npmConfig())
- if (opts.global) {
- const err = new Error('`npm audit` does not support testing globals')
- err.code = 'EAUDITGLOBAL'
- throw err
- }
- if (args.length && args[0] !== 'fix') {
- return cb(new Error('Invalid audit subcommand: `' + args[0] + '`\n\nUsage:\n' + auditCmd.usage))
- }
- return Bluebird.all([
- maybeReadFile('npm-shrinkwrap.json'),
- maybeReadFile('package-lock.json'),
- maybeReadFile('package.json')
- ]).spread((shrinkwrap, lockfile, pkgJson) => {
- const sw = shrinkwrap || lockfile
- if (!pkgJson) {
- const err = new Error('No package.json found: Cannot audit a project without a package.json')
- err.code = 'EAUDITNOPJSON'
- throw err
- }
- if (!sw) {
- const err = new Error('Neither npm-shrinkwrap.json nor package-lock.json found: Cannot audit a project without a lockfile')
- err.code = 'EAUDITNOLOCK'
- throw err
- } else if (shrinkwrap && lockfile) {
- log.warn('audit', 'Both npm-shrinkwrap.json and package-lock.json exist, using npm-shrinkwrap.json.')
- }
- const requires = Object.assign(
- {},
- (pkgJson && pkgJson.dependencies) || {},
- (pkgJson && pkgJson.devDependencies) || {}
- )
- return lockVerify(npm.prefix).then((result) => {
- if (result.status) return audit.generate(sw, requires)
-
- const lockFile = shrinkwrap ? 'npm-shrinkwrap.json' : 'package-lock.json'
- const err = new Error(`Errors were found in your ${lockFile}, run npm install to fix them.\n ` +
- result.errors.join('\n '))
- err.code = 'ELOCKVERIFY'
- throw err
- })
- }).then((auditReport) => {
- return audit.submitForFullReport(auditReport)
- }).catch((err) => {
- if (err.statusCode >= 400) {
- let msg
- if (err.statusCode === 401) {
- msg = `Either your login credentials are invalid or your registry (${opts.registry}) does not support audit.`
- } else if (err.statusCode === 404) {
- msg = `Your configured registry (${opts.registry}) does not support audit requests.`
- } else {
- msg = `Your configured registry (${opts.registry}) does not support audit requests, or the audit endpoint is temporarily unavailable.`
- }
- const ne = new Error(msg)
- ne.code = 'ENOAUDIT'
- ne.wrapped = err
- throw ne
- }
- throw err
- }).then((auditResult) => {
- if (args[0] === 'fix') {
- const actions = (auditResult.actions || []).reduce((acc, action) => {
- action = filterEnv(action, opts)
- if (!action) { return acc }
- if (action.isMajor) {
- acc.major.add(`${action.module}@${action.target}`)
- action.resolves.forEach(({id, path}) => acc.majorFixes.add(`${id}::${path}`))
- } else if (action.action === 'install') {
- acc.install.add(`${action.module}@${action.target}`)
- action.resolves.forEach(({id, path}) => acc.installFixes.add(`${id}::${path}`))
- } else if (action.action === 'update') {
- const name = action.module
- const version = action.target
- action.resolves.forEach(vuln => {
- acc.updateFixes.add(`${vuln.id}::${vuln.path}`)
- const modPath = vuln.path.split('>')
- const newPath = modPath.slice(
- 0, modPath.indexOf(name)
- ).concat(`${name}@${version}`)
- if (newPath.length === 1) {
- acc.install.add(newPath[0])
- } else {
- acc.update.add(newPath.join('>'))
- }
- })
- } else if (action.action === 'review') {
- action.resolves.forEach(({id, path}) => acc.review.add(`${id}::${path}`))
- }
- return acc
- }, {
- install: new Set(),
- installFixes: new Set(),
- update: new Set(),
- updateFixes: new Set(),
- major: new Set(),
- majorFixes: new Set(),
- review: new Set()
- })
- return Bluebird.try(() => {
- const installMajor = opts.force
- const installCount = actions.install.size + (installMajor ? actions.major.size : 0) + actions.update.size
- const vulnFixCount = new Set([...actions.installFixes, ...actions.updateFixes, ...(installMajor ? actions.majorFixes : [])]).size
- const metavuln = auditResult.metadata.vulnerabilities
- const total = Object.keys(metavuln).reduce((acc, key) => acc + metavuln[key], 0)
- if (installCount) {
- log.verbose(
- 'audit',
- 'installing',
- [...actions.install, ...(installMajor ? actions.major : []), ...actions.update]
- )
- }
- return Bluebird.fromNode(cb => {
- new Auditor(
- npm.prefix,
- !!opts['dry-run'],
- [...actions.install, ...(installMajor ? actions.major : [])],
- opts.concat({
- runId: auditResult.runId,
- deepArgs: [...actions.update].map(u => u.split('>'))
- }).toJSON()
- ).run(cb)
- }).then(() => {
- const numScanned = auditResult.metadata.totalDependencies
- if (!opts.json && !opts.parseable) {
- output(`fixed ${vulnFixCount} of ${total} vulnerabilit${total === 1 ? 'y' : 'ies'} in ${numScanned} scanned package${numScanned === 1 ? '' : 's'}`)
- if (actions.review.size) {
- output(` ${actions.review.size} vulnerabilit${actions.review.size === 1 ? 'y' : 'ies'} required manual review and could not be updated`)
- }
- if (actions.major.size) {
- output(` ${actions.major.size} package update${actions.major.size === 1 ? '' : 's'} for ${actions.majorFixes.size} vuln${actions.majorFixes.size === 1 ? '' : 's'} involved breaking changes`)
- if (installMajor) {
- output(' (installed due to `--force` option)')
- } else {
- output(' (use `npm audit fix --force` to install breaking changes;' +
- ' or refer to `npm audit` for steps to fix these manually)')
- }
- }
- }
- })
- })
- } else {
- const levels = ['low', 'moderate', 'high', 'critical']
- const minLevel = levels.indexOf(opts['audit-level'])
- const vulns = levels.reduce((count, level, i) => {
- return i < minLevel ? count : count + (auditResult.metadata.vulnerabilities[level] || 0)
- }, 0)
- if (vulns > 0) process.exitCode = 1
- if (opts.parseable) {
- return audit.printParseableReport(auditResult)
- } else {
- return audit.printFullReport(auditResult)
- }
- }
- }).asCallback(cb)
-}
diff --git a/deps/node/deps/npm/lib/auth/legacy.js b/deps/node/deps/npm/lib/auth/legacy.js
deleted file mode 100644
index 7ad678be..00000000
--- a/deps/node/deps/npm/lib/auth/legacy.js
+++ /dev/null
@@ -1,79 +0,0 @@
-'use strict'
-
-const read = require('../utils/read-user-info.js')
-const profile = require('libnpm/profile')
-const log = require('npmlog')
-const figgyPudding = require('figgy-pudding')
-const npmConfig = require('../config/figgy-config.js')
-const output = require('../utils/output.js')
-const openUrl = require('../utils/open-url')
-
-const openerPromise = (url) => new Promise((resolve, reject) => {
- openUrl(url, 'to complete your login please visit', (er) => er ? reject(er) : resolve())
-})
-
-const loginPrompter = (creds) => {
- const opts = { log: log }
- return read.username('Username:', creds.username, opts).then((u) => {
- creds.username = u
- return read.password('Password:', creds.password)
- }).then((p) => {
- creds.password = p
- return read.email('Email: (this IS public) ', creds.email, opts)
- }).then((e) => {
- creds.email = e
- return creds
- })
-}
-
-const LoginOpts = figgyPudding({
- 'always-auth': {},
- creds: {},
- log: {default: () => log},
- registry: {},
- scope: {}
-})
-
-module.exports.login = (creds = {}, registry, scope, cb) => {
- const opts = LoginOpts(npmConfig()).concat({scope, registry, creds})
- login(opts).then((newCreds) => cb(null, newCreds)).catch(cb)
-}
-
-function login (opts) {
- return profile.login(openerPromise, loginPrompter, opts)
- .catch((err) => {
- if (err.code === 'EOTP') throw err
- const u = opts.creds.username
- const p = opts.creds.password
- const e = opts.creds.email
- if (!(u && p && e)) throw err
- return profile.adduserCouch(u, e, p, opts)
- })
- .catch((err) => {
- if (err.code !== 'EOTP') throw err
- return read.otp(
- 'Enter one-time password from your authenticator app: '
- ).then(otp => {
- const u = opts.creds.username
- const p = opts.creds.password
- return profile.loginCouch(u, p, opts.concat({otp}))
- })
- }).then((result) => {
- const newCreds = {}
- if (result && result.token) {
- newCreds.token = result.token
- } else {
- newCreds.username = opts.creds.username
- newCreds.password = opts.creds.password
- newCreds.email = opts.creds.email
- newCreds.alwaysAuth = opts['always-auth']
- }
-
- const usermsg = opts.creds.username ? ' user ' + opts.creds.username : ''
- opts.log.info('login', 'Authorized' + usermsg)
- const scopeMessage = opts.scope ? ' to scope ' + opts.scope : ''
- const userout = opts.creds.username ? ' as ' + opts.creds.username : ''
- output('Logged in%s%s on %s.', userout, scopeMessage, opts.registry)
- return newCreds
- })
-}
diff --git a/deps/node/deps/npm/lib/auth/oauth.js b/deps/node/deps/npm/lib/auth/oauth.js
deleted file mode 100644
index 1cb3ffec..00000000
--- a/deps/node/deps/npm/lib/auth/oauth.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var ssoAuth = require('./sso')
-var npm = require('../npm')
-
-module.exports.login = function login () {
- npm.config.set('sso-type', 'oauth')
- ssoAuth.login.apply(this, arguments)
-}
diff --git a/deps/node/deps/npm/lib/auth/saml.js b/deps/node/deps/npm/lib/auth/saml.js
deleted file mode 100644
index ae92ea5b..00000000
--- a/deps/node/deps/npm/lib/auth/saml.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var ssoAuth = require('./sso')
-var npm = require('../npm')
-
-module.exports.login = function login () {
- npm.config.set('sso-type', 'saml')
- ssoAuth.login.apply(this, arguments)
-}
diff --git a/deps/node/deps/npm/lib/auth/sso.js b/deps/node/deps/npm/lib/auth/sso.js
deleted file mode 100644
index 099e764e..00000000
--- a/deps/node/deps/npm/lib/auth/sso.js
+++ /dev/null
@@ -1,73 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const figgyPudding = require('figgy-pudding')
-const log = require('npmlog')
-const npmConfig = require('../config/figgy-config.js')
-const npmFetch = require('npm-registry-fetch')
-const output = require('../utils/output.js')
-const openUrl = BB.promisify(require('../utils/open-url.js'))
-const otplease = require('../utils/otplease.js')
-const profile = require('libnpm/profile')
-
-const SsoOpts = figgyPudding({
- ssoType: 'sso-type',
- 'sso-type': {},
- ssoPollFrequency: 'sso-poll-frequency',
- 'sso-poll-frequency': {}
-})
-
-module.exports.login = function login (creds, registry, scope, cb) {
- const opts = SsoOpts(npmConfig()).concat({creds, registry, scope})
- const ssoType = opts.ssoType
- if (!ssoType) { return cb(new Error('Missing option: sso-type')) }
-
- // We're reusing the legacy login endpoint, so we need some dummy
- // stuff here to pass validation. They're never used.
- const auth = {
- username: 'npm_' + ssoType + '_auth_dummy_user',
- password: 'placeholder',
- email: 'support@npmjs.com',
- authType: ssoType
- }
-
- otplease(opts,
- opts => profile.loginCouch(auth.username, auth.password, opts)
- ).then(({token, sso}) => {
- if (!token) { throw new Error('no SSO token returned') }
- if (!sso) { throw new Error('no SSO URL returned by services') }
- return openUrl(sso, 'to complete your login please visit').then(() => {
- return pollForSession(registry, token, opts)
- }).then(username => {
- log.info('adduser', 'Authorized user %s', username)
- var scopeMessage = scope ? ' to scope ' + scope : ''
- output('Logged in as %s%s on %s.', username, scopeMessage, registry)
- return {token}
- })
- }).nodeify(cb)
-}
-
-function pollForSession (registry, token, opts) {
- log.info('adduser', 'Polling for validated SSO session')
- return npmFetch.json(
- '/-/whoami', opts.concat({registry, forceAuth: {token}})
- ).then(
- ({username}) => username,
- err => {
- if (err.code === 'E401') {
- return sleep(opts['sso-poll-frequency']).then(() => {
- return pollForSession(registry, token, opts)
- })
- } else {
- throw err
- }
- }
- )
-}
-
-function sleep (time) {
- return new BB((resolve) => {
- setTimeout(resolve, time)
- })
-}
diff --git a/deps/node/deps/npm/lib/bin.js b/deps/node/deps/npm/lib/bin.js
deleted file mode 100644
index 7258893b..00000000
--- a/deps/node/deps/npm/lib/bin.js
+++ /dev/null
@@ -1,23 +0,0 @@
-module.exports = bin
-
-var npm = require('./npm.js')
-var osenv = require('osenv')
-var output = require('./utils/output.js')
-
-bin.usage = 'npm bin [--global]'
-
-function bin (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
- var b = npm.bin
- var PATH = osenv.path()
-
- if (!silent) output(b)
- process.nextTick(cb.bind(this, null, b))
-
- if (npm.config.get('global') && PATH.indexOf(b) === -1) {
- npm.config.get('logstream').write('(not in PATH env variable)\n')
- }
-}
diff --git a/deps/node/deps/npm/lib/bugs.js b/deps/node/deps/npm/lib/bugs.js
deleted file mode 100644
index 10300d1e..00000000
--- a/deps/node/deps/npm/lib/bugs.js
+++ /dev/null
@@ -1,31 +0,0 @@
-module.exports = bugs
-
-var log = require('npmlog')
-var openUrl = require('./utils/open-url')
-var fetchPackageMetadata = require('./fetch-package-metadata.js')
-var usage = require('./utils/usage')
-
-bugs.usage = usage(
- 'bugs',
- 'npm bugs [<pkgname>]'
-)
-
-bugs.completion = function (opts, cb) {
- // FIXME: there used to be registry completion here, but it stopped making
- // sense somewhere around 50,000 packages on the registry
- cb()
-}
-
-function bugs (args, cb) {
- var n = args.length ? args[0] : '.'
- fetchPackageMetadata(n, '.', {fullMetadata: true}, function (er, d) {
- if (er) return cb(er)
-
- var url = d.bugs && ((typeof d.bugs === 'string') ? d.bugs : d.bugs.url)
- if (!url) {
- url = 'https://www.npmjs.org/package/' + d.name
- }
- log.silly('bugs', 'url', url)
- openUrl(url, 'bug list available at the following URL', cb)
- })
-}
diff --git a/deps/node/deps/npm/lib/build.js b/deps/node/deps/npm/lib/build.js
deleted file mode 100644
index f8b3c493..00000000
--- a/deps/node/deps/npm/lib/build.js
+++ /dev/null
@@ -1,140 +0,0 @@
-// npm build command
-
-// everything about the installation after the creation of
-// the .npm/{name}/{version}/package folder.
-// linking the modules into the npm.root,
-// resolving dependencies, etc.
-
-// This runs AFTER install or link are completed.
-
-var npm = require('./npm.js')
-var log = require('npmlog')
-var chain = require('slide').chain
-var path = require('path')
-var fs = require('graceful-fs')
-var lifecycle = require('./utils/lifecycle.js')
-var readJson = require('read-package-json')
-var binLinks = require('bin-links')
-var binLinksConfig = require('./config/bin-links.js')
-var ini = require('ini')
-var writeFile = require('write-file-atomic')
-
-module.exports = build
-build.usage = 'npm build [<folder>]'
-
-build._didBuild = {}
-build._noLC = {}
-function build (args, global, didPre, didRB, cb) {
- if (typeof cb !== 'function') {
- cb = didRB
- didRB = false
- }
- if (typeof cb !== 'function') {
- cb = didPre
- didPre = false
- }
- if (typeof cb !== 'function') {
- cb = global
- global = npm.config.get('global')
- }
-
- if (!args.length) {
- readJson(path.resolve(npm.localPrefix, 'package.json'), function (er, pkg) {
- if (!args.length && pkg && pkg.scripts && pkg.scripts.build) {
- log.warn('build', '`npm build` called with no arguments. Did you mean to `npm run-script build`?')
- }
- cb()
- })
- } else {
- // it'd be nice to asyncMap these, but actually, doing them
- // in parallel generally munges up the output from node-waf
- var builder = build_(global, didPre, didRB)
- chain(args.map(function (arg) {
- return function (cb) {
- builder(arg, cb)
- }
- }), cb)
- }
-}
-
-function build_ (global, didPre, didRB) {
- return function (folder, cb) {
- folder = path.resolve(folder)
- if (build._didBuild[folder]) log.info('build', 'already built', folder)
- build._didBuild[folder] = true
- log.info('build', folder)
- readJson(path.resolve(folder, 'package.json'), function (er, pkg) {
- if (er) return cb(er)
- chain([
- !didPre && [lifecycle, pkg, 'preinstall', folder],
- [linkStuff, pkg, folder, global],
- !didRB && [rebuildBundles, pkg, folder],
- [writeBuiltinConf, pkg, folder],
- didPre !== build._noLC && [lifecycle, pkg, 'install', folder],
- didPre !== build._noLC && [lifecycle, pkg, 'postinstall', folder]
- ],
- cb)
- })
- }
-}
-
-var writeBuiltinConf = build.writeBuiltinConf = function (pkg, folder, cb) {
- // the builtin config is "sticky". Any time npm installs
- // itself globally, it puts its builtin config file there
- var parent = path.dirname(folder)
- var dir = npm.globalDir
-
- // Make this count for canary, too
- if ((pkg.name !== 'npm' && pkg.name !== 'npmc') ||
- !npm.config.get('global') ||
- !npm.config.usingBuiltin ||
- dir !== parent) {
- return cb()
- }
-
- var data = ini.stringify(npm.config.sources.builtin.data)
- writeFile(path.resolve(folder, 'npmrc'), data, cb)
-}
-
-var linkStuff = build.linkStuff = function (pkg, folder, global, cb) {
- // allow to opt out of linking binaries.
- if (npm.config.get('bin-links') === false) return cb()
- return binLinks(pkg, folder, global, binLinksConfig(pkg), cb)
-}
-
-function rebuildBundles (pkg, folder, cb) {
- if (!npm.config.get('rebuild-bundle')) return cb()
-
- var deps = Object.keys(pkg.dependencies || {})
- .concat(Object.keys(pkg.devDependencies || {}))
- var bundles = pkg.bundleDependencies || pkg.bundledDependencies || []
-
- fs.readdir(path.resolve(folder, 'node_modules'), function (er, files) {
- // error means no bundles
- if (er) return cb()
-
- log.verbose('rebuildBundles', files)
- // don't asyncMap these, because otherwise build script output
- // gets interleaved and is impossible to read
- chain(files.filter(function (file) {
- // rebuild if:
- // not a .folder, like .bin or .hooks
- return !file.match(/^[._-]/) &&
- // not some old 0.x style bundle
- file.indexOf('@') === -1 &&
- // either not a dep, or explicitly bundled
- (deps.indexOf(file) === -1 || bundles.indexOf(file) !== -1)
- }).map(function (file) {
- file = path.resolve(folder, 'node_modules', file)
- return function (cb) {
- if (build._didBuild[file]) return cb()
- log.verbose('rebuild bundle', file)
- // if file is not a package dir, then don't do it.
- fs.lstat(path.resolve(file, 'package.json'), function (er) {
- if (er) return cb()
- build_(false)(file, cb)
- })
- }
- }), cb)
- })
-}
diff --git a/deps/node/deps/npm/lib/cache.js b/deps/node/deps/npm/lib/cache.js
deleted file mode 100644
index 00abd8c7..00000000
--- a/deps/node/deps/npm/lib/cache.js
+++ /dev/null
@@ -1,137 +0,0 @@
-'use strict'
-/* eslint-disable standard/no-callback-literal */
-
-const BB = require('bluebird')
-
-const assert = require('assert')
-const cacache = require('cacache')
-const finished = BB.promisify(require('mississippi').finished)
-const log = require('npmlog')
-const npa = require('npm-package-arg')
-const npm = require('./npm.js')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const pacote = require('pacote')
-const path = require('path')
-const rm = BB.promisify(require('./utils/gently-rm.js'))
-const unbuild = BB.promisify(npm.commands.unbuild)
-
-cache.usage = 'npm cache add <tarball file>' +
- '\nnpm cache add <folder>' +
- '\nnpm cache add <tarball url>' +
- '\nnpm cache add <git url>' +
- '\nnpm cache add <name>@<version>' +
- '\nnpm cache clean' +
- '\nnpm cache verify'
-
-cache.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
- if (argv.length === 2) {
- return cb(null, ['add', 'clean'])
- }
-
- // TODO - eventually...
- switch (argv[2]) {
- case 'clean':
- case 'add':
- return cb(null, [])
- }
-}
-
-exports = module.exports = cache
-function cache (args, cb) {
- const cmd = args.shift()
- let result
- switch (cmd) {
- case 'rm': case 'clear': case 'clean':
- result = clean(args)
- break
- case 'add':
- result = add(args, npm.prefix)
- break
- case 'verify': case 'check':
- result = verify()
- break
- default: return cb('Usage: ' + cache.usage)
- }
- if (!result || !result.then) {
- throw new Error(`npm cache ${cmd} handler did not return a Promise`)
- }
- result.then(() => cb(), cb)
-}
-
-// npm cache clean [pkg]*
-cache.clean = clean
-function clean (args) {
- if (!args) args = []
- if (args.length) {
- return BB.reject(new Error('npm cache clear does not accept arguments'))
- }
- const cachePath = path.join(npm.cache, '_cacache')
- if (!npm.config.get('force')) {
- return BB.reject(new Error("As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.\n\nIf you're sure you want to delete the entire cache, rerun this command with --force."))
- }
- // TODO - remove specific packages or package versions
- return rm(cachePath)
-}
-
-// npm cache add <tarball-url>
-// npm cache add <pkg> <ver>
-// npm cache add <tarball>
-// npm cache add <folder>
-cache.add = function (pkg, ver, where, scrub) {
- assert(typeof pkg === 'string', 'must include name of package to install')
- if (scrub) {
- return clean([]).then(() => {
- return add([pkg, ver], where)
- })
- }
- return add([pkg, ver], where)
-}
-
-function add (args, where) {
- var usage = 'Usage:\n' +
- ' npm cache add <tarball-url>\n' +
- ' npm cache add <pkg>@<ver>\n' +
- ' npm cache add <tarball>\n' +
- ' npm cache add <folder>\n'
- var spec
- log.silly('cache add', 'args', args)
- if (args[1] === undefined) args[1] = null
- // at this point the args length must ==2
- if (args[1] !== null) {
- spec = args[0] + '@' + args[1]
- } else if (args.length === 2) {
- spec = args[0]
- }
- log.verbose('cache add', 'spec', spec)
- if (!spec) return BB.reject(new Error(usage))
- log.silly('cache add', 'parsed spec', spec)
- return finished(pacote.tarball.stream(spec, npmConfig({where})).resume())
-}
-
-cache.verify = verify
-function verify () {
- const cache = path.join(npm.config.get('cache'), '_cacache')
- let prefix = cache
- if (prefix.indexOf(process.env.HOME) === 0) {
- prefix = '~' + prefix.substr(process.env.HOME.length)
- }
- return cacache.verify(cache).then((stats) => {
- output(`Cache verified and compressed (${prefix}):`)
- output(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`)
- stats.badContentCount && output(`Corrupted content removed: ${stats.badContentCount}`)
- stats.reclaimedCount && output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
- stats.missingContent && output(`Missing content: ${stats.missingContent}`)
- output(`Index entries: ${stats.totalEntries}`)
- output(`Finished in ${stats.runTime.total / 1000}s`)
- })
-}
-
-cache.unpack = unpack
-function unpack (pkg, ver, unpackTarget, dmode, fmode, uid, gid) {
- return unbuild([unpackTarget], true).then(() => {
- const opts = npmConfig({dmode, fmode, uid, gid, offline: true})
- return pacote.extract(npa.resolve(pkg, ver), unpackTarget, opts)
- })
-}
diff --git a/deps/node/deps/npm/lib/ci.js b/deps/node/deps/npm/lib/ci.js
deleted file mode 100644
index 1fbb28b5..00000000
--- a/deps/node/deps/npm/lib/ci.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict'
-
-const Installer = require('libcipm')
-const npmConfig = require('./config/figgy-config.js')
-const npmlog = require('npmlog')
-
-ci.usage = 'npm ci'
-
-ci.completion = (cb) => cb(null, [])
-
-module.exports = ci
-function ci (args, cb) {
- return new Installer(npmConfig({ log: npmlog })).run().then(details => {
- npmlog.disableProgress()
- console.log(`added ${details.pkgCount} packages in ${
- details.runTime / 1000
- }s`)
- }).then(() => cb(), cb)
-}
diff --git a/deps/node/deps/npm/lib/completion.js b/deps/node/deps/npm/lib/completion.js
deleted file mode 100644
index a682c134..00000000
--- a/deps/node/deps/npm/lib/completion.js
+++ /dev/null
@@ -1,248 +0,0 @@
-module.exports = completion
-
-completion.usage = 'source <(npm completion)'
-
-var npm = require('./npm.js')
-var npmconf = require('./config/core.js')
-var configDefs = npmconf.defs
-var configTypes = configDefs.types
-var shorthands = configDefs.shorthands
-var nopt = require('nopt')
-var configNames = Object.keys(configTypes)
- .filter(function (e) { return e.charAt(0) !== '_' })
-var shorthandNames = Object.keys(shorthands)
-var allConfs = configNames.concat(shorthandNames)
-var once = require('once')
-var isWindowsShell = require('./utils/is-windows-shell.js')
-var output = require('./utils/output.js')
-
-completion.completion = function (opts, cb) {
- if (opts.w > 3) return cb()
-
- var fs = require('graceful-fs')
- var path = require('path')
- var bashExists = null
- var zshExists = null
- fs.stat(path.resolve(process.env.HOME, '.bashrc'), function (er) {
- bashExists = !er
- next()
- })
- fs.stat(path.resolve(process.env.HOME, '.zshrc'), function (er) {
- zshExists = !er
- next()
- })
- function next () {
- if (zshExists === null || bashExists === null) return
- var out = []
- if (zshExists) out.push('~/.zshrc')
- if (bashExists) out.push('~/.bashrc')
- if (opts.w === 2) {
- out = out.map(function (m) {
- return ['>>', m]
- })
- }
- cb(null, out)
- }
-}
-
-function completion (args, cb) {
- if (isWindowsShell) {
- var e = new Error('npm completion supported only in MINGW / Git bash on Windows')
- e.code = 'ENOTSUP'
- e.errno = require('constants').ENOTSUP // eslint-disable-line node/no-deprecated-api
- return cb(e)
- }
-
- // if the COMP_* isn't in the env, then just dump the script.
- if (process.env.COMP_CWORD === undefined ||
- process.env.COMP_LINE === undefined ||
- process.env.COMP_POINT === undefined) {
- return dumpScript(cb)
- }
-
- console.error(process.env.COMP_CWORD)
- console.error(process.env.COMP_LINE)
- console.error(process.env.COMP_POINT)
-
- // get the partial line and partial word,
- // if the point isn't at the end.
- // ie, tabbing at: npm foo b|ar
- var w = +process.env.COMP_CWORD
- var words = args.map(unescape)
- var word = words[w]
- var line = process.env.COMP_LINE
- var point = +process.env.COMP_POINT
- var partialLine = line.substr(0, point)
- var partialWords = words.slice(0, w)
-
- // figure out where in that last word the point is.
- var partialWord = args[w]
- var i = partialWord.length
- while (partialWord.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) {
- i--
- }
- partialWord = unescape(partialWord.substr(0, i))
- partialWords.push(partialWord)
-
- var opts = {
- words: words,
- w: w,
- word: word,
- line: line,
- lineLength: line.length,
- point: point,
- partialLine: partialLine,
- partialWords: partialWords,
- partialWord: partialWord,
- raw: args
- }
-
- cb = wrapCb(cb, opts)
-
- console.error(opts)
-
- if (partialWords.slice(0, -1).indexOf('--') === -1) {
- if (word.charAt(0) === '-') return configCompl(opts, cb)
- if (words[w - 1] &&
- words[w - 1].charAt(0) === '-' &&
- !isFlag(words[w - 1])) {
- // awaiting a value for a non-bool config.
- // don't even try to do this for now
- console.error('configValueCompl')
- return configValueCompl(opts, cb)
- }
- }
-
- // try to find the npm command.
- // it's the first thing after all the configs.
- // take a little shortcut and use npm's arg parsing logic.
- // don't have to worry about the last arg being implicitly
- // boolean'ed, since the last block will catch that.
- var parsed = opts.conf =
- nopt(configTypes, shorthands, partialWords.slice(0, -1), 0)
- // check if there's a command already.
- console.error(parsed)
- var cmd = parsed.argv.remain[1]
- if (!cmd) return cmdCompl(opts, cb)
-
- Object.keys(parsed).forEach(function (k) {
- npm.config.set(k, parsed[k])
- })
-
- // at this point, if words[1] is some kind of npm command,
- // then complete on it.
- // otherwise, do nothing
- cmd = npm.commands[cmd]
- if (cmd && cmd.completion) return cmd.completion(opts, cb)
-
- // nothing to do.
- cb()
-}
-
-function dumpScript (cb) {
- var fs = require('graceful-fs')
- var path = require('path')
- var p = path.resolve(__dirname, 'utils/completion.sh')
-
- // The Darwin patch below results in callbacks first for the write and then
- // for the error handler, so make sure we only call our callback once.
- cb = once(cb)
-
- fs.readFile(p, 'utf8', function (er, d) {
- if (er) return cb(er)
- d = d.replace(/^#!.*?\n/, '')
-
- process.stdout.write(d, function () { cb() })
- process.stdout.on('error', function (er) {
- // Darwin is a pain sometimes.
- //
- // This is necessary because the "source" or "." program in
- // bash on OS X closes its file argument before reading
- // from it, meaning that you get exactly 1 write, which will
- // work most of the time, and will always raise an EPIPE.
- //
- // Really, one should not be tossing away EPIPE errors, or any
- // errors, so casually. But, without this, `. <(npm completion)`
- // can never ever work on OS X.
- if (er.errno === 'EPIPE') er = null
- cb(er)
- })
- })
-}
-
-function unescape (w) {
- if (w.charAt(0) === '\'') return w.replace(/^'|'$/g, '')
- else return w.replace(/\\ /g, ' ')
-}
-
-function escape (w) {
- if (!w.match(/\s+/)) return w
- return '\'' + w + '\''
-}
-
-// The command should respond with an array. Loop over that,
-// wrapping quotes around any that have spaces, and writing
-// them to stdout. Use console.log, not the outfd config.
-// If any of the items are arrays, then join them with a space.
-// Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand
-// to: 'a', 'b c', or 'd' 'e'
-function wrapCb (cb, opts) {
- return function (er, compls) {
- if (!Array.isArray(compls)) compls = compls ? [compls] : []
- compls = compls.map(function (c) {
- if (Array.isArray(c)) c = c.map(escape).join(' ')
- else c = escape(c)
- return c
- })
-
- if (opts.partialWord) {
- compls = compls.filter(function (c) {
- return c.indexOf(opts.partialWord) === 0
- })
- }
-
- console.error([er && er.stack, compls, opts.partialWord])
- if (er || compls.length === 0) return cb(er)
-
- output(compls.join('\n'))
- cb()
- }
-}
-
-// the current word has a dash. Return the config names,
-// with the same number of dashes as the current word has.
-function configCompl (opts, cb) {
- var word = opts.word
- var split = word.match(/^(-+)((?:no-)*)(.*)$/)
- var dashes = split[1]
- var no = split[2]
- var flags = configNames.filter(isFlag)
- console.error(flags)
-
- return cb(null, allConfs.map(function (c) {
- return dashes + c
- }).concat(flags.map(function (f) {
- return dashes + (no || 'no-') + f
- })))
-}
-
-// expand with the valid values of various config values.
-// not yet implemented.
-function configValueCompl (opts, cb) {
- console.error('configValue', opts)
- return cb(null, [])
-}
-
-// check if the thing is a flag or not.
-function isFlag (word) {
- // shorthands never take args.
- var split = word.match(/^(-*)((?:no-)+)?(.*)$/)
- var no = split[2]
- var conf = split[3]
- return no || configTypes[conf] === Boolean || shorthands[conf]
-}
-
-// complete against the npm commands
-function cmdCompl (opts, cb) {
- return cb(null, npm.fullList)
-}
diff --git a/deps/node/deps/npm/lib/config.js b/deps/node/deps/npm/lib/config.js
deleted file mode 100644
index 0d4161d3..00000000
--- a/deps/node/deps/npm/lib/config.js
+++ /dev/null
@@ -1,286 +0,0 @@
-/* eslint-disable standard/no-callback-literal */
-module.exports = config
-
-var log = require('npmlog')
-var npm = require('./npm.js')
-var npmconf = require('./config/core.js')
-var fs = require('graceful-fs')
-var writeFileAtomic = require('write-file-atomic')
-var types = npmconf.defs.types
-var ini = require('ini')
-var editor = require('editor')
-var os = require('os')
-var path = require('path')
-var mkdirp = require('mkdirp')
-var umask = require('./utils/umask')
-var usage = require('./utils/usage')
-var output = require('./utils/output')
-var noProgressTillDone = require('./utils/no-progress-while-running').tillDone
-
-config.usage = usage(
- 'config',
- 'npm config set <key> <value>' +
- '\nnpm config get [<key>]' +
- '\nnpm config delete <key>' +
- '\nnpm config list [--json]' +
- '\nnpm config edit' +
- '\nnpm set <key> <value>' +
- '\nnpm get [<key>]'
-)
-config.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
- if (argv[1] !== 'config') argv.unshift('config')
- if (argv.length === 2) {
- var cmds = ['get', 'set', 'delete', 'ls', 'rm', 'edit']
- if (opts.partialWord !== 'l') cmds.push('list')
- return cb(null, cmds)
- }
-
- var action = argv[2]
- switch (action) {
- case 'set':
- // todo: complete with valid values, if possible.
- if (argv.length > 3) return cb(null, [])
- // fallthrough
- /* eslint no-fallthrough:0 */
- case 'get':
- case 'delete':
- case 'rm':
- return cb(null, Object.keys(types))
- case 'edit':
- case 'list':
- case 'ls':
- return cb(null, [])
- default:
- return cb(null, [])
- }
-}
-
-// npm config set key value
-// npm config get key
-// npm config list
-function config (args, cb) {
- var action = args.shift()
- switch (action) {
- case 'set':
- return set(args[0], args[1], cb)
- case 'get':
- return get(args[0], cb)
- case 'delete':
- case 'rm':
- case 'del':
- return del(args[0], cb)
- case 'list':
- case 'ls':
- return npm.config.get('json') ? listJson(cb) : list(cb)
- case 'edit':
- return edit(cb)
- default:
- return unknown(action, cb)
- }
-}
-
-function edit (cb) {
- var e = npm.config.get('editor')
- var which = npm.config.get('global') ? 'global' : 'user'
- var f = npm.config.get(which + 'config')
- if (!e) return cb(new Error('No EDITOR config or environ set.'))
- npm.config.save(which, function (er) {
- if (er) return cb(er)
- fs.readFile(f, 'utf8', function (er, data) {
- if (er) data = ''
- data = [
- ';;;;',
- '; npm ' + (npm.config.get('global')
- ? 'globalconfig' : 'userconfig') + ' file',
- '; this is a simple ini-formatted file',
- '; lines that start with semi-colons are comments.',
- '; read `npm help config` for help on the various options',
- ';;;;',
- '',
- data
- ].concat([
- ';;;;',
- '; all options with default values',
- ';;;;'
- ]).concat(Object.keys(npmconf.defaults).reduce(function (arr, key) {
- var obj = {}
- obj[key] = npmconf.defaults[key]
- if (key === 'logstream') return arr
- return arr.concat(
- ini.stringify(obj)
- .replace(/\n$/m, '')
- .replace(/^/g, '; ')
- .replace(/\n/g, '\n; ')
- .split('\n'))
- }, []))
- .concat([''])
- .join(os.EOL)
- mkdirp(path.dirname(f), function (er) {
- if (er) return cb(er)
- writeFileAtomic(
- f,
- data,
- function (er) {
- if (er) return cb(er)
- editor(f, { editor: e }, noProgressTillDone(cb))
- }
- )
- })
- })
- })
-}
-
-function del (key, cb) {
- if (!key) return cb(new Error('no key provided'))
- var where = npm.config.get('global') ? 'global' : 'user'
- npm.config.del(key, where)
- npm.config.save(where, cb)
-}
-
-function set (key, val, cb) {
- if (key === undefined) {
- return unknown('', cb)
- }
- if (val === undefined) {
- if (key.indexOf('=') !== -1) {
- var k = key.split('=')
- key = k.shift()
- val = k.join('=')
- } else {
- val = ''
- }
- }
- key = key.trim()
- val = val.trim()
- log.info('config', 'set %j %j', key, val)
- var where = npm.config.get('global') ? 'global' : 'user'
- if (key.match(/umask/)) val = umask.fromString(val)
- npm.config.set(key, val, where)
- npm.config.save(where, cb)
-}
-
-function get (key, cb) {
- if (!key) return list(cb)
- if (!publicVar(key)) {
- return cb(new Error('---sekretz---'))
- }
- var val = npm.config.get(key)
- if (key.match(/umask/)) val = umask.toString(val)
- output(val)
- cb()
-}
-
-function sort (a, b) {
- return a > b ? 1 : -1
-}
-
-function publicVar (k) {
- return !(k.charAt(0) === '_' || k.indexOf(':_') !== -1)
-}
-
-function getKeys (data) {
- return Object.keys(data).filter(publicVar).sort(sort)
-}
-
-function listJson (cb) {
- const publicConf = npm.config.keys.reduce((publicConf, k) => {
- var value = npm.config.get(k)
-
- if (publicVar(k) &&
- // argv is not really config, it's command config
- k !== 'argv' &&
- // logstream is a Stream, and would otherwise produce circular refs
- k !== 'logstream') publicConf[k] = value
-
- return publicConf
- }, {})
-
- output(JSON.stringify(publicConf, null, 2))
- return cb()
-}
-
-function listFromSource (title, conf, long) {
- var confKeys = getKeys(conf)
- var msg = ''
-
- if (confKeys.length) {
- msg += '; ' + title + '\n'
- confKeys.forEach(function (k) {
- var val = JSON.stringify(conf[k])
- if (conf[k] !== npm.config.get(k)) {
- if (!long) return
- msg += '; ' + k + ' = ' + val + ' (overridden)\n'
- } else msg += k + ' = ' + val + '\n'
- })
- msg += '\n'
- }
-
- return msg
-}
-
-function list (cb) {
- var msg = ''
- var long = npm.config.get('long')
-
- var cli = npm.config.sources.cli.data
- var cliKeys = getKeys(cli)
- if (cliKeys.length) {
- msg += '; cli configs\n'
- cliKeys.forEach(function (k) {
- if (cli[k] && typeof cli[k] === 'object') return
- if (k === 'argv') return
- msg += k + ' = ' + JSON.stringify(cli[k]) + '\n'
- })
- msg += '\n'
- }
-
- // env configs
- msg += listFromSource('environment configs', npm.config.sources.env.data, long)
-
- // project config file
- var project = npm.config.sources.project
- msg += listFromSource('project config ' + project.path, project.data, long)
-
- // user config file
- msg += listFromSource('userconfig ' + npm.config.get('userconfig'), npm.config.sources.user.data, long)
-
- // global config file
- msg += listFromSource('globalconfig ' + npm.config.get('globalconfig'), npm.config.sources.global.data, long)
-
- // builtin config file
- var builtin = npm.config.sources.builtin || {}
- if (builtin && builtin.data) {
- msg += listFromSource('builtin config ' + builtin.path, builtin.data, long)
- }
-
- // only show defaults if --long
- if (!long) {
- msg += '; node bin location = ' + process.execPath + '\n' +
- '; cwd = ' + process.cwd() + '\n' +
- '; HOME = ' + process.env.HOME + '\n' +
- '; "npm config ls -l" to show all defaults.\n'
-
- output(msg)
- return cb()
- }
-
- var defaults = npmconf.defaults
- var defKeys = getKeys(defaults)
- msg += '; default values\n'
- defKeys.forEach(function (k) {
- if (defaults[k] && typeof defaults[k] === 'object') return
- var val = JSON.stringify(defaults[k])
- if (defaults[k] !== npm.config.get(k)) {
- msg += '; ' + k + ' = ' + val + ' (overridden)\n'
- } else msg += k + ' = ' + val + '\n'
- })
- msg += '\n'
-
- output(msg)
- return cb()
-}
-
-function unknown (action, cb) {
- cb('Usage:\n' + config.usage)
-}
diff --git a/deps/node/deps/npm/lib/config/bin-links.js b/deps/node/deps/npm/lib/config/bin-links.js
deleted file mode 100644
index 1ee90cc3..00000000
--- a/deps/node/deps/npm/lib/config/bin-links.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict'
-
-const npm = require('../npm.js')
-var packageId = require('../utils/package-id.js')
-const log = require('npmlog')
-
-module.exports = binLinksOpts
-
-function binLinksOpts (pkg) {
- return {
- ignoreScripts: npm.config.get('ignore-scripts'),
- force: npm.config.get('force'),
- globalBin: npm.globalBin,
- globalDir: npm.globalDir,
- json: npm.config.get('json'),
- log: log,
- name: 'npm',
- parseable: npm.config.get('parseable'),
- pkgId: packageId(pkg),
- prefix: npm.config.get('prefix'),
- prefixes: [
- npm.prefix,
- npm.globalPrefix,
- npm.dir,
- npm.root,
- npm.globalDir,
- npm.bin,
- npm.globalBin
- ],
- umask: npm.config.get('umask')
- }
-}
diff --git a/deps/node/deps/npm/lib/config/clear-credentials-by-uri.js b/deps/node/deps/npm/lib/config/clear-credentials-by-uri.js
deleted file mode 100644
index 13c35660..00000000
--- a/deps/node/deps/npm/lib/config/clear-credentials-by-uri.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var assert = require('assert')
-
-var toNerfDart = require('./nerf-dart.js')
-
-module.exports = clearCredentialsByURI
-
-function clearCredentialsByURI (uri) {
- assert(uri && typeof uri === 'string', 'registry URL is required')
-
- var nerfed = toNerfDart(uri)
-
- this.del(nerfed + ':_authToken', 'user')
- this.del(nerfed + ':_password', 'user')
- this.del(nerfed + ':username', 'user')
- this.del(nerfed + ':email', 'user')
-}
diff --git a/deps/node/deps/npm/lib/config/cmd-list.js b/deps/node/deps/npm/lib/config/cmd-list.js
deleted file mode 100644
index fa4390fc..00000000
--- a/deps/node/deps/npm/lib/config/cmd-list.js
+++ /dev/null
@@ -1,135 +0,0 @@
-// short names for common things
-var shorthands = {
- 'un': 'uninstall',
- 'rb': 'rebuild',
- 'list': 'ls',
- 'ln': 'link',
- 'create': 'init',
- 'i': 'install',
- 'it': 'install-test',
- 'cit': 'install-ci-test',
- 'up': 'update',
- 'c': 'config',
- 's': 'search',
- 'se': 'search',
- 'unstar': 'star', // same function
- 'tst': 'test',
- 't': 'test',
- 'ddp': 'dedupe',
- 'v': 'view',
- 'run': 'run-script',
- 'clean-install': 'ci',
- 'clean-install-test': 'cit'
-}
-
-var affordances = {
- 'la': 'ls',
- 'll': 'ls',
- 'verison': 'version',
- 'ic': 'ci',
- 'innit': 'init',
- 'isntall': 'install',
- 'install-clean': 'ci',
- 'isntall-clean': 'ci',
- 'dist-tags': 'dist-tag',
- 'apihelp': 'help',
- 'find-dupes': 'dedupe',
- 'upgrade': 'update',
- 'udpate': 'update',
- 'login': 'adduser',
- 'add-user': 'adduser',
- 'author': 'owner',
- 'home': 'docs',
- 'issues': 'bugs',
- 'info': 'view',
- 'show': 'view',
- 'find': 'search',
- 'add': 'install',
- 'unlink': 'uninstall',
- 'remove': 'uninstall',
- 'rm': 'uninstall',
- 'r': 'uninstall',
- 'rum': 'run-script',
- 'sit': 'cit',
- 'urn': 'run-script',
- 'ogr': 'org'
-}
-
-// these are filenames in .
-var cmdList = [
- 'ci',
- 'install-ci-test',
- 'install',
- 'install-test',
- 'uninstall',
- 'cache',
- 'config',
- 'set',
- 'get',
- 'update',
- 'outdated',
- 'prune',
- 'pack',
- 'dedupe',
- 'hook',
-
- 'rebuild',
- 'link',
-
- 'publish',
- 'star',
- 'stars',
- 'adduser',
- 'login', // This is an alias for `adduser` but it can be confusing
- 'logout',
- 'unpublish',
- 'owner',
- 'access',
- 'team',
- 'deprecate',
- 'shrinkwrap',
- 'token',
- 'profile',
- 'audit',
- 'org',
-
- 'help',
- 'help-search',
- 'ls',
- 'search',
- 'view',
- 'init',
- 'version',
- 'edit',
- 'explore',
- 'docs',
- 'repo',
- 'bugs',
- 'root',
- 'prefix',
- 'bin',
- 'whoami',
- 'dist-tag',
- 'ping',
-
- 'test',
- 'stop',
- 'start',
- 'restart',
- 'run-script',
- 'completion',
- 'doctor'
-]
-
-var plumbing = [
- 'build',
- 'unbuild',
- 'xmas',
- 'substack',
- 'visnup'
-]
-module.exports.aliases = Object.assign({}, shorthands, affordances)
-module.exports.shorthands = shorthands
-module.exports.affordances = affordances
-module.exports.cmdList = cmdList
-module.exports.plumbing = plumbing
diff --git a/deps/node/deps/npm/lib/config/core.js b/deps/node/deps/npm/lib/config/core.js
deleted file mode 100644
index b9851f98..00000000
--- a/deps/node/deps/npm/lib/config/core.js
+++ /dev/null
@@ -1,429 +0,0 @@
-var CC = require('config-chain').ConfigChain
-var inherits = require('inherits')
-var configDefs = require('./defaults.js')
-var types = configDefs.types
-var once = require('once')
-var fs = require('fs')
-var path = require('path')
-var nopt = require('nopt')
-var ini = require('ini')
-var Umask = configDefs.Umask
-var mkdirp = require('mkdirp')
-var umask = require('../utils/umask')
-var isWindows = require('../utils/is-windows.js')
-
-exports.load = load
-exports.Conf = Conf
-exports.loaded = false
-exports.rootConf = null
-exports.usingBuiltin = false
-exports.defs = configDefs
-
-Object.defineProperty(exports, 'defaults', { get: function () {
- return configDefs.defaults
-},
-enumerable: true })
-
-Object.defineProperty(exports, 'types', { get: function () {
- return configDefs.types
-},
-enumerable: true })
-
-exports.validate = validate
-
-var myUid = process.env.SUDO_UID !== undefined
- ? process.env.SUDO_UID : (process.getuid && process.getuid())
-var myGid = process.env.SUDO_GID !== undefined
- ? process.env.SUDO_GID : (process.getgid && process.getgid())
-
-var loading = false
-var loadCbs = []
-function load () {
- var cli, builtin, cb
- for (var i = 0; i < arguments.length; i++) {
- switch (typeof arguments[i]) {
- case 'string': builtin = arguments[i]; break
- case 'object': cli = arguments[i]; break
- case 'function': cb = arguments[i]; break
- }
- }
-
- if (!cb) cb = function () {}
-
- if (exports.loaded) {
- var ret = exports.loaded
- if (cli) {
- ret = new Conf(ret)
- ret.unshift(cli)
- }
- return process.nextTick(cb.bind(null, null, ret))
- }
-
- // either a fresh object, or a clone of the passed in obj
- if (!cli) {
- cli = {}
- } else {
- cli = Object.keys(cli).reduce(function (c, k) {
- c[k] = cli[k]
- return c
- }, {})
- }
-
- loadCbs.push(cb)
- if (loading) return
-
- loading = true
-
- cb = once(function (er, conf) {
- if (!er) {
- exports.loaded = conf
- loading = false
- }
- loadCbs.forEach(function (fn) {
- fn(er, conf)
- })
- loadCbs.length = 0
- })
-
- // check for a builtin if provided.
- exports.usingBuiltin = !!builtin
- var rc = exports.rootConf = new Conf()
- if (builtin) {
- rc.addFile(builtin, 'builtin')
- } else {
- rc.add({}, 'builtin')
- }
-
- rc.on('load', function () {
- load_(builtin, rc, cli, cb)
- })
- rc.on('error', cb)
-}
-
-function load_ (builtin, rc, cli, cb) {
- var defaults = configDefs.defaults
- var conf = new Conf(rc)
-
- conf.usingBuiltin = !!builtin
- conf.add(cli, 'cli')
- conf.addEnv()
-
- conf.loadPrefix(function (er) {
- if (er) return cb(er)
-
- // If you're doing `npm --userconfig=~/foo.npmrc` then you'd expect
- // that ~/.npmrc won't override the stuff in ~/foo.npmrc (or, indeed
- // be used at all).
- //
- // However, if the cwd is ~, then ~/.npmrc is the home for the project
- // config, and will override the userconfig.
- //
- // If you're not setting the userconfig explicitly, then it will be loaded
- // twice, which is harmless but excessive. If you *are* setting the
- // userconfig explicitly then it will override your explicit intent, and
- // that IS harmful and unexpected.
- //
- // Solution: Do not load project config file that is the same as either
- // the default or resolved userconfig value. npm will log a "verbose"
- // message about this when it happens, but it is a rare enough edge case
- // that we don't have to be super concerned about it.
- var projectConf = path.resolve(conf.localPrefix, '.npmrc')
- var defaultUserConfig = rc.get('userconfig')
- var resolvedUserConfig = conf.get('userconfig')
- if (!conf.get('global') &&
- projectConf !== defaultUserConfig &&
- projectConf !== resolvedUserConfig) {
- conf.addFile(projectConf, 'project')
- conf.once('load', afterPrefix)
- } else {
- conf.add({}, 'project')
- afterPrefix()
- }
- })
-
- function afterPrefix () {
- conf.addFile(conf.get('userconfig'), 'user')
- conf.once('error', cb)
- conf.once('load', afterUser)
- }
-
- function afterUser () {
- // globalconfig and globalignorefile defaults
- // need to respond to the 'prefix' setting up to this point.
- // Eg, `npm config get globalconfig --prefix ~/local` should
- // return `~/local/etc/npmrc`
- // annoying humans and their expectations!
- if (conf.get('prefix')) {
- var etc = path.resolve(conf.get('prefix'), 'etc')
- defaults.globalconfig = path.resolve(etc, 'npmrc')
- defaults.globalignorefile = path.resolve(etc, 'npmignore')
- }
-
- conf.addFile(conf.get('globalconfig'), 'global')
-
- // move the builtin into the conf stack now.
- conf.root = defaults
- conf.add(rc.shift(), 'builtin')
- conf.once('load', function () {
- conf.loadExtras(afterExtras)
- })
- }
-
- function afterExtras (er) {
- if (er) return cb(er)
-
- // warn about invalid bits.
- validate(conf)
-
- var cafile = conf.get('cafile')
-
- if (cafile) {
- return conf.loadCAFile(cafile, finalize)
- }
-
- finalize()
- }
-
- function finalize (er) {
- if (er) {
- return cb(er)
- }
-
- exports.loaded = conf
- cb(er, conf)
- }
-}
-
-// Basically the same as CC, but:
-// 1. Always ini
-// 2. Parses environment variable names in field values
-// 3. Field values that start with ~/ are replaced with process.env.HOME
-// 4. Can inherit from another Conf object, using it as the base.
-inherits(Conf, CC)
-function Conf (base) {
- if (!(this instanceof Conf)) return new Conf(base)
-
- CC.call(this)
-
- if (base) {
- if (base instanceof Conf) {
- this.root = base.list[0] || base.root
- } else {
- this.root = base
- }
- } else {
- this.root = configDefs.defaults
- }
-}
-
-Conf.prototype.loadPrefix = require('./load-prefix.js')
-Conf.prototype.loadCAFile = require('./load-cafile.js')
-Conf.prototype.loadUid = require('./load-uid.js')
-Conf.prototype.setUser = require('./set-user.js')
-Conf.prototype.getCredentialsByURI = require('./get-credentials-by-uri.js')
-Conf.prototype.setCredentialsByURI = require('./set-credentials-by-uri.js')
-Conf.prototype.clearCredentialsByURI = require('./clear-credentials-by-uri.js')
-
-Conf.prototype.loadExtras = function (cb) {
- this.setUser(function (er) {
- if (er) return cb(er)
- this.loadUid(function (er) {
- if (er) return cb(er)
- // Without prefix, nothing will ever work
- mkdirp(this.prefix, cb)
- }.bind(this))
- }.bind(this))
-}
-
-Conf.prototype.save = function (where, cb) {
- var target = this.sources[where]
- if (!target || !(target.path || target.source) || !target.data) {
- var er
- if (where !== 'builtin') er = new Error('bad save target: ' + where)
- if (cb) {
- process.nextTick(cb.bind(null, er))
- return this
- }
- return this.emit('error', er)
- }
-
- if (target.source) {
- var pref = target.prefix || ''
- Object.keys(target.data).forEach(function (k) {
- target.source[pref + k] = target.data[k]
- })
- if (cb) process.nextTick(cb)
- return this
- }
-
- var data = ini.stringify(target.data)
-
- var then = function then (er) {
- if (er) return done(er)
-
- fs.chmod(target.path, mode, done)
- }
-
- var done = function done (er) {
- if (er) {
- if (cb) return cb(er)
- else return this.emit('error', er)
- }
- this._saving--
- if (this._saving === 0) {
- if (cb) cb()
- this.emit('save')
- }
- }
-
- then = then.bind(this)
- done = done.bind(this)
- this._saving++
-
- var mode = where === 'user' ? '0600' : '0666'
- if (!data.trim()) {
- fs.unlink(target.path, function () {
- // ignore the possible error (e.g. the file doesn't exist)
- done(null)
- })
- } else {
- mkdirp(path.dirname(target.path), function (er) {
- if (er) return then(er)
- fs.writeFile(target.path, data, 'utf8', function (er) {
- if (er) return then(er)
- if (where === 'user' && myUid && myGid) {
- fs.chown(target.path, +myUid, +myGid, then)
- } else {
- then()
- }
- })
- })
- }
-
- return this
-}
-
-Conf.prototype.addFile = function (file, name) {
- name = name || file
- var marker = { __source__: name }
- this.sources[name] = { path: file, type: 'ini' }
- this.push(marker)
- this._await()
- fs.readFile(file, 'utf8', function (er, data) {
- // just ignore missing files.
- if (er) return this.add({}, marker)
-
- this.addString(data, file, 'ini', marker)
- }.bind(this))
- return this
-}
-
-// always ini files.
-Conf.prototype.parse = function (content, file) {
- return CC.prototype.parse.call(this, content, file, 'ini')
-}
-
-Conf.prototype.add = function (data, marker) {
- try {
- Object.keys(data).forEach(function (k) {
- const newKey = envReplace(k)
- const newField = parseField(data[k], newKey)
- delete data[k]
- data[newKey] = newField
- })
- } catch (e) {
- this.emit('error', e)
- return this
- }
- return CC.prototype.add.call(this, data, marker)
-}
-
-Conf.prototype.addEnv = function (env) {
- env = env || process.env
- var conf = {}
- Object.keys(env)
- .filter(function (k) { return k.match(/^npm_config_/i) })
- .forEach(function (k) {
- if (!env[k]) return
-
- // leave first char untouched, even if
- // it is a '_' - convert all other to '-'
- var p = k.toLowerCase()
- .replace(/^npm_config_/, '')
- .replace(/(?!^)_/g, '-')
- conf[p] = env[k]
- })
- return CC.prototype.addEnv.call(this, '', conf, 'env')
-}
-
-function parseField (f, k) {
- if (typeof f !== 'string' && !(f instanceof String)) return f
-
- // type can be an array or single thing.
- var typeList = [].concat(types[k])
- var isPath = typeList.indexOf(path) !== -1
- var isBool = typeList.indexOf(Boolean) !== -1
- var isString = typeList.indexOf(String) !== -1
- var isUmask = typeList.indexOf(Umask) !== -1
- var isNumber = typeList.indexOf(Number) !== -1
-
- f = ('' + f).trim()
-
- if (f.match(/^".*"$/)) {
- try {
- f = JSON.parse(f)
- } catch (e) {
- throw new Error('Failed parsing JSON config key ' + k + ': ' + f)
- }
- }
-
- if (isBool && !isString && f === '') return true
-
- switch (f) {
- case 'true': return true
- case 'false': return false
- case 'null': return null
- case 'undefined': return undefined
- }
-
- f = envReplace(f)
-
- if (isPath) {
- var homePattern = isWindows ? /^~(\/|\\)/ : /^~\//
- if (f.match(homePattern) && process.env.HOME) {
- f = path.resolve(process.env.HOME, f.substr(2))
- }
- f = path.resolve(f)
- }
-
- if (isUmask) f = umask.fromString(f)
-
- if (isNumber && !isNaN(f)) f = +f
-
- return f
-}
-
-function envReplace (f) {
- if (typeof f !== 'string' || !f) return f
-
- // replace any ${ENV} values with the appropriate environ.
- var envExpr = /(\\*)\$\{([^}]+)\}/g
- return f.replace(envExpr, function (orig, esc, name) {
- esc = esc.length && esc.length % 2
- if (esc) return orig
- if (undefined === process.env[name]) {
- throw new Error('Failed to replace env in config: ' + orig)
- }
-
- return process.env[name]
- })
-}
-
-function validate (cl) {
- // warn about invalid configs at every level.
- cl.list.forEach(function (conf) {
- nopt.clean(conf, configDefs.types)
- })
-
- nopt.clean(cl.root, configDefs.types)
-}
diff --git a/deps/node/deps/npm/lib/config/defaults.js b/deps/node/deps/npm/lib/config/defaults.js
deleted file mode 100644
index 25926595..00000000
--- a/deps/node/deps/npm/lib/config/defaults.js
+++ /dev/null
@@ -1,433 +0,0 @@
-// defaults, types, and shorthands.
-
-var path = require('path')
-var url = require('url')
-var Stream = require('stream').Stream
-var semver = require('semver')
-var stableFamily = semver.parse(process.version)
-var nopt = require('nopt')
-var os = require('os')
-var osenv = require('osenv')
-var umask = require('../utils/umask')
-var hasUnicode = require('has-unicode')
-
-var log
-try {
- log = require('npmlog')
-} catch (er) {
- var util = require('util')
- log = { warn: function (m) {
- console.warn(m + ' ' + util.format.apply(util, [].slice.call(arguments, 1)))
- } }
-}
-
-exports.Umask = Umask
-function Umask () {}
-function validateUmask (data, k, val) {
- return umask.validate(data, k, val)
-}
-
-function validateSemver (data, k, val) {
- if (!semver.valid(val)) return false
- data[k] = semver.valid(val)
-}
-
-function validateStream (data, k, val) {
- if (!(val instanceof Stream)) return false
- data[k] = val
-}
-
-nopt.typeDefs.semver = { type: semver, validate: validateSemver }
-nopt.typeDefs.Stream = { type: Stream, validate: validateStream }
-nopt.typeDefs.Umask = { type: Umask, validate: validateUmask }
-
-nopt.invalidHandler = function (k, val, type) {
- log.warn('invalid config', k + '=' + JSON.stringify(val))
-
- if (Array.isArray(type)) {
- if (type.indexOf(url) !== -1) type = url
- else if (type.indexOf(path) !== -1) type = path
- }
-
- switch (type) {
- case Umask:
- log.warn('invalid config', 'Must be umask, octal number in range 0000..0777')
- break
- case url:
- log.warn('invalid config', "Must be a full url with 'http://'")
- break
- case path:
- log.warn('invalid config', 'Must be a valid filesystem path')
- break
- case Number:
- log.warn('invalid config', 'Must be a numeric value')
- break
- case Stream:
- log.warn('invalid config', 'Must be an instance of the Stream class')
- break
- }
-}
-
-if (!stableFamily || (+stableFamily.minor % 2)) stableFamily = null
-else stableFamily = stableFamily.major + '.' + stableFamily.minor
-
-var defaults
-
-var temp = osenv.tmpdir()
-var home = osenv.home()
-
-var uidOrPid = process.getuid ? process.getuid() : process.pid
-
-if (home) process.env.HOME = home
-else home = path.resolve(temp, 'npm-' + uidOrPid)
-
-var cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm'
-var cacheRoot = (process.platform === 'win32' && process.env.APPDATA) || home
-var cache = path.resolve(cacheRoot, cacheExtra)
-
-var globalPrefix
-Object.defineProperty(exports, 'defaults', {get: function () {
- if (defaults) return defaults
-
- if (process.env.PREFIX) {
- globalPrefix = process.env.PREFIX
- } else if (process.platform === 'win32') {
- // c:\node\node.exe --> prefix=c:\node\
- globalPrefix = path.dirname(process.execPath)
- } else {
- // /usr/local/bin/node --> prefix=/usr/local
- globalPrefix = path.dirname(path.dirname(process.execPath))
-
- // destdir only is respected on Unix
- if (process.env.DESTDIR) {
- globalPrefix = path.join(process.env.DESTDIR, globalPrefix)
- }
- }
-
- defaults = {
- access: null,
- 'allow-same-version': false,
- 'always-auth': false,
- also: null,
- audit: true,
- 'audit-level': 'low',
- 'auth-type': 'legacy',
-
- 'bin-links': true,
- browser: null,
-
- ca: null,
- cafile: null,
-
- cache: cache,
-
- 'cache-lock-stale': 60000,
- 'cache-lock-retries': 10,
- 'cache-lock-wait': 10000,
-
- 'cache-max': Infinity,
- 'cache-min': 10,
-
- cert: null,
-
- cidr: null,
-
- color: process.env.NO_COLOR == null,
- depth: Infinity,
- description: true,
- dev: false,
- 'dry-run': false,
- editor: osenv.editor(),
- 'engine-strict': false,
- force: false,
-
- 'fetch-retries': 2,
- 'fetch-retry-factor': 10,
- 'fetch-retry-mintimeout': 10000,
- 'fetch-retry-maxtimeout': 60000,
-
- git: 'git',
- 'git-tag-version': true,
- 'commit-hooks': true,
-
- global: false,
- globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'),
- 'global-style': false,
- group: process.platform === 'win32' ? 0
- : process.env.SUDO_GID || (process.getgid && process.getgid()),
- 'ham-it-up': false,
- heading: 'npm',
- 'if-present': false,
- 'ignore-prepublish': false,
- 'ignore-scripts': false,
- 'init-module': path.resolve(home, '.npm-init.js'),
- 'init-author-name': '',
- 'init-author-email': '',
- 'init-author-url': '',
- 'init-version': '1.0.0',
- 'init-license': 'ISC',
- json: false,
- key: null,
- 'legacy-bundling': false,
- link: false,
- 'local-address': undefined,
- loglevel: 'notice',
- logstream: process.stderr,
- 'logs-max': 10,
- long: false,
- maxsockets: 50,
- message: '%s',
- 'metrics-registry': null,
- 'node-options': null,
- 'node-version': process.version,
- 'offline': false,
- 'onload-script': false,
- only: null,
- optional: true,
- otp: null,
- 'package-lock': true,
- 'package-lock-only': false,
- parseable: false,
- 'prefer-offline': false,
- 'prefer-online': false,
- prefix: globalPrefix,
- preid: '',
- production: process.env.NODE_ENV === 'production',
- 'progress': !process.env.TRAVIS && !process.env.CI,
- proxy: null,
- 'https-proxy': null,
- 'noproxy': null,
- 'user-agent': 'npm/{npm-version} ' +
- 'node/{node-version} ' +
- '{platform} ' +
- '{arch}',
- 'read-only': false,
- 'rebuild-bundle': true,
- registry: 'https://registry.npmjs.org/',
- rollback: true,
- save: true,
- 'save-bundle': false,
- 'save-dev': false,
- 'save-exact': false,
- 'save-optional': false,
- 'save-prefix': '^',
- 'save-prod': false,
- scope: '',
- 'script-shell': null,
- 'scripts-prepend-node-path': 'warn-only',
- searchopts: '',
- searchexclude: null,
- searchlimit: 20,
- searchstaleness: 15 * 60,
- 'send-metrics': false,
- shell: osenv.shell(),
- shrinkwrap: true,
- 'sign-git-commit': false,
- 'sign-git-tag': false,
- 'sso-poll-frequency': 500,
- 'sso-type': 'oauth',
- 'strict-ssl': true,
- tag: 'latest',
- 'tag-version-prefix': 'v',
- timing: false,
- tmp: temp,
- unicode: hasUnicode(),
- 'unsafe-perm': process.platform === 'win32' ||
- process.platform === 'cygwin' ||
- !(process.getuid && process.setuid &&
- process.getgid && process.setgid) ||
- process.getuid() !== 0,
- 'update-notifier': true,
- usage: false,
- user: (process.platform === 'win32' || os.type() === 'OS400') ? 0 : 'nobody',
- userconfig: path.resolve(home, '.npmrc'),
- umask: process.umask ? process.umask() : umask.fromString('022'),
- version: false,
- versions: false,
- viewer: process.platform === 'win32' ? 'browser' : 'man',
-
- _exit: true
- }
-
- return defaults
-}})
-
-exports.types = {
- access: [null, 'restricted', 'public'],
- 'allow-same-version': Boolean,
- 'always-auth': Boolean,
- also: [null, 'dev', 'development'],
- audit: Boolean,
- 'audit-level': ['low', 'moderate', 'high', 'critical'],
- 'auth-type': ['legacy', 'sso', 'saml', 'oauth'],
- 'bin-links': Boolean,
- browser: [null, String],
- ca: [null, String, Array],
- cafile: path,
- cache: path,
- 'cache-lock-stale': Number,
- 'cache-lock-retries': Number,
- 'cache-lock-wait': Number,
- 'cache-max': Number,
- 'cache-min': Number,
- cert: [null, String],
- cidr: [null, String, Array],
- color: ['always', Boolean],
- depth: Number,
- description: Boolean,
- dev: Boolean,
- 'dry-run': Boolean,
- editor: String,
- 'engine-strict': Boolean,
- force: Boolean,
- 'fetch-retries': Number,
- 'fetch-retry-factor': Number,
- 'fetch-retry-mintimeout': Number,
- 'fetch-retry-maxtimeout': Number,
- git: String,
- 'git-tag-version': Boolean,
- 'commit-hooks': Boolean,
- global: Boolean,
- globalconfig: path,
- 'global-style': Boolean,
- group: [Number, String],
- 'https-proxy': [null, url],
- 'user-agent': String,
- 'ham-it-up': Boolean,
- 'heading': String,
- 'if-present': Boolean,
- 'ignore-prepublish': Boolean,
- 'ignore-scripts': Boolean,
- 'init-module': path,
- 'init-author-name': String,
- 'init-author-email': String,
- 'init-author-url': ['', url],
- 'init-license': String,
- 'init-version': semver,
- json: Boolean,
- key: [null, String],
- 'legacy-bundling': Boolean,
- link: Boolean,
- 'local-address': getLocalAddresses(),
- loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'],
- logstream: Stream,
- 'logs-max': Number,
- long: Boolean,
- maxsockets: Number,
- message: String,
- 'metrics-registry': [null, String],
- 'node-options': [null, String],
- 'node-version': [null, semver],
- 'noproxy': [null, String, Array],
- offline: Boolean,
- 'onload-script': [null, String],
- only: [null, 'dev', 'development', 'prod', 'production'],
- optional: Boolean,
- 'package-lock': Boolean,
- otp: [null, String],
- 'package-lock-only': Boolean,
- parseable: Boolean,
- 'prefer-offline': Boolean,
- 'prefer-online': Boolean,
- prefix: path,
- preid: String,
- production: Boolean,
- progress: Boolean,
- proxy: [null, false, url], // allow proxy to be disabled explicitly
- 'read-only': Boolean,
- 'rebuild-bundle': Boolean,
- registry: [null, url],
- rollback: Boolean,
- save: Boolean,
- 'save-bundle': Boolean,
- 'save-dev': Boolean,
- 'save-exact': Boolean,
- 'save-optional': Boolean,
- 'save-prefix': String,
- 'save-prod': Boolean,
- scope: String,
- 'script-shell': [null, String],
- 'scripts-prepend-node-path': [false, true, 'auto', 'warn-only'],
- searchopts: String,
- searchexclude: [null, String],
- searchlimit: Number,
- searchstaleness: Number,
- 'send-metrics': Boolean,
- shell: String,
- shrinkwrap: Boolean,
- 'sign-git-commit': Boolean,
- 'sign-git-tag': Boolean,
- 'sso-poll-frequency': Number,
- 'sso-type': [null, 'oauth', 'saml'],
- 'strict-ssl': Boolean,
- tag: String,
- timing: Boolean,
- tmp: path,
- unicode: Boolean,
- 'unsafe-perm': Boolean,
- 'update-notifier': Boolean,
- usage: Boolean,
- user: [Number, String],
- userconfig: path,
- umask: Umask,
- version: Boolean,
- 'tag-version-prefix': String,
- versions: Boolean,
- viewer: String,
- _exit: Boolean
-}
-
-function getLocalAddresses () {
- var interfaces
- // #8094: some environments require elevated permissions to enumerate
- // interfaces, and synchronously throw EPERM when run without
- // elevated privileges
- try {
- interfaces = os.networkInterfaces()
- } catch (e) {
- interfaces = {}
- }
-
- return Object.keys(interfaces).map(
- nic => interfaces[nic].map(({address}) => address)
- ).reduce((curr, next) => curr.concat(next), []).concat(undefined)
-}
-
-exports.shorthands = {
- s: ['--loglevel', 'silent'],
- d: ['--loglevel', 'info'],
- dd: ['--loglevel', 'verbose'],
- ddd: ['--loglevel', 'silly'],
- noreg: ['--no-registry'],
- N: ['--no-registry'],
- reg: ['--registry'],
- 'no-reg': ['--no-registry'],
- silent: ['--loglevel', 'silent'],
- verbose: ['--loglevel', 'verbose'],
- quiet: ['--loglevel', 'warn'],
- q: ['--loglevel', 'warn'],
- h: ['--usage'],
- H: ['--usage'],
- '?': ['--usage'],
- help: ['--usage'],
- v: ['--version'],
- f: ['--force'],
- desc: ['--description'],
- 'no-desc': ['--no-description'],
- 'local': ['--no-global'],
- l: ['--long'],
- m: ['--message'],
- p: ['--parseable'],
- porcelain: ['--parseable'],
- readonly: ['--read-only'],
- g: ['--global'],
- S: ['--save'],
- D: ['--save-dev'],
- E: ['--save-exact'],
- O: ['--save-optional'],
- P: ['--save-prod'],
- y: ['--yes'],
- n: ['--no-yes'],
- B: ['--save-bundle'],
- C: ['--prefix']
-}
diff --git a/deps/node/deps/npm/lib/config/fetch-opts.js b/deps/node/deps/npm/lib/config/fetch-opts.js
deleted file mode 100644
index 213c293d..00000000
--- a/deps/node/deps/npm/lib/config/fetch-opts.js
+++ /dev/null
@@ -1,77 +0,0 @@
-'use strict'
-
-const url = require('url')
-
-module.exports.fromPacote = fromPacote
-
-function fromPacote (opts) {
- return {
- cache: getCacheMode(opts),
- cacheManager: opts.cache,
- ca: opts.ca,
- cert: opts.cert,
- headers: getHeaders('', opts.registry, opts),
- key: opts.key,
- localAddress: opts.localAddress,
- maxSockets: opts.maxSockets,
- proxy: opts.proxy,
- referer: opts.refer,
- retry: opts.retry,
- strictSSL: !!opts.strictSSL,
- timeout: opts.timeout,
- uid: opts.uid,
- gid: opts.gid
- }
-}
-
-function getCacheMode (opts) {
- return opts.offline
- ? 'only-if-cached'
- : opts.preferOffline
- ? 'force-cache'
- : opts.preferOnline
- ? 'no-cache'
- : 'default'
-}
-
-function getHeaders (uri, registry, opts) {
- const headers = Object.assign({
- 'npm-in-ci': opts.isFromCI,
- 'npm-scope': opts.projectScope,
- 'npm-session': opts.npmSession,
- 'user-agent': opts.userAgent,
- 'referer': opts.refer
- }, opts.headers)
- // check for auth settings specific to this registry
- let auth = (
- opts.auth &&
- opts.auth[registryKey(registry)]
- ) || opts.auth
- // If a tarball is hosted on a different place than the manifest, only send
- // credentials on `alwaysAuth`
- const shouldAuth = auth && (
- auth.alwaysAuth ||
- url.parse(uri).host === url.parse(registry).host
- )
- if (shouldAuth && auth.token) {
- headers.authorization = `Bearer ${auth.token}`
- } else if (shouldAuth && auth.username && auth.password) {
- const encoded = Buffer.from(
- `${auth.username}:${auth.password}`, 'utf8'
- ).toString('base64')
- headers.authorization = `Basic ${encoded}`
- } else if (shouldAuth && auth._auth) {
- headers.authorization = `Basic ${auth._auth}`
- }
- return headers
-}
-
-function registryKey (registry) {
- const parsed = url.parse(registry)
- const formatted = url.format({
- host: parsed.host,
- pathname: parsed.pathname,
- slashes: parsed.slashes
- })
- return url.resolve(formatted, '.')
-}
diff --git a/deps/node/deps/npm/lib/config/figgy-config.js b/deps/node/deps/npm/lib/config/figgy-config.js
deleted file mode 100644
index 9e9ca0ba..00000000
--- a/deps/node/deps/npm/lib/config/figgy-config.js
+++ /dev/null
@@ -1,87 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const crypto = require('crypto')
-const figgyPudding = require('figgy-pudding')
-const log = require('npmlog')
-const npm = require('../npm.js')
-const pack = require('../pack.js')
-const path = require('path')
-
-const npmSession = crypto.randomBytes(8).toString('hex')
-log.verbose('npm-session', npmSession)
-
-const SCOPE_REGISTRY_REGEX = /@.*:registry$/gi
-const NpmConfig = figgyPudding({}, {
- other (key) {
- return key.match(SCOPE_REGISTRY_REGEX)
- }
-})
-
-let baseConfig
-
-module.exports = mkConfig
-function mkConfig (...providers) {
- if (!baseConfig) {
- baseConfig = NpmConfig(npm.config, {
- // Add some non-npm-config opts by hand.
- cache: path.join(npm.config.get('cache'), '_cacache'),
- // NOTE: npm has some magic logic around color distinct from the config
- // value, so we have to override it here
- color: !!npm.color,
- dirPacker: pack.packGitDep,
- hashAlgorithm: 'sha1',
- includeDeprecated: false,
- log,
- 'npm-session': npmSession,
- 'project-scope': npm.projectScope,
- refer: npm.referer,
- dmode: npm.modes.exec,
- fmode: npm.modes.file,
- umask: npm.modes.umask,
- npmVersion: npm.version,
- tmp: npm.tmp,
- Promise: BB
- })
- const ownerStats = calculateOwner()
- if (ownerStats.uid != null || ownerStats.gid != null) {
- baseConfig = baseConfig.concat(ownerStats)
- }
- }
- let conf = baseConfig.concat(...providers)
- // Adapt some other configs if missing
- if (npm.config.get('prefer-online') === undefined) {
- conf = conf.concat({
- 'prefer-online': npm.config.get('cache-max') <= 0
- })
- }
- if (npm.config.get('prefer-online') === undefined) {
- conf = conf.concat({
- 'prefer-online': npm.config.get('cache-min') >= 9999
- })
- }
- return conf
-}
-
-let effectiveOwner
-function calculateOwner () {
- if (!effectiveOwner) {
- effectiveOwner = { uid: 0, gid: 0 }
-
- // Pretty much only on windows
- if (!process.getuid) {
- return effectiveOwner
- }
-
- effectiveOwner.uid = +process.getuid()
- effectiveOwner.gid = +process.getgid()
-
- if (effectiveOwner.uid === 0) {
- if (process.env.SUDO_UID) effectiveOwner.uid = +process.env.SUDO_UID
- if (process.env.SUDO_GID) effectiveOwner.gid = +process.env.SUDO_GID
- }
- }
-
- return effectiveOwner
-}
diff --git a/deps/node/deps/npm/lib/config/gentle-fs.js b/deps/node/deps/npm/lib/config/gentle-fs.js
deleted file mode 100644
index c4a1f9fa..00000000
--- a/deps/node/deps/npm/lib/config/gentle-fs.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict'
-
-const npm = require('../npm.js')
-const log = require('npmlog')
-
-module.exports = gentleFSOpts
-
-function gentleFSOpts (gently, base, abs) {
- return {
- // never rm the root, prefix, or bin dirs
- //
- // globals included because of `npm link` -- as far as the package
- // requesting the link is concerned, the linked package is always
- // installed globally
- prefixes: [
- npm.prefix,
- npm.globalPrefix,
- npm.dir,
- npm.root,
- npm.globalDir,
- npm.bin,
- npm.globalBin
- ],
- absolute: abs,
- log: log,
- prefix: npm.prefix,
- force: npm.config.get('force'),
- gently: gently,
- base: base,
- name: 'npm'
- }
-}
diff --git a/deps/node/deps/npm/lib/config/get-credentials-by-uri.js b/deps/node/deps/npm/lib/config/get-credentials-by-uri.js
deleted file mode 100644
index 21926c68..00000000
--- a/deps/node/deps/npm/lib/config/get-credentials-by-uri.js
+++ /dev/null
@@ -1,78 +0,0 @@
-var assert = require('assert')
-
-var toNerfDart = require('./nerf-dart.js')
-
-module.exports = getCredentialsByURI
-
-function getCredentialsByURI (uri) {
- assert(uri && typeof uri === 'string', 'registry URL is required')
- var nerfed = toNerfDart(uri)
- var defnerf = toNerfDart(this.get('registry'))
-
- // hidden class micro-optimization
- var c = {
- scope: nerfed,
- token: undefined,
- password: undefined,
- username: undefined,
- email: undefined,
- auth: undefined,
- alwaysAuth: undefined
- }
-
- // used to override scope matching for tokens as well as legacy auth
- if (this.get(nerfed + ':always-auth') !== undefined) {
- var val = this.get(nerfed + ':always-auth')
- c.alwaysAuth = val === 'false' ? false : !!val
- } else if (this.get('always-auth') !== undefined) {
- c.alwaysAuth = this.get('always-auth')
- }
-
- if (this.get(nerfed + ':_authToken')) {
- c.token = this.get(nerfed + ':_authToken')
- // the bearer token is enough, don't confuse things
- return c
- }
-
- if (this.get(nerfed + ':-authtoken')) {
- c.token = this.get(nerfed + ':-authtoken')
- // the bearer token is enough, don't confuse things
- return c
- }
-
- // Handle the old-style _auth=<base64> style for the default
- // registry, if set.
- var authDef = this.get('_auth')
- var userDef = this.get('username')
- var passDef = this.get('_password')
- if (authDef && !(userDef && passDef)) {
- authDef = Buffer.from(authDef, 'base64').toString()
- authDef = authDef.split(':')
- userDef = authDef.shift()
- passDef = authDef.join(':')
- }
-
- if (this.get(nerfed + ':_password')) {
- c.password = Buffer.from(this.get(nerfed + ':_password'), 'base64').toString('utf8')
- } else if (nerfed === defnerf && passDef) {
- c.password = passDef
- }
-
- if (this.get(nerfed + ':username')) {
- c.username = this.get(nerfed + ':username')
- } else if (nerfed === defnerf && userDef) {
- c.username = userDef
- }
-
- if (this.get(nerfed + ':email')) {
- c.email = this.get(nerfed + ':email')
- } else if (this.get('email')) {
- c.email = this.get('email')
- }
-
- if (c.username && c.password) {
- c.auth = Buffer.from(c.username + ':' + c.password).toString('base64')
- }
-
- return c
-}
diff --git a/deps/node/deps/npm/lib/config/lifecycle.js b/deps/node/deps/npm/lib/config/lifecycle.js
deleted file mode 100644
index 86941edc..00000000
--- a/deps/node/deps/npm/lib/config/lifecycle.js
+++ /dev/null
@@ -1,31 +0,0 @@
-'use strict'
-
-const npm = require('../npm.js')
-const log = require('npmlog')
-
-module.exports = lifecycleOpts
-
-let opts
-
-function lifecycleOpts (moreOpts) {
- if (!opts) {
- opts = {
- config: npm.config.snapshot,
- dir: npm.dir,
- failOk: false,
- force: npm.config.get('force'),
- group: npm.config.get('group'),
- ignorePrepublish: npm.config.get('ignore-prepublish'),
- ignoreScripts: npm.config.get('ignore-scripts'),
- log: log,
- nodeOptions: npm.config.get('node-options'),
- production: npm.config.get('production'),
- scriptShell: npm.config.get('script-shell'),
- scriptsPrependNodePath: npm.config.get('scripts-prepend-node-path'),
- unsafePerm: npm.config.get('unsafe-perm'),
- user: npm.config.get('user')
- }
- }
-
- return moreOpts ? Object.assign({}, opts, moreOpts) : opts
-}
diff --git a/deps/node/deps/npm/lib/config/load-cafile.js b/deps/node/deps/npm/lib/config/load-cafile.js
deleted file mode 100644
index de8f6162..00000000
--- a/deps/node/deps/npm/lib/config/load-cafile.js
+++ /dev/null
@@ -1,32 +0,0 @@
-module.exports = loadCAFile
-
-var fs = require('fs')
-
-function loadCAFile (cafilePath, cb) {
- if (!cafilePath) return process.nextTick(cb)
-
- fs.readFile(cafilePath, 'utf8', afterCARead.bind(this))
-
- function afterCARead (er, cadata) {
- if (er) {
- // previous cafile no longer exists, so just continue on gracefully
- if (er.code === 'ENOENT') return cb()
- return cb(er)
- }
-
- var delim = '-----END CERTIFICATE-----'
- var output
-
- output = cadata
- .split(delim)
- .filter(function (xs) {
- return !!xs.trim()
- })
- .map(function (xs) {
- return xs.trimLeft() + delim
- })
-
- this.set('ca', output)
- cb(null)
- }
-}
diff --git a/deps/node/deps/npm/lib/config/load-prefix.js b/deps/node/deps/npm/lib/config/load-prefix.js
deleted file mode 100644
index 090865d2..00000000
--- a/deps/node/deps/npm/lib/config/load-prefix.js
+++ /dev/null
@@ -1,51 +0,0 @@
-module.exports = loadPrefix
-
-var findPrefix = require('find-npm-prefix')
-var path = require('path')
-
-function loadPrefix (cb) {
- var cli = this.list[0]
-
- Object.defineProperty(this, 'prefix',
- {
- set: function (prefix) {
- var g = this.get('global')
- this[g ? 'globalPrefix' : 'localPrefix'] = prefix
- }.bind(this),
- get: function () {
- var g = this.get('global')
- return g ? this.globalPrefix : this.localPrefix
- }.bind(this),
- enumerable: true
- })
-
- Object.defineProperty(this, 'globalPrefix',
- {
- set: function (prefix) {
- this.set('prefix', prefix)
- }.bind(this),
- get: function () {
- return path.resolve(this.get('prefix'))
- }.bind(this),
- enumerable: true
- })
-
- var p
- Object.defineProperty(this, 'localPrefix',
- { set: function (prefix) { p = prefix },
- get: function () { return p },
- enumerable: true })
-
- // try to guess at a good node_modules location.
- // If we are *explicitly* given a prefix on the cli, then
- // always use that. otherwise, infer local prefix from cwd.
- if (Object.prototype.hasOwnProperty.call(cli, 'prefix')) {
- p = path.resolve(cli.prefix)
- process.nextTick(cb)
- } else {
- findPrefix(process.cwd()).then((found) => {
- p = found
- cb()
- }, cb)
- }
-}
diff --git a/deps/node/deps/npm/lib/config/load-uid.js b/deps/node/deps/npm/lib/config/load-uid.js
deleted file mode 100644
index 859eac74..00000000
--- a/deps/node/deps/npm/lib/config/load-uid.js
+++ /dev/null
@@ -1,15 +0,0 @@
-module.exports = loadUid
-
-var getUid = require('uid-number')
-
-// Call in the context of a npmconf object
-
-function loadUid (cb) {
- // if we're not in unsafe-perm mode, then figure out who
- // to run stuff as. Do this first, to support `npm update npm -g`
- if (!this.get('unsafe-perm')) {
- getUid(this.get('user'), this.get('group'), cb)
- } else {
- process.nextTick(cb)
- }
-}
diff --git a/deps/node/deps/npm/lib/config/nerf-dart.js b/deps/node/deps/npm/lib/config/nerf-dart.js
deleted file mode 100644
index 8d2bdd26..00000000
--- a/deps/node/deps/npm/lib/config/nerf-dart.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var url = require('url')
-
-module.exports = toNerfDart
-
-/**
- * Maps a URL to an identifier.
- *
- * Name courtesy schiffertronix media LLC, a New Jersey corporation
- *
- * @param {String} uri The URL to be nerfed.
- *
- * @returns {String} A nerfed URL.
- */
-function toNerfDart (uri) {
- var parsed = url.parse(uri)
- delete parsed.protocol
- delete parsed.auth
- delete parsed.query
- delete parsed.search
- delete parsed.hash
-
- return url.resolve(url.format(parsed), '.')
-}
diff --git a/deps/node/deps/npm/lib/config/set-credentials-by-uri.js b/deps/node/deps/npm/lib/config/set-credentials-by-uri.js
deleted file mode 100644
index 4723d561..00000000
--- a/deps/node/deps/npm/lib/config/set-credentials-by-uri.js
+++ /dev/null
@@ -1,39 +0,0 @@
-var assert = require('assert')
-
-var toNerfDart = require('./nerf-dart.js')
-
-module.exports = setCredentialsByURI
-
-function setCredentialsByURI (uri, c) {
- assert(uri && typeof uri === 'string', 'registry URL is required')
- assert(c && typeof c === 'object', 'credentials are required')
-
- var nerfed = toNerfDart(uri)
-
- if (c.token) {
- this.set(nerfed + ':_authToken', c.token, 'user')
- this.del(nerfed + ':_password', 'user')
- this.del(nerfed + ':username', 'user')
- this.del(nerfed + ':email', 'user')
- this.del(nerfed + ':always-auth', 'user')
- } else if (c.username || c.password || c.email) {
- assert(c.username, 'must include username')
- assert(c.password, 'must include password')
- assert(c.email, 'must include email address')
-
- this.del(nerfed + ':_authToken', 'user')
-
- var encoded = Buffer.from(c.password, 'utf8').toString('base64')
- this.set(nerfed + ':_password', encoded, 'user')
- this.set(nerfed + ':username', c.username, 'user')
- this.set(nerfed + ':email', c.email, 'user')
-
- if (c.alwaysAuth !== undefined) {
- this.set(nerfed + ':always-auth', c.alwaysAuth, 'user')
- } else {
- this.del(nerfed + ':always-auth', 'user')
- }
- } else {
- throw new Error('No credentials to set.')
- }
-}
diff --git a/deps/node/deps/npm/lib/config/set-user.js b/deps/node/deps/npm/lib/config/set-user.js
deleted file mode 100644
index 14cc21d2..00000000
--- a/deps/node/deps/npm/lib/config/set-user.js
+++ /dev/null
@@ -1,29 +0,0 @@
-module.exports = setUser
-
-var assert = require('assert')
-var path = require('path')
-var fs = require('fs')
-var mkdirp = require('mkdirp')
-
-function setUser (cb) {
- var defaultConf = this.root
- assert(defaultConf !== Object.prototype)
-
- // If global, leave it as-is.
- // If not global, then set the user to the owner of the prefix folder.
- // Just set the default, so it can be overridden.
- if (this.get('global')) return cb()
- if (process.env.SUDO_UID) {
- defaultConf.user = +(process.env.SUDO_UID)
- return cb()
- }
-
- var prefix = path.resolve(this.get('prefix'))
- mkdirp(prefix, function (er) {
- if (er) return cb(er)
- fs.stat(prefix, function (er, st) {
- defaultConf.user = st && st.uid
- return cb(er)
- })
- })
-}
diff --git a/deps/node/deps/npm/lib/dedupe.js b/deps/node/deps/npm/lib/dedupe.js
deleted file mode 100644
index 325faeaa..00000000
--- a/deps/node/deps/npm/lib/dedupe.js
+++ /dev/null
@@ -1,160 +0,0 @@
-var util = require('util')
-var path = require('path')
-var validate = require('aproba')
-var without = require('lodash.without')
-var asyncMap = require('slide').asyncMap
-var chain = require('slide').chain
-var npa = require('npm-package-arg')
-var log = require('npmlog')
-var npm = require('./npm.js')
-var Installer = require('./install.js').Installer
-var findRequirement = require('./install/deps.js').findRequirement
-var earliestInstallable = require('./install/deps.js').earliestInstallable
-var checkPermissions = require('./install/check-permissions.js')
-var decomposeActions = require('./install/decompose-actions.js')
-var loadExtraneous = require('./install/deps.js').loadExtraneous
-var computeMetadata = require('./install/deps.js').computeMetadata
-var sortActions = require('./install/diff-trees.js').sortActions
-var moduleName = require('./utils/module-name.js')
-var packageId = require('./utils/package-id.js')
-var childPath = require('./utils/child-path.js')
-var usage = require('./utils/usage')
-var getRequested = require('./install/get-requested.js')
-
-module.exports = dedupe
-module.exports.Deduper = Deduper
-
-dedupe.usage = usage(
- 'dedupe',
- 'npm dedupe'
-)
-
-function dedupe (args, cb) {
- validate('AF', arguments)
- // the /path/to/node_modules/..
- var where = path.resolve(npm.dir, '..')
- var dryrun = false
- if (npm.command.match(/^find/)) dryrun = true
- if (npm.config.get('dry-run')) dryrun = true
- if (dryrun && !npm.config.get('json')) npm.config.set('parseable', true)
-
- new Deduper(where, dryrun).run(cb)
-}
-
-function Deduper (where, dryrun) {
- validate('SB', arguments)
- Installer.call(this, where, dryrun, [])
- this.noPackageJsonOk = true
- this.topLevelLifecycles = false
-}
-util.inherits(Deduper, Installer)
-
-Deduper.prototype.loadIdealTree = function (cb) {
- validate('F', arguments)
- log.silly('install', 'loadIdealTree')
-
- var self = this
- chain([
- [this.newTracker(this.progress.loadIdealTree, 'cloneCurrentTree')],
- [this, this.cloneCurrentTreeToIdealTree],
- [this, this.finishTracker, 'cloneCurrentTree'],
-
- [this.newTracker(this.progress.loadIdealTree, 'loadAllDepsIntoIdealTree', 10)],
- [ function (next) {
- loadExtraneous(self.idealTree, self.progress.loadAllDepsIntoIdealTree, next)
- } ],
- [this, this.finishTracker, 'loadAllDepsIntoIdealTree'],
-
- [this, andComputeMetadata(this.idealTree)]
- ], cb)
-}
-
-function andComputeMetadata (tree) {
- return function (next) {
- next(null, computeMetadata(tree))
- }
-}
-
-Deduper.prototype.generateActionsToTake = function (cb) {
- validate('F', arguments)
- log.silly('dedupe', 'generateActionsToTake')
- chain([
- [this.newTracker(log, 'hoist', 1)],
- [hoistChildren, this.idealTree, this.differences],
- [this, this.finishTracker, 'hoist'],
- [this.newTracker(log, 'sort-actions', 1)],
- [this, function (next) {
- this.differences = sortActions(this.differences)
- next()
- }],
- [this, this.finishTracker, 'sort-actions'],
- [checkPermissions, this.differences],
- [decomposeActions, this.differences, this.todo]
- ], cb)
-}
-
-function move (node, hoistTo, diff) {
- node.parent.children = without(node.parent.children, node)
- hoistTo.children.push(node)
- node.fromPath = node.path
- node.path = childPath(hoistTo.path, node)
- node.parent = hoistTo
- if (!diff.filter(function (action) { return action[0] === 'move' && action[1] === node }).length) {
- diff.push(['move', node])
- }
-}
-
-function moveRemainingChildren (node, diff) {
- node.children.forEach(function (child) {
- move(child, node, diff)
- moveRemainingChildren(child, diff)
- })
-}
-
-function remove (child, diff, done) {
- remove_(child, diff, new Set(), done)
-}
-
-function remove_ (child, diff, seen, done) {
- if (seen.has(child)) return done()
- seen.add(child)
- diff.push(['remove', child])
- child.parent.children = without(child.parent.children, child)
- asyncMap(child.children, function (child, next) {
- remove_(child, diff, seen, next)
- }, done)
-}
-
-function hoistChildren (tree, diff, next) {
- hoistChildren_(tree, diff, new Set(), next)
-}
-
-function hoistChildren_ (tree, diff, seen, next) {
- validate('OAOF', arguments)
- if (seen.has(tree)) return next()
- seen.add(tree)
- asyncMap(tree.children, function (child, done) {
- if (!tree.parent || child.fromBundle || child.package._inBundle) return hoistChildren_(child, diff, seen, done)
- var better = findRequirement(tree.parent, moduleName(child), getRequested(child) || npa(packageId(child)))
- if (better) {
- return chain([
- [remove, child, diff],
- [andComputeMetadata(tree)]
- ], done)
- }
- var hoistTo = earliestInstallable(tree, tree.parent, child.package, log)
- if (hoistTo) {
- move(child, hoistTo, diff)
- chain([
- [andComputeMetadata(hoistTo)],
- [hoistChildren_, child, diff, seen],
- [ function (next) {
- moveRemainingChildren(child, diff)
- next()
- } ]
- ], done)
- } else {
- done()
- }
- }, next)
-}
diff --git a/deps/node/deps/npm/lib/deprecate.js b/deps/node/deps/npm/lib/deprecate.js
deleted file mode 100644
index 7fe2fbed..00000000
--- a/deps/node/deps/npm/lib/deprecate.js
+++ /dev/null
@@ -1,72 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const npmConfig = require('./config/figgy-config.js')
-const fetch = require('libnpm/fetch')
-const figgyPudding = require('figgy-pudding')
-const otplease = require('./utils/otplease.js')
-const npa = require('libnpm/parse-arg')
-const semver = require('semver')
-const whoami = require('./whoami.js')
-
-const DeprecateConfig = figgyPudding({})
-
-module.exports = deprecate
-
-deprecate.usage = 'npm deprecate <pkg>[@<version>] <message>'
-
-deprecate.completion = function (opts, cb) {
- return BB.try(() => {
- if (opts.conf.argv.remain.length > 2) { return }
- return whoami([], true, () => {}).then(username => {
- if (username) {
- // first, get a list of remote packages this user owns.
- // once we have a user account, then don't complete anything.
- // get the list of packages by user
- return fetch(
- `/-/by-user/${encodeURIComponent(username)}`,
- DeprecateConfig()
- ).then(list => list[username])
- }
- })
- }).nodeify(cb)
-}
-
-function deprecate ([pkg, msg], opts, cb) {
- if (typeof cb !== 'function') {
- cb = opts
- opts = null
- }
- opts = DeprecateConfig(opts || npmConfig())
- return BB.try(() => {
- if (msg == null) throw new Error(`Usage: ${deprecate.usage}`)
- // fetch the data and make sure it exists.
- const p = npa(pkg)
-
- // npa makes the default spec "latest", but for deprecation
- // "*" is the appropriate default.
- const spec = p.rawSpec === '' ? '*' : p.fetchSpec
-
- if (semver.validRange(spec, true) === null) {
- throw new Error('invalid version range: ' + spec)
- }
-
- const uri = '/' + p.escapedName
- return fetch.json(uri, opts.concat({
- spec: p,
- query: {write: true}
- })).then(packument => {
- // filter all the versions that match
- Object.keys(packument.versions)
- .filter(v => semver.satisfies(v, spec))
- .forEach(v => { packument.versions[v].deprecated = msg })
- return otplease(opts, opts => fetch(uri, opts.concat({
- spec: p,
- method: 'PUT',
- body: packument,
- ignoreBody: true
- })))
- })
- }).nodeify(cb)
-}
diff --git a/deps/node/deps/npm/lib/dist-tag.js b/deps/node/deps/npm/lib/dist-tag.js
deleted file mode 100644
index 176e6122..00000000
--- a/deps/node/deps/npm/lib/dist-tag.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/* eslint-disable standard/no-callback-literal */
-module.exports = distTag
-
-const BB = require('bluebird')
-
-const figgyPudding = require('figgy-pudding')
-const log = require('npmlog')
-const npa = require('libnpm/parse-arg')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const otplease = require('./utils/otplease.js')
-const readLocalPkg = BB.promisify(require('./utils/read-local-package.js'))
-const regFetch = require('libnpm/fetch')
-const semver = require('semver')
-const usage = require('./utils/usage')
-
-const DistTagOpts = figgyPudding({
- tag: {}
-})
-
-distTag.usage = usage(
- 'dist-tag',
- 'npm dist-tag add <pkg>@<version> [<tag>]' +
- '\nnpm dist-tag rm <pkg> <tag>' +
- '\nnpm dist-tag ls [<pkg>]'
-)
-
-distTag.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
- if (argv.length === 2) {
- return cb(null, ['add', 'rm', 'ls'])
- }
-
- switch (argv[2]) {
- default:
- return cb()
- }
-}
-
-function UsageError () {
- throw Object.assign(new Error('Usage:\n' + distTag.usage), {
- code: 'EUSAGE'
- })
-}
-
-function distTag ([cmd, pkg, tag], cb) {
- const opts = DistTagOpts(npmConfig())
- return BB.try(() => {
- switch (cmd) {
- case 'add': case 'a': case 'set': case 's':
- return add(pkg, tag, opts)
- case 'rm': case 'r': case 'del': case 'd': case 'remove':
- return remove(pkg, tag, opts)
- case 'ls': case 'l': case 'sl': case 'list':
- return list(pkg, opts)
- default:
- if (!pkg) {
- return list(cmd, opts)
- } else {
- UsageError()
- }
- }
- }).then(
- x => cb(null, x),
- err => {
- if (err.code === 'EUSAGE') {
- cb(err.message)
- } else {
- cb(err)
- }
- }
- )
-}
-
-function add (spec, tag, opts) {
- spec = npa(spec || '')
- const version = spec.rawSpec
- const t = (tag || opts.tag).trim()
-
- log.verbose('dist-tag add', t, 'to', spec.name + '@' + version)
-
- if (!spec || !version || !t) UsageError()
-
- if (semver.validRange(t)) {
- throw new Error('Tag name must not be a valid SemVer range: ' + t)
- }
-
- return fetchTags(spec, opts).then(tags => {
- if (tags[t] === version) {
- log.warn('dist-tag add', t, 'is already set to version', version)
- return
- }
- tags[t] = version
- const url = `/-/package/${spec.escapedName}/dist-tags/${encodeURIComponent(t)}`
- const reqOpts = opts.concat({
- method: 'PUT',
- body: JSON.stringify(version),
- headers: {
- 'content-type': 'application/json'
- },
- spec
- })
- return otplease(reqOpts, reqOpts => regFetch(url, reqOpts)).then(() => {
- output(`+${t}: ${spec.name}@${version}`)
- })
- })
-}
-
-function remove (spec, tag, opts) {
- spec = npa(spec || '')
- log.verbose('dist-tag del', tag, 'from', spec.name)
-
- return fetchTags(spec, opts).then(tags => {
- if (!tags[tag]) {
- log.info('dist-tag del', tag, 'is not a dist-tag on', spec.name)
- throw new Error(tag + ' is not a dist-tag on ' + spec.name)
- }
- const version = tags[tag]
- delete tags[tag]
- const url = `/-/package/${spec.escapedName}/dist-tags/${encodeURIComponent(tag)}`
- const reqOpts = opts.concat({
- method: 'DELETE'
- })
- return otplease(reqOpts, reqOpts => regFetch(url, reqOpts)).then(() => {
- output(`-${tag}: ${spec.name}@${version}`)
- })
- })
-}
-
-function list (spec, opts) {
- if (!spec) {
- return readLocalPkg().then(pkg => {
- if (!pkg) { UsageError() }
- return list(pkg, opts)
- })
- }
- spec = npa(spec)
-
- return fetchTags(spec, opts).then(tags => {
- var msg = Object.keys(tags).map(k => `${k}: ${tags[k]}`).sort().join('\n')
- output(msg)
- return tags
- }, err => {
- log.error('dist-tag ls', "Couldn't get dist-tag data for", spec)
- throw err
- })
-}
-
-function fetchTags (spec, opts) {
- return regFetch.json(
- `/-/package/${spec.escapedName}/dist-tags`,
- opts.concat({
- 'prefer-online': true,
- spec
- })
- ).then(data => {
- if (data && typeof data === 'object') delete data._etag
- if (!data || !Object.keys(data).length) {
- throw new Error('No dist-tags found for ' + spec.name)
- }
- return data
- })
-}
diff --git a/deps/node/deps/npm/lib/docs.js b/deps/node/deps/npm/lib/docs.js
deleted file mode 100644
index 6d67da4e..00000000
--- a/deps/node/deps/npm/lib/docs.js
+++ /dev/null
@@ -1,41 +0,0 @@
-module.exports = docs
-
-var openUrl = require('./utils/open-url')
-var log = require('npmlog')
-var fetchPackageMetadata = require('./fetch-package-metadata.js')
-var usage = require('./utils/usage')
-
-docs.usage = usage(
- 'docs',
- 'npm docs <pkgname>' +
- '\nnpm docs .'
-)
-docs.completion = function (opts, cb) {
- // FIXME: there used to be registry completion here, but it stopped making
- // sense somewhere around 50,000 packages on the registry
- cb()
-}
-
-function docs (args, cb) {
- if (!args || !args.length) args = ['.']
- var pending = args.length
- log.silly('docs', args)
- args.forEach(function (proj) {
- getDoc(proj, function (err) {
- if (err) {
- return cb(err)
- }
- --pending || cb()
- })
- })
-}
-
-function getDoc (project, cb) {
- log.silly('getDoc', project)
- fetchPackageMetadata(project, '.', {fullMetadata: true}, function (er, d) {
- if (er) return cb(er)
- var url = d.homepage
- if (!url) url = 'https://www.npmjs.org/package/' + d.name
- return openUrl(url, 'docs available at the following URL', cb)
- })
-}
diff --git a/deps/node/deps/npm/lib/doctor.js b/deps/node/deps/npm/lib/doctor.js
deleted file mode 100644
index 95ede1bc..00000000
--- a/deps/node/deps/npm/lib/doctor.js
+++ /dev/null
@@ -1,113 +0,0 @@
-'use strict'
-
-const ansiTrim = require('./utils/ansi-trim')
-const chain = require('slide').chain
-const color = require('ansicolors')
-const defaultRegistry = require('./config/defaults').defaults.registry
-const log = require('npmlog')
-const npm = require('./npm')
-const output = require('./utils/output')
-const path = require('path')
-const semver = require('semver')
-const styles = require('ansistyles')
-const table = require('text-table')
-
-// steps
-const checkFilesPermission = require('./doctor/check-files-permission')
-const checkPing = require('./doctor/check-ping')
-const getGitPath = require('./doctor/get-git-path')
-const getLatestNodejsVersion = require('./doctor/get-latest-nodejs-version')
-const getLatestNpmVersion = require('./doctor/get-latest-npm-version')
-const verifyCachedFiles = require('./doctor/verify-cached-files')
-
-const globalNodeModules = path.join(npm.config.globalPrefix, 'lib', 'node_modules')
-const localNodeModules = path.join(npm.config.localPrefix, 'node_modules')
-
-module.exports = doctor
-
-doctor.usage = 'npm doctor'
-
-function doctor (args, silent, cb) {
- args = args || {}
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
-
- const actionsToRun = [
- [checkPing],
- [getLatestNpmVersion],
- [getLatestNodejsVersion, args['node-url']],
- [getGitPath],
- [checkFilesPermission, npm.cache, 4, 6],
- [checkFilesPermission, globalNodeModules, 4, 4],
- [checkFilesPermission, localNodeModules, 6, 6],
- [verifyCachedFiles, path.join(npm.cache, '_cacache')]
- ]
-
- log.info('doctor', 'Running checkup')
- chain(actionsToRun, function (stderr, stdout) {
- if (stderr && stderr.message !== 'not found: git') return cb(stderr)
- const list = makePretty(stdout)
- let outHead = ['Check', 'Value', 'Recommendation']
- let outBody = list
-
- if (npm.color) {
- outHead = outHead.map(function (item) {
- return styles.underline(item)
- })
- outBody = outBody.map(function (item) {
- if (item[2]) {
- item[0] = color.red(item[0])
- item[2] = color.magenta(item[2])
- }
- return item
- })
- }
-
- const outTable = [outHead].concat(outBody)
- const tableOpts = {
- stringLength: function (s) { return ansiTrim(s).length }
- }
-
- if (!silent) output(table(outTable, tableOpts))
-
- cb(null, list)
- })
-}
-
-function makePretty (p) {
- const ping = p[1]
- const npmLTS = p[2]
- const nodeLTS = p[3].replace('v', '')
- const whichGit = p[4] || 'not installed'
- const readbleCaches = p[5] ? 'ok' : 'notOk'
- const executableGlobalModules = p[6] ? 'ok' : 'notOk'
- const executableLocalModules = p[7] ? 'ok' : 'notOk'
- const cacheStatus = p[8] ? `verified ${p[8].verifiedContent} tarballs` : 'notOk'
- const npmV = npm.version
- const nodeV = process.version.replace('v', '')
- const registry = npm.config.get('registry')
- const list = [
- ['npm ping', ping],
- ['npm -v', 'v' + npmV],
- ['node -v', 'v' + nodeV],
- ['npm config get registry', registry],
- ['which git', whichGit],
- ['Perms check on cached files', readbleCaches],
- ['Perms check on global node_modules', executableGlobalModules],
- ['Perms check on local node_modules', executableLocalModules],
- ['Verify cache contents', cacheStatus]
- ]
-
- if (p[0] !== 200) list[0][2] = 'Check your internet connection'
- if (!semver.satisfies(npmV, '>=' + npmLTS)) list[1][2] = 'Use npm v' + npmLTS
- if (!semver.satisfies(nodeV, '>=' + nodeLTS)) list[2][2] = 'Use node v' + nodeLTS
- if (registry !== defaultRegistry) list[3][2] = 'Try `npm config set registry ' + defaultRegistry + '`'
- if (whichGit === 'not installed') list[4][2] = 'Install git and ensure it\'s in your PATH.'
- if (readbleCaches !== 'ok') list[5][2] = 'Check the permissions of your files in ' + npm.config.get('cache')
- if (executableGlobalModules !== 'ok') list[6][2] = globalNodeModules + ' must be readable and writable by the current user.'
- if (executableLocalModules !== 'ok') list[7][2] = localNodeModules + ' must be readable and writable by the current user.'
-
- return list
-}
diff --git a/deps/node/deps/npm/lib/doctor/check-files-permission.js b/deps/node/deps/npm/lib/doctor/check-files-permission.js
deleted file mode 100644
index 1cefb6e6..00000000
--- a/deps/node/deps/npm/lib/doctor/check-files-permission.js
+++ /dev/null
@@ -1,57 +0,0 @@
-var fs = require('fs')
-var path = require('path')
-var getUid = require('uid-number')
-var chain = require('slide').chain
-var log = require('npmlog')
-var npm = require('../npm.js')
-var fileCompletion = require('../utils/completion/file-completion.js')
-
-function checkFilesPermission (root, fmask, dmask, cb) {
- if (process.platform === 'win32') return cb(null, true)
- getUid(npm.config.get('user'), npm.config.get('group'), function (e, uid, gid) {
- var tracker = log.newItem('checkFilePermissions', 1)
- if (e) {
- tracker.finish()
- tracker.warn('checkFilePermissions', 'Error looking up user and group:', e)
- return cb(e)
- }
- tracker.info('checkFilePermissions', 'Building file list of ' + root)
- fileCompletion(root, '.', Infinity, function (e, files) {
- if (e) {
- tracker.warn('checkFilePermissions', 'Error building file list:', e)
- tracker.finish()
- return cb(e)
- }
- tracker.addWork(files.length)
- tracker.completeWork(1)
- chain(files.map(andCheckFile), function (er) {
- tracker.finish()
- cb(null, !er)
- })
- function andCheckFile (f) {
- return [checkFile, f]
- }
- function checkFile (f, next) {
- var file = path.join(root, f)
- tracker.silly('checkFilePermissions', f)
- fs.lstat(file, function (e, stat) {
- tracker.completeWork(1)
- if (e) return next(e)
- if (!stat.isDirectory() && !stat.isFile()) return next()
- // 6 = fs.constants.R_OK | fs.constants.W_OK
- // constants aren't available on v4
- fs.access(file, stat.isFile() ? fmask : dmask, (err) => {
- if (err) {
- tracker.error('checkFilePermissions', `Missing permissions on ${file}`)
- return next(new Error('Missing permissions for ' + file))
- } else {
- return next()
- }
- })
- })
- }
- })
- })
-}
-
-module.exports = checkFilesPermission
diff --git a/deps/node/deps/npm/lib/doctor/check-ping.js b/deps/node/deps/npm/lib/doctor/check-ping.js
deleted file mode 100644
index 70db2554..00000000
--- a/deps/node/deps/npm/lib/doctor/check-ping.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var log = require('npmlog')
-var ping = require('../ping.js')
-
-function checkPing (cb) {
- var tracker = log.newItem('checkPing', 1)
- tracker.info('checkPing', 'Pinging registry')
- ping({}, true, (err, pong) => {
- if (err && err.code && err.code.match(/^E\d{3}$/)) {
- return cb(null, [err.code.substr(1)])
- } else {
- cb(null, [200, 'OK'])
- }
- })
-}
-
-module.exports = checkPing
diff --git a/deps/node/deps/npm/lib/doctor/get-git-path.js b/deps/node/deps/npm/lib/doctor/get-git-path.js
deleted file mode 100644
index 5b00e9d5..00000000
--- a/deps/node/deps/npm/lib/doctor/get-git-path.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var log = require('npmlog')
-var which = require('which')
-
-function getGitPath (cb) {
- var tracker = log.newItem('getGitPath', 1)
- tracker.info('getGitPath', 'Finding git in your PATH')
- which('git', function (err, path) {
- tracker.finish()
- cb(err, path)
- })
-}
-
-module.exports = getGitPath
diff --git a/deps/node/deps/npm/lib/doctor/get-latest-nodejs-version.js b/deps/node/deps/npm/lib/doctor/get-latest-nodejs-version.js
deleted file mode 100644
index 1586b087..00000000
--- a/deps/node/deps/npm/lib/doctor/get-latest-nodejs-version.js
+++ /dev/null
@@ -1,27 +0,0 @@
-var log = require('npmlog')
-var request = require('request')
-var semver = require('semver')
-
-function getLatestNodejsVersion (url, cb) {
- var tracker = log.newItem('getLatestNodejsVersion', 1)
- tracker.info('getLatestNodejsVersion', 'Getting Node.js release information')
- var version = 'v0.0.0'
- url = url || 'https://nodejs.org/dist/index.json'
- request(url, function (e, res, index) {
- tracker.finish()
- if (e) return cb(e)
- if (res.statusCode !== 200) {
- return cb(new Error('Status not 200, ' + res.statusCode))
- }
- try {
- JSON.parse(index).forEach(function (item) {
- if (item.lts && semver.gt(item.version, version)) version = item.version
- })
- cb(null, version)
- } catch (e) {
- cb(e)
- }
- })
-}
-
-module.exports = getLatestNodejsVersion
diff --git a/deps/node/deps/npm/lib/doctor/get-latest-npm-version.js b/deps/node/deps/npm/lib/doctor/get-latest-npm-version.js
deleted file mode 100644
index 5a096ab8..00000000
--- a/deps/node/deps/npm/lib/doctor/get-latest-npm-version.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var log = require('npmlog')
-var fetchPackageMetadata = require('../fetch-package-metadata')
-
-function getLatestNpmVersion (cb) {
- var tracker = log.newItem('getLatestNpmVersion', 1)
- tracker.info('getLatestNpmVersion', 'Getting npm package information')
- fetchPackageMetadata('npm@latest', '.', {}, function (err, d) {
- tracker.finish()
- if (err) { return cb(err) }
- cb(null, d.version)
- })
-}
-
-module.exports = getLatestNpmVersion
diff --git a/deps/node/deps/npm/lib/doctor/verify-cached-files.js b/deps/node/deps/npm/lib/doctor/verify-cached-files.js
deleted file mode 100644
index f00dbd62..00000000
--- a/deps/node/deps/npm/lib/doctor/verify-cached-files.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict'
-
-const cacache = require('cacache')
-const log = require('npmlog')
-
-module.exports = verifyCachedFiles
-function verifyCachedFiles (cache, cb) {
- log.info('verifyCachedFiles', `Verifying cache at ${cache}`)
- cacache.verify(cache).then((stats) => {
- log.info('verifyCachedFiles', `Verification complete. Stats: ${JSON.stringify(stats, 2)}`)
- if (stats.reclaimedCount || stats.badContentCount || stats.missingContent) {
- stats.badContentCount && log.warn('verifyCachedFiles', `Corrupted content removed: ${stats.badContentCount}`)
- stats.reclaimedCount && log.warn('verifyCachedFiles', `Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
- stats.missingContent && log.warn('verifyCachedFiles', `Missing content: ${stats.missingContent}`)
- log.warn('verifyCachedFiles', 'Cache issues have been fixed')
- }
- return stats
- }).then((s) => cb(null, s), cb)
-}
diff --git a/deps/node/deps/npm/lib/edit.js b/deps/node/deps/npm/lib/edit.js
deleted file mode 100644
index 2e8b339e..00000000
--- a/deps/node/deps/npm/lib/edit.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// npm edit <pkg>
-// open the package folder in the $EDITOR
-
-module.exports = edit
-edit.usage = 'npm edit <pkg>[/<subpkg>...]'
-
-edit.completion = require('./utils/completion/installed-shallow.js')
-
-var npm = require('./npm.js')
-var path = require('path')
-var fs = require('graceful-fs')
-var editor = require('editor')
-var noProgressTillDone = require('./utils/no-progress-while-running').tillDone
-
-function edit (args, cb) {
- var p = args[0]
- if (args.length !== 1 || !p) return cb(edit.usage)
- var e = npm.config.get('editor')
- if (!e) {
- return cb(new Error(
- "No editor set. Set the 'editor' config, or $EDITOR environ."
- ))
- }
- p = p.split('/')
- // combine scoped parts
- .reduce(function (parts, part) {
- if (parts.length === 0) {
- return [part]
- }
- var lastPart = parts[parts.length - 1]
- // check if previous part is the first part of a scoped package
- if (lastPart[0] === '@' && !lastPart.includes('/')) {
- parts[parts.length - 1] += '/' + part
- } else {
- parts.push(part)
- }
- return parts
- }, [])
- .join('/node_modules/')
- .replace(/(\/node_modules)+/, '/node_modules')
- var f = path.resolve(npm.dir, p)
- fs.lstat(f, function (er) {
- if (er) return cb(er)
- editor(f, { editor: e }, noProgressTillDone(function (er) {
- if (er) return cb(er)
- npm.commands.rebuild(args, cb)
- }))
- })
-}
diff --git a/deps/node/deps/npm/lib/explore.js b/deps/node/deps/npm/lib/explore.js
deleted file mode 100644
index 826a527f..00000000
--- a/deps/node/deps/npm/lib/explore.js
+++ /dev/null
@@ -1,59 +0,0 @@
-// npm explore <pkg>[@<version>]
-// open a subshell to the package folder.
-
-module.exports = explore
-explore.usage = 'npm explore <pkg> [ -- <command>]'
-explore.completion = require('./utils/completion/installed-shallow.js')
-
-var npm = require('./npm.js')
-var spawn = require('./utils/spawn')
-var path = require('path')
-var fs = require('graceful-fs')
-var isWindowsShell = require('./utils/is-windows-shell.js')
-var escapeExecPath = require('./utils/escape-exec-path.js')
-var escapeArg = require('./utils/escape-arg.js')
-var output = require('./utils/output.js')
-
-function explore (args, cb) {
- if (args.length < 1 || !args[0]) return cb(explore.usage)
- var p = args.shift()
-
- var cwd = path.resolve(npm.dir, p)
- var opts = {cwd: cwd, stdio: 'inherit'}
-
- var shellArgs = []
- if (args) {
- if (isWindowsShell) {
- var execCmd = escapeExecPath(args.shift())
- var execArgs = [execCmd].concat(args.map(escapeArg))
- opts.windowsVerbatimArguments = true
- shellArgs = ['/d', '/s', '/c'].concat(execArgs)
- } else {
- shellArgs.unshift('-c')
- shellArgs = ['-c', args.map(escapeArg).join(' ').trim()]
- }
- }
-
- var sh = npm.config.get('shell')
- fs.stat(cwd, function (er, s) {
- if (er || !s.isDirectory()) {
- return cb(new Error(
- "It doesn't look like " + p + ' is installed.'
- ))
- }
-
- if (!shellArgs.length) {
- output(
- '\nExploring ' + cwd + '\n' +
- "Type 'exit' or ^D when finished\n"
- )
- }
-
- var shell = spawn(sh, shellArgs, opts)
- shell.on('close', function (er) {
- // only fail if non-interactive.
- if (!shellArgs.length) return cb()
- cb(er)
- })
- })
-}
diff --git a/deps/node/deps/npm/lib/fetch-package-metadata.js b/deps/node/deps/npm/lib/fetch-package-metadata.js
deleted file mode 100644
index 78eed42b..00000000
--- a/deps/node/deps/npm/lib/fetch-package-metadata.js
+++ /dev/null
@@ -1,118 +0,0 @@
-'use strict'
-
-const deprCheck = require('./utils/depr-check')
-const path = require('path')
-const log = require('npmlog')
-const readPackageTree = require('read-package-tree')
-const rimraf = require('rimraf')
-const validate = require('aproba')
-const npa = require('npm-package-arg')
-const npm = require('./npm')
-let npmConfig
-const npmlog = require('npmlog')
-const limit = require('call-limit')
-const tempFilename = require('./utils/temp-filename')
-const pacote = require('pacote')
-const isWindows = require('./utils/is-windows.js')
-
-function andLogAndFinish (spec, tracker, done) {
- validate('SOF|SZF|OOF|OZF', [spec, tracker, done])
- return (er, pkg) => {
- if (er) {
- log.silly('fetchPackageMetaData', 'error for ' + String(spec), er.message)
- if (tracker) tracker.finish()
- }
- return done(er, pkg)
- }
-}
-
-const CACHE = require('lru-cache')({
- max: 300 * 1024 * 1024,
- length: (p) => p._contentLength
-})
-
-module.exports = limit(fetchPackageMetadata, npm.limit.fetch)
-function fetchPackageMetadata (spec, where, opts, done) {
- validate('SSOF|SSFZ|OSOF|OSFZ', [spec, where, opts, done])
-
- if (!done) {
- done = opts
- opts = {}
- }
- var tracker = opts.tracker
- const logAndFinish = andLogAndFinish(spec, tracker, done)
-
- if (typeof spec === 'object') {
- var dep = spec
- } else {
- dep = npa(spec)
- }
- if (!isWindows && dep.type === 'directory' && /^[a-zA-Z]:/.test(dep.fetchSpec)) {
- var err = new Error(`Can't install from windows path on a non-windows system: ${dep.fetchSpec.replace(/[/]/g, '\\')}`)
- err.code = 'EWINDOWSPATH'
- return logAndFinish(err)
- }
- if (!npmConfig) {
- npmConfig = require('./config/figgy-config.js')
- }
- pacote.manifest(dep, npmConfig({
- annotate: true,
- fullMetadata: opts.fullMetadata,
- log: tracker || npmlog,
- memoize: CACHE,
- where: where
- })).then(
- (pkg) => logAndFinish(null, deprCheck(pkg)),
- (err) => {
- if (dep.type !== 'directory') return logAndFinish(err)
- if (err.code === 'ENOTDIR') {
- var enolocal = new Error(`Could not install "${path.relative(process.cwd(), dep.fetchSpec)}" as it is not a directory and is not a file with a name ending in .tgz, .tar.gz or .tar`)
- enolocal.code = 'ENOLOCAL'
- if (err.stack) enolocal.stack = err.stack
- return logAndFinish(enolocal)
- } else if (err.code === 'ENOPACKAGEJSON') {
- var enopackage = new Error(`Could not install from "${path.relative(process.cwd(), dep.fetchSpec)}" as it does not contain a package.json file.`)
- enopackage.code = 'ENOLOCAL'
- if (err.stack) enopackage.stack = err.stack
- return logAndFinish(enopackage)
- } else {
- return logAndFinish(err)
- }
- }
- )
-}
-
-module.exports.addBundled = addBundled
-function addBundled (pkg, next) {
- validate('OF', arguments)
- if (pkg._bundled !== undefined) return next(null, pkg)
-
- if (!pkg.bundleDependencies && pkg._requested.type !== 'directory') return next(null, pkg)
- const requested = pkg._requested || npa(pkg._from)
- if (requested.type === 'directory') {
- pkg._bundled = null
- return readPackageTree(pkg._requested.fetchSpec, function (er, tree) {
- if (tree) pkg._bundled = tree.children
- return next(null, pkg)
- })
- }
- pkg._bundled = null
- const target = tempFilename('unpack')
- if (!npmConfig) {
- npmConfig = require('./config/figgy-config.js')
- }
- const opts = npmConfig({integrity: pkg._integrity})
- pacote.extract(pkg._resolved || pkg._requested || npa.resolve(pkg.name, pkg.version), target, opts).then(() => {
- log.silly('addBundled', 'read tarball')
- readPackageTree(target, (err, tree) => {
- if (err) { return next(err) }
- log.silly('cleanup', 'remove extracted module')
- rimraf(target, function () {
- if (tree) {
- pkg._bundled = tree.children
- }
- next(null, pkg)
- })
- })
- }, next)
-}
diff --git a/deps/node/deps/npm/lib/fetch-package-metadata.md b/deps/node/deps/npm/lib/fetch-package-metadata.md
deleted file mode 100644
index 6fe4beac..00000000
--- a/deps/node/deps/npm/lib/fetch-package-metadata.md
+++ /dev/null
@@ -1,37 +0,0 @@
-fetch-package-metadata
-----------------------
-
- var fetchPackageMetadata = require("npm/lib/fetch-package-metadata")
- fetchPackageMetadata(spec, contextdir, callback)
-
-This will get package metadata (and if possible, ONLY package metadata) for
-a specifier as passed to `npm install` et al, eg `npm@next` or `npm@^2.0.3`
-
-## fetchPackageMetadata(*spec*, *contextdir*, *tracker*, *callback*)
-
-* *spec* **string** | **object** -- The package specifier, can be anything npm can
- understand (see [realize-package-specifier]), or it can be the result from
- realize-package-specifier or npm-package-arg (for non-local deps).
-
-* *contextdir* **string** -- The directory from which relative paths to
- local packages should be resolved.
-
-* *tracker* **object** -- **(optional)** An are-we-there-yet tracker group as
- provided by `npm.log.newGroup()`.
-
-* *callback* **function (er, package)** -- Called when the package information
- has been loaded. `package` is the object for of the `package.json`
- matching the requested spec. In the case of named packages, it comes from
- the registry and thus may not exactly match what's found in the associated
- tarball.
-
-[realize-package-specifier]: (https://github.com/npm/realize-package-specifier)
-
-In the case of tarballs and git repos, it will use the cache to download
-them in order to get the package metadata. For named packages, only the
-metadata is downloaded (eg https://registry.npmjs.org/package). For local
-directories, the package.json is read directly. For local tarballs, the
-tarball is streamed in memory and just the package.json is extracted from
-it. (Due to the nature of tars, having the package.json early in the file
-will result in it being loaded faster– the extractor short-circuits the
-uncompress/untar streams as best as it can.)
diff --git a/deps/node/deps/npm/lib/get.js b/deps/node/deps/npm/lib/get.js
deleted file mode 100644
index 8dc805ec..00000000
--- a/deps/node/deps/npm/lib/get.js
+++ /dev/null
@@ -1,12 +0,0 @@
-
-module.exports = get
-
-get.usage = 'npm get <key> <value> (See `npm config`)'
-
-var npm = require('./npm.js')
-
-get.completion = npm.commands.config.completion
-
-function get (args, cb) {
- npm.commands.config(['get'].concat(args), cb)
-}
diff --git a/deps/node/deps/npm/lib/help-search.js b/deps/node/deps/npm/lib/help-search.js
deleted file mode 100644
index 475f305e..00000000
--- a/deps/node/deps/npm/lib/help-search.js
+++ /dev/null
@@ -1,212 +0,0 @@
-
-module.exports = helpSearch
-
-var fs = require('graceful-fs')
-var path = require('path')
-var asyncMap = require('slide').asyncMap
-var npm = require('./npm.js')
-var glob = require('glob')
-var color = require('ansicolors')
-var output = require('./utils/output.js')
-
-helpSearch.usage = 'npm help-search <text>'
-
-function helpSearch (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
- if (!args.length) return cb(helpSearch.usage)
-
- var docPath = path.resolve(__dirname, '..', 'doc')
- return glob(docPath + '/*/*.md', function (er, files) {
- if (er) return cb(er)
- readFiles(files, function (er, data) {
- if (er) return cb(er)
- searchFiles(args, data, function (er, results) {
- if (er) return cb(er)
- formatResults(args, results, cb)
- })
- })
- })
-}
-
-function readFiles (files, cb) {
- var res = {}
- asyncMap(files, function (file, cb) {
- fs.readFile(file, 'utf8', function (er, data) {
- res[file] = data
- return cb(er)
- })
- }, function (er) {
- return cb(er, res)
- })
-}
-
-function searchFiles (args, files, cb) {
- var results = []
- Object.keys(files).forEach(function (file) {
- var data = files[file]
-
- // skip if no matches at all
- var match
- for (var a = 0, l = args.length; a < l && !match; a++) {
- match = data.toLowerCase().indexOf(args[a].toLowerCase()) !== -1
- }
- if (!match) return
-
- var lines = data.split(/\n+/)
-
- // if a line has a search term, then skip it and the next line.
- // if the next line has a search term, then skip all 3
- // otherwise, set the line to null. then remove the nulls.
- l = lines.length
- for (var i = 0; i < l; i++) {
- var line = lines[i]
- var nextLine = lines[i + 1]
- var ll
-
- match = false
- if (nextLine) {
- for (a = 0, ll = args.length; a < ll && !match; a++) {
- match = nextLine.toLowerCase()
- .indexOf(args[a].toLowerCase()) !== -1
- }
- if (match) {
- // skip over the next line, and the line after it.
- i += 2
- continue
- }
- }
-
- match = false
- for (a = 0, ll = args.length; a < ll && !match; a++) {
- match = line.toLowerCase().indexOf(args[a].toLowerCase()) !== -1
- }
- if (match) {
- // skip over the next line
- i++
- continue
- }
-
- lines[i] = null
- }
-
- // now squish any string of nulls into a single null
- lines = lines.reduce(function (l, r) {
- if (!(r === null && l[l.length - 1] === null)) l.push(r)
- return l
- }, [])
-
- if (lines[lines.length - 1] === null) lines.pop()
- if (lines[0] === null) lines.shift()
-
- // now see how many args were found at all.
- var found = {}
- var totalHits = 0
- lines.forEach(function (line) {
- args.forEach(function (arg) {
- var hit = (line || '').toLowerCase()
- .split(arg.toLowerCase()).length - 1
- if (hit > 0) {
- found[arg] = (found[arg] || 0) + hit
- totalHits += hit
- }
- })
- })
-
- var cmd = 'npm help '
- if (path.basename(path.dirname(file)) === 'api') {
- cmd = 'npm apihelp '
- }
- cmd += path.basename(file, '.md').replace(/^npm-/, '')
- results.push({
- file: file,
- cmd: cmd,
- lines: lines,
- found: Object.keys(found),
- hits: found,
- totalHits: totalHits
- })
- })
-
- // if only one result, then just show that help section.
- if (results.length === 1) {
- return npm.commands.help([results[0].file.replace(/\.md$/, '')], cb)
- }
-
- if (results.length === 0) {
- output('No results for ' + args.map(JSON.stringify).join(' '))
- return cb()
- }
-
- // sort results by number of results found, then by number of hits
- // then by number of matching lines
- results = results.sort(function (a, b) {
- return a.found.length > b.found.length ? -1
- : a.found.length < b.found.length ? 1
- : a.totalHits > b.totalHits ? -1
- : a.totalHits < b.totalHits ? 1
- : a.lines.length > b.lines.length ? -1
- : a.lines.length < b.lines.length ? 1
- : 0
- })
-
- cb(null, results)
-}
-
-function formatResults (args, results, cb) {
- if (!results) return cb(null)
-
- var cols = Math.min(process.stdout.columns || Infinity, 80) + 1
-
- var out = results.map(function (res) {
- var out = res.cmd
- var r = Object.keys(res.hits)
- .map(function (k) {
- return k + ':' + res.hits[k]
- }).sort(function (a, b) {
- return a > b ? 1 : -1
- }).join(' ')
-
- out += ((new Array(Math.max(1, cols - out.length - r.length)))
- .join(' ')) + r
-
- if (!npm.config.get('long')) return out
-
- out = '\n\n' + out + '\n' +
- (new Array(cols)).join('—') + '\n' +
- res.lines.map(function (line, i) {
- if (line === null || i > 3) return ''
- for (var out = line, a = 0, l = args.length; a < l; a++) {
- var finder = out.toLowerCase().split(args[a].toLowerCase())
- var newOut = ''
- var p = 0
-
- finder.forEach(function (f) {
- newOut += out.substr(p, f.length)
-
- var hilit = out.substr(p + f.length, args[a].length)
- if (npm.color) hilit = color.bgBlack(color.red(hilit))
- newOut += hilit
-
- p += f.length + args[a].length
- })
- }
-
- return newOut
- }).join('\n').trim()
- return out
- }).join('\n')
-
- if (results.length && !npm.config.get('long')) {
- out = 'Top hits for ' + (args.map(JSON.stringify).join(' ')) + '\n' +
- (new Array(cols)).join('—') + '\n' +
- out + '\n' +
- (new Array(cols)).join('—') + '\n' +
- '(run with -l or --long to see more context)'
- }
-
- output(out.trim())
- cb(null, results)
-}
diff --git a/deps/node/deps/npm/lib/help.js b/deps/node/deps/npm/lib/help.js
deleted file mode 100644
index 3f70f2dc..00000000
--- a/deps/node/deps/npm/lib/help.js
+++ /dev/null
@@ -1,247 +0,0 @@
-
-module.exports = help
-
-help.completion = function (opts, cb) {
- if (opts.conf.argv.remain.length > 2) return cb(null, [])
- getSections(cb)
-}
-
-var path = require('path')
-var spawn = require('./utils/spawn')
-var npm = require('./npm.js')
-var log = require('npmlog')
-var openUrl = require('./utils/open-url')
-var glob = require('glob')
-var didYouMean = require('./utils/did-you-mean')
-var cmdList = require('./config/cmd-list').cmdList
-var shorthands = require('./config/cmd-list').shorthands
-var commands = cmdList.concat(Object.keys(shorthands))
-var output = require('./utils/output.js')
-
-function help (args, cb) {
- var argv = npm.config.get('argv').cooked
-
- var argnum = 0
- if (args.length === 2 && ~~args[0]) {
- argnum = ~~args.shift()
- }
-
- // npm help foo bar baz: search topics
- if (args.length > 1 && args[0]) {
- return npm.commands['help-search'](args, argnum, cb)
- }
-
- var section = npm.deref(args[0]) || args[0]
-
- // npm help <noargs>: show basic usage
- if (!section) {
- var valid = argv[0] === 'help' ? 0 : 1
- return npmUsage(valid, cb)
- }
-
- // npm <command> -h: show command usage
- if (npm.config.get('usage') &&
- npm.commands[section] &&
- npm.commands[section].usage) {
- npm.config.set('loglevel', 'silent')
- log.level = 'silent'
- output(npm.commands[section].usage)
- return cb()
- }
-
- // npm apihelp <section>: Prefer section 3 over section 1
- var apihelp = argv.length && argv[0].indexOf('api') !== -1
- var pref = apihelp ? [3, 1, 5, 7] : [1, 3, 5, 7]
- if (argnum) {
- pref = [ argnum ].concat(pref.filter(function (n) {
- return n !== argnum
- }))
- }
-
- // npm help <section>: Try to find the path
- var manroot = path.resolve(__dirname, '..', 'man')
-
- // legacy
- if (section === 'global') section = 'folders'
- else if (section === 'json') section = 'package.json'
-
- // find either /section.n or /npm-section.n
- // The glob is used in the glob. The regexp is used much
- // further down. Globs and regexps are different
- var compextglob = '.+(gz|bz2|lzma|[FYzZ]|xz)'
- var compextre = '\\.(gz|bz2|lzma|[FYzZ]|xz)$'
- var f = '+(npm-' + section + '|' + section + ').[0-9]?(' + compextglob + ')'
- return glob(manroot + '/*/' + f, function (er, mans) {
- if (er) return cb(er)
-
- if (!mans.length) return npm.commands['help-search'](args, cb)
-
- mans = mans.map(function (man) {
- var ext = path.extname(man)
- if (man.match(new RegExp(compextre))) man = path.basename(man, ext)
-
- return man
- })
-
- viewMan(pickMan(mans, pref), cb)
- })
-}
-
-function pickMan (mans, pref_) {
- var nre = /([0-9]+)$/
- var pref = {}
- pref_.forEach(function (sect, i) {
- pref[sect] = i
- })
- mans = mans.sort(function (a, b) {
- var an = a.match(nre)[1]
- var bn = b.match(nre)[1]
- return an === bn ? (a > b ? -1 : 1)
- : pref[an] < pref[bn] ? -1
- : 1
- })
- return mans[0]
-}
-
-function viewMan (man, cb) {
- var nre = /([0-9]+)$/
- var num = man.match(nre)[1]
- var section = path.basename(man, '.' + num)
-
- // at this point, we know that the specified man page exists
- var manpath = path.join(__dirname, '..', 'man')
- var env = {}
- Object.keys(process.env).forEach(function (i) {
- env[i] = process.env[i]
- })
- env.MANPATH = manpath
- var viewer = npm.config.get('viewer')
-
- var conf
- switch (viewer) {
- case 'woman':
- var a = ['-e', '(woman-find-file \'' + man + '\')']
- conf = { env: env, stdio: 'inherit' }
- var woman = spawn('emacsclient', a, conf)
- woman.on('close', cb)
- break
-
- case 'browser':
- openUrl(htmlMan(man), 'help available at the following URL', cb)
- break
-
- default:
- conf = { env: env, stdio: 'inherit' }
- var manProcess = spawn('man', [num, section], conf)
- manProcess.on('close', cb)
- break
- }
-}
-
-function htmlMan (man) {
- var sect = +man.match(/([0-9]+)$/)[1]
- var f = path.basename(man).replace(/([0-9]+)$/, 'html')
- switch (sect) {
- case 1:
- sect = 'cli'
- break
- case 3:
- sect = 'api'
- break
- case 5:
- sect = 'files'
- break
- case 7:
- sect = 'misc'
- break
- default:
- throw new Error('invalid man section: ' + sect)
- }
- return path.resolve(__dirname, '..', 'html', 'doc', sect, f)
-}
-
-function npmUsage (valid, cb) {
- npm.config.set('loglevel', 'silent')
- log.level = 'silent'
- output([
- '\nUsage: npm <command>',
- '',
- 'where <command> is one of:',
- npm.config.get('long') ? usages()
- : ' ' + wrap(commands),
- '',
- 'npm <command> -h quick help on <command>',
- 'npm -l display full usage info',
- 'npm help <term> search for help on <term>',
- 'npm help npm involved overview',
- '',
- 'Specify configs in the ini-formatted file:',
- ' ' + npm.config.get('userconfig'),
- 'or on the command line via: npm <command> --key value',
- 'Config info can be viewed via: npm help config',
- '',
- 'npm@' + npm.version + ' ' + path.dirname(__dirname)
- ].join('\n'))
-
- if (npm.argv.length > 1) {
- output(didYouMean(npm.argv[1], commands))
- }
-
- cb(valid)
-}
-
-function usages () {
- // return a string of <command>: <usage>
- var maxLen = 0
- return Object.keys(npm.commands).filter(function (c) {
- return c === npm.deref(c)
- }).reduce(function (set, c) {
- set.push([c, npm.commands[c].usage || ''])
- maxLen = Math.max(maxLen, c.length)
- return set
- }, []).map(function (item) {
- var c = item[0]
- var usage = item[1]
- return '\n ' +
- c + (new Array(maxLen - c.length + 2).join(' ')) +
- (usage.split('\n').join('\n' + (new Array(maxLen + 6).join(' '))))
- }).join('\n')
-}
-
-function wrap (arr) {
- var out = ['']
- var l = 0
- var line
-
- line = process.stdout.columns
- if (!line) {
- line = 60
- } else {
- line = Math.min(60, Math.max(line - 16, 24))
- }
-
- arr.sort(function (a, b) { return a < b ? -1 : 1 })
- .forEach(function (c) {
- if (out[l].length + c.length + 2 < line) {
- out[l] += ', ' + c
- } else {
- out[l++] += ','
- out[l] = c
- }
- })
- return out.join('\n ').substr(2)
-}
-
-function getSections (cb) {
- var g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]')
- glob(g, function (er, files) {
- if (er) return cb(er)
-
- cb(null, Object.keys(files.reduce(function (acc, file) {
- file = path.basename(file).replace(/\.[0-9]+$/, '')
- file = file.replace(/^npm-/, '')
- acc[file] = true
- return acc
- }, { help: true })))
- })
-}
diff --git a/deps/node/deps/npm/lib/hook.js b/deps/node/deps/npm/lib/hook.js
deleted file mode 100644
index 54aea9f1..00000000
--- a/deps/node/deps/npm/lib/hook.js
+++ /dev/null
@@ -1,152 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const hookApi = require('libnpm/hook')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const otplease = require('./utils/otplease.js')
-const pudding = require('figgy-pudding')
-const relativeDate = require('tiny-relative-date')
-const Table = require('cli-table3')
-const validate = require('aproba')
-
-hook.usage = [
- 'npm hook add <pkg> <url> <secret> [--type=<type>]',
- 'npm hook ls [pkg]',
- 'npm hook rm <id>',
- 'npm hook update <id> <url> <secret>'
-].join('\n')
-
-hook.completion = (opts, cb) => {
- validate('OF', [opts, cb])
- return cb(null, []) // fill in this array with completion values
-}
-
-const HookConfig = pudding({
- json: {},
- loglevel: {},
- parseable: {},
- silent: {},
- unicode: {}
-})
-
-function UsageError () {
- throw Object.assign(new Error(hook.usage), {code: 'EUSAGE'})
-}
-
-module.exports = (args, cb) => BB.try(() => hook(args)).then(
- val => cb(null, val),
- err => err.code === 'EUSAGE' ? cb(err.message) : cb(err)
-)
-function hook (args) {
- return otplease(npmConfig(), opts => {
- opts = HookConfig(opts)
- switch (args[0]) {
- case 'add':
- return add(args[1], args[2], args[3], opts)
- case 'ls':
- return ls(args[1], opts)
- case 'rm':
- return rm(args[1], opts)
- case 'update':
- case 'up':
- return update(args[1], args[2], args[3], opts)
- default:
- UsageError()
- }
- })
-}
-
-function add (pkg, uri, secret, opts) {
- return hookApi.add(pkg, uri, secret, opts).then(hook => {
- if (opts.json) {
- output(JSON.stringify(hook, null, 2))
- } else if (opts.parseable) {
- output(Object.keys(hook).join('\t'))
- output(Object.keys(hook).map(k => hook[k]).join('\t'))
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`+ ${hookName(hook)} ${
- opts.unicode ? ' ➜ ' : ' -> '
- } ${hook.endpoint}`)
- }
- })
-}
-
-function ls (pkg, opts) {
- return hookApi.ls(opts.concat({package: pkg})).then(hooks => {
- if (opts.json) {
- output(JSON.stringify(hooks, null, 2))
- } else if (opts.parseable) {
- output(Object.keys(hooks[0]).join('\t'))
- hooks.forEach(hook => {
- output(Object.keys(hook).map(k => hook[k]).join('\t'))
- })
- } else if (!hooks.length) {
- output("You don't have any hooks configured yet.")
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- if (hooks.length === 1) {
- output('You have one hook configured.')
- } else {
- output(`You have ${hooks.length} hooks configured.`)
- }
- const table = new Table({head: ['id', 'target', 'endpoint']})
- hooks.forEach((hook) => {
- table.push([
- {rowSpan: 2, content: hook.id},
- hookName(hook),
- hook.endpoint
- ])
- if (hook.last_delivery) {
- table.push([
- {
- colSpan: 1,
- content: `triggered ${relativeDate(hook.last_delivery)}`
- },
- hook.response_code
- ])
- } else {
- table.push([{colSpan: 2, content: 'never triggered'}])
- }
- })
- output(table.toString())
- }
- })
-}
-
-function rm (id, opts) {
- return hookApi.rm(id, opts).then(hook => {
- if (opts.json) {
- output(JSON.stringify(hook, null, 2))
- } else if (opts.parseable) {
- output(Object.keys(hook).join('\t'))
- output(Object.keys(hook).map(k => hook[k]).join('\t'))
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`- ${hookName(hook)} ${
- opts.unicode ? ' ✘ ' : ' X '
- } ${hook.endpoint}`)
- }
- })
-}
-
-function update (id, uri, secret, opts) {
- return hookApi.update(id, uri, secret, opts).then(hook => {
- if (opts.json) {
- output(JSON.stringify(hook, null, 2))
- } else if (opts.parseable) {
- output(Object.keys(hook).join('\t'))
- output(Object.keys(hook).map(k => hook[k]).join('\t'))
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`+ ${hookName(hook)} ${
- opts.unicode ? ' ➜ ' : ' -> '
- } ${hook.endpoint}`)
- }
- })
-}
-
-function hookName (hook) {
- let target = hook.name
- if (hook.type === 'scope') { target = '@' + target }
- if (hook.type === 'owner') { target = '~' + target }
- return target
-}
diff --git a/deps/node/deps/npm/lib/init.js b/deps/node/deps/npm/lib/init.js
deleted file mode 100644
index 9d873689..00000000
--- a/deps/node/deps/npm/lib/init.js
+++ /dev/null
@@ -1,85 +0,0 @@
-// initialize a package.json file
-
-module.exports = init
-
-var path = require('path')
-var log = require('npmlog')
-var npa = require('npm-package-arg')
-var npm = require('./npm.js')
-var npx = require('libnpx')
-var initJson = require('init-package-json')
-var isRegistry = require('./utils/is-registry.js')
-var output = require('./utils/output.js')
-var noProgressTillDone = require('./utils/no-progress-while-running').tillDone
-var usage = require('./utils/usage')
-
-init.usage = usage(
- 'init',
- '\nnpm init [--force|-f|--yes|-y|--scope]' +
- '\nnpm init <@scope> (same as `npx <@scope>/create`)' +
- '\nnpm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)'
-)
-
-function init (args, cb) {
- if (args.length) {
- var NPM_PATH = path.resolve(__dirname, '../bin/npm-cli.js')
- var initerName = args[0]
- var packageName = initerName
- if (/^@[^/]+$/.test(initerName)) {
- packageName = initerName + '/create'
- } else {
- var req = npa(initerName)
- if (req.type === 'git' && req.hosted) {
- var { user, project } = req.hosted
- packageName = initerName
- .replace(user + '/' + project, user + '/create-' + project)
- } else if (isRegistry(req)) {
- packageName = req.name.replace(/^(@[^/]+\/)?/, '$1create-')
- if (req.rawSpec) {
- packageName += '@' + req.rawSpec
- }
- } else {
- var err = new Error(
- 'Unrecognized initializer: ' + initerName +
- '\nFor more package binary executing power check out `npx`:' +
- '\nhttps://www.npmjs.com/package/npx'
- )
- err.code = 'EUNSUPPORTED'
- throw err
- }
- }
- var npxArgs = [process.argv0, '[fake arg]', '--always-spawn', packageName, ...process.argv.slice(4)]
- var parsed = npx.parseArgs(npxArgs, NPM_PATH)
-
- return npx(parsed)
- .then(() => cb())
- .catch(cb)
- }
- var dir = process.cwd()
- log.pause()
- var initFile = npm.config.get('init-module')
- if (!initJson.yes(npm.config)) {
- output([
- 'This utility will walk you through creating a package.json file.',
- 'It only covers the most common items, and tries to guess sensible defaults.',
- '',
- 'See `npm help json` for definitive documentation on these fields',
- 'and exactly what they do.',
- '',
- 'Use `npm install <pkg>` afterwards to install a package and',
- 'save it as a dependency in the package.json file.',
- '',
- 'Press ^C at any time to quit.'
- ].join('\n'))
- }
- initJson(dir, initFile, npm.config, noProgressTillDone(function (er, data) {
- log.resume()
- log.silly('package data', data)
- if (er && er.message === 'canceled') {
- log.warn('init', 'canceled')
- return cb(null, data)
- }
- log.info('init', 'written successfully')
- cb(er, data)
- }))
-}
diff --git a/deps/node/deps/npm/lib/install-ci-test.js b/deps/node/deps/npm/lib/install-ci-test.js
deleted file mode 100644
index 26120f4a..00000000
--- a/deps/node/deps/npm/lib/install-ci-test.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict'
-
-// npm install-ci-test
-// Runs `npm ci` and then runs `npm test`
-
-module.exports = installTest
-var ci = require('./ci.js')
-var test = require('./test.js')
-var usage = require('./utils/usage')
-
-installTest.usage = usage(
- 'install-ci-test',
- '\nnpm install-ci-test [args]' +
- '\nSame args as `npm ci`'
-)
-
-installTest.completion = ci.completion
-
-function installTest (args, cb) {
- ci(args, function (er) {
- if (er) {
- return cb(er)
- }
- test([], cb)
- })
-}
diff --git a/deps/node/deps/npm/lib/install-test.js b/deps/node/deps/npm/lib/install-test.js
deleted file mode 100644
index f66dfd40..00000000
--- a/deps/node/deps/npm/lib/install-test.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict'
-
-// npm install-test
-// Runs `npm install` and then runs `npm test`
-
-module.exports = installTest
-var install = require('./install.js')
-var test = require('./test.js')
-var usage = require('./utils/usage')
-
-installTest.usage = usage(
- 'install-test',
- '\nnpm install-test [args]' +
- '\nSame args as `npm install`'
-)
-
-installTest.completion = install.completion
-
-function installTest (args, cb) {
- install(args, function (er) {
- if (er) {
- return cb(er)
- }
- test([], cb)
- })
-}
diff --git a/deps/node/deps/npm/lib/install.js b/deps/node/deps/npm/lib/install.js
deleted file mode 100644
index e15bc479..00000000
--- a/deps/node/deps/npm/lib/install.js
+++ /dev/null
@@ -1,1016 +0,0 @@
-'use strict'
-/* eslint-disable camelcase */
-/* eslint-disable standard/no-callback-literal */
-// npm install <pkg> <pkg> <pkg>
-//
-// See doc/cli/npm-install.md for more description
-//
-// Managing contexts...
-// there's a lot of state associated with an "install" operation, including
-// packages that are already installed, parent packages, current shrinkwrap, and
-// so on. We maintain this state in a "context" object that gets passed around.
-// every time we dive into a deeper node_modules folder, the "family" list that
-// gets passed along uses the previous "family" list as its __proto__. Any
-// "resolved precise dependency" things that aren't already on this object get
-// added, and then that's passed to the next generation of installation.
-
-module.exports = install
-module.exports.Installer = Installer
-
-var usage = require('./utils/usage')
-
-install.usage = usage(
- 'install',
- '\nnpm install (with no args, in package dir)' +
- '\nnpm install [<@scope>/]<pkg>' +
- '\nnpm install [<@scope>/]<pkg>@<tag>' +
- '\nnpm install [<@scope>/]<pkg>@<version>' +
- '\nnpm install [<@scope>/]<pkg>@<version range>' +
- '\nnpm install <folder>' +
- '\nnpm install <tarball file>' +
- '\nnpm install <tarball url>' +
- '\nnpm install <git:// url>' +
- '\nnpm install <github username>/<github project>',
- '[--save-prod|--save-dev|--save-optional] [--save-exact] [--no-save]'
-)
-
-install.completion = function (opts, cb) {
- validate('OF', arguments)
- // install can complete to a folder with a package.json, or any package.
- // if it has a slash, then it's gotta be a folder
- // if it starts with https?://, then just give up, because it's a url
- if (/^https?:\/\//.test(opts.partialWord)) {
- // do not complete to URLs
- return cb(null, [])
- }
-
- if (/\//.test(opts.partialWord)) {
- // Complete fully to folder if there is exactly one match and it
- // is a folder containing a package.json file. If that is not the
- // case we return 0 matches, which will trigger the default bash
- // complete.
- var lastSlashIdx = opts.partialWord.lastIndexOf('/')
- var partialName = opts.partialWord.slice(lastSlashIdx + 1)
- var partialPath = opts.partialWord.slice(0, lastSlashIdx)
- if (partialPath === '') partialPath = '/'
-
- var annotatePackageDirMatch = function (sibling, cb) {
- var fullPath = path.join(partialPath, sibling)
- if (sibling.slice(0, partialName.length) !== partialName) {
- return cb(null, null) // not name match
- }
- fs.readdir(fullPath, function (err, contents) {
- if (err) return cb(null, { isPackage: false })
-
- cb(
- null,
- {
- fullPath: fullPath,
- isPackage: contents.indexOf('package.json') !== -1
- }
- )
- })
- }
-
- return fs.readdir(partialPath, function (err, siblings) {
- if (err) return cb(null, []) // invalid dir: no matching
-
- asyncMap(siblings, annotatePackageDirMatch, function (err, matches) {
- if (err) return cb(err)
-
- var cleaned = matches.filter(function (x) { return x !== null })
- if (cleaned.length !== 1) return cb(null, [])
- if (!cleaned[0].isPackage) return cb(null, [])
-
- // Success - only one match and it is a package dir
- return cb(null, [cleaned[0].fullPath])
- })
- })
- }
-
- // FIXME: there used to be registry completion here, but it stopped making
- // sense somewhere around 50,000 packages on the registry
- cb()
-}
-
-// system packages
-var fs = require('fs')
-var path = require('path')
-
-// dependencies
-var log = require('npmlog')
-var readPackageTree = require('read-package-tree')
-var readPackageJson = require('read-package-json')
-var chain = require('slide').chain
-var asyncMap = require('slide').asyncMap
-var archy = require('archy')
-var mkdirp = require('mkdirp')
-var rimraf = require('rimraf')
-var iferr = require('iferr')
-var validate = require('aproba')
-var uniq = require('lodash.uniq')
-var Bluebird = require('bluebird')
-
-// npm internal utils
-var npm = require('./npm.js')
-var locker = require('./utils/locker.js')
-var lock = locker.lock
-var unlock = locker.unlock
-var parseJSON = require('./utils/parse-json.js')
-var output = require('./utils/output.js')
-var saveMetrics = require('./utils/metrics.js').save
-
-// install specific libraries
-var copyTree = require('./install/copy-tree.js')
-var readShrinkwrap = require('./install/read-shrinkwrap.js')
-var computeMetadata = require('./install/deps.js').computeMetadata
-var prefetchDeps = require('./install/deps.js').prefetchDeps
-var loadDeps = require('./install/deps.js').loadDeps
-var loadDevDeps = require('./install/deps.js').loadDevDeps
-var getAllMetadata = require('./install/deps.js').getAllMetadata
-var loadRequestedDeps = require('./install/deps.js').loadRequestedDeps
-var loadExtraneous = require('./install/deps.js').loadExtraneous
-var diffTrees = require('./install/diff-trees.js')
-var checkPermissions = require('./install/check-permissions.js')
-var decomposeActions = require('./install/decompose-actions.js')
-var validateTree = require('./install/validate-tree.js')
-var validateArgs = require('./install/validate-args.js')
-var saveRequested = require('./install/save.js').saveRequested
-var saveShrinkwrap = require('./install/save.js').saveShrinkwrap
-var audit = require('./install/audit.js')
-var getSaveType = require('./install/save.js').getSaveType
-var doSerialActions = require('./install/actions.js').doSerial
-var doReverseSerialActions = require('./install/actions.js').doReverseSerial
-var doParallelActions = require('./install/actions.js').doParallel
-var doOneAction = require('./install/actions.js').doOne
-var removeObsoleteDep = require('./install/deps.js').removeObsoleteDep
-var removeExtraneous = require('./install/deps.js').removeExtraneous
-var computeVersionSpec = require('./install/deps.js').computeVersionSpec
-var packageId = require('./utils/package-id.js')
-var moduleName = require('./utils/module-name.js')
-var errorMessage = require('./utils/error-message.js')
-var isExtraneous = require('./install/is-extraneous.js')
-
-function unlockCB (lockPath, name, cb) {
- validate('SSF', arguments)
- return function (installEr) {
- var args = arguments
- try {
- unlock(lockPath, name, reportErrorAndReturn)
- } catch (unlockEx) {
- process.nextTick(function () {
- reportErrorAndReturn(unlockEx)
- })
- }
- function reportErrorAndReturn (unlockEr) {
- if (installEr) {
- if (unlockEr && unlockEr.code !== 'ENOTLOCKED') {
- log.warn('unlock' + name, unlockEr)
- }
- return cb.apply(null, args)
- }
- if (unlockEr) return cb(unlockEr)
- return cb.apply(null, args)
- }
- }
-}
-
-function install (where, args, cb) {
- if (!cb) {
- cb = args
- args = where
- where = null
- }
- var globalTop = path.resolve(npm.globalDir, '..')
- if (!where) {
- where = npm.config.get('global')
- ? globalTop
- : npm.prefix
- }
- validate('SAF', [where, args, cb])
- // the /path/to/node_modules/..
- var dryrun = !!npm.config.get('dry-run')
-
- if (npm.config.get('dev')) {
- log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--only=dev` instead.')
- }
-
- if (where === globalTop && !args.length) {
- args = ['.']
- }
- args = args.filter(function (a) {
- return path.resolve(a) !== npm.prefix
- })
-
- new Installer(where, dryrun, args).run(cb)
-}
-
-function Installer (where, dryrun, args, opts) {
- validate('SBA|SBAO', arguments)
- if (!opts) opts = {}
- this.where = where
- this.dryrun = dryrun
- this.args = args
- // fakechildren are children created from the lockfile and lack relationship data
- // the only exist when the tree does not match the lockfile
- // this is fine when doing full tree installs/updates but not ok when modifying only
- // a few deps via `npm install` or `npm uninstall`.
- this.currentTree = null
- this.idealTree = null
- this.differences = []
- this.todo = []
- this.progress = {}
- this.noPackageJsonOk = !!args.length
- this.topLevelLifecycles = !args.length
-
- this.autoPrune = npm.config.get('package-lock')
-
- const dev = npm.config.get('dev')
- const only = npm.config.get('only')
- const onlyProd = /^prod(uction)?$/.test(only)
- const onlyDev = /^dev(elopment)?$/.test(only)
- const prod = npm.config.get('production')
- this.dev = opts.dev != null ? opts.dev : dev || (!onlyProd && !prod) || onlyDev
- this.prod = opts.prod != null ? opts.prod : !onlyDev
-
- this.packageLockOnly = opts.packageLockOnly != null
- ? opts.packageLockOnly : npm.config.get('package-lock-only')
- this.rollback = opts.rollback != null ? opts.rollback : npm.config.get('rollback')
- this.link = opts.link != null ? opts.link : npm.config.get('link')
- this.saveOnlyLock = opts.saveOnlyLock
- this.global = opts.global != null ? opts.global : this.where === path.resolve(npm.globalDir, '..')
- this.audit = npm.config.get('audit') && !this.global
- this.started = Date.now()
-}
-Installer.prototype = {}
-
-Installer.prototype.run = function (_cb) {
- validate('F|', arguments)
-
- var result
- var cb
- if (_cb) {
- cb = function (err) {
- saveMetrics(!err)
- return _cb.apply(this, arguments)
- }
- } else {
- result = new Promise((resolve, reject) => {
- cb = (err, value) => err ? reject(err) : resolve(value)
- })
- }
- // FIXME: This is bad and I should feel bad.
- // lib/install needs to have some way of sharing _limited_
- // state with the things it calls. Passing the object is too
- // much. The global config is WAY too much. =( =(
- // But not having this is gonna break linked modules in
- // subtle stupid ways, and refactoring all this code isn't
- // the right thing to do just yet.
- if (this.global) {
- var prevGlobal = npm.config.get('global')
- npm.config.set('global', true)
- var next = cb
- cb = function () {
- npm.config.set('global', prevGlobal)
- next.apply(null, arguments)
- }
- }
-
- var installSteps = []
- var postInstallSteps = []
- if (!this.dryrun) {
- installSteps.push(
- [this.newTracker(log, 'runTopLevelLifecycles', 2)],
- [this, this.runPreinstallTopLevelLifecycles])
- }
- installSteps.push(
- [this.newTracker(log, 'loadCurrentTree', 4)],
- [this, this.loadCurrentTree],
- [this, this.finishTracker, 'loadCurrentTree'],
-
- [this.newTracker(log, 'loadIdealTree', 12)],
- [this, this.loadIdealTree],
- [this, this.finishTracker, 'loadIdealTree'],
-
- [this, this.debugTree, 'currentTree', 'currentTree'],
- [this, this.debugTree, 'idealTree', 'idealTree'],
-
- [this.newTracker(log, 'generateActionsToTake')],
- [this, this.generateActionsToTake],
- [this, this.finishTracker, 'generateActionsToTake'],
-
- [this, this.debugActions, 'diffTrees', 'differences'],
- [this, this.debugActions, 'decomposeActions', 'todo'],
- [this, this.startAudit]
- )
-
- if (this.packageLockOnly) {
- postInstallSteps.push(
- [this, this.saveToDependencies])
- } else if (!this.dryrun) {
- installSteps.push(
- [this.newTracker(log, 'executeActions', 8)],
- [this, this.executeActions],
- [this, this.finishTracker, 'executeActions'])
- var node_modules = path.resolve(this.where, 'node_modules')
- var staging = path.resolve(node_modules, '.staging')
- postInstallSteps.push(
- [this.newTracker(log, 'rollbackFailedOptional', 1)],
- [this, this.rollbackFailedOptional, staging, this.todo],
- [this, this.finishTracker, 'rollbackFailedOptional'],
- [this, this.commit, staging, this.todo],
-
- [this, this.runPostinstallTopLevelLifecycles],
- [this, this.finishTracker, 'runTopLevelLifecycles']
- )
- if (getSaveType()) {
- postInstallSteps.push(
- // this is necessary as we don't fill in `dependencies` and `devDependencies` in deps loaded from shrinkwrap
- // until after we extract them
- [this, (next) => { computeMetadata(this.idealTree); next() }],
- [this, this.pruneIdealTree],
- [this, this.debugLogicalTree, 'saveTree', 'idealTree'],
- [this, this.saveToDependencies])
- }
- }
- postInstallSteps.push(
- [this, this.printWarnings],
- [this, this.printInstalled])
-
- var self = this
- chain(installSteps, function (installEr) {
- if (installEr) self.failing = true
- chain(postInstallSteps, function (postInstallEr) {
- if (installEr && postInstallEr) {
- var msg = errorMessage(postInstallEr)
- msg.summary.forEach(function (logline) {
- log.warn.apply(log, logline)
- })
- msg.detail.forEach(function (logline) {
- log.verbose.apply(log, logline)
- })
- }
- cb(installEr || postInstallEr, self.getInstalledModules(), self.idealTree)
- })
- })
- return result
-}
-
-Installer.prototype.loadArgMetadata = function (next) {
- getAllMetadata(this.args, this.currentTree, process.cwd(), iferr(next, (args) => {
- this.args = args
- next()
- }))
-}
-
-Installer.prototype.newTracker = function (tracker, name, size) {
- validate('OS', [tracker, name])
- if (size) validate('N', [size])
- this.progress[name] = tracker.newGroup(name, size)
- return function (next) {
- process.emit('time', 'stage:' + name)
- next()
- }
-}
-
-Installer.prototype.finishTracker = function (name, cb) {
- validate('SF', arguments)
- process.emit('timeEnd', 'stage:' + name)
- cb()
-}
-
-Installer.prototype.loadCurrentTree = function (cb) {
- validate('F', arguments)
- log.silly('install', 'loadCurrentTree')
- var todo = []
- if (this.global) {
- todo.push([this, this.readGlobalPackageData])
- } else {
- todo.push([this, this.readLocalPackageData])
- }
- todo.push([this, this.normalizeCurrentTree])
- chain(todo, cb)
-}
-
-var createNode = require('./install/node.js').create
-var flatNameFromTree = require('./install/flatten-tree.js').flatNameFromTree
-Installer.prototype.normalizeCurrentTree = function (cb) {
- this.currentTree.isTop = true
- normalizeTree(this.currentTree)
- // If the user didn't have a package.json then fill in deps with what was on disk
- if (this.currentTree.error) {
- for (let child of this.currentTree.children) {
- if (!child.fakeChild && isExtraneous(child)) {
- this.currentTree.package.dependencies[child.package.name] = computeVersionSpec(this.currentTree, child)
- }
- }
- }
- computeMetadata(this.currentTree)
- return cb()
-
- function normalizeTree (tree, seen) {
- if (!seen) seen = new Set()
- if (seen.has(tree)) return
- seen.add(tree)
- createNode(tree)
- tree.location = flatNameFromTree(tree)
- tree.children.forEach((child) => normalizeTree(child, seen))
- }
-}
-
-Installer.prototype.loadIdealTree = function (cb) {
- validate('F', arguments)
- log.silly('install', 'loadIdealTree')
-
- chain([
- [this.newTracker(this.progress.loadIdealTree, 'loadIdealTree:cloneCurrentTree')],
- [this, this.cloneCurrentTreeToIdealTree],
- [this, this.finishTracker, 'loadIdealTree:cloneCurrentTree'],
-
- [this.newTracker(this.progress.loadIdealTree, 'loadIdealTree:loadShrinkwrap')],
- [this, this.loadShrinkwrap],
- [this, this.finishTracker, 'loadIdealTree:loadShrinkwrap'],
-
- [this.newTracker(this.progress.loadIdealTree, 'loadIdealTree:loadAllDepsIntoIdealTree', 10)],
- [this, this.loadAllDepsIntoIdealTree],
- [this, this.finishTracker, 'loadIdealTree:loadAllDepsIntoIdealTree'],
- [this, function (next) { computeMetadata(this.idealTree); next() }],
- [this, this.pruneIdealTree]
- ], cb)
-}
-
-Installer.prototype.pruneIdealTree = function (cb) {
- if (!this.idealTree) return cb()
- // if our lock file didn't have the requires field and there
- // are any fake children then forgo pruning until we have more info.
- if (!this.idealTree.hasRequiresFromLock && this.idealTree.children.some((n) => n.fakeChild)) return cb()
- const toPrune = this.idealTree.children
- .filter((child) => isExtraneous(child) && (this.autoPrune || child.removing))
- .map((n) => ({name: moduleName(n)}))
- return removeExtraneous(toPrune, this.idealTree, cb)
-}
-
-Installer.prototype.loadAllDepsIntoIdealTree = function (cb) {
- validate('F', arguments)
- log.silly('install', 'loadAllDepsIntoIdealTree')
- var saveDeps = getSaveType()
-
- var cg = this.progress['loadIdealTree:loadAllDepsIntoIdealTree']
- var installNewModules = !!this.args.length
- var steps = []
-
- if (installNewModules) {
- steps.push([validateArgs, this.idealTree, this.args])
- steps.push([loadRequestedDeps, this.args, this.idealTree, saveDeps, cg.newGroup('loadRequestedDeps')])
- } else {
- const depsToPreload = Object.assign({},
- this.idealTree.package.devDependencies,
- this.idealTree.package.dependencies
- )
- steps.push(
- [prefetchDeps, this.idealTree, depsToPreload, cg.newGroup('prefetchDeps')],
- [loadDeps, this.idealTree, cg.newGroup('loadDeps')],
- [loadDevDeps, this.idealTree, cg.newGroup('loadDevDeps')])
- }
- steps.push(
- [loadExtraneous.andResolveDeps, this.idealTree, cg.newGroup('loadExtraneous')])
- chain(steps, cb)
-}
-
-Installer.prototype.generateActionsToTake = function (cb) {
- validate('F', arguments)
- log.silly('install', 'generateActionsToTake')
- var cg = this.progress.generateActionsToTake
- chain([
- [validateTree, this.idealTree, cg.newGroup('validateTree')],
- [diffTrees, this.currentTree, this.idealTree, this.differences, cg.newGroup('diffTrees')],
- [this, this.computeLinked],
- [checkPermissions, this.differences],
- [decomposeActions, this.differences, this.todo]
- ], cb)
-}
-
-Installer.prototype.computeLinked = function (cb) {
- validate('F', arguments)
- if (!this.link || this.global) return cb()
- var linkTodoList = []
- var self = this
- asyncMap(this.differences, function (action, next) {
- var cmd = action[0]
- var pkg = action[1]
- if (cmd !== 'add' && cmd !== 'update') return next()
- var isReqByTop = pkg.requiredBy.filter(function (mod) { return mod.isTop }).length
- var isReqByUser = pkg.userRequired
- var isExtraneous = pkg.requiredBy.length === 0
- if (!isReqByTop && !isReqByUser && !isExtraneous) return next()
- isLinkable(pkg, function (install, link) {
- if (install) linkTodoList.push(['global-install', pkg])
- if (link) linkTodoList.push(['global-link', pkg])
- if (install || link) removeObsoleteDep(pkg)
- next()
- })
- }, function () {
- if (linkTodoList.length === 0) return cb()
- self.differences.length = 0
- Array.prototype.push.apply(self.differences, linkTodoList)
- diffTrees(self.currentTree, self.idealTree, self.differences, log.newGroup('d2'), cb)
- })
-}
-
-function isLinkable (pkg, cb) {
- var globalPackage = path.resolve(npm.globalPrefix, 'lib', 'node_modules', moduleName(pkg))
- var globalPackageJson = path.resolve(globalPackage, 'package.json')
- fs.stat(globalPackage, function (er) {
- if (er) return cb(true, true)
- fs.readFile(globalPackageJson, function (er, data) {
- var json = parseJSON.noExceptions(data)
- cb(false, json && json.version === pkg.package.version)
- })
- })
-}
-
-Installer.prototype.executeActions = function (cb) {
- validate('F', arguments)
- log.silly('install', 'executeActions')
- var todo = this.todo
- var cg = this.progress.executeActions
-
- var node_modules = path.resolve(this.where, 'node_modules')
- var staging = path.resolve(node_modules, '.staging')
- var steps = []
- var trackLifecycle = cg.newGroup('lifecycle')
-
- cb = unlockCB(node_modules, '.staging', cb)
-
- steps.push(
- [doSerialActions, 'global-install', staging, todo, trackLifecycle.newGroup('global-install')],
- [lock, node_modules, '.staging'],
- [rimraf, staging],
- [doParallelActions, 'extract', staging, todo, cg.newGroup('extract', 100)],
- [doReverseSerialActions, 'unbuild', staging, todo, cg.newGroup('unbuild')],
- [doSerialActions, 'remove', staging, todo, cg.newGroup('remove')],
- [doSerialActions, 'move', staging, todo, cg.newGroup('move')],
- [doSerialActions, 'finalize', staging, todo, cg.newGroup('finalize')],
- [doParallelActions, 'refresh-package-json', staging, todo, cg.newGroup('refresh-package-json')],
- [doParallelActions, 'preinstall', staging, todo, trackLifecycle.newGroup('preinstall')],
- [doSerialActions, 'build', staging, todo, trackLifecycle.newGroup('build')],
- [doSerialActions, 'global-link', staging, todo, trackLifecycle.newGroup('global-link')],
- [doParallelActions, 'update-linked', staging, todo, trackLifecycle.newGroup('update-linked')],
- [doSerialActions, 'install', staging, todo, trackLifecycle.newGroup('install')],
- [doSerialActions, 'postinstall', staging, todo, trackLifecycle.newGroup('postinstall')])
-
- var self = this
- chain(steps, function (er) {
- if (!er || self.rollback) {
- rimraf(staging, function () { cb(er) })
- } else {
- cb(er)
- }
- })
-}
-
-Installer.prototype.rollbackFailedOptional = function (staging, actionsToRun, cb) {
- if (!this.rollback) return cb()
- var failed = uniq(actionsToRun.map(function (action) {
- return action[1]
- }).filter(function (pkg) {
- return pkg.failed && pkg.rollback
- }))
- var top = this.currentTree && this.currentTree.path
- Bluebird.map(failed, (pkg) => {
- return Bluebird.map(pkg.rollback, (rollback) => rollback(top, staging, pkg))
- }).asCallback(cb)
-}
-
-Installer.prototype.commit = function (staging, actionsToRun, cb) {
- var toCommit = actionsToRun.map(function (action) { return action[1] }).filter(function (pkg) { return !pkg.failed && pkg.commit })
- asyncMap(toCommit, function (pkg, next) {
- asyncMap(pkg.commit, function (commit, done) {
- commit(staging, pkg, done)
- }, function () {
- pkg.commit = []
- next.apply(null, arguments)
- })
- }, cb)
-}
-
-Installer.prototype.runPreinstallTopLevelLifecycles = function (cb) {
- validate('F', arguments)
- if (this.failing) return cb()
- if (!this.topLevelLifecycles) return cb()
- log.silly('install', 'runPreinstallTopLevelLifecycles')
-
- readPackageJson(path.join(this.where, 'package.json'), log, false, (err, data) => {
- if (err) return cb()
- this.currentTree = createNode({
- isTop: true,
- package: data,
- path: this.where
- })
- doOneAction('preinstall', this.where, this.currentTree, log.newGroup('preinstall:.'), cb)
- })
-}
-
-Installer.prototype.runPostinstallTopLevelLifecycles = function (cb) {
- validate('F', arguments)
- if (this.failing) return cb()
- if (!this.topLevelLifecycles) return cb()
- log.silly('install', 'runPostinstallTopLevelLifecycles')
- var steps = []
- var trackLifecycle = this.progress.runTopLevelLifecycles
-
- steps.push(
- [doOneAction, 'build', this.idealTree.path, this.idealTree, trackLifecycle.newGroup('build:.')],
- [doOneAction, 'install', this.idealTree.path, this.idealTree, trackLifecycle.newGroup('install:.')],
- [doOneAction, 'postinstall', this.idealTree.path, this.idealTree, trackLifecycle.newGroup('postinstall:.')])
- if (this.dev) {
- steps.push(
- [doOneAction, 'prepare', this.idealTree.path, this.idealTree, trackLifecycle.newGroup('prepare')])
- }
- chain(steps, cb)
-}
-
-Installer.prototype.startAudit = function (cb) {
- if (!this.audit) return cb()
- this.auditSubmission = Bluebird.try(() => {
- return audit.generateFromInstall(this.idealTree, this.differences, this.args, this.remove)
- }).then((auditData) => {
- return audit.submitForInstallReport(auditData)
- }).catch(_ => {})
- cb()
-}
-
-Installer.prototype.saveToDependencies = function (cb) {
- validate('F', arguments)
- if (this.failing) return cb()
- log.silly('install', 'saveToDependencies')
- if (this.saveOnlyLock) {
- saveShrinkwrap(this.idealTree, cb)
- } else {
- saveRequested(this.idealTree, cb)
- }
-}
-
-Installer.prototype.readGlobalPackageData = function (cb) {
- validate('F', arguments)
- log.silly('install', 'readGlobalPackageData')
- var self = this
- this.loadArgMetadata(iferr(cb, function () {
- mkdirp(self.where, iferr(cb, function () {
- var pkgs = {}
- self.args.forEach(function (pkg) {
- pkgs[pkg.name] = true
- })
- readPackageTree(self.where, function (ctx, kid) { return ctx.parent || pkgs[kid] }, iferr(cb, function (currentTree) {
- self.currentTree = currentTree
- return cb()
- }))
- }))
- }))
-}
-
-Installer.prototype.readLocalPackageData = function (cb) {
- validate('F', arguments)
- log.silly('install', 'readLocalPackageData')
- var self = this
- mkdirp(this.where, iferr(cb, function () {
- readPackageTree(self.where, iferr(cb, function (currentTree) {
- self.currentTree = currentTree
- self.currentTree.warnings = []
- if (currentTree.error && currentTree.error.code === 'EJSONPARSE') {
- return cb(currentTree.error)
- }
- if (!self.noPackageJsonOk && !currentTree.package) {
- log.error('install', "Couldn't read dependencies")
- var er = new Error("ENOENT, open '" + path.join(self.where, 'package.json') + "'")
- er.code = 'ENOPACKAGEJSON'
- er.errno = 34
- return cb(er)
- }
- if (!currentTree.package) currentTree.package = {}
- readShrinkwrap(currentTree, function (err) {
- if (err) {
- cb(err)
- } else {
- self.loadArgMetadata(cb)
- }
- })
- }))
- }))
-}
-
-Installer.prototype.cloneCurrentTreeToIdealTree = function (cb) {
- validate('F', arguments)
- log.silly('install', 'cloneCurrentTreeToIdealTree')
-
- this.idealTree = copyTree(this.currentTree)
- this.idealTree.warnings = []
- cb()
-}
-
-Installer.prototype.loadShrinkwrap = function (cb) {
- validate('F', arguments)
- log.silly('install', 'loadShrinkwrap')
- readShrinkwrap.andInflate(this.idealTree, iferr(cb, () => {
- computeMetadata(this.idealTree)
- cb()
- }))
-}
-
-Installer.prototype.getInstalledModules = function () {
- return this.differences.filter(function (action) {
- var mutation = action[0]
- return (mutation === 'add' || mutation === 'update')
- }).map(function (action) {
- var child = action[1]
- return [child.package._id, child.path]
- })
-}
-
-Installer.prototype.printWarnings = function (cb) {
- if (!this.idealTree) return cb()
-
- var self = this
- var warned = false
- this.idealTree.warnings.forEach(function (warning) {
- if (warning.code === 'EPACKAGEJSON' && self.global) return
- if (warning.code === 'ENOTDIR') return
- warned = true
- var msg = errorMessage(warning)
- msg.summary.forEach(function (logline) {
- log.warn.apply(log, logline)
- })
- msg.detail.forEach(function (logline) {
- log.verbose.apply(log, logline)
- })
- })
- if (warned && log.levels[npm.config.get('loglevel')] <= log.levels.warn) console.error()
- cb()
-}
-
-Installer.prototype.printInstalled = function (cb) {
- validate('F', arguments)
- if (this.failing) return cb()
- log.silly('install', 'printInstalled')
- const diffs = this.differences
- if (!this.idealTree.error && this.idealTree.removedChildren) {
- const deps = this.currentTree.package.dependencies || {}
- const dev = this.currentTree.package.devDependencies || {}
- this.idealTree.removedChildren.forEach((r) => {
- if (diffs.some((d) => d[0] === 'remove' && d[1].path === r.path)) return
- if (!deps[moduleName(r)] && !dev[moduleName(r)]) return
- diffs.push(['remove', r])
- })
- }
- return Bluebird.try(() => {
- if (!this.auditSubmission) return
- return Bluebird.resolve(this.auditSubmission).timeout(10000).catch(() => null)
- }).then((auditResult) => {
- if (auditResult && !auditResult.metadata) {
- log.warn('audit', 'Audit result from registry missing metadata. This is probably an issue with the registry.')
- }
- // maybe write audit report w/ hash of pjson & shrinkwrap for later reading by `npm audit`
- if (npm.config.get('json')) {
- return this.printInstalledForJSON(diffs, auditResult)
- } else if (npm.config.get('parseable')) {
- return this.printInstalledForParseable(diffs, auditResult)
- } else {
- return this.printInstalledForHuman(diffs, auditResult)
- }
- }).asCallback(cb)
-}
-
-Installer.prototype.printInstalledForHuman = function (diffs, auditResult) {
- var removed = 0
- var added = 0
- var updated = 0
- var moved = 0
- // Count the number of contributors to packages added, tracking
- // contributors we've seen, so we can produce a running unique count.
- var contributors = new Set()
- diffs.forEach(function (action) {
- var mutation = action[0]
- var pkg = action[1]
- if (pkg.failed) return
- if (mutation === 'remove') {
- ++removed
- } else if (mutation === 'move') {
- ++moved
- } else if (mutation === 'add') {
- ++added
- // Count contributors to added packages. Start by combining `author`
- // and `contributors` data into a single array of contributor-people
- // for this package.
- var people = []
- var meta = pkg.package
- if (meta.author) people.push(meta.author)
- if (meta.contributors && Array.isArray(meta.contributors)) {
- people = people.concat(meta.contributors)
- }
- // Make sure a normalized string for every person behind this
- // package is in `contributors`.
- people.forEach(function (person) {
- // Ignore errors from malformed `author` and `contributors`.
- try {
- var normalized = normalizePerson(person)
- } catch (error) {
- return
- }
- if (!contributors.has(normalized)) contributors.add(normalized)
- })
- } else if (mutation === 'update' || mutation === 'update-linked') {
- ++updated
- }
- })
- var report = ''
- if (this.args.length && (added || updated)) {
- report += this.args.map((p) => {
- return `+ ${p.name}@${p.version}`
- }).join('\n') + '\n'
- }
- var actions = []
- if (added) {
- var action = 'added ' + packages(added)
- if (contributors.size) action += from(contributors.size)
- actions.push(action)
- }
- if (removed) actions.push('removed ' + packages(removed))
- if (updated) actions.push('updated ' + packages(updated))
- if (moved) actions.push('moved ' + packages(moved))
- if (auditResult && auditResult.metadata && auditResult.metadata.totalDependencies) {
- actions.push('audited ' + packages(auditResult.metadata.totalDependencies))
- }
- if (actions.length === 0) {
- report += 'up to date'
- } else if (actions.length === 1) {
- report += actions[0]
- } else {
- var lastAction = actions.pop()
- report += actions.join(', ') + ' and ' + lastAction
- }
- report += ' in ' + ((Date.now() - this.started) / 1000) + 's'
-
- output(report)
- return auditResult && audit.printInstallReport(auditResult)
-
- function packages (num) {
- return num + ' package' + (num > 1 ? 's' : '')
- }
-
- function from (num) {
- return ' from ' + num + ' contributor' + (num > 1 ? 's' : '')
- }
-
- // Values of `author` and elements of `contributors` in `package.json`
- // files can be e-mail style strings or Objects with `name`, `email,
- // and `url` String properties. Convert Objects to Strings so that
- // we can efficiently keep a set of contributors we have already seen.
- function normalizePerson (argument) {
- if (typeof argument === 'string') return argument
- var returned = ''
- if (argument.name) returned += argument.name
- if (argument.email) returned += ' <' + argument.email + '>'
- if (argument.url) returned += ' (' + argument.email + ')'
- return returned
- }
-}
-
-Installer.prototype.printInstalledForJSON = function (diffs, auditResult) {
- var result = {
- added: [],
- removed: [],
- updated: [],
- moved: [],
- failed: [],
- warnings: [],
- audit: auditResult,
- elapsed: Date.now() - this.started
- }
- var self = this
- this.idealTree.warnings.forEach(function (warning) {
- if (warning.code === 'EPACKAGEJSON' && self.global) return
- if (warning.code === 'ENOTDIR') return
- var output = errorMessage(warning)
- var message = flattenMessage(output.summary)
- if (output.detail.length) {
- message += '\n' + flattenMessage(output.detail)
- }
- result.warnings.push(message)
- })
- diffs.forEach(function (action) {
- var mutation = action[0]
- var child = action[1]
- var record = recordAction(action)
- if (child.failed) {
- result.failed.push(record)
- } else if (mutation === 'add') {
- result.added.push(record)
- } else if (mutation === 'update' || mutation === 'update-linked') {
- result.updated.push(record)
- } else if (mutation === 'move') {
- result.moved.push(record)
- } else if (mutation === 'remove') {
- result.removed.push(record)
- }
- })
- output(JSON.stringify(result, null, 2))
-
- function flattenMessage (msg) {
- return msg.map(function (logline) { return logline.slice(1).join(' ') }).join('\n')
- }
-
- function recordAction (action) {
- var mutation = action[0]
- var child = action[1]
- var result = {
- action: mutation,
- name: moduleName(child),
- version: child.package && child.package.version,
- path: child.path
- }
- if (mutation === 'move') {
- result.previousPath = child.fromPath
- } else if (mutation === 'update') {
- result.previousVersion = child.oldPkg.package && child.oldPkg.package.version
- }
- return result
- }
-}
-
-Installer.prototype.printInstalledForParseable = function (diffs) {
- var self = this
- diffs.forEach(function (action) {
- var mutation = action[0]
- var child = action[1]
- if (mutation === 'move') {
- var previousPath = path.relative(self.where, child.fromPath)
- } else if (mutation === 'update') {
- var previousVersion = child.oldPkg.package && child.oldPkg.package.version
- }
- output(
- mutation + '\t' +
- moduleName(child) + '\t' +
- (child.package ? child.package.version : '') + '\t' +
- (child.path ? path.relative(self.where, child.path) : '') + '\t' +
- (previousVersion || '') + '\t' +
- (previousPath || ''))
- })
-}
-
-Installer.prototype.debugActions = function (name, actionListName, cb) {
- validate('SSF', arguments)
- var actionsToLog = this[actionListName]
- log.silly(name, 'action count', actionsToLog.length)
- actionsToLog.forEach(function (action) {
- log.silly(name, action.map(function (value) {
- return (value && value.package) ? packageId(value) : value
- }).join(' '))
- })
- cb()
-}
-
-// This takes an object and a property name instead of a value to allow us
-// to define the arguments for use by chain before the property exists yet.
-Installer.prototype.debugTree = function (name, treeName, cb) {
- validate('SSF', arguments)
- log.silly(name, this.archyDebugTree(this[treeName]).trim())
- cb()
-}
-
-Installer.prototype.archyDebugTree = function (tree) {
- validate('O', arguments)
- var seen = new Set()
- function byName (aa, bb) {
- return packageId(aa).localeCompare(packageId(bb))
- }
- function expandTree (tree) {
- seen.add(tree)
- return {
- label: packageId(tree),
- nodes: tree.children.filter((tree) => { return !seen.has(tree) && !tree.removed }).sort(byName).map(expandTree)
- }
- }
- return archy(expandTree(tree), '', { unicode: npm.config.get('unicode') })
-}
-
-Installer.prototype.debugLogicalTree = function (name, treeName, cb) {
- validate('SSF', arguments)
- this[treeName] && log.silly(name, this.archyDebugLogicalTree(this[treeName]).trim())
- cb()
-}
-
-Installer.prototype.archyDebugLogicalTree = function (tree) {
- validate('O', arguments)
- var seen = new Set()
- function byName (aa, bb) {
- return packageId(aa).localeCompare(packageId(bb))
- }
- function expandTree (tree) {
- seen.add(tree)
- return {
- label: packageId(tree),
- nodes: tree.requires.filter((tree) => { return !seen.has(tree) && !tree.removed }).sort(byName).map(expandTree)
- }
- }
- return archy(expandTree(tree), '', { unicode: npm.config.get('unicode') })
-}
diff --git a/deps/node/deps/npm/lib/install/access-error.js b/deps/node/deps/npm/lib/install/access-error.js
deleted file mode 100644
index ff94be98..00000000
--- a/deps/node/deps/npm/lib/install/access-error.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-module.exports = function (dir, er) {
- if (!er) return
- var accessEr = new Error("EACCES, access '" + dir + "'", -13)
- accessEr.code = 'EACCES'
- accessEr.path = dir
- return accessEr
-}
diff --git a/deps/node/deps/npm/lib/install/action/build.js b/deps/node/deps/npm/lib/install/action/build.js
deleted file mode 100644
index be2c141f..00000000
--- a/deps/node/deps/npm/lib/install/action/build.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-var chain = require('slide').chain
-var build = require('../../build.js')
-var npm = require('../../npm.js')
-var packageId = require('../../utils/package-id.js')
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('build', packageId(pkg))
- chain([
- [build.linkStuff, pkg.package, pkg.path, npm.config.get('global')],
- [build.writeBuiltinConf, pkg.package, pkg.path]
- ], next)
-}
diff --git a/deps/node/deps/npm/lib/install/action/extract-worker.js b/deps/node/deps/npm/lib/install/action/extract-worker.js
deleted file mode 100644
index 225e5b4a..00000000
--- a/deps/node/deps/npm/lib/install/action/extract-worker.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const extract = require('pacote/extract')
-// const npmlog = require('npmlog')
-
-module.exports = (args, cb) => {
- const parsed = typeof args === 'string' ? JSON.parse(args) : args
- const spec = parsed[0]
- const extractTo = parsed[1]
- const opts = parsed[2]
- // if (!opts.log) {
- // opts.log = npmlog
- // }
- // opts.log.level = opts.loglevel || opts.log.level
- BB.resolve(extract(spec, extractTo, opts)).nodeify(cb)
-}
diff --git a/deps/node/deps/npm/lib/install/action/extract.js b/deps/node/deps/npm/lib/install/action/extract.js
deleted file mode 100644
index c1c17cdf..00000000
--- a/deps/node/deps/npm/lib/install/action/extract.js
+++ /dev/null
@@ -1,139 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const figgyPudding = require('figgy-pudding')
-const stat = BB.promisify(require('graceful-fs').stat)
-const gentlyRm = BB.promisify(require('../../utils/gently-rm.js'))
-const mkdirp = BB.promisify(require('mkdirp'))
-const moduleStagingPath = require('../module-staging-path.js')
-const move = require('../../utils/move.js')
-const npa = require('npm-package-arg')
-const npm = require('../../npm.js')
-let npmConfig
-const packageId = require('../../utils/package-id.js')
-const path = require('path')
-const localWorker = require('./extract-worker.js')
-const workerFarm = require('worker-farm')
-const isRegistry = require('../../utils/is-registry.js')
-
-const WORKER_PATH = require.resolve('./extract-worker.js')
-let workers
-
-const ExtractOpts = figgyPudding({
- log: {}
-}, { other () { return true } })
-
-// Disabled for now. Re-enable someday. Just not today.
-const ENABLE_WORKERS = false
-
-extract.init = () => {
- if (ENABLE_WORKERS) {
- workers = workerFarm({
- maxConcurrentCallsPerWorker: npm.limit.fetch,
- maxRetries: 1
- }, WORKER_PATH)
- }
- return BB.resolve()
-}
-extract.teardown = () => {
- if (ENABLE_WORKERS) {
- workerFarm.end(workers)
- workers = null
- }
- return BB.resolve()
-}
-module.exports = extract
-function extract (staging, pkg, log) {
- log.silly('extract', packageId(pkg))
- const extractTo = moduleStagingPath(staging, pkg)
- if (!npmConfig) {
- npmConfig = require('../../config/figgy-config.js')
- }
- let opts = ExtractOpts(npmConfig()).concat({
- integrity: pkg.package._integrity,
- resolved: pkg.package._resolved
- })
- const args = [
- pkg.package._requested,
- extractTo,
- opts
- ]
- return BB.fromNode((cb) => {
- let launcher = localWorker
- let msg = args
- const spec = typeof args[0] === 'string' ? npa(args[0]) : args[0]
- args[0] = spec.raw
- if (ENABLE_WORKERS && (isRegistry(spec) || spec.type === 'remote')) {
- // We can't serialize these options
- opts = opts.concat({
- loglevel: opts.log.level,
- log: null,
- dirPacker: null,
- Promise: null,
- _events: null,
- _eventsCount: null,
- list: null,
- sources: null,
- _maxListeners: null,
- root: null
- })
- // workers will run things in parallel!
- launcher = workers
- try {
- msg = JSON.stringify(msg)
- } catch (e) {
- return cb(e)
- }
- }
- launcher(msg, cb)
- }).then(() => {
- if (pkg.package.bundleDependencies || anyBundled(pkg)) {
- return readBundled(pkg, staging, extractTo)
- }
- }).then(() => {
- return gentlyRm(path.join(extractTo, 'node_modules'))
- })
-}
-
-function anyBundled (top, pkg) {
- if (!pkg) pkg = top
- return pkg.children.some((child) => child.fromBundle === top || anyBundled(top, child))
-}
-
-function readBundled (pkg, staging, extractTo) {
- return BB.map(pkg.children, (child) => {
- if (!child.fromBundle) return
- if (child.error) {
- throw child.error
- } else {
- return stageBundledModule(pkg, child, staging, extractTo)
- }
- }, {concurrency: 10})
-}
-
-function stageBundledModule (bundler, child, staging, parentPath) {
- const stageFrom = path.join(parentPath, 'node_modules', child.package.name)
- const stageTo = moduleStagingPath(staging, child)
-
- return BB.map(child.children, (child) => {
- if (child.error) {
- throw child.error
- } else {
- return stageBundledModule(bundler, child, staging, stageFrom)
- }
- }).then(() => {
- return finishModule(bundler, child, stageTo, stageFrom)
- })
-}
-
-function finishModule (bundler, child, stageTo, stageFrom) {
- // If we were the one's who bundled this module…
- if (child.fromBundle === bundler) {
- return mkdirp(path.dirname(stageTo)).then(() => {
- return move(stageFrom, stageTo)
- })
- } else {
- return stat(stageFrom).then(() => gentlyRm(stageFrom), () => {})
- }
-}
diff --git a/deps/node/deps/npm/lib/install/action/fetch.js b/deps/node/deps/npm/lib/install/action/fetch.js
deleted file mode 100644
index 346194e5..00000000
--- a/deps/node/deps/npm/lib/install/action/fetch.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const finished = BB.promisify(require('mississippi').finished)
-const npmConfig = require('../../config/figgy-config.js')
-const packageId = require('../../utils/package-id.js')
-const pacote = require('pacote')
-
-module.exports = fetch
-function fetch (staging, pkg, log, next) {
- log.silly('fetch', packageId(pkg))
- const opts = npmConfig({integrity: pkg.package._integrity})
- return finished(pacote.tarball.stream(pkg.package._requested, opts))
- .then(() => next(), next)
-}
diff --git a/deps/node/deps/npm/lib/install/action/finalize.js b/deps/node/deps/npm/lib/install/action/finalize.js
deleted file mode 100644
index e46f1b9d..00000000
--- a/deps/node/deps/npm/lib/install/action/finalize.js
+++ /dev/null
@@ -1,106 +0,0 @@
-'use strict'
-const path = require('path')
-const fs = require('graceful-fs')
-const Bluebird = require('bluebird')
-const rimraf = Bluebird.promisify(require('rimraf'))
-const mkdirp = Bluebird.promisify(require('mkdirp'))
-const lstat = Bluebird.promisify(fs.lstat)
-const readdir = Bluebird.promisify(fs.readdir)
-const symlink = Bluebird.promisify(fs.symlink)
-const gentlyRm = Bluebird.promisify(require('../../utils/gently-rm'))
-const moduleStagingPath = require('../module-staging-path.js')
-const move = require('move-concurrently')
-const moveOpts = {fs: fs, Promise: Bluebird, maxConcurrency: 4}
-const getRequested = require('../get-requested.js')
-const log = require('npmlog')
-const packageId = require('../../utils/package-id.js')
-
-module.exports = function (staging, pkg, log) {
- log.silly('finalize', pkg.realpath)
-
- const extractedTo = moduleStagingPath(staging, pkg)
-
- const delpath = path.join(path.dirname(pkg.realpath), '.' + path.basename(pkg.realpath) + '.DELETE')
- let movedDestAway = false
-
- const requested = pkg.package._requested || getRequested(pkg)
- if (requested.type === 'directory') {
- const relative = path.relative(path.dirname(pkg.path), pkg.realpath)
- return makeParentPath(pkg.path)
- .then(() => symlink(relative, pkg.path, 'junction'))
- .catch((ex) => {
- return rimraf(pkg.path).then(() => symlink(relative, pkg.path, 'junction'))
- })
- } else {
- return makeParentPath(pkg.realpath)
- .then(moveStagingToDestination)
- .then(restoreOldNodeModules)
- .catch((err) => {
- if (movedDestAway) {
- return rimraf(pkg.realpath).then(moveOldDestinationBack).then(() => {
- throw err
- })
- } else {
- throw err
- }
- })
- .then(() => rimraf(delpath))
- }
-
- function makeParentPath (dir) {
- return mkdirp(path.dirname(dir))
- }
-
- function moveStagingToDestination () {
- return destinationIsClear()
- .then(actuallyMoveStaging)
- .catch(() => moveOldDestinationAway().then(actuallyMoveStaging))
- }
-
- function destinationIsClear () {
- return lstat(pkg.realpath).then(() => {
- throw new Error('destination exists')
- }, () => {})
- }
-
- function actuallyMoveStaging () {
- return move(extractedTo, pkg.realpath, moveOpts)
- }
-
- function moveOldDestinationAway () {
- return rimraf(delpath).then(() => {
- return move(pkg.realpath, delpath, moveOpts)
- }).then(() => { movedDestAway = true })
- }
-
- function moveOldDestinationBack () {
- return move(delpath, pkg.realpath, moveOpts).then(() => { movedDestAway = false })
- }
-
- function restoreOldNodeModules () {
- if (!movedDestAway) return
- return readdir(path.join(delpath, 'node_modules')).catch(() => []).then((modules) => {
- if (!modules.length) return
- return mkdirp(path.join(pkg.realpath, 'node_modules')).then(() => Bluebird.map(modules, (file) => {
- const from = path.join(delpath, 'node_modules', file)
- const to = path.join(pkg.realpath, 'node_modules', file)
- return move(from, to, moveOpts)
- }))
- })
- }
-}
-
-module.exports.rollback = function (top, staging, pkg) {
- return Bluebird.try(() => {
- const requested = pkg.package._requested || getRequested(pkg)
- if (requested && requested.type === 'directory') return Promise.resolve()
- // strictly speaking rolling back a finalize should ONLY remove module that
- // was being finalized, not any of the things under it. But currently
- // those modules are guaranteed to be useless so we may as well remove them too.
- // When/if we separate `commit` step and can rollback to previous versions
- // of upgraded modules then we'll need to revisit this…
- return gentlyRm(pkg.path, false, top).catch((err) => {
- log.warn('rollback', `Rolling back ${packageId(pkg)} failed (this is probably harmless): ${err.message ? err.message : err}`)
- })
- })
-}
diff --git a/deps/node/deps/npm/lib/install/action/global-install.js b/deps/node/deps/npm/lib/install/action/global-install.js
deleted file mode 100644
index bdc121b6..00000000
--- a/deps/node/deps/npm/lib/install/action/global-install.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict'
-var path = require('path')
-var npm = require('../../npm.js')
-var Installer = require('../../install.js').Installer
-var packageId = require('../../utils/package-id.js')
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('global-install', packageId(pkg))
- var globalRoot = path.resolve(npm.globalDir, '..')
- npm.config.set('global', true)
- var install = new Installer(globalRoot, false, [pkg.package.name + '@' + pkg.package._requested.fetchSpec])
- install.link = false
- install.run(function () {
- npm.config.set('global', false)
- next.apply(null, arguments)
- })
-}
diff --git a/deps/node/deps/npm/lib/install/action/global-link.js b/deps/node/deps/npm/lib/install/action/global-link.js
deleted file mode 100644
index f109e5b8..00000000
--- a/deps/node/deps/npm/lib/install/action/global-link.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-var npm = require('../../npm.js')
-var packageId = require('../../utils/package-id.js')
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('global-link', packageId(pkg))
- npm.link(pkg.package.name, next)
-}
diff --git a/deps/node/deps/npm/lib/install/action/install.js b/deps/node/deps/npm/lib/install/action/install.js
deleted file mode 100644
index a5cf63b7..00000000
--- a/deps/node/deps/npm/lib/install/action/install.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-var lifecycle = require('../../utils/lifecycle.js')
-var packageId = require('../../utils/package-id.js')
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('install', packageId(pkg))
- lifecycle(pkg.package, 'install', pkg.path, next)
-}
diff --git a/deps/node/deps/npm/lib/install/action/move.js b/deps/node/deps/npm/lib/install/action/move.js
deleted file mode 100644
index 00d58a15..00000000
--- a/deps/node/deps/npm/lib/install/action/move.js
+++ /dev/null
@@ -1,96 +0,0 @@
-'use strict'
-var fs = require('graceful-fs')
-var path = require('path')
-var chain = require('slide').chain
-var iferr = require('iferr')
-var rimraf = require('rimraf')
-var mkdirp = require('mkdirp')
-var rmStuff = require('../../unbuild.js').rmStuff
-var lifecycle = require('../../utils/lifecycle.js')
-var move = require('../../utils/move.js')
-
-/*
- Move a module from one point in the node_modules tree to another.
- Do not disturb either the source or target location's node_modules
- folders.
-*/
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('move', pkg.fromPath, pkg.path)
- chain([
- [lifecycle, pkg.package, 'preuninstall', pkg.fromPath, { failOk: true }],
- [lifecycle, pkg.package, 'uninstall', pkg.fromPath, { failOk: true }],
- [rmStuff, pkg.package, pkg.fromPath],
- [lifecycle, pkg.package, 'postuninstall', pkg.fromPath, { failOk: true }],
- [moveModuleOnly, pkg.fromPath, pkg.path, log],
- [lifecycle, pkg.package, 'preinstall', pkg.path, { failOk: true }],
- [removeEmptyParents, path.resolve(pkg.fromPath, '..')]
- ], next)
-}
-
-function removeEmptyParents (pkgdir, next) {
- fs.rmdir(pkgdir, function (er) {
- // FIXME: Make sure windows does what we want here
- if (er && er.code !== 'ENOENT') return next()
- removeEmptyParents(path.resolve(pkgdir, '..'), next)
- })
-}
-
-function moveModuleOnly (from, to, log, done) {
- var fromModules = path.join(from, 'node_modules')
- var tempFromModules = from + '.node_modules'
- var toModules = path.join(to, 'node_modules')
- var tempToModules = to + '.node_modules'
-
- log.silly('move', 'move existing destination node_modules away', toModules)
-
- move(toModules, tempToModules).then(removeDestination(done), removeDestination(done))
-
- function removeDestination (next) {
- return function (er) {
- log.silly('move', 'remove existing destination', to)
- if (er) {
- rimraf(to, iferr(next, makeDestination(next)))
- } else {
- rimraf(to, iferr(next, makeDestination(iferr(next, moveToModulesBack(next)))))
- }
- }
- }
-
- function moveToModulesBack (next) {
- return function () {
- log.silly('move', 'move existing destination node_modules back', toModules)
- move(tempToModules, toModules).then(next, done)
- }
- }
-
- function makeDestination (next) {
- return function () {
- log.silly('move', 'make sure destination parent exists', path.resolve(to, '..'))
- mkdirp(path.resolve(to, '..'), iferr(done, moveNodeModules(next)))
- }
- }
-
- function moveNodeModules (next) {
- return function () {
- log.silly('move', 'move source node_modules away', fromModules)
- move(fromModules, tempFromModules).then(doMove(moveNodeModulesBack(next)), doMove(next))
- }
- }
-
- function doMove (next) {
- return function () {
- log.silly('move', 'move module dir to final dest', from, to)
- move(from, to).then(next, done)
- }
- }
-
- function moveNodeModulesBack (next) {
- return function () {
- mkdirp(from, iferr(done, function () {
- log.silly('move', 'put source node_modules back', fromModules)
- move(tempFromModules, fromModules).then(next, done)
- }))
- }
- }
-}
diff --git a/deps/node/deps/npm/lib/install/action/postinstall.js b/deps/node/deps/npm/lib/install/action/postinstall.js
deleted file mode 100644
index 01accb2a..00000000
--- a/deps/node/deps/npm/lib/install/action/postinstall.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-var lifecycle = require('../../utils/lifecycle.js')
-var packageId = require('../../utils/package-id.js')
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('postinstall', packageId(pkg))
- lifecycle(pkg.package, 'postinstall', pkg.path, next)
-}
diff --git a/deps/node/deps/npm/lib/install/action/preinstall.js b/deps/node/deps/npm/lib/install/action/preinstall.js
deleted file mode 100644
index 374ff563..00000000
--- a/deps/node/deps/npm/lib/install/action/preinstall.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-var lifecycle = require('../../utils/lifecycle.js')
-var packageId = require('../../utils/package-id.js')
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('preinstall', packageId(pkg))
- lifecycle(pkg.package, 'preinstall', pkg.path, next)
-}
diff --git a/deps/node/deps/npm/lib/install/action/prepare.js b/deps/node/deps/npm/lib/install/action/prepare.js
deleted file mode 100644
index d48c8e7e..00000000
--- a/deps/node/deps/npm/lib/install/action/prepare.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict'
-var chain = require('slide').chain
-var lifecycle = require('../../utils/lifecycle.js')
-var packageId = require('../../utils/package-id.js')
-var prepublishWarning = require('../../utils/warn-deprecated.js')('prepublish-on-install')
-var moduleStagingPath = require('../module-staging-path.js')
-
-module.exports = function (staging, pkg, log, next) {
- log.silly('prepublish', packageId(pkg))
- // TODO: for `npm@5`, change the behavior and remove this warning.
- // see https://github.com/npm/npm/issues/10074 for details
- if (pkg.package && pkg.package.scripts && pkg.package.scripts.prepublish) {
- prepublishWarning([
- 'As of npm@5, `prepublish` scripts are deprecated.',
- 'Use `prepare` for build steps and `prepublishOnly` for upload-only.',
- 'See the deprecation note in `npm help scripts` for more information.'
- ])
- }
- var buildpath = moduleStagingPath(staging, pkg)
- chain(
- [
- [lifecycle, pkg.package, 'prepublish', buildpath],
- [lifecycle, pkg.package, 'prepare', buildpath]
- ],
- next
- )
-}
diff --git a/deps/node/deps/npm/lib/install/action/refresh-package-json.js b/deps/node/deps/npm/lib/install/action/refresh-package-json.js
deleted file mode 100644
index 32e64444..00000000
--- a/deps/node/deps/npm/lib/install/action/refresh-package-json.js
+++ /dev/null
@@ -1,45 +0,0 @@
-'use strict'
-
-const Bluebird = require('bluebird')
-
-const checkPlatform = Bluebird.promisify(require('npm-install-checks').checkPlatform)
-const getRequested = require('../get-requested.js')
-const npm = require('../../npm.js')
-const path = require('path')
-const readJson = Bluebird.promisify(require('read-package-json'))
-const updatePackageJson = Bluebird.promisify(require('../update-package-json'))
-
-module.exports = function (staging, pkg, log) {
- log.silly('refresh-package-json', pkg.realpath)
-
- return readJson(path.join(pkg.path, 'package.json'), false).then((metadata) => {
- Object.keys(pkg.package).forEach(function (key) {
- if (key !== 'version' && key !== 'dependencies' && !isEmpty(pkg.package[key])) {
- metadata[key] = pkg.package[key]
- }
- })
- if (metadata._resolved == null && pkg.fakeChild) {
- metadata._resolved = pkg.fakeChild.resolved
- }
- // These two sneak in and it's awful
- delete metadata.readme
- delete metadata.readmeFilename
-
- pkg.package = metadata
- pkg.fakeChild = false
- }).catch(() => 'ignore').then(() => {
- return checkPlatform(pkg.package, npm.config.get('force'))
- }).then(() => {
- const requested = pkg.package._requested || getRequested(pkg)
- if (requested.type !== 'directory') {
- return updatePackageJson(pkg, pkg.path)
- }
- })
-}
-
-function isEmpty (value) {
- if (value == null) return true
- if (Array.isArray(value)) return !value.length
- if (typeof value === 'object') return !Object.keys(value).length
- return false
-}
diff --git a/deps/node/deps/npm/lib/install/action/remove.js b/deps/node/deps/npm/lib/install/action/remove.js
deleted file mode 100644
index a852d10c..00000000
--- a/deps/node/deps/npm/lib/install/action/remove.js
+++ /dev/null
@@ -1,85 +0,0 @@
-'use strict'
-var path = require('path')
-var fs = require('graceful-fs')
-var rimraf = require('rimraf')
-var asyncMap = require('slide').asyncMap
-var mkdirp = require('mkdirp')
-var npm = require('../../npm.js')
-var andIgnoreErrors = require('../and-ignore-errors.js')
-var move = require('../../utils/move.js')
-var isInside = require('path-is-inside')
-var vacuum = require('fs-vacuum')
-
-// This is weird because we want to remove the module but not it's node_modules folder
-// allowing for this allows us to not worry about the order of operations
-module.exports = function (staging, pkg, log, next) {
- log.silly('remove', pkg.path)
- if (pkg.target) {
- removeLink(pkg, next)
- } else {
- removeDir(pkg, log, next)
- }
-}
-
-function removeLink (pkg, next) {
- var base = isInside(pkg.path, npm.prefix) ? npm.prefix : pkg.path
- rimraf(pkg.path, (err) => {
- if (err) return next(err)
- vacuum(pkg.path, {base: base}, next)
- })
-}
-
-function removeDir (pkg, log, next) {
- var modpath = path.join(path.dirname(pkg.path), '.' + path.basename(pkg.path) + '.MODULES')
-
- move(path.join(pkg.path, 'node_modules'), modpath).then(unbuildPackage, unbuildPackage)
-
- function unbuildPackage (moveEr) {
- rimraf(pkg.path, moveEr ? andRemoveEmptyParents(pkg.path) : moveModulesBack)
- }
-
- function andRemoveEmptyParents (path) {
- return function (er) {
- if (er) return next(er)
- removeEmptyParents(pkg.path)
- }
- }
-
- function moveModulesBack () {
- fs.readdir(modpath, makeTarget)
- }
-
- function makeTarget (readdirEr, files) {
- if (readdirEr) return cleanup()
- if (!files.length) return cleanup()
- mkdirp(path.join(pkg.path, 'node_modules'), function (mkdirEr) { moveModules(mkdirEr, files) })
- }
-
- function moveModules (mkdirEr, files) {
- if (mkdirEr) return next(mkdirEr)
- asyncMap(files, function (file, done) {
- var from = path.join(modpath, file)
- var to = path.join(pkg.path, 'node_modules', file)
- // we ignore errors here, because they can legitimately happen, for instance,
- // bundled modules will be in both node_modules folders
- move(from, to).then(andIgnoreErrors(done), andIgnoreErrors(done))
- }, cleanup)
- }
-
- function cleanup () {
- rimraf(modpath, afterCleanup)
- }
-
- function afterCleanup (rimrafEr) {
- if (rimrafEr) log.warn('remove', rimrafEr)
- removeEmptyParents(path.resolve(pkg.path, '..'))
- }
-
- function removeEmptyParents (pkgdir) {
- fs.rmdir(pkgdir, function (er) {
- // FIXME: Make sure windows does what we want here
- if (er && er.code !== 'ENOENT') return next()
- removeEmptyParents(path.resolve(pkgdir, '..'))
- })
- }
-}
diff --git a/deps/node/deps/npm/lib/install/action/unbuild.js b/deps/node/deps/npm/lib/install/action/unbuild.js
deleted file mode 100644
index dbfbd9c4..00000000
--- a/deps/node/deps/npm/lib/install/action/unbuild.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict'
-var Bluebird = require('bluebird')
-var lifecycle = Bluebird.promisify(require('../../utils/lifecycle.js'))
-var packageId = require('../../utils/package-id.js')
-var rmStuff = Bluebird.promisify(require('../../unbuild.js').rmStuff)
-
-module.exports = function (staging, pkg, log) {
- log.silly('unbuild', packageId(pkg))
- return lifecycle(pkg.package, 'preuninstall', pkg.path, { failOk: true }).then(() => {
- return lifecycle(pkg.package, 'uninstall', pkg.path, { failOk: true })
- }).then(() => {
- return rmStuff(pkg.package, pkg.path)
- }).then(() => {
- return lifecycle(pkg.package, 'postuninstall', pkg.path, { failOk: true })
- })
-}
diff --git a/deps/node/deps/npm/lib/install/actions.js b/deps/node/deps/npm/lib/install/actions.js
deleted file mode 100644
index a34d03ff..00000000
--- a/deps/node/deps/npm/lib/install/actions.js
+++ /dev/null
@@ -1,192 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const andAddParentToErrors = require('./and-add-parent-to-errors.js')
-const failedDependency = require('./deps.js').failedDependency
-const isInstallable = BB.promisify(require('./validate-args.js').isInstallable)
-const moduleName = require('../utils/module-name.js')
-const npm = require('../npm.js')
-const reportOptionalFailure = require('./report-optional-failure.js')
-const validate = require('aproba')
-
-const actions = {}
-
-actions.fetch = require('./action/fetch.js')
-actions.extract = require('./action/extract.js')
-actions.build = require('./action/build.js')
-actions.preinstall = require('./action/preinstall.js')
-actions.install = require('./action/install.js')
-actions.postinstall = require('./action/postinstall.js')
-actions.prepare = require('./action/prepare.js')
-actions.finalize = require('./action/finalize.js')
-actions.remove = require('./action/remove.js')
-actions.unbuild = require('./action/unbuild.js')
-actions.move = require('./action/move.js')
-actions['global-install'] = require('./action/global-install.js')
-actions['global-link'] = require('./action/global-link.js')
-actions['refresh-package-json'] = require('./action/refresh-package-json.js')
-
-// FIXME: We wrap actions like three ways to sunday here.
-// Rewrite this to only work one way.
-
-Object.keys(actions).forEach(function (actionName) {
- var action = actions[actionName]
- actions[actionName] = (staging, pkg, log) => {
- validate('SOO', [staging, pkg, log])
- // refuse to run actions for failed packages
- if (pkg.failed) return BB.resolve()
- if (action.rollback) {
- if (!pkg.rollback) pkg.rollback = []
- pkg.rollback.unshift(action.rollback)
- }
- if (action.commit) {
- if (!pkg.commit) pkg.commit = []
- pkg.commit.push(action.commit)
- }
-
- let actionP
- if (pkg.knownInstallable) {
- actionP = runAction(action, staging, pkg, log)
- } else {
- actionP = isInstallable(pkg.package).then(() => {
- pkg.knownInstallable = true
- return runAction(action, staging, pkg, log)
- })
- }
-
- return actionP.then(() => {
- log.finish()
- }, (err) => {
- return BB.fromNode((cb) => {
- andAddParentToErrors(pkg.parent, cb)(err)
- }).catch((err) => {
- return handleOptionalDepErrors(pkg, err)
- })
- })
- }
- actions[actionName].init = action.init || (() => BB.resolve())
- actions[actionName].teardown = action.teardown || (() => BB.resolve())
-})
-exports.actions = actions
-
-function runAction (action, staging, pkg, log) {
- return BB.fromNode((cb) => {
- const result = action(staging, pkg, log, cb)
- if (result && result.then) {
- result.then(() => cb(), cb)
- }
- })
-}
-
-function markAsFailed (pkg) {
- if (pkg.failed) return
- pkg.failed = true
- pkg.requires.forEach((req) => {
- var requiredBy = req.requiredBy.filter((reqReqBy) => !reqReqBy.failed)
- if (requiredBy.length === 0 && !req.userRequired) {
- markAsFailed(req)
- }
- })
-}
-
-function handleOptionalDepErrors (pkg, err) {
- markAsFailed(pkg)
- var anyFatal = failedDependency(pkg)
- if (anyFatal) {
- throw err
- } else {
- reportOptionalFailure(pkg, null, err)
- }
-}
-
-exports.doOne = doOne
-function doOne (cmd, staging, pkg, log, next) {
- validate('SSOOF', arguments)
- const prepped = prepareAction([cmd, pkg], staging, log)
- return withInit(actions[cmd], () => {
- return execAction(prepped)
- }).nodeify(next)
-}
-
-exports.doParallel = doParallel
-function doParallel (type, staging, actionsToRun, log, next) {
- validate('SSAOF', arguments)
- const acts = actionsToRun.reduce((acc, todo) => {
- if (todo[0] === type) {
- acc.push(prepareAction(todo, staging, log))
- }
- return acc
- }, [])
- log.silly('doParallel', type + ' ' + acts.length)
- time(log)
- if (!acts.length) { return next() }
- return withInit(actions[type], () => {
- return BB.map(acts, execAction, {
- concurrency: npm.limit.action
- })
- }).nodeify((err) => {
- log.finish()
- timeEnd(log)
- next(err)
- })
-}
-
-exports.doSerial = doSerial
-function doSerial (type, staging, actionsToRun, log, next) {
- validate('SSAOF', arguments)
- log.silly('doSerial', '%s %d', type, actionsToRun.length)
- runSerial(type, staging, actionsToRun, log, next)
-}
-
-exports.doReverseSerial = doReverseSerial
-function doReverseSerial (type, staging, actionsToRun, log, next) {
- validate('SSAOF', arguments)
- log.silly('doReverseSerial', '%s %d', type, actionsToRun.length)
- runSerial(type, staging, [].concat(actionsToRun).reverse(), log, next)
-}
-
-function runSerial (type, staging, actionsToRun, log, next) {
- const acts = actionsToRun.reduce((acc, todo) => {
- if (todo[0] === type) {
- acc.push(prepareAction(todo, staging, log))
- }
- return acc
- }, [])
- time(log)
- if (!acts.length) { return next() }
- return withInit(actions[type], () => {
- return BB.each(acts, execAction)
- }).nodeify((err) => {
- log.finish()
- timeEnd(log)
- next(err)
- })
-}
-
-function time (log) {
- process.emit('time', 'action:' + log.name)
-}
-function timeEnd (log) {
- process.emit('timeEnd', 'action:' + log.name)
-}
-
-function withInit (action, body) {
- return BB.using(
- action.init().disposer(() => action.teardown()),
- body
- )
-}
-
-function prepareAction (action, staging, log) {
- validate('ASO', arguments)
- validate('SO', action)
- var cmd = action[0]
- var pkg = action[1]
- if (!actions[cmd]) throw new Error('Unknown decomposed command "' + cmd + '" (is it new?)')
- return [actions[cmd], staging, pkg, log.newGroup(cmd + ':' + moduleName(pkg))]
-}
-
-function execAction (todo) {
- return todo[0].apply(null, todo.slice(1))
-}
diff --git a/deps/node/deps/npm/lib/install/and-add-parent-to-errors.js b/deps/node/deps/npm/lib/install/and-add-parent-to-errors.js
deleted file mode 100644
index 62a86bd4..00000000
--- a/deps/node/deps/npm/lib/install/and-add-parent-to-errors.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-var validate = require('aproba')
-
-module.exports = function (parent, cb) {
- validate('F', [cb])
- return function (er) {
- if (!er) return cb.apply(null, arguments)
- if (er instanceof Error && parent && parent.package && parent.package.name) {
- er.parent = parent.package.name
- }
- cb(er)
- }
-}
diff --git a/deps/node/deps/npm/lib/install/and-finish-tracker.js b/deps/node/deps/npm/lib/install/and-finish-tracker.js
deleted file mode 100644
index 2bab60dd..00000000
--- a/deps/node/deps/npm/lib/install/and-finish-tracker.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict'
-var validate = require('aproba')
-
-module.exports = function (tracker, cb) {
- validate('OF', [tracker, cb])
- return function () {
- tracker.finish()
- cb.apply(null, arguments)
- }
-}
-
-module.exports.now = function (tracker, cb) {
- validate('OF', [tracker, cb])
- tracker.finish()
- cb.apply(null, Array.prototype.slice.call(arguments, 2))
-}
diff --git a/deps/node/deps/npm/lib/install/and-ignore-errors.js b/deps/node/deps/npm/lib/install/and-ignore-errors.js
deleted file mode 100644
index cf46ad82..00000000
--- a/deps/node/deps/npm/lib/install/and-ignore-errors.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict'
-
-module.exports = function (cb) {
- return function () {
- var args = Array.prototype.slice.call(arguments, 1)
- if (args.length) args.unshift(null)
- return cb.apply(null, args)
- }
-}
diff --git a/deps/node/deps/npm/lib/install/audit.js b/deps/node/deps/npm/lib/install/audit.js
deleted file mode 100644
index f5bc5ae1..00000000
--- a/deps/node/deps/npm/lib/install/audit.js
+++ /dev/null
@@ -1,279 +0,0 @@
-'use strict'
-exports.generate = generate
-exports.generateFromInstall = generateFromInstall
-exports.submitForInstallReport = submitForInstallReport
-exports.submitForFullReport = submitForFullReport
-exports.printInstallReport = printInstallReport
-exports.printParseableReport = printParseableReport
-exports.printFullReport = printFullReport
-
-const auditReport = require('npm-audit-report')
-const npmConfig = require('../config/figgy-config.js')
-const figgyPudding = require('figgy-pudding')
-const treeToShrinkwrap = require('../shrinkwrap.js').treeToShrinkwrap
-const packageId = require('../utils/package-id.js')
-const output = require('../utils/output.js')
-const npm = require('../npm.js')
-const qw = require('qw')
-const regFetch = require('npm-registry-fetch')
-const perf = require('../utils/perf.js')
-const npa = require('npm-package-arg')
-const uuid = require('uuid')
-const ssri = require('ssri')
-const cloneDeep = require('lodash.clonedeep')
-
-// used when scrubbing module names/specifiers
-const runId = uuid.v4()
-
-const InstallAuditConfig = figgyPudding({
- color: {},
- json: {},
- unicode: {}
-}, {
- other (key) {
- return /:registry$/.test(key)
- }
-})
-
-function submitForInstallReport (auditData) {
- const opts = InstallAuditConfig(npmConfig())
- const scopedRegistries = [...opts.keys()].filter(
- k => /:registry$/.test(k)
- ).map(k => opts[k])
- scopedRegistries.forEach(registry => {
- // we don't care about the response so destroy the stream if we can, or leave it flowing
- // so it can eventually finish and clean up after itself
- regFetch('/-/npm/v1/security/audits/quick', opts.concat({
- method: 'POST',
- registry,
- gzip: true,
- body: auditData
- })).then(_ => {
- _.body.on('error', () => {})
- if (_.body.destroy) {
- _.body.destroy()
- } else {
- _.body.resume()
- }
- }, _ => {})
- })
- perf.emit('time', 'audit submit')
- return regFetch('/-/npm/v1/security/audits/quick', opts.concat({
- method: 'POST',
- gzip: true,
- body: auditData
- })).then(response => {
- perf.emit('timeEnd', 'audit submit')
- perf.emit('time', 'audit body')
- return response.json()
- }).then(result => {
- perf.emit('timeEnd', 'audit body')
- return result
- })
-}
-
-function submitForFullReport (auditData) {
- perf.emit('time', 'audit submit')
- const opts = InstallAuditConfig(npmConfig())
- return regFetch('/-/npm/v1/security/audits', opts.concat({
- method: 'POST',
- gzip: true,
- body: auditData
- })).then(response => {
- perf.emit('timeEnd', 'audit submit')
- perf.emit('time', 'audit body')
- return response.json()
- }).then(result => {
- perf.emit('timeEnd', 'audit body')
- result.runId = runId
- return result
- })
-}
-
-function printInstallReport (auditResult) {
- const opts = InstallAuditConfig(npmConfig())
- return auditReport(auditResult, {
- reporter: 'install',
- withColor: opts.color,
- withUnicode: opts.unicode
- }).then(result => output(result.report))
-}
-
-function printFullReport (auditResult) {
- const opts = InstallAuditConfig(npmConfig())
- return auditReport(auditResult, {
- log: output,
- reporter: opts.json ? 'json' : 'detail',
- withColor: opts.color,
- withUnicode: opts.unicode
- }).then(result => output(result.report))
-}
-
-function printParseableReport (auditResult) {
- const opts = InstallAuditConfig(npmConfig())
- return auditReport(auditResult, {
- log: output,
- reporter: 'parseable',
- withColor: opts.color,
- withUnicode: opts.unicode
- }).then(result => output(result.report))
-}
-
-function generate (shrinkwrap, requires, diffs, install, remove) {
- const sw = cloneDeep(shrinkwrap)
- delete sw.lockfileVersion
- sw.requires = scrubRequires(requires)
- scrubDeps(sw.dependencies)
-
- // sw.diffs = diffs || {}
- sw.install = (install || []).map(scrubArg)
- sw.remove = (remove || []).map(scrubArg)
- return generateMetadata().then((md) => {
- sw.metadata = md
- return sw
- })
-}
-
-const scrubKeys = qw`version`
-const deleteKeys = qw`from resolved`
-
-function scrubDeps (deps) {
- if (!deps) return
- Object.keys(deps).forEach(name => {
- if (!shouldScrubName(name) && !shouldScrubSpec(name, deps[name].version)) return
- const value = deps[name]
- delete deps[name]
- deps[scrub(name)] = value
- })
- Object.keys(deps).forEach(name => {
- for (let toScrub of scrubKeys) {
- if (!deps[name][toScrub]) continue
- deps[name][toScrub] = scrubSpec(name, deps[name][toScrub])
- }
- for (let toDelete of deleteKeys) delete deps[name][toDelete]
-
- scrubRequires(deps[name].requires)
- scrubDeps(deps[name].dependencies)
- })
-}
-
-function scrubRequires (reqs) {
- if (!reqs) return reqs
- Object.keys(reqs).forEach(name => {
- const spec = reqs[name]
- if (shouldScrubName(name) || shouldScrubSpec(name, spec)) {
- delete reqs[name]
- reqs[scrub(name)] = scrubSpec(name, spec)
- } else {
- reqs[name] = scrubSpec(name, spec)
- }
- })
- return reqs
-}
-
-function getScope (name) {
- if (name[0] === '@') return name.slice(0, name.indexOf('/'))
-}
-
-function shouldScrubName (name) {
- const scope = getScope(name)
- const cfg = npm.config // avoid the no-dynamic-lookups test
- return Boolean(scope && cfg.get(scope + ':registry'))
-}
-function shouldScrubSpec (name, spec) {
- const req = npa.resolve(name, spec)
- return !req.registry
-}
-
-function scrubArg (arg) {
- const req = npa(arg)
- let name = req.name
- if (shouldScrubName(name) || shouldScrubSpec(name, req.rawSpec)) {
- name = scrubName(name)
- }
- const spec = scrubSpec(req.name, req.rawSpec)
- return name + '@' + spec
-}
-
-function scrubName (name) {
- return shouldScrubName(name) ? scrub(name) : name
-}
-
-function scrubSpec (name, spec) {
- const req = npa.resolve(name, spec)
- if (req.registry) return spec
- if (req.type === 'git') {
- return 'git+ssh://' + scrub(spec)
- } else if (req.type === 'remote') {
- return 'https://' + scrub(spec)
- } else if (req.type === 'directory') {
- return 'file:' + scrub(spec)
- } else if (req.type === 'file') {
- return 'file:' + scrub(spec) + '.tar'
- } else {
- return scrub(spec)
- }
-}
-
-module.exports.scrub = scrub
-function scrub (value, rid) {
- return ssri.fromData((rid || runId) + ' ' + value, {algorithms: ['sha256']}).hexDigest()
-}
-
-function generateMetadata () {
- const meta = {}
- meta.npm_version = npm.version
- meta.node_version = process.version
- meta.platform = process.platform
- meta.node_env = process.env.NODE_ENV
-
- return Promise.resolve(meta)
-}
-/*
- const head = path.resolve(npm.prefix, '.git/HEAD')
- return readFile(head, 'utf8').then((head) => {
- if (!head.match(/^ref: /)) {
- meta.commit_hash = head.trim()
- return
- }
- const headFile = head.replace(/^ref: /, '').trim()
- meta.branch = headFile.replace(/^refs[/]heads[/]/, '')
- return readFile(path.resolve(npm.prefix, '.git', headFile), 'utf8')
- }).then((commitHash) => {
- meta.commit_hash = commitHash.trim()
- const proc = spawn('git', qw`diff --quiet --exit-code package.json package-lock.json`, {cwd: npm.prefix, stdio: 'ignore'})
- return new Promise((resolve, reject) => {
- proc.once('error', reject)
- proc.on('exit', (code, signal) => {
- if (signal == null) meta.state = code === 0 ? 'clean' : 'dirty'
- resolve()
- })
- })
- }).then(() => meta, () => meta)
-*/
-
-function generateFromInstall (tree, diffs, install, remove) {
- const requires = {}
- tree.requires.forEach((pkg) => {
- requires[pkg.package.name] = tree.package.dependencies[pkg.package.name] || tree.package.devDependencies[pkg.package.name] || pkg.package.version
- })
-
- const auditInstall = (install || []).filter((a) => a.name).map(packageId)
- const auditRemove = (remove || []).filter((a) => a.name).map(packageId)
- const auditDiffs = {}
- diffs.forEach((action) => {
- const mutation = action[0]
- const child = action[1]
- if (mutation !== 'add' && mutation !== 'update' && mutation !== 'remove') return
- if (!auditDiffs[mutation]) auditDiffs[mutation] = []
- if (mutation === 'add') {
- auditDiffs[mutation].push({location: child.location})
- } else if (mutation === 'update') {
- auditDiffs[mutation].push({location: child.location, previous: packageId(child.oldPkg)})
- } else if (mutation === 'remove') {
- auditDiffs[mutation].push({previous: packageId(child)})
- }
- })
-
- return generate(treeToShrinkwrap(tree), requires, auditDiffs, auditInstall, auditRemove)
-}
diff --git a/deps/node/deps/npm/lib/install/check-permissions.js b/deps/node/deps/npm/lib/install/check-permissions.js
deleted file mode 100644
index 7806fcff..00000000
--- a/deps/node/deps/npm/lib/install/check-permissions.js
+++ /dev/null
@@ -1,69 +0,0 @@
-'use strict'
-var path = require('path')
-var log = require('npmlog')
-var validate = require('aproba')
-var uniq = require('lodash.uniq')
-var asyncMap = require('slide').asyncMap
-var npm = require('../npm.js')
-var exists = require('./exists.js')
-var writable = require('./writable.js')
-
-module.exports = function (actions, next) {
- validate('AF', arguments)
- var errors = []
- asyncMap(actions, function (action, done) {
- var cmd = action[0]
- var pkg = action[1]
- switch (cmd) {
- case 'add':
- hasAnyWriteAccess(path.resolve(pkg.path, '..'), errors, done)
- break
- case 'update':
- case 'remove':
- hasWriteAccess(pkg.path, errors, andHasWriteAccess(path.resolve(pkg.path, '..'), errors, done))
- break
- case 'move':
- hasAnyWriteAccess(pkg.path, errors, andHasWriteAccess(path.resolve(pkg.fromPath, '..'), errors, done))
- break
- default:
- done()
- }
- }, function () {
- if (!errors.length) return next()
- uniq(errors.map(function (er) { return 'Missing write access to ' + er.path })).forEach(function (er) {
- log.warn('checkPermissions', er)
- })
- npm.config.get('force') ? next() : next(errors[0])
- })
-}
-
-function andHasWriteAccess (dir, errors, done) {
- validate('SAF', arguments)
- return function () {
- hasWriteAccess(dir, errors, done)
- }
-}
-
-function hasAnyWriteAccess (dir, errors, done) {
- validate('SAF', arguments)
- findNearestDir()
- function findNearestDir () {
- var nextDir = path.resolve(dir, '..')
- exists(dir, function (dirDoesntExist) {
- if (!dirDoesntExist || nextDir === dir) {
- return hasWriteAccess(dir, errors, done)
- } else {
- dir = nextDir
- findNearestDir()
- }
- })
- }
-}
-
-function hasWriteAccess (dir, errors, done) {
- validate('SAF', arguments)
- writable(dir, function (er) {
- if (er) errors.push(er)
- done()
- })
-}
diff --git a/deps/node/deps/npm/lib/install/copy-tree.js b/deps/node/deps/npm/lib/install/copy-tree.js
deleted file mode 100644
index 2bf7064f..00000000
--- a/deps/node/deps/npm/lib/install/copy-tree.js
+++ /dev/null
@@ -1,30 +0,0 @@
-'use strict'
-var createNode = require('./node.js').create
-module.exports = function (tree) {
- return copyTree(tree, {})
-}
-
-function copyTree (tree, cache) {
- if (cache[tree.path]) { return cache[tree.path] }
- var newTree = cache[tree.path] = createNode(Object.assign({}, tree))
- copyModuleList(newTree, 'children', cache)
- newTree.children.forEach(function (child) {
- child.parent = newTree
- })
- copyModuleList(newTree, 'requires', cache)
- copyModuleList(newTree, 'requiredBy', cache)
- return newTree
-}
-
-function copyModuleList (tree, key, cache) {
- var newList = []
- if (tree[key]) {
- tree[key].forEach(function (child) {
- const copy = copyTree(child, cache)
- if (copy) {
- newList.push(copy)
- }
- })
- }
- tree[key] = newList
-}
diff --git a/deps/node/deps/npm/lib/install/decompose-actions.js b/deps/node/deps/npm/lib/install/decompose-actions.js
deleted file mode 100644
index ba08e6e7..00000000
--- a/deps/node/deps/npm/lib/install/decompose-actions.js
+++ /dev/null
@@ -1,79 +0,0 @@
-'use strict'
-var validate = require('aproba')
-var npm = require('../npm.js')
-
-module.exports = function (differences, decomposed, next) {
- validate('AAF', arguments)
- differences.forEach((action) => {
- var cmd = action[0]
- var pkg = action[1]
- switch (cmd) {
- case 'add':
- addSteps(decomposed, pkg)
- break
- case 'update':
- updateSteps(decomposed, pkg)
- break
- case 'move':
- moveSteps(decomposed, pkg)
- break
- case 'remove':
- removeSteps(decomposed, pkg)
- break
- default:
- defaultSteps(decomposed, cmd, pkg)
- }
- })
- next()
-}
-
-function addAction (decomposed, action, pkg) {
- if (decomposed.some((_) => _[0] === action && _[1] === pkg)) return
- decomposed.push([action, pkg])
-}
-
-function addSteps (decomposed, pkg) {
- if (pkg.fromBundle) {
- // make sure our source module exists to extract ourselves from
- // if we're installing our source module anyway, the duplication
- // of these steps will be elided by `addAction` automatically
- addAction(decomposed, 'fetch', pkg.fromBundle)
- addAction(decomposed, 'extract', pkg.fromBundle)
- }
- if (!pkg.fromBundle && !pkg.isLink) {
- addAction(decomposed, 'fetch', pkg)
- addAction(decomposed, 'extract', pkg)
- }
- if (!pkg.fromBundle || npm.config.get('rebuild-bundle')) {
- addAction(decomposed, 'preinstall', pkg)
- addAction(decomposed, 'build', pkg)
- addAction(decomposed, 'install', pkg)
- addAction(decomposed, 'postinstall', pkg)
- }
- if (!pkg.fromBundle || !pkg.isLink) {
- addAction(decomposed, 'finalize', pkg)
- }
- addAction(decomposed, 'refresh-package-json', pkg)
-}
-
-function updateSteps (decomposed, pkg) {
- removeSteps(decomposed, pkg.oldPkg)
- addSteps(decomposed, pkg)
-}
-
-function removeSteps (decomposed, pkg) {
- addAction(decomposed, 'unbuild', pkg)
- addAction(decomposed, 'remove', pkg)
-}
-
-function moveSteps (decomposed, pkg) {
- addAction(decomposed, 'move', pkg)
- addAction(decomposed, 'build', pkg)
- addAction(decomposed, 'install', pkg)
- addAction(decomposed, 'postinstall', pkg)
- addAction(decomposed, 'refresh-package-json', pkg)
-}
-
-function defaultSteps (decomposed, cmd, pkg) {
- addAction(decomposed, cmd, pkg)
-}
diff --git a/deps/node/deps/npm/lib/install/deps.js b/deps/node/deps/npm/lib/install/deps.js
deleted file mode 100644
index c3626509..00000000
--- a/deps/node/deps/npm/lib/install/deps.js
+++ /dev/null
@@ -1,816 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-var fs = require('fs')
-var assert = require('assert')
-var path = require('path')
-var semver = require('semver')
-var asyncMap = require('slide').asyncMap
-var chain = require('slide').chain
-var iferr = require('iferr')
-var npa = require('npm-package-arg')
-var validate = require('aproba')
-var dezalgo = require('dezalgo')
-var fetchPackageMetadata = require('../fetch-package-metadata.js')
-var andAddParentToErrors = require('./and-add-parent-to-errors.js')
-var addBundled = require('../fetch-package-metadata.js').addBundled
-var readShrinkwrap = require('./read-shrinkwrap.js')
-var inflateShrinkwrap = require('./inflate-shrinkwrap.js')
-var inflateBundled = require('./inflate-bundled.js')
-var andFinishTracker = require('./and-finish-tracker.js')
-var npm = require('../npm.js')
-var flatNameFromTree = require('./flatten-tree.js').flatNameFromTree
-var createChild = require('./node.js').create
-var resetMetadata = require('./node.js').reset
-var isInstallable = require('./validate-args.js').isInstallable
-var packageId = require('../utils/package-id.js')
-var moduleName = require('../utils/module-name.js')
-var isDevDep = require('./is-dev-dep.js')
-var isProdDep = require('./is-prod-dep.js')
-var reportOptionalFailure = require('./report-optional-failure.js')
-var getSaveType = require('./save.js').getSaveType
-var unixFormatPath = require('../utils/unix-format-path.js')
-var isExtraneous = require('./is-extraneous.js')
-var isRegistry = require('../utils/is-registry.js')
-var hasModernMeta = require('./has-modern-meta.js')
-
-// The export functions in this module mutate a dependency tree, adding
-// items to them.
-
-var registryTypes = { range: true, version: true }
-
-function doesChildVersionMatch (child, requested, requestor) {
- if (child.fromShrinkwrap && !child.hasRequiresFromLock) return true
- // ranges of * ALWAYS count as a match, because when downloading we allow
- // prereleases to match * if there are ONLY prereleases
- if (requested.type === 'range' && requested.fetchSpec === '*') return true
-
- if (requested.type === 'directory') {
- if (!child.isLink) return false
- return path.relative(child.realpath, requested.fetchSpec) === ''
- }
-
- if (requested.type === 'git' && child.fromShrinkwrap) {
- const fromSw = child.package._from ? npa(child.package._from) : child.fromShrinkwrap
- fromSw.name = requested.name // we're only checking specifiers here
- if (fromSw.toString() === requested.toString()) return true
- }
-
- if (!registryTypes[requested.type]) {
- var childReq = child.package._requested
- if (childReq) {
- if (childReq.rawSpec === requested.rawSpec) return true
- if (childReq.type === requested.type && childReq.saveSpec === requested.saveSpec) return true
- }
- // If _requested didn't exist OR if it didn't match then we'll try using
- // _from. We pass it through npa to normalize the specifier.
- // This can happen when installing from an `npm-shrinkwrap.json` where `_requested` will
- // be the tarball URL from `resolved` and thus can't match what's in the `package.json`.
- // In those cases _from, will be preserved and we can compare that to ensure that they
- // really came from the same sources.
- // You'll see this scenario happen with at least tags and git dependencies.
- // Some buggy clients will write spaces into the module name part of a _from.
- if (child.package._from) {
- var fromReq = npa.resolve(moduleName(child), child.package._from.replace(new RegExp('^\\s*' + moduleName(child) + '\\s*@'), ''))
- if (fromReq.rawSpec === requested.rawSpec) return true
- if (fromReq.type === requested.type && fromReq.saveSpec && fromReq.saveSpec === requested.saveSpec) return true
- }
- return false
- }
- try {
- return semver.satisfies(child.package.version, requested.fetchSpec, true)
- } catch (e) {
- return false
- }
-}
-
-function childDependencySpecifier (tree, name, spec, where) {
- return npa.resolve(name, spec, where || packageRelativePath(tree))
-}
-
-exports.computeMetadata = computeMetadata
-function computeMetadata (tree, seen) {
- if (!seen) seen = new Set()
- if (!tree || seen.has(tree)) return
- seen.add(tree)
- if (tree.parent == null) {
- resetMetadata(tree)
- tree.isTop = true
- }
- tree.location = flatNameFromTree(tree)
-
- function findChild (name, spec, kind) {
- try {
- var req = childDependencySpecifier(tree, name, spec)
- } catch (err) {
- return
- }
- var child = findRequirement(tree, req.name, req)
- if (child) {
- resolveWithExistingModule(child, tree)
- return true
- }
- }
-
- const deps = tree.package.dependencies || {}
- const reqs = tree.swRequires || {}
- for (let name of Object.keys(deps)) {
- if (findChild(name, deps[name])) continue
- if (name in reqs && findChild(name, reqs[name])) continue
- tree.missingDeps[name] = deps[name]
- }
- if (tree.isTop) {
- const devDeps = tree.package.devDependencies || {}
- for (let name of Object.keys(devDeps)) {
- if (findChild(name, devDeps[name])) continue
- tree.missingDevDeps[name] = devDeps[name]
- }
- }
-
- tree.children.filter((child) => !child.removed).forEach((child) => computeMetadata(child, seen))
-
- return tree
-}
-
-function isDep (tree, child) {
- var name = moduleName(child)
- var prodVer = isProdDep(tree, name)
- var devVer = isDevDep(tree, name)
-
- try {
- var prodSpec = childDependencySpecifier(tree, name, prodVer)
- } catch (err) {
- return {isDep: true, isProdDep: false, isDevDep: false}
- }
- var matches
- if (prodSpec) matches = doesChildVersionMatch(child, prodSpec, tree)
- if (matches) return {isDep: true, isProdDep: prodSpec, isDevDep: false}
- if (devVer === prodVer) return {isDep: child.fromShrinkwrap, isProdDep: false, isDevDep: false}
- try {
- var devSpec = childDependencySpecifier(tree, name, devVer)
- return {isDep: doesChildVersionMatch(child, devSpec, tree) || child.fromShrinkwrap, isProdDep: false, isDevDep: devSpec}
- } catch (err) {
- return {isDep: child.fromShrinkwrap, isProdDep: false, isDevDep: false}
- }
-}
-
-function addRequiredDep (tree, child) {
- var dep = isDep(tree, child)
- if (!dep.isDep) return false
- replaceModuleByPath(child, 'requiredBy', tree)
- replaceModuleByName(tree, 'requires', child)
- if (dep.isProdDep && tree.missingDeps) delete tree.missingDeps[moduleName(child)]
- if (dep.isDevDep && tree.missingDevDeps) delete tree.missingDevDeps[moduleName(child)]
- return true
-}
-
-exports.removeObsoleteDep = removeObsoleteDep
-function removeObsoleteDep (child, log) {
- if (child.removed) return
- child.removed = true
- if (log) {
- log.silly('removeObsoleteDep', 'removing ' + packageId(child) +
- ' from the tree as its been replaced by a newer version or is no longer required')
- }
- // remove from physical tree
- if (child.parent) {
- child.parent.children = child.parent.children.filter(function (pchild) { return pchild !== child })
- }
- // remove from logical tree
- var requires = child.requires || []
- requires.forEach(function (requirement) {
- requirement.requiredBy = requirement.requiredBy.filter(function (reqBy) { return reqBy !== child })
- // we don't just check requirement.requires because that doesn't account
- // for circular deps. isExtraneous does.
- if (isExtraneous(requirement)) removeObsoleteDep(requirement, log)
- })
-}
-
-function packageRelativePath (tree) {
- if (!tree) return ''
- var requested = tree.package._requested || {}
- var isLocal = requested.type === 'directory' || requested.type === 'file'
- return isLocal ? requested.fetchSpec
- : (tree.isLink || tree.isInLink) && !preserveSymlinks() ? tree.realpath
- : tree.path
-}
-
-function matchingDep (tree, name) {
- if (!tree || !tree.package) return
- if (tree.package.dependencies && tree.package.dependencies[name]) return tree.package.dependencies[name]
- if (tree.package.devDependencies && tree.package.devDependencies[name]) return tree.package.devDependencies[name]
-}
-
-exports.getAllMetadata = function (args, tree, where, next) {
- asyncMap(args, function (arg, done) {
- let spec
- try {
- spec = npa(arg)
- } catch (e) {
- return done(e)
- }
- if (spec.type !== 'file' && spec.type !== 'directory' && (spec.name == null || spec.rawSpec === '')) {
- return fs.stat(path.join(arg, 'package.json'), (err) => {
- if (err) {
- var version = matchingDep(tree, spec.name)
- if (version) {
- try {
- return fetchPackageMetadata(npa.resolve(spec.name, version), where, done)
- } catch (e) {
- return done(e)
- }
- } else {
- return fetchPackageMetadata(spec, where, done)
- }
- } else {
- try {
- return fetchPackageMetadata(npa('file:' + arg), where, done)
- } catch (e) {
- return done(e)
- }
- }
- })
- } else {
- return fetchPackageMetadata(spec, where, done)
- }
- }, next)
-}
-
-// Add a list of args to tree's top level dependencies
-exports.loadRequestedDeps = function (args, tree, saveToDependencies, log, next) {
- validate('AOOF', [args, tree, log, next])
- asyncMap(args, function (pkg, done) {
- var depLoaded = andAddParentToErrors(tree, done)
- resolveWithNewModule(pkg, tree, log.newGroup('loadRequestedDeps'), iferr(depLoaded, function (child, tracker) {
- validate('OO', arguments)
- if (npm.config.get('global')) {
- child.isGlobal = true
- }
- var childName = moduleName(child)
- child.saveSpec = computeVersionSpec(tree, child)
- child.userRequired = true
- child.save = getSaveType(tree, child)
- const types = ['dependencies', 'devDependencies', 'optionalDependencies']
- if (child.save) {
- tree.package[child.save][childName] = child.saveSpec
- // Astute readers might notice that this exact same code exists in
- // save.js under a different guise. That code is responsible for deps
- // being removed from the final written `package.json`. The removal in
- // this function is specifically to prevent "installed as both X and Y"
- // warnings when moving an existing dep between different dep fields.
- //
- // Or, try it by removing this loop, and do `npm i -P x && npm i -D x`
- for (let saveType of types) {
- if (child.save !== saveType) {
- delete tree.package[saveType][childName]
- }
- }
- if (child.save === 'optionalDependencies') tree.package.dependencies[childName] = child.saveSpec
- }
-
- // For things the user asked to install, that aren't a dependency (or
- // won't be when we're done), flag it as "depending" on the user
- // themselves, so we don't remove it as a dep that no longer exists
- var childIsDep = addRequiredDep(tree, child)
- if (!childIsDep) child.userRequired = true
- depLoaded(null, child, tracker)
- }))
- }, andForEachChild(loadDeps, andFinishTracker(log, next)))
-}
-
-function isNotEmpty (value) {
- return value != null && value !== ''
-}
-
-exports.computeVersionSpec = computeVersionSpec
-function computeVersionSpec (tree, child) {
- validate('OO', arguments)
- var requested
- var childReq = child.package._requested
- if (child.isLink) {
- requested = npa.resolve(child.package.name, 'file:' + child.realpath, getTop(tree).path)
- } else if (childReq && (isNotEmpty(childReq.saveSpec) || (isNotEmpty(childReq.rawSpec) && isNotEmpty(childReq.fetchSpec)))) {
- requested = child.package._requested
- } else if (child.package._from) {
- requested = npa(child.package._from, tree.path)
- } else {
- requested = npa.resolve(child.package.name, child.package.version)
- }
- if (isRegistry(requested)) {
- var version = child.package.version
- var rangeDescriptor = ''
- if (semver.valid(version, true) &&
- semver.gte(version, '0.1.0', true) &&
- !npm.config.get('save-exact')) {
- rangeDescriptor = npm.config.get('save-prefix')
- }
- return rangeDescriptor + version
- } else if (requested.type === 'directory' || requested.type === 'file') {
- return 'file:' + unixFormatPath(path.relative(getTop(tree).path, requested.fetchSpec))
- } else {
- return requested.saveSpec || requested.rawSpec
- }
-}
-
-function moduleNameMatches (name) {
- return function (child) { return moduleName(child) === name }
-}
-
-// while this implementation does not require async calling, doing so
-// gives this a consistent interface with loadDeps et al
-exports.removeDeps = function (args, tree, saveToDependencies, next) {
- validate('AOSF|AOZF', [args, tree, saveToDependencies, next])
- for (let pkg of args) {
- var pkgName = moduleName(pkg)
- var toRemove = tree.children.filter(moduleNameMatches(pkgName))
- var pkgToRemove = toRemove[0] || createChild({package: {name: pkgName}})
- var saveType = getSaveType(tree, pkg) || 'dependencies'
- if (tree.isTop && saveToDependencies) {
- pkgToRemove.save = saveType
- }
- if (tree.package[saveType][pkgName]) {
- delete tree.package[saveType][pkgName]
- if (saveType === 'optionalDependencies' && tree.package.dependencies[pkgName]) {
- delete tree.package.dependencies[pkgName]
- }
- }
- replaceModuleByPath(tree, 'removedChildren', pkgToRemove)
- for (let parent of pkgToRemove.requiredBy) {
- parent.requires = parent.requires.filter((child) => child !== pkgToRemove)
- }
- pkgToRemove.requiredBy = pkgToRemove.requiredBy.filter((parent) => parent !== tree)
- flagAsRemoving(pkgToRemove)
- }
- next()
-}
-
-function flagAsRemoving (toRemove, seen) {
- if (!seen) seen = new Set()
- if (seen.has(toRemove)) return
- seen.add(toRemove)
- toRemove.removing = true
- toRemove.requires.forEach((required) => {
- flagAsRemoving(required, seen)
- })
-}
-
-exports.removeExtraneous = function (args, tree, next) {
- for (let pkg of args) {
- var pkgName = moduleName(pkg)
- var toRemove = tree.children.filter(moduleNameMatches(pkgName))
- if (toRemove.length) {
- removeObsoleteDep(toRemove[0])
- }
- }
- next()
-}
-
-function andForEachChild (load, next) {
- validate('F', [next])
- next = dezalgo(next)
- return function (er, children, logs) {
- // when children is empty, logs won't be passed in at all (asyncMap is weird)
- // so shortcircuit before arg validation
- if (!er && (!children || children.length === 0)) return next()
- validate('EAA', arguments)
- if (er) return next(er)
- assert(children.length === logs.length)
- var cmds = []
- for (var ii = 0; ii < children.length; ++ii) {
- cmds.push([load, children[ii], logs[ii]])
- }
- var sortedCmds = cmds.sort(function installOrder (aa, bb) {
- return moduleName(aa[1]).localeCompare(moduleName(bb[1]))
- })
- chain(sortedCmds, next)
- }
-}
-
-function isDepOptional (tree, name, pkg) {
- if (pkg.package && pkg.package._optional) return true
- const optDeps = tree.package.optionalDependencies
- if (optDeps && optDeps[name] != null) return true
-
- const devDeps = tree.package.devDependencies
- if (devDeps && devDeps[name] != null) {
- const includeDev = npm.config.get('dev') ||
- (!/^prod(uction)?$/.test(npm.config.get('only')) && !npm.config.get('production')) ||
- /^dev(elopment)?$/.test(npm.config.get('only')) ||
- /^dev(elopment)?$/.test(npm.config.get('also'))
- return !includeDev
- }
- const prodDeps = tree.package.dependencies
- if (prodDeps && prodDeps[name] != null) {
- const includeProd = !/^dev(elopment)?$/.test(npm.config.get('only'))
- return !includeProd
- }
- return false
-}
-
-exports.failedDependency = failedDependency
-function failedDependency (tree, name, pkg) {
- if (name) {
- if (isDepOptional(tree, name, pkg || {})) {
- return false
- }
- }
-
- tree.failed = true
-
- if (tree.isTop) return true
-
- if (tree.userRequired) return true
-
- if (!tree.requiredBy) return false
-
- let anyFailed = false
- for (var ii = 0; ii < tree.requiredBy.length; ++ii) {
- var requireParent = tree.requiredBy[ii]
- if (failedDependency(requireParent, moduleName(tree), tree)) {
- anyFailed = true
- }
- }
- return anyFailed
-}
-
-function andHandleOptionalErrors (log, tree, name, done) {
- validate('OOSF', arguments)
- return function (er, child, childLog) {
- if (!er) validate('OO', [child, childLog])
- if (!er) return done(er, child, childLog)
- var isFatal = failedDependency(tree, name)
- if (er && !isFatal) {
- reportOptionalFailure(tree, name, er)
- return done()
- } else {
- return done(er, child, childLog)
- }
- }
-}
-
-exports.prefetchDeps = prefetchDeps
-function prefetchDeps (tree, deps, log, next) {
- validate('OOOF', arguments)
- var skipOptional = !npm.config.get('optional')
- var seen = new Set()
- const finished = andFinishTracker(log, next)
- const fpm = BB.promisify(fetchPackageMetadata)
- resolveBranchDeps(tree.package, deps).then(
- () => finished(), finished
- )
-
- function resolveBranchDeps (pkg, deps) {
- return BB.resolve(null).then(() => {
- var allDependencies = Object.keys(deps).map((dep) => {
- return npa.resolve(dep, deps[dep])
- }).filter((dep) => {
- return isRegistry(dep) &&
- !seen.has(dep.toString()) &&
- !findRequirement(tree, dep.name, dep)
- })
- if (skipOptional) {
- var optDeps = pkg.optionalDependencies || {}
- allDependencies = allDependencies.filter((dep) => !optDeps[dep.name])
- }
- return BB.map(allDependencies, (dep) => {
- seen.add(dep.toString())
- return fpm(dep, '', {tracker: log.newItem('fetchMetadata')}).then(
- (pkg) => {
- return pkg && pkg.dependencies && resolveBranchDeps(pkg, pkg.dependencies)
- },
- () => null
- )
- })
- })
- }
-}
-
-// Load any missing dependencies in the given tree
-exports.loadDeps = loadDeps
-function loadDeps (tree, log, next) {
- validate('OOF', arguments)
- if (tree.loaded || (tree.parent && tree.parent.failed) || tree.removed) return andFinishTracker.now(log, next)
- if (tree.parent) tree.loaded = true
- if (!tree.package.dependencies) tree.package.dependencies = {}
- asyncMap(Object.keys(tree.package.dependencies), function (dep, done) {
- var version = tree.package.dependencies[dep]
- addDependency(dep, version, tree, log.newGroup('loadDep:' + dep), andHandleOptionalErrors(log, tree, dep, done))
- }, andForEachChild(loadDeps, andFinishTracker(log, next)))
-}
-
-// Load development dependencies into the given tree
-exports.loadDevDeps = function (tree, log, next) {
- validate('OOF', arguments)
- if (!tree.package.devDependencies) return andFinishTracker.now(log, next)
- asyncMap(Object.keys(tree.package.devDependencies), function (dep, done) {
- // things defined as both dev dependencies and regular dependencies are treated
- // as the former
- if (tree.package.dependencies[dep]) return done()
-
- var logGroup = log.newGroup('loadDevDep:' + dep)
- addDependency(dep, tree.package.devDependencies[dep], tree, logGroup, andHandleOptionalErrors(log, tree, dep, done))
- }, andForEachChild(loadDeps, andFinishTracker(log, next)))
-}
-
-var loadExtraneous = exports.loadExtraneous = function (tree, log, next) {
- var seen = new Set()
-
- function loadExtraneous (tree) {
- if (seen.has(tree)) return
- seen.add(tree)
- for (var child of tree.children) {
- if (child.loaded) continue
- resolveWithExistingModule(child, tree)
- loadExtraneous(child)
- }
- }
- loadExtraneous(tree)
- log.finish()
- next()
-}
-
-exports.loadExtraneous.andResolveDeps = function (tree, log, next) {
- validate('OOF', arguments)
- // For canonicalized trees (eg from shrinkwrap) we don't want to bother
- // resolving the dependencies of extraneous deps.
- if (tree.loaded) return loadExtraneous(tree, log, next)
- asyncMap(tree.children.filter(function (child) { return !child.loaded }), function (child, done) {
- resolveWithExistingModule(child, tree)
- done(null, child, log)
- }, andForEachChild(loadDeps, andFinishTracker(log, next)))
-}
-
-function addDependency (name, versionSpec, tree, log, done) {
- validate('SSOOF', arguments)
- var next = andAddParentToErrors(tree, done)
- try {
- var req = childDependencySpecifier(tree, name, versionSpec)
- if (tree.swRequires && tree.swRequires[name]) {
- var swReq = childDependencySpecifier(tree, name, tree.swRequires[name], tree.package._where)
- }
- } catch (err) {
- return done(err)
- }
- var child = findRequirement(tree, name, req)
- if (!child && swReq) child = findRequirement(tree, name, swReq)
- if (hasModernMeta(child)) {
- resolveWithExistingModule(child, tree)
- if (child.package._shrinkwrap === undefined) {
- readShrinkwrap.andInflate(child, function (er) { next(er, child, log) })
- } else {
- next(null, child, log)
- }
- } else {
- if (child) {
- if (req.registry) {
- req = childDependencySpecifier(tree, name, child.package.version)
- }
- if (child.fromBundle) reportBundleOverride(child, log)
- removeObsoleteDep(child, log)
- }
- fetchPackageMetadata(req, packageRelativePath(tree), {tracker: log.newItem('fetchMetadata')}, iferr(next, function (pkg) {
- resolveWithNewModule(pkg, tree, log, next)
- }))
- }
-}
-
-function getTop (pkg) {
- const seen = new Set()
- while (pkg.parent && !seen.has(pkg.parent)) {
- pkg = pkg.parent
- seen.add(pkg)
- }
- return pkg
-}
-
-function reportBundleOverride (child, log) {
- const code = 'EBUNDLEOVERRIDE'
- const top = getTop(child.fromBundle)
- const bundlerId = packageId(child.fromBundle)
- if (!top.warnings.some((w) => {
- return w.code === code
- })) {
- const err = new Error(`${bundlerId} had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions.`)
- err.code = code
- top.warnings.push(err)
- }
- if (log) log.verbose('bundle', `${code}: Replacing ${bundlerId}'s bundled version of ${moduleName(child)} with ${packageId(child)}.`)
-}
-
-function resolveWithExistingModule (child, tree) {
- validate('OO', arguments)
- addRequiredDep(tree, child)
- if (tree.parent && child.parent !== tree) updatePhantomChildren(tree.parent, child)
-}
-
-var updatePhantomChildren = exports.updatePhantomChildren = function (current, child) {
- validate('OO', arguments)
- while (current && current !== child.parent) {
- if (!current.phantomChildren) current.phantomChildren = {}
- current.phantomChildren[moduleName(child)] = child
- current = current.parent
- }
-}
-
-exports._replaceModuleByPath = replaceModuleByPath
-function replaceModuleByPath (obj, key, child) {
- return replaceModule(obj, key, child, function (replacing, child) {
- return replacing.path === child.path
- })
-}
-
-exports._replaceModuleByName = replaceModuleByName
-function replaceModuleByName (obj, key, child) {
- var childName = moduleName(child)
- return replaceModule(obj, key, child, function (replacing, child) {
- return moduleName(replacing) === childName
- })
-}
-
-function replaceModule (obj, key, child, matchBy) {
- validate('OSOF', arguments)
- if (!obj[key]) obj[key] = []
- // we replace children with a new array object instead of mutating it
- // because mutating it results in weird failure states.
- // I would very much like to know _why_ this is. =/
- var children = [].concat(obj[key])
- for (var replaceAt = 0; replaceAt < children.length; ++replaceAt) {
- if (matchBy(children[replaceAt], child)) break
- }
- var replacing = children.splice(replaceAt, 1, child)
- obj[key] = children
- return replacing[0]
-}
-
-function resolveWithNewModule (pkg, tree, log, next) {
- validate('OOOF', arguments)
-
- log.silly('resolveWithNewModule', packageId(pkg), 'checking installable status')
- return isInstallable(pkg, (err) => {
- let installable = !err
- addBundled(pkg, (bundleErr) => {
- var parent = earliestInstallable(tree, tree, pkg, log) || tree
- var isLink = pkg._requested.type === 'directory'
- var child = createChild({
- package: pkg,
- parent: parent,
- path: path.join(parent.isLink ? parent.realpath : parent.path, 'node_modules', pkg.name),
- realpath: isLink ? pkg._requested.fetchSpec : path.join(parent.realpath, 'node_modules', pkg.name),
- children: pkg._bundled || [],
- isLink: isLink,
- isInLink: parent.isLink,
- knownInstallable: installable
- })
- if (!installable || bundleErr) child.failed = true
- delete pkg._bundled
- var hasBundled = child.children.length
-
- var replaced = replaceModuleByName(parent, 'children', child)
- if (replaced) {
- if (replaced.fromBundle) reportBundleOverride(replaced, log)
- removeObsoleteDep(replaced)
- }
- addRequiredDep(tree, child)
- child.location = flatNameFromTree(child)
-
- if (tree.parent && parent !== tree) updatePhantomChildren(tree.parent, child)
-
- if (hasBundled) {
- inflateBundled(child, child, child.children)
- }
-
- if (pkg._shrinkwrap && pkg._shrinkwrap.dependencies) {
- return inflateShrinkwrap(child, pkg._shrinkwrap, (swErr) => {
- if (swErr) child.failed = true
- next(err || bundleErr || swErr, child, log)
- })
- }
- next(err || bundleErr, child, log)
- })
- })
-}
-
-var validatePeerDeps = exports.validatePeerDeps = function (tree, onInvalid) {
- if (!tree.package.peerDependencies) return
- Object.keys(tree.package.peerDependencies).forEach(function (pkgname) {
- var version = tree.package.peerDependencies[pkgname]
- try {
- var spec = npa.resolve(pkgname, version)
- } catch (e) {}
- var match = spec && findRequirement(tree.parent || tree, pkgname, spec)
- if (!match) onInvalid(tree, pkgname, version)
- })
-}
-
-exports.validateAllPeerDeps = function (tree, onInvalid) {
- validateAllPeerDeps(tree, onInvalid, new Set())
-}
-
-function validateAllPeerDeps (tree, onInvalid, seen) {
- validate('OFO', arguments)
- if (seen.has(tree)) return
- seen.add(tree)
- validatePeerDeps(tree, onInvalid)
- tree.children.forEach(function (child) { validateAllPeerDeps(child, onInvalid, seen) })
-}
-
-// Determine if a module requirement is already met by the tree at or above
-// our current location in the tree.
-var findRequirement = exports.findRequirement = function (tree, name, requested, requestor) {
- validate('OSO', [tree, name, requested])
- if (!requestor) requestor = tree
- var nameMatch = function (child) {
- return moduleName(child) === name && child.parent && !child.removed
- }
- var versionMatch = function (child) {
- return doesChildVersionMatch(child, requested, requestor)
- }
- if (nameMatch(tree)) {
- // this *is* the module, but it doesn't match the version, so a
- // new copy will have to be installed
- return versionMatch(tree) ? tree : null
- }
-
- var matches = tree.children.filter(nameMatch)
- if (matches.length) {
- matches = matches.filter(versionMatch)
- // the module exists as a dependent, but the version doesn't match, so
- // a new copy will have to be installed above here
- if (matches.length) return matches[0]
- return null
- }
- if (tree.isTop) return null
- if (!preserveSymlinks() && /^[.][.][\\/]/.test(path.relative(tree.parent.realpath, tree.realpath))) return null
- return findRequirement(tree.parent, name, requested, requestor)
-}
-
-function preserveSymlinks () {
- if (!('NODE_PRESERVE_SYMLINKS' in process.env)) return false
- const value = process.env.NODE_PRESERVE_SYMLINKS
- if (value == null || value === '' || value === 'false' || value === 'no' || value === '0') return false
- return true
-}
-
-// Find the highest level in the tree that we can install this module in.
-// If the module isn't installed above us yet, that'd be the very top.
-// If it is, then it's the level below where its installed.
-var earliestInstallable = exports.earliestInstallable = function (requiredBy, tree, pkg, log) {
- validate('OOOO', arguments)
-
- function undeletedModuleMatches (child) {
- return !child.removed && moduleName(child) === pkg.name
- }
- const undeletedMatches = tree.children.filter(undeletedModuleMatches)
- if (undeletedMatches.length) {
- // if there's a conflict with another child AT THE SAME level then we're replacing it, so
- // mark it as removed and continue with resolution normally.
- if (tree === requiredBy) {
- undeletedMatches.forEach((pkg) => {
- if (pkg.fromBundle) reportBundleOverride(pkg, log)
- removeObsoleteDep(pkg, log)
- })
- } else {
- return null
- }
- }
-
- // If any of the children of this tree have conflicting
- // binaries then we need to decline to install this package here.
- var binaryMatches = pkg.bin && tree.children.some(function (child) {
- if (child.removed || !child.package.bin) return false
- return Object.keys(child.package.bin).some(function (bin) {
- return pkg.bin[bin]
- })
- })
-
- if (binaryMatches) return null
-
- // if this tree location requested the same module then we KNOW it
- // isn't compatible because if it were findRequirement would have
- // found that version.
- var deps = tree.package.dependencies || {}
- if (!tree.removed && requiredBy !== tree && deps[pkg.name]) {
- return null
- }
-
- var devDeps = tree.package.devDependencies || {}
- if (tree.isTop && devDeps[pkg.name]) {
- var requested = childDependencySpecifier(tree, pkg.name, devDeps[pkg.name])
- if (!doesChildVersionMatch({package: pkg}, requested, tree)) {
- return null
- }
- }
-
- if (tree.phantomChildren && tree.phantomChildren[pkg.name]) return null
-
- if (tree.isTop) return tree
- if (tree.isGlobal) return tree
-
- if (npm.config.get('global-style') && tree.parent.isTop) return tree
- if (npm.config.get('legacy-bundling')) return tree
-
- if (!preserveSymlinks() && /^[.][.][\\/]/.test(path.relative(tree.parent.realpath, tree.realpath))) return tree
-
- return (earliestInstallable(requiredBy, tree.parent, pkg, log) || tree)
-}
diff --git a/deps/node/deps/npm/lib/install/diff-trees.js b/deps/node/deps/npm/lib/install/diff-trees.js
deleted file mode 100644
index 346846fd..00000000
--- a/deps/node/deps/npm/lib/install/diff-trees.js
+++ /dev/null
@@ -1,260 +0,0 @@
-'use strict'
-var npm = require('../npm.js')
-var validate = require('aproba')
-var npa = require('npm-package-arg')
-var flattenTree = require('./flatten-tree.js')
-var isOnlyDev = require('./is-only-dev.js')
-var log = require('npmlog')
-var path = require('path')
-var ssri = require('ssri')
-var moduleName = require('../utils/module-name.js')
-var isOnlyOptional = require('./is-only-optional.js')
-
-// we don't use get-requested because we're operating on files on disk, and
-// we don't want to extropolate from what _should_ be there.
-function pkgRequested (pkg) {
- return pkg._requested || (pkg._resolved && npa(pkg._resolved)) || (pkg._from && npa(pkg._from))
-}
-
-function nonRegistrySource (requested) {
- if (fromGit(requested)) return true
- if (fromLocal(requested)) return true
- if (fromRemote(requested)) return true
- return false
-}
-
-function fromRemote (requested) {
- if (requested.type === 'remote') return true
-}
-
-function fromLocal (requested) {
- // local is an npm@3 type that meant "file"
- if (requested.type === 'file' || requested.type === 'directory' || requested.type === 'local') return true
- return false
-}
-
-function fromGit (requested) {
- if (requested.type === 'hosted' || requested.type === 'git') return true
- return false
-}
-
-function pkgIntegrity (pkg) {
- try {
- // dist is provided by the registry
- var sri = (pkg.dist && pkg.dist.integrity) ||
- // _integrity is provided by pacote
- pkg._integrity ||
- // _shasum is legacy
- (pkg._shasum && ssri.fromHex(pkg._shasum, 'sha1').toString())
- if (!sri) return
- var integrity = ssri.parse(sri)
- if (Object.keys(integrity).length === 0) return
- return integrity
- } catch (ex) {
-
- }
-}
-
-function sriMatch (aa, bb) {
- if (!aa || !bb) return false
- for (let algo of Object.keys(aa)) {
- if (!bb[algo]) continue
- for (let aaHash of aa[algo]) {
- for (let bbHash of bb[algo]) {
- return aaHash.digest === bbHash.digest
- }
- }
- }
- return false
-}
-
-function pkgAreEquiv (aa, bb) {
- // coming in we know they share a path…
-
- // if one is inside a link and the other is not, then they are not equivalent
- // this happens when we're replacing a linked dep with a non-linked version
- if (aa.isInLink !== bb.isInLink) return false
- // if they share package metadata _identity_, they're the same thing
- if (aa.package === bb.package) return true
- // if they share integrity information, they're the same thing
- var aaIntegrity = pkgIntegrity(aa.package)
- var bbIntegrity = pkgIntegrity(bb.package)
- if (aaIntegrity || bbIntegrity) return sriMatch(aaIntegrity, bbIntegrity)
-
- // if they're links and they share the same target, they're the same thing
- if (aa.isLink && bb.isLink) return aa.realpath === bb.realpath
-
- // if we can't determine both their sources then we have no way to know
- // if they're the same thing, so we have to assume they aren't
- var aaReq = pkgRequested(aa.package)
- var bbReq = pkgRequested(bb.package)
- if (!aaReq || !bbReq) return false
-
- if (fromGit(aaReq) && fromGit(bbReq)) {
- // if both are git and share a _resolved specifier (one with the
- // comittish replaced by a commit hash) then they're the same
- return aa.package._resolved && bb.package._resolved &&
- aa.package._resolved === bb.package._resolved
- }
-
- // we have to give up trying to find matches for non-registry sources at this point…
- if (nonRegistrySource(aaReq) || nonRegistrySource(bbReq)) return false
-
- // finally, if they ARE a registry source then version matching counts
- return aa.package.version === bb.package.version
-}
-
-function pushAll (aa, bb) {
- Array.prototype.push.apply(aa, bb)
-}
-
-module.exports = function (oldTree, newTree, differences, log, next) {
- validate('OOAOF', arguments)
- pushAll(differences, sortActions(diffTrees(oldTree, newTree)))
- log.finish()
- next()
-}
-
-function isNotTopOrExtraneous (node) {
- return !node.isTop && !node.userRequired && !node.existing
-}
-
-var sortActions = module.exports.sortActions = function (differences) {
- var actions = {}
- differences.forEach(function (action) {
- var child = action[1]
- actions[child.location] = action
- })
-
- var sorted = []
- var added = {}
-
- var sortedlocs = Object.keys(actions).sort(sortByLocation)
-
- // We're going to sort the actions taken on top level dependencies first, before
- // considering the order of transitive deps. Because we're building our list
- // from the bottom up, this means we will return a list with top level deps LAST.
- // This is important in terms of keeping installations as consistent as possible
- // as folks add new dependencies.
- var toplocs = sortedlocs.filter(function (location) {
- var mod = actions[location][1]
- if (!mod.requiredBy) return true
- // If this module is required by any non-top level module
- // or by any extraneous module, eg user requested or existing
- // then we don't want to give this priority sorting.
- return !mod.requiredBy.some(isNotTopOrExtraneous)
- })
-
- toplocs.concat(sortedlocs).forEach(function (location) {
- sortByDeps(actions[location])
- })
-
- function sortByLocation (aa, bb) {
- return bb.localeCompare(aa)
- }
- function sortModuleByLocation (aa, bb) {
- return sortByLocation(aa && aa.location, bb && bb.location)
- }
- function sortByDeps (action) {
- var mod = action[1]
- if (added[mod.location]) return
- added[mod.location] = action
- if (!mod.requiredBy) mod.requiredBy = []
- mod.requiredBy.sort(sortModuleByLocation).forEach(function (mod) {
- if (actions[mod.location]) sortByDeps(actions[mod.location])
- })
- sorted.unshift(action)
- }
-
- // safety net, anything excluded above gets tacked on the end
- differences.forEach((_) => {
- if (sorted.indexOf(_) === -1) sorted.push(_)
- })
-
- return sorted
-}
-
-function setAction (differences, action, pkg) {
- differences.push([action, pkg])
-}
-
-var diffTrees = module.exports._diffTrees = function (oldTree, newTree) {
- validate('OO', arguments)
- var differences = []
- var flatOldTree = flattenTree(oldTree)
- var flatNewTree = flattenTree(newTree)
- var toRemove = {}
- var toRemoveByName = {}
-
- // Build our tentative remove list. We don't add remove actions yet
- // because we might resuse them as part of a move.
- Object.keys(flatOldTree).forEach(function (flatname) {
- if (flatname === '/') return
- if (flatNewTree[flatname]) return
- var pkg = flatOldTree[flatname]
- if (pkg.isInLink && /^[.][.][/\\]/.test(path.relative(newTree.realpath, pkg.realpath))) return
-
- toRemove[flatname] = pkg
- var name = moduleName(pkg)
- if (!toRemoveByName[name]) toRemoveByName[name] = []
- toRemoveByName[name].push({flatname: flatname, pkg: pkg})
- })
-
- // generate our add/update/move actions
- Object.keys(flatNewTree).forEach(function (flatname) {
- if (flatname === '/') return
- var pkg = flatNewTree[flatname]
- var oldPkg = pkg.oldPkg = flatOldTree[flatname]
- if (oldPkg) {
- // if the versions are equivalent then we don't need to update… unless
- // the user explicitly asked us to.
- if (!pkg.userRequired && pkgAreEquiv(oldPkg, pkg)) return
- setAction(differences, 'update', pkg)
- } else {
- var name = moduleName(pkg)
- // find any packages we're removing that share the same name and are equivalent
- var removing = (toRemoveByName[name] || []).filter((rm) => pkgAreEquiv(rm.pkg, pkg))
- var bundlesOrFromBundle = pkg.fromBundle || pkg.package.bundleDependencies
- // if we have any removes that match AND we're not working with a bundle then upgrade to a move
- if (removing.length && !bundlesOrFromBundle) {
- var toMv = removing.shift()
- toRemoveByName[name] = toRemoveByName[name].filter((rm) => rm !== toMv)
- pkg.fromPath = toMv.pkg.path
- setAction(differences, 'move', pkg)
- delete toRemove[toMv.flatname]
- // we don't generate add actions for things found in links (which already exist on disk)
- } else if (!pkg.isInLink || !(pkg.fromBundle && pkg.fromBundle.isLink)) {
- setAction(differences, 'add', pkg)
- }
- }
- })
-
- // finally generate our remove actions from any not consumed by moves
- Object
- .keys(toRemove)
- .map((flatname) => toRemove[flatname])
- .forEach((pkg) => setAction(differences, 'remove', pkg))
-
- return filterActions(differences)
-}
-
-function filterActions (differences) {
- const includeOpt = npm.config.get('optional')
- const includeDev = npm.config.get('dev') ||
- (!/^prod(uction)?$/.test(npm.config.get('only')) && !npm.config.get('production')) ||
- /^dev(elopment)?$/.test(npm.config.get('only')) ||
- /^dev(elopment)?$/.test(npm.config.get('also'))
- const includeProd = !/^dev(elopment)?$/.test(npm.config.get('only'))
- if (includeProd && includeDev && includeOpt) return differences
-
- log.silly('diff-trees', 'filtering actions:', 'includeDev', includeDev, 'includeProd', includeProd, 'includeOpt', includeOpt)
- return differences.filter((diff) => {
- const pkg = diff[1]
- const pkgIsOnlyDev = isOnlyDev(pkg)
- const pkgIsOnlyOpt = isOnlyOptional(pkg)
- if (!includeProd && pkgIsOnlyDev) return true
- if (includeDev && pkgIsOnlyDev) return true
- if (includeProd && !pkgIsOnlyDev && (includeOpt || !pkgIsOnlyOpt)) return true
- return false
- })
-}
diff --git a/deps/node/deps/npm/lib/install/exists.js b/deps/node/deps/npm/lib/install/exists.js
deleted file mode 100644
index 59100d63..00000000
--- a/deps/node/deps/npm/lib/install/exists.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict'
-var fs = require('fs')
-var inflight = require('inflight')
-var accessError = require('./access-error.js')
-var isFsAccessAvailable = require('./is-fs-access-available.js')
-
-if (isFsAccessAvailable) {
- module.exports = fsAccessImplementation
-} else {
- module.exports = fsStatImplementation
-}
-
-// exposed only for testing purposes
-module.exports.fsAccessImplementation = fsAccessImplementation
-module.exports.fsStatImplementation = fsStatImplementation
-
-function fsAccessImplementation (dir, done) {
- done = inflight('exists:' + dir, done)
- if (!done) return
- fs.access(dir, fs.F_OK, done)
-}
-
-function fsStatImplementation (dir, done) {
- done = inflight('exists:' + dir, done)
- if (!done) return
- fs.stat(dir, function (er) { done(accessError(dir, er)) })
-}
diff --git a/deps/node/deps/npm/lib/install/flatten-tree.js b/deps/node/deps/npm/lib/install/flatten-tree.js
deleted file mode 100644
index 56282b77..00000000
--- a/deps/node/deps/npm/lib/install/flatten-tree.js
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict'
-var validate = require('aproba')
-var moduleName = require('../utils/module-name.js')
-
-module.exports = flattenTree
-module.exports.flatName = flatName
-module.exports.flatNameFromTree = flatNameFromTree
-
-function flattenTree (tree) {
- validate('O', arguments)
- var seen = new Set()
- var flat = {}
- var todo = [[tree, '/']]
- while (todo.length) {
- var next = todo.shift()
- var pkg = next[0]
- seen.add(pkg)
- var path = next[1]
- flat[path] = pkg
- if (path !== '/') path += '/'
- for (var ii = 0; ii < pkg.children.length; ++ii) {
- var child = pkg.children[ii]
- if (!seen.has(child)) {
- todo.push([child, flatName(path, child)])
- }
- }
- }
- return flat
-}
-
-function flatName (path, child) {
- validate('SO', arguments)
- return path + (moduleName(child) || 'TOP')
-}
-
-function flatNameFromTree (tree) {
- validate('O', arguments)
- if (tree.isTop) return '/'
- var path = flatNameFromTree(tree.parent)
- if (path !== '/') path += '/'
- return flatName(path, tree)
-}
diff --git a/deps/node/deps/npm/lib/install/get-requested.js b/deps/node/deps/npm/lib/install/get-requested.js
deleted file mode 100644
index ab410ffc..00000000
--- a/deps/node/deps/npm/lib/install/get-requested.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-const npa = require('npm-package-arg')
-const moduleName = require('../utils/module-name.js')
-
-module.exports = function (child, reqBy) {
- if (!child.requiredBy.length) return
- if (!reqBy) reqBy = child.requiredBy[0]
- const deps = reqBy.package.dependencies || {}
- const devDeps = reqBy.package.devDependencies || {}
- const name = moduleName(child)
- return npa.resolve(name, deps[name] || devDeps[name], reqBy.realpath)
-}
diff --git a/deps/node/deps/npm/lib/install/has-modern-meta.js b/deps/node/deps/npm/lib/install/has-modern-meta.js
deleted file mode 100644
index bf801d0d..00000000
--- a/deps/node/deps/npm/lib/install/has-modern-meta.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict'
-module.exports = hasModernMeta
-
-const npa = require('npm-package-arg')
-const moduleName = require('../utils/module-name.js')
-
-function isLink (child) {
- return child.isLink || (child.parent && isLink(child.parent))
-}
-
-function hasModernMeta (child) {
- if (!child) return false
- const resolved = child.package._resolved && npa.resolve(moduleName(child), child.package._resolved)
- const version = npa.resolve(moduleName(child), child.package.version)
- return child.isTop ||
- isLink(child) ||
- child.fromBundle || child.package._inBundle ||
- child.package._integrity || child.package._shasum ||
- (resolved && resolved.type === 'git') || (version && version.type === 'git')
-}
diff --git a/deps/node/deps/npm/lib/install/inflate-bundled.js b/deps/node/deps/npm/lib/install/inflate-bundled.js
deleted file mode 100644
index 66bbb44a..00000000
--- a/deps/node/deps/npm/lib/install/inflate-bundled.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict'
-
-var childPath = require('../utils/child-path.js')
-var reset = require('./node.js').reset
-
-module.exports = function inflateBundled (bundler, parent, children) {
- children.forEach(function (child) {
- if (child.fromBundle === bundler) return
- reset(child)
- child.fromBundle = bundler
- child.isInLink = bundler.isLink
- child.parent = parent
- child.path = childPath(parent.path, child)
- child.realpath = bundler.isLink ? child.realpath : childPath(parent.realpath, child)
- child.isLink = child.isLink || parent.isLink || parent.target
- inflateBundled(bundler, child, child.children)
- })
-}
diff --git a/deps/node/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/node/deps/npm/lib/install/inflate-shrinkwrap.js
deleted file mode 100644
index bf1ab706..00000000
--- a/deps/node/deps/npm/lib/install/inflate-shrinkwrap.js
+++ /dev/null
@@ -1,233 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-let addBundled
-const childPath = require('../utils/child-path.js')
-const createChild = require('./node.js').create
-let fetchPackageMetadata
-const inflateBundled = require('./inflate-bundled.js')
-const moduleName = require('../utils/module-name.js')
-const normalizePackageData = require('normalize-package-data')
-const npm = require('../npm.js')
-const realizeShrinkwrapSpecifier = require('./realize-shrinkwrap-specifier.js')
-const validate = require('aproba')
-const path = require('path')
-const isRegistry = require('../utils/is-registry.js')
-const hasModernMeta = require('./has-modern-meta.js')
-const ssri = require('ssri')
-const npa = require('npm-package-arg')
-
-module.exports = function (tree, sw, opts, finishInflating) {
- if (!fetchPackageMetadata) {
- fetchPackageMetadata = BB.promisify(require('../fetch-package-metadata.js'))
- addBundled = BB.promisify(fetchPackageMetadata.addBundled)
- }
- if (arguments.length === 3) {
- finishInflating = opts
- opts = {}
- }
- if (!npm.config.get('shrinkwrap') || !npm.config.get('package-lock')) {
- return finishInflating()
- }
- tree.loaded = false
- tree.hasRequiresFromLock = sw.requires
- return inflateShrinkwrap(tree.path, tree, sw.dependencies, opts).then(
- () => finishInflating(),
- finishInflating
- )
-}
-
-function inflateShrinkwrap (topPath, tree, swdeps, opts) {
- if (!swdeps) return Promise.resolve()
- if (!opts) opts = {}
- const onDisk = {}
- tree.children.forEach((child) => {
- onDisk[moduleName(child)] = child
- })
-
- tree.children = []
-
- return BB.each(Object.keys(swdeps), (name) => {
- const sw = swdeps[name]
- const dependencies = sw.dependencies || {}
- const requested = realizeShrinkwrapSpecifier(name, sw, topPath)
- return inflatableChild(
- onDisk[name], name, topPath, tree, sw, requested, opts
- ).then((child) => {
- child.hasRequiresFromLock = tree.hasRequiresFromLock
- return inflateShrinkwrap(topPath, child, dependencies)
- })
- })
-}
-
-function normalizePackageDataNoErrors (pkg) {
- try {
- normalizePackageData(pkg)
- } catch (ex) {
- // don't care
- }
-}
-
-function quotemeta (str) {
- return str.replace(/([^A-Za-z_0-9/])/g, '\\$1')
-}
-
-function tarballToVersion (name, tb) {
- const registry = quotemeta(npm.config.get('registry'))
- .replace(/https?:/, 'https?:')
- .replace(/([^/])$/, '$1/')
- let matchRegTarball
- if (name) {
- const nameMatch = quotemeta(name)
- matchRegTarball = new RegExp(`^${registry}${nameMatch}/-/${nameMatch}-(.*)[.]tgz$`)
- } else {
- matchRegTarball = new RegExp(`^${registry}(.*)?/-/\\1-(.*)[.]tgz$`)
- }
- const match = tb.match(matchRegTarball)
- if (!match) return
- return match[2] || match[1]
-}
-
-function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts) {
- validate('OSSOOOO|ZSSOOOO', arguments)
- const usesIntegrity = (
- requested.registry ||
- requested.type === 'remote' ||
- requested.type === 'file'
- )
- const regTarball = tarballToVersion(name, sw.version)
- if (regTarball) {
- sw.resolved = sw.version
- sw.version = regTarball
- }
- if (sw.requires) Object.keys(sw.requires).map(_ => { sw.requires[_] = tarballToVersion(_, sw.requires[_]) || sw.requires[_] })
- const modernLink = requested.type === 'directory' && !sw.from
- if (hasModernMeta(onDiskChild) && childIsEquivalent(sw, requested, onDiskChild)) {
- // The version on disk matches the shrinkwrap entry.
- if (!onDiskChild.fromShrinkwrap) onDiskChild.fromShrinkwrap = requested
- onDiskChild.package._requested = requested
- onDiskChild.package._spec = requested.rawSpec
- onDiskChild.package._where = topPath
- onDiskChild.package._optional = sw.optional
- onDiskChild.package._development = sw.dev
- onDiskChild.package._inBundle = sw.bundled
- onDiskChild.fromBundle = (sw.bundled || onDiskChild.package._inBundle) ? tree.fromBundle || tree : null
- if (!onDiskChild.package._args) onDiskChild.package._args = []
- onDiskChild.package._args.push([String(requested), topPath])
- // non-npm registries can and will return unnormalized data, plus
- // even the npm registry may have package data normalized with older
- // normalization rules. This ensures we get package data in a consistent,
- // stable format.
- normalizePackageDataNoErrors(onDiskChild.package)
- onDiskChild.swRequires = sw.requires
- tree.children.push(onDiskChild)
- return BB.resolve(onDiskChild)
- } else if ((sw.version && (sw.integrity || !usesIntegrity) && (requested.type !== 'directory' || modernLink)) || sw.bundled) {
- // The shrinkwrap entry has an integrity field. We can fake a pkg to get
- // the installer to do a content-address fetch from the cache, if possible.
- return BB.resolve(makeFakeChild(name, topPath, tree, sw, requested))
- } else {
- // It's not on disk, and we can't just look it up by address -- do a full
- // fpm/inflate bundle pass. For registry deps, this will go straight to the
- // tarball URL, as if it were a remote tarball dep.
- return fetchChild(topPath, tree, sw, requested)
- }
-}
-
-function isGit (sw) {
- const version = npa.resolve(sw.name, sw.version)
- return (version && version.type === 'git')
-}
-
-function makeFakeChild (name, topPath, tree, sw, requested) {
- const from = sw.from || requested.raw
- const pkg = {
- name: name,
- version: sw.version,
- _id: name + '@' + sw.version,
- _resolved: sw.resolved || (isGit(sw) && sw.version),
- _requested: requested,
- _optional: sw.optional,
- _development: sw.dev,
- _inBundle: sw.bundled,
- _integrity: sw.integrity,
- _from: from,
- _spec: requested.rawSpec,
- _where: topPath,
- _args: [[requested.toString(), topPath]],
- dependencies: sw.requires
- }
-
- if (!sw.bundled) {
- const bundleDependencies = Object.keys(sw.dependencies || {}).filter((d) => sw.dependencies[d].bundled)
- if (bundleDependencies.length === 0) {
- pkg.bundleDependencies = bundleDependencies
- }
- }
- const child = createChild({
- package: pkg,
- loaded: false,
- parent: tree,
- children: [],
- fromShrinkwrap: requested,
- fakeChild: sw,
- fromBundle: sw.bundled ? tree.fromBundle || tree : null,
- path: childPath(tree.path, pkg),
- realpath: requested.type === 'directory' ? requested.fetchSpec : childPath(tree.realpath, pkg),
- location: (tree.location === '/' ? '' : tree.location + '/') + pkg.name,
- isLink: requested.type === 'directory',
- isInLink: tree.isLink,
- swRequires: sw.requires
- })
- tree.children.push(child)
- return child
-}
-
-function fetchChild (topPath, tree, sw, requested) {
- return fetchPackageMetadata(requested, topPath).then((pkg) => {
- pkg._from = sw.from || requested.raw
- pkg._optional = sw.optional
- pkg._development = sw.dev
- pkg._inBundle = false
- return addBundled(pkg).then(() => pkg)
- }).then((pkg) => {
- var isLink = pkg._requested.type === 'directory'
- const child = createChild({
- package: pkg,
- loaded: false,
- parent: tree,
- fromShrinkwrap: requested,
- path: childPath(tree.path, pkg),
- realpath: isLink ? requested.fetchSpec : childPath(tree.realpath, pkg),
- children: pkg._bundled || [],
- location: (tree.location === '/' ? '' : tree.location + '/') + pkg.name,
- fromBundle: null,
- isLink: isLink,
- isInLink: tree.isLink,
- swRequires: sw.requires
- })
- tree.children.push(child)
- if (pkg._bundled) {
- delete pkg._bundled
- inflateBundled(child, child, child.children)
- }
- return child
- })
-}
-
-function childIsEquivalent (sw, requested, child) {
- if (!child) return false
- if (child.fromShrinkwrap) return true
- if (
- sw.integrity &&
- child.package._integrity &&
- ssri.parse(sw.integrity).match(child.package._integrity)
- ) return true
- if (child.isLink && requested.type === 'directory') return path.relative(child.realpath, requested.fetchSpec) === ''
-
- if (sw.resolved) return child.package._resolved === sw.resolved
- if (!isRegistry(requested) && sw.from) return child.package._from === sw.from
- if (!isRegistry(requested) && child.package._resolved) return sw.version === child.package._resolved
- return child.package.version === sw.version
-}
diff --git a/deps/node/deps/npm/lib/install/is-dev-dep.js b/deps/node/deps/npm/lib/install/is-dev-dep.js
deleted file mode 100644
index c7a7982c..00000000
--- a/deps/node/deps/npm/lib/install/is-dev-dep.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-module.exports = isDevDep
-
-function isDevDep (node, name) {
- return node.package &&
- node.package.devDependencies &&
- node.package.devDependencies[name]
-}
diff --git a/deps/node/deps/npm/lib/install/is-extraneous.js b/deps/node/deps/npm/lib/install/is-extraneous.js
deleted file mode 100644
index a6477c23..00000000
--- a/deps/node/deps/npm/lib/install/is-extraneous.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict'
-module.exports = isExtraneous
-
-function isExtraneous (tree) {
- var result = !isNotExtraneous(tree)
- return result
-}
-
-function topHasNoPjson (tree) {
- var top = tree
- while (!top.isTop) top = top.parent
- return top.error
-}
-
-function isNotExtraneous (tree, isCycle) {
- if (!isCycle) isCycle = {}
- if (tree.isTop || tree.userRequired) {
- return true
- } else if (isCycle[tree.path]) {
- return topHasNoPjson(tree)
- } else {
- isCycle[tree.path] = true
- return tree.requiredBy && tree.requiredBy.some(function (node) {
- return isNotExtraneous(node, Object.create(isCycle))
- })
- }
-}
diff --git a/deps/node/deps/npm/lib/install/is-fs-access-available.js b/deps/node/deps/npm/lib/install/is-fs-access-available.js
deleted file mode 100644
index a7d2640d..00000000
--- a/deps/node/deps/npm/lib/install/is-fs-access-available.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict'
-var fs = require('fs')
-var semver = require('semver')
-var isWindows = process.platform === 'win32'
-
-// fs.access first introduced in node 0.12 / io.js
-if (!fs.access) {
- module.exports = false
-} else if (!isWindows) {
- // fs.access always works on non-Windows OSes
- module.exports = true
-} else {
- // The Windows implementation of `fs.access` has a bug where it will
- // sometimes return access errors all the time for directories, even
- // when access is available. As all we actually test ARE directories, this
- // is a bit of a problem.
- // This was fixed in io.js version 1.5.0
- // As of 2015-07-20, it is still unfixed in node:
- // https://github.com/joyent/node/issues/25657
-
- module.exports = semver.gte(process.version, '1.5.0')
-}
diff --git a/deps/node/deps/npm/lib/install/is-only-dev.js b/deps/node/deps/npm/lib/install/is-only-dev.js
deleted file mode 100644
index 2877c61a..00000000
--- a/deps/node/deps/npm/lib/install/is-only-dev.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict'
-module.exports = isOnlyDev
-
-const moduleName = require('../utils/module-name.js')
-const isDevDep = require('./is-dev-dep.js')
-const isProdDep = require('./is-prod-dep.js')
-
-// Returns true if the module `node` is only required direcctly as a dev
-// dependency of the top level or transitively _from_ top level dev
-// dependencies.
-// Dual mode modules (that are both dev AND prod) should return false.
-function isOnlyDev (node, seen) {
- if (!seen) seen = new Set()
- return node.requiredBy.length && node.requiredBy.every(andIsOnlyDev(moduleName(node), seen))
-}
-
-// There is a known limitation with this implementation: If a dependency is
-// ONLY required by cycles that are detached from the top level then it will
-// ultimately return true.
-//
-// This is ok though: We don't allow shrinkwraps with extraneous deps and
-// these situation is caught by the extraneous checker before we get here.
-function andIsOnlyDev (name, seen) {
- return function (req) {
- const isDev = isDevDep(req, name)
- const isProd = isProdDep(req, name)
- if (req.isTop) {
- return isDev && !isProd
- } else {
- if (seen.has(req)) return true
- seen = new Set(seen)
- seen.add(req)
- return isOnlyDev(req, seen)
- }
- }
-}
diff --git a/deps/node/deps/npm/lib/install/is-only-optional.js b/deps/node/deps/npm/lib/install/is-only-optional.js
deleted file mode 100644
index f1b73157..00000000
--- a/deps/node/deps/npm/lib/install/is-only-optional.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict'
-module.exports = isOptional
-
-const isOptDep = require('./is-opt-dep.js')
-
-function isOptional (node, seen) {
- if (!seen) seen = new Set()
- // If a node is not required by anything, then we've reached
- // the top level package.
- if (seen.has(node) || node.requiredBy.length === 0) {
- return false
- }
- seen = new Set(seen)
- seen.add(node)
- const swOptional = node.fromShrinkwrap && node.package._optional
- return node.requiredBy.every(function (req) {
- if (req.fakeChild && swOptional) return true
- return isOptDep(req, node.package.name) || isOptional(req, seen)
- })
-}
diff --git a/deps/node/deps/npm/lib/install/is-opt-dep.js b/deps/node/deps/npm/lib/install/is-opt-dep.js
deleted file mode 100644
index 807b8ab9..00000000
--- a/deps/node/deps/npm/lib/install/is-opt-dep.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-module.exports = isOptDep
-
-function isOptDep (node, name) {
- return node.package &&
- node.package.optionalDependencies &&
- node.package.optionalDependencies[name]
-}
diff --git a/deps/node/deps/npm/lib/install/is-prod-dep.js b/deps/node/deps/npm/lib/install/is-prod-dep.js
deleted file mode 100644
index 1e2a0b4e..00000000
--- a/deps/node/deps/npm/lib/install/is-prod-dep.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict'
-
-module.exports = isProdDep
-
-function isProdDep (node, name) {
- return node.package &&
- node.package.dependencies &&
- node.package.dependencies[name]
-}
diff --git a/deps/node/deps/npm/lib/install/module-staging-path.js b/deps/node/deps/npm/lib/install/module-staging-path.js
deleted file mode 100644
index 00ee96b3..00000000
--- a/deps/node/deps/npm/lib/install/module-staging-path.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-var uniqueFilename = require('unique-filename')
-var moduleName = require('../utils/module-name.js')
-
-module.exports = moduleStagingPath
-function moduleStagingPath (staging, pkg) {
- return uniqueFilename(staging, moduleName(pkg), pkg.realpath)
-}
diff --git a/deps/node/deps/npm/lib/install/mutate-into-logical-tree.js b/deps/node/deps/npm/lib/install/mutate-into-logical-tree.js
deleted file mode 100644
index 88514945..00000000
--- a/deps/node/deps/npm/lib/install/mutate-into-logical-tree.js
+++ /dev/null
@@ -1,140 +0,0 @@
-'use strict'
-var union = require('lodash.union')
-var without = require('lodash.without')
-var validate = require('aproba')
-var flattenTree = require('./flatten-tree.js')
-var isExtraneous = require('./is-extraneous.js')
-var validateAllPeerDeps = require('./deps.js').validateAllPeerDeps
-var packageId = require('../utils/package-id.js')
-var moduleName = require('../utils/module-name.js')
-var npm = require('../npm.js')
-
-// Return true if tree is a part of a cycle that:
-// A) Never connects to the top of the tree
-// B) Has not not had a point in the cycle arbitrarily declared its top
-// yet.
-function isDisconnectedCycle (tree, seen) {
- if (!seen) seen = {}
- if (tree.isTop || tree.cycleTop || tree.requiredBy.length === 0) {
- return false
- } else if (seen[tree.path]) {
- return true
- } else {
- seen[tree.path] = true
- return tree.requiredBy.every(function (node) {
- return isDisconnectedCycle(node, Object.create(seen))
- })
- }
-}
-
-var mutateIntoLogicalTree = module.exports = function (tree) {
- validate('O', arguments)
-
- validateAllPeerDeps(tree, function (tree, pkgname, version) {
- if (!tree.missingPeers) tree.missingPeers = {}
- tree.missingPeers[pkgname] = version
- })
-
- var flat = flattenTree(tree)
-
- Object.keys(flat).sort().forEach(function (flatname) {
- var node = flat[flatname]
- if (!(node.requiredBy && node.requiredBy.length)) return
-
- if (node.parent) {
- // If a node is a cycle that never reaches the root of the logical
- // tree then we'll leave it attached to the root, or else it
- // would go missing. Further we'll note that this is the node in the
- // cycle that we picked arbitrarily to be the one attached to the root.
- // others will fall
- if (isDisconnectedCycle(node)) {
- node.cycleTop = true
- // Nor do we want to disconnect non-cyclical extraneous modules from the tree.
- } else if (node.requiredBy.length) {
- // regular deps though, we do, as we're moving them into the capable
- // hands of the modules that require them.
- node.parent.children = without(node.parent.children, node)
- }
- }
-
- node.requiredBy.forEach(function (parentNode) {
- parentNode.children = union(parentNode.children, [node])
- })
- })
- return tree
-}
-
-module.exports.asReadInstalled = function (tree) {
- mutateIntoLogicalTree(tree)
- return translateTree(tree)
-}
-
-function translateTree (tree) {
- return translateTree_(tree, new Set())
-}
-
-function translateTree_ (tree, seen) {
- var pkg = tree.package
- if (seen.has(tree)) return pkg
- seen.add(tree)
- if (pkg._dependencies) return pkg
- pkg._dependencies = pkg.dependencies
- pkg.dependencies = {}
- tree.children.forEach(function (child) {
- const dep = pkg.dependencies[moduleName(child)] = translateTree_(child, seen)
- if (child.fakeChild) {
- dep.missing = true
- dep.optional = child.package._optional
- dep.requiredBy = child.package._spec
- }
- })
-
- function markMissing (name, requiredBy) {
- if (pkg.dependencies[name]) {
- if (pkg.dependencies[name].missing) return
- pkg.dependencies[name].invalid = true
- pkg.dependencies[name].realName = name
- pkg.dependencies[name].extraneous = false
- } else {
- pkg.dependencies[name] = {
- requiredBy: requiredBy,
- missing: true,
- optional: !!pkg.optionalDependencies[name]
- }
- }
- }
-
- Object.keys(tree.missingDeps).forEach(function (name) {
- markMissing(name, tree.missingDeps[name])
- })
- Object.keys(tree.missingDevDeps).forEach(function (name) {
- markMissing(name, tree.missingDevDeps[name])
- })
- var checkForMissingPeers = (tree.parent ? [] : [tree]).concat(tree.children)
- checkForMissingPeers.filter(function (child) {
- return child.missingPeers
- }).forEach(function (child) {
- Object.keys(child.missingPeers).forEach(function (pkgname) {
- var version = child.missingPeers[pkgname]
- var peerPkg = pkg.dependencies[pkgname]
- if (!peerPkg) {
- peerPkg = pkg.dependencies[pkgname] = {
- _id: pkgname + '@' + version,
- name: pkgname,
- version: version
- }
- }
- if (!peerPkg.peerMissing) peerPkg.peerMissing = []
- peerPkg.peerMissing.push({
- requiredBy: packageId(child),
- requires: pkgname + '@' + version
- })
- })
- })
- pkg.path = tree.path
-
- pkg.error = tree.error
- pkg.extraneous = !tree.isTop && (!tree.parent.isTop || !tree.parent.error) && !npm.config.get('global') && isExtraneous(tree)
- if (tree.target && tree.parent && !tree.parent.target) pkg.link = tree.realpath
- return pkg
-}
diff --git a/deps/node/deps/npm/lib/install/node.js b/deps/node/deps/npm/lib/install/node.js
deleted file mode 100644
index 18138078..00000000
--- a/deps/node/deps/npm/lib/install/node.js
+++ /dev/null
@@ -1,77 +0,0 @@
-'use strict'
-
-var defaultTemplate = {
- package: {
- version: '',
- dependencies: {},
- devDependencies: {},
- optionalDependencies: {}
- },
- loaded: false,
- children: [],
- requiredBy: [],
- requires: [],
- missingDeps: {},
- missingDevDeps: {},
- phantomChildren: {},
- path: null,
- realpath: null,
- location: null,
- userRequired: false,
- save: false,
- saveSpec: null,
- isTop: false,
- fromBundle: false
-}
-
-function isLink (node) {
- return node && node.isLink
-}
-function isInLink (node) {
- return node && (node.isInLink || node.isLink)
-}
-
-var create = exports.create = function (node, template, isNotTop) {
- if (!template) template = defaultTemplate
- Object.keys(template).forEach(function (key) {
- if (template[key] != null && typeof template[key] === 'object' && !(template[key] instanceof Array)) {
- if (!node[key]) node[key] = {}
- return create(node[key], template[key], true)
- }
- if (node[key] != null) return
- node[key] = template[key]
- })
- if (!isNotTop) {
- // isLink is true for the symlink and everything inside it.
- // by contrast, isInLink is true for only the things inside a link
- if (node.isLink == null) node.isLink = isLink(node.parent)
- if (node.isInLink == null) node.isInLink = isInLink(node.parent)
- if (node.fromBundle == null) {
- node.fromBundle = false
- }
- }
- return node
-}
-
-exports.reset = function (node) {
- reset(node, new Set())
-}
-
-function reset (node, seen) {
- if (seen.has(node)) return
- seen.add(node)
- var child = create(node)
-
- // FIXME: cleaning up after read-package-json's mess =(
- if (child.package._id === '@') delete child.package._id
-
- child.isTop = false
- child.requiredBy = []
- child.requires = []
- child.missingDeps = {}
- child.missingDevDeps = {}
- child.phantomChildren = {}
- child.location = null
-
- child.children.forEach(function (child) { reset(child, seen) })
-}
diff --git a/deps/node/deps/npm/lib/install/read-shrinkwrap.js b/deps/node/deps/npm/lib/install/read-shrinkwrap.js
deleted file mode 100644
index 70746780..00000000
--- a/deps/node/deps/npm/lib/install/read-shrinkwrap.js
+++ /dev/null
@@ -1,108 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const fs = require('graceful-fs')
-const iferr = require('iferr')
-const inflateShrinkwrap = require('./inflate-shrinkwrap.js')
-const log = require('npmlog')
-const parseJSON = require('../utils/parse-json.js')
-const path = require('path')
-const PKGLOCK_VERSION = require('../npm.js').lockfileVersion
-
-const readFileAsync = BB.promisify(fs.readFile)
-
-module.exports = readShrinkwrap
-function readShrinkwrap (child, next) {
- if (child.package._shrinkwrap) return process.nextTick(next)
- BB.join(
- maybeReadFile('npm-shrinkwrap.json', child),
- // Don't read non-root lockfiles
- child.isTop && maybeReadFile('package-lock.json', child),
- child.isTop && maybeReadFile('package.json', child),
- (shrinkwrap, lockfile, pkgJson) => {
- if (shrinkwrap && lockfile) {
- log.warn('read-shrinkwrap', 'Ignoring package-lock.json because there is already an npm-shrinkwrap.json. Please use only one of the two.')
- }
- const name = shrinkwrap ? 'npm-shrinkwrap.json' : 'package-lock.json'
- const parsed = parsePkgLock(shrinkwrap || lockfile, name)
- if (parsed && parsed.lockfileVersion !== PKGLOCK_VERSION) {
- log.warn('read-shrinkwrap', `This version of npm is compatible with lockfileVersion@${PKGLOCK_VERSION}, but ${name} was generated for lockfileVersion@${parsed.lockfileVersion || 0}. I'll try to do my best with it!`)
- }
- child.package._shrinkwrap = parsed
- }
- ).then(() => next(), next)
-}
-
-function maybeReadFile (name, child) {
- return readFileAsync(
- path.join(child.path, name),
- 'utf8'
- ).catch({code: 'ENOENT'}, () => null)
-}
-
-module.exports.andInflate = function (child, next) {
- readShrinkwrap(child, iferr(next, function () {
- if (child.package._shrinkwrap) {
- return inflateShrinkwrap(child, child.package._shrinkwrap || {}, next)
- } else {
- return next()
- }
- }))
-}
-
-const PARENT_RE = /\|{7,}/g
-const OURS_RE = /<{7,}/g
-const THEIRS_RE = /={7,}/g
-const END_RE = />{7,}/g
-
-module.exports._isDiff = isDiff
-function isDiff (str) {
- return str.match(OURS_RE) && str.match(THEIRS_RE) && str.match(END_RE)
-}
-
-module.exports._parsePkgLock = parsePkgLock
-function parsePkgLock (str, filename) {
- if (!str) { return null }
- try {
- return parseJSON(str)
- } catch (e) {
- if (isDiff(str)) {
- log.warn('conflict', `A git conflict was detected in ${filename}. Attempting to auto-resolve.`)
- log.warn('conflict', 'To make this happen automatically on git rebase/merge, consider using the npm-merge-driver:')
- log.warn('conflict', '$ npx npm-merge-driver install -g')
- const pieces = str.split(/[\n\r]+/g).reduce((acc, line) => {
- if (line.match(PARENT_RE)) acc.state = 'parent'
- else if (line.match(OURS_RE)) acc.state = 'ours'
- else if (line.match(THEIRS_RE)) acc.state = 'theirs'
- else if (line.match(END_RE)) acc.state = 'top'
- else {
- if (acc.state === 'top' || acc.state === 'ours') acc.ours += line
- if (acc.state === 'top' || acc.state === 'theirs') acc.theirs += line
- if (acc.state === 'top' || acc.state === 'parent') acc.parent += line
- }
- return acc
- }, {
- state: 'top',
- ours: '',
- theirs: '',
- parent: ''
- })
- try {
- const ours = parseJSON(pieces.ours)
- const theirs = parseJSON(pieces.theirs)
- return reconcileLockfiles(ours, theirs)
- } catch (_e) {
- log.error('conflict', `Automatic conflict resolution failed. Please manually resolve conflicts in ${filename} and try again.`)
- log.silly('conflict', `Error during resolution: ${_e}`)
- throw e
- }
- } else {
- throw e
- }
- }
-}
-
-function reconcileLockfiles (parent, ours, theirs) {
- return Object.assign({}, ours, theirs)
-}
diff --git a/deps/node/deps/npm/lib/install/realize-shrinkwrap-specifier.js b/deps/node/deps/npm/lib/install/realize-shrinkwrap-specifier.js
deleted file mode 100644
index e4b14b1f..00000000
--- a/deps/node/deps/npm/lib/install/realize-shrinkwrap-specifier.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict'
-var npa = require('npm-package-arg')
-const isRegistry = require('../utils/is-registry.js')
-
-module.exports = function (name, sw, where) {
- try {
- if (sw.version && sw.integrity) {
- return npa.resolve(name, sw.version, where)
- } else if (sw.from) {
- const spec = npa(sw.from, where)
- if (isRegistry(spec) && sw.version) {
- return npa.resolve(name, sw.version, where)
- } else if (!sw.resolved) {
- return spec
- }
- }
- if (sw.resolved) {
- return npa.resolve(name, sw.resolved, where)
- }
- } catch (_) { }
- return npa.resolve(name, sw.version, where)
-}
diff --git a/deps/node/deps/npm/lib/install/report-optional-failure.js b/deps/node/deps/npm/lib/install/report-optional-failure.js
deleted file mode 100644
index 41c7c535..00000000
--- a/deps/node/deps/npm/lib/install/report-optional-failure.js
+++ /dev/null
@@ -1,31 +0,0 @@
-'use strict'
-var path = require('path')
-var moduleName = require('../utils/module-name.js')
-
-module.exports = reportOptionalFailure
-
-function top (tree) {
- if (tree.parent) return top(tree.parent)
- return tree
-}
-
-function reportOptionalFailure (tree, what, error) {
- var topTree = top(tree)
- if (!topTree.warnings) topTree.warnings = []
- var id
- if (what) {
- var depVer = tree.package.dependencies && tree.package.dependencies[what]
- var optDepVer = tree.package.optionalDependencies && tree.package.optionalDependencies[what]
- var devDepVer = tree.package.devDependencies && tree.package.devDependencies[what]
- var version = depVer || optDepVer || devDepVer
- id = what + (version ? '@' + version : '')
- } else {
- id = tree._id || moduleName(tree) + (tree.package.version ? '@' + tree.package.version : '')
- }
- var location = path.relative(topTree.path, tree.path)
- if (what) location = path.join(location, 'node_modules', what)
-
- error.optional = id
- error.location = location
- topTree.warnings.push(error)
-}
diff --git a/deps/node/deps/npm/lib/install/save.js b/deps/node/deps/npm/lib/install/save.js
deleted file mode 100644
index 7227e788..00000000
--- a/deps/node/deps/npm/lib/install/save.js
+++ /dev/null
@@ -1,189 +0,0 @@
-'use strict'
-
-const deepSortObject = require('../utils/deep-sort-object.js')
-const detectIndent = require('detect-indent')
-const detectNewline = require('detect-newline')
-const fs = require('graceful-fs')
-const iferr = require('iferr')
-const log = require('npmlog')
-const moduleName = require('../utils/module-name.js')
-const npm = require('../npm.js')
-const parseJSON = require('../utils/parse-json.js')
-const path = require('path')
-const stringifyPackage = require('stringify-package')
-const validate = require('aproba')
-const without = require('lodash.without')
-const writeFileAtomic = require('write-file-atomic')
-
-// if the -S|--save option is specified, then write installed packages
-// as dependencies to a package.json file.
-
-exports.saveRequested = function (tree, andReturn) {
- validate('OF', arguments)
- savePackageJson(tree, andWarnErrors(andSaveShrinkwrap(tree, andReturn)))
-}
-
-function andSaveShrinkwrap (tree, andReturn) {
- validate('OF', arguments)
- return function (er) {
- validate('E', arguments)
- saveShrinkwrap(tree, andWarnErrors(andReturn))
- }
-}
-
-function andWarnErrors (cb) {
- validate('F', arguments)
- return function (er) {
- if (er) log.warn('saveError', er.message)
- arguments[0] = null
- cb.apply(null, arguments)
- }
-}
-
-exports.saveShrinkwrap = saveShrinkwrap
-
-function saveShrinkwrap (tree, next) {
- validate('OF', arguments)
- if (!npm.config.get('shrinkwrap') || !npm.config.get('package-lock')) {
- return next()
- }
- require('../shrinkwrap.js').createShrinkwrap(tree, {silent: false}, next)
-}
-
-function savePackageJson (tree, next) {
- validate('OF', arguments)
- var saveBundle = npm.config.get('save-bundle')
-
- // each item in the tree is a top-level thing that should be saved
- // to the package.json file.
- // The relevant tree shape is { <folder>: {what:<pkg>} }
- var saveTarget = path.resolve(tree.path, 'package.json')
- // don't use readJson, because we don't want to do all the other
- // tricky npm-specific stuff that's in there.
- fs.readFile(saveTarget, 'utf8', iferr(next, function (packagejson) {
- const indent = detectIndent(packagejson).indent
- const newline = detectNewline(packagejson)
- try {
- tree.package = parseJSON(packagejson)
- } catch (ex) {
- return next(ex)
- }
-
- // If we're saving bundled deps, normalize the key before we start
- if (saveBundle) {
- var bundle = tree.package.bundleDependencies || tree.package.bundledDependencies
- delete tree.package.bundledDependencies
- if (!Array.isArray(bundle)) bundle = []
- }
-
- var toSave = getThingsToSave(tree)
- var toRemove = getThingsToRemove(tree)
- var savingTo = {}
- toSave.forEach(function (pkg) { if (pkg.save) savingTo[pkg.save] = true })
- toRemove.forEach(function (pkg) { if (pkg.save) savingTo[pkg.save] = true })
-
- Object.keys(savingTo).forEach(function (save) {
- if (!tree.package[save]) tree.package[save] = {}
- })
-
- log.verbose('saving', toSave)
- const types = ['dependencies', 'devDependencies', 'optionalDependencies']
- toSave.forEach(function (pkg) {
- if (pkg.save) tree.package[pkg.save][pkg.name] = pkg.spec
- const movedFrom = []
- for (let saveType of types) {
- if (
- pkg.save !== saveType &&
- tree.package[saveType] &&
- tree.package[saveType][pkg.name]
- ) {
- movedFrom.push(saveType)
- delete tree.package[saveType][pkg.name]
- }
- }
- if (movedFrom.length) {
- log.notice('save', `${pkg.name} is being moved from ${movedFrom.join(' and ')} to ${pkg.save}`)
- }
- if (saveBundle) {
- var ii = bundle.indexOf(pkg.name)
- if (ii === -1) bundle.push(pkg.name)
- }
- })
-
- toRemove.forEach(function (pkg) {
- if (pkg.save) delete tree.package[pkg.save][pkg.name]
- if (saveBundle) {
- bundle = without(bundle, pkg.name)
- }
- })
-
- Object.keys(savingTo).forEach(function (key) {
- tree.package[key] = deepSortObject(tree.package[key])
- })
- if (saveBundle) {
- tree.package.bundleDependencies = deepSortObject(bundle)
- }
-
- var json = stringifyPackage(tree.package, indent, newline)
- if (json === packagejson) {
- log.verbose('shrinkwrap', 'skipping write for package.json because there were no changes.')
- next()
- } else {
- writeFileAtomic(saveTarget, json, next)
- }
- }))
-}
-
-exports.getSaveType = function (tree, arg) {
- if (arguments.length) validate('OO', arguments)
- var globalInstall = npm.config.get('global')
- var noSaveFlags = !npm.config.get('save') &&
- !npm.config.get('save-dev') &&
- !npm.config.get('save-prod') &&
- !npm.config.get('save-optional')
- if (globalInstall || noSaveFlags) return null
-
- if (npm.config.get('save-optional')) {
- return 'optionalDependencies'
- } else if (npm.config.get('save-dev')) {
- return 'devDependencies'
- } else if (npm.config.get('save-prod')) {
- return 'dependencies'
- } else {
- if (arg) {
- var name = moduleName(arg)
- if (tree.package.optionalDependencies[name]) {
- return 'optionalDependencies'
- } else if (tree.package.devDependencies[name]) {
- return 'devDependencies'
- }
- }
- return 'dependencies'
- }
-}
-
-function getThingsToSave (tree) {
- validate('O', arguments)
- var toSave = tree.children.filter(function (child) {
- return child.save
- }).map(function (child) {
- return {
- name: moduleName(child),
- spec: child.saveSpec,
- save: child.save
- }
- })
- return toSave
-}
-
-function getThingsToRemove (tree) {
- validate('O', arguments)
- if (!tree.removedChildren) return []
- var toRemove = tree.removedChildren.map(function (child) {
- return {
- name: moduleName(child),
- save: child.save
- }
- })
- return toRemove
-}
diff --git a/deps/node/deps/npm/lib/install/update-package-json.js b/deps/node/deps/npm/lib/install/update-package-json.js
deleted file mode 100644
index afffaf78..00000000
--- a/deps/node/deps/npm/lib/install/update-package-json.js
+++ /dev/null
@@ -1,56 +0,0 @@
-'use strict'
-var path = require('path')
-var writeFileAtomic = require('write-file-atomic')
-var moduleName = require('../utils/module-name.js')
-var deepSortObject = require('../utils/deep-sort-object.js')
-var sortedObject = require('sorted-object')
-var isWindows = require('../utils/is-windows.js')
-
-var sortKeys = [
- 'dependencies', 'devDependencies', 'bundleDependencies',
- 'optionalDependencies', 'keywords', 'engines', 'scripts',
- 'files'
-]
-
-module.exports = function (mod, buildpath, next) {
- var pkg = sortedObject(mod.package)
- var name = moduleName(mod)
- // Add our diagnostic keys to the package.json.
- // Note that there are folks relying on these, for ex, the Visual Studio
- // Node.js addon.
- pkg._requiredBy =
- mod.requiredBy
- .map(function (req) {
- if (
- req.package.devDependencies &&
- req.package.devDependencies[name] &&
- !req.package.dependencies[name]
- ) {
- return '#DEV:' + req.location
- } else {
- return req.location
- }
- })
- .concat(mod.userRequired ? ['#USER'] : [])
- .sort()
- pkg._location = mod.location
- pkg._phantomChildren = {}
- Object.keys(mod.phantomChildren).sort().forEach(function (name) {
- pkg._phantomChildren[name] = mod.phantomChildren[name].package.version
- })
- pkg._inBundle = !!mod.fromBundle
-
- // sort keys that are known safe to sort to produce more consistent output
- sortKeys.forEach(function (key) {
- if (pkg[key] != null) pkg[key] = deepSortObject(pkg[key])
- })
-
- var data = JSON.stringify(sortedObject(pkg), null, 2) + '\n'
-
- writeFileAtomic(path.resolve(buildpath, 'package.json'), data, {
- // We really don't need this guarantee, and fsyncing here is super slow. Except on
- // Windows where there isn't a big performance difference and it prevents errors when
- // rolling back optional packages (#17671)
- fsync: isWindows
- }, next)
-}
diff --git a/deps/node/deps/npm/lib/install/validate-args.js b/deps/node/deps/npm/lib/install/validate-args.js
deleted file mode 100644
index 65b66041..00000000
--- a/deps/node/deps/npm/lib/install/validate-args.js
+++ /dev/null
@@ -1,73 +0,0 @@
-'use strict'
-var validate = require('aproba')
-var asyncMap = require('slide').asyncMap
-var chain = require('slide').chain
-var npmInstallChecks = require('npm-install-checks')
-var iferr = require('iferr')
-var checkEngine = npmInstallChecks.checkEngine
-var checkPlatform = npmInstallChecks.checkPlatform
-var npm = require('../npm.js')
-
-module.exports = function (idealTree, args, next) {
- validate('OAF', arguments)
- var force = npm.config.get('force')
-
- asyncMap(args, function (pkg, done) {
- chain([
- [hasMinimumFields, pkg],
- [checkSelf, idealTree, pkg, force],
- [isInstallable, pkg]
- ], done)
- }, next)
-}
-
-function hasMinimumFields (pkg, cb) {
- if (pkg.name === '' || pkg.name == null) {
- return cb(new Error(`Can't install ${pkg._resolved}: Missing package name`))
- } else if (pkg.version === '' || pkg.version == null) {
- return cb(new Error(`Can't install ${pkg._resolved}: Missing package version`))
- } else {
- return cb()
- }
-}
-
-function getWarnings (pkg) {
- while (pkg.parent) pkg = pkg.parent
- if (!pkg.warnings) pkg.warnings = []
- return pkg.warnings
-}
-
-var isInstallable = module.exports.isInstallable = function (pkg, next) {
- var force = npm.config.get('force')
- var nodeVersion = npm.config.get('node-version')
- if (/-/.test(nodeVersion)) {
- // for the purposes of validation, if the node version is a prerelease,
- // strip that. We check and warn about this sceanrio over in validate-tree.
- nodeVersion = nodeVersion.replace(/-.*/, '')
- }
- var strict = npm.config.get('engine-strict')
- checkEngine(pkg, npm.version, nodeVersion, force, strict, iferr(next, thenWarnEngineIssues))
- function thenWarnEngineIssues (warn) {
- if (warn) getWarnings(pkg).push(warn)
- checkPlatform(pkg, force, next)
- }
-}
-
-function checkSelf (idealTree, pkg, force, next) {
- if (idealTree.package && idealTree.package.name !== pkg.name) return next()
- if (force) {
- var warn = new Error("Wouldn't install " + pkg.name + ' as a dependency of itself, but being forced')
- warn.code = 'ENOSELF'
- idealTree.warnings.push(warn)
- next()
- } else {
- var er = new Error('Refusing to install package with name "' + pkg.name +
- '" under a package\n' +
- 'also called "' + pkg.name + '". Did you name your project the same\n' +
- 'as the dependency you\'re installing?\n\n' +
- 'For more information, see:\n' +
- ' <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>')
- er.code = 'ENOSELF'
- next(er)
- }
-}
diff --git a/deps/node/deps/npm/lib/install/validate-tree.js b/deps/node/deps/npm/lib/install/validate-tree.js
deleted file mode 100644
index 24a14017..00000000
--- a/deps/node/deps/npm/lib/install/validate-tree.js
+++ /dev/null
@@ -1,95 +0,0 @@
-'use strict'
-var path = require('path')
-var validate = require('aproba')
-var asyncMap = require('slide').asyncMap
-var chain = require('slide').chain
-var npmInstallChecks = require('npm-install-checks')
-var checkGit = npmInstallChecks.checkGit
-var clone = require('lodash.clonedeep')
-var normalizePackageData = require('normalize-package-data')
-var npm = require('../npm.js')
-var andFinishTracker = require('./and-finish-tracker.js')
-var flattenTree = require('./flatten-tree.js')
-var validateAllPeerDeps = require('./deps.js').validateAllPeerDeps
-var packageId = require('../utils/package-id.js')
-
-module.exports = function (idealTree, log, next) {
- validate('OOF', arguments)
- var moduleMap = flattenTree(idealTree)
- var modules = Object.keys(moduleMap).map(function (name) { return moduleMap[name] })
-
- chain([
- [asyncMap, modules, function (mod, done) {
- chain([
- mod.parent && !mod.isLink && [checkGit, mod.realpath],
- [checkErrors, mod, idealTree]
- ], done)
- }],
- [thenValidateAllPeerDeps, idealTree],
- [thenCheckTop, idealTree],
- [thenCheckDuplicateDeps, idealTree]
- ], andFinishTracker(log, next))
-}
-
-function checkErrors (mod, idealTree, next) {
- if (mod.error && (mod.parent || path.resolve(npm.globalDir, '..') !== mod.path)) idealTree.warnings.push(mod.error)
- next()
-}
-
-function thenValidateAllPeerDeps (idealTree, next) {
- validate('OF', arguments)
- validateAllPeerDeps(idealTree, function (tree, pkgname, version) {
- var warn = new Error(packageId(tree) + ' requires a peer of ' + pkgname + '@' +
- version + ' but none is installed. You must install peer dependencies yourself.')
- warn.code = 'EPEERINVALID'
- idealTree.warnings.push(warn)
- })
- next()
-}
-
-function thenCheckTop (idealTree, next) {
- validate('OF', arguments)
- if (idealTree.package.error) return next()
-
- // FIXME: when we replace read-package-json with something less magic,
- // this should done elsewhere.
- // As it is, the package has already been normalized and thus some
- // errors are suppressed.
- var pkg = clone(idealTree.package)
- try {
- normalizePackageData(pkg, function (warn) {
- var warnObj = new Error(packageId(idealTree) + ' ' + warn)
- warnObj.code = 'EPACKAGEJSON'
- idealTree.warnings.push(warnObj)
- }, false)
- } catch (er) {
- er.code = 'EPACKAGEJSON'
- idealTree.warnings.push(er)
- }
-
- var nodeVersion = npm.config.get('node-version')
- if (/-/.test(nodeVersion)) {
- // if this is a prerelease node…
- var warnObj = new Error('You are using a pre-release version of node and things may not work as expected')
- warnObj.code = 'ENODEPRE'
- idealTree.warnings.push(warnObj)
- }
-
- next()
-}
-
-// check for deps duplciated between devdeps and regular deps
-function thenCheckDuplicateDeps (idealTree, next) {
- var deps = idealTree.package.dependencies || {}
- var devDeps = idealTree.package.devDependencies || {}
-
- for (var pkg in devDeps) {
- if (pkg in deps) {
- var warnObj = new Error('The package ' + pkg + ' is included as both a dev and production dependency.')
- warnObj.code = 'EDUPLICATEDEP'
- idealTree.warnings.push(warnObj)
- }
- }
-
- next()
-}
diff --git a/deps/node/deps/npm/lib/install/writable.js b/deps/node/deps/npm/lib/install/writable.js
deleted file mode 100644
index 199b48f5..00000000
--- a/deps/node/deps/npm/lib/install/writable.js
+++ /dev/null
@@ -1,35 +0,0 @@
-'use strict'
-var path = require('path')
-var fs = require('fs')
-var inflight = require('inflight')
-var accessError = require('./access-error.js')
-var andIgnoreErrors = require('./and-ignore-errors.js')
-var isFsAccessAvailable = require('./is-fs-access-available.js')
-
-if (isFsAccessAvailable) {
- module.exports = fsAccessImplementation
-} else {
- module.exports = fsOpenImplementation
-}
-
-// exposed only for testing purposes
-module.exports.fsAccessImplementation = fsAccessImplementation
-module.exports.fsOpenImplementation = fsOpenImplementation
-
-function fsAccessImplementation (dir, done) {
- done = inflight('writable:' + dir, done)
- if (!done) return
- fs.access(dir, fs.W_OK, done)
-}
-
-function fsOpenImplementation (dir, done) {
- done = inflight('writable:' + dir, done)
- if (!done) return
- var tmp = path.join(dir, '.npm.check.permissions')
- fs.open(tmp, 'w', function (er, fd) {
- if (er) return done(accessError(dir, er))
- fs.close(fd, function () {
- fs.unlink(tmp, andIgnoreErrors(done))
- })
- })
-}
diff --git a/deps/node/deps/npm/lib/link.js b/deps/node/deps/npm/lib/link.js
deleted file mode 100644
index e05526c4..00000000
--- a/deps/node/deps/npm/lib/link.js
+++ /dev/null
@@ -1,197 +0,0 @@
-// link with no args: symlink the folder to the global location
-// link with package arg: symlink the global to the local
-
-var npm = require('./npm.js')
-var symlink = require('./utils/link.js')
-var fs = require('graceful-fs')
-var log = require('npmlog')
-var asyncMap = require('slide').asyncMap
-var chain = require('slide').chain
-var path = require('path')
-var build = require('./build.js')
-var npa = require('npm-package-arg')
-var usage = require('./utils/usage')
-var output = require('./utils/output.js')
-
-module.exports = link
-
-link.usage = usage(
- 'link',
- 'npm link (in package dir)' +
- '\nnpm link [<@scope>/]<pkg>[@<version>]'
-)
-
-link.completion = function (opts, cb) {
- var dir = npm.globalDir
- fs.readdir(dir, function (er, files) {
- cb(er, files.filter(function (f) {
- return !f.match(/^[._-]/)
- }))
- })
-}
-
-function link (args, cb) {
- if (process.platform === 'win32') {
- var semver = require('semver')
- if (!semver.gte(process.version, '0.7.9')) {
- var msg = 'npm link not supported on windows prior to node 0.7.9'
- var e = new Error(msg)
- e.code = 'ENOTSUP'
- e.errno = require('constants').ENOTSUP // eslint-disable-line node/no-deprecated-api
- return cb(e)
- }
- }
-
- if (npm.config.get('global')) {
- return cb(new Error(
- 'link should never be --global.\n' +
- 'Please re-run this command with --local'
- ))
- }
-
- if (args.length === 1 && args[0] === '.') args = []
- if (args.length) return linkInstall(args, cb)
- linkPkg(npm.prefix, cb)
-}
-
-function parentFolder (id, folder) {
- if (id[0] === '@') {
- return path.resolve(folder, '..', '..')
- } else {
- return path.resolve(folder, '..')
- }
-}
-
-function linkInstall (pkgs, cb) {
- asyncMap(pkgs, function (pkg, cb) {
- var t = path.resolve(npm.globalDir, '..')
- var pp = path.resolve(npm.globalDir, pkg)
- var rp = null
- var target = path.resolve(npm.dir, pkg)
-
- function n (er, data) {
- if (er) return cb(er, data)
- // we want the ONE thing that was installed into the global dir
- var installed = data.filter(function (info) {
- var id = info[0]
- var folder = info[1]
- return parentFolder(id, folder) === npm.globalDir
- })
- var id = installed[0][0]
- pp = installed[0][1]
- var what = npa(id)
- pkg = what.name
- target = path.resolve(npm.dir, pkg)
- next()
- }
-
- // if it's a folder, a random not-installed thing, or not a scoped package,
- // then link or install it first
- if (pkg[0] !== '@' && (pkg.indexOf('/') !== -1 || pkg.indexOf('\\') !== -1)) {
- return fs.lstat(path.resolve(pkg), function (er, st) {
- if (er || !st.isDirectory()) {
- npm.commands.install(t, pkg, n)
- } else {
- rp = path.resolve(pkg)
- linkPkg(rp, n)
- }
- })
- }
-
- fs.lstat(pp, function (er, st) {
- if (er) {
- rp = pp
- return npm.commands.install(t, [pkg], n)
- } else if (!st.isSymbolicLink()) {
- rp = pp
- next()
- } else {
- return fs.realpath(pp, function (er, real) {
- if (er) log.warn('invalid symbolic link', pkg)
- else rp = real
- next()
- })
- }
- })
-
- function next () {
- if (npm.config.get('dry-run')) return resultPrinter(pkg, pp, target, rp, cb)
- chain(
- [
- [ function (cb) {
- log.verbose('link', 'symlinking %s to %s', pp, target)
- cb()
- } ],
- [symlink, pp, target, false, false],
- // do not run any scripts
- rp && [build, [target], npm.config.get('global'), build._noLC, true],
- [resultPrinter, pkg, pp, target, rp]
- ],
- cb
- )
- }
- }, cb)
-}
-
-function linkPkg (folder, cb_) {
- var me = folder || npm.prefix
- var readJson = require('read-package-json')
-
- log.verbose('linkPkg', folder)
-
- readJson(path.resolve(me, 'package.json'), function (er, d) {
- function cb (er) {
- return cb_(er, [[d && d._id, target, null, null]])
- }
- if (er) return cb(er)
- if (!d.name) {
- er = new Error('Package must have a name field to be linked')
- return cb(er)
- }
- var target = path.resolve(npm.globalDir, d.name)
- if (npm.config.get('dry-run')) return resultPrinter(path.basename(me), me, target, cb)
- symlink(me, target, false, true, function (er) {
- if (er) return cb(er)
- log.verbose('link', 'build target', target)
- // also install missing dependencies.
- npm.commands.install(me, [], function (er) {
- if (er) return cb(er)
- // build the global stuff. Don't run *any* scripts, because
- // install command already will have done that.
- build([target], true, build._noLC, true, function (er) {
- if (er) return cb(er)
- resultPrinter(path.basename(me), me, target, cb)
- })
- })
- })
- })
-}
-
-function resultPrinter (pkg, src, dest, rp, cb) {
- if (typeof cb !== 'function') {
- cb = rp
- rp = null
- }
- var where = dest
- rp = (rp || '').trim()
- src = (src || '').trim()
- // XXX If --json is set, then look up the data from the package.json
- if (npm.config.get('parseable')) {
- return parseableOutput(dest, rp || src, cb)
- }
- if (rp === src) rp = null
- output(where + ' -> ' + src + (rp ? ' -> ' + rp : ''))
- cb()
-}
-
-function parseableOutput (dest, rp, cb) {
- // XXX this should match ls --parseable and install --parseable
- // look up the data from package.json, format it the same way.
- //
- // link is always effectively 'long', since it doesn't help much to
- // *just* print the target folder.
- // However, we don't actually ever read the version number, so
- // the second field is always blank.
- output(dest + '::' + rp)
- cb()
-}
diff --git a/deps/node/deps/npm/lib/logout.js b/deps/node/deps/npm/lib/logout.js
deleted file mode 100644
index 411f5472..00000000
--- a/deps/node/deps/npm/lib/logout.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const eu = encodeURIComponent
-const getAuth = require('npm-registry-fetch/auth.js')
-const log = require('npmlog')
-const npm = require('./npm.js')
-const npmConfig = require('./config/figgy-config.js')
-const npmFetch = require('libnpm/fetch')
-
-logout.usage = 'npm logout [--registry=<url>] [--scope=<@scope>]'
-
-function afterLogout (normalized) {
- var scope = npm.config.get('scope')
-
- if (scope) npm.config.del(scope + ':registry')
-
- npm.config.clearCredentialsByURI(normalized)
- return BB.fromNode(cb => npm.config.save('user', cb))
-}
-
-module.exports = logout
-function logout (args, cb) {
- const opts = npmConfig()
- BB.try(() => {
- const reg = npmFetch.pickRegistry('foo', opts)
- const auth = getAuth(reg, opts)
- if (auth.token) {
- log.verbose('logout', 'clearing session token for', reg)
- return npmFetch(`/-/user/token/${eu(auth.token)}`, opts.concat({
- method: 'DELETE',
- ignoreBody: true
- })).then(() => afterLogout(reg))
- } else if (auth.username || auth.password) {
- log.verbose('logout', 'clearing user credentials for', reg)
- return afterLogout(reg)
- } else {
- throw new Error(
- 'Not logged in to', reg + ',', "so can't log out."
- )
- }
- }).nodeify(cb)
-}
diff --git a/deps/node/deps/npm/lib/ls.js b/deps/node/deps/npm/lib/ls.js
deleted file mode 100644
index bb5e433f..00000000
--- a/deps/node/deps/npm/lib/ls.js
+++ /dev/null
@@ -1,548 +0,0 @@
-// show the installed versions of packages
-//
-// --parseable creates output like this:
-// <fullpath>:<name@ver>:<realpath>:<flags>
-// Flags are a :-separated list of zero or more indicators
-
-module.exports = exports = ls
-
-var path = require('path')
-var url = require('url')
-var readPackageTree = require('read-package-tree')
-var archy = require('archy')
-var semver = require('semver')
-var color = require('ansicolors')
-var npa = require('npm-package-arg')
-var sortedObject = require('sorted-object')
-var npm = require('./npm.js')
-var mutateIntoLogicalTree = require('./install/mutate-into-logical-tree.js')
-var computeMetadata = require('./install/deps.js').computeMetadata
-var readShrinkwrap = require('./install/read-shrinkwrap.js')
-var packageId = require('./utils/package-id.js')
-var usage = require('./utils/usage')
-var output = require('./utils/output.js')
-
-ls.usage = usage(
- 'ls',
- 'npm ls [[<@scope>/]<pkg> ...]'
-)
-
-ls.completion = require('./utils/completion/installed-deep.js')
-
-function ls (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
- var dir = path.resolve(npm.dir, '..')
- readPackageTree(dir, function (_, physicalTree) {
- if (!physicalTree) physicalTree = {package: {}, path: dir}
- physicalTree.isTop = true
- readShrinkwrap.andInflate(physicalTree, function () {
- lsFromTree(dir, computeMetadata(physicalTree), args, silent, cb)
- })
- })
-}
-
-function inList (list, value) {
- return list.indexOf(value) !== -1
-}
-
-var lsFromTree = ls.fromTree = function (dir, physicalTree, args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
-
- // npm ls 'foo@~1.3' bar 'baz@<2'
- if (!args) {
- args = []
- } else {
- args = args.map(function (a) {
- if (typeof a === 'object') {
- return [a.package.name, a.package.version, a]
- } else {
- var p = npa(a)
- var name = p.name
- // When version spec is missing, we'll skip using it when filtering.
- // Otherwise, `semver.validRange` would return '*', which won't
- // match prerelease versions.
- var ver = (p.rawSpec &&
- (semver.validRange(p.rawSpec) || ''))
- return [ name, ver, a ]
- }
- })
- }
-
- var data = mutateIntoLogicalTree.asReadInstalled(physicalTree)
-
- pruneNestedExtraneous(data)
- filterByEnv(data)
- filterByLink(data)
-
- var unlooped = filterFound(unloop(data), args)
- var lite = getLite(unlooped)
-
- if (silent) return cb(null, data, lite)
-
- var long = npm.config.get('long')
- var json = npm.config.get('json')
- var out
- if (json) {
- var seen = new Set()
- var d = long ? unlooped : lite
- // the raw data can be circular
- out = JSON.stringify(d, function (k, o) {
- if (typeof o === 'object') {
- if (seen.has(o)) return '[Circular]'
- seen.add(o)
- }
- return o
- }, 2)
- } else if (npm.config.get('parseable')) {
- out = makeParseable(unlooped, long, dir)
- } else if (data) {
- out = makeArchy(unlooped, long, dir)
- }
- output(out)
-
- if (args.length && !data._found) process.exitCode = 1
-
- var er
- // if any errors were found, then complain and exit status 1
- if (lite.problems && lite.problems.length) {
- er = lite.problems.join('\n')
- }
- cb(er, data, lite)
-}
-
-function pruneNestedExtraneous (data, visited) {
- visited = visited || []
- visited.push(data)
- for (var i in data.dependencies) {
- if (data.dependencies[i].extraneous) {
- data.dependencies[i].dependencies = {}
- } else if (visited.indexOf(data.dependencies[i]) === -1) {
- pruneNestedExtraneous(data.dependencies[i], visited)
- }
- }
-}
-
-function filterByEnv (data) {
- var dev = npm.config.get('dev') || /^dev(elopment)?$/.test(npm.config.get('only'))
- var production = npm.config.get('production') || /^prod(uction)?$/.test(npm.config.get('only'))
- var dependencies = {}
- var devKeys = Object.keys(data.devDependencies || [])
- var prodKeys = Object.keys(data._dependencies || [])
- Object.keys(data.dependencies).forEach(function (name) {
- if (!dev && inList(devKeys, name) && !inList(prodKeys, name) && data.dependencies[name].missing) {
- return
- }
-
- if ((dev && inList(devKeys, name)) || // only --dev
- (production && inList(prodKeys, name)) || // only --production
- (!dev && !production)) { // no --production|--dev|--only=xxx
- dependencies[name] = data.dependencies[name]
- }
- })
- data.dependencies = dependencies
-}
-
-function filterByLink (data) {
- if (npm.config.get('link')) {
- var dependencies = {}
- Object.keys(data.dependencies).forEach(function (name) {
- var dependency = data.dependencies[name]
- if (dependency.link) {
- dependencies[name] = dependency
- }
- })
- data.dependencies = dependencies
- }
-}
-
-function alphasort (a, b) {
- a = a.toLowerCase()
- b = b.toLowerCase()
- return a > b ? 1
- : a < b ? -1 : 0
-}
-
-function isCruft (data) {
- return data.extraneous && data.error && data.error.code === 'ENOTDIR'
-}
-
-function getLite (data, noname, depth) {
- var lite = {}
-
- if (isCruft(data)) return lite
-
- var maxDepth = npm.config.get('depth')
-
- if (typeof depth === 'undefined') depth = 0
- if (!noname && data.name) lite.name = data.name
- if (data.version) lite.version = data.version
- if (data.extraneous) {
- lite.extraneous = true
- lite.problems = lite.problems || []
- lite.problems.push('extraneous: ' + packageId(data) + ' ' + (data.path || ''))
- }
-
- if (data.error && data.path !== path.resolve(npm.globalDir, '..') &&
- (data.error.code !== 'ENOENT' || noname)) {
- lite.invalid = true
- lite.problems = lite.problems || []
- var message = data.error.message
- lite.problems.push('error in ' + data.path + ': ' + message)
- }
-
- if (data._from) {
- lite.from = data._from
- }
-
- if (data._resolved) {
- lite.resolved = data._resolved
- }
-
- if (data.invalid) {
- lite.invalid = true
- lite.problems = lite.problems || []
- lite.problems.push('invalid: ' +
- packageId(data) +
- ' ' + (data.path || ''))
- }
-
- if (data.peerInvalid) {
- lite.peerInvalid = true
- lite.problems = lite.problems || []
- lite.problems.push('peer dep not met: ' +
- packageId(data) +
- ' ' + (data.path || ''))
- }
-
- var deps = (data.dependencies && Object.keys(data.dependencies)) || []
- if (deps.length) {
- lite.dependencies = deps.map(function (d) {
- var dep = data.dependencies[d]
- if (dep.missing && !dep.optional) {
- lite.problems = lite.problems || []
- var p
- if (data.depth > maxDepth) {
- p = 'max depth reached: '
- } else {
- p = 'missing: '
- }
- p += d + '@' + dep.requiredBy +
- ', required by ' +
- packageId(data)
- lite.problems.push(p)
- if (dep.dependencies) {
- return [d, getLite(dep, true)]
- } else {
- return [d, { required: dep.requiredBy, missing: true }]
- }
- } else if (dep.peerMissing) {
- lite.problems = lite.problems || []
- dep.peerMissing.forEach(function (missing) {
- var pdm = 'peer dep missing: ' +
- missing.requires +
- ', required by ' +
- missing.requiredBy
- lite.problems.push(pdm)
- })
- return [d, { required: dep, peerMissing: true }]
- } else if (npm.config.get('json')) {
- if (depth === maxDepth) delete dep.dependencies
- return [d, getLite(dep, true, depth + 1)]
- }
- return [d, getLite(dep, true)]
- }).reduce(function (deps, d) {
- if (d[1].problems) {
- lite.problems = lite.problems || []
- lite.problems.push.apply(lite.problems, d[1].problems)
- }
- deps[d[0]] = d[1]
- return deps
- }, {})
- }
- return lite
-}
-
-function unloop (root) {
- var queue = [root]
- var seen = new Set()
- seen.add(root)
-
- while (queue.length) {
- var current = queue.shift()
- var deps = current.dependencies = current.dependencies || {}
- Object.keys(deps).forEach(function (d) {
- var dep = deps[d]
- if (dep.missing && !dep.dependencies) return
- if (dep.path && seen.has(dep)) {
- dep = deps[d] = Object.assign({}, dep)
- dep.dependencies = {}
- dep._deduped = path.relative(root.path, dep.path).replace(/node_modules\//g, '')
- return
- }
- seen.add(dep)
- queue.push(dep)
- })
- }
-
- return root
-}
-
-function filterFound (root, args) {
- if (!args.length) return root
- if (!root.dependencies) return root
-
- // Mark all deps
- var toMark = [root]
- while (toMark.length) {
- var markPkg = toMark.shift()
- var markDeps = markPkg.dependencies
- if (!markDeps) continue
- Object.keys(markDeps).forEach(function (depName) {
- var dep = markDeps[depName]
- if (dep.peerMissing) return
- dep._parent = markPkg
- for (var ii = 0; ii < args.length; ii++) {
- var argName = args[ii][0]
- var argVersion = args[ii][1]
- var argRaw = args[ii][2]
- var found
- if (typeof argRaw === 'object') {
- if (dep.path === argRaw.path) {
- found = true
- }
- } else if (depName === argName && argVersion) {
- found = semver.satisfies(dep.version, argVersion, true)
- } else if (depName === argName) {
- // If version is missing from arg, just do a name match.
- found = true
- }
- if (found) {
- dep._found = 'explicit'
- var parent = dep._parent
- while (parent && !parent._found && !parent._deduped) {
- parent._found = 'implicit'
- parent = parent._parent
- }
- break
- }
- }
- toMark.push(dep)
- })
- }
- var toTrim = [root]
- while (toTrim.length) {
- var trimPkg = toTrim.shift()
- var trimDeps = trimPkg.dependencies
- if (!trimDeps) continue
- trimPkg.dependencies = {}
- Object.keys(trimDeps).forEach(function (name) {
- var dep = trimDeps[name]
- if (!dep._found) return
- if (dep._found === 'implicit' && dep._deduped) return
- trimPkg.dependencies[name] = dep
- toTrim.push(dep)
- })
- }
- return root
-}
-
-function makeArchy (data, long, dir) {
- var out = makeArchy_(data, long, dir, 0)
- return archy(out, '', { unicode: npm.config.get('unicode') })
-}
-
-function makeArchy_ (data, long, dir, depth, parent, d) {
- if (data.missing) {
- if (depth - 1 <= npm.config.get('depth')) {
- // just missing
- var unmet = 'UNMET ' + (data.optional ? 'OPTIONAL ' : '') + 'DEPENDENCY'
- if (npm.color) {
- if (data.optional) {
- unmet = color.bgBlack(color.yellow(unmet))
- } else {
- unmet = color.bgBlack(color.red(unmet))
- }
- }
- var label = data._id || (d + '@' + data.requiredBy)
- if (data._found === 'explicit' && data._id) {
- if (npm.color) {
- label = color.bgBlack(color.yellow(label.trim())) + ' '
- } else {
- label = label.trim() + ' '
- }
- }
- return {
- label: unmet + ' ' + label,
- nodes: Object.keys(data.dependencies || {})
- .sort(alphasort).filter(function (d) {
- return !isCruft(data.dependencies[d])
- }).map(function (d) {
- return makeArchy_(sortedObject(data.dependencies[d]), long, dir, depth + 1, data, d)
- })
- }
- } else {
- return {label: d + '@' + data.requiredBy}
- }
- }
-
- var out = {}
- // the top level is a bit special.
- out.label = data._id || ''
- if (data._found === 'explicit' && data._id) {
- if (npm.color) {
- out.label = color.bgBlack(color.yellow(out.label.trim())) + ' '
- } else {
- out.label = out.label.trim() + ' '
- }
- }
- if (data.link) out.label += ' -> ' + data.link
-
- if (data._deduped) {
- if (npm.color) {
- out.label += ' ' + color.brightBlack('deduped')
- } else {
- out.label += ' deduped'
- }
- }
-
- if (data.invalid) {
- if (data.realName !== data.name) out.label += ' (' + data.realName + ')'
- var invalid = 'invalid'
- if (npm.color) invalid = color.bgBlack(color.red(invalid))
- out.label += ' ' + invalid
- }
-
- if (data.peerInvalid) {
- var peerInvalid = 'peer invalid'
- if (npm.color) peerInvalid = color.bgBlack(color.red(peerInvalid))
- out.label += ' ' + peerInvalid
- }
-
- if (data.peerMissing) {
- var peerMissing = 'UNMET PEER DEPENDENCY'
-
- if (npm.color) peerMissing = color.bgBlack(color.red(peerMissing))
- out.label = peerMissing + ' ' + out.label
- }
-
- if (data.extraneous && data.path !== dir) {
- var extraneous = 'extraneous'
- if (npm.color) extraneous = color.bgBlack(color.green(extraneous))
- out.label += ' ' + extraneous
- }
-
- if (data.error && depth) {
- var message = data.error.message
- if (message.indexOf('\n')) message = message.slice(0, message.indexOf('\n'))
- var error = 'error: ' + message
- if (npm.color) error = color.bgRed(color.brightWhite(error))
- out.label += ' ' + error
- }
-
- // add giturl to name@version
- if (data._resolved) {
- try {
- var type = npa(data._resolved).type
- var isGit = type === 'git' || type === 'hosted'
- if (isGit) {
- out.label += ' (' + data._resolved + ')'
- }
- } catch (ex) {
- // npa threw an exception then it ain't git so whatev
- }
- }
-
- if (long) {
- if (dir === data.path) out.label += '\n' + dir
- out.label += '\n' + getExtras(data)
- } else if (dir === data.path) {
- if (out.label) out.label += ' '
- out.label += dir
- }
-
- // now all the children.
- out.nodes = []
- if (depth <= npm.config.get('depth')) {
- out.nodes = Object.keys(data.dependencies || {})
- .sort(alphasort).filter(function (d) {
- return !isCruft(data.dependencies[d])
- }).map(function (d) {
- return makeArchy_(sortedObject(data.dependencies[d]), long, dir, depth + 1, data, d)
- })
- }
-
- if (out.nodes.length === 0 && data.path === dir) {
- out.nodes = ['(empty)']
- }
-
- return out
-}
-
-function getExtras (data) {
- var extras = []
-
- if (data.description) extras.push(data.description)
- if (data.repository) extras.push(data.repository.url)
- if (data.homepage) extras.push(data.homepage)
- if (data._from) {
- var from = data._from
- if (from.indexOf(data.name + '@') === 0) {
- from = from.substr(data.name.length + 1)
- }
- var u = url.parse(from)
- if (u.protocol) extras.push(from)
- }
- return extras.join('\n')
-}
-
-function makeParseable (data, long, dir, depth, parent, d) {
- if (data._deduped) return []
- depth = depth || 0
- if (depth > npm.config.get('depth')) return [ makeParseable_(data, long, dir, depth, parent, d) ]
- return [ makeParseable_(data, long, dir, depth, parent, d) ]
- .concat(Object.keys(data.dependencies || {})
- .sort(alphasort).map(function (d) {
- return makeParseable(data.dependencies[d], long, dir, depth + 1, data, d)
- }))
- .filter(function (x) { return x && x.length })
- .join('\n')
-}
-
-function makeParseable_ (data, long, dir, depth, parent, d) {
- if (data.hasOwnProperty('_found') && data._found !== 'explicit') return ''
-
- if (data.missing) {
- if (depth < npm.config.get('depth')) {
- data = npm.config.get('long')
- ? path.resolve(parent.path, 'node_modules', d) +
- ':' + d + '@' + JSON.stringify(data.requiredBy) + ':INVALID:MISSING'
- : ''
- } else {
- data = path.resolve(dir || '', 'node_modules', d || '') +
- (npm.config.get('long')
- ? ':' + d + '@' + JSON.stringify(data.requiredBy) +
- ':' + // no realpath resolved
- ':MAXDEPTH'
- : '')
- }
-
- return data
- }
-
- if (!npm.config.get('long')) return data.path
-
- return data.path +
- ':' + (data._id || '') +
- ':' + (data.realPath !== data.path ? data.realPath : '') +
- (data.extraneous ? ':EXTRANEOUS' : '') +
- (data.error && data.path !== path.resolve(npm.globalDir, '..') ? ':ERROR' : '') +
- (data.invalid ? ':INVALID' : '') +
- (data.peerInvalid ? ':PEERINVALID' : '') +
- (data.peerMissing ? ':PEERINVALID:MISSING' : '')
-}
diff --git a/deps/node/deps/npm/lib/npm.js b/deps/node/deps/npm/lib/npm.js
deleted file mode 100644
index 2ee9a991..00000000
--- a/deps/node/deps/npm/lib/npm.js
+++ /dev/null
@@ -1,476 +0,0 @@
-;(function () {
- // windows: running 'npm blah' in this folder will invoke WSH, not node.
- /* globals WScript */
- if (typeof WScript !== 'undefined') {
- WScript.echo(
- 'npm does not work when run\n' +
- 'with the Windows Scripting Host\n\n' +
- '"cd" to a different directory,\n' +
- 'or type "npm.cmd <args>",\n' +
- 'or type "node npm <args>".'
- )
- WScript.quit(1)
- return
- }
-
- var unsupported = require('../lib/utils/unsupported.js')
- unsupported.checkForBrokenNode()
-
- var gfs = require('graceful-fs')
- // Patch the global fs module here at the app level
- var fs = gfs.gracefulify(require('fs'))
-
- var EventEmitter = require('events').EventEmitter
- var npm = module.exports = new EventEmitter()
- var npmconf = require('./config/core.js')
- var log = require('npmlog')
- var inspect = require('util').inspect
-
- // capture global logging
- process.on('log', function (level) {
- try {
- return log[level].apply(log, [].slice.call(arguments, 1))
- } catch (ex) {
- log.verbose('attempt to log ' + inspect(arguments) + ' crashed: ' + ex.message)
- }
- })
-
- var path = require('path')
- var abbrev = require('abbrev')
- var which = require('which')
- var glob = require('glob')
- var rimraf = require('rimraf')
- var parseJSON = require('./utils/parse-json.js')
- var aliases = require('./config/cmd-list').aliases
- var cmdList = require('./config/cmd-list').cmdList
- var plumbing = require('./config/cmd-list').plumbing
- var output = require('./utils/output.js')
- var startMetrics = require('./utils/metrics.js').start
- var perf = require('./utils/perf.js')
-
- perf.emit('time', 'npm')
- perf.on('timing', function (name, finished) {
- log.timing(name, 'Completed in', finished + 'ms')
- })
-
- npm.config = {
- loaded: false,
- get: function () {
- throw new Error('npm.load() required')
- },
- set: function () {
- throw new Error('npm.load() required')
- }
- }
-
- npm.commands = {}
-
- // TUNING
- npm.limit = {
- fetch: 10,
- action: 50
- }
- // ***
-
- npm.lockfileVersion = 1
-
- npm.rollbacks = []
-
- try {
- // startup, ok to do this synchronously
- var j = parseJSON(fs.readFileSync(
- path.join(__dirname, '../package.json')) + '')
- npm.name = j.name
- npm.version = j.version
- } catch (ex) {
- try {
- log.info('error reading version', ex)
- } catch (er) {}
- npm.version = ex
- }
-
- var commandCache = {}
- var aliasNames = Object.keys(aliases)
-
- var littleGuys = [ 'isntall', 'verison' ]
- var fullList = cmdList.concat(aliasNames).filter(function (c) {
- return plumbing.indexOf(c) === -1
- })
- var abbrevs = abbrev(fullList)
-
- // we have our reasons
- fullList = npm.fullList = fullList.filter(function (c) {
- return littleGuys.indexOf(c) === -1
- })
-
- var registryRefer
-
- Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) {
- Object.defineProperty(npm.commands, c, { get: function () {
- if (!loaded) {
- throw new Error(
- 'Call npm.load(config, cb) before using this command.\n' +
- 'See the README.md or bin/npm-cli.js for example usage.'
- )
- }
- var a = npm.deref(c)
- if (c === 'la' || c === 'll') {
- npm.config.set('long', true)
- }
-
- npm.command = c
- if (commandCache[a]) return commandCache[a]
-
- var cmd = require(path.join(__dirname, a + '.js'))
-
- commandCache[a] = function () {
- var args = Array.prototype.slice.call(arguments, 0)
- if (typeof args[args.length - 1] !== 'function') {
- args.push(defaultCb)
- }
- if (args.length === 1) args.unshift([])
-
- // Options are prefixed by a hyphen-minus (-, \u2d).
- // Other dash-type chars look similar but are invalid.
- Array(args[0]).forEach(function (arg) {
- if (/^[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/.test(arg)) {
- log.error('arg', 'Argument starts with non-ascii dash, this is probably invalid:', arg)
- }
- })
-
- if (!registryRefer) {
- registryRefer = [a].concat(args[0]).map(function (arg) {
- // exclude anything that might be a URL, path, or private module
- // Those things will always have a slash in them somewhere
- if (arg && arg.match && arg.match(/\/|\\/)) {
- return '[REDACTED]'
- } else {
- return arg
- }
- }).filter(function (arg) {
- return arg && arg.match
- }).join(' ')
- npm.referer = registryRefer
- }
-
- cmd.apply(npm, args)
- }
-
- Object.keys(cmd).forEach(function (k) {
- commandCache[a][k] = cmd[k]
- })
-
- return commandCache[a]
- },
- enumerable: fullList.indexOf(c) !== -1,
- configurable: true })
-
- // make css-case commands callable via camelCase as well
- if (c.match(/-([a-z])/)) {
- addCommand(c.replace(/-([a-z])/g, function (a, b) {
- return b.toUpperCase()
- }))
- }
- })
-
- function defaultCb (er, data) {
- log.disableProgress()
- if (er) console.error(er.stack || er.message)
- else output(data)
- }
-
- npm.deref = function (c) {
- if (!c) return ''
- if (c.match(/[A-Z]/)) {
- c = c.replace(/([A-Z])/g, function (m) {
- return '-' + m.toLowerCase()
- })
- }
- if (plumbing.indexOf(c) !== -1) return c
- var a = abbrevs[c]
- while (aliases[a]) {
- a = aliases[a]
- }
- return a
- }
-
- var loaded = false
- var loading = false
- var loadErr = null
- var loadListeners = []
-
- function loadCb (er) {
- loadListeners.forEach(function (cb) {
- process.nextTick(cb.bind(npm, er, npm))
- })
- loadListeners.length = 0
- }
-
- npm.load = function (cli, cb_) {
- if (!cb_ && typeof cli === 'function') {
- cb_ = cli
- cli = {}
- }
- if (!cb_) cb_ = function () {}
- if (!cli) cli = {}
- loadListeners.push(cb_)
- if (loaded || loadErr) return cb(loadErr)
- if (loading) return
- loading = true
- var onload = true
-
- function cb (er) {
- if (loadErr) return
- loadErr = er
- if (er) return cb_(er)
- if (npm.config.get('force')) {
- log.warn('using --force', 'I sure hope you know what you are doing.')
- }
- npm.config.loaded = true
- loaded = true
- loadCb(loadErr = er)
- onload = onload && npm.config.get('onload-script')
- if (onload) {
- try {
- require(onload)
- } catch (err) {
- log.warn('onload-script', 'failed to require onload script', onload)
- log.warn('onload-script', err)
- }
- onload = false
- }
- }
-
- log.pause()
-
- load(npm, cli, cb)
- }
-
- function load (npm, cli, cb) {
- which(process.argv[0], function (er, node) {
- if (!er && node.toUpperCase() !== process.execPath.toUpperCase()) {
- log.verbose('node symlink', node)
- process.execPath = node
- process.installPrefix = path.resolve(node, '..', '..')
- }
-
- // look up configs
- var builtin = path.resolve(__dirname, '..', 'npmrc')
- npmconf.load(cli, builtin, function (er, config) {
- if (er === config) er = null
-
- npm.config = config
- if (er) return cb(er)
-
- // if the 'project' config is not a filename, and we're
- // not in global mode, then that means that it collided
- // with either the default or effective userland config
- if (!config.get('global') &&
- config.sources.project &&
- config.sources.project.type !== 'ini') {
- log.verbose(
- 'config',
- 'Skipping project config: %s. (matches userconfig)',
- config.localPrefix + '/.npmrc'
- )
- }
-
- // Include npm-version and node-version in user-agent
- var ua = config.get('user-agent') || ''
- ua = ua.replace(/\{node-version\}/gi, process.version)
- ua = ua.replace(/\{npm-version\}/gi, npm.version)
- ua = ua.replace(/\{platform\}/gi, process.platform)
- ua = ua.replace(/\{arch\}/gi, process.arch)
- config.set('user-agent', ua)
-
- if (config.get('metrics-registry') == null) {
- config.set('metrics-registry', config.get('registry'))
- }
-
- var color = config.get('color')
-
- if (npm.config.get('timing') && npm.config.get('loglevel') === 'notice') {
- log.level = 'timing'
- } else {
- log.level = config.get('loglevel')
- }
- log.heading = config.get('heading') || 'npm'
- log.stream = config.get('logstream')
-
- switch (color) {
- case 'always':
- npm.color = true
- break
- case false:
- npm.color = false
- break
- default:
- npm.color = process.stdout.isTTY && process.env['TERM'] !== 'dumb'
- break
- }
- if (npm.color) {
- log.enableColor()
- } else {
- log.disableColor()
- }
-
- if (config.get('unicode')) {
- log.enableUnicode()
- } else {
- log.disableUnicode()
- }
-
- if (config.get('progress') && process.stderr.isTTY && process.env['TERM'] !== 'dumb') {
- log.enableProgress()
- } else {
- log.disableProgress()
- }
-
- glob(path.resolve(npm.cache, '_logs', '*-debug.log'), function (er, files) {
- if (er) return cb(er)
-
- while (files.length >= npm.config.get('logs-max')) {
- rimraf.sync(files[0])
- files.splice(0, 1)
- }
- })
-
- log.resume()
-
- var umask = npm.config.get('umask')
- npm.modes = {
- exec: parseInt('0777', 8) & (~umask),
- file: parseInt('0666', 8) & (~umask),
- umask: umask
- }
-
- var gp = Object.getOwnPropertyDescriptor(config, 'globalPrefix')
- Object.defineProperty(npm, 'globalPrefix', gp)
-
- var lp = Object.getOwnPropertyDescriptor(config, 'localPrefix')
- Object.defineProperty(npm, 'localPrefix', lp)
-
- config.set('scope', scopeifyScope(config.get('scope')))
- npm.projectScope = config.get('scope') ||
- scopeifyScope(getProjectScope(npm.prefix))
-
- startMetrics()
-
- return cb(null, npm)
- })
- })
- }
-
- Object.defineProperty(npm, 'prefix',
- {
- get: function () {
- return npm.config.get('global') ? npm.globalPrefix : npm.localPrefix
- },
- set: function (r) {
- var k = npm.config.get('global') ? 'globalPrefix' : 'localPrefix'
- npm[k] = r
- return r
- },
- enumerable: true
- })
-
- Object.defineProperty(npm, 'bin',
- {
- get: function () {
- if (npm.config.get('global')) return npm.globalBin
- return path.resolve(npm.root, '.bin')
- },
- enumerable: true
- })
-
- Object.defineProperty(npm, 'globalBin',
- {
- get: function () {
- var b = npm.globalPrefix
- if (process.platform !== 'win32') b = path.resolve(b, 'bin')
- return b
- }
- })
-
- Object.defineProperty(npm, 'dir',
- {
- get: function () {
- if (npm.config.get('global')) return npm.globalDir
- return path.resolve(npm.prefix, 'node_modules')
- },
- enumerable: true
- })
-
- Object.defineProperty(npm, 'globalDir',
- {
- get: function () {
- return (process.platform !== 'win32')
- ? path.resolve(npm.globalPrefix, 'lib', 'node_modules')
- : path.resolve(npm.globalPrefix, 'node_modules')
- },
- enumerable: true
- })
-
- Object.defineProperty(npm, 'root',
- { get: function () { return npm.dir } })
-
- Object.defineProperty(npm, 'cache',
- { get: function () { return npm.config.get('cache') },
- set: function (r) { return npm.config.set('cache', r) },
- enumerable: true
- })
-
- var tmpFolder
- var rand = require('crypto').randomBytes(4).toString('hex')
- Object.defineProperty(npm, 'tmp',
- {
- get: function () {
- if (!tmpFolder) tmpFolder = 'npm-' + process.pid + '-' + rand
- return path.resolve(npm.config.get('tmp'), tmpFolder)
- },
- enumerable: true
- })
-
- // the better to repl you with
- Object.getOwnPropertyNames(npm.commands).forEach(function (n) {
- if (npm.hasOwnProperty(n) || n === 'config') return
-
- Object.defineProperty(npm, n, { get: function () {
- return function () {
- var args = Array.prototype.slice.call(arguments, 0)
- var cb = defaultCb
-
- if (args.length === 1 && Array.isArray(args[0])) {
- args = args[0]
- }
-
- if (typeof args[args.length - 1] === 'function') {
- cb = args.pop()
- }
- npm.commands[n](args, cb)
- }
- },
- enumerable: false,
- configurable: true })
- })
-
- if (require.main === module) {
- require('../bin/npm-cli.js')
- }
-
- function scopeifyScope (scope) {
- return (!scope || scope[0] === '@') ? scope : ('@' + scope)
- }
-
- function getProjectScope (prefix) {
- try {
- var pkg = JSON.parse(fs.readFileSync(path.join(prefix, 'package.json')))
- if (typeof pkg.name !== 'string') return ''
- var sep = pkg.name.indexOf('/')
- if (sep === -1) return ''
- return pkg.name.slice(0, sep)
- } catch (ex) {
- return ''
- }
- }
-})()
diff --git a/deps/node/deps/npm/lib/org.js b/deps/node/deps/npm/lib/org.js
deleted file mode 100644
index d8f857e3..00000000
--- a/deps/node/deps/npm/lib/org.js
+++ /dev/null
@@ -1,151 +0,0 @@
-'use strict'
-
-const figgyPudding = require('figgy-pudding')
-const liborg = require('libnpm/org')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const otplease = require('./utils/otplease.js')
-const Table = require('cli-table3')
-
-module.exports = org
-
-org.subcommands = ['set', 'rm', 'ls']
-
-org.usage =
- 'npm org set orgname username [developer | admin | owner]\n' +
- 'npm org rm orgname username\n' +
- 'npm org ls orgname [<username>]'
-
-const OrgConfig = figgyPudding({
- json: {},
- loglevel: {},
- parseable: {},
- silent: {}
-})
-
-org.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
- if (argv.length === 2) {
- return cb(null, org.subcommands)
- }
- switch (argv[2]) {
- case 'ls':
- case 'add':
- case 'rm':
- case 'set':
- return cb(null, [])
- default:
- return cb(new Error(argv[2] + ' not recognized'))
- }
-}
-
-function UsageError () {
- throw Object.assign(new Error(org.usage), {code: 'EUSAGE'})
-}
-
-function org ([cmd, orgname, username, role], cb) {
- otplease(npmConfig(), opts => {
- opts = OrgConfig(opts)
- switch (cmd) {
- case 'add':
- case 'set':
- return orgSet(orgname, username, role, opts)
- case 'rm':
- return orgRm(orgname, username, opts)
- case 'ls':
- return orgList(orgname, username, opts)
- default:
- UsageError()
- }
- }).then(
- x => cb(null, x),
- err => cb(err.code === 'EUSAGE' ? err.message : err)
- )
-}
-
-function orgSet (org, user, role, opts) {
- role = role || 'developer'
- if (!org) {
- throw new Error('First argument `orgname` is required.')
- }
- if (!user) {
- throw new Error('Second argument `username` is required.')
- }
- if (!['owner', 'admin', 'developer'].find(x => x === role)) {
- throw new Error('Third argument `role` must be one of `owner`, `admin`, or `developer`, with `developer` being the default value if omitted.')
- }
- return liborg.set(org, user, role, opts).then(memDeets => {
- if (opts.json) {
- output(JSON.stringify(memDeets, null, 2))
- } else if (opts.parseable) {
- output(['org', 'orgsize', 'user', 'role'].join('\t'))
- output([
- memDeets.org.name,
- memDeets.org.size,
- memDeets.user,
- memDeets.role
- ])
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`Added ${memDeets.user} as ${memDeets.role} to ${memDeets.org.name}. You now ${memDeets.org.size} member${memDeets.org.size === 1 ? '' : 's'} in this org.`)
- }
- return memDeets
- })
-}
-
-function orgRm (org, user, opts) {
- if (!org) {
- throw new Error('First argument `orgname` is required.')
- }
- if (!user) {
- throw new Error('Second argument `username` is required.')
- }
- return liborg.rm(org, user, opts).then(() => {
- return liborg.ls(org, opts)
- }).then(roster => {
- user = user.replace(/^[~@]?/, '')
- org = org.replace(/^[~@]?/, '')
- const userCount = Object.keys(roster).length
- if (opts.json) {
- output(JSON.stringify({
- user,
- org,
- userCount,
- deleted: true
- }))
- } else if (opts.parseable) {
- output(['user', 'org', 'userCount', 'deleted'].join('\t'))
- output([user, org, userCount, true].join('\t'))
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`Successfully removed ${user} from ${org}. You now have ${userCount} member${userCount === 1 ? '' : 's'} in this org.`)
- }
- })
-}
-
-function orgList (org, user, opts) {
- if (!org) {
- throw new Error('First argument `orgname` is required.')
- }
- return liborg.ls(org, opts).then(roster => {
- if (user) {
- const newRoster = {}
- if (roster[user]) {
- newRoster[user] = roster[user]
- }
- roster = newRoster
- }
- if (opts.json) {
- output(JSON.stringify(roster, null, 2))
- } else if (opts.parseable) {
- output(['user', 'role'].join('\t'))
- Object.keys(roster).forEach(user => {
- output([user, roster[user]].join('\t'))
- })
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- const table = new Table({head: ['user', 'role']})
- Object.keys(roster).sort().forEach(user => {
- table.push([user, roster[user]])
- })
- output(table.toString())
- }
- })
-}
diff --git a/deps/node/deps/npm/lib/outdated.js b/deps/node/deps/npm/lib/outdated.js
deleted file mode 100644
index ebd67fb6..00000000
--- a/deps/node/deps/npm/lib/outdated.js
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
-
-npm outdated [pkg]
-
-Does the following:
-
-1. check for a new version of pkg
-
-If no packages are specified, then run for all installed
-packages.
-
---parseable creates output like this:
-<fullpath>:<name@wanted>:<name@installed>:<name@latest>
-
-*/
-
-module.exports = outdated
-
-outdated.usage = 'npm outdated [[<@scope>/]<pkg> ...]'
-
-outdated.completion = require('./utils/completion/installed-deep.js')
-
-var os = require('os')
-var url = require('url')
-var path = require('path')
-var readPackageTree = require('read-package-tree')
-var asyncMap = require('slide').asyncMap
-var color = require('ansicolors')
-var styles = require('ansistyles')
-var table = require('text-table')
-var semver = require('semver')
-var npa = require('libnpm/parse-arg')
-var pickManifest = require('npm-pick-manifest')
-var fetchPackageMetadata = require('./fetch-package-metadata.js')
-var mutateIntoLogicalTree = require('./install/mutate-into-logical-tree.js')
-var npm = require('./npm.js')
-const npmConfig = require('./config/figgy-config.js')
-const figgyPudding = require('figgy-pudding')
-const packument = require('libnpm/packument')
-var long = npm.config.get('long')
-var isExtraneous = require('./install/is-extraneous.js')
-var computeMetadata = require('./install/deps.js').computeMetadata
-var computeVersionSpec = require('./install/deps.js').computeVersionSpec
-var moduleName = require('./utils/module-name.js')
-var output = require('./utils/output.js')
-var ansiTrim = require('./utils/ansi-trim')
-
-const OutdatedConfig = figgyPudding({
- also: {},
- color: {},
- depth: {},
- dev: 'development',
- development: {},
- global: {},
- json: {},
- only: {},
- parseable: {},
- prod: 'production',
- production: {},
- save: {},
- 'save-dev': {},
- 'save-optional': {}
-})
-
-function uniq (list) {
- // we maintain the array because we need an array, not iterator, return
- // value.
- var uniqed = []
- var seen = new Set()
- list.forEach(function (item) {
- if (seen.has(item)) return
- seen.add(item)
- uniqed.push(item)
- })
- return uniqed
-}
-
-function andComputeMetadata (next) {
- return function (er, tree) {
- if (er) return next(er)
- next(null, computeMetadata(tree))
- }
-}
-
-function outdated (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
- let opts = OutdatedConfig(npmConfig())
- var dir = path.resolve(npm.dir, '..')
-
- // default depth for `outdated` is 0 (cf. `ls`)
- if (opts.depth) opts = opts.concat({depth: 0})
-
- readPackageTree(dir, andComputeMetadata(function (er, tree) {
- if (!tree) return cb(er)
- mutateIntoLogicalTree(tree)
- outdated_(args, '', tree, {}, 0, opts, function (er, list) {
- list = uniq(list || []).sort(function (aa, bb) {
- return aa[0].path.localeCompare(bb[0].path) ||
- aa[1].localeCompare(bb[1])
- })
- if (er || silent || list.length === 0) return cb(er, list)
- if (opts.json) {
- output(makeJSON(list, opts))
- } else if (opts.parseable) {
- output(makeParseable(list, opts))
- } else {
- var outList = list.map(x => makePretty(x, opts))
- var outHead = [ 'Package',
- 'Current',
- 'Wanted',
- 'Latest',
- 'Location'
- ]
- if (long) outHead.push('Package Type', 'Homepage')
- var outTable = [outHead].concat(outList)
-
- if (opts.color) {
- outTable[0] = outTable[0].map(function (heading) {
- return styles.underline(heading)
- })
- }
-
- var tableOpts = {
- align: ['l', 'r', 'r', 'r', 'l'],
- stringLength: function (s) { return ansiTrim(s).length }
- }
- output(table(outTable, tableOpts))
- }
- process.exitCode = 1
- cb(null, list.map(function (item) { return [item[0].parent.path].concat(item.slice(1, 7)) }))
- })
- }))
-}
-
-// [[ dir, dep, has, want, latest, type ]]
-function makePretty (p, opts) {
- var depname = p[1]
- var has = p[2]
- var want = p[3]
- var latest = p[4]
- var type = p[6]
- var deppath = p[7]
- var homepage = p[0].package.homepage || ''
-
- var columns = [ depname,
- has || 'MISSING',
- want,
- latest,
- deppath
- ]
- if (long) {
- columns[5] = type
- columns[6] = homepage
- }
-
- if (opts.color) {
- columns[0] = color[has === want || want === 'linked' ? 'yellow' : 'red'](columns[0]) // dep
- columns[2] = color.green(columns[2]) // want
- columns[3] = color.magenta(columns[3]) // latest
- }
-
- return columns
-}
-
-function makeParseable (list) {
- return list.map(function (p) {
- var dep = p[0]
- var depname = p[1]
- var dir = dep.path
- var has = p[2]
- var want = p[3]
- var latest = p[4]
- var type = p[6]
-
- var out = [
- dir,
- depname + '@' + want,
- (has ? (depname + '@' + has) : 'MISSING'),
- depname + '@' + latest
- ]
- if (long) out.push(type, dep.package.homepage)
-
- return out.join(':')
- }).join(os.EOL)
-}
-
-function makeJSON (list, opts) {
- var out = {}
- list.forEach(function (p) {
- var dep = p[0]
- var depname = p[1]
- var dir = dep.path
- var has = p[2]
- var want = p[3]
- var latest = p[4]
- var type = p[6]
- if (!opts.global) {
- dir = path.relative(process.cwd(), dir)
- }
- out[depname] = { current: has,
- wanted: want,
- latest: latest,
- location: dir
- }
- if (long) {
- out[depname].type = type
- out[depname].homepage = dep.package.homepage
- }
- })
- return JSON.stringify(out, null, 2)
-}
-
-function outdated_ (args, path, tree, parentHas, depth, opts, cb) {
- if (!tree.package) tree.package = {}
- if (path && tree.package.name) path += ' > ' + tree.package.name
- if (!path && tree.package.name) path = tree.package.name
- if (depth > opts.depth) {
- return cb(null, [])
- }
- var types = {}
- var pkg = tree.package
-
- if (!tree.children) tree.children = []
-
- var deps = tree.error ? tree.children : tree.children.filter((child) => !isExtraneous(child))
-
- deps.forEach(function (dep) {
- types[moduleName(dep)] = 'dependencies'
- })
-
- Object.keys(tree.missingDeps || {}).forEach(function (name) {
- deps.push({
- package: { name: name },
- path: tree.path,
- parent: tree,
- isMissing: true
- })
- types[name] = 'dependencies'
- })
-
- // If we explicitly asked for dev deps OR we didn't ask for production deps
- // AND we asked to save dev-deps OR we didn't ask to save anything that's NOT
- // dev deps then…
- // (All the save checking here is because this gets called from npm-update currently
- // and that requires this logic around dev deps.)
- // FIXME: Refactor npm update to not be in terms of outdated.
- var dev = opts.dev || /^dev(elopment)?$/.test(opts.also)
- var prod = opts.production || /^prod(uction)?$/.test(opts.only)
- if (
- (dev || !prod) &&
- (
- opts['save-dev'] || (!opts.save && !opts['save-optional'])
- )
- ) {
- Object.keys(tree.missingDevDeps).forEach(function (name) {
- deps.push({
- package: { name: name },
- path: tree.path,
- parent: tree,
- isMissing: true
- })
- if (!types[name]) {
- types[name] = 'devDependencies'
- }
- })
- }
-
- if (opts['save-dev']) {
- deps = deps.filter(function (dep) { return pkg.devDependencies[moduleName(dep)] })
- deps.forEach(function (dep) {
- types[moduleName(dep)] = 'devDependencies'
- })
- } else if (opts.save) {
- // remove optional dependencies from dependencies during --save.
- deps = deps.filter(function (dep) { return !pkg.optionalDependencies[moduleName(dep)] })
- } else if (opts['save-optional']) {
- deps = deps.filter(function (dep) { return pkg.optionalDependencies[moduleName(dep)] })
- deps.forEach(function (dep) {
- types[moduleName(dep)] = 'optionalDependencies'
- })
- }
- var doUpdate = dev || (
- !prod &&
- !Object.keys(parentHas).length &&
- !opts.global
- )
- if (doUpdate) {
- Object.keys(pkg.devDependencies || {}).forEach(function (k) {
- if (!(k in parentHas)) {
- deps[k] = pkg.devDependencies[k]
- types[k] = 'devDependencies'
- }
- })
- }
-
- var has = Object.create(parentHas)
- tree.children.forEach(function (child) {
- if (child.package.name && child.package.private) {
- deps = deps.filter(function (dep) { return dep !== child })
- }
- has[child.package.name] = {
- version: child.isLink ? 'linked' : child.package.version,
- from: child.isLink ? 'file:' + child.path : child.package._from
- }
- })
-
- // now get what we should have, based on the dep.
- // if has[dep] !== shouldHave[dep], then cb with the data
- // otherwise dive into the folder
- asyncMap(deps, function (dep, cb) {
- var name = moduleName(dep)
- var required
- if (tree.package.dependencies && name in tree.package.dependencies) {
- required = tree.package.dependencies[name]
- } else if (tree.package.optionalDependencies && name in tree.package.optionalDependencies) {
- required = tree.package.optionalDependencies[name]
- } else if (tree.package.devDependencies && name in tree.package.devDependencies) {
- required = tree.package.devDependencies[name]
- } else if (has[name]) {
- required = computeVersionSpec(tree, dep)
- }
-
- if (!long) return shouldUpdate(args, dep, name, has, required, depth, path, opts, cb)
-
- shouldUpdate(args, dep, name, has, required, depth, path, opts, cb, types[name])
- }, cb)
-}
-
-function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, opts, cb, type) {
- // look up the most recent version.
- // if that's what we already have, or if it's not on the args list,
- // then dive into it. Otherwise, cb() with the data.
-
- // { version: , from: }
- var curr = has[dep]
-
- function skip (er) {
- // show user that no viable version can be found
- if (er) return cb(er)
- outdated_(args,
- pkgpath,
- tree,
- has,
- depth + 1,
- opts,
- cb)
- }
-
- function doIt (wanted, latest) {
- if (!long) {
- return cb(null, [[tree, dep, curr && curr.version, wanted, latest, req, null, pkgpath]])
- }
- cb(null, [[tree, dep, curr && curr.version, wanted, latest, req, type, pkgpath]])
- }
-
- if (args.length && args.indexOf(dep) === -1) return skip()
-
- if (tree.isLink && req == null) return skip()
-
- if (req == null || req === '') req = '*'
-
- var parsed = npa.resolve(dep, req)
- if (parsed.type === 'directory') {
- if (tree.isLink) {
- return skip()
- } else {
- return doIt('linked', 'linked')
- }
- } else if (parsed.type === 'git') {
- return doIt('git', 'git')
- } else if (parsed.type === 'file') {
- return updateLocalDeps()
- } else {
- return packument(dep, opts.concat({
- 'prefer-online': true
- })).nodeify(updateDeps)
- }
-
- function updateLocalDeps (latestRegistryVersion) {
- fetchPackageMetadata('file:' + parsed.fetchSpec, '.', (er, localDependency) => {
- if (er) return cb()
-
- var wanted = localDependency.version
- var latest = localDependency.version
-
- if (latestRegistryVersion) {
- latest = latestRegistryVersion
- if (semver.lt(wanted, latestRegistryVersion)) {
- wanted = latestRegistryVersion
- req = dep + '@' + latest
- }
- }
-
- if (!curr || curr.version !== wanted) {
- doIt(wanted, latest)
- } else {
- skip()
- }
- })
- }
-
- function updateDeps (er, d) {
- if (er) return cb(er)
-
- try {
- var l = pickManifest(d, 'latest')
- var m = pickManifest(d, req)
- } catch (er) {
- if (er.code === 'ETARGET') {
- return skip(er)
- } else {
- return skip()
- }
- }
-
- // check that the url origin hasn't changed (#1727) and that
- // there is no newer version available
- var dFromUrl = m._from && url.parse(m._from).protocol
- var cFromUrl = curr && curr.from && url.parse(curr.from).protocol
-
- if (!curr ||
- (dFromUrl && cFromUrl && m._from !== curr.from) ||
- m.version !== curr.version ||
- m.version !== l.version) {
- doIt(m.version, l.version)
- } else {
- skip()
- }
- }
-}
diff --git a/deps/node/deps/npm/lib/owner.js b/deps/node/deps/npm/lib/owner.js
deleted file mode 100644
index a64cb5e1..00000000
--- a/deps/node/deps/npm/lib/owner.js
+++ /dev/null
@@ -1,242 +0,0 @@
-module.exports = owner
-
-const BB = require('bluebird')
-
-const log = require('npmlog')
-const npa = require('libnpm/parse-arg')
-const npmConfig = require('./config/figgy-config.js')
-const npmFetch = require('libnpm/fetch')
-const output = require('./utils/output.js')
-const otplease = require('./utils/otplease.js')
-const packument = require('libnpm/packument')
-const readLocalPkg = BB.promisify(require('./utils/read-local-package.js'))
-const usage = require('./utils/usage')
-const whoami = BB.promisify(require('./whoami.js'))
-
-owner.usage = usage(
- 'owner',
- 'npm owner add <user> [<@scope>/]<pkg>' +
- '\nnpm owner rm <user> [<@scope>/]<pkg>' +
- '\nnpm owner ls [<@scope>/]<pkg>'
-)
-
-owner.completion = function (opts, cb) {
- const argv = opts.conf.argv.remain
- if (argv.length > 4) return cb()
- if (argv.length <= 2) {
- var subs = ['add', 'rm']
- if (opts.partialWord === 'l') subs.push('ls')
- else subs.push('ls', 'list')
- return cb(null, subs)
- }
- BB.try(() => {
- const opts = npmConfig()
- return whoami([], true).then(username => {
- const un = encodeURIComponent(username)
- let byUser, theUser
- switch (argv[2]) {
- case 'ls':
- // FIXME: there used to be registry completion here, but it stopped
- // making sense somewhere around 50,000 packages on the registry
- return
- case 'rm':
- if (argv.length > 3) {
- theUser = encodeURIComponent(argv[3])
- byUser = `/-/by-user/${theUser}|${un}`
- return npmFetch.json(byUser, opts).then(d => {
- return d[theUser].filter(
- // kludge for server adminery.
- p => un === 'isaacs' || d[un].indexOf(p) === -1
- )
- })
- }
- // else fallthrough
- /* eslint no-fallthrough:0 */
- case 'add':
- if (argv.length > 3) {
- theUser = encodeURIComponent(argv[3])
- byUser = `/-/by-user/${theUser}|${un}`
- return npmFetch.json(byUser, opts).then(d => {
- var mine = d[un] || []
- var theirs = d[theUser] || []
- return mine.filter(p => theirs.indexOf(p) === -1)
- })
- } else {
- // just list all users who aren't me.
- return npmFetch.json('/-/users', opts).then(list => {
- return Object.keys(list).filter(n => n !== un)
- })
- }
-
- default:
- return cb()
- }
- })
- }).nodeify(cb)
-}
-
-function UsageError () {
- throw Object.assign(new Error(owner.usage), {code: 'EUSAGE'})
-}
-
-function owner ([action, ...args], cb) {
- const opts = npmConfig()
- BB.try(() => {
- switch (action) {
- case 'ls': case 'list': return ls(args[0], opts)
- case 'add': return add(args[0], args[1], opts)
- case 'rm': case 'remove': return rm(args[0], args[1], opts)
- default: UsageError()
- }
- }).then(
- data => cb(null, data),
- err => err.code === 'EUSAGE' ? cb(err.message) : cb(err)
- )
-}
-
-function ls (pkg, opts) {
- if (!pkg) {
- return readLocalPkg().then(pkg => {
- if (!pkg) { UsageError() }
- return ls(pkg, opts)
- })
- }
-
- const spec = npa(pkg)
- return packument(spec, opts.concat({fullMetadata: true})).then(
- data => {
- var owners = data.maintainers
- if (!owners || !owners.length) {
- output('admin party!')
- } else {
- output(owners.map(o => `${o.name} <${o.email}>`).join('\n'))
- }
- return owners
- },
- err => {
- log.error('owner ls', "Couldn't get owner data", pkg)
- throw err
- }
- )
-}
-
-function add (user, pkg, opts) {
- if (!user) { UsageError() }
- if (!pkg) {
- return readLocalPkg().then(pkg => {
- if (!pkg) { UsageError() }
- return add(user, pkg, opts)
- })
- }
- log.verbose('owner add', '%s to %s', user, pkg)
-
- const spec = npa(pkg)
- return withMutation(spec, user, opts, (u, owners) => {
- if (!owners) owners = []
- for (var i = 0, l = owners.length; i < l; i++) {
- var o = owners[i]
- if (o.name === u.name) {
- log.info(
- 'owner add',
- 'Already a package owner: ' + o.name + ' <' + o.email + '>'
- )
- return false
- }
- }
- owners.push(u)
- return owners
- })
-}
-
-function rm (user, pkg, opts) {
- if (!user) { UsageError() }
- if (!pkg) {
- return readLocalPkg().then(pkg => {
- if (!pkg) { UsageError() }
- return add(user, pkg, opts)
- })
- }
- log.verbose('owner rm', '%s from %s', user, pkg)
-
- const spec = npa(pkg)
- return withMutation(spec, user, opts, function (u, owners) {
- let found = false
- const m = owners.filter(function (o) {
- var match = (o.name === user)
- found = found || match
- return !match
- })
-
- if (!found) {
- log.info('owner rm', 'Not a package owner: ' + user)
- return false
- }
-
- if (!m.length) {
- throw new Error(
- 'Cannot remove all owners of a package. Add someone else first.'
- )
- }
-
- return m
- })
-}
-
-function withMutation (spec, user, opts, mutation) {
- return BB.try(() => {
- if (user) {
- const uri = `/-/user/org.couchdb.user:${encodeURIComponent(user)}`
- return npmFetch.json(uri, opts).then(mutate_, err => {
- log.error('owner mutate', 'Error getting user data for %s', user)
- throw err
- })
- } else {
- return mutate_(null)
- }
- })
-
- function mutate_ (u) {
- if (user && (!u || u.error)) {
- throw new Error(
- "Couldn't get user data for " + user + ': ' + JSON.stringify(u)
- )
- }
-
- if (u) u = { name: u.name, email: u.email }
- return packument(spec, opts.concat({
- fullMetadata: true
- })).then(data => {
- // save the number of maintainers before mutation so that we can figure
- // out if maintainers were added or removed
- const beforeMutation = data.maintainers.length
-
- const m = mutation(u, data.maintainers)
- if (!m) return // handled
- if (m instanceof Error) throw m // error
-
- data = {
- _id: data._id,
- _rev: data._rev,
- maintainers: m
- }
- const dataPath = `/${spec.escapedName}/-rev/${encodeURIComponent(data._rev)}`
- return otplease(opts, opts => {
- const reqOpts = opts.concat({
- method: 'PUT',
- body: data,
- spec
- })
- return npmFetch.json(dataPath, reqOpts)
- }).then(data => {
- if (data.error) {
- throw new Error('Failed to update package metadata: ' + JSON.stringify(data))
- } else if (m.length > beforeMutation) {
- output('+ %s (%s)', user, spec.name)
- } else if (m.length < beforeMutation) {
- output('- %s (%s)', user, spec.name)
- }
- return data
- })
- })
- }
-}
diff --git a/deps/node/deps/npm/lib/pack.js b/deps/node/deps/npm/lib/pack.js
deleted file mode 100644
index 78e5bfd1..00000000
--- a/deps/node/deps/npm/lib/pack.js
+++ /dev/null
@@ -1,361 +0,0 @@
-'use strict'
-
-// npm pack <pkg>
-// Packs the specified package into a .tgz file, which can then
-// be installed.
-
-const BB = require('bluebird')
-
-const byteSize = require('byte-size')
-const cacache = require('cacache')
-const columnify = require('columnify')
-const cp = require('child_process')
-const deprCheck = require('./utils/depr-check')
-const fpm = require('./fetch-package-metadata')
-const fs = require('graceful-fs')
-const install = require('./install')
-const lifecycle = BB.promisify(require('./utils/lifecycle'))
-const log = require('npmlog')
-const move = require('move-concurrently')
-const npm = require('./npm')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output')
-const pacote = require('pacote')
-const path = require('path')
-const PassThrough = require('stream').PassThrough
-const pathIsInside = require('path-is-inside')
-const pipe = BB.promisify(require('mississippi').pipe)
-const prepublishWarning = require('./utils/warn-deprecated')('prepublish-on-install')
-const pinflight = require('promise-inflight')
-const readJson = BB.promisify(require('read-package-json'))
-const tar = require('tar')
-const packlist = require('npm-packlist')
-const ssri = require('ssri')
-
-pack.usage = 'npm pack [[<@scope>/]<pkg>...] [--dry-run]'
-
-// if it can be installed, it can be packed.
-pack.completion = install.completion
-
-module.exports = pack
-function pack (args, silent, cb) {
- const cwd = process.cwd()
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
-
- if (args.length === 0) args = ['.']
-
- BB.all(
- args.map((arg) => pack_(arg, cwd))
- ).then((tarballs) => {
- if (!silent && npm.config.get('json')) {
- output(JSON.stringify(tarballs, null, 2))
- } else if (!silent) {
- tarballs.forEach(logContents)
- output(tarballs.map((f) => path.relative(cwd, f.filename)).join('\n'))
- }
- return tarballs
- }).nodeify(cb)
-}
-
-function pack_ (pkg, dir) {
- return BB.fromNode((cb) => fpm(pkg, dir, cb)).then((mani) => {
- let name = mani.name[0] === '@'
- // scoped packages get special treatment
- ? mani.name.substr(1).replace(/\//g, '-')
- : mani.name
- const target = `${name}-${mani.version}.tgz`
- return pinflight(target, () => {
- const dryRun = npm.config.get('dry-run')
- if (mani._requested.type === 'directory') {
- return prepareDirectory(mani._resolved)
- .then(() => {
- return packDirectory(mani, mani._resolved, target, target, true, dryRun)
- })
- } else if (dryRun) {
- log.verbose('pack', '--dry-run mode enabled. Skipping write.')
- return cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'packing'}, (tmp) => {
- const tmpTarget = path.join(tmp, path.basename(target))
- return packFromPackage(pkg, tmpTarget, target)
- })
- } else {
- return packFromPackage(pkg, target, target)
- }
- })
- })
-}
-
-function packFromPackage (arg, target, filename) {
- const opts = npmConfig()
- return pacote.tarball.toFile(arg, target, opts)
- .then(() => cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'unpacking'}, (tmp) => {
- const tmpTarget = path.join(tmp, filename)
- return pacote.extract(arg, tmpTarget, opts)
- .then(() => readJson(path.join(tmpTarget, 'package.json')))
- }))
- .then((pkg) => getContents(pkg, target, filename))
-}
-
-module.exports.prepareDirectory = prepareDirectory
-function prepareDirectory (dir) {
- return readJson(path.join(dir, 'package.json')).then((pkg) => {
- if (!pkg.name) {
- throw new Error('package.json requires a "name" field')
- }
- if (!pkg.version) {
- throw new Error('package.json requires a valid "version" field')
- }
- if (!pathIsInside(dir, npm.tmp)) {
- if (pkg.scripts && pkg.scripts.prepublish) {
- prepublishWarning([
- 'As of npm@5, `prepublish` scripts are deprecated.',
- 'Use `prepare` for build steps and `prepublishOnly` for upload-only.',
- 'See the deprecation note in `npm help scripts` for more information.'
- ])
- }
- if (npm.config.get('ignore-prepublish')) {
- return lifecycle(pkg, 'prepare', dir).then(() => pkg)
- } else {
- return lifecycle(pkg, 'prepublish', dir).then(() => {
- return lifecycle(pkg, 'prepare', dir)
- }).then(() => pkg)
- }
- }
- return pkg
- })
-}
-
-module.exports.packDirectory = packDirectory
-function packDirectory (mani, dir, target, filename, logIt, dryRun) {
- deprCheck(mani)
- return readJson(path.join(dir, 'package.json')).then((pkg) => {
- return lifecycle(pkg, 'prepack', dir)
- }).then(() => {
- return readJson(path.join(dir, 'package.json'))
- }).then((pkg) => {
- return cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'packing'}, (tmp) => {
- const tmpTarget = path.join(tmp, path.basename(target))
-
- const tarOpt = {
- file: tmpTarget,
- cwd: dir,
- prefix: 'package/',
- portable: true,
- // Provide a specific date in the 1980s for the benefit of zip,
- // which is confounded by files dated at the Unix epoch 0.
- mtime: new Date('1985-10-26T08:15:00.000Z'),
- gzip: true
- }
-
- return BB.resolve(packlist({ path: dir }))
- // NOTE: node-tar does some Magic Stuff depending on prefixes for files
- // specifically with @ signs, so we just neutralize that one
- // and any such future "features" by prepending `./`
- .then((files) => tar.create(tarOpt, files.map((f) => `./${f}`)))
- .then(() => getContents(pkg, tmpTarget, filename, logIt))
- // thread the content info through
- .tap(() => {
- if (dryRun) {
- log.verbose('pack', '--dry-run mode enabled. Skipping write.')
- } else {
- return move(tmpTarget, target, {Promise: BB, fs})
- }
- })
- .tap(() => lifecycle(pkg, 'postpack', dir))
- })
- })
-}
-
-module.exports.logContents = logContents
-function logContents (tarball) {
- log.notice('')
- log.notice('', `${npm.config.get('unicode') ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`)
- log.notice('=== Tarball Contents ===')
- if (tarball.files.length) {
- log.notice('', columnify(tarball.files.map((f) => {
- const bytes = byteSize(f.size)
- return {path: f.path, size: `${bytes.value}${bytes.unit}`}
- }), {
- include: ['size', 'path'],
- showHeaders: false
- }))
- }
- if (tarball.bundled.length) {
- log.notice('=== Bundled Dependencies ===')
- tarball.bundled.forEach((name) => log.notice('', name))
- }
- log.notice('=== Tarball Details ===')
- log.notice('', columnify([
- {name: 'name:', value: tarball.name},
- {name: 'version:', value: tarball.version},
- tarball.filename && {name: 'filename:', value: tarball.filename},
- {name: 'package size:', value: byteSize(tarball.size)},
- {name: 'unpacked size:', value: byteSize(tarball.unpackedSize)},
- {name: 'shasum:', value: tarball.shasum},
- {
- name: 'integrity:',
- value: tarball.integrity.toString().substr(0, 20) + '[...]' + tarball.integrity.toString().substr(80)},
- tarball.bundled.length && {name: 'bundled deps:', value: tarball.bundled.length},
- tarball.bundled.length && {name: 'bundled files:', value: tarball.entryCount - tarball.files.length},
- tarball.bundled.length && {name: 'own files:', value: tarball.files.length},
- {name: 'total files:', value: tarball.entryCount}
- ].filter((x) => x), {
- include: ['name', 'value'],
- showHeaders: false
- }))
- log.notice('', '')
-}
-
-module.exports.getContents = getContents
-function getContents (pkg, target, filename, silent) {
- const bundledWanted = new Set(
- pkg.bundleDependencies ||
- pkg.bundledDependencies ||
- []
- )
- const files = []
- const bundled = new Set()
- let totalEntries = 0
- let totalEntrySize = 0
- return tar.t({
- file: target,
- onentry (entry) {
- totalEntries++
- totalEntrySize += entry.size
- const p = entry.path
- if (p.startsWith('package/node_modules/')) {
- const name = p.match(/^package\/node_modules\/((?:@[^/]+\/)?[^/]+)/)[1]
- if (bundledWanted.has(name)) {
- bundled.add(name)
- }
- } else {
- files.push({
- path: entry.path.replace(/^package\//, ''),
- size: entry.size,
- mode: entry.mode
- })
- }
- },
- strip: 1
- })
- .then(() => BB.all([
- BB.fromNode((cb) => fs.stat(target, cb)),
- ssri.fromStream(fs.createReadStream(target), {
- algorithms: ['sha1', 'sha512']
- })
- ]))
- .then(([stat, integrity]) => {
- const shasum = integrity['sha1'][0].hexDigest()
- return {
- id: pkg._id,
- name: pkg.name,
- version: pkg.version,
- from: pkg._from,
- size: stat.size,
- unpackedSize: totalEntrySize,
- shasum,
- integrity: ssri.parse(integrity['sha512'][0]),
- filename,
- files,
- entryCount: totalEntries,
- bundled: Array.from(bundled)
- }
- })
-}
-
-const PASSTHROUGH_OPTS = [
- 'always-auth',
- 'auth-type',
- 'ca',
- 'cafile',
- 'cert',
- 'git',
- 'local-address',
- 'maxsockets',
- 'offline',
- 'prefer-offline',
- 'prefer-online',
- 'proxy',
- 'https-proxy',
- 'registry',
- 'send-metrics',
- 'sso-poll-frequency',
- 'sso-type',
- 'strict-ssl'
-]
-
-module.exports.packGitDep = packGitDep
-function packGitDep (manifest, dir) {
- const stream = new PassThrough()
- readJson(path.join(dir, 'package.json')).then((pkg) => {
- if (pkg.scripts && pkg.scripts.prepare) {
- log.verbose('prepareGitDep', `${manifest._spec}: installing devDeps and running prepare script.`)
- const cliArgs = PASSTHROUGH_OPTS.reduce((acc, opt) => {
- if (npm.config.get(opt, 'cli') != null) {
- acc.push(`--${opt}=${npm.config.get(opt)}`)
- }
- return acc
- }, [])
- const child = cp.spawn(process.env.NODE || process.execPath, [
- require.resolve('../bin/npm-cli.js'),
- 'install',
- '--dev',
- '--prod',
- '--ignore-prepublish',
- '--no-progress',
- '--no-save'
- ].concat(cliArgs), {
- cwd: dir,
- env: process.env
- })
- let errData = []
- let errDataLen = 0
- let outData = []
- let outDataLen = 0
- child.stdout.on('data', (data) => {
- outData.push(data)
- outDataLen += data.length
- log.gauge.pulse('preparing git package')
- })
- child.stderr.on('data', (data) => {
- errData.push(data)
- errDataLen += data.length
- log.gauge.pulse('preparing git package')
- })
- return BB.fromNode((cb) => {
- child.on('error', cb)
- child.on('exit', (code, signal) => {
- if (code > 0) {
- const err = new Error(`${signal}: npm exited with code ${code} while attempting to build ${manifest._requested}. Clone the repository manually and run 'npm install' in it for more information.`)
- err.code = code
- err.signal = signal
- cb(err)
- } else {
- cb()
- }
- })
- }).then(() => {
- if (outDataLen > 0) log.silly('prepareGitDep', '1>', Buffer.concat(outData, outDataLen).toString())
- if (errDataLen > 0) log.silly('prepareGitDep', '2>', Buffer.concat(errData, errDataLen).toString())
- }, (err) => {
- if (outDataLen > 0) log.error('prepareGitDep', '1>', Buffer.concat(outData, outDataLen).toString())
- if (errDataLen > 0) log.error('prepareGitDep', '2>', Buffer.concat(errData, errDataLen).toString())
- throw err
- })
- }
- }).then(() => {
- return readJson(path.join(dir, 'package.json'))
- }).then((pkg) => {
- return cacache.tmp.withTmp(npm.tmp, {
- tmpPrefix: 'pacote-packing'
- }, (tmp) => {
- const tmpTar = path.join(tmp, 'package.tgz')
- return packDirectory(manifest, dir, tmpTar).then(() => {
- return pipe(fs.createReadStream(tmpTar), stream)
- })
- })
- }).catch((err) => stream.emit('error', err))
- return stream
-}
diff --git a/deps/node/deps/npm/lib/ping.js b/deps/node/deps/npm/lib/ping.js
deleted file mode 100644
index 3023bab0..00000000
--- a/deps/node/deps/npm/lib/ping.js
+++ /dev/null
@@ -1,47 +0,0 @@
-'use strict'
-
-const npmConfig = require('./config/figgy-config.js')
-const fetch = require('libnpm/fetch')
-const figgyPudding = require('figgy-pudding')
-const log = require('npmlog')
-const npm = require('./npm.js')
-const output = require('./utils/output.js')
-
-const PingConfig = figgyPudding({
- json: {},
- registry: {}
-})
-
-module.exports = ping
-
-ping.usage = 'npm ping\nping registry'
-
-function ping (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
-
- const opts = PingConfig(npmConfig())
- const registry = opts.registry
- log.notice('PING', registry)
- const start = Date.now()
- return fetch('/-/ping?write=true', opts).then(
- res => res.json().catch(() => ({}))
- ).then(details => {
- if (silent) {
- } else {
- const time = Date.now() - start
- log.notice('PONG', `${time / 1000}ms`)
- if (npm.config.get('json')) {
- output(JSON.stringify({
- registry,
- time,
- details
- }, null, 2))
- } else if (Object.keys(details).length) {
- log.notice('PONG', `${JSON.stringify(details, null, 2)}`)
- }
- }
- }).nodeify(cb)
-}
diff --git a/deps/node/deps/npm/lib/prefix.js b/deps/node/deps/npm/lib/prefix.js
deleted file mode 100644
index fb20389c..00000000
--- a/deps/node/deps/npm/lib/prefix.js
+++ /dev/null
@@ -1,15 +0,0 @@
-module.exports = prefix
-
-var npm = require('./npm.js')
-var output = require('./utils/output.js')
-
-prefix.usage = 'npm prefix [-g]'
-
-function prefix (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
- if (!silent) output(npm.prefix)
- process.nextTick(cb.bind(this, null, npm.prefix))
-}
diff --git a/deps/node/deps/npm/lib/profile.js b/deps/node/deps/npm/lib/profile.js
deleted file mode 100644
index 7ce9cb5c..00000000
--- a/deps/node/deps/npm/lib/profile.js
+++ /dev/null
@@ -1,334 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const ansistyles = require('ansistyles')
-const figgyPudding = require('figgy-pudding')
-const inspect = require('util').inspect
-const log = require('npmlog')
-const npm = require('./npm.js')
-const npmConfig = require('./config/figgy-config.js')
-const otplease = require('./utils/otplease.js')
-const output = require('./utils/output.js')
-const profile = require('libnpm/profile')
-const pulseTillDone = require('./utils/pulse-till-done.js')
-const qrcodeTerminal = require('qrcode-terminal')
-const queryString = require('query-string')
-const qw = require('qw')
-const readUserInfo = require('./utils/read-user-info.js')
-const Table = require('cli-table3')
-const url = require('url')
-
-module.exports = profileCmd
-
-profileCmd.usage =
- 'npm profile enable-2fa [auth-only|auth-and-writes]\n' +
- 'npm profile disable-2fa\n' +
- 'npm profile get [<key>]\n' +
- 'npm profile set <key> <value>'
-
-profileCmd.subcommands = qw`enable-2fa disable-2fa get set`
-
-profileCmd.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
- switch (argv[2]) {
- case 'enable-2fa':
- case 'enable-tfa':
- if (argv.length === 3) {
- return cb(null, qw`auth-and-writes auth-only`)
- } else {
- return cb(null, [])
- }
- case 'disable-2fa':
- case 'disable-tfa':
- case 'get':
- case 'set':
- return cb(null, [])
- default:
- return cb(new Error(argv[2] + ' not recognized'))
- }
-}
-
-function withCb (prom, cb) {
- prom.then((value) => cb(null, value), cb)
-}
-
-const ProfileOpts = figgyPudding({
- json: {},
- otp: {},
- parseable: {},
- registry: {}
-})
-
-function profileCmd (args, cb) {
- if (args.length === 0) return cb(new Error(profileCmd.usage))
- log.gauge.show('profile')
- switch (args[0]) {
- case 'enable-2fa':
- case 'enable-tfa':
- case 'enable2fa':
- case 'enabletfa':
- withCb(enable2fa(args.slice(1)), cb)
- break
- case 'disable-2fa':
- case 'disable-tfa':
- case 'disable2fa':
- case 'disabletfa':
- withCb(disable2fa(), cb)
- break
- case 'get':
- withCb(get(args.slice(1)), cb)
- break
- case 'set':
- withCb(set(args.slice(1)), cb)
- break
- default:
- cb(new Error('Unknown profile command: ' + args[0]))
- }
-}
-
-const knownProfileKeys = qw`
- name email ${'two-factor auth'} fullname homepage
- freenode twitter github created updated`
-
-function get (args) {
- const tfa = 'two-factor auth'
- const conf = ProfileOpts(npmConfig())
- return pulseTillDone.withPromise(profile.get(conf)).then((info) => {
- if (!info.cidr_whitelist) delete info.cidr_whitelist
- if (conf.json) {
- output(JSON.stringify(info, null, 2))
- return
- }
- const cleaned = {}
- knownProfileKeys.forEach((k) => { cleaned[k] = info[k] || '' })
- Object.keys(info).filter((k) => !(k in cleaned)).forEach((k) => { cleaned[k] = info[k] || '' })
- delete cleaned.tfa
- delete cleaned.email_verified
- cleaned['email'] += info.email_verified ? ' (verified)' : '(unverified)'
- if (info.tfa && !info.tfa.pending) {
- cleaned[tfa] = info.tfa.mode
- } else {
- cleaned[tfa] = 'disabled'
- }
- if (args.length) {
- const values = args // comma or space separated ↓
- .join(',').split(/,/).map((arg) => arg.trim()).filter((arg) => arg !== '')
- .map((arg) => cleaned[arg])
- .join('\t')
- output(values)
- } else {
- if (conf.parseable) {
- Object.keys(info).forEach((key) => {
- if (key === 'tfa') {
- output(`${key}\t${cleaned[tfa]}`)
- } else {
- output(`${key}\t${info[key]}`)
- }
- })
- } else {
- const table = new Table()
- Object.keys(cleaned).forEach((k) => table.push({[ansistyles.bright(k)]: cleaned[k]}))
- output(table.toString())
- }
- }
- })
-}
-
-const writableProfileKeys = qw`
- email password fullname homepage freenode twitter github`
-
-function set (args) {
- let conf = ProfileOpts(npmConfig())
- const prop = (args[0] || '').toLowerCase().trim()
- let value = args.length > 1 ? args.slice(1).join(' ') : null
- if (prop !== 'password' && value === null) {
- return Promise.reject(Error('npm profile set <prop> <value>'))
- }
- if (prop === 'password' && value !== null) {
- return Promise.reject(Error(
- 'npm profile set password\n' +
- 'Do not include your current or new passwords on the command line.'))
- }
- if (writableProfileKeys.indexOf(prop) === -1) {
- return Promise.reject(Error(`"${prop}" is not a property we can set. Valid properties are: ` + writableProfileKeys.join(', ')))
- }
- return BB.try(() => {
- if (prop === 'password') {
- return readUserInfo.password('Current password: ').then((current) => {
- return readPasswords().then((newpassword) => {
- value = {old: current, new: newpassword}
- })
- })
- } else if (prop === 'email') {
- return readUserInfo.password('Password: ').then((current) => {
- return {password: current, email: value}
- })
- }
- function readPasswords () {
- return readUserInfo.password('New password: ').then((password1) => {
- return readUserInfo.password(' Again: ').then((password2) => {
- if (password1 !== password2) {
- log.warn('profile', 'Passwords do not match, please try again.')
- return readPasswords()
- }
- return password1
- })
- })
- }
- }).then(() => {
- // FIXME: Work around to not clear everything other than what we're setting
- return pulseTillDone.withPromise(profile.get(conf).then((user) => {
- const newUser = {}
- writableProfileKeys.forEach((k) => { newUser[k] = user[k] })
- newUser[prop] = value
- return otplease(conf, conf => profile.set(newUser, conf))
- .then((result) => {
- if (conf.json) {
- output(JSON.stringify({[prop]: result[prop]}, null, 2))
- } else if (conf.parseable) {
- output(prop + '\t' + result[prop])
- } else if (result[prop] != null) {
- output('Set', prop, 'to', result[prop])
- } else {
- output('Set', prop)
- }
- })
- }))
- })
-}
-
-function enable2fa (args) {
- if (args.length > 1) {
- return Promise.reject(new Error('npm profile enable-2fa [auth-and-writes|auth-only]'))
- }
- const mode = args[0] || 'auth-and-writes'
- if (mode !== 'auth-only' && mode !== 'auth-and-writes') {
- return Promise.reject(new Error(`Invalid two-factor authentication mode "${mode}".\n` +
- 'Valid modes are:\n' +
- ' auth-only - Require two-factor authentication only when logging in\n' +
- ' auth-and-writes - Require two-factor authentication when logging in AND when publishing'))
- }
- const conf = ProfileOpts(npmConfig())
- if (conf.json || conf.parseable) {
- return Promise.reject(new Error(
- 'Enabling two-factor authentication is an interactive operation and ' +
- (conf.json ? 'JSON' : 'parseable') + ' output mode is not available'))
- }
-
- const info = {
- tfa: {
- mode: mode
- }
- }
-
- return BB.try(() => {
- // if they're using legacy auth currently then we have to update them to a
- // bearer token before continuing.
- const auth = getAuth(conf)
- if (auth.basic) {
- log.info('profile', 'Updating authentication to bearer token')
- return profile.createToken(
- auth.basic.password, false, [], conf
- ).then((result) => {
- if (!result.token) throw new Error('Your registry ' + conf.registry + 'does not seem to support bearer tokens. Bearer tokens are required for two-factor authentication')
- npm.config.setCredentialsByURI(conf.registry, {token: result.token})
- return BB.fromNode((cb) => npm.config.save('user', cb))
- })
- }
- }).then(() => {
- log.notice('profile', 'Enabling two factor authentication for ' + mode)
- return readUserInfo.password()
- }).then((password) => {
- info.tfa.password = password
- log.info('profile', 'Determine if tfa is pending')
- return pulseTillDone.withPromise(profile.get(conf)).then((info) => {
- if (!info.tfa) return
- if (info.tfa.pending) {
- log.info('profile', 'Resetting two-factor authentication')
- return pulseTillDone.withPromise(profile.set({tfa: {password, mode: 'disable'}}, conf))
- } else {
- if (conf.auth.otp) return
- return readUserInfo.otp('Enter one-time password from your authenticator app: ').then((otp) => {
- conf.auth.otp = otp
- })
- }
- })
- }).then(() => {
- log.info('profile', 'Setting two-factor authentication to ' + mode)
- return pulseTillDone.withPromise(profile.set(info, conf))
- }).then((challenge) => {
- if (challenge.tfa === null) {
- output('Two factor authentication mode changed to: ' + mode)
- return
- }
- if (typeof challenge.tfa !== 'string' || !/^otpauth:[/][/]/.test(challenge.tfa)) {
- throw new Error('Unknown error enabling two-factor authentication. Expected otpauth URL, got: ' + inspect(challenge.tfa))
- }
- const otpauth = url.parse(challenge.tfa)
- const opts = queryString.parse(otpauth.query)
- return qrcode(challenge.tfa).then((code) => {
- output('Scan into your authenticator app:\n' + code + '\n Or enter code:', opts.secret)
- }).then((code) => {
- return readUserInfo.otp('And an OTP code from your authenticator: ')
- }).then((otp1) => {
- log.info('profile', 'Finalizing two-factor authentication')
- return profile.set({tfa: [otp1]}, conf)
- }).then((result) => {
- output('2FA successfully enabled. Below are your recovery codes, please print these out.')
- output('You will need these to recover access to your account if you lose your authentication device.')
- result.tfa.forEach((c) => output('\t' + c))
- })
- })
-}
-
-function getAuth (conf) {
- const creds = npm.config.getCredentialsByURI(conf.registry)
- let auth
- if (creds.token) {
- auth = {token: creds.token}
- } else if (creds.username) {
- auth = {basic: {username: creds.username, password: creds.password}}
- } else if (creds.auth) {
- const basic = Buffer.from(creds.auth, 'base64').toString().split(':', 2)
- auth = {basic: {username: basic[0], password: basic[1]}}
- } else {
- auth = {}
- }
-
- if (conf.otp) auth.otp = conf.otp
- return auth
-}
-
-function disable2fa (args) {
- let conf = ProfileOpts(npmConfig())
- return pulseTillDone.withPromise(profile.get(conf)).then((info) => {
- if (!info.tfa || info.tfa.pending) {
- output('Two factor authentication not enabled.')
- return
- }
- return readUserInfo.password().then((password) => {
- return BB.try(() => {
- if (conf.otp) return
- return readUserInfo.otp('Enter one-time password from your authenticator: ').then((otp) => {
- conf = conf.concat({otp})
- })
- }).then(() => {
- log.info('profile', 'disabling tfa')
- return pulseTillDone.withPromise(profile.set({tfa: {password: password, mode: 'disable'}}, conf)).then(() => {
- if (conf.json) {
- output(JSON.stringify({tfa: false}, null, 2))
- } else if (conf.parseable) {
- output('tfa\tfalse')
- } else {
- output('Two factor authentication disabled.')
- }
- })
- })
- })
- })
-}
-
-function qrcode (url) {
- return new Promise((resolve) => qrcodeTerminal.generate(url, resolve))
-}
diff --git a/deps/node/deps/npm/lib/prune.js b/deps/node/deps/npm/lib/prune.js
deleted file mode 100644
index 010e471e..00000000
--- a/deps/node/deps/npm/lib/prune.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// prune extraneous packages.
-
-module.exports = prune
-module.exports.Pruner = Pruner
-
-prune.usage = 'npm prune [[<@scope>/]<pkg>...] [--production]'
-
-var npm = require('./npm.js')
-var log = require('npmlog')
-var util = require('util')
-var moduleName = require('./utils/module-name.js')
-var Installer = require('./install.js').Installer
-var isExtraneous = require('./install/is-extraneous.js')
-var isOnlyDev = require('./install/is-only-dev.js')
-var removeDeps = require('./install/deps.js').removeDeps
-var loadExtraneous = require('./install/deps.js').loadExtraneous
-var chain = require('slide').chain
-var computeMetadata = require('./install/deps.js').computeMetadata
-
-prune.completion = require('./utils/completion/installed-deep.js')
-
-function prune (args, cb) {
- var dryrun = !!npm.config.get('dry-run')
- new Pruner('.', dryrun, args).run(cb)
-}
-
-function Pruner (where, dryrun, args) {
- Installer.call(this, where, dryrun, args)
- this.autoPrune = true
-}
-util.inherits(Pruner, Installer)
-
-Pruner.prototype.loadAllDepsIntoIdealTree = function (cb) {
- log.silly('uninstall', 'loadAllDepsIntoIdealTree')
-
- var cg = this.progress['loadIdealTree:loadAllDepsIntoIdealTree']
- var steps = []
-
- computeMetadata(this.idealTree)
- var self = this
- var excludeDev = npm.config.get('production') || /^prod(uction)?$/.test(npm.config.get('only'))
- function shouldPrune (child) {
- if (isExtraneous(child)) return true
- if (!excludeDev) return false
- return isOnlyDev(child)
- }
- function getModuleName (child) {
- // wrapping because moduleName doesn't like extra args and we're called
- // from map.
- return moduleName(child)
- }
- function matchesArg (name) {
- return self.args.length === 0 || self.args.indexOf(name) !== -1
- }
- function nameObj (name) {
- return {name: name}
- }
- var toPrune = this.idealTree.children.filter(shouldPrune).map(getModuleName).filter(matchesArg).map(nameObj)
-
- steps.push(
- [removeDeps, toPrune, this.idealTree, null],
- [loadExtraneous, this.idealTree, cg.newGroup('loadExtraneous')])
- chain(steps, cb)
-}
-
-Pruner.prototype.runPreinstallTopLevelLifecycles = function (cb) { cb() }
-Pruner.prototype.runPostinstallTopLevelLifecycles = function (cb) { cb() }
-Pruner.prototype.saveToDependencies = function (cb) { cb() }
diff --git a/deps/node/deps/npm/lib/publish.js b/deps/node/deps/npm/lib/publish.js
deleted file mode 100644
index e81fc1a0..00000000
--- a/deps/node/deps/npm/lib/publish.js
+++ /dev/null
@@ -1,167 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const cacache = require('cacache')
-const figgyPudding = require('figgy-pudding')
-const libpub = require('libnpm/publish')
-const libunpub = require('libnpm/unpublish')
-const lifecycle = BB.promisify(require('./utils/lifecycle.js'))
-const log = require('npmlog')
-const npa = require('libnpm/parse-arg')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const otplease = require('./utils/otplease.js')
-const pack = require('./pack')
-const { tarball, extract } = require('libnpm')
-const path = require('path')
-const readFileAsync = BB.promisify(require('graceful-fs').readFile)
-const readJson = BB.promisify(require('read-package-json'))
-const semver = require('semver')
-const statAsync = BB.promisify(require('graceful-fs').stat)
-
-publish.usage = 'npm publish [<tarball>|<folder>] [--tag <tag>] [--access <public|restricted>] [--dry-run]' +
- "\n\nPublishes '.' if no argument supplied" +
- '\n\nSets tag `latest` if no --tag specified'
-
-publish.completion = function (opts, cb) {
- // publish can complete to a folder with a package.json
- // or a tarball, or a tarball url.
- // for now, not yet implemented.
- return cb()
-}
-
-const PublishConfig = figgyPudding({
- dryRun: 'dry-run',
- 'dry-run': { default: false },
- force: { default: false },
- json: { default: false },
- Promise: { default: () => Promise },
- tag: { default: 'latest' },
- tmp: {}
-})
-
-module.exports = publish
-function publish (args, isRetry, cb) {
- if (typeof cb !== 'function') {
- cb = isRetry
- isRetry = false
- }
- if (args.length === 0) args = ['.']
- if (args.length !== 1) return cb(publish.usage)
-
- log.verbose('publish', args)
-
- const opts = PublishConfig(npmConfig())
- const t = opts.tag.trim()
- if (semver.validRange(t)) {
- return cb(new Error('Tag name must not be a valid SemVer range: ' + t))
- }
-
- return publish_(args[0], opts)
- .then((tarball) => {
- const silent = log.level === 'silent'
- if (!silent && opts.json) {
- output(JSON.stringify(tarball, null, 2))
- } else if (!silent) {
- output(`+ ${tarball.id}`)
- }
- })
- .nodeify(cb)
-}
-
-function publish_ (arg, opts) {
- return statAsync(arg).then((stat) => {
- if (stat.isDirectory()) {
- return stat
- } else {
- const err = new Error('not a directory')
- err.code = 'ENOTDIR'
- throw err
- }
- }).then(() => {
- return publishFromDirectory(arg, opts)
- }, (err) => {
- if (err.code !== 'ENOENT' && err.code !== 'ENOTDIR') {
- throw err
- } else {
- return publishFromPackage(arg, opts)
- }
- })
-}
-
-function publishFromDirectory (arg, opts) {
- // All this readJson is because any of the given scripts might modify the
- // package.json in question, so we need to refresh after every step.
- let contents
- return pack.prepareDirectory(arg).then(() => {
- return readJson(path.join(arg, 'package.json'))
- }).then((pkg) => {
- return lifecycle(pkg, 'prepublishOnly', arg)
- }).then(() => {
- return readJson(path.join(arg, 'package.json'))
- }).then((pkg) => {
- return cacache.tmp.withTmp(opts.tmp, {tmpPrefix: 'fromDir'}, (tmpDir) => {
- const target = path.join(tmpDir, 'package.tgz')
- return pack.packDirectory(pkg, arg, target, null, true)
- .tap((c) => { contents = c })
- .then((c) => !opts.json && pack.logContents(c))
- .then(() => upload(pkg, false, target, opts))
- })
- }).then(() => {
- return readJson(path.join(arg, 'package.json'))
- }).tap((pkg) => {
- return lifecycle(pkg, 'publish', arg)
- }).tap((pkg) => {
- return lifecycle(pkg, 'postpublish', arg)
- })
- .then(() => contents)
-}
-
-function publishFromPackage (arg, opts) {
- return cacache.tmp.withTmp(opts.tmp, {tmpPrefix: 'fromPackage'}, tmp => {
- const extracted = path.join(tmp, 'package')
- const target = path.join(tmp, 'package.json')
- return tarball.toFile(arg, target, opts)
- .then(() => extract(arg, extracted, opts))
- .then(() => readJson(path.join(extracted, 'package.json')))
- .then((pkg) => {
- return BB.resolve(pack.getContents(pkg, target))
- .tap((c) => !opts.json && pack.logContents(c))
- .tap(() => upload(pkg, false, target, opts))
- })
- })
-}
-
-function upload (pkg, isRetry, cached, opts) {
- if (!opts.dryRun) {
- return readFileAsync(cached).then(tarball => {
- return otplease(opts, opts => {
- return libpub(pkg, tarball, opts)
- }).catch(err => {
- if (
- err.code === 'EPUBLISHCONFLICT' &&
- opts.force &&
- !isRetry
- ) {
- log.warn('publish', 'Forced publish over ' + pkg._id)
- return otplease(opts, opts => libunpub(
- npa.resolve(pkg.name, pkg.version), opts
- )).finally(() => {
- // ignore errors. Use the force. Reach out with your feelings.
- return otplease(opts, opts => {
- return upload(pkg, true, tarball, opts)
- }).catch(() => {
- // but if it fails again, then report the first error.
- throw err
- })
- })
- } else {
- throw err
- }
- })
- })
- } else {
- return opts.Promise.resolve(true)
- }
-}
diff --git a/deps/node/deps/npm/lib/rebuild.js b/deps/node/deps/npm/lib/rebuild.js
deleted file mode 100644
index bbc5e8f4..00000000
--- a/deps/node/deps/npm/lib/rebuild.js
+++ /dev/null
@@ -1,78 +0,0 @@
-
-module.exports = rebuild
-
-var readInstalled = require('read-installed')
-var semver = require('semver')
-var log = require('npmlog')
-var npm = require('./npm.js')
-var npa = require('npm-package-arg')
-var usage = require('./utils/usage')
-var output = require('./utils/output.js')
-
-rebuild.usage = usage(
- 'rebuild',
- 'npm rebuild [[<@scope>/<name>]...]'
-)
-
-rebuild.completion = require('./utils/completion/installed-deep.js')
-
-function rebuild (args, cb) {
- var opt = { depth: npm.config.get('depth'), dev: true }
- readInstalled(npm.prefix, opt, function (er, data) {
- log.info('readInstalled', typeof data)
- if (er) return cb(er)
- var set = filter(data, args)
- var folders = Object.keys(set).filter(function (f) {
- return f !== npm.prefix
- })
- if (!folders.length) return cb()
- log.silly('rebuild set', folders)
- cleanBuild(folders, set, cb)
- })
-}
-
-function cleanBuild (folders, set, cb) {
- npm.commands.build(folders, function (er) {
- if (er) return cb(er)
- output(folders.map(function (f) {
- return set[f] + ' ' + f
- }).join('\n'))
- cb()
- })
-}
-
-function filter (data, args, set, seen) {
- if (!set) set = {}
- if (!seen) seen = new Set()
- if (set.hasOwnProperty(data.path)) return set
- if (seen.has(data)) return set
- seen.add(data)
- var pass
- if (!args.length) pass = true // rebuild everything
- else if (data.name && data._id) {
- for (var i = 0, l = args.length; i < l; i++) {
- var arg = args[i]
- var nv = npa(arg)
- var n = nv.name
- var v = nv.rawSpec
- if (n !== data.name) continue
- if (!semver.satisfies(data.version, v, true)) continue
- pass = true
- break
- }
- }
- if (pass && data._id) {
- log.verbose('rebuild', 'path, id', [data.path, data._id])
- set[data.path] = data._id
- }
- // need to also dive through kids, always.
- // since this isn't an install these won't get auto-built unless
- // they're not dependencies.
- Object.keys(data.dependencies || {}).forEach(function (d) {
- // return
- var dep = data.dependencies[d]
- if (typeof dep === 'string') return
- filter(dep, args, set, seen)
- })
- return set
-}
diff --git a/deps/node/deps/npm/lib/repo.js b/deps/node/deps/npm/lib/repo.js
deleted file mode 100644
index b930402a..00000000
--- a/deps/node/deps/npm/lib/repo.js
+++ /dev/null
@@ -1,50 +0,0 @@
-module.exports = repo
-
-repo.usage = 'npm repo [<pkg>]'
-
-const openUrl = require('./utils/open-url')
-const hostedGitInfo = require('hosted-git-info')
-const url_ = require('url')
-const fetchPackageMetadata = require('./fetch-package-metadata.js')
-
-repo.completion = function (opts, cb) {
- // FIXME: there used to be registry completion here, but it stopped making
- // sense somewhere around 50,000 packages on the registry
- cb()
-}
-
-function repo (args, cb) {
- const n = args.length ? args[0] : '.'
- fetchPackageMetadata(n, '.', {fullMetadata: true}, function (er, d) {
- if (er) return cb(er)
- getUrlAndOpen(d, cb)
- })
-}
-
-function getUrlAndOpen (d, cb) {
- const r = d.repository
- if (!r) return cb(new Error('no repository'))
- // XXX remove this when npm@v1.3.10 from node 0.10 is deprecated
- // from https://github.com/npm/npm-www/issues/418
- const info = hostedGitInfo.fromUrl(r.url)
- const url = info ? info.browse() : unknownHostedUrl(r.url)
-
- if (!url) return cb(new Error('no repository: could not get url'))
-
- openUrl(url, 'repository available at the following URL', cb)
-}
-
-function unknownHostedUrl (url) {
- try {
- const idx = url.indexOf('@')
- if (idx !== -1) {
- url = url.slice(idx + 1).replace(/:([^\d]+)/, '/$1')
- }
- url = url_.parse(url)
- const protocol = url.protocol === 'https:'
- ? 'https:'
- : 'http:'
- return protocol + '//' + (url.host || '') +
- url.path.replace(/\.git$/, '')
- } catch (e) {}
-}
diff --git a/deps/node/deps/npm/lib/restart.js b/deps/node/deps/npm/lib/restart.js
deleted file mode 100644
index 41f9c3a7..00000000
--- a/deps/node/deps/npm/lib/restart.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./utils/lifecycle-cmd.js')('restart')
diff --git a/deps/node/deps/npm/lib/root.js b/deps/node/deps/npm/lib/root.js
deleted file mode 100644
index 82a804af..00000000
--- a/deps/node/deps/npm/lib/root.js
+++ /dev/null
@@ -1,15 +0,0 @@
-module.exports = root
-
-var npm = require('./npm.js')
-var output = require('./utils/output.js')
-
-root.usage = 'npm root [-g]'
-
-function root (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
- if (!silent) output(npm.dir)
- process.nextTick(cb.bind(this, null, npm.dir))
-}
diff --git a/deps/node/deps/npm/lib/run-script.js b/deps/node/deps/npm/lib/run-script.js
deleted file mode 100644
index 33025763..00000000
--- a/deps/node/deps/npm/lib/run-script.js
+++ /dev/null
@@ -1,185 +0,0 @@
-module.exports = runScript
-
-var lifecycle = require('./utils/lifecycle.js')
-var npm = require('./npm.js')
-var path = require('path')
-var readJson = require('read-package-json')
-var log = require('npmlog')
-var chain = require('slide').chain
-var usage = require('./utils/usage')
-var output = require('./utils/output.js')
-var didYouMean = require('./utils/did-you-mean')
-var isWindowsShell = require('./utils/is-windows-shell.js')
-
-runScript.usage = usage(
- 'run-script',
- 'npm run-script <command> [-- <args>...]'
-)
-
-runScript.completion = function (opts, cb) {
- // see if there's already a package specified.
- var argv = opts.conf.argv.remain
-
- if (argv.length >= 4) return cb()
-
- if (argv.length === 3) {
- // either specified a script locally, in which case, done,
- // or a package, in which case, complete against its scripts
- var json = path.join(npm.localPrefix, 'package.json')
- return readJson(json, function (er, d) {
- if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er)
- if (er) d = {}
- var scripts = Object.keys(d.scripts || {})
- console.error('local scripts', scripts)
- if (scripts.indexOf(argv[2]) !== -1) return cb()
- // ok, try to find out which package it was, then
- var pref = npm.config.get('global') ? npm.config.get('prefix')
- : npm.localPrefix
- var pkgDir = path.resolve(pref, 'node_modules', argv[2], 'package.json')
- readJson(pkgDir, function (er, d) {
- if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er)
- if (er) d = {}
- var scripts = Object.keys(d.scripts || {})
- return cb(null, scripts)
- })
- })
- }
-
- readJson(path.join(npm.localPrefix, 'package.json'), function (er, d) {
- if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er)
- d = d || {}
- cb(null, Object.keys(d.scripts || {}))
- })
-}
-
-function runScript (args, cb) {
- if (!args.length) return list(cb)
-
- var pkgdir = npm.localPrefix
- var cmd = args.shift()
-
- readJson(path.resolve(pkgdir, 'package.json'), function (er, d) {
- if (er) return cb(er)
- run(d, pkgdir, cmd, args, cb)
- })
-}
-
-function list (cb) {
- var json = path.join(npm.localPrefix, 'package.json')
- var cmdList = [
- 'publish',
- 'install',
- 'uninstall',
- 'test',
- 'stop',
- 'start',
- 'restart',
- 'version'
- ].reduce(function (l, p) {
- return l.concat(['pre' + p, p, 'post' + p])
- }, [])
- return readJson(json, function (er, d) {
- if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er)
- if (er) d = {}
- var allScripts = Object.keys(d.scripts || {})
- var scripts = []
- var runScripts = []
- allScripts.forEach(function (script) {
- if (cmdList.indexOf(script) !== -1) scripts.push(script)
- else runScripts.push(script)
- })
-
- if (log.level === 'silent') {
- return cb(null, allScripts)
- }
-
- if (npm.config.get('json')) {
- output(JSON.stringify(d.scripts || {}, null, 2))
- return cb(null, allScripts)
- }
-
- if (npm.config.get('parseable')) {
- allScripts.forEach(function (script) {
- output(script + ':' + d.scripts[script])
- })
- return cb(null, allScripts)
- }
-
- var s = '\n '
- var prefix = ' '
- if (scripts.length) {
- output('Lifecycle scripts included in %s:', d.name)
- }
- scripts.forEach(function (script) {
- output(prefix + script + s + d.scripts[script])
- })
- if (!scripts.length && runScripts.length) {
- output('Scripts available in %s via `npm run-script`:', d.name)
- } else if (runScripts.length) {
- output('\navailable via `npm run-script`:')
- }
- runScripts.forEach(function (script) {
- output(prefix + script + s + d.scripts[script])
- })
- return cb(null, allScripts)
- })
-}
-
-function run (pkg, wd, cmd, args, cb) {
- if (!pkg.scripts) pkg.scripts = {}
-
- var cmds
- if (cmd === 'restart' && !pkg.scripts.restart) {
- cmds = [
- 'prestop', 'stop', 'poststop',
- 'restart',
- 'prestart', 'start', 'poststart'
- ]
- } else {
- if (!pkg.scripts[cmd]) {
- if (cmd === 'test') {
- pkg.scripts.test = 'echo \'Error: no test specified\''
- } else if (cmd === 'env') {
- if (isWindowsShell) {
- log.verbose('run-script using default platform env: SET (Windows)')
- pkg.scripts[cmd] = 'SET'
- } else {
- log.verbose('run-script using default platform env: env (Unix)')
- pkg.scripts[cmd] = 'env'
- }
- } else if (npm.config.get('if-present')) {
- return cb(null)
- } else {
- let suggestions = didYouMean(cmd, Object.keys(pkg.scripts))
- suggestions = suggestions ? '\n' + suggestions : ''
- return cb(new Error('missing script: ' + cmd + suggestions))
- }
- }
- cmds = [cmd]
- }
-
- if (!cmd.match(/^(pre|post)/)) {
- cmds = ['pre' + cmd].concat(cmds).concat('post' + cmd)
- }
-
- log.verbose('run-script', cmds)
- chain(cmds.map(function (c) {
- // pass cli arguments after -- to script.
- if (pkg.scripts[c] && c === cmd) {
- pkg.scripts[c] = pkg.scripts[c] + joinArgs(args)
- }
-
- // when running scripts explicitly, assume that they're trusted.
- return [lifecycle, pkg, c, wd, { unsafePerm: true }]
- }), cb)
-}
-
-// join arguments after '--' and pass them to script,
-// handle special characters such as ', ", ' '.
-function joinArgs (args) {
- var joinedArgs = ''
- args.forEach(function (arg) {
- joinedArgs += ' "' + arg.replace(/"/g, '\\"') + '"'
- })
- return joinedArgs
-}
diff --git a/deps/node/deps/npm/lib/search.js b/deps/node/deps/npm/lib/search.js
deleted file mode 100644
index 3c59f8b4..00000000
--- a/deps/node/deps/npm/lib/search.js
+++ /dev/null
@@ -1,114 +0,0 @@
-'use strict'
-
-module.exports = exports = search
-
-const npm = require('./npm.js')
-const allPackageSearch = require('./search/all-package-search')
-const figgyPudding = require('figgy-pudding')
-const formatPackageStream = require('./search/format-package-stream.js')
-const libSearch = require('libnpm/search')
-const log = require('npmlog')
-const ms = require('mississippi')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const usage = require('./utils/usage')
-
-search.usage = usage(
- 'search',
- 'npm search [--long] [search terms ...]'
-)
-
-search.completion = function (opts, cb) {
- cb(null, [])
-}
-
-const SearchOpts = figgyPudding({
- description: {},
- exclude: {},
- include: {},
- limit: {},
- log: {},
- staleness: {},
- unicode: {}
-})
-
-function search (args, cb) {
- const opts = SearchOpts(npmConfig()).concat({
- description: npm.config.get('description'),
- exclude: prepareExcludes(npm.config.get('searchexclude')),
- include: prepareIncludes(args, npm.config.get('searchopts')),
- limit: npm.config.get('searchlimit') || 20,
- log: log,
- staleness: npm.config.get('searchstaleness'),
- unicode: npm.config.get('unicode')
- })
- if (opts.include.length === 0) {
- return cb(new Error('search must be called with arguments'))
- }
-
- // Used later to figure out whether we had any packages go out
- let anyOutput = false
-
- const entriesStream = ms.through.obj()
-
- let esearchWritten = false
- libSearch.stream(opts.include, opts).on('data', pkg => {
- entriesStream.write(pkg)
- !esearchWritten && (esearchWritten = true)
- }).on('error', err => {
- if (esearchWritten) {
- // If esearch errored after already starting output, we can't fall back.
- return entriesStream.emit('error', err)
- }
- log.warn('search', 'fast search endpoint errored. Using old search.')
- allPackageSearch(opts)
- .on('data', pkg => entriesStream.write(pkg))
- .on('error', err => entriesStream.emit('error', err))
- .on('end', () => entriesStream.end())
- }).on('end', () => entriesStream.end())
-
- // Grab a configured output stream that will spit out packages in the
- // desired format.
- var outputStream = formatPackageStream({
- args: args, // --searchinclude options are not highlighted
- long: npm.config.get('long'),
- description: npm.config.get('description'),
- json: npm.config.get('json'),
- parseable: npm.config.get('parseable'),
- color: npm.color
- })
- outputStream.on('data', chunk => {
- if (!anyOutput) { anyOutput = true }
- output(chunk.toString('utf8'))
- })
-
- log.silly('search', 'searching packages')
- ms.pipe(entriesStream, outputStream, err => {
- if (err) return cb(err)
- if (!anyOutput && !npm.config.get('json') && !npm.config.get('parseable')) {
- output('No matches found for ' + (args.map(JSON.stringify).join(' ')))
- }
- log.silly('search', 'search completed')
- log.clearProgress()
- cb(null, {})
- })
-}
-
-function prepareIncludes (args, searchopts) {
- if (typeof searchopts !== 'string') searchopts = ''
- return searchopts.split(/\s+/).concat(args).map(function (s) {
- return s.toLowerCase()
- }).filter(function (s) { return s })
-}
-
-function prepareExcludes (searchexclude) {
- var exclude
- if (typeof searchexclude === 'string') {
- exclude = searchexclude.split(/\s+/)
- } else {
- exclude = []
- }
- return exclude.map(function (s) {
- return s.toLowerCase()
- })
-}
diff --git a/deps/node/deps/npm/lib/search/all-package-metadata.js b/deps/node/deps/npm/lib/search/all-package-metadata.js
deleted file mode 100644
index 5883def5..00000000
--- a/deps/node/deps/npm/lib/search/all-package-metadata.js
+++ /dev/null
@@ -1,313 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const cacheFile = require('npm-cache-filename')
-const chownr = BB.promisify(require('chownr'))
-const correctMkdir = BB.promisify(require('../utils/correct-mkdir.js'))
-const figgyPudding = require('figgy-pudding')
-const fs = require('graceful-fs')
-const JSONStream = require('JSONStream')
-const log = require('npmlog')
-const mkdir = BB.promisify(require('mkdirp'))
-const ms = require('mississippi')
-const npmFetch = require('libnpm/fetch')
-const path = require('path')
-const sortedUnionStream = require('sorted-union-stream')
-const url = require('url')
-const writeStreamAtomic = require('fs-write-stream-atomic')
-
-const statAsync = BB.promisify(fs.stat)
-
-const APMOpts = figgyPudding({
- cache: {},
- registry: {}
-})
-// Returns a sorted stream of all package metadata. Internally, takes care of
-// maintaining its metadata cache and making partial or full remote requests,
-// according to staleness, validity, etc.
-//
-// The local cache must hold certain invariants:
-// 1. It must be a proper JSON object
-// 2. It must have its keys lexically sorted
-// 3. The first entry must be `_updated` with a millisecond timestamp as a val.
-// 4. It must include all entries that exist in the metadata endpoint as of
-// the value in `_updated`
-module.exports = allPackageMetadata
-function allPackageMetadata (opts) {
- const staleness = opts.staleness
- const stream = ms.through.obj()
-
- opts = APMOpts(opts)
- const cacheBase = cacheFile(path.resolve(path.dirname(opts.cache)))(url.resolve(opts.registry, '/-/all'))
- const cachePath = path.join(cacheBase, '.cache.json')
- createEntryStream(
- cachePath, staleness, opts
- ).then(({entryStream, latest, newEntries}) => {
- log.silly('all-package-metadata', 'entry stream created')
- if (entryStream && newEntries) {
- return createCacheWriteStream(cachePath, latest, opts).then(writer => {
- log.silly('all-package-metadata', 'output stream created')
- ms.pipeline.obj(entryStream, writer, stream)
- })
- } else if (entryStream) {
- ms.pipeline.obj(entryStream, stream)
- } else {
- stream.emit('error', new Error('No search sources available'))
- }
- }).catch(err => stream.emit('error', err))
- return stream
-}
-
-// Creates a stream of the latest available package metadata.
-// Metadata will come from a combination of the local cache and remote data.
-module.exports._createEntryStream = createEntryStream
-function createEntryStream (cachePath, staleness, opts) {
- return createCacheEntryStream(
- cachePath, opts
- ).catch(err => {
- log.warn('', 'Failed to read search cache. Rebuilding')
- log.silly('all-package-metadata', 'cache read error: ', err)
- return {}
- }).then(({
- updateStream: cacheStream,
- updatedLatest: cacheLatest
- }) => {
- cacheLatest = cacheLatest || 0
- return createEntryUpdateStream(staleness, cacheLatest, opts).catch(err => {
- log.warn('', 'Search data request failed, search might be stale')
- log.silly('all-package-metadata', 'update request error: ', err)
- return {}
- }).then(({updateStream, updatedLatest}) => {
- updatedLatest = updatedLatest || 0
- const latest = updatedLatest || cacheLatest
- if (!cacheStream && !updateStream) {
- throw new Error('No search sources available')
- }
- if (cacheStream && updateStream) {
- // Deduped, unioned, sorted stream from the combination of both.
- return {
- entryStream: createMergedStream(cacheStream, updateStream),
- latest,
- newEntries: !!updatedLatest
- }
- } else {
- // Either one works if one or the other failed
- return {
- entryStream: cacheStream || updateStream,
- latest,
- newEntries: !!updatedLatest
- }
- }
- })
- })
-}
-
-// Merges `a` and `b` into one stream, dropping duplicates in favor of entries
-// in `b`. Both input streams should already be individually sorted, and the
-// returned output stream will have semantics resembling the merge step of a
-// plain old merge sort.
-module.exports._createMergedStream = createMergedStream
-function createMergedStream (a, b) {
- linkStreams(a, b)
- return sortedUnionStream(b, a, ({name}) => name)
-}
-
-// Reads the local index and returns a stream that spits out package data.
-module.exports._createCacheEntryStream = createCacheEntryStream
-function createCacheEntryStream (cacheFile, opts) {
- log.verbose('all-package-metadata', 'creating entry stream from local cache')
- log.verbose('all-package-metadata', cacheFile)
- return statAsync(cacheFile).then(stat => {
- // TODO - This isn't very helpful if `cacheFile` is empty or just `{}`
- const entryStream = ms.pipeline.obj(
- fs.createReadStream(cacheFile),
- JSONStream.parse('*'),
- // I believe this passthrough is necessary cause `jsonstream` returns
- // weird custom streams that behave funny sometimes.
- ms.through.obj()
- )
- return extractUpdated(entryStream, 'cached-entry-stream', opts)
- })
-}
-
-// Stream of entry updates from the server. If `latest` is `0`, streams the
-// entire metadata object from the registry.
-module.exports._createEntryUpdateStream = createEntryUpdateStream
-function createEntryUpdateStream (staleness, latest, opts) {
- log.verbose('all-package-metadata', 'creating remote entry stream')
- let partialUpdate = false
- let uri = '/-/all'
- if (latest && (Date.now() - latest < (staleness * 1000))) {
- // Skip the request altogether if our `latest` isn't stale.
- log.verbose('all-package-metadata', 'Local data up to date, skipping update')
- return BB.resolve({})
- } else if (latest === 0) {
- log.warn('', 'Building the local index for the first time, please be patient')
- log.verbose('all-package-metadata', 'No cached data: requesting full metadata db')
- } else {
- log.verbose('all-package-metadata', 'Cached data present with timestamp:', latest, 'requesting partial index update')
- uri += '/since?stale=update_after&startkey=' + latest
- partialUpdate = true
- }
- return npmFetch(uri, opts).then(res => {
- log.silly('all-package-metadata', 'request stream opened, code:', res.statusCode)
- let entryStream = ms.pipeline.obj(
- res.body,
- JSONStream.parse('*', (pkg, key) => {
- if (key[0] === '_updated' || key[0][0] !== '_') {
- return pkg
- }
- })
- )
- if (partialUpdate) {
- // The `/all/since` endpoint doesn't return `_updated`, so we
- // just use the request's own timestamp.
- return {
- updateStream: entryStream,
- updatedLatest: Date.parse(res.headers.get('date'))
- }
- } else {
- return extractUpdated(entryStream, 'entry-update-stream', opts)
- }
- })
-}
-
-// Both the (full) remote requests and the local index have `_updated` as their
-// first returned entries. This is the "latest" unix timestamp for the metadata
-// in question. This code does a bit of juggling with the data streams
-// so that we can pretend that field doesn't exist, but still extract `latest`
-function extractUpdated (entryStream, label, opts) {
- log.silly('all-package-metadata', 'extracting latest')
- return new BB((resolve, reject) => {
- function nope (msg) {
- return function () {
- log.warn('all-package-metadata', label, msg)
- entryStream.removeAllListeners()
- entryStream.destroy()
- reject(new Error(msg))
- }
- }
- const onErr = nope('Failed to read stream')
- const onEnd = nope('Empty or invalid stream')
- entryStream.on('error', onErr)
- entryStream.on('end', onEnd)
- entryStream.once('data', latest => {
- log.silly('all-package-metadata', 'got first stream entry for', label, latest)
- entryStream.removeListener('error', onErr)
- entryStream.removeListener('end', onEnd)
- if (typeof latest === 'number') {
- // The extra pipeline is to return a stream that will implicitly unpause
- // after having an `.on('data')` listener attached, since using this
- // `data` event broke its initial state.
- resolve({
- updateStream: entryStream.pipe(ms.through.obj()),
- updatedLatest: latest
- })
- } else {
- reject(new Error('expected first entry to be _updated'))
- }
- })
- })
-}
-
-// Creates a stream that writes input metadata to the current cache.
-// Cache updates are atomic, and the stream closes when *everything* is done.
-// The stream is also passthrough, so entries going through it will also
-// be output from it.
-module.exports._createCacheWriteStream = createCacheWriteStream
-function createCacheWriteStream (cacheFile, latest, opts) {
- return _ensureCacheDirExists(cacheFile, opts).then(() => {
- log.silly('all-package-metadata', 'creating output stream')
- const outStream = _createCacheOutStream()
- const cacheFileStream = writeStreamAtomic(cacheFile)
- const inputStream = _createCacheInStream(
- cacheFileStream, outStream, latest
- )
-
- // Glue together the various streams so they fail together.
- // `cacheFileStream` errors are already handled by the `inputStream`
- // pipeline
- let errEmitted = false
- linkStreams(inputStream, outStream, () => { errEmitted = true })
-
- cacheFileStream.on('close', () => !errEmitted && outStream.end())
-
- return ms.duplex.obj(inputStream, outStream)
- })
-}
-
-function _ensureCacheDirExists (cacheFile, opts) {
- var cacheBase = path.dirname(cacheFile)
- log.silly('all-package-metadata', 'making sure cache dir exists at', cacheBase)
- return correctMkdir(opts.cache).then(st => {
- return mkdir(cacheBase).then(made => {
- return chownr(made || cacheBase, st.uid, st.gid)
- })
- })
-}
-
-function _createCacheOutStream () {
- // NOTE: this looks goofy, but it's necessary in order to get
- // JSONStream to play nice with the rest of everything.
- return ms.pipeline.obj(
- ms.through(),
- JSONStream.parse('*', (obj, key) => {
- // This stream happens to get _updated passed through it, for
- // implementation reasons. We make sure to filter it out cause
- // the fact that it comes t
- if (typeof obj === 'object') {
- return obj
- }
- }),
- ms.through.obj()
- )
-}
-
-function _createCacheInStream (writer, outStream, latest) {
- let updatedWritten = false
- const inStream = ms.pipeline.obj(
- ms.through.obj((pkg, enc, cb) => {
- if (!updatedWritten && typeof pkg === 'number') {
- // This is the `_updated` value getting sent through.
- updatedWritten = true
- return cb(null, ['_updated', pkg])
- } else if (typeof pkg !== 'object') {
- this.emit('error', new Error('invalid value written to input stream'))
- } else {
- // The [key, val] format is expected by `jsonstream` for object writing
- cb(null, [pkg.name, pkg])
- }
- }),
- JSONStream.stringifyObject('{', ',', '}'),
- ms.through((chunk, enc, cb) => {
- // This tees off the buffer data to `outStream`, and then continues
- // the pipeline as usual
- outStream.write(chunk, enc, () => cb(null, chunk))
- }),
- // And finally, we write to the cache file.
- writer
- )
- inStream.write(latest)
- return inStream
-}
-
-// Links errors between `a` and `b`, preventing cycles, and calls `cb` if
-// an error happens, once per error.
-function linkStreams (a, b, cb) {
- var lastError = null
- a.on('error', function (err) {
- if (err !== lastError) {
- lastError = err
- b.emit('error', err)
- cb && cb(err)
- }
- })
- b.on('error', function (err) {
- if (err !== lastError) {
- lastError = err
- a.emit('error', err)
- cb && cb(err)
- }
- })
-}
diff --git a/deps/node/deps/npm/lib/search/all-package-search.js b/deps/node/deps/npm/lib/search/all-package-search.js
deleted file mode 100644
index fef343bc..00000000
--- a/deps/node/deps/npm/lib/search/all-package-search.js
+++ /dev/null
@@ -1,50 +0,0 @@
-var ms = require('mississippi')
-var allPackageMetadata = require('./all-package-metadata')
-var packageFilter = require('./package-filter.js')
-
-module.exports = allPackageSearch
-function allPackageSearch (opts) {
- var searchSection = (opts.unicode ? '🤔 ' : '') + 'search'
-
- // Get a stream with *all* the packages. This takes care of dealing
- // with the local cache as well, but that's an internal detail.
- var allEntriesStream = allPackageMetadata(opts)
-
- // Grab a stream that filters those packages according to given params.
- var filterStream = streamFilter(function (pkg) {
- opts.log.gauge.pulse('search')
- opts.log.gauge.show({section: searchSection, logline: 'scanning ' + pkg.name})
- // Simply 'true' if the package matches search parameters.
- var match = packageFilter(pkg, opts.include, opts.exclude, {
- description: opts.description
- })
- return match
- })
- return ms.pipeline.obj(allEntriesStream, filterStream)
-}
-
-function streamFilter (filter) {
- return ms.through.obj(function (data, enc, cb) {
- if (filter(data)) {
- this.push(standardizePkg(data))
- }
- cb()
- })
-}
-
-function standardizePkg (data) {
- return {
- name: data.name,
- description: data.description,
- maintainers: (data.maintainers || []).map(function (m) {
- return { username: m.name, email: m.email }
- }),
- keywords: data.keywords || [],
- version: Object.keys(data.versions || {})[0] || [],
- date: (
- data.time &&
- data.time.modified &&
- new Date(data.time.modified)
- ) || null
- }
-}
diff --git a/deps/node/deps/npm/lib/search/format-package-stream.js b/deps/node/deps/npm/lib/search/format-package-stream.js
deleted file mode 100644
index bb0f552b..00000000
--- a/deps/node/deps/npm/lib/search/format-package-stream.js
+++ /dev/null
@@ -1,172 +0,0 @@
-'use strict'
-
-var ms = require('mississippi')
-var jsonstream = require('JSONStream')
-var columnify = require('columnify')
-
-// This module consumes package data in the following format:
-//
-// {
-// name: String,
-// description: String,
-// maintainers: [{ username: String, email: String }],
-// keywords: String | [String],
-// version: String,
-// date: Date // can be null,
-// }
-//
-// The returned stream will format this package data
-// into a byte stream of formatted, displayable output.
-
-module.exports = formatPackageStream
-function formatPackageStream (opts) {
- opts = opts || {}
- if (opts.json) {
- return jsonOutputStream()
- } else {
- return textOutputStream(opts)
- }
-}
-
-function jsonOutputStream () {
- return ms.pipeline.obj(
- ms.through.obj(),
- jsonstream.stringify('[', ',', ']'),
- ms.through()
- )
-}
-
-function textOutputStream (opts) {
- var line = 0
- return ms.through.obj(function (pkg, enc, cb) {
- cb(null, prettify(pkg, ++line, opts))
- })
-}
-
-function prettify (data, num, opts) {
- opts = opts || {}
- var truncate = !opts.long
-
- var pkg = normalizePackage(data, opts)
-
- var columns = opts.description
- ? ['name', 'description', 'author', 'date', 'version', 'keywords']
- : ['name', 'author', 'date', 'version', 'keywords']
-
- if (opts.parseable) {
- return columns.map(function (col) {
- return pkg[col] && ('' + pkg[col]).replace(/\t/g, ' ')
- }).join('\t')
- }
-
- var output = columnify(
- [pkg],
- {
- include: columns,
- showHeaders: num <= 1,
- columnSplitter: ' | ',
- truncate: truncate,
- config: {
- name: { minWidth: 25, maxWidth: 25, truncate: false, truncateMarker: '' },
- description: { minWidth: 20, maxWidth: 20 },
- author: { minWidth: 15, maxWidth: 15 },
- date: { maxWidth: 11 },
- version: { minWidth: 8, maxWidth: 8 },
- keywords: { maxWidth: Infinity }
- }
- }
- )
- output = trimToMaxWidth(output)
- if (opts.color) {
- output = highlightSearchTerms(output, opts.args)
- }
- return output
-}
-
-var colors = [31, 33, 32, 36, 34, 35]
-var cl = colors.length
-
-function addColorMarker (str, arg, i) {
- var m = i % cl + 1
- var markStart = String.fromCharCode(m)
- var markEnd = String.fromCharCode(0)
-
- if (arg.charAt(0) === '/') {
- return str.replace(
- new RegExp(arg.substr(1, arg.length - 2), 'gi'),
- function (bit) { return markStart + bit + markEnd }
- )
- }
-
- // just a normal string, do the split/map thing
- var pieces = str.toLowerCase().split(arg.toLowerCase())
- var p = 0
-
- return pieces.map(function (piece) {
- piece = str.substr(p, piece.length)
- var mark = markStart +
- str.substr(p + piece.length, arg.length) +
- markEnd
- p += piece.length + arg.length
- return piece + mark
- }).join('')
-}
-
-function colorize (line) {
- for (var i = 0; i < cl; i++) {
- var m = i + 1
- var color = '\u001B[' + colors[i] + 'm'
- line = line.split(String.fromCharCode(m)).join(color)
- }
- var uncolor = '\u001B[0m'
- return line.split('\u0000').join(uncolor)
-}
-
-function getMaxWidth () {
- var cols
- try {
- var tty = require('tty')
- var stdout = process.stdout
- cols = !tty.isatty(stdout.fd) ? Infinity : process.stdout.getWindowSize()[0]
- cols = (cols === 0) ? Infinity : cols
- } catch (ex) { cols = Infinity }
- return cols
-}
-
-function trimToMaxWidth (str) {
- var maxWidth = getMaxWidth()
- return str.split('\n').map(function (line) {
- return line.slice(0, maxWidth)
- }).join('\n')
-}
-
-function highlightSearchTerms (str, terms) {
- terms.forEach(function (arg, i) {
- str = addColorMarker(str, arg, i)
- })
-
- return colorize(str).trim()
-}
-
-function normalizePackage (data, opts) {
- opts = opts || {}
- return {
- name: data.name,
- description: opts.description ? data.description : '',
- author: (data.maintainers || []).map(function (m) {
- return '=' + m.username
- }).join(' '),
- keywords: Array.isArray(data.keywords)
- ? data.keywords.join(' ')
- : typeof data.keywords === 'string'
- ? data.keywords.replace(/[,\s]+/, ' ')
- : '',
- version: data.version,
- date: (data.date &&
- (data.date.toISOString() // remove time
- .split('T').join(' ')
- .replace(/:[0-9]{2}\.[0-9]{3}Z$/, ''))
- .slice(0, -5)) ||
- 'prehistoric'
- }
-}
diff --git a/deps/node/deps/npm/lib/search/package-filter.js b/deps/node/deps/npm/lib/search/package-filter.js
deleted file mode 100644
index 892adb08..00000000
--- a/deps/node/deps/npm/lib/search/package-filter.js
+++ /dev/null
@@ -1,41 +0,0 @@
-'use strict'
-
-module.exports = filter
-function filter (data, include, exclude, opts) {
- return typeof data === 'object' &&
- filterWords(data, include, exclude, opts)
-}
-
-function getWords (data, opts) {
- return [ data.name ]
- .concat((opts && opts.description) ? data.description : [])
- .concat((data.maintainers || []).map(function (m) {
- return '=' + m.name
- }))
- .concat(data.versions && data.versions.length && data.url && ('<' + data.url + '>'))
- .concat(data.keywords || [])
- .map(function (f) { return f && f.trim && f.trim() })
- .filter(function (f) { return f })
- .join(' ')
- .toLowerCase()
-}
-
-function filterWords (data, include, exclude, opts) {
- var words = getWords(data, opts)
- for (var i = 0, l = include.length; i < l; i++) {
- if (!match(words, include[i])) return false
- }
- for (i = 0, l = exclude.length; i < l; i++) {
- if (match(words, exclude[i])) return false
- }
- return true
-}
-
-function match (words, pattern) {
- if (pattern.charAt(0) === '/') {
- pattern = pattern.replace(/\/$/, '')
- pattern = new RegExp(pattern.substr(1, pattern.length - 1))
- return words.match(pattern)
- }
- return words.indexOf(pattern) !== -1
-}
diff --git a/deps/node/deps/npm/lib/set.js b/deps/node/deps/npm/lib/set.js
deleted file mode 100644
index b5e7376f..00000000
--- a/deps/node/deps/npm/lib/set.js
+++ /dev/null
@@ -1,13 +0,0 @@
-
-module.exports = set
-
-set.usage = 'npm set <key> <value> (See `npm config`)'
-
-var npm = require('./npm.js')
-
-set.completion = npm.commands.config.completion
-
-function set (args, cb) {
- if (!args.length) return cb(set.usage)
- npm.commands.config(['set'].concat(args), cb)
-}
diff --git a/deps/node/deps/npm/lib/shrinkwrap.js b/deps/node/deps/npm/lib/shrinkwrap.js
deleted file mode 100644
index dbb12b5b..00000000
--- a/deps/node/deps/npm/lib/shrinkwrap.js
+++ /dev/null
@@ -1,275 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const chain = require('slide').chain
-const detectIndent = require('detect-indent')
-const detectNewline = require('detect-newline')
-const readFile = BB.promisify(require('graceful-fs').readFile)
-const getRequested = require('./install/get-requested.js')
-const id = require('./install/deps.js')
-const iferr = require('iferr')
-const isOnlyOptional = require('./install/is-only-optional.js')
-const isOnlyDev = require('./install/is-only-dev.js')
-const lifecycle = require('./utils/lifecycle.js')
-const log = require('npmlog')
-const moduleName = require('./utils/module-name.js')
-const move = require('move-concurrently')
-const npm = require('./npm.js')
-const path = require('path')
-const readPackageTree = BB.promisify(require('read-package-tree'))
-const ssri = require('ssri')
-const stringifyPackage = require('stringify-package')
-const validate = require('aproba')
-const writeFileAtomic = require('write-file-atomic')
-const unixFormatPath = require('./utils/unix-format-path.js')
-const isRegistry = require('./utils/is-registry.js')
-
-const PKGLOCK = 'package-lock.json'
-const SHRINKWRAP = 'npm-shrinkwrap.json'
-const PKGLOCK_VERSION = npm.lockfileVersion
-
-// emit JSON describing versions of all packages currently installed (for later
-// use with shrinkwrap install)
-shrinkwrap.usage = 'npm shrinkwrap'
-
-module.exports = exports = shrinkwrap
-exports.treeToShrinkwrap = treeToShrinkwrap
-
-function shrinkwrap (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
-
- if (args.length) {
- log.warn('shrinkwrap', "doesn't take positional args")
- }
-
- move(
- path.resolve(npm.prefix, PKGLOCK),
- path.resolve(npm.prefix, SHRINKWRAP),
- { Promise: BB }
- ).then(() => {
- log.notice('', `${PKGLOCK} has been renamed to ${SHRINKWRAP}. ${SHRINKWRAP} will be used for future installations.`)
- return readFile(path.resolve(npm.prefix, SHRINKWRAP)).then((d) => {
- return JSON.parse(d)
- })
- }, (err) => {
- if (err.code !== 'ENOENT') {
- throw err
- } else {
- return readPackageTree(npm.localPrefix).then(
- id.computeMetadata
- ).then((tree) => {
- return BB.fromNode((cb) => {
- createShrinkwrap(tree, {
- silent,
- defaultFile: SHRINKWRAP
- }, cb)
- })
- })
- }
- }).then((data) => cb(null, data), cb)
-}
-
-module.exports.createShrinkwrap = createShrinkwrap
-
-function createShrinkwrap (tree, opts, cb) {
- opts = opts || {}
- lifecycle(tree.package, 'preshrinkwrap', tree.path, function () {
- const pkginfo = treeToShrinkwrap(tree)
- chain([
- [lifecycle, tree.package, 'shrinkwrap', tree.path],
- [shrinkwrap_, tree.path, pkginfo, opts],
- [lifecycle, tree.package, 'postshrinkwrap', tree.path]
- ], iferr(cb, function (data) {
- cb(null, pkginfo)
- }))
- })
-}
-
-function treeToShrinkwrap (tree) {
- validate('O', arguments)
- var pkginfo = {}
- if (tree.package.name) pkginfo.name = tree.package.name
- if (tree.package.version) pkginfo.version = tree.package.version
- if (tree.children.length) {
- pkginfo.requires = true
- shrinkwrapDeps(pkginfo.dependencies = {}, tree, tree)
- }
- return pkginfo
-}
-
-function shrinkwrapDeps (deps, top, tree, seen) {
- validate('OOO', [deps, top, tree])
- if (!seen) seen = new Set()
- if (seen.has(tree)) return
- seen.add(tree)
- sortModules(tree.children).forEach(function (child) {
- var childIsOnlyDev = isOnlyDev(child)
- var pkginfo = deps[moduleName(child)] = {}
- var requested = getRequested(child) || child.package._requested || {}
- pkginfo.version = childVersion(top, child, requested)
- if (requested.type === 'git' && child.package._from) {
- pkginfo.from = child.package._from
- }
- if (child.fromBundle || child.isInLink) {
- pkginfo.bundled = true
- } else {
- if (isRegistry(requested)) {
- pkginfo.resolved = child.package._resolved
- }
- // no integrity for git deps as integirty hashes are based on the
- // tarball and we can't (yet) create consistent tarballs from a stable
- // source.
- if (requested.type !== 'git') {
- pkginfo.integrity = child.package._integrity || undefined
- if (!pkginfo.integrity && child.package._shasum) {
- pkginfo.integrity = ssri.fromHex(child.package._shasum, 'sha1')
- }
- }
- }
- if (childIsOnlyDev) pkginfo.dev = true
- if (isOnlyOptional(child)) pkginfo.optional = true
- if (child.requires.length) {
- pkginfo.requires = {}
- sortModules(child.requires).forEach((required) => {
- var requested = getRequested(required, child) || required.package._requested || {}
- pkginfo.requires[moduleName(required)] = childRequested(top, required, requested)
- })
- }
- if (child.children.length) {
- pkginfo.dependencies = {}
- shrinkwrapDeps(pkginfo.dependencies, top, child, seen)
- }
- })
-}
-
-function sortModules (modules) {
- // sort modules with the locale-agnostic Unicode sort
- var sortedModuleNames = modules.map(moduleName).sort()
- return modules.sort((a, b) => (
- sortedModuleNames.indexOf(moduleName(a)) - sortedModuleNames.indexOf(moduleName(b))
- ))
-}
-
-function childVersion (top, child, req) {
- if (req.type === 'directory' || req.type === 'file') {
- return 'file:' + unixFormatPath(path.relative(top.path, child.package._resolved || req.fetchSpec))
- } else if (!isRegistry(req) && !child.fromBundle) {
- return child.package._resolved || req.saveSpec || req.rawSpec
- } else {
- return child.package.version
- }
-}
-
-function childRequested (top, child, requested) {
- if (requested.type === 'directory' || requested.type === 'file') {
- return 'file:' + unixFormatPath(path.relative(top.path, child.package._resolved || requested.fetchSpec))
- } else if (requested.type === 'git' && child.package._from) {
- return child.package._from
- } else if (!isRegistry(requested) && !child.fromBundle) {
- return child.package._resolved || requested.saveSpec || requested.rawSpec
- } else if (requested.type === 'tag') {
- // tags are not ranges we can match against, so we invent a "reasonable"
- // one based on what we actually installed.
- return npm.config.get('save-prefix') + child.package.version
- } else if (requested.saveSpec || requested.rawSpec) {
- return requested.saveSpec || requested.rawSpec
- } else if (child.package._from || (child.package._requested && child.package._requested.rawSpec)) {
- return child.package._from.replace(/^@?[^@]+@/, '') || child.package._requested.rawSpec
- } else {
- return child.package.version
- }
-}
-
-function shrinkwrap_ (dir, pkginfo, opts, cb) {
- save(dir, pkginfo, opts, cb)
-}
-
-function save (dir, pkginfo, opts, cb) {
- // copy the keys over in a well defined order
- // because javascript objects serialize arbitrarily
- BB.join(
- checkPackageFile(dir, SHRINKWRAP),
- checkPackageFile(dir, PKGLOCK),
- checkPackageFile(dir, 'package.json'),
- (shrinkwrap, lockfile, pkg) => {
- const info = (
- shrinkwrap ||
- lockfile ||
- {
- path: path.resolve(dir, opts.defaultFile || PKGLOCK),
- data: '{}',
- indent: pkg && pkg.indent,
- newline: pkg && pkg.newline
- }
- )
- const updated = updateLockfileMetadata(pkginfo, pkg && JSON.parse(pkg.raw))
- const swdata = stringifyPackage(updated, info.indent, info.newline)
- if (swdata === info.raw) {
- // skip writing if file is identical
- log.verbose('shrinkwrap', `skipping write for ${path.basename(info.path)} because there were no changes.`)
- cb(null, pkginfo)
- } else {
- writeFileAtomic(info.path, swdata, (err) => {
- if (err) return cb(err)
- if (opts.silent) return cb(null, pkginfo)
- if (!shrinkwrap && !lockfile) {
- log.notice('', `created a lockfile as ${path.basename(info.path)}. You should commit this file.`)
- }
- cb(null, pkginfo)
- })
- }
- }
- ).then((file) => {
- }, cb)
-}
-
-function updateLockfileMetadata (pkginfo, pkgJson) {
- // This is a lot of work just to make sure the extra metadata fields are
- // between version and dependencies fields, without affecting any other stuff
- const newPkg = {}
- let metainfoWritten = false
- const metainfo = new Set([
- 'lockfileVersion',
- 'preserveSymlinks'
- ])
- Object.keys(pkginfo).forEach((k) => {
- if (k === 'dependencies') {
- writeMetainfo(newPkg)
- }
- if (!metainfo.has(k)) {
- newPkg[k] = pkginfo[k]
- }
- if (k === 'version') {
- writeMetainfo(newPkg)
- }
- })
- if (!metainfoWritten) {
- writeMetainfo(newPkg)
- }
- function writeMetainfo (pkginfo) {
- pkginfo.lockfileVersion = PKGLOCK_VERSION
- if (process.env.NODE_PRESERVE_SYMLINKS) {
- pkginfo.preserveSymlinks = process.env.NODE_PRESERVE_SYMLINKS
- }
- metainfoWritten = true
- }
- return newPkg
-}
-
-function checkPackageFile (dir, name) {
- const file = path.resolve(dir, name)
- return readFile(
- file, 'utf8'
- ).then((data) => {
- return {
- path: file,
- raw: data,
- indent: detectIndent(data).indent,
- newline: detectNewline(data)
- }
- }).catch({code: 'ENOENT'}, () => {})
-}
diff --git a/deps/node/deps/npm/lib/star.js b/deps/node/deps/npm/lib/star.js
deleted file mode 100644
index 44a762b1..00000000
--- a/deps/node/deps/npm/lib/star.js
+++ /dev/null
@@ -1,77 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const fetch = require('libnpm/fetch')
-const figgyPudding = require('figgy-pudding')
-const log = require('npmlog')
-const npa = require('libnpm/parse-arg')
-const npm = require('./npm.js')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const usage = require('./utils/usage.js')
-const whoami = require('./whoami.js')
-
-const StarConfig = figgyPudding({
- 'unicode': {}
-})
-
-star.usage = usage(
- 'star',
- 'npm star [<pkg>...]\n' +
- 'npm unstar [<pkg>...]'
-)
-
-star.completion = function (opts, cb) {
- // FIXME: there used to be registry completion here, but it stopped making
- // sense somewhere around 50,000 packages on the registry
- cb()
-}
-
-module.exports = star
-function star (args, cb) {
- const opts = StarConfig(npmConfig())
- return BB.try(() => {
- if (!args.length) throw new Error(star.usage)
- let s = opts.unicode ? '\u2605 ' : '(*)'
- const u = opts.unicode ? '\u2606 ' : '( )'
- const using = !(npm.command.match(/^un/))
- if (!using) s = u
- return BB.map(args.map(npa), pkg => {
- return BB.all([
- whoami([pkg], true, () => {}),
- fetch.json(pkg.escapedName, opts.concat({
- spec: pkg,
- query: {write: true},
- 'prefer-online': true
- }))
- ]).then(([username, fullData]) => {
- if (!username) { throw new Error('You need to be logged in!') }
- const body = {
- _id: fullData._id,
- _rev: fullData._rev,
- users: fullData.users || {}
- }
-
- if (using) {
- log.info('star', 'starring', body._id)
- body.users[username] = true
- log.verbose('star', 'starring', body)
- } else {
- delete body.users[username]
- log.info('star', 'unstarring', body._id)
- log.verbose('star', 'unstarring', body)
- }
- return fetch.json(pkg.escapedName, opts.concat({
- spec: pkg,
- method: 'PUT',
- body
- }))
- }).then(data => {
- output(s + ' ' + pkg.name)
- log.verbose('star', data)
- return data
- })
- })
- }).nodeify(cb)
-}
diff --git a/deps/node/deps/npm/lib/stars.js b/deps/node/deps/npm/lib/stars.js
deleted file mode 100644
index ea3581f1..00000000
--- a/deps/node/deps/npm/lib/stars.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const npmConfig = require('./config/figgy-config.js')
-const fetch = require('libnpm/fetch')
-const log = require('npmlog')
-const output = require('./utils/output.js')
-const whoami = require('./whoami.js')
-
-stars.usage = 'npm stars [<user>]'
-
-module.exports = stars
-function stars ([user], cb) {
- const opts = npmConfig()
- return BB.try(() => {
- return (user ? BB.resolve(user) : whoami([], true, () => {})).then(usr => {
- return fetch.json('/-/_view/starredByUser', opts.concat({
- query: {key: `"${usr}"`} // WHY. WHY THE ""?!
- }))
- }).then(data => data.rows).then(stars => {
- if (stars.length === 0) {
- log.warn('stars', 'user has not starred any packages.')
- } else {
- stars.forEach(s => output(s.value))
- }
- })
- }).catch(err => {
- if (err.code === 'ENEEDAUTH') {
- throw Object.assign(new Error("'npm starts' on your own user account requires auth"), {
- code: 'ENEEDAUTH'
- })
- } else {
- throw err
- }
- }).nodeify(cb)
-}
diff --git a/deps/node/deps/npm/lib/start.js b/deps/node/deps/npm/lib/start.js
deleted file mode 100644
index e9785365..00000000
--- a/deps/node/deps/npm/lib/start.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./utils/lifecycle-cmd.js')('start')
diff --git a/deps/node/deps/npm/lib/stop.js b/deps/node/deps/npm/lib/stop.js
deleted file mode 100644
index fd43d08f..00000000
--- a/deps/node/deps/npm/lib/stop.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./utils/lifecycle-cmd.js')('stop')
diff --git a/deps/node/deps/npm/lib/substack.js b/deps/node/deps/npm/lib/substack.js
deleted file mode 100644
index 428e0a58..00000000
--- a/deps/node/deps/npm/lib/substack.js
+++ /dev/null
@@ -1,22 +0,0 @@
-module.exports = substack
-var npm = require('./npm.js')
-var output = require('./utils/output.js')
-
-var isms = [
- '\u001b[32mbeep \u001b[35mboop\u001b[m',
- 'Replace your configs with services',
- 'SEPARATE ALL THE CONCERNS!',
- 'MODULE ALL THE THINGS!',
- '\\o/',
- 'but first, burritos',
- 'full time mad scientist here',
- 'c/,,\\'
-]
-
-function substack (args, cb) {
- var i = Math.floor(Math.random() * isms.length)
- output(isms[i])
- var c = args.shift()
- if (c) npm.commands[c](args, cb)
- else cb()
-}
diff --git a/deps/node/deps/npm/lib/team.js b/deps/node/deps/npm/lib/team.js
deleted file mode 100644
index 2b56e3b1..00000000
--- a/deps/node/deps/npm/lib/team.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/* eslint-disable standard/no-callback-literal */
-
-const columns = require('cli-columns')
-const figgyPudding = require('figgy-pudding')
-const libteam = require('libnpm/team')
-const npmConfig = require('./config/figgy-config.js')
-const output = require('./utils/output.js')
-const otplease = require('./utils/otplease.js')
-const usage = require('./utils/usage')
-
-module.exports = team
-
-team.subcommands = ['create', 'destroy', 'add', 'rm', 'ls', 'edit']
-
-team.usage = usage(
- 'team',
- 'npm team create <scope:team>\n' +
- 'npm team destroy <scope:team>\n' +
- 'npm team add <scope:team> <user>\n' +
- 'npm team rm <scope:team> <user>\n' +
- 'npm team ls <scope>|<scope:team>\n' +
- 'npm team edit <scope:team>'
-)
-
-const TeamConfig = figgyPudding({
- json: {},
- loglevel: {},
- parseable: {},
- silent: {}
-})
-
-function UsageError () {
- throw Object.assign(new Error(team.usage), {code: 'EUSAGE'})
-}
-
-team.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
- if (argv.length === 2) {
- return cb(null, team.subcommands)
- }
- switch (argv[2]) {
- case 'ls':
- case 'create':
- case 'destroy':
- case 'add':
- case 'rm':
- case 'edit':
- return cb(null, [])
- default:
- return cb(new Error(argv[2] + ' not recognized'))
- }
-}
-
-function team ([cmd, entity = '', user = ''], cb) {
- // Entities are in the format <scope>:<team>
- otplease(npmConfig(), opts => {
- opts = TeamConfig(opts).concat({description: null})
- entity = entity.replace(/^@/, '')
- switch (cmd) {
- case 'create': return teamCreate(entity, opts)
- case 'destroy': return teamDestroy(entity, opts)
- case 'add': return teamAdd(entity, user, opts)
- case 'rm': return teamRm(entity, user, opts)
- case 'ls': {
- const match = entity.match(/[^:]+:.+/)
- if (match) {
- return teamListUsers(entity, opts)
- } else {
- return teamListTeams(entity, opts)
- }
- }
- case 'edit':
- throw new Error('`npm team edit` is not implemented yet.')
- default:
- UsageError()
- }
- }).then(
- data => cb(null, data),
- err => err.code === 'EUSAGE' ? cb(err.message) : cb(err)
- )
-}
-
-function teamCreate (entity, opts) {
- return libteam.create(entity, opts).then(() => {
- if (opts.json) {
- output(JSON.stringify({
- created: true,
- team: entity
- }))
- } else if (opts.parseable) {
- output(`${entity}\tcreated`)
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`+@${entity}`)
- }
- })
-}
-
-function teamDestroy (entity, opts) {
- return libteam.destroy(entity, opts).then(() => {
- if (opts.json) {
- output(JSON.stringify({
- deleted: true,
- team: entity
- }))
- } else if (opts.parseable) {
- output(`${entity}\tdeleted`)
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`-@${entity}`)
- }
- })
-}
-
-function teamAdd (entity, user, opts) {
- return libteam.add(user, entity, opts).then(() => {
- if (opts.json) {
- output(JSON.stringify({
- added: true,
- team: entity,
- user
- }))
- } else if (opts.parseable) {
- output(`${user}\t${entity}\tadded`)
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`${user} added to @${entity}`)
- }
- })
-}
-
-function teamRm (entity, user, opts) {
- return libteam.rm(user, entity, opts).then(() => {
- if (opts.json) {
- output(JSON.stringify({
- removed: true,
- team: entity,
- user
- }))
- } else if (opts.parseable) {
- output(`${user}\t${entity}\tremoved`)
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`${user} removed from @${entity}`)
- }
- })
-}
-
-function teamListUsers (entity, opts) {
- return libteam.lsUsers(entity, opts).then(users => {
- users = users.sort()
- if (opts.json) {
- output(JSON.stringify(users, null, 2))
- } else if (opts.parseable) {
- output(users.join('\n'))
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`\n@${entity} has ${users.length} user${users.length === 1 ? '' : 's'}:\n`)
- output(columns(users, {padding: 1}))
- }
- })
-}
-
-function teamListTeams (entity, opts) {
- return libteam.lsTeams(entity, opts).then(teams => {
- teams = teams.sort()
- if (opts.json) {
- output(JSON.stringify(teams, null, 2))
- } else if (opts.parseable) {
- output(teams.join('\n'))
- } else if (!opts.silent && opts.loglevel !== 'silent') {
- output(`\n@${entity} has ${teams.length} team${teams.length === 1 ? '' : 's'}:\n`)
- output(columns(teams.map(t => `@${t}`), {padding: 1}))
- }
- })
-}
diff --git a/deps/node/deps/npm/lib/test.js b/deps/node/deps/npm/lib/test.js
deleted file mode 100644
index 05bffed8..00000000
--- a/deps/node/deps/npm/lib/test.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* eslint-disable standard/no-callback-literal */
-module.exports = test
-
-const testCmd = require('./utils/lifecycle-cmd.js')('test')
-
-test.usage = testCmd.usage
-
-function test (args, cb) {
- testCmd(args, function (er) {
- if (!er) return cb()
- if (er.code === 'ELIFECYCLE') {
- return cb('Test failed. See above for more details.')
- }
- return cb(er)
- })
-}
diff --git a/deps/node/deps/npm/lib/token.js b/deps/node/deps/npm/lib/token.js
deleted file mode 100644
index cccbba2f..00000000
--- a/deps/node/deps/npm/lib/token.js
+++ /dev/null
@@ -1,230 +0,0 @@
-'use strict'
-const profile = require('libnpm/profile')
-const npm = require('./npm.js')
-const output = require('./utils/output.js')
-const Table = require('cli-table3')
-const Bluebird = require('bluebird')
-const isCidrV4 = require('is-cidr').v4
-const isCidrV6 = require('is-cidr').v6
-const readUserInfo = require('./utils/read-user-info.js')
-const ansistyles = require('ansistyles')
-const log = require('npmlog')
-const pulseTillDone = require('./utils/pulse-till-done.js')
-
-module.exports = token
-
-token._validateCIDRList = validateCIDRList
-
-token.usage =
- 'npm token list\n' +
- 'npm token revoke <tokenKey>\n' +
- 'npm token create [--read-only] [--cidr=list]\n'
-
-token.subcommands = ['list', 'revoke', 'create']
-
-token.completion = function (opts, cb) {
- var argv = opts.conf.argv.remain
-
- switch (argv[2]) {
- case 'list':
- case 'revoke':
- case 'create':
- return cb(null, [])
- default:
- return cb(new Error(argv[2] + ' not recognized'))
- }
-}
-
-function withCb (prom, cb) {
- prom.then((value) => cb(null, value), cb)
-}
-
-function token (args, cb) {
- log.gauge.show('token')
- if (args.length === 0) return withCb(list([]), cb)
- switch (args[0]) {
- case 'list':
- case 'ls':
- withCb(list(), cb)
- break
- case 'delete':
- case 'revoke':
- case 'remove':
- case 'rm':
- withCb(rm(args.slice(1)), cb)
- break
- case 'create':
- withCb(create(args.slice(1)), cb)
- break
- default:
- cb(new Error('Unknown profile command: ' + args[0]))
- }
-}
-
-function generateTokenIds (tokens, minLength) {
- const byId = {}
- tokens.forEach((token) => {
- token.id = token.key
- for (let ii = minLength; ii < token.key.length; ++ii) {
- if (!tokens.some((ot) => ot !== token && ot.key.slice(0, ii) === token.key.slice(0, ii))) {
- token.id = token.key.slice(0, ii)
- break
- }
- }
- byId[token.id] = token
- })
- return byId
-}
-
-function config () {
- const conf = {
- json: npm.config.get('json'),
- parseable: npm.config.get('parseable'),
- registry: npm.config.get('registry'),
- otp: npm.config.get('otp')
- }
- const creds = npm.config.getCredentialsByURI(conf.registry)
- if (creds.token) {
- conf.auth = {token: creds.token}
- } else if (creds.username) {
- conf.auth = {basic: {username: creds.username, password: creds.password}}
- } else if (creds.auth) {
- const auth = Buffer.from(creds.auth, 'base64').toString().split(':', 2)
- conf.auth = {basic: {username: auth[0], password: auth[1]}}
- } else {
- conf.auth = {}
- }
- if (conf.otp) conf.auth.otp = conf.otp
- return conf
-}
-
-function list (args) {
- const conf = config()
- log.info('token', 'getting list')
- return pulseTillDone.withPromise(profile.listTokens(conf)).then((tokens) => {
- if (conf.json) {
- output(JSON.stringify(tokens, null, 2))
- return
- } else if (conf.parseable) {
- output(['key', 'token', 'created', 'readonly', 'CIDR whitelist'].join('\t'))
- tokens.forEach((token) => {
- output([
- token.key,
- token.token,
- token.created,
- token.readonly ? 'true' : 'false',
- token.cidr_whitelist ? token.cidr_whitelist.join(',') : ''
- ].join('\t'))
- })
- return
- }
- generateTokenIds(tokens, 6)
- const idWidth = tokens.reduce((acc, token) => Math.max(acc, token.id.length), 0)
- const table = new Table({
- head: ['id', 'token', 'created', 'readonly', 'CIDR whitelist'],
- colWidths: [Math.max(idWidth, 2) + 2, 9, 12, 10]
- })
- tokens.forEach((token) => {
- table.push([
- token.id,
- token.token + '…',
- String(token.created).slice(0, 10),
- token.readonly ? 'yes' : 'no',
- token.cidr_whitelist ? token.cidr_whitelist.join(', ') : ''
- ])
- })
- output(table.toString())
- })
-}
-
-function rm (args) {
- if (args.length === 0) {
- throw new Error('npm token revoke <tokenKey>')
- }
- const conf = config()
- const toRemove = []
- const progress = log.newItem('removing tokens', toRemove.length)
- progress.info('token', 'getting existing list')
- return pulseTillDone.withPromise(profile.listTokens(conf).then((tokens) => {
- args.forEach((id) => {
- const matches = tokens.filter((token) => token.key.indexOf(id) === 0)
- if (matches.length === 1) {
- toRemove.push(matches[0].key)
- } else if (matches.length > 1) {
- throw new Error(`Token ID "${id}" was ambiguous, a new token may have been created since you last ran \`npm-profile token list\`.`)
- } else {
- const tokenMatches = tokens.filter((token) => id.indexOf(token.token) === 0)
- if (tokenMatches === 0) {
- throw new Error(`Unknown token id or value "${id}".`)
- }
- toRemove.push(id)
- }
- })
- return Bluebird.map(toRemove, (key) => {
- return profile.removeToken(key, conf).catch((ex) => {
- if (ex.code !== 'EOTP') throw ex
- log.info('token', 'failed because revoking this token requires OTP')
- return readUserInfo.otp().then((otp) => {
- conf.auth.otp = otp
- return profile.removeToken(key, conf)
- })
- })
- })
- })).then(() => {
- if (conf.json) {
- output(JSON.stringify(toRemove))
- } else if (conf.parseable) {
- output(toRemove.join('\t'))
- } else {
- output('Removed ' + toRemove.length + ' token' + (toRemove.length !== 1 ? 's' : ''))
- }
- })
-}
-
-function create (args) {
- const conf = config()
- const cidr = npm.config.get('cidr')
- const readonly = npm.config.get('read-only')
-
- const validCIDR = validateCIDRList(cidr)
- return readUserInfo.password().then((password) => {
- log.info('token', 'creating')
- return profile.createToken(password, readonly, validCIDR, conf).catch((ex) => {
- if (ex.code !== 'EOTP') throw ex
- log.info('token', 'failed because it requires OTP')
- return readUserInfo.otp().then((otp) => {
- conf.auth.otp = otp
- log.info('token', 'creating with OTP')
- return pulseTillDone.withPromise(profile.createToken(password, readonly, validCIDR, conf))
- })
- })
- }).then((result) => {
- delete result.key
- delete result.updated
- if (conf.json) {
- output(JSON.stringify(result))
- } else if (conf.parseable) {
- Object.keys(result).forEach((k) => output(k + '\t' + result[k]))
- } else {
- const table = new Table()
- Object.keys(result).forEach((k) => table.push({[ansistyles.bright(k)]: String(result[k])}))
- output(table.toString())
- }
- })
-}
-
-function validateCIDR (cidr) {
- if (isCidrV6(cidr)) {
- throw new Error('CIDR whitelist can only contain IPv4 addresses, ' + cidr + ' is IPv6')
- }
- if (!isCidrV4(cidr)) {
- throw new Error('CIDR whitelist contains invalid CIDR entry: ' + cidr)
- }
-}
-
-function validateCIDRList (cidrs) {
- const maybeList = cidrs ? (Array.isArray(cidrs) ? cidrs : [cidrs]) : []
- const list = maybeList.length === 1 ? maybeList[0].split(/,\s*/) : maybeList
- list.forEach(validateCIDR)
- return list
-}
diff --git a/deps/node/deps/npm/lib/unbuild.js b/deps/node/deps/npm/lib/unbuild.js
deleted file mode 100644
index d527778e..00000000
--- a/deps/node/deps/npm/lib/unbuild.js
+++ /dev/null
@@ -1,132 +0,0 @@
-module.exports = unbuild
-module.exports.rmStuff = rmStuff
-unbuild.usage = 'npm unbuild <folder>\n(this is plumbing)'
-
-var readJson = require('read-package-json')
-var gentlyRm = require('./utils/gently-rm.js')
-var npm = require('./npm.js')
-var path = require('path')
-var isInside = require('path-is-inside')
-var lifecycle = require('./utils/lifecycle.js')
-var asyncMap = require('slide').asyncMap
-var chain = require('slide').chain
-var log = require('npmlog')
-var build = require('./build.js')
-var output = require('./utils/output.js')
-
-// args is a list of folders.
-// remove any bins/etc, and then delete the folder.
-function unbuild (args, silent, cb) {
- if (typeof silent === 'function') {
- cb = silent
- silent = false
- }
- asyncMap(args, unbuild_(silent), cb)
-}
-
-function unbuild_ (silent) {
- return function (folder, cb_) {
- function cb (er) {
- cb_(er, path.relative(npm.root, folder))
- }
- folder = path.resolve(folder)
- var base = isInside(folder, npm.prefix) ? npm.prefix : folder
- delete build._didBuild[folder]
- log.verbose('unbuild', folder.substr(npm.prefix.length + 1))
- readJson(path.resolve(folder, 'package.json'), function (er, pkg) {
- // if no json, then just trash it, but no scripts or whatever.
- if (er) return gentlyRm(folder, false, base, cb)
- chain(
- [
- [lifecycle, pkg, 'preuninstall', folder, { failOk: true }],
- [lifecycle, pkg, 'uninstall', folder, { failOk: true }],
- !silent && function (cb) {
- output('unbuild ' + pkg._id)
- cb()
- },
- [rmStuff, pkg, folder],
- [lifecycle, pkg, 'postuninstall', folder, { failOk: true }],
- [gentlyRm, folder, false, base]
- ],
- cb
- )
- })
- }
-}
-
-function rmStuff (pkg, folder, cb) {
- // if it's global, and folder is in {prefix}/node_modules,
- // then bins are in {prefix}/bin
- // otherwise, then bins are in folder/../.bin
- var parent = pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder)
- var gnm = npm.dir
- // gnm might be an absolute path, parent might be relative
- // this checks they're the same directory regardless
- var top = path.relative(gnm, parent) === ''
-
- log.verbose('unbuild rmStuff', pkg._id, 'from', gnm)
- if (!top) log.verbose('unbuild rmStuff', 'in', parent)
- asyncMap([rmBins, rmMans], function (fn, cb) {
- fn(pkg, folder, parent, top, cb)
- }, cb)
-}
-
-function rmBins (pkg, folder, parent, top, cb) {
- if (!pkg.bin) return cb()
- var binRoot = top ? npm.bin : path.resolve(parent, '.bin')
- asyncMap(Object.keys(pkg.bin), function (b, cb) {
- if (process.platform === 'win32') {
- chain([ [gentlyRm, path.resolve(binRoot, b) + '.cmd', true, folder],
- [gentlyRm, path.resolve(binRoot, b), true, folder] ], cb)
- } else {
- gentlyRm(path.resolve(binRoot, b), true, folder, cb)
- }
- }, gentlyRmBinRoot)
-
- function gentlyRmBinRoot (err) {
- if (err || top) return cb(err)
- return gentlyRm(binRoot, true, parent, cb)
- }
-}
-
-function rmMans (pkg, folder, parent, top, cb) {
- if (!pkg.man ||
- !top ||
- process.platform === 'win32' ||
- !npm.config.get('global')) {
- return cb()
- }
- var manRoot = path.resolve(npm.config.get('prefix'), 'share', 'man')
- log.verbose('rmMans', 'man files are', pkg.man, 'in', manRoot)
- asyncMap(pkg.man, function (man, cb) {
- if (Array.isArray(man)) {
- man.forEach(rmMan)
- } else {
- rmMan(man)
- }
-
- function rmMan (man) {
- log.silly('rmMan', 'preparing to remove', man)
- var parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/)
- if (!parseMan) {
- log.error(
- 'rmMan', man, 'is not a valid name for a man file.',
- 'Man files must end with a number, ' +
- 'and optionally a .gz suffix if they are compressed.'
- )
- return cb()
- }
-
- var stem = parseMan[1]
- var sxn = parseMan[2]
- var gz = parseMan[3] || ''
- var bn = path.basename(stem)
- var manDest = path.join(
- manRoot,
- 'man' + sxn,
- (bn.indexOf(pkg.name) === 0 ? bn : pkg.name + '-' + bn) + '.' + sxn + gz
- )
- gentlyRm(manDest, true, cb)
- }
- }, cb)
-}
diff --git a/deps/node/deps/npm/lib/uninstall.js b/deps/node/deps/npm/lib/uninstall.js
deleted file mode 100644
index c4bd23ea..00000000
--- a/deps/node/deps/npm/lib/uninstall.js
+++ /dev/null
@@ -1,79 +0,0 @@
-'use strict'
-// remove a package.
-
-module.exports = uninstall
-
-const path = require('path')
-const validate = require('aproba')
-const readJson = require('read-package-json')
-const iferr = require('iferr')
-const npm = require('./npm.js')
-const Installer = require('./install.js').Installer
-const getSaveType = require('./install/save.js').getSaveType
-const removeDeps = require('./install/deps.js').removeDeps
-const log = require('npmlog')
-const usage = require('./utils/usage')
-
-uninstall.usage = usage(
- 'uninstall',
- 'npm uninstall [<@scope>/]<pkg>[@<version>]... [--save-prod|--save-dev|--save-optional] [--no-save]'
-)
-
-uninstall.completion = require('./utils/completion/installed-shallow.js')
-
-function uninstall (args, cb) {
- validate('AF', arguments)
- // the /path/to/node_modules/..
- const dryrun = !!npm.config.get('dry-run')
-
- if (args.length === 1 && args[0] === '.') args = []
-
- const where = npm.config.get('global') || !args.length
- ? path.resolve(npm.globalDir, '..')
- : npm.prefix
-
- args = args.filter(function (a) {
- return path.resolve(a) !== where
- })
-
- if (args.length) {
- new Uninstaller(where, dryrun, args).run(cb)
- } else {
- // remove this package from the global space, if it's installed there
- readJson(path.resolve(npm.localPrefix, 'package.json'), function (er, pkg) {
- if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er)
- if (er) return cb(uninstall.usage)
- new Uninstaller(where, dryrun, [pkg.name]).run(cb)
- })
- }
-}
-
-class Uninstaller extends Installer {
- constructor (where, dryrun, args) {
- super(where, dryrun, args)
- this.remove = []
- }
-
- loadArgMetadata (next) {
- this.args = this.args.map(function (arg) { return {name: arg} })
- next()
- }
-
- loadAllDepsIntoIdealTree (cb) {
- validate('F', arguments)
- this.remove = this.args
- this.args = []
- log.silly('uninstall', 'loadAllDepsIntoIdealTree')
- const saveDeps = getSaveType()
-
- super.loadAllDepsIntoIdealTree(iferr(cb, () => {
- removeDeps(this.remove, this.idealTree, saveDeps, cb)
- }))
- }
-
- // no top level lifecycles on rm
- runPreinstallTopLevelLifecycles (cb) { cb() }
- runPostinstallTopLevelLifecycles (cb) { cb() }
-}
-
-module.exports.Uninstaller = Uninstaller
diff --git a/deps/node/deps/npm/lib/unpublish.js b/deps/node/deps/npm/lib/unpublish.js
deleted file mode 100644
index bf5867a2..00000000
--- a/deps/node/deps/npm/lib/unpublish.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* eslint-disable standard/no-callback-literal */
-'use strict'
-
-module.exports = unpublish
-
-const BB = require('bluebird')
-
-const figgyPudding = require('figgy-pudding')
-const libaccess = require('libnpm/access')
-const libunpub = require('libnpm/unpublish')
-const log = require('npmlog')
-const npa = require('npm-package-arg')
-const npm = require('./npm.js')
-const npmConfig = require('./config/figgy-config.js')
-const npmFetch = require('npm-registry-fetch')
-const otplease = require('./utils/otplease.js')
-const output = require('./utils/output.js')
-const path = require('path')
-const readJson = BB.promisify(require('read-package-json'))
-const usage = require('./utils/usage.js')
-const whoami = BB.promisify(require('./whoami.js'))
-
-unpublish.usage = usage('npm unpublish [<@scope>/]<pkg>[@<version>]')
-
-function UsageError () {
- throw Object.assign(new Error(`Usage: ${unpublish.usage}`), {
- code: 'EUSAGE'
- })
-}
-
-const UnpublishConfig = figgyPudding({
- force: {},
- loglevel: {},
- silent: {}
-})
-
-unpublish.completion = function (cliOpts, cb) {
- if (cliOpts.conf.argv.remain.length >= 3) return cb()
-
- whoami([], true).then(username => {
- if (!username) { return [] }
- const opts = UnpublishConfig(npmConfig())
- return libaccess.lsPackages(username, opts).then(access => {
- // do a bit of filtering at this point, so that we don't need
- // to fetch versions for more than one thing, but also don't
- // accidentally a whole project.
- let pkgs = Object.keys(access)
- if (!cliOpts.partialWord || !pkgs.length) { return pkgs }
- const pp = npa(cliOpts.partialWord).name
- pkgs = pkgs.filter(p => !p.indexOf(pp))
- if (pkgs.length > 1) return pkgs
- return npmFetch.json(npa(pkgs[0]).escapedName, opts).then(doc => {
- const vers = Object.keys(doc.versions)
- if (!vers.length) {
- return pkgs
- } else {
- return vers.map(v => `${pkgs[0]}@${v}`)
- }
- })
- })
- }).nodeify(cb)
-}
-
-function unpublish (args, cb) {
- if (args.length > 1) return cb(unpublish.usage)
-
- const spec = args.length && npa(args[0])
- const opts = UnpublishConfig(npmConfig())
- const version = spec.rawSpec
- BB.try(() => {
- log.silly('unpublish', 'args[0]', args[0])
- log.silly('unpublish', 'spec', spec)
- if (!version && !opts.force) {
- throw Object.assign(new Error(
- 'Refusing to delete entire project.\n' +
- 'Run with --force to do this.\n' +
- unpublish.usage
- ), {code: 'EUSAGE'})
- }
- if (!spec || path.resolve(spec.name) === npm.localPrefix) {
- // if there's a package.json in the current folder, then
- // read the package name and version out of that.
- const cwdJson = path.join(npm.localPrefix, 'package.json')
- return readJson(cwdJson).then(data => {
- log.verbose('unpublish', data)
- return otplease(opts, opts => {
- return libunpub(npa.resolve(data.name, data.version), opts.concat(data.publishConfig))
- })
- }, err => {
- if (err && err.code !== 'ENOENT' && err.code !== 'ENOTDIR') {
- throw err
- } else {
- UsageError()
- }
- })
- } else {
- return otplease(opts, opts => libunpub(spec, opts))
- }
- }).then(
- ret => {
- if (!opts.silent && opts.loglevel !== 'silent') {
- output(`-${spec.name}${
- spec.type === 'version' ? `@${spec.rawSpec}` : ''
- }`)
- }
- cb(null, ret)
- },
- err => err.code === 'EUSAGE' ? cb(err.message) : cb(err)
- )
-}
diff --git a/deps/node/deps/npm/lib/update.js b/deps/node/deps/npm/lib/update.js
deleted file mode 100644
index 9b1345f9..00000000
--- a/deps/node/deps/npm/lib/update.js
+++ /dev/null
@@ -1,72 +0,0 @@
-'use strict'
-module.exports = update
-
-const url = require('url')
-const log = require('npmlog')
-const Bluebird = require('bluebird')
-const npm = require('./npm.js')
-const Installer = require('./install.js').Installer
-const usage = require('./utils/usage')
-const outdated = Bluebird.promisify(npm.commands.outdated)
-
-update.usage = usage(
- 'update',
- 'npm update [-g] [<pkg>...]'
-)
-
-update.completion = npm.commands.outdated.completion
-
-function update (args, cb) {
- return update_(args).asCallback(cb)
-}
-
-function update_ (args) {
- let dryrun = false
- if (npm.config.get('dry-run')) dryrun = true
-
- log.verbose('update', 'computing outdated modules to update')
- return outdated(args, true).then((rawOutdated) => {
- const outdated = rawOutdated.map(function (ww) {
- return {
- dep: ww[0],
- depname: ww[1],
- current: ww[2],
- wanted: ww[3],
- latest: ww[4],
- req: ww[5],
- what: ww[1] + '@' + ww[3]
- }
- })
-
- const wanted = outdated.filter(function (ww) {
- if (ww.current === ww.wanted && ww.wanted !== ww.latest) {
- log.verbose(
- 'outdated',
- 'not updating', ww.depname,
- "because it's currently at the maximum version that matches its specified semver range"
- )
- }
- return ww.current !== ww.wanted && ww.latest !== 'linked'
- })
- if (wanted.length === 0) return
-
- log.info('outdated', 'updating', wanted)
- const toInstall = {}
-
- wanted.forEach(function (ww) {
- // use the initial installation method (repo, tar, git) for updating
- if (url.parse(ww.req).protocol) ww.what = ww.req
-
- const where = (ww.dep.parent && ww.dep.parent.path) || ww.dep.path
- const isTransitive = !(ww.dep.requiredBy || []).some((p) => p.isTop)
- const key = where + ':' + String(isTransitive)
- if (!toInstall[key]) toInstall[key] = {where: where, opts: {saveOnlyLock: isTransitive}, what: []}
- if (toInstall[key].what.indexOf(ww.what) === -1) toInstall[key].what.push(ww.what)
- })
- return Bluebird.each(Object.keys(toInstall), (key) => {
- const deps = toInstall[key]
- const inst = new Installer(deps.where, dryrun, deps.what, deps.opts)
- return inst.run()
- })
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/ansi-trim.js b/deps/node/deps/npm/lib/utils/ansi-trim.js
deleted file mode 100644
index 7f9a6c30..00000000
--- a/deps/node/deps/npm/lib/utils/ansi-trim.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function ansiTrim (str) {
- var r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
- '\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g')
- return str.replace(r, '')
-}
-
-module.exports = ansiTrim
diff --git a/deps/node/deps/npm/lib/utils/child-path.js b/deps/node/deps/npm/lib/utils/child-path.js
deleted file mode 100644
index 4594f432..00000000
--- a/deps/node/deps/npm/lib/utils/child-path.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-var path = require('path')
-var validate = require('aproba')
-var moduleName = require('../utils/module-name.js')
-
-module.exports = childPath
-function childPath (parentPath, child) {
- validate('SO', arguments)
- return path.join(parentPath, 'node_modules', moduleName(child))
-}
diff --git a/deps/node/deps/npm/lib/utils/completion.sh b/deps/node/deps/npm/lib/utils/completion.sh
deleted file mode 100755
index c549b31c..00000000
--- a/deps/node/deps/npm/lib/utils/completion.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/bash
-###-begin-npm-completion-###
-#
-# npm command completion script
-#
-# Installation: npm completion >> ~/.bashrc (or ~/.zshrc)
-# Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm
-#
-
-if type complete &>/dev/null; then
- _npm_completion () {
- local words cword
- if type _get_comp_words_by_ref &>/dev/null; then
- _get_comp_words_by_ref -n = -n @ -n : -w words -i cword
- else
- cword="$COMP_CWORD"
- words=("${COMP_WORDS[@]}")
- fi
-
- local si="$IFS"
- IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \
- COMP_LINE="$COMP_LINE" \
- COMP_POINT="$COMP_POINT" \
- npm completion -- "${words[@]}" \
- 2>/dev/null)) || return $?
- IFS="$si"
- if type __ltrim_colon_completions &>/dev/null; then
- __ltrim_colon_completions "${words[cword]}"
- fi
- }
- complete -o default -F _npm_completion npm
-elif type compdef &>/dev/null; then
- _npm_completion() {
- local si=$IFS
- compadd -- $(COMP_CWORD=$((CURRENT-1)) \
- COMP_LINE=$BUFFER \
- COMP_POINT=0 \
- npm completion -- "${words[@]}" \
- 2>/dev/null)
- IFS=$si
- }
- compdef _npm_completion npm
-elif type compctl &>/dev/null; then
- _npm_completion () {
- local cword line point words si
- read -Ac words
- read -cn cword
- let cword-=1
- read -l line
- read -ln point
- si="$IFS"
- IFS=$'\n' reply=($(COMP_CWORD="$cword" \
- COMP_LINE="$line" \
- COMP_POINT="$point" \
- npm completion -- "${words[@]}" \
- 2>/dev/null)) || return $?
- IFS="$si"
- }
- compctl -K _npm_completion npm
-fi
-###-end-npm-completion-###
diff --git a/deps/node/deps/npm/lib/utils/completion/file-completion.js b/deps/node/deps/npm/lib/utils/completion/file-completion.js
deleted file mode 100644
index e16b636a..00000000
--- a/deps/node/deps/npm/lib/utils/completion/file-completion.js
+++ /dev/null
@@ -1,24 +0,0 @@
-module.exports = fileCompletion
-
-var mkdir = require('mkdirp')
-var glob = require('glob')
-
-function fileCompletion (root, req, depth, cb) {
- if (typeof cb !== 'function') {
- cb = depth
- depth = Infinity
- }
- mkdir(root, function (er) {
- if (er) return cb(er)
-
- // can be either exactly the req, or a descendent
- var pattern = root + '/{' + req + ',' + req + '/**/*}'
- var opts = { mark: true, dot: true, maxDepth: depth }
- glob(pattern, opts, function (er, files) {
- if (er) return cb(er)
- return cb(null, (files || []).map(function (f) {
- return f.substr(root.length + 1).replace(/^\/|\/$/g, '')
- }))
- })
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/completion/installed-deep.js b/deps/node/deps/npm/lib/utils/completion/installed-deep.js
deleted file mode 100644
index dc9bfbee..00000000
--- a/deps/node/deps/npm/lib/utils/completion/installed-deep.js
+++ /dev/null
@@ -1,52 +0,0 @@
-module.exports = installedDeep
-
-var npm = require('../../npm.js')
-var readInstalled = require('read-installed')
-
-function installedDeep (opts, cb) {
- var local
- var global
- var depth = npm.config.get('depth')
- var opt = { depth: depth, dev: true }
-
- if (npm.config.get('global')) {
- local = []
- next()
- } else {
- readInstalled(npm.prefix, opt, function (er, data) {
- local = getNames(data || {})
- next()
- })
- }
-
- readInstalled(npm.config.get('prefix'), opt, function (er, data) {
- global = getNames(data || {})
- next()
- })
-
- function getNames_ (d, n) {
- if (d.realName && n) {
- if (n[d.realName]) return n
- n[d.realName] = true
- }
- if (!n) n = {}
- Object.keys(d.dependencies || {}).forEach(function (dep) {
- getNames_(d.dependencies[dep], n)
- })
- return n
- }
- function getNames (d) {
- return Object.keys(getNames_(d))
- }
-
- function next () {
- if (!local || !global) return
- if (!npm.config.get('global')) {
- global = global.map(function (g) {
- return [g, '-g']
- })
- }
- var names = local.concat(global)
- return cb(null, names)
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/completion/installed-shallow.js b/deps/node/deps/npm/lib/utils/completion/installed-shallow.js
deleted file mode 100644
index bf692fed..00000000
--- a/deps/node/deps/npm/lib/utils/completion/installed-shallow.js
+++ /dev/null
@@ -1,87 +0,0 @@
-
-module.exports = installedShallow
-
-var npm = require('../../npm.js')
-var fs = require('graceful-fs')
-var path = require('path')
-var readJson = require('read-package-json')
-var asyncMap = require('slide').asyncMap
-
-function installedShallow (opts, filter, cb) {
- if (typeof cb !== 'function') {
- cb = filter
- filter = null
- }
- var conf = opts.conf
- var args = conf.argv.remain
- if (args.length > 3) return cb()
- var local
- var global
- var localDir = npm.dir
- var globalDir = npm.globalDir
- if (npm.config.get('global')) {
- local = []
- next()
- } else {
- fs.readdir(localDir, function (er, pkgs) {
- local = (pkgs || []).filter(function (p) {
- return p.charAt(0) !== '.'
- })
- next()
- })
- }
-
- fs.readdir(globalDir, function (er, pkgs) {
- global = (pkgs || []).filter(function (p) {
- return p.charAt(0) !== '.'
- })
- next()
- })
- function next () {
- if (!local || !global) return
- filterInstalled(local, global, filter, cb)
- }
-}
-
-function filterInstalled (local, global, filter, cb) {
- var fl
- var fg
-
- if (!filter) {
- fl = local
- fg = global
- return next()
- }
-
- asyncMap(local, function (p, cb) {
- readJson(path.join(npm.dir, p, 'package.json'), function (er, d) {
- if (!d || !filter(d)) return cb(null, [])
- return cb(null, d.name)
- })
- }, function (er, local) {
- fl = local || []
- next()
- })
-
- var globalDir = npm.globalDir
- asyncMap(global, function (p, cb) {
- readJson(path.join(globalDir, p, 'package.json'), function (er, d) {
- if (!d || !filter(d)) return cb(null, [])
- return cb(null, d.name)
- })
- }, function (er, global) {
- fg = global || []
- next()
- })
-
- function next () {
- if (!fg || !fl) return
- if (!npm.config.get('global')) {
- fg = fg.map(function (g) {
- return [g, '-g']
- })
- }
- console.error('filtered', fl, fg)
- return cb(null, fl.concat(fg))
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/correct-mkdir.js b/deps/node/deps/npm/lib/utils/correct-mkdir.js
deleted file mode 100644
index 68c4a4ad..00000000
--- a/deps/node/deps/npm/lib/utils/correct-mkdir.js
+++ /dev/null
@@ -1,123 +0,0 @@
-var chownr = require('chownr')
-var dezalgo = require('dezalgo')
-var fs = require('graceful-fs')
-var inflight = require('inflight')
-var log = require('npmlog')
-var mkdirp = require('mkdirp')
-
-// memoize the directories created by this step
-var stats = {}
-var effectiveOwner
-module.exports = function correctMkdir (path, cb) {
- cb = dezalgo(cb)
- cb = inflight('correctMkdir:' + path, cb)
- if (!cb) {
- return log.verbose('correctMkdir', path, 'correctMkdir already in flight; waiting')
- } else {
- log.verbose('correctMkdir', path, 'correctMkdir not in flight; initializing')
- }
-
- if (stats[path]) return cb(null, stats[path])
-
- fs.stat(path, function (er, st) {
- if (er) return makeDirectory(path, cb)
-
- if (!st.isDirectory()) {
- log.error('correctMkdir', 'invalid dir %s', path)
- return cb(er)
- }
-
- var ownerStats = calculateOwner()
- // there's always a chance the permissions could have been frobbed, so fix
- if (st.uid !== ownerStats.uid) {
- stats[path] = ownerStats
- setPermissions(path, ownerStats, cb)
- } else {
- stats[path] = st
- cb(null, stats[path])
- }
- })
-}
-
-function calculateOwner () {
- if (!effectiveOwner) {
- effectiveOwner = { uid: 0, gid: 0 }
-
- // Pretty much only on windows
- if (!process.getuid) {
- return effectiveOwner
- }
-
- effectiveOwner.uid = +process.getuid()
- effectiveOwner.gid = +process.getgid()
-
- if (effectiveOwner.uid === 0) {
- if (process.env.SUDO_UID) effectiveOwner.uid = +process.env.SUDO_UID
- if (process.env.SUDO_GID) effectiveOwner.gid = +process.env.SUDO_GID
- }
- }
-
- return effectiveOwner
-}
-
-function makeDirectory (path, cb) {
- cb = inflight('makeDirectory:' + path, cb)
- if (!cb) {
- return log.verbose('makeDirectory', path, 'creation already in flight; waiting')
- } else {
- log.verbose('makeDirectory', path, 'creation not in flight; initializing')
- }
-
- var owner = calculateOwner()
-
- if (!process.getuid) {
- return mkdirp(path, function (er) {
- log.verbose('makeCacheDir', 'UID & GID are irrelevant on', process.platform)
-
- stats[path] = owner
- return cb(er, stats[path])
- })
- }
-
- if (owner.uid !== 0 || !process.env.HOME) {
- log.silly(
- 'makeDirectory', path,
- 'uid:', owner.uid,
- 'gid:', owner.gid
- )
- stats[path] = owner
- mkdirp(path, afterMkdir)
- } else {
- fs.stat(process.env.HOME, function (er, st) {
- if (er) {
- log.error('makeDirectory', 'homeless?')
- return cb(er)
- }
-
- log.silly(
- 'makeDirectory', path,
- 'uid:', st.uid,
- 'gid:', st.gid
- )
- stats[path] = st
- mkdirp(path, afterMkdir)
- })
- }
-
- function afterMkdir (er, made) {
- if (er || !stats[path] || isNaN(stats[path].uid) || isNaN(stats[path].gid)) {
- return cb(er, stats[path])
- }
-
- if (!made) return cb(er, stats[path])
-
- setPermissions(made, stats[path], cb)
- }
-}
-
-function setPermissions (path, st, cb) {
- chownr(path, st.uid, st.gid, function (er) {
- if (er && er.code === 'ENOENT') return cb(null, st)
- return cb(er, st)
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/deep-sort-object.js b/deps/node/deps/npm/lib/utils/deep-sort-object.js
deleted file mode 100644
index 7499efc4..00000000
--- a/deps/node/deps/npm/lib/utils/deep-sort-object.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict'
-var sortedObject = require('sorted-object')
-
-module.exports = function deepSortObject (obj) {
- if (obj == null || typeof obj !== 'object') return obj
- if (obj instanceof Array) {
- return obj.map(deepSortObject)
- }
- obj = sortedObject(obj)
- Object.keys(obj).forEach(function (key) {
- obj[key] = deepSortObject(obj[key])
- })
- return obj
-}
diff --git a/deps/node/deps/npm/lib/utils/depr-check.js b/deps/node/deps/npm/lib/utils/depr-check.js
deleted file mode 100644
index 97023ddd..00000000
--- a/deps/node/deps/npm/lib/utils/depr-check.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict'
-
-const log = require('npmlog')
-
-const deprecated = {}
-const deprWarned = {}
-
-module.exports = deprCheck
-function deprCheck (data) {
- if (deprecated[data._id]) {
- data.deprecated = deprecated[data._id]
- }
-
- if (data.deprecated) {
- deprecated[data._id] = data.deprecated
- if (!deprWarned[data._id]) {
- deprWarned[data._id] = true
- log.warn('deprecated', '%s: %s', data._id, data.deprecated)
- }
- }
-
- return data
-}
diff --git a/deps/node/deps/npm/lib/utils/did-you-mean.js b/deps/node/deps/npm/lib/utils/did-you-mean.js
deleted file mode 100644
index 479f0475..00000000
--- a/deps/node/deps/npm/lib/utils/did-you-mean.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var meant = require('meant')
-
-function didYouMean (scmd, commands) {
- var bestSimilarity = meant(scmd, commands).map(function (str) {
- return ' ' + str
- })
-
- if (bestSimilarity.length === 0) return ''
- if (bestSimilarity.length === 1) {
- return '\nDid you mean this?\n' + bestSimilarity[0]
- } else {
- return ['\nDid you mean one of these?']
- .concat(bestSimilarity.slice(0, 3)).join('\n')
- }
-}
-
-module.exports = didYouMean
diff --git a/deps/node/deps/npm/lib/utils/error-handler.js b/deps/node/deps/npm/lib/utils/error-handler.js
deleted file mode 100644
index ba9d9f8e..00000000
--- a/deps/node/deps/npm/lib/utils/error-handler.js
+++ /dev/null
@@ -1,252 +0,0 @@
-
-module.exports = errorHandler
-module.exports.exit = exit
-
-var cbCalled = false
-var log = require('npmlog')
-var npm = require('../npm.js')
-var itWorked = false
-var path = require('path')
-var wroteLogFile = false
-var exitCode = 0
-var rollbacks = npm.rollbacks
-var chain = require('slide').chain
-var writeFileAtomic = require('write-file-atomic')
-var errorMessage = require('./error-message.js')
-var stopMetrics = require('./metrics.js').stop
-var mkdirp = require('mkdirp')
-var fs = require('graceful-fs')
-
-var logFileName
-function getLogFile () {
- if (!logFileName) {
- logFileName = path.resolve(npm.config.get('cache'), '_logs', (new Date()).toISOString().replace(/[.:]/g, '_') + '-debug.log')
- }
- return logFileName
-}
-
-var timings = {
- version: npm.version,
- command: process.argv.slice(2),
- logfile: null
-}
-process.on('timing', function (name, value) {
- if (timings[name]) { timings[name] += value } else { timings[name] = value }
-})
-
-process.on('exit', function (code) {
- process.emit('timeEnd', 'npm')
- log.disableProgress()
- if (npm.config.loaded && npm.config.get('timing')) {
- try {
- timings.logfile = getLogFile()
- fs.appendFileSync(path.join(npm.config.get('cache'), '_timing.json'), JSON.stringify(timings) + '\n')
- } catch (_) {
- // ignore
- }
- }
-
- // kill any outstanding stats reporter if it hasn't finished yet
- stopMetrics()
-
- if (code) itWorked = false
- if (itWorked) {
- log.info('ok')
- } else {
- if (!cbCalled) {
- log.error('', 'cb() never called!')
- console.error('')
- log.error('', 'This is an error with npm itself. Please report this error at:')
- log.error('', ' <https://npm.community>')
- writeLogFile()
- }
-
- if (code) {
- log.verbose('code', code)
- }
- }
- if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile) writeLogFile()
- if (wroteLogFile) {
- // just a line break
- if (log.levels[log.level] <= log.levels.error) console.error('')
-
- log.error(
- '',
- [
- 'A complete log of this run can be found in:',
- ' ' + getLogFile()
- ].join('\n')
- )
- wroteLogFile = false
- }
-
- var doExit = npm.config.loaded && npm.config.get('_exit')
- if (doExit) {
- // actually exit.
- if (exitCode === 0 && !itWorked) {
- exitCode = 1
- }
- if (exitCode !== 0) process.exit(exitCode)
- } else {
- itWorked = false // ready for next exit
- }
-})
-
-function exit (code, noLog) {
- exitCode = exitCode || process.exitCode || code
-
- var doExit = npm.config.loaded ? npm.config.get('_exit') : true
- log.verbose('exit', [code, doExit])
- if (log.level === 'silent') noLog = true
-
- if (rollbacks.length) {
- chain(rollbacks.map(function (f) {
- return function (cb) {
- npm.commands.unbuild([f], true, cb)
- }
- }), function (er) {
- if (er) {
- log.error('error rolling back', er)
- if (!code) {
- errorHandler(er)
- } else {
- if (!noLog) writeLogFile()
- reallyExit(er)
- }
- } else {
- if (!noLog && code) writeLogFile()
- reallyExit()
- }
- })
- rollbacks.length = 0
- } else if (code && !noLog) {
- writeLogFile()
- } else {
- reallyExit()
- }
-
- function reallyExit (er) {
- if (er && !code) code = typeof er.errno === 'number' ? er.errno : 1
-
- itWorked = !code
-
- // Exit directly -- nothing in the CLI should still be running in the
- // background at this point, and this makes sure anything left dangling
- // for whatever reason gets thrown away, instead of leaving the CLI open
- //
- // Commands that expect long-running actions should just delay `cb()`
- process.stdout.write('', () => {
- process.exit(code)
- })
- }
-}
-
-function errorHandler (er) {
- log.disableProgress()
- if (!npm.config || !npm.config.loaded) {
- // logging won't work unless we pretend that it's ready
- er = er || new Error('Exit prior to config file resolving.')
- console.error(er.stack || er.message)
- }
-
- if (cbCalled) {
- er = er || new Error('Callback called more than once.')
- }
-
- cbCalled = true
- if (!er) return exit(0)
- if (typeof er === 'string') {
- log.error('', er)
- return exit(1, true)
- } else if (!(er instanceof Error)) {
- log.error('weird error', er)
- return exit(1, true)
- }
-
- var m = er.code || er.message.match(/^(?:Error: )?(E[A-Z]+)/)
- if (m && !er.code) {
- er.code = m
- }
-
- ;[
- 'type',
- 'stack',
- 'statusCode',
- 'pkgid'
- ].forEach(function (k) {
- var v = er[k]
- if (!v) return
- log.verbose(k, v)
- })
-
- log.verbose('cwd', process.cwd())
-
- var os = require('os')
- log.verbose('', os.type() + ' ' + os.release())
- log.verbose('argv', process.argv.map(JSON.stringify).join(' '))
- log.verbose('node', process.version)
- log.verbose('npm ', 'v' + npm.version)
-
- ;[
- 'file',
- 'path',
- 'code',
- 'errno',
- 'syscall'
- ].forEach(function (k) {
- var v = er[k]
- if (v) log.error(k, v)
- })
-
- var msg = errorMessage(er)
- msg.summary.concat(msg.detail).forEach(function (errline) {
- log.error.apply(log, errline)
- })
- if (npm.config && npm.config.get('json')) {
- var error = {
- error: {
- code: er.code,
- summary: messageText(msg.summary),
- detail: messageText(msg.detail)
- }
- }
- console.log(JSON.stringify(error, null, 2))
- }
-
- exit(typeof er.errno === 'number' ? er.errno : 1)
-}
-
-function messageText (msg) {
- return msg.map(function (line) {
- return line.slice(1).join(' ')
- }).join('\n')
-}
-
-function writeLogFile () {
- if (wroteLogFile) return
-
- var os = require('os')
-
- try {
- mkdirp.sync(path.resolve(npm.config.get('cache'), '_logs'))
- var logOutput = ''
- log.record.forEach(function (m) {
- var pref = [m.id, m.level]
- if (m.prefix) pref.push(m.prefix)
- pref = pref.join(' ')
-
- m.message.trim().split(/\r?\n/).map(function (line) {
- return (pref + ' ' + line).trim()
- }).forEach(function (line) {
- logOutput += line + os.EOL
- })
- })
- writeFileAtomic.sync(getLogFile(), logOutput)
-
- // truncate once it's been written.
- log.record.length = 0
- wroteLogFile = true
- } catch (ex) {
-
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/error-message.js b/deps/node/deps/npm/lib/utils/error-message.js
deleted file mode 100644
index 55c54634..00000000
--- a/deps/node/deps/npm/lib/utils/error-message.js
+++ /dev/null
@@ -1,367 +0,0 @@
-'use strict'
-var npm = require('../npm.js')
-var util = require('util')
-var nameValidator = require('validate-npm-package-name')
-
-module.exports = errorMessage
-
-function errorMessage (er) {
- var short = []
- var detail = []
- switch (er.code) {
- case 'ENOAUDIT':
- short.push(['audit', er.message])
- break
- case 'EAUDITNOPJSON':
- short.push(['audit', er.message])
- break
- case 'EAUDITNOLOCK':
- short.push(['audit', er.message])
- detail.push(['audit', 'Try creating one first with: npm i --package-lock-only'])
- break
-
- case 'ECONNREFUSED':
- short.push(['', er])
- detail.push([
- '',
- [
- '\nIf you are behind a proxy, please make sure that the',
- "'proxy' config is set properly. See: 'npm help config'"
- ].join('\n')
- ])
- break
-
- case 'EACCES':
- case 'EPERM':
- short.push(['', er])
- detail.push([
- '',
- [
- '\nThe operation was rejected by your operating system.',
- (process.platform === 'win32'
- ? 'It\'s possible that the file was already in use (by a text editor or antivirus),\nor that you lack permissions to access it.'
- : 'It is likely you do not have the permissions to access this file as the current user'),
- '\nIf you believe this might be a permissions issue, please double-check the',
- 'permissions of the file and its containing directories, or try running',
- 'the command again as root/Administrator (though this is not recommended).'
- ].join('\n')])
- break
-
- case 'ELIFECYCLE':
- short.push(['', er.message])
- detail.push([
- '',
- [
- '',
- 'Failed at the ' + er.pkgid + ' ' + er.stage + ' script.',
- 'This is probably not a problem with npm. There is likely additional logging output above.'
- ].join('\n')]
- )
- break
-
- case 'ENOGIT':
- short.push(['', er.message])
- detail.push([
- '',
- [
- '',
- 'Failed using git.',
- 'Please check if you have git installed and in your PATH.'
- ].join('\n')
- ])
- break
-
- case 'EJSONPARSE':
- const path = require('path')
- // Check whether we ran into a conflict in our own package.json
- if (er.file === path.join(npm.prefix, 'package.json')) {
- const isDiff = require('../install/read-shrinkwrap.js')._isDiff
- const txt = require('fs').readFileSync(er.file, 'utf8')
- if (isDiff(txt)) {
- detail.push([
- '',
- [
- 'Merge conflict detected in your package.json.',
- '',
- 'Please resolve the package.json conflict and retry the command:',
- '',
- `$ ${process.argv.join(' ')}`
- ].join('\n')
- ])
- break
- }
- }
- short.push(['JSON.parse', er.message])
- detail.push([
- 'JSON.parse',
- [
- 'Failed to parse package.json data.',
- 'package.json must be actual JSON, not just JavaScript.'
- ].join('\n')
- ])
- break
-
- case 'EOTP':
- case 'E401':
- // E401 is for places where we accidentally neglect OTP stuff
- if (er.code === 'EOTP' || /one-time pass/.test(er.message)) {
- short.push(['', 'This operation requires a one-time password from your authenticator.'])
- detail.push([
- '',
- [
- 'You can provide a one-time password by passing --otp=<code> to the command you ran.',
- 'If you already provided a one-time password then it is likely that you either typoed',
- 'it, or it timed out. Please try again.'
- ].join('\n')
- ])
- } else {
- // npm ERR! code E401
- // npm ERR! Unable to authenticate, need: Basic
- const auth = (er.headers && er.headers['www-authenticate'] && er.headers['www-authenticate'].map((au) => au.split(/,\s*/))[0]) || []
- if (auth.indexOf('Bearer') !== -1) {
- short.push(['', 'Unable to authenticate, your authentication token seems to be invalid.'])
- detail.push([
- '',
- [
- 'To correct this please trying logging in again with:',
- ' npm login'
- ].join('\n')
- ])
- } else if (auth.indexOf('Basic') !== -1) {
- short.push(['', 'Incorrect or missing password.'])
- detail.push([
- '',
- [
- 'If you were trying to login, change your password, create an',
- 'authentication token or enable two-factor authentication then',
- 'that means you likely typed your password in incorrectly.',
- 'Please try again, or recover your password at:',
- ' https://www.npmjs.com/forgot',
- '',
- 'If you were doing some other operation then your saved credentials are',
- 'probably out of date. To correct this please try logging in again with:',
- ' npm login'
- ].join('\n')
- ])
- } else {
- short.push(['', er.message || er])
- }
- }
- break
-
- case 'E404':
- // There's no need to have 404 in the message as well.
- var msg = er.message.replace(/^404\s+/, '')
- short.push(['404', msg])
- if (er.pkgid && er.pkgid !== '-') {
- detail.push(['404', ''])
- detail.push(['404', '', "'" + er.pkgid + "' is not in the npm registry."])
-
- var valResult = nameValidator(er.pkgid)
-
- if (valResult.validForNewPackages) {
- detail.push(['404', 'You should bug the author to publish it (or use the name yourself!)'])
- } else {
- detail.push(['404', 'Your package name is not valid, because', ''])
-
- var errorsArray = (valResult.errors || []).concat(valResult.warnings || [])
- errorsArray.forEach(function (item, idx) {
- detail.push(['404', ' ' + (idx + 1) + '. ' + item])
- })
- }
-
- if (er.parent) {
- detail.push(['404', "It was specified as a dependency of '" + er.parent + "'"])
- }
- detail.push(['404', '\nNote that you can also install from a'])
- detail.push(['404', 'tarball, folder, http url, or git url.'])
- }
- break
-
- case 'EPUBLISHCONFLICT':
- short.push(['publish fail', 'Cannot publish over existing version.'])
- detail.push(['publish fail', "Update the 'version' field in package.json and try again."])
- detail.push(['publish fail', ''])
- detail.push(['publish fail', 'To automatically increment version numbers, see:'])
- detail.push(['publish fail', ' npm help version'])
- break
-
- case 'EISGIT':
- short.push(['git', er.message])
- short.push(['git', ' ' + er.path])
- detail.push([
- 'git',
- [
- 'Refusing to remove it. Update manually,',
- 'or move it out of the way first.'
- ].join('\n')
- ])
- break
-
- case 'ECYCLE':
- short.push([
- 'cycle',
- [
- er.message,
- 'While installing: ' + er.pkgid
- ].join('\n')
- ])
- detail.push([
- 'cycle',
- [
- 'Found a pathological dependency case that npm cannot solve.',
- 'Please report this to the package author.'
- ].join('\n')
- ])
- break
-
- case 'EBADPLATFORM':
- var validOs = er.os.join ? er.os.join(',') : er.os
- var validArch = er.cpu.join ? er.cpu.join(',') : er.cpu
- var expected = {os: validOs, arch: validArch}
- var actual = {os: process.platform, arch: process.arch}
- short.push([
- 'notsup',
- [
- util.format('Unsupported platform for %s: wanted %j (current: %j)', er.pkgid, expected, actual)
- ].join('\n')
- ])
- detail.push([
- 'notsup',
- [
- 'Valid OS: ' + validOs,
- 'Valid Arch: ' + validArch,
- 'Actual OS: ' + process.platform,
- 'Actual Arch: ' + process.arch
- ].join('\n')
- ])
- break
-
- case 'EEXIST':
- short.push(['', er.message])
- short.push(['', 'File exists: ' + er.path])
- detail.push(['', 'Move it away, and try again.'])
- break
-
- case 'ENEEDAUTH':
- short.push(['need auth', er.message])
- detail.push(['need auth', 'You need to authorize this machine using `npm adduser`'])
- break
-
- case 'ECONNRESET':
- case 'ENOTFOUND':
- case 'ETIMEDOUT':
- case 'EAI_FAIL':
- short.push(['network', er.message])
- detail.push([
- 'network',
- [
- 'This is a problem related to network connectivity.',
- 'In most cases you are behind a proxy or have bad network settings.',
- '\nIf you are behind a proxy, please make sure that the',
- "'proxy' config is set properly. See: 'npm help config'"
- ].join('\n')
- ])
- break
-
- case 'ENOPACKAGEJSON':
- short.push(['package.json', er.message])
- detail.push([
- 'package.json',
- [
- "npm can't find a package.json file in your current directory."
- ].join('\n')
- ])
- break
-
- case 'ETARGET':
- short.push(['notarget', er.message])
- msg = [
- 'In most cases you or one of your dependencies are requesting',
- "a package version that doesn't exist."
- ]
- if (er.parent) {
- msg.push("\nIt was specified as a dependency of '" + er.parent + "'\n")
- }
- detail.push(['notarget', msg.join('\n')])
- break
-
- case 'ENOTSUP':
- if (er.required) {
- short.push(['notsup', er.message])
- short.push(['notsup', 'Not compatible with your version of node/npm: ' + er.pkgid])
- detail.push([
- 'notsup',
- [
- 'Not compatible with your version of node/npm: ' + er.pkgid,
- 'Required: ' + JSON.stringify(er.required),
- 'Actual: ' + JSON.stringify({
- npm: npm.version,
- node: npm.config.get('node-version')
- })
- ].join('\n')
- ])
- break
- } // else passthrough
- /* eslint no-fallthrough:0 */
-
- case 'ENOSPC':
- short.push(['nospc', er.message])
- detail.push([
- 'nospc',
- [
- 'There appears to be insufficient space on your system to finish.',
- 'Clear up some disk space and try again.'
- ].join('\n')
- ])
- break
-
- case 'EROFS':
- short.push(['rofs', er.message])
- detail.push([
- 'rofs',
- [
- 'Often virtualized file systems, or other file systems',
- "that don't support symlinks, give this error."
- ].join('\n')
- ])
- break
-
- case 'ENOENT':
- short.push(['enoent', er.message])
- detail.push([
- 'enoent',
- [
- 'This is related to npm not being able to find a file.',
- er.file ? "\nCheck if the file '" + er.file + "' is present." : ''
- ].join('\n')
- ])
- break
-
- case 'EMISSINGARG':
- case 'EUNKNOWNTYPE':
- case 'EINVALIDTYPE':
- case 'ETOOMANYARGS':
- short.push(['typeerror', er.stack])
- detail.push([
- 'typeerror',
- [
- 'This is an error with npm itself. Please report this error at:',
- ' <https://npm.community>'
- ].join('\n')
- ])
- break
-
- default:
- short.push(['', er.message || er])
- break
- }
- if (er.optional) {
- short.unshift(['optional', er.optional + ' (' + er.location + '):'])
- short.concat(detail).forEach(function (msg) {
- if (!msg[0]) msg[0] = 'optional'
- if (msg[1]) msg[1] = msg[1].toString().replace(/(^|\n)/g, '$1SKIPPING OPTIONAL DEPENDENCY: ')
- })
- }
- return {summary: short, detail: detail}
-}
diff --git a/deps/node/deps/npm/lib/utils/escape-arg.js b/deps/node/deps/npm/lib/utils/escape-arg.js
deleted file mode 100644
index d12ee5ed..00000000
--- a/deps/node/deps/npm/lib/utils/escape-arg.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict'
-var path = require('path')
-var isWindowsShell = require('./is-windows-shell.js')
-
-/*
-Escape the name of an executable suitable for passing to the system shell.
-
-Windows is easy, wrap in double quotes and you're done, as there's no
-facility to create files with quotes in their names.
-
-Unix-likes are a little more complicated, wrap in single quotes and escape
-any single quotes in the filename.
-*/
-
-module.exports = escapify
-
-function escapify (str) {
- if (isWindowsShell) {
- return '"' + path.normalize(str) + '"'
- } else {
- if (/[^-_.~/\w]/.test(str)) {
- return "'" + str.replace(/'/g, "'\"'\"'") + "'"
- } else {
- return str
- }
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/escape-exec-path.js b/deps/node/deps/npm/lib/utils/escape-exec-path.js
deleted file mode 100644
index bf94886e..00000000
--- a/deps/node/deps/npm/lib/utils/escape-exec-path.js
+++ /dev/null
@@ -1,30 +0,0 @@
-'use strict'
-var path = require('path')
-var isWindowsShell = require('./is-windows-shell.js')
-
-/*
-Escape the name of an executable suitable for passing to the system shell.
-
-Windows is easy, wrap in double quotes and you're done, as there's no
-facility to create files with quotes in their names.
-
-Unix-likes are a little more complicated, wrap in single quotes and escape
-any single quotes in the filename.
-*/
-
-module.exports = escapify
-
-function windowsQuotes (str) {
- if (!/ /.test(str)) return str
- return '"' + str + '"'
-}
-
-function escapify (str) {
- if (isWindowsShell) {
- return path.normalize(str).split(/\\/).map(windowsQuotes).join('\\')
- } else if (/[^-_.~/\w]/.test(str)) {
- return "'" + str.replace(/'/g, "'\"'\"'") + "'"
- } else {
- return str
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/gently-rm.js b/deps/node/deps/npm/lib/utils/gently-rm.js
deleted file mode 100644
index 16d0aa9b..00000000
--- a/deps/node/deps/npm/lib/utils/gently-rm.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// only remove the thing if it's a symlink into a specific folder. This is
-// a very common use-case of npm's, but not so common elsewhere.
-
-exports = module.exports = gentlyRm
-
-var gentleFS = require('gentle-fs')
-var gentleFSOpts = require('../config/gentle-fs.js')
-
-function gentlyRm (target, gently, base, cb) {
- if (!cb) {
- cb = base
- base = undefined
- }
-
- if (!cb) {
- cb = gently
- gently = false
- }
-
- return gentleFS.rm(target, gentleFSOpts(gently, base), cb)
-}
diff --git a/deps/node/deps/npm/lib/utils/git.js b/deps/node/deps/npm/lib/utils/git.js
deleted file mode 100644
index 6770853d..00000000
--- a/deps/node/deps/npm/lib/utils/git.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const exec = require('child_process').execFile
-const spawn = require('./spawn')
-const npm = require('../npm.js')
-const which = require('which')
-const git = npm.config.get('git')
-const assert = require('assert')
-const log = require('npmlog')
-const noProgressTillDone = require('./no-progress-while-running.js').tillDone
-
-exports.spawn = spawnGit
-exports.exec = BB.promisify(execGit)
-exports.chainableExec = chainableExec
-exports.whichAndExec = whichAndExec
-
-function prefixGitArgs () {
- return process.platform === 'win32' ? ['-c', 'core.longpaths=true'] : []
-}
-
-function execGit (args, options, cb) {
- log.info('git', args)
- const fullArgs = prefixGitArgs().concat(args || [])
- return exec(git, fullArgs, options, noProgressTillDone(cb))
-}
-
-function spawnGit (args, options) {
- log.info('git', args)
- return spawn(git, prefixGitArgs().concat(args || []), options)
-}
-
-function chainableExec () {
- var args = Array.prototype.slice.call(arguments)
- return [execGit].concat(args)
-}
-
-function whichAndExec (args, options, cb) {
- assert.equal(typeof cb, 'function', 'no callback provided')
- // check for git
- which(git, function (err) {
- if (err) {
- err.code = 'ENOGIT'
- return cb(err)
- }
-
- execGit(args, options, cb)
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/gunzip-maybe.js b/deps/node/deps/npm/lib/utils/gunzip-maybe.js
deleted file mode 100644
index adf7e440..00000000
--- a/deps/node/deps/npm/lib/utils/gunzip-maybe.js
+++ /dev/null
@@ -1,22 +0,0 @@
-var duplex = require('mississippi').duplex
-var through = require('mississippi').through
-var zlib = require('zlib')
-
-function hasGzipHeader (c) {
- return c[0] === 0x1F && c[1] === 0x8B && c[2] === 0x08
-}
-
-module.exports = gunzip
-function gunzip () {
- var stream = duplex()
- var peeker = through(function (chunk, enc, cb) {
- var newStream = hasGzipHeader(chunk)
- ? zlib.createGunzip()
- : through()
- stream.setReadable(newStream)
- stream.setWritable(newStream)
- stream.write(chunk)
- })
- stream.setWritable(peeker)
- return stream
-}
diff --git a/deps/node/deps/npm/lib/utils/is-registry.js b/deps/node/deps/npm/lib/utils/is-registry.js
deleted file mode 100644
index e5f08e16..00000000
--- a/deps/node/deps/npm/lib/utils/is-registry.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-module.exports = isRegistry
-
-function isRegistry (req) {
- if (req == null) return false
- // modern metadata
- if ('registry' in req) return req.registry
- // legacy metadata
- if (req.type === 'range' || req.type === 'version' || req.type === 'tag') return true
- return false
-}
diff --git a/deps/node/deps/npm/lib/utils/is-windows-bash.js b/deps/node/deps/npm/lib/utils/is-windows-bash.js
deleted file mode 100644
index 0a6c1796..00000000
--- a/deps/node/deps/npm/lib/utils/is-windows-bash.js
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict'
-var isWindows = require('./is-windows.js')
-module.exports = isWindows &&
- (/^MINGW(32|64)$/.test(process.env.MSYSTEM) || process.env.TERM === 'cygwin')
diff --git a/deps/node/deps/npm/lib/utils/is-windows-shell.js b/deps/node/deps/npm/lib/utils/is-windows-shell.js
deleted file mode 100644
index 803bbaa4..00000000
--- a/deps/node/deps/npm/lib/utils/is-windows-shell.js
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict'
-var isWindows = require('./is-windows.js')
-var isWindowsBash = require('./is-windows-bash.js')
-module.exports = isWindows && !isWindowsBash
diff --git a/deps/node/deps/npm/lib/utils/is-windows.js b/deps/node/deps/npm/lib/utils/is-windows.js
deleted file mode 100644
index 8a991d54..00000000
--- a/deps/node/deps/npm/lib/utils/is-windows.js
+++ /dev/null
@@ -1,2 +0,0 @@
-'use strict'
-module.exports = process.platform === 'win32'
diff --git a/deps/node/deps/npm/lib/utils/lifecycle-cmd.js b/deps/node/deps/npm/lib/utils/lifecycle-cmd.js
deleted file mode 100644
index bb802f45..00000000
--- a/deps/node/deps/npm/lib/utils/lifecycle-cmd.js
+++ /dev/null
@@ -1,18 +0,0 @@
-exports = module.exports = cmd
-
-var npm = require('../npm.js')
-var usage = require('./usage.js')
-
-function cmd (stage) {
- function CMD (args, cb) {
- npm.commands['run-script']([stage].concat(args), cb)
- }
- CMD.usage = usage(stage, 'npm ' + stage + ' [-- <args>]')
- var installedShallow = require('./completion/installed-shallow.js')
- CMD.completion = function (opts, cb) {
- installedShallow(opts, function (d) {
- return d.scripts && d.scripts[stage]
- }, cb)
- }
- return CMD
-}
diff --git a/deps/node/deps/npm/lib/utils/lifecycle.js b/deps/node/deps/npm/lib/utils/lifecycle.js
deleted file mode 100644
index 2d3265e0..00000000
--- a/deps/node/deps/npm/lib/utils/lifecycle.js
+++ /dev/null
@@ -1,14 +0,0 @@
-exports = module.exports = runLifecycle
-
-const lifecycleOpts = require('../config/lifecycle')
-const lifecycle = require('npm-lifecycle')
-
-function runLifecycle (pkg, stage, wd, moreOpts, cb) {
- if (typeof moreOpts === 'function') {
- cb = moreOpts
- moreOpts = null
- }
-
- const opts = lifecycleOpts(moreOpts)
- lifecycle(pkg, stage, wd, opts).then(cb, cb)
-}
diff --git a/deps/node/deps/npm/lib/utils/link.js b/deps/node/deps/npm/lib/utils/link.js
deleted file mode 100644
index c2642481..00000000
--- a/deps/node/deps/npm/lib/utils/link.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports = link
-
-var gentleFS = require('gentle-fs')
-var gentleFSOpts = require('../config/gentle-fs.js')
-
-function link (from, to, gently, abs, cb) {
- return gentleFS.link(from, to, gentleFSOpts(gently, undefined, abs), cb)
-}
diff --git a/deps/node/deps/npm/lib/utils/locker.js b/deps/node/deps/npm/lib/utils/locker.js
deleted file mode 100644
index 9cd8b2c4..00000000
--- a/deps/node/deps/npm/lib/utils/locker.js
+++ /dev/null
@@ -1,73 +0,0 @@
-var crypto = require('crypto')
-var resolve = require('path').resolve
-
-var lockfile = require('lockfile')
-var log = require('npmlog')
-
-var npm = require('../npm.js')
-var correctMkdir = require('../utils/correct-mkdir.js')
-
-var installLocks = {}
-
-function lockFileName (base, name) {
- var c = name.replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-+|-+$/g, '')
- var p = resolve(base, name)
- var h = crypto.createHash('sha1').update(p).digest('hex')
- var l = resolve(npm.cache, '_locks')
-
- return resolve(l, c.substr(0, 24) + '-' + h.substr(0, 16) + '.lock')
-}
-
-function lock (base, name, cb) {
- var lockDir = resolve(npm.cache, '_locks')
- correctMkdir(lockDir, function (er) {
- if (er) return cb(er)
-
- var opts = {
- stale: npm.config.get('cache-lock-stale'),
- retries: npm.config.get('cache-lock-retries'),
- wait: npm.config.get('cache-lock-wait')
- }
- var lf = lockFileName(base, name)
- lockfile.lock(lf, opts, function (er) {
- if (er) log.warn('locking', lf, 'failed', er)
-
- if (!er) {
- log.verbose('lock', 'using', lf, 'for', resolve(base, name))
- installLocks[lf] = true
- }
-
- cb(er)
- })
- })
-}
-
-function unlock (base, name, cb) {
- var lf = lockFileName(base, name)
- var locked = installLocks[lf]
- if (locked === false) {
- return process.nextTick(cb)
- } else if (locked === true) {
- lockfile.unlock(lf, function (er) {
- if (er) {
- log.warn('unlocking', lf, 'failed', er)
- } else {
- installLocks[lf] = false
- log.verbose('unlock', 'done using', lf, 'for', resolve(base, name))
- }
-
- cb(er)
- })
- } else {
- var notLocked = new Error(
- 'Attempt to unlock ' + resolve(base, name) + ", which hasn't been locked"
- )
- notLocked.code = 'ENOTLOCKED'
- throw notLocked
- }
-}
-
-module.exports = {
- lock: lock,
- unlock: unlock
-}
diff --git a/deps/node/deps/npm/lib/utils/metrics-launch.js b/deps/node/deps/npm/lib/utils/metrics-launch.js
deleted file mode 100644
index 7e2a8d1c..00000000
--- a/deps/node/deps/npm/lib/utils/metrics-launch.js
+++ /dev/null
@@ -1,40 +0,0 @@
-'use strict'
-/* eslint-disable camelcase */
-module.exports = launchSendMetrics
-var fs = require('graceful-fs')
-var child_process = require('child_process')
-
-if (require.main === module) main()
-
-function launchSendMetrics () {
- var path = require('path')
- var npm = require('../npm.js')
- try {
- if (!npm.config.get('send-metrics')) return
- var cliMetrics = path.join(npm.config.get('cache'), 'anonymous-cli-metrics.json')
- var targetRegistry = npm.config.get('metrics-registry')
- fs.statSync(cliMetrics)
- return runInBackground(__filename, [cliMetrics, targetRegistry])
- } catch (ex) {
- // if the metrics file doesn't exist, don't run
- }
-}
-
-function runInBackground (js, args, opts) {
- if (!args) args = []
- args.unshift(js)
- if (!opts) opts = {}
- opts.stdio = 'ignore'
- opts.detached = true
- var child = child_process.spawn(process.execPath, args, opts)
- child.unref()
- return child
-}
-
-function main () {
- var sendMetrics = require('./metrics.js').send
- var metricsFile = process.argv[2]
- var metricsRegistry = process.argv[3]
-
- sendMetrics(metricsFile, metricsRegistry)
-}
diff --git a/deps/node/deps/npm/lib/utils/metrics.js b/deps/node/deps/npm/lib/utils/metrics.js
deleted file mode 100644
index 0f99c841..00000000
--- a/deps/node/deps/npm/lib/utils/metrics.js
+++ /dev/null
@@ -1,77 +0,0 @@
-'use strict'
-exports.start = startMetrics
-exports.stop = stopMetrics
-exports.save = saveMetrics
-exports.send = sendMetrics
-
-const fs = require('fs')
-const path = require('path')
-const npm = require('../npm.js')
-const regFetch = require('libnpm/fetch')
-const uuid = require('uuid')
-
-let inMetrics = false
-
-function startMetrics () {
- if (inMetrics) return
- // loaded on demand to avoid any recursive deps when `./metrics-launch` requires us.
- var metricsLaunch = require('./metrics-launch.js')
- npm.metricsProcess = metricsLaunch()
-}
-
-function stopMetrics () {
- if (inMetrics) return
- if (npm.metricsProcess) npm.metricsProcess.kill('SIGKILL')
-}
-
-function saveMetrics (itWorked) {
- if (inMetrics) return
- // If the metrics reporter hasn't managed to PUT yet then kill it so that it doesn't
- // step on our updating the anonymous-cli-metrics json
- stopMetrics()
- var metricsFile = path.join(npm.config.get('cache'), 'anonymous-cli-metrics.json')
- var metrics
- try {
- metrics = JSON.parse(fs.readFileSync(metricsFile))
- metrics.metrics.to = new Date().toISOString()
- if (itWorked) {
- ++metrics.metrics.successfulInstalls
- } else {
- ++metrics.metrics.failedInstalls
- }
- } catch (ex) {
- metrics = {
- metricId: uuid.v4(),
- metrics: {
- from: new Date().toISOString(),
- to: new Date().toISOString(),
- successfulInstalls: itWorked ? 1 : 0,
- failedInstalls: itWorked ? 0 : 1
- }
- }
- }
- try {
- fs.writeFileSync(metricsFile, JSON.stringify(metrics))
- } catch (ex) {
- // we couldn't write the error metrics file, um, well, oh well.
- }
-}
-
-function sendMetrics (metricsFile, metricsRegistry) {
- inMetrics = true
- var cliMetrics = JSON.parse(fs.readFileSync(metricsFile))
- regFetch(
- `/-/npm/anon-metrics/v1/${encodeURIComponent(cliMetrics.metricId)}`,
- // NOTE: skip npmConfig() to prevent auth
- {
- registry: metricsRegistry,
- method: 'PUT',
- body: cliMetrics.metrics,
- retry: false
- }
- ).then(() => {
- fs.unlinkSync(metricsFile)
- }, err => {
- fs.writeFileSync(path.join(path.dirname(metricsFile), 'last-send-metrics-error.txt'), err.stack)
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/module-name.js b/deps/node/deps/npm/lib/utils/module-name.js
deleted file mode 100644
index 89957b18..00000000
--- a/deps/node/deps/npm/lib/utils/module-name.js
+++ /dev/null
@@ -1,31 +0,0 @@
-'use strict'
-var path = require('path')
-
-module.exports = moduleName
-module.exports.test = {}
-
-module.exports.test.pathToPackageName = pathToPackageName
-function pathToPackageName (dir) {
- if (dir == null) return ''
- if (dir === '') return ''
- var name = path.relative(path.resolve(dir, '..'), dir)
- var scoped = path.relative(path.resolve(dir, '../..'), dir)
- if (scoped[0] === '@') return scoped.replace(/\\/g, '/')
- return name.trim()
-}
-
-module.exports.test.isNotEmpty = isNotEmpty
-function isNotEmpty (str) {
- return str != null && str !== ''
-}
-
-var unknown = 0
-function moduleName (tree) {
- var pkg = tree.package || tree
- if (isNotEmpty(pkg.name) && typeof pkg.name === 'string') return pkg.name.trim()
- var pkgName = pathToPackageName(tree.path)
- if (pkgName !== '') return pkgName
- if (tree._invalidName != null) return tree._invalidName
- tree._invalidName = '!invalid#' + (++unknown)
- return tree._invalidName
-}
diff --git a/deps/node/deps/npm/lib/utils/move.js b/deps/node/deps/npm/lib/utils/move.js
deleted file mode 100644
index d564962c..00000000
--- a/deps/node/deps/npm/lib/utils/move.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-module.exports = wrappedMove
-
-const fs = require('graceful-fs')
-const move = require('move-concurrently')
-const Bluebird = require('bluebird')
-
-const options = {fs: fs, Promise: Bluebird, maxConcurrency: 4}
-
-function wrappedMove (from, to) {
- return move(from, to, options)
-}
diff --git a/deps/node/deps/npm/lib/utils/no-progress-while-running.js b/deps/node/deps/npm/lib/utils/no-progress-while-running.js
deleted file mode 100644
index 961fa8b5..00000000
--- a/deps/node/deps/npm/lib/utils/no-progress-while-running.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict'
-var log = require('npmlog')
-var progressEnabled
-var running = 0
-
-var startRunning = exports.startRunning = function () {
- if (progressEnabled == null) progressEnabled = log.progressEnabled
- if (progressEnabled) log.disableProgress()
- ++running
-}
-
-var stopRunning = exports.stopRunning = function () {
- --running
- if (progressEnabled && running === 0) log.enableProgress()
-}
-
-exports.tillDone = function noProgressTillDone (cb) {
- startRunning()
- return function () {
- stopRunning()
- cb.apply(this, arguments)
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/open-url.js b/deps/node/deps/npm/lib/utils/open-url.js
deleted file mode 100644
index 7a48d2e8..00000000
--- a/deps/node/deps/npm/lib/utils/open-url.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict'
-const npm = require('../npm.js')
-const output = require('./output.js')
-const opener = require('opener')
-
-// attempt to open URL in web-browser, print address otherwise:
-module.exports = function open (url, errMsg, cb, browser = npm.config.get('browser')) {
- opener(url, { command: npm.config.get('browser') }, (er) => {
- if (er && er.code === 'ENOENT') {
- output(`${errMsg}:\n\n${url}`)
- return cb()
- } else {
- return cb(er)
- }
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/otplease.js b/deps/node/deps/npm/lib/utils/otplease.js
deleted file mode 100644
index d0477a89..00000000
--- a/deps/node/deps/npm/lib/utils/otplease.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const optCheck = require('figgy-pudding')({
- prompt: {default: 'This operation requires a one-time password.\nEnter OTP:'},
- otp: {}
-})
-const readUserInfo = require('./read-user-info.js')
-
-module.exports = otplease
-function otplease (opts, fn) {
- opts = opts.concat ? opts : optCheck(opts)
- return BB.try(() => {
- return fn(opts)
- }).catch(err => {
- if (err.code !== 'EOTP' && !(err.code === 'E401' && /one-time pass/.test(err.body))) {
- throw err
- } else if (!process.stdin.isTTY || !process.stdout.isTTY) {
- throw err
- } else {
- return readUserInfo.otp(
- optCheck(opts).prompt
- ).then(otp => fn(opts.concat({otp})))
- }
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/output.js b/deps/node/deps/npm/lib/utils/output.js
deleted file mode 100644
index 3dd66cbd..00000000
--- a/deps/node/deps/npm/lib/utils/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-var log = require('npmlog')
-// output to stdout in a progress bar compatible way
-module.exports = function () {
- log.clearProgress()
- console.log.apply(console, arguments)
- log.showProgress()
-}
diff --git a/deps/node/deps/npm/lib/utils/package-id.js b/deps/node/deps/npm/lib/utils/package-id.js
deleted file mode 100644
index 2c5e3314..00000000
--- a/deps/node/deps/npm/lib/utils/package-id.js
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict'
-var moduleName = require('./module-name.js')
-
-module.exports = function (tree) {
- var pkg = tree.package || tree
- // FIXME: Excluding the '@' here is cleaning up after the mess that
- // read-package-json makes. =(
- if (pkg._id && pkg._id !== '@') return pkg._id
- var name = moduleName(tree)
- if (pkg.version) {
- return name + '@' + pkg.version
- } else {
- return name
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/parse-json.js b/deps/node/deps/npm/lib/utils/parse-json.js
deleted file mode 100644
index c2ebac35..00000000
--- a/deps/node/deps/npm/lib/utils/parse-json.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict'
-var parseJsonWithErrors = require('json-parse-better-errors')
-var parseJSON = module.exports = function (content) {
- return parseJsonWithErrors(stripBOM(content))
-}
-
-parseJSON.noExceptions = function (content) {
- try {
- return parseJSON(content)
- } catch (ex) {
-
- }
-}
-
-// 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) {
- content = content.slice(1)
- }
- return content
-}
diff --git a/deps/node/deps/npm/lib/utils/perf.js b/deps/node/deps/npm/lib/utils/perf.js
deleted file mode 100644
index d3148607..00000000
--- a/deps/node/deps/npm/lib/utils/perf.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict'
-var log = require('npmlog')
-var EventEmitter = require('events').EventEmitter
-var perf = new EventEmitter()
-module.exports = perf
-
-var timings = {}
-
-process.on('time', time)
-process.on('timeEnd', timeEnd)
-
-perf.on('time', time)
-perf.on('timeEnd', timeEnd)
-
-function time (name) {
- timings[name] = Date.now()
-}
-
-function timeEnd (name) {
- if (name in timings) {
- perf.emit('timing', name, Date.now() - timings[name])
- delete timings[name]
- } else {
- log.silly('timing', "Tried to end timer that doesn't exist:", name)
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/pick-manifest-from-registry-metadata.js b/deps/node/deps/npm/lib/utils/pick-manifest-from-registry-metadata.js
deleted file mode 100644
index 589cef20..00000000
--- a/deps/node/deps/npm/lib/utils/pick-manifest-from-registry-metadata.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict'
-module.exports = pickManifestFromRegistryMetadata
-
-var log = require('npmlog')
-var semver = require('semver')
-
-function pickManifestFromRegistryMetadata (spec, tag, versions, metadata) {
- log.silly('pickManifestFromRegistryMetadata', 'spec', spec, 'tag', tag, 'versions', versions)
-
- // if the tagged version satisfies, then use that.
- var tagged = metadata['dist-tags'][tag]
- if (tagged &&
- metadata.versions[tagged] &&
- semver.satisfies(tagged, spec, true)) {
- return {resolvedTo: tag, manifest: metadata.versions[tagged]}
- }
- // find the max satisfying version.
- var ms = semver.maxSatisfying(versions, spec, true)
- if (ms) {
- return {resolvedTo: ms, manifest: metadata.versions[ms]}
- } else if (spec === '*' && versions.length && tagged && metadata.versions[tagged]) {
- return {resolvedTo: tag, manifest: metadata.versions[tagged]}
- } else {
-
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/pulse-till-done.js b/deps/node/deps/npm/lib/utils/pulse-till-done.js
deleted file mode 100644
index b292c2fa..00000000
--- a/deps/node/deps/npm/lib/utils/pulse-till-done.js
+++ /dev/null
@@ -1,38 +0,0 @@
-'use strict'
-const validate = require('aproba')
-const log = require('npmlog')
-const Bluebird = require('bluebird')
-
-let pulsers = 0
-let pulse
-
-function pulseStart (prefix) {
- if (++pulsers > 1) return
- pulse = setInterval(function () {
- log.gauge.pulse(prefix)
- }, 150)
-}
-function pulseStop () {
- if (--pulsers > 0) return
- clearInterval(pulse)
-}
-
-module.exports = function (prefix, cb) {
- validate('SF', [prefix, cb])
- if (!prefix) prefix = 'network'
- pulseStart(prefix)
- return function () {
- pulseStop()
- cb.apply(null, arguments)
- }
-}
-module.exports.withPromise = pulseWhile
-
-function pulseWhile (prefix, promise) {
- if (!promise) {
- promise = prefix
- prefix = ''
- }
- pulseStart(prefix)
- return Bluebird.resolve(promise).finally(() => pulseStop())
-}
diff --git a/deps/node/deps/npm/lib/utils/read-local-package.js b/deps/node/deps/npm/lib/utils/read-local-package.js
deleted file mode 100644
index 27ca7b4e..00000000
--- a/deps/node/deps/npm/lib/utils/read-local-package.js
+++ /dev/null
@@ -1,12 +0,0 @@
-exports = module.exports = readLocalPkg
-
-var npm = require('../npm.js')
-var readJson = require('read-package-json')
-
-function readLocalPkg (cb) {
- if (npm.config.get('global')) return cb()
- var path = require('path')
- readJson(path.resolve(npm.prefix, 'package.json'), function (er, d) {
- return cb(er, d && d.name)
- })
-}
diff --git a/deps/node/deps/npm/lib/utils/read-user-info.js b/deps/node/deps/npm/lib/utils/read-user-info.js
deleted file mode 100644
index 1e8c86a5..00000000
--- a/deps/node/deps/npm/lib/utils/read-user-info.js
+++ /dev/null
@@ -1,73 +0,0 @@
-'use strict'
-const Bluebird = require('bluebird')
-const readAsync = Bluebird.promisify(require('read'))
-const userValidate = require('npm-user-validate')
-const log = require('npmlog')
-
-exports.otp = readOTP
-exports.password = readPassword
-exports.username = readUsername
-exports.email = readEmail
-
-function read (opts) {
- return Bluebird.try(() => {
- log.clearProgress()
- return readAsync(opts)
- }).finally(() => {
- log.showProgress()
- })
-}
-
-function readOTP (msg, otp, isRetry) {
- if (!msg) {
- msg = [
- 'This command requires a one-time password (OTP) from your authenticator app.',
- 'Enter one below. You can also pass one on the command line by appending --otp=123456.',
- 'For more information, see:',
- 'https://docs.npmjs.com/getting-started/using-two-factor-authentication',
- 'Enter OTP: '
- ].join('\n')
- }
- if (isRetry && otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) return otp.replace(/\s+/g, '')
-
- return read({prompt: msg, default: otp || ''})
- .then((otp) => readOTP(msg, otp, true))
-}
-
-function readPassword (msg, password, isRetry) {
- if (!msg) msg = 'npm password: '
- if (isRetry && password) return password
-
- return read({prompt: msg, silent: true, default: password || ''})
- .then((password) => readPassword(msg, password, true))
-}
-
-function readUsername (msg, username, opts, isRetry) {
- if (!msg) msg = 'npm username: '
- if (isRetry && username) {
- const error = userValidate.username(username)
- if (error) {
- opts.log && opts.log.warn(error.message)
- } else {
- return Promise.resolve(username.trim())
- }
- }
-
- return read({prompt: msg, default: username || ''})
- .then((username) => readUsername(msg, username, opts, true))
-}
-
-function readEmail (msg, email, opts, isRetry) {
- if (!msg) msg = 'email (this IS public): '
- if (isRetry && email) {
- const error = userValidate.email(email)
- if (error) {
- opts.log && opts.log.warn(error.message)
- } else {
- return email.trim()
- }
- }
-
- return read({prompt: msg, default: email || ''})
- .then((username) => readEmail(msg, username, opts, true))
-}
diff --git a/deps/node/deps/npm/lib/utils/save-stack.js b/deps/node/deps/npm/lib/utils/save-stack.js
deleted file mode 100644
index 42c4aab5..00000000
--- a/deps/node/deps/npm/lib/utils/save-stack.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict'
-var inherits = require('inherits')
-
-module.exports = SaveStack
-
-function SaveStack (fn) {
- Error.call(this)
- Error.captureStackTrace(this, fn || SaveStack)
-}
-inherits(SaveStack, Error)
-
-SaveStack.prototype.completeWith = function (er) {
- this['__' + 'proto' + '__'] = er
- this.stack = this.stack + '\n\n' + er.stack
- return this
-}
diff --git a/deps/node/deps/npm/lib/utils/spawn.js b/deps/node/deps/npm/lib/utils/spawn.js
deleted file mode 100644
index b164a6ac..00000000
--- a/deps/node/deps/npm/lib/utils/spawn.js
+++ /dev/null
@@ -1,50 +0,0 @@
-module.exports = spawn
-
-var _spawn = require('child_process').spawn
-var EventEmitter = require('events').EventEmitter
-var npwr = require('./no-progress-while-running.js')
-
-function willCmdOutput (stdio) {
- if (stdio === 'inherit') return true
- if (!Array.isArray(stdio)) return false
- for (var fh = 1; fh <= 2; ++fh) {
- if (stdio[fh] === 'inherit') return true
- if (stdio[fh] === 1 || stdio[fh] === 2) return true
- }
- return false
-}
-
-function spawn (cmd, args, options) {
- var cmdWillOutput = willCmdOutput(options && options.stdio)
-
- if (cmdWillOutput) npwr.startRunning()
- var raw = _spawn(cmd, args, options)
- var cooked = new EventEmitter()
-
- raw.on('error', function (er) {
- if (cmdWillOutput) npwr.stopRunning()
- er.file = cmd
- cooked.emit('error', er)
- }).on('close', function (code, signal) {
- if (cmdWillOutput) npwr.stopRunning()
- // Create ENOENT error because Node.js v0.8 will not emit
- // an `error` event if the command could not be found.
- if (code === 127) {
- var er = new Error('spawn ENOENT')
- er.code = 'ENOENT'
- er.errno = 'ENOENT'
- er.syscall = 'spawn'
- er.file = cmd
- cooked.emit('error', er)
- } else {
- cooked.emit('close', code, signal)
- }
- })
-
- cooked.stdin = raw.stdin
- cooked.stdout = raw.stdout
- cooked.stderr = raw.stderr
- cooked.kill = function (sig) { return raw.kill(sig) }
-
- return cooked
-}
diff --git a/deps/node/deps/npm/lib/utils/temp-filename.js b/deps/node/deps/npm/lib/utils/temp-filename.js
deleted file mode 100644
index 6b8245e8..00000000
--- a/deps/node/deps/npm/lib/utils/temp-filename.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-var uniqueFilename = require('unique-filename')
-var npm = require('../npm.js')
-
-module.exports = function (prefix) {
- return uniqueFilename(npm.tmp, prefix)
-}
diff --git a/deps/node/deps/npm/lib/utils/umask.js b/deps/node/deps/npm/lib/utils/umask.js
deleted file mode 100644
index 2dde1bef..00000000
--- a/deps/node/deps/npm/lib/utils/umask.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var umask = require('umask')
-var npmlog = require('npmlog')
-var _fromString = umask.fromString
-
-module.exports = umask
-
-// fromString with logging callback
-umask.fromString = function (val) {
- _fromString(val, function (err, result) {
- if (err) {
- npmlog.warn('invalid umask', err.message)
- }
- val = result
- })
-
- return val
-}
diff --git a/deps/node/deps/npm/lib/utils/unix-format-path.js b/deps/node/deps/npm/lib/utils/unix-format-path.js
deleted file mode 100644
index a82cd713..00000000
--- a/deps/node/deps/npm/lib/utils/unix-format-path.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict'
-
-module.exports = function (path) {
- return path.replace(/\\/g, '/')
-}
diff --git a/deps/node/deps/npm/lib/utils/unsupported.js b/deps/node/deps/npm/lib/utils/unsupported.js
deleted file mode 100644
index bfed5cdb..00000000
--- a/deps/node/deps/npm/lib/utils/unsupported.js
+++ /dev/null
@@ -1,53 +0,0 @@
-'use strict'
-var semver = require('semver')
-var supportedNode = [
- {ver: '6', min: '6.0.0'},
- {ver: '8', min: '8.0.0'},
- {ver: '9', min: '9.0.0'},
- {ver: '10', min: '10.0.0'},
- {ver: '11', min: '11.0.0'},
- {ver: '12', min: '12.0.0'}
-]
-var knownBroken = '<4.7.0'
-
-var checkVersion = exports.checkVersion = function (version) {
- var versionNoPrerelease = version.replace(/-.*$/, '')
- return {
- version: versionNoPrerelease,
- broken: semver.satisfies(versionNoPrerelease, knownBroken),
- unsupported: !semver.satisfies(versionNoPrerelease, supportedNode.map(function (n) { return '^' + n.min }).join('||'))
- }
-}
-
-exports.checkForBrokenNode = function () {
- var nodejs = checkVersion(process.version)
- if (nodejs.broken) {
- console.error('ERROR: npm is known not to run on Node.js ' + process.version)
- supportedNode.forEach(function (rel) {
- if (semver.satisfies(nodejs.version, rel.ver)) {
- console.error('Node.js ' + rel.ver + " is supported but the specific version you're running has")
- console.error('a bug known to break npm. Please update to at least ' + rel.min + ' to use this')
- console.error('version of npm. You can find the latest release of Node.js at https://nodejs.org/')
- process.exit(1)
- }
- })
- var supportedMajors = supportedNode.map(function (n) { return n.ver }).join(', ')
- console.error("You'll need to upgrade to a newer version in order to use this")
- console.error('version of npm. Supported versions are ' + supportedMajors + '. You can find the')
- console.error('latest version at https://nodejs.org/')
- process.exit(1)
- }
-}
-
-exports.checkForUnsupportedNode = function () {
- var nodejs = checkVersion(process.version)
- if (nodejs.unsupported) {
- var log = require('npmlog')
- var supportedMajors = supportedNode.map(function (n) { return n.ver }).join(', ')
- log.warn('npm', 'npm does not support Node.js ' + process.version)
- log.warn('npm', 'You should probably upgrade to a newer version of node as we')
- log.warn('npm', "can't make any promises that npm will work with this version.")
- log.warn('npm', 'Supported releases of Node.js are the latest release of ' + supportedMajors + '.')
- log.warn('npm', 'You can find the latest version at https://nodejs.org/')
- }
-}
diff --git a/deps/node/deps/npm/lib/utils/usage.js b/deps/node/deps/npm/lib/utils/usage.js
deleted file mode 100644
index ba069e64..00000000
--- a/deps/node/deps/npm/lib/utils/usage.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict'
-var aliases = require('../config/cmd-list').aliases
-
-module.exports = function usage (cmd, txt, opt) {
- var post = Object.keys(aliases).reduce(function (p, c) {
- var val = aliases[c]
- if (val !== cmd) return p
- return p.concat(c)
- }, [])
-
- if (opt || post.length > 0) txt += '\n\n'
-
- if (post.length === 1) {
- txt += 'alias: '
- txt += post.join(', ')
- } else if (post.length > 1) {
- txt += 'aliases: '
- txt += post.join(', ')
- }
-
- if (opt) {
- if (post.length > 0) txt += '\n'
- txt += 'common options: ' + opt
- }
-
- return txt
-}
diff --git a/deps/node/deps/npm/lib/utils/warn-deprecated.js b/deps/node/deps/npm/lib/utils/warn-deprecated.js
deleted file mode 100644
index fe5c5ec8..00000000
--- a/deps/node/deps/npm/lib/utils/warn-deprecated.js
+++ /dev/null
@@ -1,23 +0,0 @@
-module.exports = warnDeprecated
-
-var log = require('npmlog')
-
-var deprecations = {}
-
-function warnDeprecated (type) {
- return function warn (messages, instance) {
- if (!instance) {
- if (!deprecations[type]) {
- deprecations[type] = {}
- messages.forEach(function (m) { log.warn(type, m) })
- }
- } else {
- if (!deprecations[type]) deprecations[type] = {}
-
- if (!deprecations[type][instance]) {
- deprecations[type][instance] = true
- messages.forEach(function (m) { log.warn(type, m) })
- }
- }
- }
-}
diff --git a/deps/node/deps/npm/lib/version.js b/deps/node/deps/npm/lib/version.js
deleted file mode 100644
index 265b049b..00000000
--- a/deps/node/deps/npm/lib/version.js
+++ /dev/null
@@ -1,345 +0,0 @@
-'use strict'
-const BB = require('bluebird')
-
-const assert = require('assert')
-const chain = require('slide').chain
-const detectIndent = require('detect-indent')
-const detectNewline = require('detect-newline')
-const fs = require('graceful-fs')
-const readFile = BB.promisify(require('graceful-fs').readFile)
-const git = require('./utils/git.js')
-const lifecycle = require('./utils/lifecycle.js')
-const log = require('npmlog')
-const npm = require('./npm.js')
-const output = require('./utils/output.js')
-const parseJSON = require('./utils/parse-json.js')
-const path = require('path')
-const semver = require('semver')
-const stringifyPackage = require('stringify-package')
-const writeFileAtomic = require('write-file-atomic')
-
-version.usage = 'npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]' +
- '\n(run in package dir)\n' +
- "'npm -v' or 'npm --version' to print npm version " +
- '(' + npm.version + ')\n' +
- "'npm view <pkg> version' to view a package's " +
- 'published version\n' +
- "'npm ls' to inspect current package/dependency versions"
-
-// npm version <newver>
-module.exports = version
-function version (args, silent, cb_) {
- if (typeof cb_ !== 'function') {
- cb_ = silent
- silent = false
- }
- if (args.length > 1) return cb_(version.usage)
-
- readPackage(function (er, data, indent, newline) {
- if (!args.length) return dump(data, cb_)
-
- if (er) {
- log.error('version', 'No valid package.json found')
- return cb_(er)
- }
-
- if (args[0] === 'from-git') {
- retrieveTagVersion(silent, data, cb_)
- } else {
- var newVersion = semver.valid(args[0])
- if (!newVersion) newVersion = semver.inc(data.version, args[0], npm.config.get('preid'))
- if (!newVersion) return cb_(version.usage)
- persistVersion(newVersion, silent, data, cb_)
- }
- })
-}
-
-function retrieveTagVersion (silent, data, cb_) {
- chain([
- verifyGit,
- parseLastGitTag
- ], function (er, results) {
- if (er) return cb_(er)
- var localData = {
- hasGit: true,
- existingTag: true
- }
-
- var version = results[results.length - 1]
- persistVersion(version, silent, data, localData, cb_)
- })
-}
-
-function parseLastGitTag (cb) {
- var options = { env: process.env }
- git.whichAndExec(['describe', '--abbrev=0'], options, function (er, stdout) {
- if (er) {
- if (er.message.indexOf('No names found') !== -1) return cb(new Error('No tags found'))
- return cb(er)
- }
-
- var tag = stdout.trim()
- var prefix = npm.config.get('tag-version-prefix')
- // Strip the prefix from the start of the tag:
- if (tag.indexOf(prefix) === 0) tag = tag.slice(prefix.length)
- var version = semver.valid(tag)
- if (!version) return cb(new Error(tag + ' is not a valid version'))
- cb(null, version)
- })
-}
-
-function persistVersion (newVersion, silent, data, localData, cb_) {
- if (typeof localData === 'function') {
- cb_ = localData
- localData = {}
- }
-
- if (!npm.config.get('allow-same-version') && data.version === newVersion) {
- return cb_(new Error('Version not changed, might want --allow-same-version'))
- }
- data.version = newVersion
- var lifecycleData = Object.create(data)
- lifecycleData._id = data.name + '@' + newVersion
-
- var where = npm.prefix
- chain([
- !localData.hasGit && [checkGit, localData],
- [lifecycle, lifecycleData, 'preversion', where],
- [updatePackage, newVersion, silent],
- [lifecycle, lifecycleData, 'version', where],
- [commit, localData, newVersion],
- [lifecycle, lifecycleData, 'postversion', where]
- ], cb_)
-}
-
-function readPackage (cb) {
- var packagePath = path.join(npm.localPrefix, 'package.json')
- fs.readFile(packagePath, 'utf8', function (er, data) {
- if (er) return cb(new Error(er))
- var indent
- var newline
- try {
- indent = detectIndent(data).indent
- newline = detectNewline(data)
- data = JSON.parse(data)
- } catch (e) {
- er = e
- data = null
- }
- cb(er, data, indent, newline)
- })
-}
-
-function updatePackage (newVersion, silent, cb_) {
- function cb (er) {
- if (!er && !silent) output('v' + newVersion)
- cb_(er)
- }
-
- readPackage(function (er, data, indent, newline) {
- if (er) return cb(new Error(er))
- data.version = newVersion
- write(data, 'package.json', indent, newline, cb)
- })
-}
-
-function commit (localData, newVersion, cb) {
- updateShrinkwrap(newVersion, function (er, hasShrinkwrap, hasLock) {
- if (er || !localData.hasGit) return cb(er)
- localData.hasShrinkwrap = hasShrinkwrap
- localData.hasPackageLock = hasLock
- _commit(newVersion, localData, cb)
- })
-}
-
-const SHRINKWRAP = 'npm-shrinkwrap.json'
-const PKGLOCK = 'package-lock.json'
-
-function readLockfile (name) {
- return readFile(
- path.join(npm.localPrefix, name), 'utf8'
- ).catch({code: 'ENOENT'}, () => null)
-}
-
-function updateShrinkwrap (newVersion, cb) {
- BB.join(
- readLockfile(SHRINKWRAP),
- readLockfile(PKGLOCK),
- (shrinkwrap, lockfile) => {
- if (!shrinkwrap && !lockfile) {
- return cb(null, false, false)
- }
- const file = shrinkwrap ? SHRINKWRAP : PKGLOCK
- let data
- let indent
- let newline
- try {
- data = parseJSON(shrinkwrap || lockfile)
- indent = detectIndent(shrinkwrap || lockfile).indent
- newline = detectNewline(shrinkwrap || lockfile)
- } catch (err) {
- log.error('version', `Bad ${file} data.`)
- return cb(err)
- }
- data.version = newVersion
- write(data, file, indent, newline, (err) => {
- if (err) {
- log.error('version', `Failed to update version in ${file}`)
- return cb(err)
- } else {
- return cb(null, !!shrinkwrap, !!lockfile)
- }
- })
- }
- )
-}
-
-function dump (data, cb) {
- var v = {}
-
- if (data && data.name && data.version) v[data.name] = data.version
- v.npm = npm.version
- Object.keys(process.versions).sort().forEach(function (k) {
- v[k] = process.versions[k]
- })
-
- if (npm.config.get('json')) v = JSON.stringify(v, null, 2)
-
- output(v)
- cb()
-}
-
-function statGitFolder (cb) {
- fs.stat(path.join(npm.localPrefix, '.git'), cb)
-}
-
-function callGitStatus (cb) {
- git.whichAndExec(
- [ 'status', '--porcelain' ],
- { env: process.env },
- cb
- )
-}
-
-function cleanStatusLines (stdout) {
- var lines = stdout.trim().split('\n').filter(function (line) {
- return line.trim() && !line.match(/^\?\? /)
- }).map(function (line) {
- return line.trim()
- })
-
- return lines
-}
-
-function verifyGit (cb) {
- function checkStatus (er) {
- if (er) return cb(er)
- callGitStatus(checkStdout)
- }
-
- function checkStdout (er, stdout) {
- if (er) return cb(er)
- var lines = cleanStatusLines(stdout)
- if (lines.length > 0) {
- return cb(new Error(
- 'Git working directory not clean.\n' + lines.join('\n')
- ))
- }
-
- cb()
- }
-
- statGitFolder(checkStatus)
-}
-
-function checkGit (localData, cb) {
- statGitFolder(function (er) {
- var doGit = !er && npm.config.get('git-tag-version')
- if (!doGit) {
- if (er) log.verbose('version', 'error checking for .git', er)
- log.verbose('version', 'not tagging in git')
- return cb(null, false)
- }
-
- // check for git
- callGitStatus(function (er, stdout) {
- if (er && er.code === 'ENOGIT') {
- log.warn(
- 'version',
- 'This is a Git checkout, but the git command was not found.',
- 'npm could not create a Git tag for this release!'
- )
- return cb(null, false)
- }
-
- var lines = cleanStatusLines(stdout)
- if (lines.length && !npm.config.get('force')) {
- return cb(new Error(
- 'Git working directory not clean.\n' + lines.join('\n')
- ))
- }
- localData.hasGit = true
- cb(null, true)
- })
- })
-}
-
-module.exports.buildCommitArgs = buildCommitArgs
-function buildCommitArgs (args) {
- args = args || [ 'commit' ]
- if (!npm.config.get('commit-hooks')) args.push('-n')
- return args
-}
-
-function _commit (version, localData, cb) {
- const options = { env: process.env }
- const message = npm.config.get('message').replace(/%s/g, version)
- const signTag = npm.config.get('sign-git-tag')
- const signCommit = npm.config.get('sign-git-commit')
- const commitArgs = buildCommitArgs([
- 'commit',
- ...(signCommit ? ['-S', '-m'] : ['-m']),
- message
- ])
- const flagForTag = signTag ? '-sm' : '-am'
-
- stagePackageFiles(localData, options).then(() => {
- return git.exec(commitArgs, options)
- }).then(() => {
- if (!localData.existingTag) {
- return git.exec([
- 'tag', npm.config.get('tag-version-prefix') + version,
- flagForTag, message
- ], options)
- }
- }).nodeify(cb)
-}
-
-function stagePackageFiles (localData, options) {
- return addLocalFile('package.json', options, false).then(() => {
- if (localData.hasShrinkwrap) {
- return addLocalFile('npm-shrinkwrap.json', options, true)
- } else if (localData.hasPackageLock) {
- return addLocalFile('package-lock.json', options, true)
- }
- })
-}
-
-function addLocalFile (file, options, ignoreFailure) {
- const p = git.exec(['add', path.join(npm.localPrefix, file)], options)
- return ignoreFailure
- ? p.catch(() => {})
- : p
-}
-
-function write (data, file, indent, newline, cb) {
- assert(data && typeof data === 'object', 'must pass data to version write')
- assert(typeof file === 'string', 'must pass filename to write to version write')
-
- log.verbose('version.write', 'data', data, 'to', file)
- writeFileAtomic(
- path.join(npm.localPrefix, file),
- stringifyPackage(data, indent, newline),
- cb
- )
-}
diff --git a/deps/node/deps/npm/lib/view.js b/deps/node/deps/npm/lib/view.js
deleted file mode 100644
index 5dd60502..00000000
--- a/deps/node/deps/npm/lib/view.js
+++ /dev/null
@@ -1,512 +0,0 @@
-'use strict'
-
-// npm view [pkg [pkg ...]]
-module.exports = view
-
-const BB = require('bluebird')
-
-const byteSize = require('byte-size')
-const color = require('ansicolors')
-const columns = require('cli-columns')
-const npmConfig = require('./config/figgy-config.js')
-const log = require('npmlog')
-const figgyPudding = require('figgy-pudding')
-const npa = require('libnpm/parse-arg')
-const npm = require('./npm.js')
-const packument = require('libnpm/packument')
-const path = require('path')
-const readJson = require('libnpm/read-json')
-const relativeDate = require('tiny-relative-date')
-const semver = require('semver')
-const style = require('ansistyles')
-const usage = require('./utils/usage')
-const util = require('util')
-const validateName = require('validate-npm-package-name')
-
-const ViewConfig = figgyPudding({
- global: {},
- json: {},
- tag: {},
- unicode: {}
-})
-
-view.usage = usage(
- 'view',
- 'npm view [<@scope>/]<pkg>[@<version>] [<field>[.subfield]...]'
-)
-
-view.completion = function (opts, cb) {
- if (opts.conf.argv.remain.length <= 2) {
- // FIXME: there used to be registry completion here, but it stopped making
- // sense somewhere around 50,000 packages on the registry
- return cb()
- }
- // have the package, get the fields.
- const config = ViewConfig(npmConfig())
- const tag = config.tag
- const spec = npa(opts.conf.argv.remain[2])
- return packument(spec, config).then(d => {
- const dv = d.versions[d['dist-tags'][tag]]
- d.versions = Object.keys(d.versions).sort(semver.compareLoose)
- return getFields(d).concat(getFields(dv))
- }).nodeify(cb)
-
- function getFields (d, f, pref) {
- f = f || []
- if (!d) return f
- pref = pref || []
- Object.keys(d).forEach(function (k) {
- if (k.charAt(0) === '_' || k.indexOf('.') !== -1) return
- const p = pref.concat(k).join('.')
- f.push(p)
- if (Array.isArray(d[k])) {
- d[k].forEach(function (val, i) {
- const pi = p + '[' + i + ']'
- if (val && typeof val === 'object') getFields(val, f, [p])
- else f.push(pi)
- })
- return
- }
- if (typeof d[k] === 'object') getFields(d[k], f, [p])
- })
- return f
- }
-}
-
-function view (args, silent, cb) {
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
-
- if (!args.length) args = ['.']
-
- const opts = ViewConfig(npmConfig())
- const pkg = args.shift()
- let nv
- if (/^[.]@/.test(pkg)) {
- nv = npa.resolve(null, pkg.slice(2))
- } else {
- nv = npa(pkg)
- }
- const name = nv.name
- const local = (name === '.' || !name)
-
- if (opts.global && local) {
- return cb(new Error('Cannot use view command in global mode.'))
- }
-
- if (local) {
- const dir = npm.prefix
- BB.resolve(readJson(path.resolve(dir, 'package.json'))).nodeify((er, d) => {
- d = d || {}
- if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er)
- if (!d.name) return cb(new Error('Invalid package.json'))
-
- const p = d.name
- nv = npa(p)
- if (pkg && ~pkg.indexOf('@')) {
- nv.rawSpec = pkg.split('@')[pkg.indexOf('@')]
- }
-
- fetchAndRead(nv, args, silent, opts, cb)
- })
- } else {
- fetchAndRead(nv, args, silent, opts, cb)
- }
-}
-
-function fetchAndRead (nv, args, silent, opts, cb) {
- // get the data about this package
- let version = nv.rawSpec || npm.config.get('tag')
-
- return packument(nv, opts.concat({
- fullMetadata: true,
- 'prefer-online': true
- })).catch(err => {
- // TODO - this should probably go into pacote, but the tests expect it.
- if (err.code === 'E404') {
- err.message = `'${nv.name}' is not in the npm registry.`
- const validated = validateName(nv.name)
- if (!validated.validForNewPackages) {
- err.message += '\n'
- err.message += (validated.errors || []).join('\n')
- err.message += (validated.warnings || []).join('\n')
- } else {
- err.message += '\nYou should bug the author to publish it'
- err.message += '\n(or use the name yourself!)'
- err.message += '\n'
- err.message += '\nNote that you can also install from a'
- err.message += '\ntarball, folder, http url, or git url.'
- }
- }
- throw err
- }).then(data => {
- if (data['dist-tags'] && data['dist-tags'][version]) {
- version = data['dist-tags'][version]
- }
-
- if (data.time && data.time.unpublished) {
- const u = data.time.unpublished
- let er = new Error('Unpublished by ' + u.name + ' on ' + u.time)
- er.statusCode = 404
- er.code = 'E404'
- er.pkgid = data._id
- throw er
- }
-
- const results = []
- let error = null
- const versions = data.versions || {}
- data.versions = Object.keys(versions).sort(semver.compareLoose)
- if (!args.length) args = ['']
-
- // remove readme unless we asked for it
- if (args.indexOf('readme') === -1) {
- delete data.readme
- }
-
- Object.keys(versions).forEach(function (v) {
- if (semver.satisfies(v, version, true)) {
- args.forEach(function (args) {
- // remove readme unless we asked for it
- if (args.indexOf('readme') !== -1) {
- delete versions[v].readme
- }
- results.push(showFields(data, versions[v], args))
- })
- }
- })
- let retval = results.reduce(reducer, {})
-
- if (args.length === 1 && args[0] === '') {
- retval = cleanBlanks(retval)
- log.silly('view', retval)
- }
-
- if (silent) {
- } else if (error) {
- throw error
- } else if (
- !opts.json &&
- args.length === 1 &&
- args[0] === ''
- ) {
- data.version = version
- return BB.all(
- results.map((v) => prettyView(data, v[Object.keys(v)[0]][''], opts))
- ).then(() => retval)
- } else {
- return BB.fromNode(cb => {
- printData(retval, data._id, opts, cb)
- }).then(() => retval)
- }
- }).nodeify(cb)
-}
-
-function prettyView (packument, manifest, opts) {
- // More modern, pretty printing of default view
- const unicode = opts.unicode
- return BB.try(() => {
- if (!manifest) {
- log.error(
- 'view',
- 'No matching versions.\n' +
- 'To see a list of versions, run:\n' +
- `> npm view ${packument.name} versions`
- )
- return
- }
- const tags = []
- Object.keys(packument['dist-tags']).forEach((t) => {
- const version = packument['dist-tags'][t]
- tags.push(`${style.bright(color.green(t))}: ${version}`)
- })
- const unpackedSize = manifest.dist.unpackedSize &&
- byteSize(manifest.dist.unpackedSize)
- const licenseField = manifest.license || manifest.licence || 'Proprietary'
- const info = {
- name: color.green(manifest.name),
- version: color.green(manifest.version),
- bins: Object.keys(manifest.bin || {}).map(color.yellow),
- versions: color.yellow(packument.versions.length + ''),
- description: manifest.description,
- deprecated: manifest.deprecated,
- keywords: (packument.keywords || []).map(color.yellow),
- license: typeof licenseField === 'string'
- ? licenseField
- : (licenseField.type || 'Proprietary'),
- deps: Object.keys(manifest.dependencies || {}).map((dep) => {
- return `${color.yellow(dep)}: ${manifest.dependencies[dep]}`
- }),
- publisher: manifest._npmUser && unparsePerson({
- name: color.yellow(manifest._npmUser.name),
- email: color.cyan(manifest._npmUser.email)
- }),
- modified: color.yellow(relativeDate(packument.time[packument.version])),
- maintainers: (packument.maintainers || []).map((u) => unparsePerson({
- name: color.yellow(u.name),
- email: color.cyan(u.email)
- })),
- repo: (
- manifest.bugs && (manifest.bugs.url || manifest.bugs)
- ) || (
- manifest.repository && (manifest.repository.url || manifest.repository)
- ),
- site: (
- manifest.homepage && (manifest.homepage.url || manifest.homepage)
- ),
- stars: color.yellow('' + packument.users ? Object.keys(packument.users || {}).length : 0),
- tags,
- tarball: color.cyan(manifest.dist.tarball),
- shasum: color.yellow(manifest.dist.shasum),
- integrity: manifest.dist.integrity && color.yellow(manifest.dist.integrity),
- fileCount: manifest.dist.fileCount && color.yellow(manifest.dist.fileCount),
- unpackedSize: unpackedSize && color.yellow(unpackedSize.value) + ' ' + unpackedSize.unit
- }
- if (info.license.toLowerCase().trim() === 'proprietary') {
- info.license = style.bright(color.red(info.license))
- } else {
- info.license = color.green(info.license)
- }
- console.log('')
- console.log(
- style.underline(style.bright(`${info.name}@${info.version}`)) +
- ' | ' + info.license +
- ' | deps: ' + (info.deps.length ? color.cyan(info.deps.length) : color.green('none')) +
- ' | versions: ' + info.versions
- )
- info.description && console.log(info.description)
- if (info.repo || info.site) {
- info.site && console.log(color.cyan(info.site))
- }
-
- const warningSign = unicode ? ' ⚠️ ' : '!!'
- info.deprecated && console.log(
- `\n${style.bright(color.red('DEPRECATED'))}${
- warningSign
- } - ${info.deprecated}`
- )
-
- if (info.keywords.length) {
- console.log('')
- console.log('keywords:', info.keywords.join(', '))
- }
-
- if (info.bins.length) {
- console.log('')
- console.log('bin:', info.bins.join(', '))
- }
-
- console.log('')
- console.log('dist')
- console.log('.tarball:', info.tarball)
- console.log('.shasum:', info.shasum)
- info.integrity && console.log('.integrity:', info.integrity)
- info.unpackedSize && console.log('.unpackedSize:', info.unpackedSize)
-
- const maxDeps = 24
- if (info.deps.length) {
- console.log('')
- console.log('dependencies:')
- console.log(columns(info.deps.slice(0, maxDeps), {padding: 1}))
- if (info.deps.length > maxDeps) {
- console.log(`(...and ${info.deps.length - maxDeps} more.)`)
- }
- }
-
- if (info.maintainers && info.maintainers.length) {
- console.log('')
- console.log('maintainers:')
- info.maintainers.forEach((u) => console.log('-', u))
- }
-
- console.log('')
- console.log('dist-tags:')
- console.log(columns(info.tags))
-
- if (info.publisher || info.modified) {
- let publishInfo = 'published'
- if (info.modified) { publishInfo += ` ${info.modified}` }
- if (info.publisher) { publishInfo += ` by ${info.publisher}` }
- console.log('')
- console.log(publishInfo)
- }
- })
-}
-
-function cleanBlanks (obj) {
- const clean = {}
- Object.keys(obj).forEach(function (version) {
- clean[version] = obj[version]['']
- })
- return clean
-}
-
-function reducer (l, r) {
- if (r) {
- Object.keys(r).forEach(function (v) {
- l[v] = l[v] || {}
- Object.keys(r[v]).forEach(function (t) {
- l[v][t] = r[v][t]
- })
- })
- }
-
- return l
-}
-
-// return whatever was printed
-function showFields (data, version, fields) {
- const o = {}
- ;[data, version].forEach(function (s) {
- Object.keys(s).forEach(function (k) {
- o[k] = s[k]
- })
- })
- return search(o, fields.split('.'), version.version, fields)
-}
-
-function search (data, fields, version, title) {
- let field
- const tail = fields
- while (!field && fields.length) field = tail.shift()
- fields = [field].concat(tail)
- let o
- if (!field && !tail.length) {
- o = {}
- o[version] = {}
- o[version][title] = data
- return o
- }
- let index = field.match(/(.+)\[([^\]]+)\]$/)
- if (index) {
- field = index[1]
- index = index[2]
- if (data.field && data.field.hasOwnProperty(index)) {
- return search(data[field][index], tail, version, title)
- } else {
- field = field + '[' + index + ']'
- }
- }
- if (Array.isArray(data)) {
- if (data.length === 1) {
- return search(data[0], fields, version, title)
- }
- let results = []
- data.forEach(function (data, i) {
- const tl = title.length
- const newt = title.substr(0, tl - fields.join('.').length - 1) +
- '[' + i + ']' + [''].concat(fields).join('.')
- results.push(search(data, fields.slice(), version, newt))
- })
- results = results.reduce(reducer, {})
- return results
- }
- if (!data.hasOwnProperty(field)) return undefined
- data = data[field]
- if (tail.length) {
- if (typeof data === 'object') {
- // there are more fields to deal with.
- return search(data, tail, version, title)
- } else {
- return new Error('Not an object: ' + data)
- }
- }
- o = {}
- o[version] = {}
- o[version][title] = data
- return o
-}
-
-function printData (data, name, opts, cb) {
- const versions = Object.keys(data)
- let msg = ''
- let msgJson = []
- const includeVersions = versions.length > 1
- let includeFields
-
- versions.forEach(function (v) {
- const fields = Object.keys(data[v])
- includeFields = includeFields || (fields.length > 1)
- if (opts.json) msgJson.push({})
- fields.forEach(function (f) {
- let d = cleanup(data[v][f])
- if (fields.length === 1 && opts.json) {
- msgJson[msgJson.length - 1][f] = d
- }
- if (includeVersions || includeFields || typeof d !== 'string') {
- if (opts.json) {
- msgJson[msgJson.length - 1][f] = d
- } else {
- d = util.inspect(d, { showHidden: false, depth: 5, colors: npm.color, maxArrayLength: null })
- }
- } else if (typeof d === 'string' && opts.json) {
- d = JSON.stringify(d)
- }
- if (!opts.json) {
- if (f && includeFields) f += ' = '
- if (d.indexOf('\n') !== -1) d = ' \n' + d
- msg += (includeVersions ? name + '@' + v + ' ' : '') +
- (includeFields ? f : '') + d + '\n'
- }
- })
- })
-
- if (opts.json) {
- if (msgJson.length && Object.keys(msgJson[0]).length === 1) {
- const k = Object.keys(msgJson[0])[0]
- msgJson = msgJson.map(function (m) { return m[k] })
- }
-
- if (msgJson.length === 1) {
- msg = JSON.stringify(msgJson[0], null, 2) + '\n'
- } else if (msgJson.length > 1) {
- msg = JSON.stringify(msgJson, null, 2) + '\n'
- }
- }
-
- // preserve output symmetry by adding a whitespace-only line at the end if
- // there's one at the beginning
- if (/^\s*\n/.test(msg)) msg += '\n'
-
- // disable the progress bar entirely, as we can't meaningfully update it if
- // we may have partial lines printed.
- log.disableProgress()
-
- // print directly to stdout to not unnecessarily add blank lines
- process.stdout.write(msg, () => cb(null, data))
-}
-function cleanup (data) {
- if (Array.isArray(data)) {
- return data.map(cleanup)
- }
- if (!data || typeof data !== 'object') return data
-
- if (typeof data.versions === 'object' &&
- data.versions &&
- !Array.isArray(data.versions)) {
- data.versions = Object.keys(data.versions || {})
- }
-
- let keys = Object.keys(data)
- keys.forEach(function (d) {
- if (d.charAt(0) === '_') delete data[d]
- else if (typeof data[d] === 'object') data[d] = cleanup(data[d])
- })
- keys = Object.keys(data)
- if (keys.length <= 3 &&
- data.name &&
- (keys.length === 1 ||
- (keys.length === 3 && data.email && data.url) ||
- (keys.length === 2 && (data.email || data.url)))) {
- data = unparsePerson(data)
- }
- return data
-}
-function unparsePerson (d) {
- if (typeof d === 'string') return d
- return d.name +
- (d.email ? ' <' + d.email + '>' : '') +
- (d.url ? ' (' + d.url + ')' : '')
-}
diff --git a/deps/node/deps/npm/lib/visnup.js b/deps/node/deps/npm/lib/visnup.js
deleted file mode 100644
index a61bacb7..00000000
--- a/deps/node/deps/npm/lib/visnup.js
+++ /dev/null
@@ -1,43 +0,0 @@
-module.exports = visnup
-var npm = require('./npm.js')
-var output = require('./utils/output.js')
-
-var handsomeFace = [
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 237, 236, 236, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 235, 236, 235, 233, 237, 235, 233, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 235, 233, 232, 235, 235, 234, 233, 236, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 237, 235, 232, 232, 234, 233, 233, 232, 232, 233, 232, 232, 235, 232, 233, 234, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 232, 232, 232, 239, 238, 235, 233, 232, 232, 232, 232, 232, 232, 232, 233, 235, 232, 233, 233, 232, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 234, 234, 232, 233, 234, 233, 234, 235, 233, 235, 60, 238, 238, 234, 234, 233, 234, 233, 238, 251, 246, 233, 233, 232, 0, 0, 0, 0, 0, 0],
- [0, 0, 233, 233, 233, 232, 232, 239, 249, 251, 252, 231, 231, 188, 250, 254, 59, 60, 255, 231, 231, 231, 252, 235, 239, 235, 232, 233, 0, 0, 0, 0, 0, 0],
- [0, 0, 232, 233, 232, 232, 232, 248, 231, 231, 231, 231, 231, 231, 231, 254, 238, 254, 231, 231, 231, 231, 231, 252, 233, 235, 237, 233, 234, 0, 0, 0, 0, 0],
- [0, 0, 233, 232, 232, 232, 248, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 251, 233, 233, 233, 236, 233, 0, 0, 0, 0],
- [232, 233, 233, 232, 232, 246, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 249, 233, 234, 234, 0, 0, 0, 0],
- [232, 232, 232, 232, 233, 249, 231, 255, 255, 255, 255, 254, 109, 60, 239, 237, 238, 237, 235, 235, 235, 235, 236, 235, 235, 235, 234, 232, 232, 232, 232, 232, 233, 0],
- [0, 232, 232, 233, 233, 233, 233, 233, 233, 233, 233, 233, 235, 236, 238, 238, 235, 188, 254, 254, 145, 236, 252, 254, 254, 254, 254, 249, 236, 235, 232, 232, 233, 0],
- [0, 0, 233, 237, 249, 239, 233, 252, 231, 231, 231, 231, 231, 231, 254, 235, 235, 254, 231, 231, 251, 235, 237, 231, 231, 231, 231, 7, 237, 235, 232, 233, 233, 0],
- [0, 0, 0, 0, 233, 248, 239, 233, 231, 231, 231, 231, 254, 233, 233, 235, 254, 255, 231, 254, 237, 236, 254, 239, 235, 235, 233, 233, 232, 232, 233, 232, 0, 0],
- [0, 0, 0, 232, 233, 246, 255, 255, 236, 236, 236, 236, 236, 255, 231, 231, 231, 231, 231, 231, 252, 234, 248, 231, 231, 231, 231, 248, 232, 232, 232, 0, 0, 0],
- [0, 0, 0, 0, 235, 237, 7, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 255, 238, 235, 7, 231, 231, 231, 246, 232, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 235, 103, 188, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 252, 232, 238, 231, 231, 255, 244, 232, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 235, 236, 103, 146, 253, 255, 231, 231, 231, 231, 231, 253, 251, 250, 250, 250, 246, 232, 235, 152, 255, 146, 66, 233, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 233, 103, 146, 146, 146, 146, 254, 231, 231, 231, 109, 103, 146, 255, 188, 239, 240, 103, 255, 253, 103, 238, 234, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 232, 235, 109, 146, 146, 146, 146, 146, 252, 152, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 103, 235, 233, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 235, 235, 103, 146, 146, 146, 146, 146, 146, 188, 188, 188, 188, 188, 188, 152, 146, 146, 146, 66, 235, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 233, 235, 66, 146, 146, 146, 146, 152, 255, 146, 240, 239, 241, 109, 146, 146, 146, 103, 233, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 234, 237, 109, 146, 146, 146, 146, 146, 254, 231, 231, 188, 146, 146, 146, 103, 233, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 233, 237, 60, 103, 146, 146, 146, 146, 146, 103, 66, 60, 235, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 233, 233, 236, 235, 237, 235, 237, 237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
-]
-
-function visnup (args, cb) {
- handsomeFace.forEach(function (line) {
- output(line.map(function (ch) {
- return '\u001b[' + (ch ? '48;5;' + ch : ch) + 'm'
- }).join(' '))
- })
-
- var c = args.shift()
- if (c) npm.commands[c](args, cb)
- else cb()
-}
diff --git a/deps/node/deps/npm/lib/whoami.js b/deps/node/deps/npm/lib/whoami.js
deleted file mode 100644
index 5145b447..00000000
--- a/deps/node/deps/npm/lib/whoami.js
+++ /dev/null
@@ -1,63 +0,0 @@
-'use strict'
-
-const BB = require('bluebird')
-
-const npmConfig = require('./config/figgy-config.js')
-const fetch = require('libnpm/fetch')
-const figgyPudding = require('figgy-pudding')
-const npm = require('./npm.js')
-const output = require('./utils/output.js')
-
-const WhoamiConfig = figgyPudding({
- json: {},
- registry: {}
-})
-
-module.exports = whoami
-
-whoami.usage = 'npm whoami [--registry <registry>]\n(just prints username according to given registry)'
-
-function whoami ([spec], silent, cb) {
- // FIXME: need tighter checking on this, but is a breaking change
- if (typeof cb !== 'function') {
- cb = silent
- silent = false
- }
- const opts = WhoamiConfig(npmConfig())
- return BB.try(() => {
- // First, check if we have a user/pass-based auth
- const registry = opts.registry
- if (!registry) throw new Error('no default registry set')
- return npm.config.getCredentialsByURI(registry)
- }).then(({username, token}) => {
- if (username) {
- return username
- } else if (token) {
- return fetch.json('/-/whoami', opts.concat({
- spec
- })).then(({username}) => {
- if (username) {
- return username
- } else {
- throw Object.assign(new Error(
- 'Your auth token is no longer valid. Please log in again.'
- ), {code: 'ENEEDAUTH'})
- }
- })
- } else {
- // At this point, if they have a credentials object, it doesn't have a
- // token or auth in it. Probably just the default registry.
- throw Object.assign(new Error(
- 'This command requires you to be logged in.'
- ), {code: 'ENEEDAUTH'})
- }
- }).then(username => {
- if (silent) {
- } else if (opts.json) {
- output(JSON.stringify(username))
- } else {
- output(username)
- }
- return username
- }).nodeify(cb)
-}
diff --git a/deps/node/deps/npm/lib/xmas.js b/deps/node/deps/npm/lib/xmas.js
deleted file mode 100644
index 65c0c131..00000000
--- a/deps/node/deps/npm/lib/xmas.js
+++ /dev/null
@@ -1,59 +0,0 @@
-// happy xmas
-var log = require('npmlog')
-
-module.exports = function (args, cb) {
- var s = process.platform === 'win32' ? ' *' : ' \u2605'
- var f = '\uFF0F'
- var b = '\uFF3C'
- var x = process.platform === 'win32' ? ' ' : ''
- var o = [
- '\u0069', '\u0020', '\u0020', '\u0020', '\u0020', '\u0020',
- '\u0020', '\u0020', '\u0020', '\u0020', '\u0020', '\u0020',
- '\u0020', '\u2E1B', '\u2042', '\u2E2E', '&', '@', '\uFF61'
- ]
- var oc = [21, 33, 34, 35, 36, 37]
- var l = '\u005e'
-
- function w (s) { process.stderr.write(s) }
-
- w('\n')
- ;(function T (H) {
- for (var i = 0; i < H; i++) w(' ')
- w(x + '\u001b[33m' + s + '\n')
- var M = H * 2 - 1
- for (var L = 1; L <= H; L++) {
- var O = L * 2 - 2
- var S = (M - O) / 2
- for (i = 0; i < S; i++) w(' ')
- w(x + '\u001b[32m' + f)
- for (i = 0; i < O; i++) {
- w(
- '\u001b[' + oc[Math.floor(Math.random() * oc.length)] + 'm' +
- o[Math.floor(Math.random() * o.length)]
- )
- }
- w(x + '\u001b[32m' + b + '\n')
- }
- w(' ')
- for (i = 1; i < H; i++) w('\u001b[32m' + l)
- w('| ' + x + ' |')
- for (i = 1; i < H; i++) w('\u001b[32m' + l)
- if (H > 10) {
- w('\n ')
- for (i = 1; i < H; i++) w(' ')
- w('| ' + x + ' |')
- for (i = 1; i < H; i++) w(' ')
- }
- })(20)
- w('\n\n')
- log.heading = ''
- log.addLevel('npm', 100000, log.headingStyle)
- log.npm('loves you', 'Happy Xmas, JavaScripters!')
- cb()
-}
-var dg = false
-Object.defineProperty(module.exports, 'usage', {get: function () {
- if (dg) module.exports([], function () {})
- dg = true
- return ' '
-}})