lighthouse 13.6.0-dev.20261112 → 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.
Files changed (98) hide show
  1. package/.agents/skills/update-ard-port/SKILL.md +1 -1
  2. package/cli/bin.js +8 -3
  3. package/cli/open-file.js +1 -1
  4. package/cli/printer.js +1 -1
  5. package/cli/run.js +4 -2
  6. package/cli/sentry-prompt.js +2 -1
  7. package/cli/test/smokehouse/frontends/smokehouse-bin.js +1 -1
  8. package/cli/test/smokehouse/lighthouse-runners/cli.js +1 -2
  9. package/cli/test/smokehouse/report-assert.js +1 -2
  10. package/cli/test/smokehouse/smokehouse.js +1 -2
  11. package/core/audits/autocomplete.js +1 -2
  12. package/core/audits/bootup-time.js +1 -2
  13. package/core/audits/errors-in-console.js +1 -2
  14. package/core/audits/mainthread-work-breakdown.js +1 -2
  15. package/core/audits/metrics.d.ts +2 -2
  16. package/core/audits/metrics.js +1 -1
  17. package/core/computed/computed-artifact.js +1 -2
  18. package/core/computed/entity-classification.d.ts +3 -3
  19. package/core/computed/entity-classification.js +5 -3
  20. package/core/computed/js-bundles.js +1 -2
  21. package/core/computed/load-simulator.d.ts +5 -3
  22. package/core/computed/load-simulator.js +9 -2
  23. package/core/computed/metrics/responsiveness.d.ts +5 -3
  24. package/core/computed/metrics/responsiveness.js +1 -1
  25. package/core/computed/metrics/time-to-first-byte.js +3 -1
  26. package/core/computed/metrics/timing-summary.d.ts +7 -5
  27. package/core/computed/metrics/timing-summary.js +3 -4
  28. package/core/computed/navigation-insights.d.ts +5 -3
  29. package/core/computed/navigation-insights.js +1 -1
  30. package/core/computed/network-analysis.js +1 -2
  31. package/core/computed/page-dependency-graph.d.ts +5 -3
  32. package/core/computed/page-dependency-graph.js +1 -1
  33. package/core/computed/trace-engine-result.d.ts +7 -5
  34. package/core/computed/trace-engine-result.js +9 -5
  35. package/core/computed/unused-css.d.ts +2 -2
  36. package/core/computed/unused-css.js +1 -1
  37. package/core/config/config.js +1 -2
  38. package/core/gather/base-artifacts.js +1 -2
  39. package/core/gather/driver/environment.js +1 -2
  40. package/core/gather/driver/navigation.js +1 -2
  41. package/core/gather/driver/network-monitor.js +1 -2
  42. package/core/gather/driver/prepare.js +1 -2
  43. package/core/gather/driver/storage.js +1 -2
  44. package/core/gather/driver/target-manager.js +1 -2
  45. package/core/gather/driver/wait-for-condition.js +1 -2
  46. package/core/gather/driver.js +1 -2
  47. package/core/gather/gatherers/agentic/ard.js +1 -1
  48. package/core/gather/gatherers/agentic/llms-txt.js +1 -2
  49. package/core/gather/gatherers/image-elements.js +1 -2
  50. package/core/gather/gatherers/seo/robots-txt.js +1 -2
  51. package/core/gather/gatherers/stacks.js +1 -2
  52. package/core/gather/gatherers/stylesheets.js +1 -2
  53. package/core/gather/navigation-runner.js +1 -1
  54. package/core/gather/runner-helpers.js +1 -2
  55. package/core/gather/session.js +1 -2
  56. package/core/gather/snapshot-runner.js +1 -2
  57. package/core/gather/timespan-runner.js +1 -2
  58. package/core/lib/asset-saver.js +1 -2
  59. package/core/lib/csp-evaluator.js +1 -1
  60. package/core/lib/i18n/i18n.js +1 -2
  61. package/core/lib/lighthouse-logger.d.ts +127 -0
  62. package/core/lib/lighthouse-logger.js +319 -0
  63. package/core/lib/median-run.d.ts +16 -6
  64. package/core/lib/median-run.js +13 -6
  65. package/core/lib/network-recorder.js +1 -2
  66. package/core/lib/network-request.d.ts +2 -2
  67. package/core/lib/network-request.js +1 -1
  68. package/core/lib/page-functions.js +2 -2
  69. package/core/lib/script-helpers.d.ts +23 -8
  70. package/core/lib/script-helpers.js +7 -6
  71. package/core/lib/sentry-reporter.d.ts +59 -0
  72. package/core/lib/sentry-reporter.js +281 -0
  73. package/core/lib/sentry.d.ts +7 -7
  74. package/core/lib/sentry.js +23 -40
  75. package/core/lib/stack-packs.js +1 -1
  76. package/core/lib/timing-trace-saver.d.ts +2 -2
  77. package/core/lib/timing-trace-saver.js +1 -1
  78. package/core/lib/tracehouse/task-summary.d.ts +16 -4
  79. package/core/lib/tracehouse/task-summary.js +6 -5
  80. package/core/lib/tracehouse/trace-processor.d.ts +6 -6
  81. package/core/lib/tracehouse/trace-processor.js +1 -1
  82. package/core/lib/traces/metric-trace-events.js +1 -2
  83. package/core/lib/url-utils.d.ts +4 -4
  84. package/core/lib/url-utils.js +1 -1
  85. package/core/runner.js +1 -2
  86. package/dist/report/bundle.esm.js +10 -10
  87. package/dist/report/flow.js +12 -12
  88. package/dist/report/standalone.js +11 -11
  89. package/package.json +2 -4
  90. package/report/renderer/text-encoding.d.ts +3 -5
  91. package/report/renderer/text-encoding.js +19 -33
  92. package/report/types/augment-dom.d.ts +0 -4
  93. package/third-party/ard/README.md +1 -1
  94. package/third-party/ard/ard.js +1 -1
  95. package/tsconfig.json +2 -42
  96. package/types/artifacts.d.ts +7 -1
  97. package/types/internal/test.d.ts +5 -0
  98. 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.20261112",
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": {
@@ -139,7 +139,6 @@
139
139
  "magic-string": "^1.4.3",
