Replace lodash.pullAll and lodash.union

This commit is contained in:
Peter Hedenskog 2025-01-07 18:36:02 +01:00
parent 25c4aa2995
commit dc458b0eb4
3 changed files with 5 additions and 18 deletions

View File

@ -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(', '));
}

12
npm-shrinkwrap.json generated
View File

@ -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",

View File

@ -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",