From 43dd49c9782848c25e5b03448c8a0f923f13c158 Mon Sep 17 00:00:00 2001 From: Kat Marchán Date: Tue, 29 Jan 2019 14:43:00 -0800 Subject: deps: upgrade npm to 6.7.0 PR-URL: https://github.com/nodejs/node/pull/25804 Reviewed-By: Myles Borins --- deps/npm/node_modules/libcipm/lib/extract.js | 51 +++++++++++++++++----------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'deps/npm/node_modules/libcipm/lib/extract.js') diff --git a/deps/npm/node_modules/libcipm/lib/extract.js b/deps/npm/node_modules/libcipm/lib/extract.js index 9166ebc058..5681d1ce8c 100644 --- a/deps/npm/node_modules/libcipm/lib/extract.js +++ b/deps/npm/node_modules/libcipm/lib/extract.js @@ -2,45 +2,56 @@ const BB = require('bluebird') -const npa = require('npm-package-arg') -const workerFarm = require('worker-farm') - const extractionWorker = require('./worker.js') +const figgyPudding = require('figgy-pudding') +const npa = require('npm-package-arg') const WORKER_PATH = require.resolve('./worker.js') +let workerFarm + +// Broken for now, cause too many issues on some systems. +const ENABLE_WORKERS = false + +const ExtractOpts = figgyPudding({ + log: {} +}) module.exports = { startWorkers () { - this._workers = workerFarm({ - maxConcurrentCallsPerWorker: 20, - maxRetries: 1 - }, WORKER_PATH) + if (ENABLE_WORKERS) { + if (!workerFarm) { workerFarm = require('worker-farm') } + this._workers = workerFarm({ + maxConcurrentCallsPerWorker: 20, + maxRetries: 1 + }, WORKER_PATH) + } }, stopWorkers () { - workerFarm.end(this._workers) + if (ENABLE_WORKERS) { + if (!workerFarm) { workerFarm = require('worker-farm') } + workerFarm.end(this._workers) + } }, - child (name, child, childPath, config, opts) { + child (name, child, childPath, opts) { + opts = ExtractOpts(opts) const spec = npa.resolve(name, child.version) - const additionalToPacoteOpts = {} - if (typeof opts.dirPacker !== 'undefined') { - additionalToPacoteOpts.dirPacker = opts.dirPacker - } - const childOpts = config.toPacote(Object.assign({ + let childOpts = opts.concat({ integrity: child.integrity, resolved: child.resolved - }, additionalToPacoteOpts)) + }) const args = [spec, childPath, childOpts] return BB.fromNode((cb) => { let launcher = extractionWorker let msg = args const spec = typeof args[0] === 'string' ? npa(args[0]) : args[0] - childOpts.loglevel = opts.log.level - if (spec.registry || spec.type === 'remote') { + if (ENABLE_WORKERS && (spec.registry || spec.type === 'remote')) { + if (!workerFarm) { workerFarm = require('worker-farm') } // We can't serialize these options - childOpts.config = null - childOpts.log = null - childOpts.dirPacker = null + childOpts = childOpts.concat({ + log: null, + dirPacker: null + }) // workers will run things in parallel! launcher = this._workers try { -- cgit v1.2.3