140
140
  "mime-types": "^3.0.2",
141
141
  "mocha": "^12.0.3",
142
- "pako": "^3.0.2",
143
142
  "preact": "^10.29.8",
144
143
  "pretty-json-stringify": "^0.0.2",
145
144
  "puppeteer": "^25.16.0",
@@ -154,17 +153,16 @@
154
153
  },
155
154
  "dependencies": {
156
155
  "@paulirish/trace_engine": "0.0.68",
157
- "@sentry/node": "^11.8.0",
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
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
167
  "puppeteer-core": "^25.16.0",
170
168
  "robots-parser": "^3.0.1",
@@ -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, using
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
- const btoa_ = typeof btoa !== 'undefined' ?
8
- btoa :
9
- /** @param {string} str */
10
- (str) => Buffer.from(str).toString('base64');
11
- const atob_ = typeof atob !== 'undefined' ?
12
- atob :
13
- /** @param {string} str */
14
- (str) => Buffer.from(str, 'base64').toString();
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, using
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
- if (typeof CompressionStream !== 'undefined') {
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 btoa_(binaryString);
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 = atob_(encoded);
60
- const bytes = Uint8Array.from(binaryString, c => c.charCodeAt(0));
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
- /** @type {typeof import('pako')=} */
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};
@@ -11,7 +11,3 @@
11
11
 
12
12
  // Import to augment querySelector/querySelectorAll with stricter type checking.
13
13
  import '../../types/internal/query-selector';
14
-
15
- declare global {
16
- var pako: typeof import('pako');
17
- }
@@ -18,7 +18,7 @@ While the validation rules and test suite maintain 1:1 parity with the reference
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
 
@@ -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)';
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
- "core/test/computed/**/*.js",
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
  }
@@ -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: Audit.Context['settings'];
544
+ settings: ComputedSettings;
539
545
  gatherContext: Artifacts['GatherContext'];
540
546
  simulator: Gatherer.Simulation.Simulator | null;
541
547
  URL: Artifacts['URL'];
@@ -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 {};
@@ -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 {}