From dc458b0eb4fa8dd31eb9dff974963d9f7483acc4 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Tue, 7 Jan 2025 18:36:02 +0100 Subject: [PATCH] Replace lodash.pullAll and lodash.union --- lib/sitespeed.js | 9 +++++---- npm-shrinkwrap.json | 12 ------------ package.json | 2 -- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/lib/sitespeed.js b/lib/sitespeed.js index 87aa810ea7..ac629bee0b 100644 --- a/lib/sitespeed.js +++ b/lib/sitespeed.js @@ -7,8 +7,6 @@ import fs from 'node:fs/promises'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc.js'; import { getLogger } from '@sitespeed.io/log'; -import pullAll from 'lodash.pullall'; -import union from 'lodash.union'; import { configure } from './core/logging.js'; import { toArray } from './support/util.js'; @@ -103,8 +101,11 @@ export async function run(options) { // Finalize the plugins that we wanna run // First we add the new ones and then remove, that means remove // always wins - pluginNames = union(pluginNames, toArray(plugins.add)); - pullAll(pluginNames, toArray(plugins.remove)); + pluginNames = [...new Set([...pluginNames, ...toArray(plugins.add)])]; + + const removeSet = new Set(toArray(plugins.remove)); + pluginNames = pluginNames.filter(name => !removeSet.has(name)); + if (plugins.list) { log.info('The following plugins are enabled: %s', pluginNames.join(', ')); } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 214ac740f4..1905b920c9 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -33,10 +33,8 @@ "lodash.isempty": "4.4.0", "lodash.merge": "4.6.2", "lodash.pick": "4.4.0", - "lodash.pullall": "4.2.0", "lodash.reduce": "4.6.0", "lodash.set": "4.3.2", - "lodash.union": "4.6.0", "markdown": "0.5.0", "node-scp": "0.0.23", "ora": "8.0.1", @@ -7120,11 +7118,6 @@ "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", "integrity": "sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==" }, - "node_modules/lodash.pullall": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.pullall/-/lodash.pullall-4.2.0.tgz", - "integrity": "sha1-nZi4UYt8llsPrkCZvZ+334u/OLo=" - }, "node_modules/lodash.reduce": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", @@ -7140,11 +7133,6 @@ "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" }, - "node_modules/lodash.union": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", - "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=" - }, "node_modules/log-symbols": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-6.0.0.tgz", diff --git a/package.json b/package.json index 9732a80e31..01a9dcede4 100644 --- a/package.json +++ b/package.json @@ -104,10 +104,8 @@ "lodash.isempty": "4.4.0", "lodash.merge": "4.6.2", "lodash.pick": "4.4.0", - "lodash.pullall": "4.2.0", "lodash.reduce": "4.6.0", "lodash.set": "4.3.2", - "lodash.union": "4.6.0", "markdown": "0.5.0", "node-scp": "0.0.23", "ora": "8.0.1",