diff options
87 files changed, 2201 insertions, 1796 deletions
diff --git a/lib/config/flat-options.js b/lib/config/flat-options.js index b035bf4ff..b61fdc69b 100644 --- a/lib/config/flat-options.js +++ b/lib/config/flat-options.js @@ -161,13 +161,16 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({ // used to build up the appropriate {add:{...}} options to Arborist.reify save: npm.config.get('save'), - saveBundle: npm.config.get('save-bundle'), - saveDev: npm.config.get('save-dev'), - saveOptional: npm.config.get('save-optional'), - savePeer: npm.config.get('save-peer'), - saveProd: npm.config.get('save-prod'), - saveExact: npm.config.get('save-exact'), - savePrefix: npm.config.get('save-prefix'), + saveBundle: npm.config.get('save-bundle') && !npm.config.get('save-peer'), + saveType: npm.config.get('save-optional') && npm.config.get('save-peer') + ? 'peerOptional' + : npm.config.get('save-optional') ? 'optional' + : npm.config.get('save-dev') ? 'dev' + : npm.config.get('save-peer') ? 'peer' + : npm.config.get('save-prod') ? 'prod' + : null, + savePrefix: npm.config.get('save-exact') ? '' + : npm.config.get('save-prefix'), // configs for npm-registry-fetch otp: npm.config.get('otp'), diff --git a/lib/install.js b/lib/install.js index 401f85be0..eb60c794d 100644 --- a/lib/install.js +++ b/lib/install.js @@ -123,13 +123,13 @@ function install (where, args, cb) { where = null } // the /path/to/node_modules/.. - var globalTop = path.resolve(npm.globalDir, '..') + const globalTop = path.resolve(npm.globalDir, '..') if (!where) { where = npm.flatOptions.global ? globalTop : npm.prefix } - const {dryRun} = npm.flatOptions.dryRun + const {dryRun} = npm.flatOptions // TODO: Add warnings for other deprecated flags if (npm.config.get('dev')) { @@ -141,33 +141,6 @@ function install (where, args, cb) { } args = args.filter(a => path.resolve(a) !== npm.prefix) - const saveWhere = npm.flatOptions.saveProd ? 'dependencies' - : npm.flatOptions.saveDev ? 'devDependencies' - : npm.flatOptions.saveOptional ? 'optionalDependencies' - : npm.flatOptions.savePeer ? 'peerDependencies' - : 'dependencies' - - const {saveBundled} = npm.flatOptions - const add = !args.length ? null : args.reduce((add, a) => { - // npm install foo - // npm install @foo/bar - // npm install foo@bar - // npm install @foo/bar@baz - // npm install git+ssh://foogit.com:bar/baz#boo - const spec = npa(a, where) - add[saveWhere].push(spec) - - // XXX need to fix this npm install http://foo.com/bar.tgz --save-bundled - // TODO: arborist should take saveBundled boolean - // Point of research: can you bundle any dep other than production? If not, - // we can pass `bundleDependencies: [array, of, specs]` to arborist, - // it'll do {dependencies:{name:spec, ...}, bundleDependencies:[name,...]} - if (saveBundled && spec.name) { - add.bundleDependencies.push(spec.name) - } - return add - }, { [saveWhere]: [], bundleDependencies: [] }) - const arb = new Arborist({ ...this.flatOptions, path: where, @@ -181,7 +154,7 @@ function install (where, args, cb) { const opt = { ...this.flatOptions, - add, + add: args, } arb[dryRun ? 'buildIdealTree' : 'reify'](opt).then(tree => { output('TREEEEEEEE', tree) diff --git a/node_modules/@npmcli/arborist/README.md b/node_modules/@npmcli/arborist/README.md index a16b298ff..0a7f07afa 100644 --- a/node_modules/@npmcli/arborist/README.md +++ b/node_modules/@npmcli/arborist/README.md @@ -76,15 +76,21 @@ arb.buildIdealTree(options).then(() => { // next step is to reify that ideal tree onto disk. // options can be: // rm: array of package names to remove at top level - // add: object with the following potential properties: - // - dependencies - // - peerDependencies - // - optionalDependencies - // - devDependencies - // - peerDependenciesMeta - // Each is an array of package specifiers, which would be passed to - // `npm install`. They're added to the root node's requirements, and - // then the tree is built. + // add: Array of package specifiers to add at the top level. Each of + // these will be resolved with pacote.manifest if the name can't be + // determined from the spec. (Eg, `github:foo/bar` vs `foo@somespec`.) + // The dep will be saved in the location where it already exists, + // (or pkg.dependencies) unless a different saveType is specified. + // saveType: Save added packages in a specific dependency set. + // - null (default) Wherever they exist already, or 'dependencies' + // - prod: definitely in 'dependencies' + // - optional: in 'optionalDependencies' + // - dev: devDependencies + // - peer: save in peerDependencies, and remove any optional flag from + // peerDependenciesMeta if one exists + // - peerOptional: save in peerDependencies, and add a + // peerDepsMeta[name].optional flag + // saveBundle: add newly added deps to the bundleDependencies list // update: Either `true` to just go ahead and update everything, or an // object with any or all of the following fields: // - all: boolean. set to true to just update everything diff --git a/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js b/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js index 14f38f75c..999c2d247 100644 --- a/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js +++ b/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js @@ -5,37 +5,98 @@ const removeFromOthers = (name, type, pkg) => { 'dependencies', 'optionalDependencies', 'devDependencies', + 'peerDependenciesMeta', + 'peerDependencies', ]) - // these two ride along together - if (type !== 'peerDependencies' && type !== 'peerDependenciesMeta') { - others.delete(type) - others.add('peerDependenciesMeta') - others.add('peerDependencies') + + switch (type) { + case 'prod': + others.delete('dependencies') + break + case 'dev': + others.delete('devDependencies') + break + case 'optional': + others.delete('optionalDependencies') + break + case 'peer': + case 'peerOptional': + others.delete('peerDependencies') + others.delete('peerDependenciesMeta') + break } + for (const other of others) { deleteSubKey(pkg, other, name) } } -const add = (pkg, add) => { - // if adding to one kind of dependency set, remove from others - for (const [type, specs] of Object.entries(add)) { - if (type === 'bundleDependencies') { - pkg.bundleDependencies = pkg.bundleDependencies || [] - pkg.bundleDependencies.push(...specs) - } else { - // keep the existing value if it's '' - for (const [name, spec] of Object.entries(specs)) { - removeFromOthers(name, type, pkg) - pkg[type] = pkg[type] || {} - if (spec !== '' || pkg[type][name] === undefined) - pkg[type][name] = spec - } - } +const add = ({pkg, add, saveBundle, saveType}) => { + for (const spec of add) { + addSingle({pkg, spec, saveBundle, saveType}) } return pkg } +const addSingle = ({pkg, spec, saveBundle, saveType}) => { + if (!saveType) + saveType = getSaveType(pkg, spec) + + const {name} = spec + removeFromOthers(name, saveType, pkg) + const type = saveType === 'prod' ? 'dependencies' + : saveType === 'dev' ? 'devDependencies' + : saveType === 'optional' ? 'optionalDependencies' + : saveType === 'peer' || saveType === 'peerOptional' ? 'peerDependencies' + : /* istanbul ignore next */ null + + pkg[type] = pkg[type] || {} + if (spec.rawSpec !== '' || pkg[type][name] === undefined) + pkg[type][name] = spec.rawSpec || '*' + + if (saveType === 'peer' || saveType === 'peerOptional') { + const pdm = pkg.peerDependenciesMeta || {} + if (saveType === 'peer' && pdm[name] && pdm[name].optional) + pdm[name].optional = false + else if (saveType === 'peerOptional') { + pdm[name] = pdm[name] || {} + pdm[name].optional = true + pkg.peerDependenciesMeta = pdm + } + } + + if (saveBundle) { + // keep it sorted, keep it unique + const bd = new Set(pkg.bundleDependencies || []) + bd.add(spec.name) + pkg.bundleDependencies = [...bd].sort((a, b) => a.localeCompare(b)) + } +} + +const getSaveType = (pkg, spec) => { + const {name} = spec + const { + // these names are so lonnnnngggg + dependencies: deps, + devDependencies: devDeps, + optionalDependencies: optDeps, + peerDependencies: peerDeps, + peerDependenciesMeta: peerDepsMeta, + } = pkg + + if (devDeps && devDeps[name] !== undefined) + return 'dev' + else if (optDeps && optDeps[name] !== undefined) + return 'optional' + else if (peerDeps && peerDeps[name] !== undefined) { + if (peerDepsMeta && peerDepsMeta[name] && peerDepsMeta[name].optional) + return 'peerOptional' + else + return 'peer' + } else + return 'prod' +} + const deleteSubKey = (obj, k, sk) => { if (obj[k]) { delete obj[k][sk] diff --git a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index 069e234f0..94647727b 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -57,7 +57,7 @@ const _fixDepFlags = Symbol('fixDepFlags') const _resolveLinks = Symbol('resolveLinks') const _rootNodeFromPackage = Symbol('rootNodeFromPackage') const _add = Symbol('add') -const _explicitRequests = Symbol('explicitRequests') +const _resolvedAdd = Symbol.for('resolvedAdd') const _queueNamedUpdates = Symbol('queueNamedUpdates') const _shouldUpdateNode = Symbol('shouldUpdateNode') const _resetDepFlags = Symbol('resetDepFlags') @@ -65,10 +65,13 @@ const _loadFailures = Symbol('loadFailures') const _pruneFailedOptional = Symbol('pruneFailedOptional') const _linkNodes = Symbol('linkNodes') const _follow = Symbol('follow') +const _globalStyle = Symbol('globalStyle') +const _globalRootNode = Symbol('globalRootNode') // used by Reify mixin +const _explicitRequests = Symbol.for('explicitRequests') +const _global = Symbol.for('global') const _idealTreePrune = Symbol.for('idealTreePrune') -const _resolvedAdd = Symbol.for('resolvedAdd') const Virtual = require('./load-virtual.js') const Actual = require('./load-actual.js') @@ -81,9 +84,17 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl const registry = options.registry || 'https://registry.npmjs.org' options.registry = this.registry = registry.replace(/\/+$/, '') + '/' + const { + idealTree = null, + global = false, + follow = false, + globalStyle = false, + } = options + this.idealTree = options.idealTree - this[_follow] = !!options.follow + this[_globalStyle] = this[_global] || globalStyle + this[_follow] = !!follow this[_explicitRequests] = new Set() this[_preferDedupe] = false @@ -104,6 +115,9 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl if (this.idealTree) return Promise.resolve(this.idealTree) + if (!options.add && !options.rm && this[_global]) + return Promise.reject(new Error('global requires an add or rm option')) + // first get the virtual tree, if possible. If there's a lockfile, then // that defines the ideal tree, unless the root package.json is not // satisfied by what the ideal tree provides. @@ -155,17 +169,22 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl // load the initial tree, either the virtualTree from a shrinkwrap, // or just the root node from a package.json [_initTree] () { - return rpj(this.path + '/package.json') - .then(pkg => this[_rootNodeFromPackage](pkg)) + return ( + this[_global] ? this[_globalRootNode]() + : rpj(this.path + '/package.json') + .then( + pkg => this[_rootNodeFromPackage](pkg), + er => this[_rootNodeFromPackage]({}) + )) // ok to not have a virtual tree. probably initial install. // When updating all, we load the shrinkwrap, but don't bother // to build out the full virtual tree from it, since we'll be // reconstructing it anyway. - .then(root => this[_updateAll] - ? Shrinkwrap.load({ path: this.path }).then(meta => { - meta.reset() - root.meta = meta - return root + .then(root => this[_global] ? root + : this[_updateAll] ? Shrinkwrap.load({ path: this.path }).then(meta => { + meta.reset() + root.meta = meta + return root }) : this.loadVirtual({ root })) @@ -177,6 +196,17 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl }) } + [_globalRootNode] () { + const root = this[_rootNodeFromPackage]({}) + // this is a gross kludge to handle the fact that we don't save + // metadata on the root node in global installs, because the "root" + // node is something like /usr/local/lib/node_modules. + const meta = new Shrinkwrap({ path: this.path }) + meta.reset() + root.meta = meta + return Promise.resolve(root) + } + [_rootNodeFromPackage] (pkg) { return new Node({ path: this.path, @@ -186,6 +216,7 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl devOptional: false, peer: false, optional: false, + global: this[_global], }) } @@ -198,65 +229,50 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl if (this[_updateNames].length) this[_queueNamedUpdates]() - if (options.rm && options.rm.length) + if (options.rm && options.rm.length) { addRmPkgDeps.rm(this.idealTree.package, options.rm) + for (const name of options.rm) + this[_explicitRequests].add(name) + } // triggers a refresh of all edgesOut const after = () => this.idealTree.package = this.idealTree.package // these just add and remove to/from the root node return (options.add) - ? this[_add](options.add).then(after) + ? this[_add](options).then(after) : after() } - // add => might return promise - // might not have name, call pacote.manifest (find name) - [_add] (add) { + // This returns a promise because we might not have the name yet, + // and need to call pacote.manifest to find the name. + [_add] ({add, saveType = null, saveBundle = false}) { const promises = [] - this[_resolvedAdd] = {} - - // not going to work for: - // peerDepsMeta - // bundledDeps - for (const [type, specs] of Object.entries(add)) { - const p = Promise.all(specs.map(s => { - const spec = npa(s, this.path) - if (spec.name) { - return spec - } else { - return pacote.manifest(spec).then(mani => { - spec.name = mani.name - return spec - }) - } - })).then(specs => { - for (const spec of specs) { - if (type === 'bundleDependencies') { - this[_resolvedAdd][type] = this[_resolvedAdd][type] || [] - this[_resolvedAdd][type].push(spec.name) - } else { - this[_resolvedAdd][type] = this[_resolvedAdd][type] || {} - this[_resolvedAdd][type][spec.name] = spec.rawSpec - } - } + + // get the name for each of the specs in the list. + // ie, doing `foo@bar` we just return foo + // but if it's a url or git, we don't know the name until we + // fetch it and look in its manifest. + return Promise.all(add.map(s => { + const spec = npa(s, this.path) + return spec.name ? spec : pacote.manifest(spec).then(mani => { + spec.name = mani.name + return spec }) - promises.push(p) - } - return Promise.all(promises).then(() => { - // get the list of deps that we're explicitly requesting, so that - // 'npm install foo' will reinstall, even if we already have it. - for (const [type, specs] of Object.entries(this[_resolvedAdd])) { - if (type === 'dependencies' || type === 'devDependencies' || - type === 'optionalDependencies' || type === 'peerDependencies') { - for (const name of Object.keys(this[_resolvedAdd][type])) { - this[_explicitRequests].add(name) - } - } + })).then(add => { + this[_resolvedAdd] = add + // now add is a list of spec objects with names. + // find a home for each of them! + addRmPkgDeps.add({ + pkg: this.idealTree.package, + add, + saveBundle, + saveType, + }) + for (const spec of add) { + this[_explicitRequests].add(spec.name) } - - addRmPkgDeps.add(this.idealTree.package, this[_resolvedAdd]) }) } @@ -526,6 +542,11 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl // very disk-inefficient if (this[_legacyBundling]) break + + // when installing globally, or just in global style, we never place + // deps above the first level. + if (this[_globalStyle] && check.resolveParent === this.idealTree) + break } if (!target) { diff --git a/node_modules/@npmcli/arborist/lib/arborist/load-actual.js b/node_modules/@npmcli/arborist/lib/arborist/load-actual.js index f9d2610dc..3e7abf796 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/load-actual.js +++ b/node_modules/@npmcli/arborist/lib/arborist/load-actual.js @@ -12,12 +12,12 @@ const Node = require('../node.js') const Link = require('../link.js') const realpath = require('../realpath.js') -const loadFSNode = Symbol('loadFSNode') -const newNode = Symbol('newNode') -const newLink = Symbol('newLink') -const loadFSTree = Symbol('loadFSTree') -const loadFSChildren = Symbol('loadFSChildren') -const findFSParents = Symbol('findFSParents') +const _loadFSNode = Symbol('loadFSNode') +const _newNode = Symbol('newNode') +const _newLink = Symbol('newLink') +const _loadFSTree = Symbol('loadFSTree') +const _loadFSChildren = Symbol('loadFSChildren') +const _findFSParents = Symbol('findFSParents') const _actualTreeLoaded = Symbol('actualTreeLoaded') const _rpcache = Symbol('realpathCache') @@ -27,10 +27,15 @@ const _cache = Symbol('nodeLoadingCache') const _loadActualVirtually = Symbol('loadActualVirtually') const _loadActualActually = Symbol('loadActualActually') +const _filter = Symbol('filter') +const _global = Symbol.for('global') + module.exports = cls => class ActualLoader extends cls { constructor (options) { super(options) + this[_global] = !!options.global + // the tree of nodes on disk this.actualTree = options.actualTree @@ -58,13 +63,28 @@ module.exports = cls => class ActualLoader extends cls { } // public method - loadActual () { + loadActual (options = {}) { // mostly realpath to throw if the root doesn't exist if (this.actualTree) return Promise.resolve(this.actualTree) + const { global = false, filter = () => true } = options + this[_filter] = filter + if (global) { + return realpath(this.path, this[_rpcache], this[_stcache]) + .then(real => this[this.path === real ? _newNode : _newLink]({ + path: this.path, + realpath: real, + pkg: {}, + global, + })).then(node => { + this.actualTree = node + return this[_loadActualActually]() + }) + } + return realpath(this.path, this[_rpcache], this[_stcache]) - .then(real => this[loadFSNode]({ path: this.path, real })) + .then(real => this[_loadFSNode]({ path: this.path, real })) .then(node => { // XXX only rely on this if the hidden lockfile is the newest thing? // need some kind of heuristic, like if the package.json or sw have @@ -72,6 +92,7 @@ module.exports = cls => class ActualLoader extends cls { // user switches back and forth between Arborist and another way of // mutating the node_modules folder. this.actualTree = node + return Shrinkwrap.load({ path: node.realpath, hiddenLockfile: true, @@ -107,17 +128,17 @@ module.exports = cls => class ActualLoader extends cls { this[_actualTreeLoaded] = new Set() // did is a set of all realpaths visited on this walk // important when a link points at a node we end up visiting later. - return this[loadFSTree](this.actualTree) - .then(() => this[findFSParents]()) + return this[_loadFSTree](this.actualTree) + .then(() => this[_findFSParents]()) .then(() => calcDepFlags(this.actualTree)) .then(() => this.actualTree) } - [loadFSNode] ({ path, parent, real, root }) { + [_loadFSNode] ({ path, parent, real, root }) { if (!real) return realpath(path, this[_rpcache], this[_stcache]) .then( - real => this[loadFSNode]({ path, parent, real, root }), + real => this[_loadFSNode]({ path, parent, real, root }), // if realpath fails, just provide a dummy error node error => new Node({ error, path, realpath: path, parent, root }) ) @@ -139,7 +160,7 @@ module.exports = cls => class ActualLoader extends cls { // soldier on if read-package-json raises an error .then(pkg => [pkg, null], error => [null, error]) .then(([pkg, error]) => { - return this[path === real ? newNode : newLink]({ + return this[path === real ? _newNode : _newLink]({ path, realpath: real, pkg, @@ -163,7 +184,7 @@ module.exports = cls => class ActualLoader extends cls { // the tree or attempting to load children. However, it IS remarkably // difficult to get to happen in a test environment to verify reliably. // Hence this kludge. - [newNode] (options) { + [_newNode] (options) { // check it for an fsParent if it's a tree top. there's a decent chance // it'll get parented later, making the fsParent scan a no-op, but better // safe than sorry, since it's cheap. @@ -175,7 +196,7 @@ module.exports = cls => class ActualLoader extends cls { : new Node(options) } - [newLink] (options) { + [_newLink] (options) { const { realpath } = options this[_linkTargets].add(realpath) const target = this[_cache].get(realpath) @@ -189,8 +210,8 @@ module.exports = cls => class ActualLoader extends cls { // pick up peers of that node in the node_modules tree. This is how // we can read pnpm trees properly. Defer loading until this is done. if (nmParent) { - return this[loadFSNode]({ path: nmParent, root: link.root }) - .then(node => this[loadFSTree](node)) + return this[_loadFSNode]({ path: nmParent, root: link.root }) + .then(node => this[_loadFSTree](node)) .then(() => link) } } else if (target.then) @@ -199,14 +220,14 @@ module.exports = cls => class ActualLoader extends cls { return link } - [loadFSTree] (node) { + [_loadFSTree] (node) { const did = this[_actualTreeLoaded] node = node.target || node // if a Link target has started, but not completed, then // a Promise will be in the cache to indicate this. if (node.then) - return node.then(node => this[loadFSTree](node)) + return node.then(node => this[_loadFSTree](node)) // impossible except in pathological ELOOP cases /* istanbul ignore next */ @@ -214,25 +235,26 @@ module.exports = cls => class ActualLoader extends cls { return Promise.resolve(node) did.add(node.realpath) - return this[loadFSChildren](node) + return this[_loadFSChildren](node) .then(() => Promise.all( [...node.children.entries()] .filter(([name, kid]) => !did.has(kid.realpath)) - .map(([name, kid]) => this[loadFSTree](kid)))) + .map(([name, kid]) => this[_loadFSTree](kid)))) } // create child nodes for all the entries in node_modules // and attach them to the node as a parent - [loadFSChildren] (node) { + [_loadFSChildren] (node) { const nm = resolve(node.realpath, 'node_modules') return readdir(nm).then(kids => { return Promise.all( // ignore . dirs and retired scoped package folders kids.filter(kid => !/^(@[^/]+\/)?\./.test(kid)) - .map(kid => this[loadFSNode]({ - parent: node, - path: resolve(nm, kid), - }))) + .filter(kid => this[_filter](node, kid)) + .map(kid => this[_loadFSNode]({ + parent: node, + path: resolve(nm, kid), + }))) }, // error in the readdir is not fatal, just means no kids () => {}) @@ -242,7 +264,7 @@ module.exports = cls => class ActualLoader extends cls { // node_modules tree sense, of any link targets. this allows us to // resolve deps that node will find, but a legacy npm view of the // world would not have noticed. - [findFSParents] () { + [_findFSParents] () { for (const path of this[_linkTargets]) { const node = this[_cache].get(path) if (!node.parent && !node.fsParent) { diff --git a/node_modules/@npmcli/arborist/lib/arborist/reify.js b/node_modules/@npmcli/arborist/lib/arborist/reify.js index 3d71f6614..bb0a11baf 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -12,6 +12,7 @@ const binLinks = require('bin-links') const runScript = require('@npmcli/run-script') const rpj = require('read-package-json-fast') const {checkEngine, checkPlatform} = require('npm-install-checks') +const updateDepSpec = require('../update-dep-spec.js') const boolEnv = b => b ? '1' : '' @@ -45,6 +46,7 @@ const _registryResolved = Symbol('registryResolved') const _trashList = Symbol('trashList') const _addNodeToTrashList = Symbol('addNodeToTrashList') const _handleOptionalFailure = Symbol('handleOptionalFailure') +const _loadTrees = Symbol('loadTrees') // shared symbols for swapping out when testing const _diffTrees = Symbol.for('diffTrees') @@ -77,14 +79,14 @@ const _omitDev = Symbol('omitDev') const _omitOptional = Symbol('omitOptional') const _omitPeer = Symbol('omitPeer') -const _global = Symbol('global') +const _global = Symbol.for('global') const _ignoreScripts = Symbol('ignoreScripts') const _scriptShell = Symbol('scriptShell') const _force = Symbol('force') // defined by Ideal mixin const _idealTreePrune = Symbol.for('idealTreePrune') -const _explicitRootInstalls = Symbol.for('explicitRootInstalls') +const _explicitRequests = Symbol.for('explicitRequests') const _resolvedAdd = Symbol.for('resolvedAdd') module.exports = cls => class Reifier extends Ideal(cls) { @@ -93,14 +95,16 @@ module.exports = cls => class Reifier extends Ideal(cls) { const { ignoreScripts = false, - global = false, force = false, scriptShell, savePrefix = '^', + binLinks = true, } = options + if (!binLinks) + this[_binLinks] = () => {} + this[_ignoreScripts] = !!ignoreScripts - this[_global] = !!global this[_force] = !!force this[_scriptShell] = scriptShell this[_savePrefix] = savePrefix @@ -121,7 +125,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { // start tracker block this.addTracker('reify') - return Promise.all([this.loadActual(), this.buildIdealTree(options)]) + return this[_loadTrees](options) .then(() => this[_diffTrees]()) .then(() => this[_retireShallowNodes]()) .then(() => this[_createSparseTree]()) @@ -140,6 +144,24 @@ module.exports = cls => class Reifier extends Ideal(cls) { }) } + // when doing a local install, we load everything and figure it all out. + // when doing a global install, we *only* care about the explicit requests. + [_loadTrees] (options) { + if (!this[_global]) + return Promise.all([this.loadActual(), this.buildIdealTree(options)]) + + // the global install space tends to have a lot of stuff in it. don't + // load all of it, just what we care about. we won't be saving a + // hidden lockfile in there anyway. + const actualOpts = { + global: true, + filter: (node, kid) => !node.isRoot ? true + : this[_explicitRequests].has(kid), + } + return this.buildIdealTree(options) + .then(() => this.loadActual(actualOpts)) + } + [_diffTrees] () { // XXX if we have an existing diff already, there should be a way // to just invalidate the parts that changed, but avoid walking the @@ -193,16 +215,16 @@ module.exports = cls => class Reifier extends Ideal(cls) { [_renamePath] (from, to, didMkdirp = false) { return rename(from, to) .catch(er => { - // ignore missing shims, since only windows has them anyway - if (er.code === 'ENOENT' && from.match(/\.(cmd|ps1)$/)) - return + // Occasionally an expected bin file might not exist in the package, + // or a shim/symlink might have been moved aside. If we've already + // handled the most common cause of ENOENT (dir doesn't exist yet), + // then just ignore any ENOENT. + if (er.code === 'ENOENT') + return didMkdirp ? null : mkdirp(dirname(to)).then(() => + this[_renamePath](from, to, true)) else if (er.code === 'EEXIST') return rimraf(to).then(() => rename(from, to)) - else if (er.code === 'ENOENT' && !didMkdirp) { - // often this is a matter of the target dir not existing - return mkdirp(dirname(to)).then(() => - this[_renamePath](from, to, true)) - } else + else throw er }) } @@ -339,7 +361,9 @@ module.exports = cls => class Reifier extends Ideal(cls) { const {meta} = this.idealTree return meta.loadedFromDisk && meta.originalLockfileVersion < 2 && rpj(node.path + '/package.json').then(pkg => { - node.package = pkg + node.package.os = pkg.os + node.package.cpu = pkg.cpu + node.package.engines = pkg.engines return this[_checkEngineAndPlatform](node) }) } @@ -386,9 +410,9 @@ module.exports = cls => class Reifier extends Ideal(cls) { return binLinks({ pkg: node.package, path: node.path, - top: node.isTop, + top: node.isTop || node.globalTop, force: this[_force], - global: this[_global], + global: node.globalTop, }) } @@ -460,13 +484,7 @@ module.exports = cls => class Reifier extends Ideal(cls) { }) const promises = [] for (const node of set) { - promises.push(binLinks({ - pkg: node.package, - path: node.path, - top: node.isTop, - force: this[_force], - global: this[_global], - })) + promises.push(this[_binLinks](node)) } return promiseAllRejectLate(promises) }).then(() => node) @@ -631,8 +649,8 @@ module.exports = cls => class Reifier extends Ideal(cls) { return return rpj(node.path + '/package.json').then(pkg => { - node.package = pkg if (pkg.scripts) { + node.package.scripts = pkg.scripts const val = [node, pkg] if (pkg.scripts.preinstall) preinstall.push(val) @@ -709,34 +727,30 @@ module.exports = cls => class Reifier extends Ideal(cls) { // save it first, then prune out the optional trash, and then return it. // support save=false option - if (options.save === false) + if (options.save === false || this[_global]) return if (this[_resolvedAdd]) { - const pkg = this.idealTree.package - // need to save these more nicely, now that we know what they are - for (const [type, specs] of Object.entries(this[_resolvedAdd])) { - if (!specs || typeof specs !== 'object' || Array.isArray(specs)) - continue - - for (const [name, spec] of Object.entries(specs)) { - const child = this.idealTree.children.get(name) - const resolved = child.resolved - const req = npa(spec) - const res = npa(resolved) + const root = this.idealTree + const pkg = root.package + for (const req of this[_resolvedAdd]) { + const {name} = req + const child = root.children.get(name) + const res = npa(child.resolved) + + if (req.registry) { const version = child.package.version - if (req.registry) { - const range = this[_savePrefix] + version - const pname = child.package.name - const alias = name !== pname - pkg[type][name] = (alias ? `npm:${pname}@` : '') + `${range}` - } else if (req.hosted) { - pkg[type][name] = req.hosted.shortcut({ noCommittish: false }) - } else { - pkg[type][name] = req.saveSpec - } + const range = this[_savePrefix] + version + const pname = child.package.name + const alias = name !== pname + updateDepSpec(pkg, name, (alias ? `npm:${pname}@` : '') + range) + } else if (req.hosted) { + updateDepSpec(pkg, name, req.hosted.shortcut({ noCommittish: false })) + } else { + updateDepSpec(pkg, name, req.saveSpec) } } + // refresh the edges so they have the correct specs this.idealTree.package = pkg } @@ -766,6 +780,6 @@ module.exports = cls => class Reifier extends Ideal(cls) { node.parent = null } - return this.actualTree.meta.save() + return !this[_global] && this.actualTree.meta.save() } } diff --git a/node_modules/@npmcli/arborist/lib/legacy-location-to-relpath.js b/node_modules/@npmcli/arborist/lib/legacy-location-to-relpath.js deleted file mode 100644 index 3700311df..000000000 --- a/node_modules/@npmcli/arborist/lib/legacy-location-to-relpath.js +++ /dev/null @@ -1,11 +0,0 @@ -// turn /@foo/bar/baz to node_modules/@foo/bar/node_modules/baz -const legacyLocationToRelpath = loc => { - const re = /\/(@[^\/]+\/[^\/]+|[^@\/][^\/]*)/g - let relpath = [] - let name - while (name = re.exec(loc)) { - relpath.push('node_modules/' + name[1]) - } - return relpath.join('/') -} -module.exports = legacyLocationToRelpath diff --git a/node_modules/@npmcli/arborist/lib/node.js b/node_modules/@npmcli/arborist/lib/node.js index 91e551ede..a7330a29a 100644 --- a/node_modules/@npmcli/arborist/lib/node.js +++ b/node_modules/@npmcli/arborist/lib/node.js @@ -33,6 +33,7 @@ const Edge = require('./edge.js') const Inventory = require('./inventory.js') const Shrinkwrap = require('./shrinkwrap.js') const {normalize} = require('read-package-json-fast') +const {getPaths: getBinPaths} = require('bin-links') /* istanbul ignore next */ const dassert = /\barborist\b/.test(process.env.NODE_DEBUG || '') @@ -53,6 +54,7 @@ const _refreshLocation = Symbol('_refreshLocation') const _refreshTopMeta = Symbol('_refreshTopMeta') const _refreshPath = Symbol('_refreshPath') const _delistFromMeta = Symbol('_delistFromMeta') +const _global = Symbol.for('global') const relpath = require('./relpath.js') const consistentResolve = require('./consistent-resolve.js') @@ -84,8 +86,12 @@ class Node { optional = true, devOptional = true, peer = true, + global = false, } = options + // true if part of a global install + this[_global] = global + this.errors = error ? [error] : [] const pkg = normalize(options.pkg || {}) @@ -192,22 +198,25 @@ class Node { this[_loadDeps]() } + get global () { + return this.root[_global] + } + + // true for packages installed directly in the global node_modules folder + get globalTop () { + return this.global && this.parent.isRoot + } + get binPaths () { if (!this.parent) return [] - // just use a string resolution rather than path functions because - // we already know that the path is .../node_modules/node.name - const base = this.path.slice(0, -1 * this.name.length) - const nmbin = resolve(base, '.bin') - - const paths = [] - for (const bin of Object.keys(this[_package].bin || {})) { - paths.push(resolve(nmbin, bin)) - paths.push(resolve(nmbin, bin + '.cmd')) - paths.push(resolve(nmbin, bin + '.ps1')) - } - return paths + return getBinPaths({ + pkg: this[_package], + path: this.path, + global: this.global, + top: this.globalTop, + }) } get hasInstallScript () { diff --git a/node_modules/@npmcli/arborist/lib/update-dep-spec.js b/node_modules/@npmcli/arborist/lib/update-dep-spec.js new file mode 100644 index 000000000..76663513f --- /dev/null +++ b/node_modules/@npmcli/arborist/lib/update-dep-spec.js @@ -0,0 +1,24 @@ +// given a dep name and spec, update it wherever it exists in +// the manifest, or add the spec to 'dependencies' if not found. + +module.exports = (pkg, name, newSpec) => { + const type = findType(pkg, name) + pkg[type] = pkg[type] || {} + pkg[type][name] = newSpec + return pkg +} + +const types = [ + 'peerDependencies', + 'devDependencies', + 'optionalDependencies', + 'dependencies', +] + +const findType = (pkg, name) => { + for (const t of types) { + if (pkg[t] && typeof pkg[t] === 'object' && pkg[t][name] !== undefined) + return t + } + return 'dependencies' +} diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/README.md b/node_modules/@npmcli/arborist/node_modules/bin-links/README.md index 8e6289d71..4e3a8b407 100644 --- a/node_modules/@npmcli/arborist/node_modules/bin-links/README.md +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/README.md @@ -14,6 +14,7 @@ binaries and man pages for Javascript packages * [Contributing](#contributing) * [API](#api) * [`binLinks`](#binLinks) + * [`binLinks.getPaths()`](#getPaths) ### Example @@ -59,6 +60,13 @@ jump in if you'd like to, or even ask us questions if something isn't clear. Returns a Promise that resolves when the requisite things have been linked. +#### <a name="getPaths"></a> `> binLinks.getPaths({path, pkg, global, top })` + +Returns an array of all the paths of links and shims that _might_ be +created (assuming that they exist!) for the package at the specified path. + +Does not touch the filesystem. + ##### Example ```javascript diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/index.js b/node_modules/@npmcli/arborist/node_modules/bin-links/index.js index b09787ad9..51cc410af 100644 --- a/node_modules/@npmcli/arborist/node_modules/bin-links/index.js +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/index.js @@ -1,6 +1,3 @@ -const {basename, dirname } = require('path') -const isWindows = require('./lib/is-windows.js') - const linkBins = require('./lib/link-bins.js') const linkMans = require('./lib/link-mans.js') @@ -14,32 +11,20 @@ const binLinks = opts => { // non-top pkgs get their bins installed in {prefix}/node_modules/.bin, // and do not install mans // - // non-global top pkgs don't have any bins or mans linked. + // non-global top pkgs don't have any bins or mans linked. From here on + // out, if it's top, we know that it's global, so no need to pass that + // option further down the stack. if (top && !global) return Promise.resolve() - // now we know it's global and/or not top, so the path has to be - // {prefix}/node_modules/{name}. Can't rely on pkg.name, because - // it might be installed as an alias. - const scopeOrNm = dirname(path) - const nm = basename(scopeOrNm) === 'node_modules' ? scopeOrNm - : dirname(scopeOrNm) - const prefix = dirname(nm) - - const binTarget = !top ? nm + '/.bin' - : isWindows ? prefix - : dirname(prefix) + '/bin' - - const manTarget = !top || isWindows ? null - : dirname(prefix) + '/share/man' - return Promise.all([ // allow clobbering within the local node_modules/.bin folder. // only global bins are protected in this way, or else it is // yet another vector for excessive dependency conflicts. - linkBins({path, binTarget, pkg, force: force || !top}), - linkMans({path, manTarget, pkg, force}), + linkBins({path, pkg, top, force: force || !top}), + linkMans({path, pkg, top, force}), ]) } +binLinks.getPaths = require('./lib/get-paths.js') module.exports = binLinks diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/bin-target.js b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/bin-target.js new file mode 100644 index 000000000..7ea0c2a96 --- /dev/null +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/bin-target.js @@ -0,0 +1,9 @@ +const isWindows = require('./is-windows.js') +const getPrefix = require('./get-prefix.js') +const getNodeModules = require('./get-node-modules.js') +const {dirname} = require('path') + +module.exports = ({top, path}) => + !top ? getNodeModules(path) + '/.bin' + : isWindows ? getPrefix(path) + : dirname(getPrefix(path)) + '/bin' diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-node-modules.js b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-node-modules.js new file mode 100644 index 000000000..b67c198ef --- /dev/null +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-node-modules.js @@ -0,0 +1,18 @@ +// we know it's global and/or not top, so the path has to be +// {prefix}/node_modules/{name}. Can't rely on pkg.name, because +// it might be installed as an alias. + +const {dirname, basename} = require('path') +// this gets called a lot and can't change, so memoize it +const memo = new Map() +module.exports = path => { + if (memo.has(path)) + return memo.get(path) + + const scopeOrNm = dirname(path) + const nm = basename(scopeOrNm) === 'node_modules' ? scopeOrNm + : dirname(scopeOrNm) + + memo.set(path, nm) + return nm +} diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-paths.js b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-paths.js new file mode 100644 index 000000000..614c85652 --- /dev/null +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-paths.js @@ -0,0 +1,48 @@ +// get all the paths that are (or might be) installed for a given pkg +// There's no guarantee that all of these will be installed, but if they +// are present, then we can assume that they're associated. +const binTarget = require('./bin-target.js') +const manTarget = require('./man-target.js') +const {resolve, basename} = require('path') +const isWindows = require('./is-windows.js') +module.exports = ({path, pkg, global, top}) => { + if (top && !global) + return [] + + const binSet = [] + const binTarg = binTarget({path, top}) + if (pkg.bin) { + for (const bin of Object.keys(pkg.bin)) { + const b = resolve(binTarg, bin) + binSet.push(b) + if (isWindows) { + binSet.push(b + '.cmd') + binSet.push(b + '.ps1') + } + } + } + + const manTarg = manTarget({path, top}) + const manSet = [] + if (manTarg && pkg.man && Array.isArray(pkg.man) && pkg.man.length) { + for (const man of pkg.man) { + const parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) + // invalid entries invalidate the entire man set + if (!parseMan) + return binSet + + const stem = parseMan[1] + const sxn = parseMan[2] + const base = basename(stem) + const absFrom = resolve(path, man) + + /* istanbul ignore if - should be impossible */ + if (absFrom.indexOf(path) !== 0) + return binSet + + manSet.push(resolve(manTarg, 'man' + sxn, base)) + } + } + + return manSet.length ? [...binSet, ...manSet] : binSet +} diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-prefix.js b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-prefix.js new file mode 100644 index 000000000..96112bf0a --- /dev/null +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/get-prefix.js @@ -0,0 +1,3 @@ +const {dirname} = require('path') +const getNodeModules = require('./get-node-modules.js') +module.exports = path => dirname(getNodeModules(path)) diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-bins.js b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-bins.js index 1b556275c..6a1086b92 100644 --- a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-bins.js +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-bins.js @@ -1,15 +1,17 @@ const isWindows = require('./is-windows.js') +const binTarget = require('./bin-target.js') const { dirname, resolve, relative } = require('path') const linkBin = isWindows ? require('./shim-bin.js') : require('./link-bin.js') const normalize = require('npm-normalize-package-bin') -const linkBins = ({path, binTarget, pkg, force}) => { +const linkBins = ({path, pkg, top, force}) => { pkg = normalize(pkg) if (!pkg.bin) return Promise.resolve([]) const promises = [] + const target = binTarget({path, top}) for (const [key, val] of Object.entries(pkg.bin)) { - const to = resolve(binTarget, key) + const to = resolve(target, key) const absFrom = resolve(path, val) const from = relative(dirname(to), absFrom) promises.push(linkBin({path, from, to, absFrom, force})) diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-mans.js b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-mans.js index 634ecf550..6fb167e48 100644 --- a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-mans.js +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/link-mans.js @@ -1,7 +1,10 @@ const { dirname, relative, join, resolve, basename } = require('path') const linkGently = require('./link-gently.js') -const linkMans = ({path, manTarget, pkg, force}) => { - if (!manTarget || !pkg.man || !Array.isArray(pkg.man)) +const manTarget = require('./man-target.js') + +const linkMans = ({path, pkg, top, force}) => { + const target = manTarget({path, top}) + if (!target || !pkg.man || !Array.isArray(pkg.man) || !pkg.man.length) return Promise.resolve([]) // break any links to c:\\blah or /foo/blah or ../blah @@ -23,6 +26,7 @@ const linkMans = ({path, manTarget, pkg, force}) => { man, })) } + const stem = parseMan[1] const sxn = parseMan[2] const base = basename(stem) @@ -37,7 +41,7 @@ const linkMans = ({path, manTarget, pkg, force}) => { })) } - const to = resolve(manTarget, 'man' + sxn, base) + const to = resolve(target, 'man' + sxn, base) const from = relative(dirname(to), absFrom) return linkGently({from, to, path, absFrom, force}) diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/lib/man-target.js b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/man-target.js new file mode 100644 index 000000000..832d2ea35 --- /dev/null +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/lib/man-target.js @@ -0,0 +1,6 @@ +const isWindows = require('./is-windows.js') +const getPrefix = require('./get-prefix.js') +const {dirname} = require('path') + +module.exports = ({top, path}) => !top || isWindows ? null + : dirname(getPrefix(path)) + '/share/man' diff --git a/node_modules/@npmcli/arborist/node_modules/bin-links/package.json b/node_modules/@npmcli/arborist/node_modules/bin-links/package.json index d09336977..012269f13 100644 --- a/node_modules/@npmcli/arborist/node_modules/bin-links/package.json +++ b/node_modules/@npmcli/arborist/node_modules/bin-links/package.json @@ -1,26 +1,26 @@ { - "_from": "bin-links@^2.0.0", - "_id": "bin-links@2.0.0", + "_from": "bin-links@^2.1.2", + "_id": "bin-links@2.1.2", "_inBundle": false, - "_integrity": "sha512-VvBk9YwChMjdn9rs1c9Yt0vRwbZ0SgDBsb9pT07DAmFvuTlxqAuazKtIa4be+6ChBGI+io8gYjT+vq586foYaw==", + "_integrity": "sha512-mtspzc/umzMiZkIRIVm93WgyT7fFVXX302qswWwlHErBVM8BgAVvB0EVOdzmtrNzs1zIKEE0dE4RR5PwtBfy7g==", "_location": "/@npmcli/arborist/bin-links", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "bin-links@^2.0.0", + "raw": "bin-links@^2.1.2", "name": "bin-links", "escapedName": "bin-links", - "rawSpec": "^2.0.0", + "rawSpec": "^2.1.2", "saveSpec": null, - "fetchSpec": "^2.0.0" + "fetchSpec": "^2.1.2" }, "_requiredBy": [ "/@npmcli/arborist" ], - "_resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.0.0.tgz", - "_shasum": "7b281e1f6c2238ae809589490c2d61380c027a8b", - "_spec": "bin-links@^2.0.0", + "_resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.1.2.tgz", + "_shasum": "110f82e5563caf66c4483c1eb5d84043ef571660", + "_spec": "bin-links@^2.1.2", "_where": "/Users/isaacs/dev/npm/cli/node_modules/@npmcli/arborist", "bugs": { "url": "https://github.com/npm/bin-links/issues" @@ -45,7 +45,7 @@ }, "files": [ "index.js", - "lib" + "lib/*.js" ], "homepage": "https://github.com/npm/bin-links#readme", "keywords": [ @@ -71,5 +71,5 @@ "check-coverage": true, "coverage-map": "map.js" }, - "version": "2.0.0" + "version": "2.1.2" } diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index 1b6fc796e..8f011a674 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,8 +1,8 @@ { "_from": "@npmcli/arborist@latest", - "_id": "@npmcli/arborist@0.0.0-pre.9", + "_id": "@npmcli/arborist@0.0.0-pre.11", "_inBundle": false, - "_integrity": "sha512-P9iWMYo5ePQoOiiSf5xu+IvahV/FQ7Vtw/bmGGQG3BWk9d+tEWmReBsRGp/ENxGIA+PV+SY12qHVO1YsBGNPNg==", + "_integrity": "sha512-d75SHZi+fybiPH3juQ9VhZEexhVsom3vGl0pN0cbLHAHd/N5tSqgIKJ/YXjN96G24pMLI9wfpkFAIrnPkfv/6w==", "_location": "/@npmcli/arborist", "_phantomChildren": { "glob": "7.1.4", @@ -27,8 +27,8 @@ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.9.tgz", - "_shasum": "5c9bf32bbe12bf4d2b93bcb6eb7bf3b60318d032", + "_resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.11.tgz", + "_shasum": "116d6f8862d72774c63e303be883cdb459ad072a", "_spec": "@npmcli/arborist@latest", "_where": "/Users/isaacs/dev/npm/cli", "author": { @@ -43,12 +43,12 @@ "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", "@npmcli/run-script": "^1.2.1", - "bin-links": "^2.0.0", + "bin-links": "^2.1.2", "json-stringify-nice": "^1.1.1", "mkdirp-infer-owner": "^1.0.2", "npm-install-checks": "^4.0.0", "npm-package-arg": "^8.0.0", - "pacote": "^11.0.0", + "pacote": "^11.1.0", "parse-conflict-json": "^1.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", @@ -91,5 +91,5 @@ "esm": false, "timeout": "60" }, - "version": "0.0.0-pre.9" + "version": "0.0.0-pre.11" } diff --git a/node_modules/@tootallnate/once/dist/index.d.ts b/node_modules/@tootallnate/once/dist/index.d.ts new file mode 100644 index 000000000..3380226fa --- /dev/null +++ b/node_modules/@tootallnate/once/dist/index.d.ts @@ -0,0 +1,12 @@ +/// <reference types="node" /> +import { EventEmitter } from 'events'; +declare function once<T>(emitter: EventEmitter, name: string): once.CancellablePromise<T>; +declare namespace once { + interface CancelFunction { + (): void; + } + interface CancellablePromise<T> extends Promise<T> { + cancel: CancelFunction; + } +} +export = once; diff --git a/node_modules/@tootallnate/once/dist/index.js b/node_modules/@tootallnate/once/dist/index.js new file mode 100644 index 000000000..a913d5480 --- /dev/null +++ b/node_modules/@tootallnate/once/dist/index.js @@ -0,0 +1,28 @@ +"use strict"; +function once(emitter, name) { + let c = null; + const p = new Promise((resolve, reject) => { + function cancel() { + emitter.removeListener(name, onEvent); + emitter.removeListener('error', onError); + } + function onEvent(arg) { + cancel(); + resolve(arg); + } + function onError(err) { + cancel(); + reject(err); + } + c = cancel; + emitter.on(name, onEvent); + emitter.on('error', onError); + }); + if (!c) { + throw new TypeError('Could not get `cancel()` function'); + } + p.cancel = c; + return p; +} +module.exports = once; +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/@tootallnate/once/dist/index.js.map b/node_modules/@tootallnate/once/dist/index.js.map new file mode 100644 index 000000000..8a2fa3f33 --- /dev/null +++ b/node_modules/@tootallnate/once/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,SAAS,IAAI,CACZ,OAAqB,EACrB,IAAY;IAEZ,IAAI,CAAC,GAA+B,IAAI,CAAC;IACzC,MAAM,CAAC,GAAG,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC5C,SAAS,MAAM;YACd,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACtC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;QACD,SAAS,OAAO,CAAC,GAAM;YACtB,MAAM,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,CAAC,CAAC;QACd,CAAC;QACD,SAAS,OAAO,CAAC,GAAU;YAC1B,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;QACD,CAAC,GAAG,MAAM,CAAC;QACX,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAA+B,CAAC;IACjC,IAAI,CAAC,CAAC,EAAE;QACP,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;KACzD;IACD,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACb,OAAO,CAAC,CAAC;AACV,CAAC;AAWD,iBAAS,IAAI,CAAC"}
\ No newline at end of file diff --git a/node_modules/@tootallnate/once/package.json b/node_modules/@tootallnate/once/package.json new file mode 100644 index 000000000..b76b2b1d7 --- /dev/null +++ b/node_modules/@tootallnate/once/package.json @@ -0,0 +1,76 @@ +{ + "_from": "@tootallnate/once@1", + "_id": "@tootallnate/once@1.0.0", + "_inBundle": false, + "_integrity": "sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA==", + "_location": "/@tootallnate/once", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@tootallnate/once@1", + "name": "@tootallnate/once", + "escapedName": "@tootallnate%2fonce", + "scope": "@tootallnate", + "rawSpec": "1", + "saveSpec": null, + "fetchSpec": "1" + }, + "_requiredBy": [ + "/@npmcli/arborist/http-proxy-agent" + ], + "_resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz", + "_shasum": "9c13c2574c92d4503b005feca8f2e16cc1611506", + "_spec": "@tootallnate/once@1", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/@npmcli/arborist/node_modules/http-proxy-agent", + "author": { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io/" + }, + "bugs": { + "url": "https://github.com/TooTallNate/once/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Creates a Promise that waits for a single event", + "devDependencies": { + "@types/node": "^12.12.11", + "@typescript-eslint/eslint-plugin": "1.6.0", + "@typescript-eslint/parser": "1.1.0", + "eslint": "5.16.0", + "eslint-config-airbnb": "17.1.0", + "eslint-config-prettier": "4.1.0", + "eslint-import-resolver-typescript": "1.1.1", + "eslint-plugin-import": "2.16.0", + "eslint-plugin-jsx-a11y": "6.2.1", + "eslint-plugin-react": "7.12.4", + "mocha": "^6.2.2", + "rimraf": "^3.0.0", + "typescript": "^3.7.3" + }, + "engines": { + "node": ">= 6" + }, + "files": [ + "dist" + ], + "homepage": "https://github.com/TooTallNate/once#readme", + "keywords": [], + "license": "MIT", + "main": "./dist/index.js", + "name": "@tootallnate/once", + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/once.git" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist", + "prepublishOnly": "npm run build", + "test": "mocha --reporter spec", + "test-lint": "eslint src --ext .js,.ts" + }, + "types": "./dist/index.d.ts", + "version": "1.0.0" +} diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/CHANGELOG.md b/node_modules/npm-package-arg/node_modules/hosted-git-info/CHANGELOG.md deleted file mode 100644 index 9bc6cae2e..000000000 --- a/node_modules/npm-package-arg/node_modules/hosted-git-info/CHANGELOG.md +++ /dev/null @@ -1,135 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -<a name="3.0.2"></a> -## [3.0.2](https://github.com/npm/hosted-git-info/compare/v3.0.1...v3.0.2) (2019-10-08) - - -### Bug Fixes - -* do not encodeURIComponent the domain ([3e5fbec](https://github.com/npm/hosted-git-info/commit/3e5fbec)), closes [#53](https://github.com/npm/hosted-git-info/issues/53) - - - -<a name="3.0.1"></a> -## [3.0.1](https://github.com/npm/hosted-git-info/compare/v3.0.0...v3.0.1) (2019-10-07) - - -### Bug Fixes - -* update pathmatch for gitlab ([e3e3054](https://github.com/npm/hosted-git-info/commit/e3e3054)), closes [#52](https://github.com/npm/hosted-git-info/issues/52) -* updated pathmatch for gitlab ([fa87af7](https://github.com/npm/hosted-git-info/commit/fa87af7)) - - - -<a name="3.0.0"></a> -# [3.0.0](https://github.com/npm/hosted-git-info/compare/v2.8.3...v3.0.0) (2019-08-12) - - -### Bug Fixes - -* **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([37c2891](https://github.com/npm/hosted-git-info/commit/37c2891)), closes [#38](https://github.com/npm/hosted-git-info/issues/38) - - -### BREAKING CHANGES - -* **cache:** Drop support for node 0.x - - - -<a name="2.8.3"></a> -## [2.8.3](https://github.com/npm/hosted-git-info/compare/v2.8.2...v2.8.3) (2019-08-12) - - - -<a name="2.8.2"></a> -## [2.8.2](https://github.com/npm/hosted-git-info/compare/v2.8.1...v2.8.2) (2019-08-05) - - -### Bug Fixes - -* http protocol use sshurl by default ([3b1d629](https://github.com/npm/hosted-git-info/commit/3b1d629)), closes [#48](https://github.com/npm/hosted-git-info/issues/48) - - - -<a name="2.8.1"></a> -## [2.8.1](https://github.com/npm/hosted-git-info/compare/v2.8.0...v2.8.1) (2019-08-05) - - -### Bug Fixes - -* ignore noCommittish on tarball url generation ([5d4a8d7](https://github.com/npm/hosted-git-info/commit/5d4a8d7)) -* use gist tarball url that works for anonymous gists ([1692435](https://github.com/npm/hosted-git-info/commit/1692435)) - - - -<a name="2.8.0"></a> -# [2.8.0](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.0) (2019-08-05) - - -### Bug Fixes - -* Allow slashes in gitlab project section ([bbcf7b2](https://github.com/npm/hosted-git-info/commit/bbcf7b2)), closes [#46](https://github.com/npm/hosted-git-info/issues/46) [#43](https://github.com/npm/hosted-git-info/issues/43) -* **git-host:** disallow URI-encoded slash (%2F) in `path` ([3776fa5](https://github.com/npm/hosted-git-info/commit/3776fa5)), closes [#44](https://github.com/npm/hosted-git-info/issues/44) -* **gitlab:** Do not URL encode slashes in project name for GitLab https URL ([cbf04f9](https://github.com/npm/hosted-git-info/commit/cbf04f9)), closes [#47](https://github.com/npm/hosted-git-info/issues/47) -* do not allow invalid gist urls ([d5cf830](https://github.com/npm/hosted-git-info/commit/d5cf830)) -* **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([e518222](https://github.com/npm/hosted-git-info/commit/e518222)), closes [#38](https://github.com/npm/hosted-git-info/issues/38) - - -### Features - -* give these objects a name ([60abaea](https://github.com/npm/hosted-git-info/commit/60abaea)) - - - -<a name="2.7.1"></a> -## [2.7.1](https://github.com/npm/hosted-git-info/compare/v2.7.0...v2.7.1) (2018-07-07) - - -### Bug Fixes - -* **index:** Guard against non-string types ([5bc580d](https://github.com/npm/hosted-git-info/commit/5bc580d)) -* **parse:** Crash on strings that parse to having no host ([c931482](https://github.com/npm/hosted-git-info/commit/c931482)), closes [#35](https://github.com/npm/hosted-git-info/issues/35) - - - -<a name="2.7.0"></a> -# [2.7.0](https://github.com/npm/hosted-git-info/compare/v2.6.1...v2.7.0) (2018-07-06) - - -### Bug Fixes - -* **github tarball:** update github tarballtemplate ([6efd582](https://github.com/npm/hosted-git-info/commit/6efd582)), closes [#34](https://github.com/npm/hosted-git-info/issues/34) -* **gitlab docs:** switched to lowercase anchors for readmes ([701bcd1](https://github.com/npm/hosted-git-info/commit/701bcd1)) - - -### Features - -* **all:** Support www. prefixes on hostnames ([3349575](https://github.com/npm/hosted-git-info/commit/3349575)), closes [#32](https://github.com/npm/hosted-git-info/issues/32) - - - -<a name="2.6.1"></a> -## [2.6.1](https://github.com/npm/hosted-git-info/compare/v2.6.0...v2.6.1) (2018-06-25) - -### Bug Fixes - -* **Revert:** "compat: remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25))" ([cce5a62](https://github.com/npm/hosted-git-info/commit/cce5a62)) -* **Revert:** "git-host: fix forgotten extend()" ([a815ec9](https://github.com/npm/hosted-git-info/commit/a815ec9)) - - - -<a name="2.6.0"></a> -# [2.6.0](https://github.com/npm/hosted-git-info/compare/v2.5.0...v2.6.0) (2018-03-07) - - -### Bug Fixes - -* **compat:** remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25)) ([627ab55](https://github.com/npm/hosted-git-info/commit/627ab55)) -* **git-host:** fix forgotten extend() ([eba1f7b](https://github.com/npm/hosted-git-info/commit/eba1f7b)) - - -### Features - -* **browse:** fragment support for browse() ([#28](https://github.com/npm/hosted-git-info/issues/28)) ([cd5e5bb](https://github.com/npm/hosted-git-info/commit/cd5e5bb)) diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/LICENSE b/node_modules/npm-package-arg/node_modules/hosted-git-info/LICENSE deleted file mode 100644 index 45055763d..000000000 --- a/node_modules/npm-package-arg/node_modules/hosted-git-info/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2015, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md b/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md deleted file mode 100644 index 7b723f6b9..000000000 --- a/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# hosted-git-info - -This will let you identify and transform various git hosts URLs between -protocols. It also can tell you what the URL is for the raw path for -particular file for direct access without git. - -## Example - -```javascript -var hostedGitInfo = require("hosted-git-info") -var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git", opts) -/* info looks like: -{ - type: "github", - domain: "github.com", - user: "npm", - project: "hosted-git-info" -} -*/ -``` - -If the URL can't be matched with a git host, `null` will be returned. We -can match git, ssh and https urls. Additionally, we can match ssh connect -strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg, -`github:npm/hosted-git-info`). Github specifically, is detected in the case -of a third, unprefixed, form: `npm/hosted-git-info`. - -If it does match, the returned object has properties of: - -* info.type -- The short name of the service -* info.domain -- The domain for git protocol use -* info.user -- The name of the user/org on the git host -* info.project -- The name of the project on the git host - -## Version Contract - -The major version will be bumped any time… - -* The constructor stops accepting URLs that it previously accepted. -* A method is removed. -* A method can no longer accept the number and type of arguments it previously accepted. -* A method can return a different type than it currently returns. - -Implications: - -* I do not consider the specific format of the urls returned from, say - `.https()` to be a part of the contract. The contract is that it will - return a string that can be used to fetch the repo via HTTPS. But what - that string looks like, specifically, can change. -* Dropping support for a hosted git provider would constitute a breaking - change. - -## Usage - -### var info = hostedGitInfo.fromUrl(gitSpecifier[, options]) - -* *gitSpecifer* is a URL of a git repository or a SCP-style specifier of one. -* *options* is an optional object. It can have the following properties: - * *noCommittish* — If true then committishes won't be included in generated URLs. - * *noGitPlus* — If true then `git+` won't be prefixed on URLs. - -## Methods - -All of the methods take the same options as the `fromUrl` factory. Options -provided to a method override those provided to the constructor. - -* info.file(path, opts) - -Given the path of a file relative to the repository, returns a URL for -directly fetching it from the githost. If no committish was set then -`master` will be used as the default. - -For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")` -would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json` - -* info.shortcut(opts) - -eg, `github:npm/hosted-git-info` - -* info.browse(path, fragment, opts) - -eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`, -`https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`, -`https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts` - -* info.bugs(opts) - -eg, `https://github.com/npm/hosted-git-info/issues` - -* info.docs(opts) - -eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme` - -* info.https(opts) - -eg, `git+https://github.com/npm/hosted-git-info.git` - -* info.sshurl(opts) - -eg, `git+ssh://git@github.com/npm/hosted-git-info.git` - -* info.ssh(opts) - -eg, `git@github.com:npm/hosted-git-info.git` - -* info.path(opts) - -eg, `npm/hosted-git-info` - -* info.tarball(opts) - -eg, `https://github.com/npm/hosted-git-info/archive/v1.2.0.tar.gz` - -* info.getDefaultRepresentation() - -Returns the default output type. The default output type is based on the -string you passed in to be parsed - -* info.toString(opts) - -Uses the getDefaultRepresentation to call one of the other methods to get a URL for -this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give -you a normalized version of the URL that still uses the same protocol. - -Shortcuts will still be returned as shortcuts, but the special case github -form of `org/project` will be normalized to `github:org/project`. - -SSH connect strings will be normalized into `git+ssh` URLs. - -## Supported hosts - -Currently this supports Github, Bitbucket and Gitlab. Pull requests for -additional hosts welcome. diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/git-host-info.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/git-host-info.js deleted file mode 100644 index 8147e3348..000000000 --- a/node_modules/npm-package-arg/node_modules/hosted-git-info/git-host-info.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict' - -var gitHosts = module.exports = { - github: { - // First two are insecure and generally shouldn't be used any more, but - // they are still supported. - 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'github.com', - 'treepath': 'tree', - 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}', - 'bugstemplate': 'https://{domain}/{user}/{project}/issues', - 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}', - 'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}' - }, - bitbucket: { - 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'bitbucket.org', - 'treepath': 'src', - 'tarballtemplate': 'https://{domain}/{user}/{project}/get/{committish}.tar.gz' - }, - gitlab: { - 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'gitlab.com', - 'treepath': 'tree', - 'bugstemplate': 'https://{domain}/{user}/{project}/issues', - 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}', - 'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}', - 'pathmatch': /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/ - }, - gist: { - 'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'gist.github.com', - 'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]{32,})(?:[.]git)?$/, - 'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}', - 'bugstemplate': 'https://{domain}/{project}', - 'gittemplate': 'git://{domain}/{project}.git{#committish}', - 'sshtemplate': 'git@{domain}:/{project}.git{#committish}', - 'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}', - 'browsetemplate': 'https://{domain}/{project}{/committish}', - 'browsefiletemplate': 'https://{domain}/{project}{/committish}{#path}', - 'docstemplate': 'https://{domain}/{project}{/committish}', - 'httpstemplate': 'git+https://{domain}/{project}.git{#committish}', - 'shortcuttemplate': '{type}:{project}{#committish}', - 'pathtemplate': '{project}{#committish}', - 'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}', - 'hashformat': function (fragment) { - return 'file-' + formatHashFragment(fragment) - } - } -} - -var gitHostDefaults = { - 'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}', - 'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}', - 'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}', - 'browsefiletemplate': 'https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}', - 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme', - 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}', - 'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}', - 'shortcuttemplate': '{type}:{user}/{project}{#committish}', - 'pathtemplate': '{user}/{project}{#committish}', - 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/, - 'hashformat': formatHashFragment -} - -Object.keys(gitHosts).forEach(function (name) { - Object.keys(gitHostDefaults).forEach(function (key) { - if (gitHosts[name][key]) return - gitHosts[name][key] = gitHostDefaults[key] - }) - gitHosts[name].protocols_re = RegExp('^(' + - gitHosts[name].protocols.map(function (protocol) { - return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1') - }).join('|') + '):$') -}) - -function formatHashFragment (fragment) { - return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-') -} diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/git-host.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/git-host.js deleted file mode 100644 index f9b1ec745..000000000 --- a/node_modules/npm-package-arg/node_modules/hosted-git-info/git-host.js +++ /dev/null @@ -1,156 +0,0 @@ -'use strict' -var gitHosts = require('./git-host-info.js') -/* eslint-disable node/no-deprecated-api */ - -// copy-pasta util._extend from node's source, to avoid pulling -// the whole util module into peoples' webpack bundles. -/* istanbul ignore next */ -var extend = Object.assign || function _extend (target, source) { - // Don't do anything if source isn't an object - if (source === null || typeof source !== 'object') return target - - const keys = Object.keys(source) - let i = keys.length - while (i--) { - target[keys[i]] = source[keys[i]] - } - return target -} - -module.exports = GitHost -function GitHost (type, user, auth, project, committish, defaultRepresentation, opts) { - var gitHostInfo = this - gitHostInfo.type = type - Object.keys(gitHosts[type]).forEach(function (key) { - gitHostInfo[key] = gitHosts[type][key] - }) - gitHostInfo.user = user - gitHostInfo.auth = auth - gitHostInfo.project = project - gitHostInfo.committish = committish - gitHostInfo.default = defaultRepresentation - gitHostInfo.opts = opts || {} -} - -GitHost.prototype.hash = function () { - return this.committish ? '#' + this.committish : '' -} - -GitHost.prototype._fill = function (template, opts) { - if (!template) return - var vars = extend({}, opts) - vars.path = vars.path ? vars.path.replace(/^[/]+/g, '') : '' - opts = extend(extend({}, this.opts), opts) - var self = this - Object.keys(this).forEach(function (key) { - if (self[key] != null && vars[key] == null) vars[key] = self[key] - }) - var rawAuth = vars.auth - var rawcommittish = vars.committish - var rawFragment = vars.fragment - var rawPath = vars.path - var rawProject = vars.project - Object.keys(vars).forEach(function (key) { - var value = vars[key] - if ((key === 'path' || key === 'project') && typeof value === 'string') { - vars[key] = value.split('/').map(function (pathComponent) { - return encodeURIComponent(pathComponent) - }).join('/') - } else if (key !== 'domain') { - vars[key] = encodeURIComponent(value) - } - }) - vars['auth@'] = rawAuth ? rawAuth + '@' : '' - vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : '' - vars.fragment = vars.fragment ? vars.fragment : '' - vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : '' - vars['/path'] = vars.path ? '/' + vars.path : '' - vars.projectPath = rawProject.split('/').map(encodeURIComponent).join('/') - if (opts.noCommittish) { - vars['#committish'] = '' - vars['/tree/committish'] = '' - vars['/committish'] = '' - vars.committish = '' - } else { - vars['#committish'] = rawcommittish ? '#' + rawcommittish : '' - vars['/tree/committish'] = vars.committish - ? '/' + vars.treepath + '/' + vars.committish - : '' - vars['/committish'] = vars.committish ? '/' + vars.committish : '' - vars.committish = vars.committish || 'master' - } - var res = template - Object.keys(vars).forEach(function (key) { - res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key]) - }) - if (opts.noGitPlus) { - return res.replace(/^git[+]/, '') - } else { - return res - } -} - -GitHost.prototype.ssh = function (opts) { - return this._fill(this.sshtemplate, opts) -} - -GitHost.prototype.sshurl = function (opts) { - return this._fill(this.sshurltemplate, opts) -} - -GitHost.prototype.browse = function (P, F, opts) { - if (typeof P === 'string') { - if (typeof F !== 'string') { - opts = F - F = null - } - return this._fill(this.browsefiletemplate, extend({ - fragment: F, - path: P - }, opts)) - } else { - return this._fill(this.browsetemplate, P) - } -} - -GitHost.prototype.docs = function (opts) { - return this._fill(this.docstemplate, opts) -} - -GitHost.prototype.bugs = function (opts) { - return this._fill(this.bugstemplate, opts) -} - -GitHost.prototype.https = function (opts) { - return this._fill(this.httpstemplate, opts) -} - -GitHost.prototype.git = function (opts) { - return this._fill(this.gittemplate, opts) -} - -GitHost.prototype.shortcut = function (opts) { - return this._fill(this.shortcuttemplate, opts) -} - -GitHost.prototype.path = function (opts) { - return this._fill(this.pathtemplate, opts) -} - -GitHost.prototype.tarball = function (opts_) { - var opts = extend({}, opts_, { noCommittish: false }) - return this._fill(this.tarballtemplate, opts) -} - -GitHost.prototype.file = function (P, opts) { - return this._fill(this.filetemplate, extend({ path: P }, opts)) -} - -GitHost.prototype.getDefaultRepresentation = function () { - return this.default -} - -GitHost.prototype.toString = function (opts) { - if (this.default && typeof this[this.default] === 'function') return this[this.default](opts) - return this.sshurl(opts) -} diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/index.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/index.js deleted file mode 100644 index 2ccb1d69c..000000000 --- a/node_modules/npm-package-arg/node_modules/hosted-git-info/index.js +++ /dev/null @@ -1,125 +0,0 @@ -'use strict' -var url = require('url') -var gitHosts = require('./git-host-info.js') -var GitHost = module.exports = require('./git-host.js') -var LRU = require('lru-cache') -var cache = new LRU({max: 1000}) - -var protocolToRepresentationMap = { - 'git+ssh:': 'sshurl', - 'git+https:': 'https', - 'ssh:': 'sshurl', - 'git:': 'git' -} - -function protocolToRepresentation (protocol) { - return protocolToRepresentationMap[protocol] || protocol.slice(0, -1) -} - -var authProtocols = { - 'git:': true, - 'https:': true, - 'git+https:': true, - 'http:': true, - 'git+http:': true -} - -module.exports.fromUrl = function (giturl, opts) { - if (typeof giturl !== 'string') return - var key = giturl + JSON.stringify(opts || {}) - - if (!cache.has(key)) { - cache.set(key, fromUrl(giturl, opts)) - } - - return cache.get(key) -} - -function fromUrl (giturl, opts) { - if (giturl == null || giturl === '') return - var url = fixupUnqualifiedGist( - isGitHubShorthand(giturl) ? 'github:' + giturl : giturl - ) - var parsed = parseGitUrl(url) - var shortcutMatch = url.match(new RegExp('^([^:]+):(?:(?:[^@:]+(?:[^@]+)?@)?([^/]*))[/](.+?)(?:[.]git)?($|#)')) - var matches = Object.keys(gitHosts).map(function (gitHostName) { - try { - var gitHostInfo = gitHosts[gitHostName] - var auth = null - if (parsed.auth && authProtocols[parsed.protocol]) { - auth = decodeURIComponent(parsed.auth) - } - var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null - var user = null - var project = null - var defaultRepresentation = null - if (shortcutMatch && shortcutMatch[1] === gitHostName) { - user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2]) - project = decodeURIComponent(shortcutMatch[3]) - defaultRepresentation = 'shortcut' - } else { - if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, '') !== gitHostInfo.domain) return - if (!gitHostInfo.protocols_re.test(parsed.protocol)) return - if (!parsed.path) return - var pathmatch = gitHostInfo.pathmatch - var matched = parsed.path.match(pathmatch) - if (!matched) return - /* istanbul ignore else */ - if (matched[1] !== null && matched[1] !== undefined) { - user = decodeURIComponent(matched[1].replace(/^:/, '')) - } - project = decodeURIComponent(matched[2]) - defaultRepresentation = protocolToRepresentation(parsed.protocol) - } - return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts) - } catch (ex) { - /* istanbul ignore else */ - if (ex instanceof URIError) { - } else throw ex - } - }).filter(function (gitHostInfo) { return gitHostInfo }) - if (matches.length !== 1) return - return matches[0] -} - -function isGitHubShorthand (arg) { - // Note: This does not fully test the git ref format. - // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html - // - // The only way to do this properly would be to shell out to - // git-check-ref-format, and as this is a fast sync function, - // we don't want to do that. Just let git fail if it turns - // out that the commit-ish is invalid. - // GH usernames cannot start with . or - - return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg) -} - -function fixupUnqualifiedGist (giturl) { - // necessary for round-tripping gists - var parsed = url.parse(giturl) - if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) { - return parsed.protocol + '/' + parsed.host - } else { - return giturl - } -} - -function parseGitUrl (giturl) { - var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/) - if (!matched) return url.parse(giturl) - return { - protocol: 'git+ssh:', - slashes: true, - auth: matched[1], - host: matched[2], - port: null, - hostname: matched[2], - hash: matched[4], - search: null, - query: null, - pathname: '/' + matched[3], - path: '/' + matched[3], - href: 'git+ssh://' + matched[1] + '@' + matched[2] + - '/' + matched[3] + (matched[4] || '') - } -} diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/package.json b/node_modules/npm-package-arg/node_modules/hosted-git-info/package.json deleted file mode 100644 index 17968776a..000000000 --- a/node_modules/npm-package-arg/node_modules/hosted-git-info/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_from": "hosted-git-info@^3.0.2", - "_id": "hosted-git-info@3.0.2", - "_inBundle": false, - "_integrity": "sha512-ezZMWtHXm7Eb7Rq4Mwnx2vs79WUx2QmRg3+ZqeGroKzfDO+EprOcgRPYghsOP9JuYBfK18VojmRTGCg8Ma+ktw==", - "_location": "/npm-package-arg/hosted-git-info", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "hosted-git-info@^3.0.2", - "name": "hosted-git-info", - "escapedName": "hosted-git-info", - "rawSpec": "^3.0.2", - "saveSpec": null, - "fetchSpec": "^3.0.2" - }, - "_requiredBy": [ - "/npm-package-arg" - ], - "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.2.tgz", - "_shasum": "8b7e3bd114b59b51786f8bade0f39ddc80275a97", - "_spec": "hosted-git-info@^3.0.2", - "_where": "/Users/claudiahdz/npm/cli/node_modules/npm-package-arg", - "author": { - "name": "Rebecca Turner", - "email": "me@re-becca.org", - "url": "http://re-becca.org" - }, - "bugs": { - "url": "https://github.com/npm/hosted-git-info/issues" - }, - "bundleDependencies": false, - "dependencies": { - "lru-cache": "^5.1.1" - }, - "deprecated": false, - "description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab", - "devDependencies": { - "standard": "^11.0.1", - "standard-version": "^4.4.0", - "tap": "^12.7.0" - }, - "files": [ - "index.js", - "git-host.js", - "git-host-info.js" - ], - "homepage": "https://github.com/npm/hosted-git-info", - "keywords": [ - "git", - "github", - "bitbucket", - "gitlab" - ], - "license": "ISC", - "main": "index.js", - "name": "hosted-git-info", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/hosted-git-info.git" - }, - "scripts": { - "postrelease": "npm publish && git push --follow-tags", - "prerelease": "npm t", - "pretest": "standard", - "release": "standard-version -s", - "test": "tap -J --100 --no-esm test/*.js", - "test:coverage": "tap --coverage-report=html -J --100 --no-esm test/*.js" - }, - "version": "3.0.2" -} diff --git a/node_modules/npm-package-arg/package.json b/node_modules/npm-package-arg/package.json index f297e5f12..492cf8c80 100644 --- a/node_modules/npm-package-arg/package.json +++ b/node_modules/npm-package-arg/package.json @@ -1,30 +1,33 @@ { - "_from": "npm-package-arg@8.0.0", + "_from": "npm-package-arg@latest", "_id": "npm-package-arg@8.0.0", "_inBundle": false, "_integrity": "sha512-JgqZHCEUKvhX7EehLNdySiuB227a0QYra9wpZOkW+jvwsRYKkce7y5Rv2axkxScJU1EP+L32jT2PLhQz7IWHlw==", "_location": "/npm-package-arg", - "_phantomChildren": { - "lru-cache": "5.1.1" - }, + "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "tag", "registry": true, - "raw": "npm-package-arg@8.0.0", + "raw": "npm-package-arg@latest", "name": "npm-package-arg", "escapedName": "npm-package-arg", - "rawSpec": "8.0.0", + "rawSpec": "latest", "saveSpec": null, - "fetchSpec": "8.0.0" + "fetchSpec": "latest" }, "_requiredBy": [ "#USER", - "/" + "/", + "/@npmcli/arborist", + "/npm-pick-manifest", + "/npm-registry-fetch", + "/pacote", + "/pacote/npm-registry-fetch" ], "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.0.0.tgz", "_shasum": "b519989b569efffa1fa050fb22a3c3c322d4bcc5", - "_spec": "npm-package-arg@8.0.0", - "_where": "/Users/claudiahdz/npm/cli", + "_spec": "npm-package-arg@latest", + "_where": "/Users/isaacs/dev/npm/cli", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", diff --git a/node_modules/npm-registry-fetch/CHANGELOG.md b/node_modules/npm-registry-fetch/CHANGELOG.md index 36eb6efb3..1f142a699 100644 --- a/node_modules/npm-registry-fetch/CHANGELOG.md +++ b/node_modules/npm-registry-fetch/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [8.0.0](https://github.com/npm/registry-fetch/compare/v7.0.1...v8.0.0) (2020-02-24) + + +### ⚠ BREAKING CHANGES + +* Removes the 'opts.refer' option and the HTTP Referer +header (unless explicitly added to the 'headers' option, of course). + +PR-URL: https://github.com/npm/npm-registry-fetch/pull/25 +Credit: @isaacs + +### Bug Fixes + +* remove referer header and opts.refer ([eb8f7af](https://github.com/npm/registry-fetch/commit/eb8f7af3c102834856604c1be664b00ca0fe8ef2)), closes [#25](https://github.com/npm/registry-fetch/issues/25) + +### [7.0.1](https://github.com/npm/registry-fetch/compare/v7.0.0...v7.0.1) (2020-02-24) + ## [7.0.0](https://github.com/npm/registry-fetch/compare/v6.0.2...v7.0.0) (2020-02-18) diff --git a/node_modules/npm-registry-fetch/README.md b/node_modules/npm-registry-fetch/README.md index da7228277..31a10a724 100644 --- a/node_modules/npm-registry-fetch/README.md +++ b/node_modules/npm-registry-fetch/README.md @@ -501,14 +501,6 @@ using If the request URI already has a query string, it will be merged with `opts.query`, preferring `opts.query` values. -##### <a name="opts-refer"></a> `opts.refer` - -* Type: String -* Default: null - -Value to use for the `Referer` header. The npm CLI itself uses this to serialize -the npm command line using the given request. - ##### <a name="opts-registry"></a> `opts.registry` * Type: URL diff --git a/node_modules/npm-registry-fetch/index.js b/node_modules/npm-registry-fetch/index.js index 2942db225..8e05f4184 100644 --- a/node_modules/npm-registry-fetch/index.js +++ b/node_modules/npm-registry-fetch/index.js @@ -113,7 +113,6 @@ function regFetch (uri, /* istanbul ignore next */ opts_ = {}) { method: method, noProxy: opts.noProxy, proxy: opts.httpsProxy || opts.proxy, - referer: opts.refer, retry: opts.retry ? opts.retry : { retries: opts.fetchRetries, factor: opts.fetchRetryFactor, @@ -176,12 +175,17 @@ function getCacheMode (opts) { function getHeaders (registry, uri, 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 + 'user-agent': opts.userAgent }, opts.headers || {}) + if (opts.projectScope) { + headers['npm-scope'] = opts.projectScope + } + + if (opts.npmSession) { + headers['npm-session'] = opts.npmSession + } + const auth = getAuth(registry, opts) // If a tarball is hosted on a different place than the manifest, only send // credentials on `alwaysAuth` diff --git a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.d.ts b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.d.ts index 28fb567a9..e44a88ad4 100644 --- a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.d.ts +++ b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.d.ts @@ -1,29 +1,36 @@ /// <reference types="node" /> import net from 'net'; import http from 'http'; +import https from 'https'; +import { Duplex } from 'stream'; import { EventEmitter } from 'events'; declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent; -declare namespace createAgent { - var prototype: Agent; -} declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent; declare namespace createAgent { - var prototype: Agent; -} -declare namespace createAgent { - type ClientRequest = http.ClientRequest & { + interface ClientRequest extends http.ClientRequest { _last?: boolean; _hadError?: boolean; method: string; - }; - type AgentCallbackReturn = net.Socket | createAgent.Agent | http.Agent; + } + interface AgentRequestOptions { + host?: string; + path?: string; + port: number; + } + interface HttpRequestOptions extends AgentRequestOptions, Omit<http.RequestOptions, keyof AgentRequestOptions> { + secureEndpoint: false; + } + interface HttpsRequestOptions extends AgentRequestOptions, Omit<https.RequestOptions, keyof AgentRequestOptions> { + secureEndpoint: true; + } + type RequestOptions = HttpRequestOptions | HttpsRequestOptions; + type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent; + type AgentCallbackReturn = Duplex | AgentLike; type AgentCallbackCallback = (err: Error | null | undefined, socket: createAgent.AgentCallbackReturn) => void; type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>; type AgentCallback = typeof Agent.prototype.callback; - type AgentOptions = http.AgentOptions & {}; - type RequestOptions = http.RequestOptions & { - port: number; - secureEndpoint: boolean; + type AgentOptions = { + timeout?: number; }; /** * Base `http.Agent` implementation. @@ -34,11 +41,14 @@ declare namespace createAgent { */ class Agent extends EventEmitter { timeout: number | null; - options?: createAgent.AgentOptions; maxFreeSockets: number; maxSockets: number; - sockets: net.Socket[]; - requests: http.ClientRequest[]; + sockets: { + [key: string]: net.Socket[]; + }; + requests: { + [key: string]: http.IncomingMessage[]; + }; private promisifiedCallback?; private explicitDefaultPort?; private explicitProtocol?; diff --git a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js index 788decacc..1e7b8c244 100644 --- a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js +++ b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js @@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const events_1 = require("events"); +const debug_1 = __importDefault(require("debug")); const promisify_1 = __importDefault(require("./promisify")); -function isAgentBase(v) { - return Boolean(v) && typeof v.addRequest === 'function'; -} -function isHttpAgent(v) { +const debug = debug_1.default('agent-base'); +function isAgent(v) { return Boolean(v) && typeof v.addRequest === 'function'; } function isSecureEndpoint() { @@ -30,8 +29,6 @@ function createAgent(callback, opts) { class Agent extends events_1.EventEmitter { constructor(callback, _opts) { super(); - // The callback gets promisified lazily - this.promisifiedCallback = undefined; let opts = _opts; if (typeof callback === 'function') { this.callback = callback; @@ -39,24 +36,23 @@ function createAgent(callback, opts) { else if (callback) { opts = callback; } - // timeout for the socket to be returned from the callback + // Timeout for the socket to be returned from the callback this.timeout = null; if (opts && typeof opts.timeout === 'number') { this.timeout = opts.timeout; } - this.options = opts || {}; + // These aren't actually used by `agent-base`, but are required + // for the TypeScript definition files in `@types/node` :/ this.maxFreeSockets = 1; this.maxSockets = 1; - this.sockets = []; - this.requests = []; + this.sockets = {}; + this.requests = {}; } get defaultPort() { if (typeof this.explicitDefaultPort === 'number') { return this.explicitDefaultPort; } - else { - return isSecureEndpoint() ? 443 : 80; - } + return isSecureEndpoint() ? 443 : 80; } set defaultPort(v) { this.explicitDefaultPort = v; @@ -65,9 +61,7 @@ function createAgent(callback, opts) { if (typeof this.explicitProtocol === 'string') { return this.explicitProtocol; } - else { - return isSecureEndpoint() ? 'https:' : 'http:'; - } + return isSecureEndpoint() ? 'https:' : 'http:'; } set protocol(v) { this.explicitProtocol = v; @@ -82,23 +76,24 @@ function createAgent(callback, opts) { * @api public */ addRequest(req, _opts) { - const ownOpts = Object.assign({}, _opts); - if (typeof ownOpts.secureEndpoint !== 'boolean') { - ownOpts.secureEndpoint = isSecureEndpoint(); + const opts = Object.assign({}, _opts); + if (typeof opts.secureEndpoint !== 'boolean') { + opts.secureEndpoint = isSecureEndpoint(); + } + if (opts.host == null) { + opts.host = 'localhost'; } - // Set default `host` for HTTP to localhost - if (ownOpts.host == null) { - ownOpts.host = 'localhost'; + if (opts.port == null) { + opts.port = opts.secureEndpoint ? 443 : 80; } - // Set default `port` for HTTP if none was explicitly specified - if (ownOpts.port == null) { - ownOpts.port = ownOpts.secureEndpoint ? 443 : 80; + if (opts.protocol == null) { + opts.protocol = opts.secureEndpoint ? 'https:' : 'http:'; } - const opts = Object.assign(Object.assign({}, this.options), ownOpts); if (opts.host && opts.path) { - // If both a `host` and `path` are specified then it's most likely the - // result of a `url.parse()` call... we need to remove the `path` portion so - // that `net.connect()` doesn't attempt to open that as a unix socket file. + // If both a `host` and `path` are specified then it's most + // likely the result of a `url.parse()` call... we need to + // remove the `path` portion so that `net.connect()` doesn't + // attempt to open that as a unix socket file. delete opts.path; } delete opts.agent; @@ -110,69 +105,65 @@ function createAgent(callback, opts) { // XXX: non-documented `http` module API :( req._last = true; req.shouldKeepAlive = false; - // Create the `stream.Duplex` instance let timedOut = false; - let timeout = null; - const timeoutMs = this.timeout; - const freeSocket = this.freeSocket; - function onerror(err) { + let timeoutId = null; + const timeoutMs = opts.timeout || this.timeout; + const onerror = (err) => { if (req._hadError) return; req.emit('error', err); // For Safety. Some additional errors might fire later on // and we need to make sure we don't double-fire the error event. req._hadError = true; - } - function ontimeout() { - timeout = null; + }; + const ontimeout = () => { + timeoutId = null; timedOut = true; const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`); err.code = 'ETIMEOUT'; onerror(err); - } - function callbackError(err) { + }; + const callbackError = (err) => { if (timedOut) return; - if (timeout !== null) { - clearTimeout(timeout); - timeout = null; + if (timeoutId !== null) { + clearTimeout(timeoutId); + timeoutId = null; } onerror(err); - } - function onsocket(socket) { - let sock; - function onfree() { - freeSocket(sock, opts); - } + }; + const onsocket = (socket) => { if (timedOut) return; - if (timeout != null) { - clearTimeout(timeout); - timeout = null; + if (timeoutId != null) { + clearTimeout(timeoutId); + timeoutId = null; } - if (isAgentBase(socket) || isHttpAgent(socket)) { + if (isAgent(socket)) { // `socket` is actually an `http.Agent` instance, so // relinquish responsibility for this `req` to the Agent // from here on + debug('Callback returned another Agent instance %o', socket.constructor.name); socket.addRequest(req, opts); return; } if (socket) { - sock = socket; - sock.on('free', onfree); - req.onSocket(sock); + socket.once('free', () => { + this.freeSocket(socket, opts); + }); + req.onSocket(socket); return; } const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``); onerror(err); - } + }; if (typeof this.callback !== 'function') { onerror(new Error('`callback` is not defined')); return; } if (!this.promisifiedCallback) { if (this.callback.length >= 3) { - // Legacy callback function - convert to a Promise + debug('Converting legacy callback function to promise'); this.promisifiedCallback = promisify_1.default(this.callback); } else { @@ -180,12 +171,13 @@ function createAgent(callback, opts) { } } if (typeof timeoutMs === 'number' && timeoutMs > 0) { - timeout = setTimeout(ontimeout, timeoutMs); + timeoutId = setTimeout(ontimeout, timeoutMs); } if ('port' in opts && typeof opts.port !== 'number') { opts.port = Number(opts.port); } try { + debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`); Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError); } catch (err) { @@ -193,14 +185,16 @@ function createAgent(callback, opts) { } } freeSocket(socket, opts) { - // TODO reuse sockets + debug('Freeing socket %o %o', socket.constructor.name, opts); socket.destroy(); } - destroy() { } + destroy() { + debug('Destroying agent %o', this.constructor.name); + } } createAgent.Agent = Agent; + // So that `instanceof` works correctly + createAgent.prototype = createAgent.Agent.prototype; })(createAgent || (createAgent = {})); -// So that `instanceof` works correctly -createAgent.prototype = createAgent.Agent.prototype; module.exports = createAgent; //# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js.map b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js.map index 64065f66f..ccfaa7530 100644 --- a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js.map +++ b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAEA,mCAAsC;AACtC,4DAAoC;AAEpC,SAAS,WAAW,CAAC,CAAM;IAC1B,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAAC,CAAM;IAC1B,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpE,C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iBAAS,WAAW,CAAC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/promisify.js.map b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/promisify.js.map index cff52898a..4bff9bfcf 100644 --- a/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/promisify.js.map +++ b/node_modules/npm-registry-fetch/node_modules/agent-base/dist/src/promisify.js.map @@ -1 +1 @@ -{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAwB,EAAE,EAAE;gBAC3D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"}
\ No newline at end of file +{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAyB,EAAE,EAAE;gBAC5D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/agent-base/package.json b/node_modules/npm-registry-fetch/node_modules/agent-base/package.json index bd5f8e4d5..b966412f0 100644 --- a/node_modules/npm-registry-fetch/node_modules/agent-base/package.json +++ b/node_modules/npm-registry-fetch/node_modules/agent-base/package.json @@ -1,28 +1,29 @@ { - "_from": "agent-base@5", - "_id": "agent-base@5.1.1", + "_from": "agent-base@6", + "_id": "agent-base@6.0.0", "_inBundle": false, - "_integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "_integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==", "_location": "/npm-registry-fetch/agent-base", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "agent-base@5", + "raw": "agent-base@6", "name": "agent-base", "escapedName": "agent-base", - "rawSpec": "5", + "rawSpec": "6", "saveSpec": null, - "fetchSpec": "5" + "fetchSpec": "6" }, "_requiredBy": [ "/npm-registry-fetch/http-proxy-agent", - "/npm-registry-fetch/https-proxy-agent" + "/npm-registry-fetch/https-proxy-agent", + "/npm-registry-fetch/socks-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "_shasum": "e8fb3f242959db44d63be665db7a8e739537a32c", - "_spec": "agent-base@5", - "_where": "/Users/mperrotte/npminc/cli/node_modules/npm-registry-fetch/node_modules/http-proxy-agent", + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", + "_shasum": "5d0101f19bbfaed39980b22ae866de153b93f09a", + "_spec": "agent-base@6", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/npm-registry-fetch/node_modules/http-proxy-agent", "author": { "name": "Nathan Rajlich", "email": "nathan@tootallnate.net", @@ -32,11 +33,15 @@ "url": "https://github.com/TooTallNate/node-agent-base/issues" }, "bundleDependencies": false, + "dependencies": { + "debug": "4" + }, "deprecated": false, "description": "Turn a function into an `http.Agent` instance", "devDependencies": { + "@types/debug": "4", "@types/mocha": "^5.2.7", - "@types/node": "^10.5.3", + "@types/node": "^12.12.17", "@types/ws": "^6.0.3", "@typescript-eslint/eslint-plugin": "1.6.0", "@typescript-eslint/parser": "1.1.0", @@ -84,5 +89,5 @@ "test-lint": "eslint src --ext .js,.ts" }, "typings": "dist/src/index", - "version": "5.1.1" + "version": "6.0.0" } diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/README.md b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/README.md index 4f1fc372b..d60e20661 100644 --- a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/README.md +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/README.md @@ -1,7 +1,7 @@ http-proxy-agent ================ ### An HTTP(s) proxy `http.Agent` implementation for HTTP -[![Build Status](https://travis-ci.org/TooTallNate/node-http-proxy-agent.svg?branch=master)](https://travis-ci.org/TooTallNate/node-http-proxy-agent) +[![Build Status](https://github.com/TooTallNate/node-http-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-http-proxy-agent/actions?workflow=Node+CI) This module provides an `http.Agent` implementation that connects to a specified HTTP or HTTPS proxy server, and can be used with the built-in `http` module. diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.d.ts b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.d.ts new file mode 100644 index 000000000..3f043f7f9 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.d.ts @@ -0,0 +1,32 @@ +/// <reference types="node" /> +import net from 'net'; +import { Agent, ClientRequest, RequestOptions } from 'agent-base'; +import { HttpProxyAgentOptions } from '.'; +interface HttpProxyAgentClientRequest extends ClientRequest { + path: string; + output?: string[]; + outputData?: { + data: string; + }[]; + _header?: string | null; + _implicitHeader(): void; +} +/** + * The `HttpProxyAgent` implements an HTTP Agent subclass that connects + * to the specified "HTTP proxy server" in order to proxy HTTP requests. + * + * @api public + */ +export default class HttpProxyAgent extends Agent { + private secureProxy; + private proxy; + constructor(_opts: string | HttpProxyAgentOptions); + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req: HttpProxyAgentClientRequest, opts: RequestOptions): Promise<net.Socket>; +} +export {}; diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.js b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.js new file mode 100644 index 000000000..025285051 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.js @@ -0,0 +1,145 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const net_1 = __importDefault(require("net")); +const tls_1 = __importDefault(require("tls")); +const url_1 = __importDefault(require("url")); +const debug_1 = __importDefault(require("debug")); +const once_1 = __importDefault(require("@tootallnate/once")); +const agent_base_1 = require("agent-base"); +const debug = debug_1.default('http-proxy-agent'); +function isHTTPS(protocol) { + return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; +} +/** + * The `HttpProxyAgent` implements an HTTP Agent subclass that connects + * to the specified "HTTP proxy server" in order to proxy HTTP requests. + * + * @api public + */ +class HttpProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); + } + debug('Creating new HttpProxyAgent instance: %o', opts); + super(opts); + const proxy = Object.assign({}, opts); + // If `true`, then connect to the proxy server over TLS. + // Defaults to `false`. + this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); + // Prefer `hostname` over `host`, and set the `port` if needed. + proxy.host = proxy.hostname || proxy.host; + if (typeof proxy.port === 'string') { + proxy.port = parseInt(proxy.port, 10); + } + if (!proxy.port && proxy.host) { + proxy.port = this.secureProxy ? 443 : 80; + } + if (proxy.host && proxy.path) { + // If both a `host` and `path` are specified then it's most likely + // the result of a `url.parse()` call... we need to remove the + // `path` portion so that `net.connect()` doesn't attempt to open + // that as a Unix socket file. + delete proxy.path; + delete proxy.pathname; + } + this.proxy = proxy; + } + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { proxy, secureProxy } = this; + const parsed = url_1.default.parse(req.path); + if (!parsed.protocol) { + parsed.protocol = 'http:'; + } + if (!parsed.hostname) { + parsed.hostname = opts.hostname || opts.host || null; + } + if (parsed.port == null && typeof opts.port) { + parsed.port = String(opts.port); + } + if (parsed.port === '80') { + // if port is 80, then we can remove the port so that the + // ":80" portion is not on the produced URL + delete parsed.port; + } + // Change the `http.ClientRequest` instance's "path" field + // to the absolute path of the URL that will be requested. + req.path = url_1.default.format(parsed); + // Inject the `Proxy-Authorization` header if necessary. + if (proxy.auth) { + req.setHeader('Proxy-Authorization', `Basic ${Buffer.from(proxy.auth).toString('base64')}`); + } + // Create a socket connection to the proxy server. + let socket; + if (secureProxy) { + debug('Creating `tls.Socket`: %o', proxy); + socket = tls_1.default.connect(proxy); + } + else { + debug('Creating `net.Socket`: %o', proxy); + socket = net_1.default.connect(proxy); + } + // At this point, the http ClientRequest's internal `_header` field + // might have already been set. If this is the case then we'll need + // to re-generate the string since we just changed the `req.path`. + if (req._header) { + let first; + let endOfHeaders; + debug('Regenerating stored HTTP header string for request'); + req._header = null; + req._implicitHeader(); + if (req.output && req.output.length > 0) { + // Node < 12 + debug('Patching connection write() output buffer with updated header'); + first = req.output[0]; + endOfHeaders = first.indexOf('\r\n\r\n') + 4; + req.output[0] = req._header + first.substring(endOfHeaders); + debug('Output buffer: %o', req.output); + } + else if (req.outputData && req.outputData.length > 0) { + // Node >= 12 + debug('Patching connection write() output buffer with updated header'); + first = req.outputData[0].data; + endOfHeaders = first.indexOf('\r\n\r\n') + 4; + req.outputData[0].data = + req._header + first.substring(endOfHeaders); + debug('Output buffer: %o', req.outputData[0].data); + } + } + // Wait for the socket's `connect` event, so that this `callback()` + // function throws instead of the `http` request machinery. This is + // important for i.e. `PacProxyAgent` which determines a failed proxy + // connection via the `callback()` function throwing. + yield once_1.default(socket, 'connect'); + return socket; + }); + } +} +exports.default = HttpProxyAgent; +//# sourceMappingURL=agent.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.js.map b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.js.map new file mode 100644 index 000000000..7a407620d --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/agent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,8CAAsB;AACtB,8CAAsB;AACtB,kDAAgC;AAChC,6DAAqC;AACrC,2CAAkE;AAGlE,MAAM,KAAK,GAAG,eAAW,CAAC,kBAAkB,CAAC,CAAC;AAY9C,SAAS,OAAO,CAAC,QAAwB;IACxC,OAAO,OAAO,QAAQ,KAAK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BAC7C,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;wBACrB,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;oBAC7C,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;iBACnD;aACD;YAED,mEAAmE;YACnE,mEAAmE;YACnE,qEAAqE;YACrE,qDAAqD;YACrD,MAAM,cAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YAE9B,OAAO,MAAM,CAAC;QACf,CAAC;KAAA;CACD;AA1ID,iCA0IC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.d.ts b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.d.ts new file mode 100644 index 000000000..24bdb52ef --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.d.ts @@ -0,0 +1,21 @@ +/// <reference types="node" /> +import net from 'net'; +import tls from 'tls'; +import { Url } from 'url'; +import { AgentOptions } from 'agent-base'; +import _HttpProxyAgent from './agent'; +declare function createHttpProxyAgent(opts: string | createHttpProxyAgent.HttpProxyAgentOptions): _HttpProxyAgent; +declare namespace createHttpProxyAgent { + interface BaseHttpProxyAgentOptions { + secureProxy?: boolean; + host?: string | null; + path?: string | null; + port?: string | number | null; + } + export interface HttpProxyAgentOptions extends AgentOptions, BaseHttpProxyAgentOptions, Partial<Omit<Url & net.NetConnectOpts & tls.ConnectionOptions, keyof BaseHttpProxyAgentOptions>> { + } + export type HttpProxyAgent = _HttpProxyAgent; + export const HttpProxyAgent: typeof _HttpProxyAgent; + export {}; +} +export = createHttpProxyAgent; diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.js b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.js new file mode 100644 index 000000000..0a7118059 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.js @@ -0,0 +1,14 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(require("./agent")); +function createHttpProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createHttpProxyAgent) { + createHttpProxyAgent.HttpProxyAgent = agent_1.default; + createHttpProxyAgent.prototype = agent_1.default.prototype; +})(createHttpProxyAgent || (createHttpProxyAgent = {})); +module.exports = createHttpProxyAgent; +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.js.map b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.js.map new file mode 100644 index 000000000..e07dae5b0 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAIA,oDAAsC;AAEtC,SAAS,oBAAoB,CAC5B,IAAyD;IAEzD,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,WAAU,oBAAoB;IAmBhB,mCAAc,GAAG,eAAe,CAAC;IAE9C,oBAAoB,CAAC,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC;AAC5D,CAAC,EAtBS,oBAAoB,KAApB,oBAAoB,QAsB7B;AAED,iBAAS,oBAAoB,CAAC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/index.js b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/index.js deleted file mode 100644 index 6c2909f23..000000000 --- a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/index.js +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Module dependencies. - */ - -var net = require('net'); -var tls = require('tls'); -var url = require('url'); -var Agent = require('agent-base'); -var inherits = require('util').inherits; -var debug = require('debug')('http-proxy-agent'); - -/** - * Module exports. - */ - -module.exports = HttpProxyAgent; - -/** - * The `HttpProxyAgent` implements an HTTP Agent subclass that connects to the - * specified "HTTP proxy server" in order to proxy HTTP requests. - * - * @api public - */ - -function HttpProxyAgent(opts) { - if (!(this instanceof HttpProxyAgent)) return new HttpProxyAgent(opts); - if ('string' == typeof opts) opts = url.parse(opts); - if (!opts) - throw new Error( - 'an HTTP(S) proxy server `host` and `port` must be specified!' - ); - debug('creating new HttpProxyAgent instance: %o', opts); - Agent.call(this, opts); - - var proxy = Object.assign({}, opts); - - // if `true`, then connect to the proxy server over TLS. defaults to `false`. - this.secureProxy = proxy.protocol - ? /^https:?$/i.test(proxy.protocol) - : false; - - // prefer `hostname` over `host`, and set the `port` if needed - proxy.host = proxy.hostname || proxy.host; - proxy.port = +proxy.port || (this.secureProxy ? 443 : 80); - - if (proxy.host && proxy.path) { - // if both a `host` and `path` are specified then it's most likely the - // result of a `url.parse()` call... we need to remove the `path` portion so - // that `net.connect()` doesn't attempt to open that as a unix socket file. - delete proxy.path; - delete proxy.pathname; - } - - this.proxy = proxy; -} -inherits(HttpProxyAgent, Agent); - -/** - * Called when the node-core HTTP client library is creating a new HTTP request. - * - * @api public - */ - -HttpProxyAgent.prototype.callback = function connect(req, opts, fn) { - var proxy = this.proxy; - - // change the `http.ClientRequest` instance's "path" field - // to the absolute path of the URL that will be requested - var parsed = url.parse(req.path); - if (null == parsed.protocol) parsed.protocol = 'http:'; - if (null == parsed.hostname) parsed.hostname = opts.hostname || opts.host; - if (null == parsed.port) parsed.port = opts.port; - if (parsed.port == 80) { - // if port is 80, then we can remove the port so that the - // ":80" portion is not on the produced URL - delete parsed.port; - } - var absolute = url.format(parsed); - req.path = absolute; - - // inject the `Proxy-Authorization` header if necessary - if (proxy.auth) { - req.setHeader( - 'Proxy-Authorization', - 'Basic ' + Buffer.from(proxy.auth).toString('base64') - ); - } - - // create a socket connection to the proxy server - var socket; - if (this.secureProxy) { - socket = tls.connect(proxy); - } else { - socket = net.connect(proxy); - } - - // at this point, the http ClientRequest's internal `_header` field might have - // already been set. If this is the case then we'll need to re-generate the - // string since we just changed the `req.path` - if (req._header) { - debug('regenerating stored HTTP header string for request'); - req._header = null; - req._implicitHeader(); - if (req.output && req.output.length > 0) { - // Node < 12 - debug( - 'patching connection write() output buffer with updated header' - ); - // the _header has already been queued to be written to the socket - var first = req.output[0]; - var endOfHeaders = first.indexOf('\r\n\r\n') + 4; - req.output[0] = req._header + first.substring(endOfHeaders); - debug('output buffer: %o', req.output); - } else if (req.outputData && req.outputData.length > 0) { - // Node >= 12 - debug( - 'patching connection write() output buffer with updated header' - ); - var first = req.outputData[0].data; - // the _header has already been queued to be written to the socket - var endOfHeaders = first.indexOf('\r\n\r\n') + 4; - req.outputData[0].data = - req._header + first.substring(endOfHeaders); - debug('output buffer: %o', req.outputData[0].data); - } - } - - fn(null, socket); -}; diff --git a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/package.json b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/package.json index 9a3e5b595..e460a14e4 100644 --- a/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/package.json +++ b/node_modules/npm-registry-fetch/node_modules/http-proxy-agent/package.json @@ -1,27 +1,27 @@ { - "_from": "http-proxy-agent@^3.0.0", - "_id": "http-proxy-agent@3.0.0", + "_from": "http-proxy-agent@^4.0.1", + "_id": "http-proxy-agent@4.0.1", "_inBundle": false, - "_integrity": "sha512-uGuJaBWQWDQCJI5ip0d/VTYZW0nRrlLWXA4A7P1jrsa+f77rW2yXz315oBt6zGCF6l8C2tlMxY7ffULCj+5FhA==", + "_integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", "_location": "/npm-registry-fetch/http-proxy-agent", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "http-proxy-agent@^3.0.0", + "raw": "http-proxy-agent@^4.0.1", "name": "http-proxy-agent", "escapedName": "http-proxy-agent", - "rawSpec": "^3.0.0", + "rawSpec": "^4.0.1", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "^4.0.1" }, "_requiredBy": [ "/npm-registry-fetch/make-fetch-happen" ], - "_resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-3.0.0.tgz", - "_shasum": "598f42dc815949a11e2c6dbfdf24cd8a4c165327", - "_spec": "http-proxy-agent@^3.0.0", - "_where": "/Users/mperrotte/npminc/cli/node_modules/npm-registry-fetch/node_modules/make-fetch-happen", + "_resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "_shasum": "8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a", + "_spec": "http-proxy-agent@^4.0.1", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/npm-registry-fetch/node_modules/make-fetch-happen", "author": { "name": "Nathan Rajlich", "email": "nathan@tootallnate.net", @@ -32,20 +32,34 @@ }, "bundleDependencies": false, "dependencies": { - "agent-base": "5", + "@tootallnate/once": "1", + "agent-base": "6", "debug": "4" }, "deprecated": false, "description": "An HTTP(s) proxy `http.Agent` implementation for HTTP", "devDependencies": { - "mocha": "3", - "proxy": "1" + "@types/debug": "4", + "@types/node": "^12.12.11", + "@typescript-eslint/eslint-plugin": "1.6.0", + "@typescript-eslint/parser": "1.1.0", + "eslint": "5.16.0", + "eslint-config-airbnb": "17.1.0", + "eslint-config-prettier": "4.1.0", + "eslint-import-resolver-typescript": "1.1.1", + "eslint-plugin-import": "2.16.0", + "eslint-plugin-jsx-a11y": "6.2.1", + "eslint-plugin-react": "7.12.4", + "mocha": "^6.2.2", + "proxy": "1", + "rimraf": "^3.0.0", + "typescript": "^3.5.3" }, "engines": { "node": ">= 6" }, "files": [ - "index.js" + "dist" ], "homepage": "https://github.com/TooTallNate/node-http-proxy-agent#readme", "keywords": [ @@ -55,14 +69,19 @@ "agent" ], "license": "MIT", - "main": "./index.js", + "main": "./dist/index.js", "name": "http-proxy-agent", "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-http-proxy-agent.git" }, "scripts": { - "test": "mocha --reporter spec" + "build": "tsc", + "prebuild": "rimraf dist", + "prepublishOnly": "npm run build", + "test": "mocha", + "test-lint": "eslint src --ext .js,.ts" }, - "version": "3.0.0" + "types": "./dist/index.d.ts", + "version": "4.0.1" } diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.editorconfig b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.editorconfig deleted file mode 100644 index 12b4b9a3b..000000000 --- a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.editorconfig +++ /dev/null @@ -1,37 +0,0 @@ -root = true - -[*] -indent_style = tab -indent_size = 4 -tab_width = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[{*.json,*.json.example,*.gyp,*.yml,*.yaml,*.workflow}] -indent_style = space -indent_size = 2 - -[{*.py,*.asm}] -indent_style = space - -[*.py] -indent_size = 4 - -[*.asm] -indent_size = 8 - -[*.md] -trim_trailing_whitespace = false - -# Ideal settings - some plugins might support these. -[*.js] -quote_type = single - -[{*.c,*.cc,*.h,*.hh,*.cpp,*.hpp,*.m,*.mm,*.mpp,*.js,*.java,*.go,*.rs,*.php,*.ng,*.jsx,*.ts,*.d,*.cs,*.swift}] -curly_bracket_next_line = false -spaces_around_operators = true -spaces_around_brackets = outside -# close enough to 1TB -indent_brace_style = K&R diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.eslintrc.js b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.eslintrc.js deleted file mode 100644 index 62743f2c4..000000000 --- a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.eslintrc.js +++ /dev/null @@ -1,86 +0,0 @@ -module.exports = { - 'extends': [ - 'airbnb', - 'prettier' - ], - 'parser': '@typescript-eslint/parser', - 'parserOptions': { - 'ecmaVersion': 2018, - 'sourceType': 'module', - 'modules': true - }, - 'plugins': [ - '@typescript-eslint' - ], - 'settings': { - 'import/resolver': { - 'typescript': { - } - } - }, - 'rules': { - 'quotes': [ - 2, - 'single', - { - 'allowTemplateLiterals': true - } - ], - 'class-methods-use-this': 0, - 'consistent-return': 0, - 'func-names': 0, - 'global-require': 0, - 'guard-for-in': 0, - 'import/no-duplicates': 0, - 'import/no-dynamic-require': 0, - 'import/no-extraneous-dependencies': 0, - 'import/prefer-default-export': 0, - 'lines-between-class-members': 0, - 'no-await-in-loop': 0, - 'no-bitwise': 0, - 'no-console': 0, - 'no-continue': 0, - 'no-control-regex': 0, - 'no-empty': 0, - 'no-loop-func': 0, - 'no-nested-ternary': 0, - 'no-param-reassign': 0, - 'no-plusplus': 0, - 'no-restricted-globals': 0, - 'no-restricted-syntax': 0, - 'no-shadow': 0, - 'no-underscore-dangle': 0, - 'no-use-before-define': 0, - 'prefer-const': 0, - 'prefer-destructuring': 0, - 'camelcase': 0, - 'no-unused-vars': 0, // in favor of '@typescript-eslint/no-unused-vars' - // 'indent': 0 // in favor of '@typescript-eslint/indent' - '@typescript-eslint/no-unused-vars': 'warn', - // '@typescript-eslint/indent': ['error', 2] // this might conflict with a lot ongoing changes - '@typescript-eslint/no-array-constructor': 'error', - '@typescript-eslint/adjacent-overload-signatures': 'error', - '@typescript-eslint/class-name-casing': 'error', - '@typescript-eslint/interface-name-prefix': 'error', - '@typescript-eslint/no-empty-interface': 'error', - '@typescript-eslint/no-inferrable-types': 'error', - '@typescript-eslint/no-misused-new': 'error', - '@typescript-eslint/no-namespace': 'error', - '@typescript-eslint/no-non-null-assertion': 'error', - '@typescript-eslint/no-parameter-properties': 'error', - '@typescript-eslint/no-triple-slash-reference': 'error', - '@typescript-eslint/prefer-namespace-keyword': 'error', - '@typescript-eslint/type-annotation-spacing': 'error', - // '@typescript-eslint/array-type': 'error', - // '@typescript-eslint/ban-types': 'error', - // '@typescript-eslint/explicit-function-return-type': 'warn', - // '@typescript-eslint/explicit-member-accessibility': 'error', - // '@typescript-eslint/member-delimiter-style': 'error', - // '@typescript-eslint/no-angle-bracket-type-assertion': 'error', - // '@typescript-eslint/no-explicit-any': 'warn', - // '@typescript-eslint/no-object-literal-type-assertion': 'error', - // '@typescript-eslint/no-use-before-define': 'error', - // '@typescript-eslint/no-var-requires': 'error', - // '@typescript-eslint/prefer-interface': 'error' - } -} diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.github/workflows/test.yml b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.github/workflows/test.yml deleted file mode 100644 index 329914f92..000000000 --- a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/.github/workflows/test.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Node CI - -on: - push: - branches: - - master - tags: - - '!*' - pull_request: - -jobs: - build: - name: Test Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [6.x, 8.x, 10.x, 12.x] - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v1 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Print Node.js Version - run: node --version - - - name: Install Dependencies - run: npm install - env: - CI: true - - - name: Run "build" step - run: npm run build --if-present - env: - CI: true - - - name: Run tests - run: npm test - env: - CI: true diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.d.ts b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.d.ts new file mode 100644 index 000000000..4f1c63624 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.d.ts @@ -0,0 +1,30 @@ +/// <reference types="node" /> +import net from 'net'; +import { Agent, ClientRequest, RequestOptions } from 'agent-base'; +import { HttpsProxyAgentOptions } from '.'; +/** + * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to + * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. + * + * Outgoing HTTP requests are first tunneled through the proxy server using the + * `CONNECT` HTTP request method to establish a connection to the proxy server, + * and then the proxy server connects to the destination target and issues the + * HTTP request from the proxy server. + * + * `https:` requests have their socket connection upgraded to TLS once + * the connection to the proxy server has been established. + * + * @api public + */ +export default class HttpsProxyAgent extends Agent { + private secureProxy; + private proxy; + constructor(_opts: string | HttpsProxyAgentOptions); + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req: ClientRequest, opts: RequestOptions): Promise<net.Socket>; +} diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.js b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.js new file mode 100644 index 000000000..d6665259f --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.js @@ -0,0 +1,180 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const net_1 = __importDefault(require("net")); +const tls_1 = __importDefault(require("tls")); +const url_1 = __importDefault(require("url")); +const assert_1 = __importDefault(require("assert")); +const debug_1 = __importDefault(require("debug")); +const agent_base_1 = require("agent-base"); +const parse_proxy_response_1 = __importDefault(require("./parse-proxy-response")); +const debug = debug_1.default('https-proxy-agent:agent'); +/** + * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to + * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. + * + * Outgoing HTTP requests are first tunneled through the proxy server using the + * `CONNECT` HTTP request method to establish a connection to the proxy server, + * and then the proxy server connects to the destination target and issues the + * HTTP request from the proxy server. + * + * `https:` requests have their socket connection upgraded to TLS once + * the connection to the proxy server has been established. + * + * @api public + */ +class HttpsProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); + } + debug('creating new HttpsProxyAgent instance: %o', opts); + super(opts); + const proxy = Object.assign({}, opts); + // If `true`, then connect to the proxy server over TLS. + // Defaults to `false`. + this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); + // Prefer `hostname` over `host`, and set the `port` if needed. + proxy.host = proxy.hostname || proxy.host; + if (typeof proxy.port === 'string') { + proxy.port = parseInt(proxy.port, 10); + } + if (!proxy.port && proxy.host) { + proxy.port = this.secureProxy ? 443 : 80; + } + // ALPN is supported by Node.js >= v5. + // attempt to negotiate http/1.1 for proxy servers that support http/2 + if (this.secureProxy && !('ALPNProtocols' in proxy)) { + proxy.ALPNProtocols = ['http 1.1']; + } + if (proxy.host && proxy.path) { + // If both a `host` and `path` are specified then it's most likely + // the result of a `url.parse()` call... we need to remove the + // `path` portion so that `net.connect()` doesn't attempt to open + // that as a Unix socket file. + delete proxy.path; + delete proxy.pathname; + } + this.proxy = proxy; + } + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { proxy, secureProxy } = this; + // Create a socket connection to the proxy server. + let socket; + if (secureProxy) { + debug('Creating `tls.Socket`: %o', proxy); + socket = tls_1.default.connect(proxy); + } + else { + debug('Creating `net.Socket`: %o', proxy); + socket = net_1.default.connect(proxy); + } + const headers = Object.assign({}, proxy.headers); + const hostname = `${opts.host}:${opts.port}`; + let payload = `CONNECT ${hostname} HTTP/1.1\r\n`; + // Inject the `Proxy-Authorization` header if necessary. + if (proxy.auth) { + headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`; + } + // The `Host` header should only include the port + // number when it is not the default port. + let { host, port, secureEndpoint } = opts; + if (!isDefaultPort(port, secureEndpoint)) { + host += `:${port}`; + } + headers.Host = host; + headers.Connection = 'close'; + for (const name of Object.keys(headers)) { + payload += `${name}: ${headers[name]}\r\n`; + } + const proxyResponsePromise = parse_proxy_response_1.default(socket); + socket.write(`${payload}\r\n`); + const { statusCode, buffered } = yield proxyResponsePromise; + if (statusCode === 200) { + req.once('socket', resume); + if (opts.secureEndpoint) { + const servername = opts.servername || opts.host; + if (!servername) { + throw new Error('Could not determine "servername"'); + } + // The proxy is connecting to a TLS server, so upgrade + // this socket connection to a TLS connection. + debug('Upgrading socket connection to TLS'); + return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, + servername })); + } + return socket; + } + // Some other status code that's not 200... need to re-play the HTTP + // header "data" events onto the socket once the HTTP machinery is + // attached so that the node core `http` can parse and handle the + // error status code. + // Close the original socket, and a new "fake" socket is returned + // instead, so that the proxy doesn't get the HTTP request + // written to it (which may contain `Authorization` headers or other + // sensitive data). + // + // See: https://hackerone.com/reports/541502 + socket.destroy(); + const fakeSocket = new net_1.default.Socket(); + fakeSocket.readable = true; + // Need to wait for the "socket" event to re-play the "data" events. + req.once('socket', (s) => { + debug('replaying proxy buffer for failed request'); + assert_1.default(s.listenerCount('data') > 0); + // Replay the "buffered" Buffer onto the fake `socket`, since at + // this point the HTTP module machinery has been hooked up for + // the user. + s.push(buffered); + s.push(null); + }); + return fakeSocket; + }); + } +} +exports.default = HttpsProxyAgent; +function resume(socket) { + socket.resume(); +} +function isDefaultPort(port, secure) { + return Boolean((!secure && port === 80) || (secure && port === 443)); +} +function isHTTPS(protocol) { + return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; +} +function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; +} +//# sourceMappingURL=agent.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.js.map b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.js.map new file mode 100644 index 000000000..d1307cdd8 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/agent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,8CAAsB;AACtB,8CAAsB;AACtB,oDAA4B;AAC5B,kDAAgC;AAEhC,2CAAkE;AAElE,kFAAwD;AAExD,MAAM,KAAK,GAAG,eAAW,CAAC,yBAAyB,CAAC,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAqB,eAAgB,SAAQ,kBAAK;IAIjD,YAAY,KAAsC;QACjD,IAAI,IAA4B,CAAC;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC9B,IAAI,GAAG,aAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;aAAM;YACN,IAAI,GAAG,KAAK,CAAC;SACb;QACD,IAAI,CAAC,IAAI,EAAE;YACV,MAAM,IAAI,KAAK,CACd,8DAA8D,CAC9D,CAAC;SACF;QACD,KAAK,CAAC,2CAA2C,EAAE,IAAI,CAAC,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,MAAM,KAAK,qBAAgC,IAAI,CAAE,CAAC;QAElD,wDAAwD;QACxD,uBAAuB;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE/D,+DAA+D;QAC/D,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC;QAC1C,IAAI,OAAO,K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ACtE,CAAC;AAED,SAAS,OAAO,CAAC,QAAwB;IACxC,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3E,CAAC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.d.ts b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.d.ts new file mode 100644 index 000000000..0d60062ee --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.d.ts @@ -0,0 +1,23 @@ +/// <reference types="node" /> +import net from 'net'; +import tls from 'tls'; +import { Url } from 'url'; +import { AgentOptions } from 'agent-base'; +import { OutgoingHttpHeaders } from 'http'; +import _HttpsProxyAgent from './agent'; +declare function createHttpsProxyAgent(opts: string | createHttpsProxyAgent.HttpsProxyAgentOptions): _HttpsProxyAgent; +declare namespace createHttpsProxyAgent { + interface BaseHttpsProxyAgentOptions { + headers?: OutgoingHttpHeaders; + secureProxy?: boolean; + host?: string | null; + path?: string | null; + port?: string | number | null; + } + export interface HttpsProxyAgentOptions extends AgentOptions, BaseHttpsProxyAgentOptions, Partial<Omit<Url & net.NetConnectOpts & tls.ConnectionOptions, keyof BaseHttpsProxyAgentOptions>> { + } + export type HttpsProxyAgent = _HttpsProxyAgent; + export const HttpsProxyAgent: typeof _HttpsProxyAgent; + export {}; +} +export = createHttpsProxyAgent; diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.js b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.js new file mode 100644 index 000000000..b03e7631a --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.js @@ -0,0 +1,14 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(require("./agent")); +function createHttpsProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createHttpsProxyAgent) { + createHttpsProxyAgent.HttpsProxyAgent = agent_1.default; + createHttpsProxyAgent.prototype = agent_1.default.prototype; +})(createHttpsProxyAgent || (createHttpsProxyAgent = {})); +module.exports = createHttpsProxyAgent; +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.js.map b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.js.map new file mode 100644 index 000000000..f3ce559de --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAKA,oDAAuC;AAEvC,SAAS,qBAAqB,CAC7B,IAA2D;IAE3D,OAAO,IAAI,eAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,WAAU,qBAAqB;IAoBjB,qCAAe,GAAG,eAAgB,CAAC;IAEhD,qBAAqB,CAAC,SAAS,GAAG,eAAgB,CAAC,SAAS,CAAC;AAC9D,CAAC,EAvBS,qBAAqB,KAArB,qBAAqB,QAuB9B;AAED,iBAAS,qBAAqB,CAAC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts new file mode 100644 index 000000000..7565674a3 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts @@ -0,0 +1,7 @@ +/// <reference types="node" /> +import { Readable } from 'stream'; +export interface ProxyResponse { + statusCode: number; + buffered: Buffer; +} +export default function parseProxyResponse(socket: Readable): Promise<ProxyResponse>; diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.js b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.js new file mode 100644 index 000000000..aa5ce3cc2 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.js @@ -0,0 +1,66 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const debug_1 = __importDefault(require("debug")); +const debug = debug_1.default('https-proxy-agent:parse-proxy-response'); +function parseProxyResponse(socket) { + return new Promise((resolve, reject) => { + // we need to buffer any HTTP traffic that happens with the proxy before we get + // the CONNECT response, so that if the response is anything other than an "200" + // response code, then we can re-play the "data" events on the socket once the + // HTTP parser is hooked up... + let buffersLength = 0; + const buffers = []; + function read() { + const b = socket.read(); + if (b) + ondata(b); + else + socket.once('readable', read); + } + function cleanup() { + socket.removeListener('end', onend); + socket.removeListener('error', onerror); + socket.removeListener('close', onclose); + socket.removeListener('readable', read); + } + function onclose(err) { + debug('onclose had error %o', err); + } + function onend() { + debug('onend'); + } + function onerror(err) { + cleanup(); + debug('onerror %o', err); + reject(err); + } + function ondata(b) { + buffers.push(b); + buffersLength += b.length; + const buffered = Buffer.concat(buffers, buffersLength); + const endOfHeaders = buffered.indexOf('\r\n\r\n'); + if (endOfHeaders === -1) { + // keep buffering + debug('have not received end of HTTP headers yet...'); + read(); + return; + } + const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n')); + const statusCode = +firstLine.split(' ')[1]; + debug('got proxy server response: %o', firstLine); + resolve({ + statusCode, + buffered + }); + } + socket.on('error', onerror); + socket.on('close', onclose); + socket.on('end', onend); + read(); + }); +} +exports.default = parseProxyResponse; +//# sourceMappingURL=parse-proxy-response.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map new file mode 100644 index 000000000..bacdb84b9 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse-proxy-response.js","sourceRoot":"","sources":["../src/parse-proxy-response.ts"],"names":[],"mappings":";;;;;AAAA,kDAAgC;AAGhC,MAAM,KAAK,GAAG,eAAW,CAAC,wCAAwC,CAAC,CAAC;AAOpE,SAAwB,kBAAkB,CACzC,MAAgB;IAEhB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,+EAA+E;QAC/E,gFAAgF;QAChF,8EAA8E;QAC9E,8BAA8B;QAC9B,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,SAAS,IAAI;YACZ,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC;gBAAE,MAAM,CAAC,CAAC,CAAC,CAAC;;gBACZ,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,SAAS,OAAO;YACf,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC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,IAAI,EAAE,CAAC;IACR,CAAC,CAAC,CAAC;AACJ,CAAC;AAvED,qCAuEC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/index.d.ts b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/index.d.ts deleted file mode 100644 index cec35d85e..000000000 --- a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module 'https-proxy-agent' { - import * as https from 'https'; - - namespace HttpsProxyAgent { - interface HttpsProxyAgentOptions { - host: string; - port: number | string; - secureProxy?: boolean; - headers?: { - [key: string]: string; - }; - [key: string]: any; - } - } - - // HttpsProxyAgent doesnt *actually* extend https.Agent, but for my purposes I want it to pretend that it does - class HttpsProxyAgent extends https.Agent { - constructor(opts: HttpsProxyAgent.HttpsProxyAgentOptions | string); - } - - export = HttpsProxyAgent; -} diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/index.js b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/index.js deleted file mode 100644 index aa3021e2e..000000000 --- a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/index.js +++ /dev/null @@ -1,239 +0,0 @@ -/** - * Module dependencies. - */ - -var net = require('net'); -var tls = require('tls'); -var url = require('url'); -var assert = require('assert'); -var Agent = require('agent-base'); -var inherits = require('util').inherits; -var debug = require('debug')('https-proxy-agent'); - -/** - * Module exports. - */ - -module.exports = HttpsProxyAgent; - -/** - * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to the - * specified "HTTP(s) proxy server" in order to proxy HTTPS requests. - * - * @api public - */ - -function HttpsProxyAgent(opts) { - if (!(this instanceof HttpsProxyAgent)) return new HttpsProxyAgent(opts); - if ('string' == typeof opts) opts = url.parse(opts); - if (!opts) - throw new Error( - 'an HTTP(S) proxy server `host` and `port` must be specified!' - ); - debug('creating new HttpsProxyAgent instance: %o', opts); - Agent.call(this, opts); - - var proxy = Object.assign({}, opts); - - // if `true`, then connect to the proxy server over TLS. defaults to `false`. - this.secureProxy = proxy.protocol - ? /^https:?$/i.test(proxy.protocol) - : false; - - // prefer `hostname` over `host`, and set the `port` if needed - proxy.host = proxy.hostname || proxy.host; - proxy.port = +proxy.port || (this.secureProxy ? 443 : 80); - - // ALPN is supported by Node.js >= v5. - // attempt to negotiate http/1.1 for proxy servers that support http/2 - if (this.secureProxy && !('ALPNProtocols' in proxy)) { - proxy.ALPNProtocols = ['http 1.1']; - } - - if (proxy.host && proxy.path) { - // if both a `host` and `path` are specified then it's most likely the - // result of a `url.parse()` call... we need to remove the `path` portion so - // that `net.connect()` doesn't attempt to open that as a unix socket file. - delete proxy.path; - delete proxy.pathname; - } - - this.proxy = proxy; -} -inherits(HttpsProxyAgent, Agent); - -/** - * Called when the node-core HTTP client library is creating a new HTTP request. - * - * @api public - */ - -HttpsProxyAgent.prototype.callback = function connect(req, opts, fn) { - var proxy = this.proxy; - - // create a socket connection to the proxy server - var socket; - if (this.secureProxy) { - socket = tls.connect(proxy); - } else { - socket = net.connect(proxy); - } - - // we need to buffer any HTTP traffic that happens with the proxy before we get - // the CONNECT response, so that if the response is anything other than an "200" - // response code, then we can re-play the "data" events on the socket once the - // HTTP parser is hooked up... - var buffers = []; - var buffersLength = 0; - - function read() { - var b = socket.read(); - if (b) ondata(b); - else socket.once('readable', read); - } - - function cleanup() { - socket.removeListener('end', onend); - socket.removeListener('error', onerror); - socket.removeListener('close', onclose); - socket.removeListener('readable', read); - } - - function onclose(err) { - debug('onclose had error %o', err); - } - - function onend() { - debug('onend'); - } - - function onerror(err) { - cleanup(); - fn(err); - } - - function ondata(b) { - buffers.push(b); - buffersLength += b.length; - var buffered = Buffer.concat(buffers, buffersLength); - var str = buffered.toString('ascii'); - - if (!~str.indexOf('\r\n\r\n')) { - // keep buffering - debug('have not received end of HTTP headers yet...'); - read(); - return; - } - - var firstLine = str.substring(0, str.indexOf('\r\n')); - var statusCode = +firstLine.split(' ')[1]; - debug('got proxy server response: %o', firstLine); - - if (200 == statusCode) { - // 200 Connected status code! - var sock = socket; - - // nullify the buffered data since we won't be needing it - buffers = buffered = null; - - if (opts.secureEndpoint) { - // since the proxy is connecting to an SSL server, we have - // to upgrade this socket connection to an SSL connection - debug( - 'upgrading proxy-connected socket to TLS connection: %o', - opts.host - ); - opts.socket = socket; - opts.servername = opts.servername || opts.host; - opts.host = null; - opts.hostname = null; - opts.port = null; - sock = tls.connect(opts); - } - - cleanup(); - req.once('socket', resume); - fn(null, sock); - } else { - // some other status code that's not 200... need to re-play the HTTP header - // "data" events onto the socket once the HTTP machinery is attached so - // that the node core `http` can parse and handle the error status code - cleanup(); - - // the original socket is closed, and a new closed socket is - // returned instead, so that the proxy doesn't get the HTTP request - // written to it (which may contain `Authorization` headers or other - // sensitive data). - // - // See: https://hackerone.com/reports/541502 - socket.destroy(); - socket = new net.Socket(); - socket.readable = true; - - // save a reference to the concat'd Buffer for the `onsocket` callback - buffers = buffered; - - // need to wait for the "socket" event to re-play the "data" events - req.once('socket', onsocket); - - fn(null, socket); - } - } - - function onsocket(socket) { - debug('replaying proxy buffer for failed request'); - assert(socket.listenerCount('data') > 0); - - // replay the "buffers" Buffer onto the `socket`, since at this point - // the HTTP module machinery has been hooked up for the user - socket.push(buffers); - - // nullify the cached Buffer instance - buffers = null; - } - - socket.on('error', onerror); - socket.on('close', onclose); - socket.on('end', onend); - - read(); - - var hostname = opts.host + ':' + opts.port; - var msg = 'CONNECT ' + hostname + ' HTTP/1.1\r\n'; - - var headers = Object.assign({}, proxy.headers); - if (proxy.auth) { - headers['Proxy-Authorization'] = - 'Basic ' + Buffer.from(proxy.auth).toString('base64'); - } - - // the Host header should only include the port - // number when it is a non-standard port - var host = opts.host; - if (!isDefaultPort(opts.port, opts.secureEndpoint)) { - host += ':' + opts.port; - } - headers['Host'] = host; - - headers['Connection'] = 'close'; - Object.keys(headers).forEach(function(name) { - msg += name + ': ' + headers[name] + '\r\n'; - }); - - socket.write(msg + '\r\n'); -}; - -/** - * Resumes a socket. - * - * @param {(net.Socket|tls.Socket)} socket The socket to resume - * @api public - */ - -function resume(socket) { - socket.resume(); -} - -function isDefaultPort(port, secure) { - return Boolean((!secure && port === 80) || (secure && port === 443)); -} diff --git a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/package.json b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/package.json index a03953e16..d58b42665 100644 --- a/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/package.json +++ b/node_modules/npm-registry-fetch/node_modules/https-proxy-agent/package.json @@ -1,27 +1,27 @@ { - "_from": "https-proxy-agent@^4.0.0", - "_id": "https-proxy-agent@4.0.0", + "_from": "https-proxy-agent@^5.0.0", + "_id": "https-proxy-agent@5.0.0", "_inBundle": false, - "_integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "_integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", "_location": "/npm-registry-fetch/https-proxy-agent", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "https-proxy-agent@^4.0.0", + "raw": "https-proxy-agent@^5.0.0", "name": "https-proxy-agent", "escapedName": "https-proxy-agent", - "rawSpec": "^4.0.0", + "rawSpec": "^5.0.0", "saveSpec": null, - "fetchSpec": "^4.0.0" + "fetchSpec": "^5.0.0" }, "_requiredBy": [ "/npm-registry-fetch/make-fetch-happen" ], - "_resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "_shasum": "702b71fb5520a132a66de1f67541d9e62154d82b", - "_spec": "https-proxy-agent@^4.0.0", - "_where": "/Users/mperrotte/npminc/cli/node_modules/npm-registry-fetch/node_modules/make-fetch-happen", + "_resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "_shasum": "e2a90542abb68a762e0a0850f6c9edadfd8506b2", + "_spec": "https-proxy-agent@^5.0.0", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/npm-registry-fetch/node_modules/make-fetch-happen", "author": { "name": "Nathan Rajlich", "email": "nathan@tootallnate.net", @@ -32,18 +32,34 @@ }, "bundleDependencies": false, "dependencies": { - "agent-base": "5", + "agent-base": "6", "debug": "4" }, "deprecated": false, "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", "devDependencies": { - "mocha": "6", - "proxy": "1" + "@types/debug": "4", + "@types/node": "^12.12.11", + "@typescript-eslint/eslint-plugin": "1.6.0", + "@typescript-eslint/parser": "1.1.0", + "eslint": "5.16.0", + "eslint-config-airbnb": "17.1.0", + "eslint-config-prettier": "4.1.0", + "eslint-import-resolver-typescript": "1.1.1", + "eslint-plugin-import": "2.16.0", + "eslint-plugin-jsx-a11y": "6.2.1", + "eslint-plugin-react": "7.12.4", + "mocha": "^6.2.2", + "proxy": "1", + "rimraf": "^3.0.0", + "typescript": "^3.5.3" }, "engines": { - "node": ">= 6.0.0" + "node": ">= 6" }, + "files": [ + "dist" + ], "homepage": "https://github.com/TooTallNate/node-https-proxy-agent#readme", "keywords": [ "https", @@ -52,15 +68,19 @@ "agent" ], "license": "MIT", - "main": "./index.js", + "main": "dist/index", "name": "https-proxy-agent", "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-https-proxy-agent.git" }, "scripts": { - "test": "mocha --reporter spec" + "build": "tsc", + "prebuild": "rimraf dist", + "prepublishOnly": "npm run build", + "test": "mocha --reporter spec", + "test-lint": "eslint src --ext .js,.ts" }, - "types": "./index.d.ts", - "version": "4.0.0" + "types": "dist/index", + "version": "5.0.0" } diff --git a/node_modules/npm-registry-fetch/node_modules/make-fetch-happen/package.json b/node_modules/npm-registry-fetch/node_modules/make-fetch-happen/package.json index 0d3245282..bc499863e 100644 --- a/node_modules/npm-registry-fetch/node_modules/make-fetch-happen/package.json +++ b/node_modules/npm-registry-fetch/node_modules/make-fetch-happen/package.json @@ -1,27 +1,27 @@ { - "_from": "make-fetch-happen@^8.0.1", - "_id": "make-fetch-happen@8.0.1", + "_from": "make-fetch-happen@^8.0.2", + "_id": "make-fetch-happen@8.0.2", "_inBundle": false, - "_integrity": "sha512-oiK8xz6+IxaPqmOCW+rmlH922RTZ+fi4TAULGRih8ryqIju0x6WriDR3smm7Z+8NZRxDIK/iDLM096F/gLfiWg==", + "_integrity": "sha512-jRqI9zjLyz8ufXfLSbEObJ6a8sv8geeKYEPFpI+b39JjYU14MZtCiJGazSWPZMjCm7161b4r57N/na5fBXpooQ==", "_location": "/npm-registry-fetch/make-fetch-happen", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "make-fetch-happen@^8.0.1", + "raw": "make-fetch-happen@^8.0.2", "name": "make-fetch-happen", "escapedName": "make-fetch-happen", - "rawSpec": "^8.0.1", + "rawSpec": "^8.0.2", "saveSpec": null, - "fetchSpec": "^8.0.1" + "fetchSpec": "^8.0.2" }, "_requiredBy": [ "/npm-registry-fetch" ], - "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-8.0.1.tgz", - "_shasum": "94e0c57c42617d28f3e3c6c64a8977f87887362b", - "_spec": "make-fetch-happen@^8.0.1", - "_where": "/Users/claudiahdz/npm/cli/node_modules/npm-registry-fetch", + "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-8.0.2.tgz", + "_shasum": "155ef26d7c6f3caf8146b0f5d0140a01e0fdc050", + "_spec": "make-fetch-happen@^8.0.2", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/npm-registry-fetch", "author": { "name": "Kat Marchán", "email": "kzm@zkat.tech" @@ -34,8 +34,8 @@ "agentkeepalive": "^4.1.0", "cacache": "^15.0.0", "http-cache-semantics": "^4.0.4", - "http-proxy-agent": "^3.0.0", - "https-proxy-agent": "^4.0.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", "lru-cache": "^5.1.1", "minipass": "^3.0.0", @@ -44,7 +44,7 @@ "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.2", "promise-retry": "^1.1.1", - "socks-proxy-agent": "^4.0.0", + "socks-proxy-agent": "^5.0.0", "ssri": "^8.0.0" }, "deprecated": false, @@ -94,5 +94,5 @@ "release": "standard-version -s", "test": "tap test/*.js" }, - "version": "8.0.1" + "version": "8.0.2" } diff --git a/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/README.md b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/README.md new file mode 100644 index 000000000..4df184ffa --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/README.md @@ -0,0 +1,152 @@ +socks-proxy-agent +================ +### A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS +[![Build Status](https://github.com/TooTallNate/node-socks-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-socks-proxy-agent/actions?workflow=Node+CI) + +This module provides an `http.Agent` implementation that connects to a +specified SOCKS proxy server, and can be used with the built-in `http` +and `https` modules. + +It can also be used in conjunction with the `ws` module to establish a WebSocket +connection over a SOCKS proxy. See the "Examples" section below. + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install socks-proxy-agent +``` + + +Examples +-------- + +#### TypeScript example + +```ts +import https from 'https'; +import { SocksProxyAgent } from 'socks-proxy-agent'; + +const info = { + host: 'br41.nordvpn.com', + userId: 'your-name@gmail.com', + password: 'abcdef12345124' +}; +const agent = new SocksProxyAgent(info); + +https.get('https://jsonip.org', { agent }, (res) => { + console.log(res.headers); + res.pipe(process.stdout); +}); +``` + +#### `http` module example + +```js +var url = require('url'); +var http = require('http'); +var SocksProxyAgent = require('socks-proxy-agent'); + +// SOCKS proxy to connect to +var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080'; +console.log('using proxy server %j', proxy); + +// HTTP endpoint for the proxy to connect to +var endpoint = process.argv[2] || 'http://nodejs.org/api/'; +console.log('attempting to GET %j', endpoint); +var opts = url.parse(endpoint); + +// create an instance of the `SocksProxyAgent` class with the proxy server information +var agent = new SocksProxyAgent(proxy); +opts.agent = agent; + +http.get(opts, function (res) { + console.log('"response" event!', res.headers); + res.pipe(process.stdout); +}); +``` + +#### `https` module example + +```js +var url = require('url'); +var https = require('https'); +var SocksProxyAgent = require('socks-proxy-agent'); + +// SOCKS proxy to connect to +var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080'; +console.log('using proxy server %j', proxy); + +// HTTP endpoint for the proxy to connect to +var endpoint = process.argv[2] || 'https://encrypted.google.com/'; +console.log('attempting to GET %j', endpoint); +var opts = url.parse(endpoint); + +// create an instance of the `SocksProxyAgent` class with the proxy server information +var agent = new SocksProxyAgent(proxy); +opts.agent = agent; + +https.get(opts, function (res) { + console.log('"response" event!', res.headers); + res.pipe(process.stdout); +}); +``` + +#### `ws` WebSocket connection example + +``` js +var WebSocket = require('ws'); +var SocksProxyAgent = require('socks-proxy-agent'); + +// SOCKS proxy to connect to +var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080'; +console.log('using proxy server %j', proxy); + +// WebSocket endpoint for the proxy to connect to +var endpoint = process.argv[2] || 'ws://echo.websocket.org'; +console.log('attempting to connect to WebSocket %j', endpoint); + +// create an instance of the `SocksProxyAgent` class with the proxy server information +var agent = new SocksProxyAgent(proxy); + +// initiate the WebSocket connection +var socket = new WebSocket(endpoint, { agent: agent }); + +socket.on('open', function () { + console.log('"open" event!'); + socket.send('hello world'); +}); + +socket.on('message', function (data, flags) { + console.log('"message" event! %j %j', data, flags); + socket.close(); +}); +``` + +License +------- + +(The MIT License) + +Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.d.ts b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.d.ts new file mode 100644 index 000000000..52341a1b5 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.d.ts @@ -0,0 +1,21 @@ +/// <reference types="node" /> +import net from 'net'; +import { Agent, ClientRequest, RequestOptions } from 'agent-base'; +import { SocksProxyAgentOptions } from '.'; +/** + * The `SocksProxyAgent`. + * + * @api public + */ +export default class SocksProxyAgent extends Agent { + private lookup; + private proxy; + constructor(_opts: string | SocksProxyAgentOptions); + /** + * Initiates a SOCKS connection to the specified SOCKS proxy server, + * which in turn connects to the specified remote host and port. + * + * @api protected + */ + callback(req: ClientRequest, opts: RequestOptions): Promise<net.Socket>; +} diff --git a/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.js b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.js new file mode 100644 index 000000000..f779732bb --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.js @@ -0,0 +1,182 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const dns_1 = __importDefault(require("dns")); +const tls_1 = __importDefault(require("tls")); +const url_1 = __importDefault(require("url")); +const debug_1 = __importDefault(require("debug")); +const agent_base_1 = require("agent-base"); +const socks_1 = require("socks"); +const debug = debug_1.default('socks-proxy-agent'); +function dnsLookup(host) { + return new Promise((resolve, reject) => { + dns_1.default.lookup(host, (err, res) => { + if (err) { + reject(err); + } + else { + resolve(res); + } + }); + }); +} +function parseSocksProxy(opts) { + let port = 0; + let lookup = false; + let type = 5; + // Prefer `hostname` over `host`, because of `url.parse()` + const host = opts.hostname || opts.host; + if (!host) { + throw new TypeError('No "host"'); + } + if (typeof opts.port === 'number') { + port = opts.port; + } + else if (typeof opts.port === 'string') { + port = parseInt(opts.port, 10); + } + // From RFC 1928, Section 3: https://tools.ietf.org/html/rfc1928#section-3 + // "The SOCKS service is conventionally located on TCP port 1080" + if (!port) { + port = 1080; + } + // figure out if we want socks v4 or v5, based on the "protocol" used. + // Defaults to 5. + if (opts.protocol) { + switch (opts.protocol) { + case 'socks4:': + lookup = true; + // pass through + case 'socks4a:': + type = 4; + break; + case 'socks5:': + lookup = true; + // pass through + case 'socks:': // no version specified, default to 5h + case 'socks5h:': + type = 5; + break; + default: + throw new TypeError(`A "socks" protocol must be specified! Got: ${opts.protocol}`); + } + } + if (typeof opts.type !== 'undefined') { + if (opts.type === 4 || opts.type === 5) { + type = opts.type; + } + else { + throw new TypeError(`"type" must be 4 or 5, got: ${opts.type}`); + } + } + const proxy = { + host, + port, + type + }; + let userId = opts.userId; + let password = opts.password; + if (opts.auth) { + const auth = opts.auth.split(':'); + userId = auth[0]; + password = auth[1]; + } + if (userId) { + Object.defineProperty(proxy, 'userId', { + value: userId, + enumerable: false + }); + } + if (password) { + Object.defineProperty(proxy, 'password', { + value: password, + enumerable: false + }); + } + return { lookup, proxy }; +} +/** + * The `SocksProxyAgent`. + * + * @api public + */ +class SocksProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new TypeError('a SOCKS proxy server `host` and `port` must be specified!'); + } + super(opts); + const parsedProxy = parseSocksProxy(opts); + this.lookup = parsedProxy.lookup; + this.proxy = parsedProxy.proxy; + } + /** + * Initiates a SOCKS connection to the specified SOCKS proxy server, + * which in turn connects to the specified remote host and port. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { lookup, proxy } = this; + let { host, port } = opts; + if (!host) { + throw new Error('No `host` defined!'); + } + if (lookup) { + // Client-side DNS resolution for "4" and "5" socks proxy versions. + host = yield dnsLookup(host); + } + const socksOpts = { + proxy, + destination: { host, port }, + command: 'connect' + }; + debug('Creating socks proxy connection: %o', socksOpts); + const { socket } = yield socks_1.SocksClient.createConnection(socksOpts); + debug('Successfully created socks proxy connection'); + if (opts.secureEndpoint) { + const servername = opts.servername || opts.host; + if (!servername) { + throw new Error('Could not determine "servername"'); + } + // The proxy is connecting to a TLS server, so upgrade + // this socket connection to a TLS connection. + debug('Upgrading socket connection to TLS'); + return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, + servername })); + } + return socket; + }); + } +} +exports.default = SocksProxyAgent; +function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; +} +//# sourceMappingURL=agent.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.js.map b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.js.map new file mode 100644 index 000000000..033d913ea --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/agent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,8CAAsB;AACtB,8CAAsB;AACtB,kDAAgC;AAChC,2CAAkE;AAClE,iCAAoE;AAGpE,MAAM,KAAK,GAAG,eAAW,CAAC,mBAAmB,CAAC,CAAC;AAE/C,SAAS,SAAS,CAAC,IAAY;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,aAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC7B,IAAI,GAAG,EAAE;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;aACZ;iBAAM;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;aACb;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACvB,IAA4B;IAE5B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,IAAI,GAAuB,CAAC,CAAC;IAEjC,0DAA0D;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC;IACxC,IAAI,CAAC,IAAI,EAAE;QACV,MAAM,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC;KACjC;IAED,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;QAClC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;KACjB;SAAM,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzC,IAAI,GAAG,QAA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/dist/index.d.ts b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.d.ts new file mode 100644 index 000000000..eb92e04ff --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.d.ts @@ -0,0 +1,18 @@ +/// <reference types="node" /> +import { Url } from 'url'; +import { SocksProxy } from 'socks'; +import { AgentOptions } from 'agent-base'; +import _SocksProxyAgent from './agent'; +declare function createSocksProxyAgent(opts: string | createSocksProxyAgent.SocksProxyAgentOptions): _SocksProxyAgent; +declare namespace createSocksProxyAgent { + interface BaseSocksProxyAgentOptions { + host?: string | null; + port?: string | number | null; + } + export interface SocksProxyAgentOptions extends AgentOptions, BaseSocksProxyAgentOptions, Partial<Omit<Url & SocksProxy, keyof BaseSocksProxyAgentOptions>> { + } + export type SocksProxyAgent = _SocksProxyAgent; + export const SocksProxyAgent: typeof _SocksProxyAgent; + export {}; +} +export = createSocksProxyAgent; diff --git a/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.js b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.js new file mode 100644 index 000000000..dd1e49a77 --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.js @@ -0,0 +1,14 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(require("./agent")); +function createSocksProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createSocksProxyAgent) { + createSocksProxyAgent.SocksProxyAgent = agent_1.default; + createSocksProxyAgent.prototype = agent_1.default.prototype; +})(createSocksProxyAgent || (createSocksProxyAgent = {})); +module.exports = createSocksProxyAgent; +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.js.map b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.js.map new file mode 100644 index 000000000..074fe255c --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAGA,oDAAuC;AAEvC,SAAS,qBAAqB,CAC7B,IAA2D;IAE3D,OAAO,IAAI,eAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,WAAU,qBAAqB;IAYjB,qCAAe,GAAG,eAAgB,CAAC;IAEhD,qBAAqB,CAAC,SAAS,GAAG,eAAgB,CAAC,SAAS,CAAC;AAC9D,CAAC,EAfS,qBAAqB,KAArB,qBAAqB,QAe9B;AAED,iBAAS,qBAAqB,CAAC"}
\ No newline at end of file diff --git a/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/package.json b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/package.json new file mode 100644 index 000000000..1ad95375e --- /dev/null +++ b/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent/package.json @@ -0,0 +1,94 @@ +{ + "_from": "socks-proxy-agent@^5.0.0", + "_id": "socks-proxy-agent@5.0.0", + "_inBundle": false, + "_integrity": "sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA==", + "_location": "/npm-registry-fetch/socks-proxy-agent", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "socks-proxy-agent@^5.0.0", + "name": "socks-proxy-agent", + "escapedName": "socks-proxy-agent", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/npm-registry-fetch/make-fetch-happen" + ], + "_resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.0.tgz", + "_shasum": "7c0f364e7b1cf4a7a437e71253bed72e9004be60", + "_spec": "socks-proxy-agent@^5.0.0", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/npm-registry-fetch/node_modules/make-fetch-happen", + "author": { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io/" + }, + "bugs": { + "url": "https://github.com/TooTallNate/node-socks-proxy-agent/issues" + }, + "bundleDependencies": false, + "dependencies": { + "agent-base": "6", + "debug": "4", + "socks": "^2.3.3" + }, + "deprecated": false, + "description": "A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS", + "devDependencies": { + "@types/debug": "4", + "@types/node": "^12.12.11", + "@typescript-eslint/eslint-plugin": "1.6.0", + "@typescript-eslint/parser": "1.1.0", + "eslint": "5.16.0", + "eslint-config-airbnb": "17.1.0", + "eslint-config-prettier": "4.1.0", + "eslint-import-resolver-typescript": "1.1.1", + "eslint-plugin-import": "2.16.0", + "eslint-plugin-jsx-a11y": "6.2.1", + "eslint-plugin-react": "7.12.4", + "mocha": "^6.2.2", + "proxy": "1", + "raw-body": "^2.3.2", + "rimraf": "^3.0.0", + "socksv5": "github:TooTallNate/socksv5#fix/dstSock-close-event", + "typescript": "^3.5.3" + }, + "engines": { + "node": ">= 6" + }, + "files": [ + "dist" + ], + "homepage": "https://github.com/TooTallNate/node-socks-proxy-agent#readme", + "keywords": [ + "socks", + "socks4", + "socks4a", + "socks5", + "socks5h", + "proxy", + "http", + "https", + "agent" + ], + "license": "MIT", + "main": "dist/index", + "name": "socks-proxy-agent", + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/node-socks-proxy-agent.git" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist", + "prepublishOnly": "npm run build", + "test": "mocha --reporter spec", + "test-lint": "eslint src --ext .js,.ts" + }, + "typings": "dist/index", + "version": "5.0.0" +} diff --git a/node_modules/npm-registry-fetch/package.json b/node_modules/npm-registry-fetch/package.json index ece80c6e3..5f7c99b6f 100644 --- a/node_modules/npm-registry-fetch/package.json +++ b/node_modules/npm-registry-fetch/package.json @@ -1,10 +1,11 @@ { - "_from": "npm-registry-fetch@7.0.0", - "_id": "npm-registry-fetch@7.0.0", + "_from": "npm-registry-fetch@8", + "_id": "npm-registry-fetch@8.0.0", "_inBundle": false, - "_integrity": "sha512-XABSG02i/03EfnXM8azGksxICQO8g5MSiaxIUBsNTLXnQLBcdQNS67aOZsF5Yn97RV9o9g+fBUUN2Sg8u7iCBw==", + "_integrity": "sha512-975WwLvZjX97y9UWWQ8nAyr7bw02s9xKPHqvEm5T900LQsB1HXb8Gb9ebYtCBLSX+K8gSOrO5KS/9yV/naLZmQ==", "_location": "/npm-registry-fetch", "_phantomChildren": { + "@tootallnate/once": "1.0.0", "cacache": "15.0.0", "depd": "1.1.2", "humanize-ms": "1.2.1", @@ -17,27 +18,26 @@ "minipass-pipeline": "1.2.2", "ms": "2.1.1", "promise-retry": "1.1.1", - "socks-proxy-agent": "4.0.2", + "socks": "2.3.3", "ssri": "8.0.0" }, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "npm-registry-fetch@7.0.0", + "raw": "npm-registry-fetch@8", "name": "npm-registry-fetch", "escapedName": "npm-registry-fetch", - "rawSpec": "7.0.0", + "rawSpec": "8", "saveSpec": null, - "fetchSpec": "7.0.0" + "fetchSpec": "8" }, "_requiredBy": [ "#USER", - "/", - "/pacote" + "/" ], - "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-7.0.0.tgz", - "_shasum": "314529aa2818a379947912c26d41b42942e40b9f", - "_spec": "npm-registry-fetch@7.0.0", + "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-8.0.0.tgz", + "_shasum": "65bb51dd2b9634b8363019aac9c76c003e5c5eaf", + "_spec": "npm-registry-fetch@8", "_where": "/Users/isaacs/dev/npm/cli", "author": { "name": "Kat Marchán", @@ -50,7 +50,7 @@ "dependencies": { "@npmcli/ci-detect": "^1.0.0", "lru-cache": "^5.1.1", - "make-fetch-happen": "^8.0.1", + "make-fetch-happen": "^8.0.2", "minipass": "^3.0.0", "minipass-fetch": "^1.1.2", "minipass-json-stream": "^1.0.1", @@ -103,5 +103,5 @@ "check-coverage": true, "test-ignore": "test[\\\\/](util|cache)[\\\\/]" }, - "version": "7.0.0" + "version": "8.0.0" } diff --git a/node_modules/pacote/README.md b/node_modules/pacote/README.md index 96f1c16c7..49dbde6a9 100644 --- a/node_modules/pacote/README.md +++ b/node_modules/pacote/README.md @@ -113,6 +113,14 @@ See below for valid `opts` values. ### Options +Options are passed to +[`npm-registry-fetch`](http://npm.im/npm-registry-fetch) and +[`cacache`](http://npm.im/cacache), so in addition to these, anything for +those modules can be given to pacote as well. + +Options object is cloned, and mutated along the way to add integrity, +resolved, and other properties, as they are determined. + * `cache` Where to store cache entries and temp files. Passed to [`cacache`](http://npm.im/cacache). Defaults to the same cache directory that npm will use by default, based on platform and environment. @@ -140,6 +148,10 @@ See below for valid `opts` values. packument. Defaults to `latest`. * `registry` The npm registry to use by default. Defaults to `https://registry.npmjs.org/`. +* `fullMetadata` Fetch the full metadata from the registry for packuments, + including information not strictly required for installation (author, + description, etc.) Defaults to `true` when `before` is set, since the + version publish time is part of the extended packument metadata. ## Extracted File Modes diff --git a/node_modules/pacote/lib/fetcher.js b/node_modules/pacote/lib/fetcher.js index 2901fd583..59e5c6de5 100644 --- a/node_modules/pacote/lib/fetcher.js +++ b/node_modules/pacote/lib/fetcher.js @@ -79,13 +79,13 @@ class FetcherBase { this.umask = opts.umask || 0o022 this.log = opts.log || procLog - this.preferOnline = !!opts.preferOnline || !!opts['prefer-online'] - this.preferOffline = !!opts.preferOffline || !!opts['prefer-offline'] + this.preferOnline = !!opts.preferOnline + this.preferOffline = !!opts.preferOffline this.offline = !!opts.offline - this.before = opts.before || opts['enjoy-by'] || opts.before - this.fullMetadata = this.before ? true - : (opts.fullMetadata || opts['full-metadata']) + this.before = opts.before + this.fullMetadata = this.before ? true : !!opts.fullMetadata + this.defaultTag = opts.defaultTag || 'latest' this.registry = opts.registry || 'https://registry.npmjs.org' diff --git a/node_modules/pacote/lib/registry.js b/node_modules/pacote/lib/registry.js index 30dd682dd..b9df03614 100644 --- a/node_modules/pacote/lib/registry.js +++ b/node_modules/pacote/lib/registry.js @@ -20,9 +20,6 @@ class RegistryFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) - // try to use corgis if available - this.fullMetadata = !!opts.fullMetadata - // handle case when npm-package-arg guesses wrong. if (this.spec.type === 'tag' && this.spec.rawSpec === '' && @@ -57,7 +54,7 @@ class RegistryFetcher extends Fetcher { [_headers] () { return { // npm will override UA, but ensure that we always send *something* - 'user-agent': this.opts['user-agent'] || + 'user-agent': this.opts.userAgent || `pacote/${pacoteVersion} node/${process.version}`, ...(this.opts.headers || {}), 'pacote-version': pacoteVersion, diff --git a/node_modules/pacote/lib/remote.js b/node_modules/pacote/lib/remote.js index b9cf639b2..81f14efbc 100644 --- a/node_modules/pacote/lib/remote.js +++ b/node_modules/pacote/lib/remote.js @@ -43,7 +43,7 @@ class RemoteFetcher extends Fetcher { [_headers] () { return { // npm will override this, but ensure that we always send *something* - 'user-agent': this.opts['user-agent'] || + 'user-agent': this.opts.userAgent || `pacote/${pacoteVersion} node/${process.version}`, ...(this.opts.headers || {}), 'pacote-version': pacoteVersion, @@ -51,6 +51,7 @@ class RemoteFetcher extends Fetcher { 'pacote-pkg-id': this.pkgid, ...(this.integrity ? { 'pacote-integrity': String(this.integrity) } : {}), + ...(this.opts.headers || {}), } } diff --git a/node_modules/pacote/lib/util/git/spawn.js b/node_modules/pacote/lib/util/git/spawn.js index 696963be7..95f5b0cd2 100644 --- a/node_modules/pacote/lib/util/git/spawn.js +++ b/node_modules/pacote/lib/util/git/spawn.js @@ -26,9 +26,9 @@ module.exports = (gitArgs, gitOpts, opts = {}) => { }) .then(({stdout}) => stdout) }, opts.retry !== null && opts.retry !== undefined ? opts.retry : { - retries: opts['fetch-retries'] || 2, - factor: opts['fetch-retry-factor'] || 10, - maxTimeout: opts['fetch-retry-maxtimeout'] || 60000, - minTimeout: opts['fetch-retry-mintimeout'] || 1000, + retries: opts.fetchRetries || 2, + factor: opts.fetchRetryFactor || 10, + maxTimeout: opts.fetchRetryMaxtimeout || 60000, + minTimeout: opts.fetchRetryMintimeout || 1000, }) } diff --git a/node_modules/pacote/node_modules/chownr/LICENSE b/node_modules/pacote/node_modules/chownr/LICENSE new file mode 100644 index 000000000..19129e315 --- /dev/null +++ b/node_modules/pacote/node_modules/chownr/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/pacote/node_modules/chownr/README.md b/node_modules/pacote/node_modules/chownr/README.md new file mode 100644 index 000000000..70e9a54a3 --- /dev/null +++ b/node_modules/pacote/node_modules/chownr/README.md @@ -0,0 +1,3 @@ +Like `chown -R`. + +Takes the same arguments as `fs.chown()` diff --git a/node_modules/pacote/node_modules/chownr/chownr.js b/node_modules/pacote/node_modules/chownr/chownr.js new file mode 100644 index 000000000..0d4093216 --- /dev/null +++ b/node_modules/pacote/node_modules/chownr/chownr.js @@ -0,0 +1,167 @@ +'use strict' +const fs = require('fs') +const path = require('path') + +/* istanbul ignore next */ +const LCHOWN = fs.lchown ? 'lchown' : 'chown' +/* istanbul ignore next */ +const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync' + +/* istanbul ignore next */ +const needEISDIRHandled = fs.lchown && + !process.version.match(/v1[1-9]+\./) && + !process.version.match(/v10\.[6-9]/) + +const lchownSync = (path, uid, gid) => { + try { + return fs[LCHOWNSYNC](path, uid, gid) + } catch (er) { + if (er.code !== 'ENOENT') + throw er + } +} + +/* istanbul ignore next */ +const chownSync = (path, uid, gid) => { + try { + return fs.chownSync(path, uid, gid) + } catch (er) { + if (er.code !== 'ENOENT') + throw er + } +} + +/* istanbul ignore next */ +const handleEISDIR = + needEISDIRHandled ? (path, uid, gid, cb) => er => { + // Node prior to v10 had a very questionable implementation of + // fs.lchown, which would always try to call fs.open on a directory + // Fall back to fs.chown in those cases. + if (!er || er.code !== 'EISDIR') + cb(er) + else + fs.chown(path, uid, gid, cb) + } + : (_, __, ___, cb) => cb + +/* istanbul ignore next */ +const handleEISDirSync = + needEISDIRHandled ? (path, uid, gid) => { + try { + return lchownSync(path, uid, gid) + } catch (er) { + if (er.code !== 'EISDIR') + throw er + chownSync(path, uid, gid) + } + } + : (path, uid, gid) => lchownSync(path, uid, gid) + +// fs.readdir could only accept an options object as of node v6 +const nodeVersion = process.version +let readdir = (path, options, cb) => fs.readdir(path, options, cb) +let readdirSync = (path, options) => fs.readdirSync(path, options) +/* istanbul ignore next */ +if (/^v4\./.test(nodeVersion)) + readdir = (path, options, cb) => fs.readdir(path, cb) + +const chown = (cpath, uid, gid, cb) => { + fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => { + // Skip ENOENT error + cb(er && er.code !== 'ENOENT' ? er : null) + })) +} + +const chownrKid = (p, child, uid, gid, cb) => { + if (typeof child === 'string') + return fs.lstat(path.resolve(p, child), (er, stats) => { + // Skip ENOENT error + if (er) + return cb(er.code !== 'ENOENT' ? er : null) + stats.name = child + chownrKid(p, stats, uid, gid, cb) + }) + + if (child.isDirectory()) { + chownr(path.resolve(p, child.name), uid, gid, er => { + if (er) + return cb(er) + const cpath = path.resolve(p, child.name) + chown(cpath, uid, gid, cb) + }) + } else { + const cpath = path.resolve(p, child.name) + chown(cpath, uid, gid, cb) + } +} + + +const chownr = (p, uid, gid, cb) => { + readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er) { + if (er.code === 'ENOENT') + return cb() + else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er) + } + if (er || !children.length) + return chown(p, uid, gid, cb) + + let len = children.length + let errState = null + const then = er => { + if (errState) + return + if (er) + return cb(errState = er) + if (-- len === 0) + return chown(p, uid, gid, cb) + } + + children.forEach(child => chownrKid(p, child, uid, gid, then)) + }) +} + +const chownrKidSync = (p, child, uid, gid) => { + if (typeof child === 'string') { + try { + const stats = fs.lstatSync(path.resolve(p, child)) + stats.name = child + child = stats + } catch (er) { + if (er.code === 'ENOENT') + return + else + throw er + } + } + + if (child.isDirectory()) + chownrSync(path.resolve(p, child.name), uid, gid) + + handleEISDirSync(path.resolve(p, child.name), uid, gid) +} + +const chownrSync = (p, uid, gid) => { + let children + try { + children = readdirSync(p, { withFileTypes: true }) + } catch (er) { + if (er.code === 'ENOENT') + return + else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP') + return handleEISDirSync(p, uid, gid) + else + throw er + } + + if (children && children.length) + children.forEach(child => chownrKidSync(p, child, uid, gid)) + + return handleEISDirSync(p, uid, gid) +} + +module.exports = chownr +chownr.sync = chownrSync diff --git a/node_modules/pacote/node_modules/chownr/package.json b/node_modules/pacote/node_modules/chownr/package.json new file mode 100644 index 000000000..0317b2b2c --- /dev/null +++ b/node_modules/pacote/node_modules/chownr/package.json @@ -0,0 +1,62 @@ +{ + "_from": "chownr@^1.1.4", + "_id": "chownr@1.1.4", + "_inBundle": false, + "_integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "_location": "/pacote/chownr", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "chownr@^1.1.4", + "name": "chownr", + "escapedName": "chownr", + "rawSpec": "^1.1.4", + "saveSpec": null, + "fetchSpec": "^1.1.4" + }, + "_requiredBy": [ + "/pacote" + ], + "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "_shasum": "6fc9d7b42d32a583596337666e7d08084da2cc6b", + "_spec": "chownr@^1.1.4", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/pacote", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/chownr/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "like `chown -R`", + "devDependencies": { + "mkdirp": "0.3", + "rimraf": "^2.7.1", + "tap": "^14.10.6" + }, + "files": [ + "chownr.js" + ], + "homepage": "https://github.com/isaacs/chownr#readme", + "license": "ISC", + "main": "chownr.js", + "name": "chownr", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/chownr.git" + }, + "scripts": { + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "preversion": "npm test", + "test": "tap" + }, + "tap": { + "check-coverage": true + }, + "version": "1.1.4" +} diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index 9be48164e..619c82e37 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,28 +1,28 @@ { - "_from": "pacote@latest", - "_id": "pacote@11.0.0", + "_from": "pacote@11.1", + "_id": "pacote@11.1.0", "_inBundle": false, - "_integrity": "sha512-Q8H9lfzlZTZyWWtYNGETtFp2qmzd9XHfuF3gas5xd8T6vf/6E7BOmhybWU2PxSVeSYjIw4hLpaf7hCqY+T2TbQ==", + "_integrity": "sha512-JcMmHiK6h6rcncj2HLayiyJZg28iJXJafXcmEGw2NjKH3WE8ZgSwyMZs7+f+aliPD57PDhB31IEgUtLXp0YZxA==", "_location": "/pacote", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "range", "registry": true, - "raw": "pacote@latest", + "raw": "pacote@11.1", "name": "pacote", "escapedName": "pacote", - "rawSpec": "latest", + "rawSpec": "11.1", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "11.1" }, "_requiredBy": [ "#USER", "/", "/@npmcli/arborist" ], - "_resolved": "https://registry.npmjs.org/pacote/-/pacote-11.0.0.tgz", - "_shasum": "b9c4fc7bcdeaee00a14167e669d26e9e716be8eb", - "_spec": "pacote@latest", + "_resolved": "https://registry.npmjs.org/pacote/-/pacote-11.1.0.tgz", + "_shasum": "2285e37594c42588436549148a941ca6e282d425", + "_spec": "pacote@11.1", "_where": "/Users/isaacs/dev/npm/cli", "author": { "name": "Isaac Z. Schlueter", @@ -39,7 +39,7 @@ "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", "cacache": "^15.0.0", - "chownr": "^1.1.3", + "chownr": "^1.1.4", "fs-minipass": "^2.1.0", "infer-owner": "^1.0.4", "lru-cache": "^5.1.1", @@ -47,16 +47,16 @@ "minipass-fetch": "^1.2.1", "mkdirp": "^1.0.3", "npm-package-arg": "^8.0.0", - "npm-packlist": "^2.0.3", + "npm-packlist": "^2.1.0", "npm-pick-manifest": "^6.0.0", - "npm-registry-fetch": "^7.0.0", + "npm-registry-fetch": "^8.0.0", "osenv": "^0.1.5", "promise-inflight": "^1.0.1", "promise-retry": "^1.1.1", "read-package-json-fast": "^1.1.3", - "semver": "^7.1.1", + "semver": "^7.1.3", "ssri": "^8.0.0", - "tar": "^6.0.0", + "tar": "^6.0.1", "which": "^2.0.2" }, "deprecated": false, @@ -99,5 +99,5 @@ "coverage-map": "map.js", "esm": false }, - "version": "11.0.0" + "version": "11.1.0" } diff --git a/package-lock.json b/package-lock.json index de6aba3d7..37aff9aae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -173,18 +173,18 @@ "dev": true }, "@npmcli/arborist": { - "version": "0.0.0-pre.9", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.9.tgz", - "integrity": "sha512-P9iWMYo5ePQoOiiSf5xu+IvahV/FQ7Vtw/bmGGQG3BWk9d+tEWmReBsRGp/ENxGIA+PV+SY12qHVO1YsBGNPNg==", + "version": "0.0.0-pre.11", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.0-pre.11.tgz", + "integrity": "sha512-d75SHZi+fybiPH3juQ9VhZEexhVsom3vGl0pN0cbLHAHd/N5tSqgIKJ/YXjN96G24pMLI9wfpkFAIrnPkfv/6w==", "requires": { "@npmcli/installed-package-contents": "^1.0.5", "@npmcli/run-script": "^1.2.1", - "bin-links": "^2.0.0", + "bin-links": "^2.1.2", "json-stringify-nice": "^1.1.1", "mkdirp-infer-owner": "^1.0.2", "npm-install-checks": "^4.0.0", "npm-package-arg": "^8.0.0", - "pacote": "^11.0.0", + "pacote": "^11.1.0", "parse-conflict-json": "^1.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", @@ -195,9 +195,9 @@ }, "dependencies": { "bin-links": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.0.0.tgz", - "integrity": "sha512-VvBk9YwChMjdn9rs1c9Yt0vRwbZ0SgDBsb9pT07DAmFvuTlxqAuazKtIa4be+6ChBGI+io8gYjT+vq586foYaw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.1.2.tgz", + "integrity": "sha512-mtspzc/umzMiZkIRIVm93WgyT7fFVXX302qswWwlHErBVM8BgAVvB0EVOdzmtrNzs1zIKEE0dE4RR5PwtBfy7g==", "requires": { "cmd-shim": "^4.0.1", "mkdirp": "^1.0.3", @@ -347,6 +347,11 @@ } } }, + "@tootallnate/once": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz", + "integrity": "sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA==" + }, "@types/caseless": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz", @@ -4970,16 +4975,6 @@ "osenv": "^0.1.5", "semver": "^7.0.0", "validate-npm-package-name": "^3.0.0" - }, - "dependencies": { - "hosted-git-info": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.2.tgz", - "integrity": "sha512-ezZMWtHXm7Eb7Rq4Mwnx2vs79WUx2QmRg3+ZqeGroKzfDO+EprOcgRPYghsOP9JuYBfK18VojmRTGCg8Ma+ktw==", - "requires": { - "lru-cache": "^5.1.1" - } - } } }, "npm-packlist": { @@ -5104,13 +5099,13 @@ } }, "npm-registry-fetch": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-7.0.0.tgz", - "integrity": "sha512-XABSG02i/03EfnXM8azGksxICQO8g5MSiaxIUBsNTLXnQLBcdQNS67aOZsF5Yn97RV9o9g+fBUUN2Sg8u7iCBw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-8.0.0.tgz", + "integrity": "sha512-975WwLvZjX97y9UWWQ8nAyr7bw02s9xKPHqvEm5T900LQsB1HXb8Gb9ebYtCBLSX+K8gSOrO5KS/9yV/naLZmQ==", "requires": { "@npmcli/ci-detect": "^1.0.0", "lru-cache": "^5.1.1", - "make-fetch-happen": "^8.0.1", + "make-fetch-happen": "^8.0.2", "minipass": "^3.0.0", "minipass-fetch": "^1.1.2", "minipass-json-stream": "^1.0.1", @@ -5119,9 +5114,12 @@ }, "dependencies": { "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", + "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==", + "requires": { + "debug": "4" + } }, "agentkeepalive": { "version": "4.1.0", @@ -5147,33 +5145,34 @@ "integrity": "sha512-Z2EICWNJou7Tr9Bd2M2UqDJq3A9F2ePG9w3lIpjoyuSyXFP9QbniJVu3XQYytuw5ebmG7dXSXO9PgAjJG8DDKA==" }, "http-proxy-agent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-3.0.0.tgz", - "integrity": "sha512-uGuJaBWQWDQCJI5ip0d/VTYZW0nRrlLWXA4A7P1jrsa+f77rW2yXz315oBt6zGCF6l8C2tlMxY7ffULCj+5FhA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", "requires": { - "agent-base": "5", + "@tootallnate/once": "1", + "agent-base": "6", "debug": "4" } }, "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", "requires": { - "agent-base": "5", + "agent-base": "6", "debug": "4" } }, "make-fetch-happen": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-8.0.1.tgz", - "integrity": "sha512-oiK8xz6+IxaPqmOCW+rmlH922RTZ+fi4TAULGRih8ryqIju0x6WriDR3smm7Z+8NZRxDIK/iDLM096F/gLfiWg==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-8.0.2.tgz", + "integrity": "sha512-jRqI9zjLyz8ufXfLSbEObJ6a8sv8geeKYEPFpI+b39JjYU14MZtCiJGazSWPZMjCm7161b4r57N/na5fBXpooQ==", "requires": { "agentkeepalive": "^4.1.0", "cacache": "^15.0.0", "http-cache-semantics": "^4.0.4", - "http-proxy-agent": "^3.0.0", - "https-proxy-agent": "^4.0.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", "lru-cache": "^5.1.1", "minipass": "^3.0.0", @@ -5182,9 +5181,19 @@ "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.2", "promise-retry": "^1.1.1", - "socks-proxy-agent": "^4.0.0", + "socks-proxy-agent": "^5.0.0", "ssri": "^8.0.0" } + }, + "socks-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.0.tgz", + "integrity": "sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA==", + "requires": { + "agent-base": "6", + "debug": "4", + "socks": "^2.3.3" + } } } }, @@ -5692,13 +5701,13 @@ } }, "pacote": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.0.0.tgz", - "integrity": "sha512-Q8H9lfzlZTZyWWtYNGETtFp2qmzd9XHfuF3gas5xd8T6vf/6E7BOmhybWU2PxSVeSYjIw4hLpaf7hCqY+T2TbQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.1.0.tgz", + "integrity": "sha512-JcMmHiK6h6rcncj2HLayiyJZg28iJXJafXcmEGw2NjKH3WE8ZgSwyMZs7+f+aliPD57PDhB31IEgUtLXp0YZxA==", "requires": { "@npmcli/installed-package-contents": "^1.0.5", "cacache": "^15.0.0", - "chownr": "^1.1.3", + "chownr": "^1.1.4", "fs-minipass": "^2.1.0", "infer-owner": "^1.0.4", "lru-cache": "^5.1.1", @@ -5706,19 +5715,24 @@ "minipass-fetch": "^1.2.1", "mkdirp": "^1.0.3", "npm-package-arg": "^8.0.0", - "npm-packlist": "^2.0.3", + "npm-packlist": "^2.1.0", "npm-pick-manifest": "^6.0.0", - "npm-registry-fetch": "^7.0.0", + "npm-registry-fetch": "^8.0.0", "osenv": "^0.1.5", "promise-inflight": "^1.0.1", "promise-retry": "^1.1.1", "read-package-json-fast": "^1.1.3", - "semver": "^7.1.1", + "semver": "^7.1.3", "ssri": "^8.0.0", - "tar": "^6.0.0", + "tar": "^6.0.1", "which": "^2.0.2" }, "dependencies": { + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, "mkdirp": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", diff --git a/package.json b/package.json index 7c01dab4c..8d7c9439c 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "npx": "./bin/npx-cli.js" }, "dependencies": { - "@npmcli/arborist": "0.0.0-pre.9", + "@npmcli/arborist": "0.0.0-pre.11", "JSONStream": "^1.3.5", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", @@ -105,13 +105,13 @@ "npm-packlist": "^2.1.0", "npm-pick-manifest": "^6.0.0", "npm-profile": "^4.0.2", - "npm-registry-fetch": "^7.0.0", + "npm-registry-fetch": "^8.0.0", "npm-user-validate": "~1.0.0", "npmlog": "~4.1.2", "once": "~1.4.0", "opener": "^1.5.1", "osenv": "^0.1.5", - "pacote": "^11.0.0", + "pacote": "^11.1.0", "path-is-inside": "~1.0.2", "promise-inflight": "~1.0.1", "qrcode-terminal": "^0.12.0", |