lighthouse 13.6.0-dev.20261111 → 13.6.0-dev.20261116
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/.agents/skills/update-ard-port/SKILL.md +1 -1
- package/cli/bin.js +8 -3
- package/cli/open-file.d.ts +7 -0
- package/cli/open-file.js +48 -0
- package/cli/printer.js +1 -1
- package/cli/run.js +6 -4
- package/cli/sentry-prompt.js +2 -1
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +1 -1
- package/cli/test/smokehouse/lighthouse-runners/cli.js +1 -2
- package/cli/test/smokehouse/report-assert.js +1 -2
- package/cli/test/smokehouse/smokehouse.js +1 -2
- package/core/audits/autocomplete.js +1 -2
- package/core/audits/bootup-time.js +1 -2
- package/core/audits/errors-in-console.js +1 -2
- package/core/audits/mainthread-work-breakdown.js +1 -2
- package/core/audits/metrics.d.ts +2 -2
- package/core/audits/metrics.js +1 -1
- package/core/computed/computed-artifact.js +1 -2
- package/core/computed/entity-classification.d.ts +3 -3
- package/core/computed/entity-classification.js +5 -3
- package/core/computed/js-bundles.js +1 -2
- package/core/computed/load-simulator.d.ts +5 -3
- package/core/computed/load-simulator.js +9 -2
- package/core/computed/metrics/responsiveness.d.ts +5 -3
- package/core/computed/metrics/responsiveness.js +1 -1
- package/core/computed/metrics/time-to-first-byte.js +3 -1
- package/core/computed/metrics/timing-summary.d.ts +7 -5
- package/core/computed/metrics/timing-summary.js +3 -4
- package/core/computed/navigation-insights.d.ts +5 -3
- package/core/computed/navigation-insights.js +1 -1
- package/core/computed/network-analysis.js +1 -2
- package/core/computed/page-dependency-graph.d.ts +5 -3
- package/core/computed/page-dependency-graph.js +1 -1
- package/core/computed/trace-engine-result.d.ts +7 -5
- package/core/computed/trace-engine-result.js +9 -5
- package/core/computed/unused-css.d.ts +2 -2
- package/core/computed/unused-css.js +1 -1
- package/core/config/config.js +1 -2
- package/core/gather/base-artifacts.js +1 -2
- package/core/gather/driver/environment.js +1 -2
- package/core/gather/driver/execution-context.js +2 -0
- package/core/gather/driver/navigation.js +1 -2
- package/core/gather/driver/network-monitor.js +1 -2
- package/core/gather/driver/prepare.js +1 -2
- package/core/gather/driver/storage.js +1 -2
- package/core/gather/driver/target-manager.js +1 -2
- package/core/gather/driver/wait-for-condition.js +6 -5
- package/core/gather/driver.js +1 -2
- package/core/gather/gatherers/agentic/ard.js +1 -1
- package/core/gather/gatherers/agentic/llms-txt.js +1 -2
- package/core/gather/gatherers/css-usage.js +5 -1
- package/core/gather/gatherers/image-elements.js +1 -2
- package/core/gather/gatherers/seo/robots-txt.js +1 -2
- package/core/gather/gatherers/stacks.js +1 -2
- package/core/gather/gatherers/stylesheets.js +10 -3
- package/core/gather/navigation-runner.js +1 -1
- package/core/gather/runner-helpers.js +1 -2
- package/core/gather/session.js +1 -2
- package/core/gather/snapshot-runner.js +1 -2
- package/core/gather/timespan-runner.js +1 -2
- package/core/lib/asset-saver.js +1 -2
- package/core/lib/csp-evaluator.js +1 -1
- package/core/lib/i18n/i18n.js +1 -2
- package/core/lib/lantern-trace-saver.js +19 -13
- package/core/lib/lighthouse-logger.d.ts +127 -0
- package/core/lib/lighthouse-logger.js +319 -0
- package/core/lib/median-run.d.ts +16 -6
- package/core/lib/median-run.js +13 -6
- package/core/lib/network-recorder.js +1 -2
- package/core/lib/network-request.d.ts +2 -2
- package/core/lib/network-request.js +1 -1
- package/core/lib/page-functions.js +4 -3
- package/core/lib/script-helpers.d.ts +23 -8
- package/core/lib/script-helpers.js +7 -6
- package/core/lib/sentry-reporter.d.ts +59 -0
- package/core/lib/sentry-reporter.js +281 -0
- package/core/lib/sentry.d.ts +7 -7
- package/core/lib/sentry.js +31 -39
- package/core/lib/stack-packs.js +1 -1
- package/core/lib/timing-trace-saver.d.ts +2 -2
- package/core/lib/timing-trace-saver.js +1 -1
- package/core/lib/tracehouse/main-thread-tasks.d.ts +7 -0
- package/core/lib/tracehouse/main-thread-tasks.js +18 -6
- package/core/lib/tracehouse/task-summary.d.ts +16 -4
- package/core/lib/tracehouse/task-summary.js +6 -5
- package/core/lib/tracehouse/trace-processor.d.ts +6 -6
- package/core/lib/tracehouse/trace-processor.js +1 -1
- package/core/lib/traces/metric-trace-events.js +1 -2
- package/core/lib/url-utils.d.ts +4 -4
- package/core/lib/url-utils.js +1 -1
- package/core/runner.js +1 -2
- package/dist/report/bundle.esm.js +10 -10
- package/dist/report/flow.js +13 -13
- package/dist/report/standalone.js +11 -11
- package/package.json +9 -12
- package/report/renderer/text-encoding.d.ts +3 -5
- package/report/renderer/text-encoding.js +19 -33
- package/report/types/augment-dom.d.ts +0 -4
- package/shared/util.js +10 -2
- package/third-party/ard/README.md +2 -2
- package/third-party/ard/ard.js +1 -1
- package/third-party/ard/schema-validator.js +42 -2
- package/tsconfig.json +2 -42
- package/types/artifacts.d.ts +7 -1
- package/types/internal/node.d.ts +1 -0
- package/types/internal/test.d.ts +5 -0
- package/report/types/buffer.d.ts +0 -19
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "13.6.0-dev.
|
|
4
|
+
"version": "13.6.0-dev.20261116",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -101,10 +101,11 @@
|
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@eslint/js": "^9.28.0",
|
|
104
|
-
"@
|
|
104
|
+
"@firebase/app": "^0.16.2",
|
|
105
|
+
"@firebase/auth": "^1.13.6",
|
|
106
|
+
"@formatjs/icu-messageformat-parser": "^3.5.23",
|
|
105
107
|
"@jest/fake-timers": "^30.5.2",
|
|
106
108
|
"@testing-library/preact": "^3.2.4",
|
|
107
|
-
"@types/archiver": "^8.0.0",
|
|
108
109
|
"@types/chrome": "^0.3.5",
|
|
109
110
|
"@types/debug": "^4.1.13",
|
|
110
111
|
"@types/estree": "^1.0.9",
|
|
@@ -118,16 +119,16 @@
|
|
|
118
119
|
"@types/yargs-parser": "^21.0.3",
|
|
119
120
|
"acorn": "^8.19.0",
|
|
120
121
|
"ajv": "^8.20.0",
|
|
121
|
-
"
|
|
122
|
+
"ajv-formats": "^3.0.1",
|
|
122
123
|
"chrome-devtools-frontend": "1.0.1726686",
|
|
123
124
|
"concurrently": "^10.0.6",
|
|
124
125
|
"conventional-changelog": "^8.1.3",
|
|
125
126
|
"core-js-compat": "^3.51.0",
|
|
126
127
|
"esbuild": "0.28.2",
|
|
127
128
|
"eslint": "^9.28.0",
|
|
128
|
-
"eslint-plugin-import": "^
|
|
129
|
+
"eslint-plugin-import-x": "^4.18.1",
|
|
129
130
|
"expect": "^30.5.2",
|
|
130
|
-
"
|
|
131
|
+
"fflate": "^0.8.3",
|
|
131
132
|
"gh-pages": "^6.3.0",
|
|
132
133
|
"globals": "^17.13.0",
|
|
133
134
|
"idb-keyval": "^6.3.0",
|
|
@@ -138,7 +139,6 @@
|
|
|
138
139
|
"magic-string": "^1.4.3",
|
|
139
140
|
"mime-types": "^3.0.2",
|
|
140
141
|
"mocha": "^12.0.3",
|
|
141
|
-
"pako": "^3.0.2",
|
|
142
142
|
"preact": "^10.29.8",
|
|
143
143
|
"pretty-json-stringify": "^0.0.2",
|
|
144
144
|
"puppeteer": "^25.16.0",
|
|
@@ -153,20 +153,17 @@
|
|
|
153
153
|
},
|
|
154
154
|
"dependencies": {
|
|
155
155
|
"@paulirish/trace_engine": "0.0.68",
|
|
156
|
-
"@sentry/node": "^11.8.0",
|
|
157
|
-
"ajv-formats": "^3.0.1",
|
|
158
156
|
"axe-core": "4.14.0",
|
|
159
157
|
"chrome-launcher": "^1.2.3",
|
|
160
158
|
"configstore": "^8.0.0",
|
|
161
159
|
"csp_evaluator": "1.1.8",
|
|
160
|
+
"debug": "^4.4.3",
|
|
162
161
|
"devtools-protocol": "0.0.1727723",
|
|
163
162
|
"enquirer": "^2.3.6",
|
|
164
163
|
"http-link-header": "^1.1.1",
|
|
165
|
-
"intl-messageformat": "^
|
|
164
|
+
"intl-messageformat": "^12.1.5",
|
|
166
165
|
"js-library-detector": "^6.7.0",
|
|
167
|
-
"lighthouse-logger": "^2.0.2",
|
|
168
166
|
"lighthouse-stack-packs": "1.12.3",
|
|
169
|
-
"open": "^11.0.4",
|
|
170
167
|
"puppeteer-core": "^25.16.0",
|
|
171
168
|
"robots-parser": "^3.0.1",
|
|
172
169
|
"speedline-core": "^1.4.3",
|
|
@@ -4,9 +4,7 @@ export namespace TextEncoding {
|
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Takes an UTF-8 string and returns a base64 encoded string.
|
|
7
|
-
* If gzip is true, the UTF-8 bytes are gzipped before base64'd
|
|
8
|
-
* CompressionStream (currently only in Chrome), falling back to pako
|
|
9
|
-
* (which is only used to encode in our Node tests).
|
|
7
|
+
* If gzip is true, the UTF-8 bytes are gzipped before base64'd.
|
|
10
8
|
* @param {string} string
|
|
11
9
|
* @param {{gzip: boolean}} options
|
|
12
10
|
* @return {Promise<string>}
|
|
@@ -17,10 +15,10 @@ declare function toBase64(string: string, options: {
|
|
|
17
15
|
/**
|
|
18
16
|
* @param {string} encoded
|
|
19
17
|
* @param {{gzip: boolean}} options
|
|
20
|
-
* @return {string}
|
|
18
|
+
* @return {Promise<string>}
|
|
21
19
|
*/
|
|
22
20
|
declare function fromBase64(encoded: string, options: {
|
|
23
21
|
gzip: boolean;
|
|
24
|
-
}): string
|
|
22
|
+
}): Promise<string>;
|
|
25
23
|
export {};
|
|
26
24
|
//# sourceMappingURL=text-encoding.d.ts.map
|
|
@@ -4,20 +4,19 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(
|
|
7
|
+
/**
|
|
8
|
+
* @param {CompressionStream|DecompressionStream} stream
|
|
9
|
+
* @param {Uint8Array<ArrayBuffer>} bytes
|
|
10
|
+
* @return {Promise<Uint8Array<ArrayBuffer>>}
|
|
11
|
+
*/
|
|
12
|
+
async function transformBytes(stream, bytes) {
|
|
13
|
+
const readable = new Blob([bytes]).stream().pipeThrough(stream);
|
|
14
|
+
return new Uint8Array(await new Response(readable).arrayBuffer());
|
|
15
|
+
}
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Takes an UTF-8 string and returns a base64 encoded string.
|
|
18
|
-
* If gzip is true, the UTF-8 bytes are gzipped before base64'd
|
|
19
|
-
* CompressionStream (currently only in Chrome), falling back to pako
|
|
20
|
-
* (which is only used to encode in our Node tests).
|
|
19
|
+
* If gzip is true, the UTF-8 bytes are gzipped before base64'd.
|
|
21
20
|
* @param {string} string
|
|
22
21
|
* @param {{gzip: boolean}} options
|
|
23
22
|
* @return {Promise<string>}
|
|
@@ -26,18 +25,7 @@ async function toBase64(string, options) {
|
|
|
26
25
|
let bytes = new TextEncoder().encode(string);
|
|
27
26
|
|
|
28
27
|
if (options.gzip) {
|
|
29
|
-
|
|
30
|
-
const cs = new CompressionStream('gzip');
|
|
31
|
-
const writer = cs.writable.getWriter();
|
|
32
|
-
writer.write(bytes);
|
|
33
|
-
writer.close();
|
|
34
|
-
const compAb = await new Response(cs.readable).arrayBuffer();
|
|
35
|
-
bytes = new Uint8Array(compAb);
|
|
36
|
-
} else {
|
|
37
|
-
/** @type {typeof import('pako')=} */
|
|
38
|
-
const pako = window.pako;
|
|
39
|
-
bytes = pako.gzip(string);
|
|
40
|
-
}
|
|
28
|
+
bytes = await transformBytes(new CompressionStream('gzip'), bytes);
|
|
41
29
|
}
|
|
42
30
|
|
|
43
31
|
let binaryString = '';
|
|
@@ -47,25 +35,23 @@ async function toBase64(string, options) {
|
|
|
47
35
|
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
48
36
|
binaryString += String.fromCharCode(...bytes.subarray(i, i + chunkSize));
|
|
49
37
|
}
|
|
50
|
-
return
|
|
38
|
+
return btoa(binaryString);
|
|
51
39
|
}
|
|
52
40
|
|
|
53
41
|
/**
|
|
54
42
|
* @param {string} encoded
|
|
55
43
|
* @param {{gzip: boolean}} options
|
|
56
|
-
* @return {string}
|
|
44
|
+
* @return {Promise<string>}
|
|
57
45
|
*/
|
|
58
|
-
function fromBase64(encoded, options) {
|
|
59
|
-
const binaryString =
|
|
60
|
-
|
|
46
|
+
async function fromBase64(encoded, options) {
|
|
47
|
+
const binaryString = atob(encoded);
|
|
48
|
+
let bytes = Uint8Array.from(binaryString, c => c.charCodeAt(0));
|
|
61
49
|
|
|
62
50
|
if (options.gzip) {
|
|
63
|
-
|
|
64
|
-
const pako = window.pako;
|
|
65
|
-
return pako.ungzip(bytes, {toText: true});
|
|
66
|
-
} else {
|
|
67
|
-
return new TextDecoder().decode(bytes);
|
|
51
|
+
bytes = await transformBytes(new DecompressionStream('gzip'), bytes);
|
|
68
52
|
}
|
|
53
|
+
|
|
54
|
+
return new TextDecoder().decode(bytes);
|
|
69
55
|
}
|
|
70
56
|
|
|
71
57
|
export const TextEncoding = {toBase64, fromBase64};
|
package/shared/util.js
CHANGED
|
@@ -181,8 +181,16 @@ class Util {
|
|
|
181
181
|
return string;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
/** @type {Iterator<Intl.SegmentData>} */
|
|
185
|
+
let iterator;
|
|
186
|
+
try {
|
|
187
|
+
const segmenter = new Intl.Segmenter(undefined, {granularity: 'grapheme'});
|
|
188
|
+
iterator = segmenter.segment(string)[Symbol.iterator]();
|
|
189
|
+
} catch {
|
|
190
|
+
// `Intl.Segmenter` can be missing or broken (e.g. replaced by a page's polyfill when this
|
|
191
|
+
// runs in the page). Fall back to truncating by code unit.
|
|
192
|
+
return string.slice(0, Math.max(0, characterLimit - ellipseSuffix.length)) + ellipseSuffix;
|
|
193
|
+
}
|
|
186
194
|
|
|
187
195
|
let lastSegmentIndex = 0;
|
|
188
196
|
for (let i = 0; i <= characterLimit - ellipseSuffix.length; i++) {
|
|
@@ -15,10 +15,10 @@ The original Python script is located in the `ards-project/ard-spec` repository:
|
|
|
15
15
|
While the validation rules and test suite maintain 1:1 parity with the reference suite, the following adaptations were made for Lighthouse integration:
|
|
16
16
|
- **Structured Error Return:** `ConformanceTester` stores structured objects (`{ element, message }`) in `errors`, `warnings` and `infos` instead of formatted ANSI CLI strings. The `[label]` prefix upstream puts on entry messages is reported as `element` instead.
|
|
17
17
|
- **Precompiled Standalone Validator (`schema-validator.js`):** Uses `build/build-ard-schema.js` (`yarn build-ard-schema`) to precompile the `ArdManifest` and `ArdEntry` definitions of `ard-entry.schema.json` into a pure, standalone JavaScript module (`schema-validator.js`) ahead of time using `Ajv2020` and `ajv/dist/standalone`. This eliminates runtime dynamic compilation (`new Function()` / `eval()`), preventing Content Security Policy (CSP) `unsafe-eval` violations when running inside Chrome DevTools frontend, avoiding runtime `fs.readFileSync` calls in browser/bundled contexts, and keeping `Ajv` out of the client bundle.
|
|
18
|
-
- **
|
|
18
|
+
- **Inlined Format Validation:** The build script emits a small hand-written port of the `uri` and `date-time` validators from `ajv-formats` v3.0.1 (full mode, MIT) into `schema-validator.js`, so neither `ajv-formats` nor `ajv` is a runtime dependency. The build fails if the schema references any other format.
|
|
19
19
|
- **Schema Error Messages:** Ajv reports different messages than Python's `jsonschema`. The first error not nested inside a `oneOf`/`anyOf` branch is reported, with `'x' is a required property` phrasing kept for `required` errors.
|
|
20
20
|
- **Non-object Input:** Upstream assumes the manifest root and each entry are JSON objects. The port treats anything else as empty, so it reports errors instead of throwing.
|
|
21
|
-
- **Lighthouse Logger:** Replaced raw `console.log` with `lighthouse-logger`.
|
|
21
|
+
- **Lighthouse Logger:** Replaced raw `console.log` with `core/lib/lighthouse-logger.js`.
|
|
22
22
|
|
|
23
23
|
Publisher resolution (upstream's `resolve_publisher`, spec §5.1) is implemented by the gatherer in `core/gather/gatherers/agentic/ard.js`, and the resulting legacy-location warning by the `ard-schema` audit. `infos` are not surfaced in the audit.
|
|
24
24
|
|
package/third-party/ard/ard.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* and the Lighthouse-specific adaptations.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import log from 'lighthouse-logger';
|
|
13
|
+
import log from '../../core/lib/lighthouse-logger.js';
|
|
14
14
|
import {ArdManifest as validateArdManifest, ArdEntry as validateArdEntry} from './schema-validator.js';
|
|
15
15
|
|
|
16
16
|
const ARD_VERSION = '0.91 (f073b1e)';
|
|
@@ -8,7 +8,47 @@
|
|
|
8
8
|
/* eslint-disable */
|
|
9
9
|
// @ts-nocheck
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/*! uri and date-time format validators ported from ajv-formats v3.0.1 (full mode).
|
|
12
|
+
* https://github.com/ajv-validator/ajv-formats - Copyright (c) 2020 Evgeny Poberezkin - MIT License */
|
|
13
|
+
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
14
|
+
const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
15
|
+
const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
16
|
+
const NOT_URI_FRAGMENT = /\/|:/;
|
|
17
|
+
const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
18
|
+
function isDate(str) {
|
|
19
|
+
const matches = DATE.exec(str);
|
|
20
|
+
if (!matches) return false;
|
|
21
|
+
const year = +matches[1];
|
|
22
|
+
const month = +matches[2];
|
|
23
|
+
const day = +matches[3];
|
|
24
|
+
const isLeapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
25
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear ? 29 : DAYS[month]);
|
|
26
|
+
}
|
|
27
|
+
function isTimeWithTimeZone(str) {
|
|
28
|
+
const matches = TIME.exec(str);
|
|
29
|
+
if (!matches) return false;
|
|
30
|
+
const hr = +matches[1];
|
|
31
|
+
const min = +matches[2];
|
|
32
|
+
const sec = +matches[3];
|
|
33
|
+
const tzSign = matches[5] === '-' ? -1 : 1;
|
|
34
|
+
const tzH = +(matches[6] || 0);
|
|
35
|
+
const tzM = +(matches[7] || 0);
|
|
36
|
+
if (tzH > 23 || tzM > 59 || !matches[4]) return false;
|
|
37
|
+
if (hr <= 23 && min <= 59 && sec < 60) return true;
|
|
38
|
+
// leap second
|
|
39
|
+
const utcMin = min - tzM * tzSign;
|
|
40
|
+
const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
41
|
+
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
42
|
+
}
|
|
43
|
+
const fullFormats = {
|
|
44
|
+
'uri': (str) => NOT_URI_FRAGMENT.test(str) && URI.test(str),
|
|
45
|
+
'date-time': {
|
|
46
|
+
validate(str) {
|
|
47
|
+
const dateTime = str.split(/t|\s/i);
|
|
48
|
+
return dateTime.length === 2 && isDate(dateTime[0]) && isTimeWithTimeZone(dateTime[1]);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
12
52
|
|
|
13
53
|
"use strict";
|
|
14
54
|
export const ArdManifest = validate25;
|
|
@@ -256,7 +296,7 @@ const schema34 = {
|
|
|
256
296
|
},
|
|
257
297
|
"additionalProperties": true
|
|
258
298
|
};
|
|
259
|
-
const formats0 = fullFormats
|
|
299
|
+
const formats0 = fullFormats["uri"];
|
|
260
300
|
const formats4 = fullFormats["date-time"];
|
|
261
301
|
const pattern4 = new RegExp("^urn:air:[a-zA-Z0-9.-]+(:[a-zA-Z0-9._-]+)+$", "u");
|
|
262
302
|
|
package/tsconfig.json
CHANGED
|
@@ -33,69 +33,31 @@
|
|
|
33
33
|
],
|
|
34
34
|
"exclude": [
|
|
35
35
|
"build/test/*test-case*.js",
|
|
36
|
-
"build/process-global.js",
|
|
37
36
|
"core/test/audits/**/*.js",
|
|
38
37
|
"core/test/fixtures/**/*.js",
|
|
39
|
-
|
|
38
|
+
// Lightrider has its own browser-only tsconfig that references root.
|
|
40
39
|
"clients/lightrider/**/*.js",
|
|
41
|
-
"clients/test/**/*.js",
|
|
40
|
+
"clients/test/lightrider/**/*.js",
|
|
42
41
|
"cli/test/fixtures/**/*.js",
|
|
43
42
|
"core/scripts/legacy-javascript/variants",
|
|
44
|
-
// Imports the local lighthouse-logger source, which isn't type checked (core uses its published types).
|
|
45
|
-
"core/test/lib/lighthouse-logger-test.js",
|
|
46
43
|
// These test files require further changes before they can be type checked.
|
|
47
44
|
"core/test/config/config-helpers-test.js",
|
|
48
|
-
"core/test/config/config-plugin-test.js",
|
|
49
|
-
"core/test/config/default-config-test.js",
|
|
50
45
|
"core/test/gather/driver/wait-for-condition-test.js",
|
|
51
|
-
"core/test/gather/gatherers/accessibility-test.js",
|
|
52
46
|
"core/test/gather/gatherers/console-messages-test.js",
|
|
53
47
|
"core/test/gather/gatherers/devtools-log-test.js",
|
|
54
48
|
"core/test/gather/gatherers/full-page-screenshot-test.js",
|
|
55
|
-
"core/test/gather/gatherers/global-listeners-test.js",
|
|
56
|
-
"core/test/gather/gatherers/html-without-javascript-test.js",
|
|
57
|
-
"core/test/gather/gatherers/js-usage-test.js",
|
|
58
|
-
"core/test/gather/gatherers/link-elements-test.js",
|
|
59
|
-
"core/test/gather/gatherers/offline-test.js",
|
|
60
|
-
"core/test/gather/gatherers/runtime-exceptions-test.js",
|
|
61
|
-
"core/test/gather/gatherers/source-maps-test.js",
|
|
62
|
-
"core/test/gather/gatherers/stack-collector-test.js",
|
|
63
|
-
"core/test/gather/gatherers/start-url-test.js",
|
|
64
49
|
"core/test/gather/gatherers/trace-elements-test.js",
|
|
65
|
-
"core/test/gather/gatherers/viewport-dimensions-test.js",
|
|
66
|
-
"core/test/index-test.js",
|
|
67
|
-
"core/test/lib/arbitrary-equality-map-test.js",
|
|
68
50
|
"core/test/lib/asset-saver-test.js",
|
|
69
51
|
"core/test/lib/emulation-test.js",
|
|
70
|
-
"core/test/lib/i18n/i18n-test.js",
|
|
71
52
|
"core/test/lib/icons-test.js",
|
|
72
|
-
"core/test/lib/legacy-javascript-test.js",
|
|
73
|
-
"core/test/lib/lh-element-test.js",
|
|
74
|
-
"core/test/lib/lighthouse-compatibility-test.js",
|
|
75
53
|
"core/test/lib/manifest-parser-test.js",
|
|
76
|
-
"core/test/lib/median-run-test.js",
|
|
77
|
-
"core/test/lib/minification-estimator-test.js",
|
|
78
|
-
"core/test/lib/minify-devtoolslog-test.js",
|
|
79
|
-
"core/test/lib/network-recorder-test.js",
|
|
80
54
|
"core/test/lib/network-request-test.js",
|
|
81
|
-
"core/test/lib/page-functions-test.js",
|
|
82
55
|
"core/test/lib/proto-preprocessor-test.js",
|
|
83
|
-
"core/test/lib/rect-helpers-test.js",
|
|
84
|
-
"core/test/lib/script-helpers-test.js",
|
|
85
56
|
"core/test/lib/sentry-test.js",
|
|
86
|
-
"core/test/lib/stack-packs-test.js",
|
|
87
|
-
"core/test/lib/statistics-test.js",
|
|
88
|
-
"core/test/lib/timing-trace-saver-test.js",
|
|
89
57
|
"core/test/lib/tracehouse/cpu-profile-model-test.js",
|
|
90
58
|
"core/test/lib/tracehouse/main-thread-tasks-test.js",
|
|
91
|
-
"core/test/lib/tracehouse/task-summary-test.js",
|
|
92
59
|
"core/test/lib/tracehouse/trace-processor-test.js",
|
|
93
|
-
"core/test/lib/traces/metrics-trace-events-test.js",
|
|
94
|
-
"core/test/lib/url-utils-test.js",
|
|
95
|
-
"core/test/network-records-to-devtools-log-test.js",
|
|
96
60
|
"core/test/runner-test.js",
|
|
97
|
-
"core/test/scoring-test.js",
|
|
98
|
-
"core/test/scripts/i18n/bake-ctc-to-lhl-test.js",
|
|
99
61
|
],
|
|
100
62
|
"files": [
|
|
101
63
|
// Opt-in to typechecking for some core tests and test-support files.
|
|
@@ -103,8 +65,6 @@
|
|
|
103
65
|
"core/test/audits/bf-cache-test.js",
|
|
104
66
|
"core/test/audits/third-party-cookies-test.js",
|
|
105
67
|
"core/test/audits/script-treemap-data-test.js",
|
|
106
|
-
"core/test/computed/metrics/interactive-test.js",
|
|
107
|
-
"core/test/computed/tbt-impact-tasks-test.js",
|
|
108
68
|
"core/test/fixtures/config-plugins/lighthouse-plugin-simple/plugin-simple.js",
|
|
109
69
|
],
|
|
110
70
|
}
|
package/types/artifacts.d.ts
CHANGED
|
@@ -532,10 +532,16 @@ declare namespace Artifacts {
|
|
|
532
532
|
|
|
533
533
|
type MeasureEntry = LHResult.MeasureEntry;
|
|
534
534
|
|
|
535
|
+
type ComputedSettings = Util.ImmutableObject<
|
|
536
|
+
Pick<Config.Settings, 'throttlingMethod'> &
|
|
537
|
+
Partial<Omit<Config.Settings, 'throttling'>> &
|
|
538
|
+
{throttling?: Partial<Config.Settings['throttling']>}
|
|
539
|
+
>;
|
|
540
|
+
|
|
535
541
|
interface MetricComputationDataInput {
|
|
536
542
|
devtoolsLog: DevtoolsLog;
|
|
537
543
|
trace: Trace;
|
|
538
|
-
settings:
|
|
544
|
+
settings: ComputedSettings;
|
|
539
545
|
gatherContext: Artifacts['GatherContext'];
|
|
540
546
|
simulator: Gatherer.Simulation.Simulator | null;
|
|
541
547
|
URL: Artifacts['URL'];
|
package/types/internal/node.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare global {
|
|
|
17
17
|
__nativePerformance: Performance;
|
|
18
18
|
__nativeFetch: typeof fetch,
|
|
19
19
|
__nativeURL: typeof URL;
|
|
20
|
+
__nativeMap: MapConstructor;
|
|
20
21
|
__ElementMatches: Element['matches'];
|
|
21
22
|
__HTMLElementBoundingClientRect: HTMLElement['getBoundingClientRect'];
|
|
22
23
|
|
package/types/internal/test.d.ts
CHANGED
|
@@ -49,6 +49,11 @@ declare module 'expect' {
|
|
|
49
49
|
*/
|
|
50
50
|
toBeDisplayString: (pattern: RegExp | string) => R;
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
interface AsymmetricMatchers {
|
|
54
|
+
toBeApproximately(expected: number, numDigits?: number): ReturnType<AsymmetricMatchers['closeTo']>;
|
|
55
|
+
toBeDisplayString(pattern: RegExp | string): ReturnType<AsymmetricMatchers['closeTo']>;
|
|
56
|
+
}
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
export {};
|
package/report/types/buffer.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A minimal type for Node's `Buffer` to avoid importing all Node types for
|
|
9
|
-
* atob/btoa fallback for testing `text-encoding.js`.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
class Buffer {
|
|
14
|
-
static from(str: string, encoding?: string): Buffer;
|
|
15
|
-
toString(encoding?: string): string;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export {}
|