lighthouse 12.2.1-dev.20241010 → 12.2.1-dev.20241011
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/test/smokehouse/frontends/lib.js +1 -1
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +1 -1
- package/cli/test/smokehouse/report-assert.js +1 -1
- package/core/config/config-helpers.js +3 -3
- package/core/gather/base-artifacts.js +2 -2
- package/core/lib/arbitrary-equality-map.js +2 -2
- package/core/runner.js +4 -4
- package/package.json +3 -3
- package/shared/localization/swap-locale.js +4 -4
|
@@ -16,7 +16,7 @@ import path from 'path';
|
|
|
16
16
|
import fs from 'fs';
|
|
17
17
|
import url from 'url';
|
|
18
18
|
|
|
19
|
-
import cloneDeep from 'lodash
|
|
19
|
+
import {cloneDeep} from 'lodash-es';
|
|
20
20
|
import yargs from 'yargs';
|
|
21
21
|
import * as yargsHelpers from 'yargs/helpers';
|
|
22
22
|
import log from 'lighthouse-logger';
|
|
@@ -8,7 +8,7 @@ import path from 'path';
|
|
|
8
8
|
import {createRequire} from 'module';
|
|
9
9
|
import url from 'url';
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import {isEqual} from 'lodash-es';
|
|
12
12
|
|
|
13
13
|
import * as constants from './constants.js';
|
|
14
14
|
import ConfigPlugin from './config-plugin.js';
|
|
@@ -69,7 +69,7 @@ const mergeOptionsOfItems = function(items) {
|
|
|
69
69
|
* - `null` is treated similarly to `undefined` for whether a value should be overridden.
|
|
70
70
|
* - `overwriteArrays` controls array extension behavior:
|
|
71
71
|
* - true: Arrays are overwritten without any merging or concatenation.
|
|
72
|
-
* - false: Arrays are concatenated and de-duped by
|
|
72
|
+
* - false: Arrays are concatenated and de-duped by isEqual.
|
|
73
73
|
* - Objects are recursively merged.
|
|
74
74
|
* - If the `settings` key is encountered while traversing an object, its arrays are *always*
|
|
75
75
|
* overridden, not concatenated. (`overwriteArrays` is flipped to `true`)
|
|
@@ -90,7 +90,7 @@ function _mergeConfigFragment(base, extension, overwriteArrays = false) {
|
|
|
90
90
|
if (!Array.isArray(base)) throw new TypeError(`Expected array but got ${typeof base}`);
|
|
91
91
|
const merged = base.slice();
|
|
92
92
|
extension.forEach(item => {
|
|
93
|
-
if (!merged.some(candidate =>
|
|
93
|
+
if (!merged.some(candidate => isEqual(candidate, item))) merged.push(item);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
return merged;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import log from 'lighthouse-logger';
|
|
8
|
-
import
|
|
8
|
+
import {isEqual} from 'lodash-es';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
getBrowserVersion, getBenchmarkIndex, getEnvironmentWarnings,
|
|
@@ -52,7 +52,7 @@ function deduplicateWarnings(warnings) {
|
|
|
52
52
|
const unique = [];
|
|
53
53
|
|
|
54
54
|
for (const warning of warnings) {
|
|
55
|
-
if (unique.some(existing =>
|
|
55
|
+
if (unique.some(existing => isEqual(warning, existing))) continue;
|
|
56
56
|
unique.push(warning);
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import {isEqual} from 'lodash-es';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @fileoverview This class is designed to allow maps with arbitrary equality functions.
|
|
@@ -73,7 +73,7 @@ class ArbitraryEqualityMap {
|
|
|
73
73
|
* @return {boolean}
|
|
74
74
|
*/
|
|
75
75
|
static deepEquals(objA, objB) {
|
|
76
|
-
return
|
|
76
|
+
return isEqual(objA, objB);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
package/core/runner.js
CHANGED
|
@@ -9,7 +9,7 @@ import path from 'path';
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
import log from 'lighthouse-logger';
|
|
12
|
-
import
|
|
12
|
+
import {isEqual} from 'lodash-es';
|
|
13
13
|
|
|
14
14
|
import {ReportScoring} from './scoring.js';
|
|
15
15
|
import {Audit} from './audits/audit.js';
|
|
@@ -308,7 +308,7 @@ class Runner {
|
|
|
308
308
|
...Object.keys(normalizedAuditSettings),
|
|
309
309
|
]);
|
|
310
310
|
for (const k of keys) {
|
|
311
|
-
if (!
|
|
311
|
+
if (!isEqual(normalizedGatherSettings[k], normalizedAuditSettings[k])) {
|
|
312
312
|
throw new Error(
|
|
313
313
|
`Cannot change settings between gathering and auditing…
|
|
314
314
|
Difference found at: \`${k}\`
|
|
@@ -318,8 +318,8 @@ vs
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
// Call `
|
|
322
|
-
if (!
|
|
321
|
+
// Call `isEqual` on the entire thing, just in case something was missed.
|
|
322
|
+
if (!isEqual(normalizedGatherSettings, normalizedAuditSettings)) {
|
|
323
323
|
throw new Error('Cannot change settings between gathering and auditing');
|
|
324
324
|
}
|
|
325
325
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "12.2.1-dev.
|
|
4
|
+
"version": "12.2.1-dev.20241011",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"@types/google.analytics": "0.0.39",
|
|
118
118
|
"@types/jpeg-js": "^0.3.7",
|
|
119
119
|
"@types/jsdom": "^16.2.13",
|
|
120
|
-
"@types/lodash": "^4.
|
|
120
|
+
"@types/lodash-es": "^4.17.12",
|
|
121
121
|
"@types/mocha": "^9.0.0",
|
|
122
122
|
"@types/node": "*",
|
|
123
123
|
"@types/pako": "^1.0.1",
|
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
"js-library-detector": "^6.7.0",
|
|
196
196
|
"lighthouse-logger": "^2.0.1",
|
|
197
197
|
"lighthouse-stack-packs": "1.12.1",
|
|
198
|
-
"lodash": "^4.17.21",
|
|
198
|
+
"lodash-es": "^4.17.21",
|
|
199
199
|
"lookup-closest-locale": "6.2.0",
|
|
200
200
|
"metaviewport-parser": "0.3.0",
|
|
201
201
|
"open": "^8.4.0",
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import {set} from 'lodash-es';
|
|
8
|
+
import {get} from 'lodash-es';
|
|
9
9
|
|
|
10
10
|
import * as format from './format.js';
|
|
11
11
|
|
|
@@ -72,7 +72,7 @@ function swapLocale(lhr, requestedLocale) {
|
|
|
72
72
|
|
|
73
73
|
// If the path isn't valid or the value isn't a string, there's no point in trying to replace it.
|
|
74
74
|
/** @type {unknown} */
|
|
75
|
-
const originalString =
|
|
75
|
+
const originalString = get(lhr, path);
|
|
76
76
|
if (typeof originalString !== 'string') {
|
|
77
77
|
continue;
|
|
78
78
|
}
|
|
@@ -96,7 +96,7 @@ function swapLocale(lhr, requestedLocale) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// Write string back into the LHR.
|
|
99
|
-
|
|
99
|
+
set(lhr, path, relocalizedString);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|