lighthouse 10.4.0-dev.20230713 → 10.4.0-dev.20230715

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 (174) hide show
  1. package/cli/cli-flags.d.ts +1 -6
  2. package/cli/cli-flags.js +0 -5
  3. package/cli/run.js +3 -10
  4. package/cli/test/smokehouse/lighthouse-runners/bundle.js +3 -1
  5. package/core/config/config-helpers.d.ts +3 -3
  6. package/core/config/config-helpers.js +5 -12
  7. package/core/config/config.js +1 -7
  8. package/core/config/constants.d.ts +0 -2
  9. package/core/config/constants.js +0 -16
  10. package/core/config/filters.js +1 -1
  11. package/core/config/validation.d.ts +5 -10
  12. package/core/config/validation.js +12 -22
  13. package/core/gather/base-artifacts.d.ts +4 -4
  14. package/core/gather/base-artifacts.js +2 -6
  15. package/core/gather/base-gatherer.d.ts +12 -37
  16. package/core/gather/base-gatherer.js +7 -54
  17. package/core/gather/driver/dom.d.ts +4 -4
  18. package/core/gather/driver/dom.js +2 -2
  19. package/core/gather/driver/environment.d.ts +4 -4
  20. package/core/gather/driver/environment.js +2 -2
  21. package/core/gather/driver/execution-context.d.ts +12 -3
  22. package/core/gather/driver/execution-context.js +27 -3
  23. package/core/gather/driver/navigation.d.ts +2 -2
  24. package/core/gather/driver/navigation.js +1 -1
  25. package/core/gather/driver/network-monitor.d.ts +6 -6
  26. package/core/gather/driver/network-monitor.js +3 -3
  27. package/core/gather/driver/network.d.ts +2 -2
  28. package/core/gather/driver/network.js +1 -1
  29. package/core/gather/driver/prepare.d.ts +10 -10
  30. package/core/gather/driver/prepare.js +10 -10
  31. package/core/gather/driver/service-workers.d.ts +4 -4
  32. package/core/gather/driver/service-workers.js +2 -2
  33. package/core/gather/driver/storage.d.ts +6 -6
  34. package/core/gather/driver/storage.js +3 -3
  35. package/core/gather/driver/target-manager.d.ts +6 -5
  36. package/core/gather/driver/target-manager.js +3 -3
  37. package/core/gather/driver/wait-for-condition.d.ts +14 -14
  38. package/core/gather/driver/wait-for-condition.js +8 -8
  39. package/core/gather/driver.d.ts +4 -4
  40. package/core/gather/driver.js +3 -3
  41. package/core/gather/fetcher.d.ts +3 -3
  42. package/core/gather/fetcher.js +1 -1
  43. package/core/gather/gatherers/accessibility.d.ts +4 -4
  44. package/core/gather/gatherers/accessibility.js +3 -3
  45. package/core/gather/gatherers/anchor-elements.d.ts +4 -4
  46. package/core/gather/gatherers/anchor-elements.js +4 -4
  47. package/core/gather/gatherers/bf-cache-failures.d.ts +8 -14
  48. package/core/gather/gatherers/bf-cache-failures.js +5 -14
  49. package/core/gather/gatherers/cache-contents.d.ts +4 -4
  50. package/core/gather/gatherers/cache-contents.js +3 -3
  51. package/core/gather/gatherers/console-messages.d.ts +6 -6
  52. package/core/gather/gatherers/console-messages.js +4 -4
  53. package/core/gather/gatherers/css-usage.d.ts +14 -14
  54. package/core/gather/gatherers/css-usage.js +9 -9
  55. package/core/gather/gatherers/devtools-log-compat.d.ts +5 -5
  56. package/core/gather/gatherers/devtools-log-compat.js +4 -4
  57. package/core/gather/gatherers/devtools-log.d.ts +6 -6
  58. package/core/gather/gatherers/devtools-log.js +4 -4
  59. package/core/gather/gatherers/dobetterweb/doctype.d.ts +4 -4
  60. package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
  61. package/core/gather/gatherers/dobetterweb/domstats.d.ts +4 -4
  62. package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
  63. package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +10 -22
  64. package/core/gather/gatherers/dobetterweb/optimized-images.js +10 -27
  65. package/core/gather/gatherers/dobetterweb/response-compression.d.ts +6 -12
  66. package/core/gather/gatherers/dobetterweb/response-compression.js +6 -15
  67. package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +8 -14
  68. package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +5 -14
  69. package/core/gather/gatherers/full-page-screenshot.d.ts +10 -10
  70. package/core/gather/gatherers/full-page-screenshot.js +6 -6
  71. package/core/gather/gatherers/global-listeners.d.ts +4 -4
  72. package/core/gather/gatherers/global-listeners.js +3 -3
  73. package/core/gather/gatherers/iframe-elements.d.ts +4 -4
  74. package/core/gather/gatherers/iframe-elements.js +3 -3
  75. package/core/gather/gatherers/image-elements.d.ts +10 -10
  76. package/core/gather/gatherers/image-elements.js +6 -6
  77. package/core/gather/gatherers/inputs.d.ts +4 -4
  78. package/core/gather/gatherers/inputs.js +3 -3
  79. package/core/gather/gatherers/inspector-issues.d.ts +8 -19
  80. package/core/gather/gatherers/inspector-issues.js +9 -26
  81. package/core/gather/gatherers/installability-errors.d.ts +6 -6
  82. package/core/gather/gatherers/installability-errors.js +4 -4
  83. package/core/gather/gatherers/js-usage.d.ts +6 -6
  84. package/core/gather/gatherers/js-usage.js +4 -4
  85. package/core/gather/gatherers/link-elements.d.ts +8 -20
  86. package/core/gather/gatherers/link-elements.js +7 -24
  87. package/core/gather/gatherers/main-document-content.d.ts +4 -16
  88. package/core/gather/gatherers/main-document-content.js +5 -23
  89. package/core/gather/gatherers/meta-elements.d.ts +4 -4
  90. package/core/gather/gatherers/meta-elements.js +3 -3
  91. package/core/gather/gatherers/network-user-agent.d.ts +5 -5
  92. package/core/gather/gatherers/network-user-agent.js +4 -4
  93. package/core/gather/gatherers/script-elements.d.ts +6 -11
  94. package/core/gather/gatherers/script-elements.js +4 -13
  95. package/core/gather/gatherers/scripts.d.ts +6 -6
  96. package/core/gather/gatherers/scripts.js +4 -4
  97. package/core/gather/gatherers/seo/embedded-content.d.ts +4 -4
  98. package/core/gather/gatherers/seo/embedded-content.js +3 -3
  99. package/core/gather/gatherers/seo/font-size.d.ts +6 -6
  100. package/core/gather/gatherers/seo/font-size.js +5 -5
  101. package/core/gather/gatherers/seo/robots-txt.d.ts +4 -4
  102. package/core/gather/gatherers/seo/robots-txt.js +3 -3
  103. package/core/gather/gatherers/seo/tap-targets.d.ts +8 -8
  104. package/core/gather/gatherers/seo/tap-targets.js +5 -5
  105. package/core/gather/gatherers/service-worker.d.ts +4 -10
  106. package/core/gather/gatherers/service-worker.js +3 -15
  107. package/core/gather/gatherers/source-maps.d.ts +12 -12
  108. package/core/gather/gatherers/source-maps.js +7 -7
  109. package/core/gather/gatherers/stacks.d.ts +7 -7
  110. package/core/gather/gatherers/stacks.js +6 -6
  111. package/core/gather/gatherers/trace-compat.d.ts +5 -5
  112. package/core/gather/gatherers/trace-compat.js +4 -4
  113. package/core/gather/gatherers/trace-elements.d.ts +13 -25
  114. package/core/gather/gatherers/trace-elements.js +13 -30
  115. package/core/gather/gatherers/trace.d.ts +8 -8
  116. package/core/gather/gatherers/trace.js +5 -5
  117. package/core/gather/gatherers/viewport-dimensions.d.ts +4 -4
  118. package/core/gather/gatherers/viewport-dimensions.js +3 -3
  119. package/core/gather/gatherers/web-app-manifest.d.ts +8 -8
  120. package/core/gather/gatherers/web-app-manifest.js +5 -5
  121. package/core/gather/navigation-runner.d.ts +9 -9
  122. package/core/gather/navigation-runner.js +6 -6
  123. package/core/gather/runner-helpers.d.ts +3 -3
  124. package/core/gather/runner-helpers.js +12 -4
  125. package/core/gather/session.d.ts +2 -2
  126. package/core/gather/session.js +1 -1
  127. package/core/gather/snapshot-runner.d.ts +2 -2
  128. package/core/gather/snapshot-runner.js +1 -1
  129. package/core/gather/timespan-runner.d.ts +2 -2
  130. package/core/gather/timespan-runner.js +1 -1
  131. package/core/index.cjs +0 -7
  132. package/core/index.d.ts +0 -15
  133. package/core/index.js +2 -40
  134. package/core/lib/asset-saver.js +8 -4
  135. package/core/lib/axe.js +1 -1
  136. package/core/lib/emulation.d.ts +14 -14
  137. package/core/lib/emulation.js +7 -7
  138. package/core/lib/page-functions.d.ts +2 -0
  139. package/core/lib/page-functions.js +10 -0
  140. package/core/lib/sentry.js +9 -2
  141. package/core/runner.d.ts +8 -30
  142. package/core/runner.js +6 -39
  143. package/core/user-flow.d.ts +4 -4
  144. package/core/user-flow.js +2 -2
  145. package/dist/report/bundle.esm.js +2221 -5832
  146. package/dist/report/flow.js +2631 -235
  147. package/dist/report/standalone.js +2586 -234
  148. package/package.json +8 -15
  149. package/third-party/esbuild-plugins-polyfills/LICENSE +3 -0
  150. package/third-party/esbuild-plugins-polyfills/README.md +7 -0
  151. package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +9 -0
  152. package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +129 -0
  153. package/tsconfig.json +1 -0
  154. package/types/artifacts.d.ts +12 -45
  155. package/types/config.d.ts +10 -52
  156. package/types/externs.d.ts +0 -2
  157. package/types/gatherer.d.ts +20 -45
  158. package/types/lh.d.ts +0 -2
  159. package/core/gather/gatherers/gatherer.d.ts +0 -46
  160. package/core/gather/gatherers/gatherer.js +0 -58
  161. package/core/legacy/config/config.d.ts +0 -107
  162. package/core/legacy/config/config.js +0 -566
  163. package/core/legacy/config/legacy-default-config.d.ts +0 -4
  164. package/core/legacy/config/legacy-default-config.js +0 -87
  165. package/core/legacy/gather/connections/connection.d.ts +0 -77
  166. package/core/legacy/gather/connections/connection.js +0 -196
  167. package/core/legacy/gather/connections/cri.d.ts +0 -27
  168. package/core/legacy/gather/connections/cri.js +0 -162
  169. package/core/legacy/gather/connections/raw.d.ts +0 -20
  170. package/core/legacy/gather/connections/raw.js +0 -57
  171. package/core/legacy/gather/driver.d.ts +0 -216
  172. package/core/legacy/gather/driver.js +0 -480
  173. package/core/legacy/gather/gather-runner.d.ts +0 -166
  174. package/core/legacy/gather/gather-runner.js +0 -590
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "10.4.0-dev.20230713",
4
+ "version": "10.4.0-dev.20230715",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {
@@ -41,7 +41,7 @@
41
41
  "start": "yarn build-report --standalone && node ./cli/index.js",
42
42
  "mocha": "node --loader=testdouble core/test/scripts/run-mocha-tests.js",
43
43
  "test": "yarn diff:sample-json && yarn lint --quiet && yarn unit && yarn type-check",
44
- "test-bundle": "yarn smoke --runner bundle --retries=2",
44
+ "test-bundle": "yarn smoke --runner bundle",
45
45
  "test-clients": "yarn mocha --testMatch clients/**/*-test.js && yarn mocha --testMatch clients/**/*-test-pptr.js",
46
46
  "test-viewer": "yarn unit-viewer && yarn mocha --testMatch viewer/**/*-test-pptr.js --timeout 35000",
47
47
  "test-treemap": "yarn unit-treemap && yarn mocha --testMatch treemap/**/*-test-pptr.js --timeout 35000",
@@ -99,14 +99,8 @@
99
99
  "devDependencies": {
100
100
  "@build-tracker/cli": "^1.0.0-beta.15",
101
101
  "@esbuild-kit/esm-loader": "^2.1.1",
102
+ "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
102
103
  "@jest/fake-timers": "^28.1.0",
103
- "@rollup/plugin-alias": "^3.1.2",
104
- "@rollup/plugin-commonjs": "^20.0.0",
105
- "@rollup/plugin-dynamic-import-vars": "^1.1.1",
106
- "@rollup/plugin-json": "^4.1.0",
107
- "@rollup/plugin-node-resolve": "^13.0.4",
108
- "@rollup/plugin-typescript": "^8.2.5",
109
- "@stadtlandnetz/rollup-plugin-postprocess": "^1.1.0",
110
104
  "@testing-library/preact": "^3.1.1",
111
105
  "@testing-library/preact-hooks": "^1.1.0",
112
106
  "@types/archiver": "^2.1.2",
@@ -125,6 +119,7 @@
125
119
  "@types/node": "*",
126
120
  "@types/pako": "^1.0.1",
127
121
  "@types/resize-observer-browser": "^0.1.1",
122
+ "@types/resolve": "^1.20.2",
128
123
  "@types/semver": "^5.5.0",
129
124
  "@types/tabulator-tables": "^4.9.1",
130
125
  "@types/ws": "^7.0.0",
@@ -135,6 +130,7 @@
135
130
  "acorn": "^8.5.0",
136
131
  "angular": "^1.7.4",
137
132
  "archiver": "^3.0.0",
133
+ "builtin-modules": "^3.3.0",
138
134
  "c8": "^7.11.3",
139
135
  "chalk": "^2.4.1",
140
136
  "chrome-devtools-frontend": "1.0.1153166",
@@ -144,6 +140,7 @@
144
140
  "cross-env": "^7.0.2",
145
141
  "csv-validator": "^0.0.3",
146
142
  "es-main": "^1.2.0",
143
+ "esbuild": "^0.18.11",
147
144
  "eslint": "^8.4.1",
148
145
  "eslint-config-google": "^0.14.0",
149
146
  "eslint-formatter-codeframe": "^7.32.1",
@@ -170,15 +167,11 @@
170
167
  "preact": "^10.7.2",
171
168
  "pretty-json-stringify": "^0.0.2",
172
169
  "puppeteer": "^20.8.0",
173
- "resolve": "^1.20.0",
170
+ "resolve": "^1.22.1",
174
171
  "rollup": "^2.52.7",
175
- "rollup-plugin-node-resolve": "^5.2.0",
176
172
  "rollup-plugin-polyfill-node": "^0.12.0",
177
- "rollup-plugin-replace": "^2.2.0",
178
- "rollup-plugin-shim": "^1.0.0",
179
- "rollup-plugin-terser": "^7.0.2",
180
173
  "tabulator-tables": "^4.9.3",
181
- "terser": "^5.3.8",
174
+ "terser": "^5.18.2",
182
175
  "testdouble": "^3.17.2",
183
176
  "typed-query-selector": "^2.6.1",
184
177
  "typescript": "^5.0.4",
@@ -0,0 +1,3 @@
1
+ MIT
2
+
3
+ https://github.com/remorses/esbuild-plugins/blob/d757c3bf5dff37a754d254168d4a3d88611e8175/package.json#L37
@@ -0,0 +1,7 @@
1
+ # @esbuild-plugins/node-modules-polyfill
2
+
3
+ This is `@esbuild-plugins/node-modules-polyfill`, with the following changes:
4
+
5
+ - using a better library for polyfills as proposed by this PR ... https://github.com/remorses/esbuild-plugins/pull/19
6
+ - ...but there are a couple correctness changes on top of the above PR, as described here: https://github.com/remorses/esbuild-plugins/pull/19#discussion_r990493080 (the PR has landed but is still broken for our use case)
7
+ - File converted from TS to JS
@@ -0,0 +1,9 @@
1
+ export function nodeModulesPolyfillPlugin(options?: {}): {
2
+ name: any;
3
+ setup: ({ onLoad, onResolve, initialOptions }: {
4
+ onLoad: any;
5
+ onResolve: any;
6
+ initialOptions: any;
7
+ }) => void;
8
+ };
9
+ //# sourceMappingURL=esbuild-polyfills.d.ts.map
@@ -0,0 +1,129 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+
4
+ import path from 'path';
5
+
6
+ import escapeStringRegexp from 'escape-string-regexp';
7
+ import {getModules as builtinsPolyfills} from 'rollup-plugin-polyfill-node/dist/modules.js';
8
+ import polyfillLib from 'rollup-plugin-polyfill-node/dist/polyfills.js';
9
+
10
+ const NAME = 'node-modules-polyfills';
11
+ const NAMESPACE = NAME;
12
+
13
+ function removeEndingSlash(importee) {
14
+ if (importee && importee.slice(-1) === '/') {
15
+ importee = importee.slice(0, -1);
16
+ }
17
+ return importee;
18
+ }
19
+
20
+ function nodeModulesPolyfillPlugin(
21
+ options = {}
22
+ ) {
23
+ const {namespace = NAMESPACE, name = NAME} = options;
24
+ if (namespace.endsWith('commonjs')) {
25
+ throw new Error(`namespace ${namespace} must not end with commonjs`);
26
+ }
27
+ // this namespace is needed to make ES modules expose their default export to require: require('assert') will give you import('assert').default
28
+ const commonjsNamespace = namespace + '-commonjs';
29
+ const polyfilledBuiltins = builtinsPolyfills();
30
+ const polyfilledBuiltinsNames = [...polyfilledBuiltins.keys()];
31
+
32
+ return {
33
+ name,
34
+ setup: function setup({onLoad, onResolve, initialOptions}) {
35
+ // polyfills contain global keyword, it must be defined
36
+ if (initialOptions?.define && !initialOptions.define?.global) {
37
+ initialOptions.define['global'] = 'globalThis';
38
+ } else if (!initialOptions?.define) {
39
+ initialOptions.define = {global: 'globalThis'};
40
+ }
41
+
42
+ // TODO these polyfill module cannot import anything, is that ok?
43
+ async function loader(
44
+ args
45
+ ) {
46
+ try {
47
+ const isCommonjs = args.namespace.endsWith('commonjs');
48
+
49
+ const key = removeEndingSlash(args.path);
50
+ const contents = polyfilledBuiltins.get(key) || polyfillLib[key + '.js'];
51
+ const resolveDir = path.dirname(key);
52
+
53
+ if (isCommonjs) {
54
+ return {
55
+ loader: 'js',
56
+ contents: commonJsTemplate({
57
+ importPath: args.path,
58
+ }),
59
+ resolveDir,
60
+ };
61
+ }
62
+ return {
63
+ loader: 'js',
64
+ contents,
65
+ resolveDir,
66
+ };
67
+ } catch (e) {
68
+ console.error('node-modules-polyfill', e);
69
+ return {
70
+ contents: `export {}`,
71
+ loader: 'js',
72
+ };
73
+ }
74
+ }
75
+ onLoad({filter: /.*/, namespace}, loader);
76
+ onLoad({filter: /.*/, namespace: commonjsNamespace}, loader);
77
+ const filter = new RegExp(
78
+ polyfilledBuiltinsNames.map(escapeStringRegexp).join('|') // TODO builtins could end with slash, keep in mind in regex
79
+ );
80
+ async function resolver(args) {
81
+ const ignoreRequire = args.namespace === commonjsNamespace;
82
+
83
+ let key;
84
+ if (args.path.startsWith('\0polyfill-node.')) {
85
+ key = args.path.replace('\0polyfill-node.', '');
86
+ } else {
87
+ if (args.path.startsWith('.')) {
88
+ key = path.join(path.dirname(args.importer), args.path);
89
+ } else {
90
+ key = args.path;
91
+ }
92
+ }
93
+
94
+ if (!polyfilledBuiltins.has(key) && !polyfillLib[key + '.js']) {
95
+ return;
96
+ }
97
+
98
+ const isCommonjs =
99
+ !ignoreRequire && args.kind === 'require-call';
100
+
101
+ return {
102
+ namespace: isCommonjs ? commonjsNamespace : namespace,
103
+ path: key,
104
+ };
105
+ }
106
+ onResolve({filter}, resolver);
107
+ onResolve({filter: /.*/, namespace}, resolver);
108
+ },
109
+ };
110
+ }
111
+
112
+ function commonJsTemplate({importPath}) {
113
+ return `
114
+ const polyfill = require('${importPath}')
115
+
116
+ if (polyfill && polyfill.default) {
117
+ module.exports = polyfill.default
118
+ for (let k in polyfill) {
119
+ module.exports[k] = polyfill[k]
120
+ }
121
+ } else if (polyfill) {
122
+ module.exports = polyfill
123
+ }
124
+
125
+
126
+ `;
127
+ }
128
+
129
+ export {nodeModulesPolyfillPlugin};
package/tsconfig.json CHANGED
@@ -21,6 +21,7 @@
21
21
  "./types/**/*.d.ts",
22
22
  "eslint-local-rules.cjs",
23
23
  "third-party/axe/valid-langs.js",
24
+ "third-party/esbuild-plugins-polyfills/esbuild-polyfills.js",
24
25
 
25
26
  "core/test/results/sample_v2.json",
26
27
  "core/test/fixtures/unresolved-perflog.json",
@@ -24,23 +24,14 @@ import Protocol from './protocol.js';
24
24
  import Util from './utility-types.js';
25
25
  import Audit from './audit.js';
26
26
 
27
- export interface Artifacts extends BaseArtifacts, GathererArtifacts {}
28
-
29
- export type FRArtifacts = Util.StrictOmit<Artifacts,
30
- | 'Fonts'
31
- | 'Manifest'
32
- | 'MixedContent'
33
- | keyof FRBaseArtifacts
34
- >;
27
+ export type Artifacts = BaseArtifacts & GathererArtifacts;
35
28
 
36
29
  /**
37
30
  * Artifacts always created by gathering. These artifacts are available to Lighthouse plugins.
38
31
  * NOTE: any breaking changes here are considered breaking Lighthouse changes that must be done
39
32
  * on a major version bump.
40
33
  */
41
- export type BaseArtifacts = UniversalBaseArtifacts & ContextualBaseArtifacts & LegacyBaseArtifacts
42
-
43
- export type FRBaseArtifacts = UniversalBaseArtifacts & ContextualBaseArtifacts;
34
+ export type BaseArtifacts = UniversalBaseArtifacts & ContextualBaseArtifacts;
44
35
 
45
36
  /**
46
37
  * The set of base artifacts that are available in every mode of Lighthouse operation.
@@ -76,18 +67,6 @@ interface ContextualBaseArtifacts {
76
67
  PageLoadError: LighthouseError | null;
77
68
  }
78
69
 
79
- /**
80
- * The set of base artifacts that were replaced by standard gatherers in Fraggle Rock.
81
- */
82
- interface LegacyBaseArtifacts {
83
- /** The user agent string that Lighthouse used to load the page. Set to the empty string if unknown. */
84
- NetworkUserAgent: string;
85
- /** A set of page-load traces, keyed by passName. */
86
- traces: {[passName: string]: Trace};
87
- /** A set of DevTools debugger protocol records, keyed by passName. */
88
- devtoolsLogs: {[passName: string]: DevtoolsLog};
89
- }
90
-
91
70
  /**
92
71
  * Artifacts provided by the default gatherers that are exposed to plugins with a hardended API.
93
72
  * NOTE: any breaking changes here are considered breaking Lighthouse changes that must be done
@@ -116,7 +95,7 @@ interface PublicGathererArtifacts {
116
95
  * Artifacts provided by the default gatherers. Augment this interface when adding additional
117
96
  * gatherers. Changes to these artifacts are not considered a breaking Lighthouse change.
118
97
  */
119
- export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArtifacts {
98
+ export interface GathererArtifacts extends PublicGathererArtifacts {
120
99
  /** The results of running the aXe accessibility tests on the page. */
121
100
  Accessibility: Artifacts.Accessibility;
122
101
  /** Array of all anchors on the page. */
@@ -127,7 +106,7 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
127
106
  CacheContents: string[];
128
107
  /** CSS coverage information for styles used by page's final state. */
129
108
  CSSUsage: {rules: Crdp.CSS.RuleUsage[], stylesheets: Artifacts.CSSStyleSheetInfo[]};
130
- /** The primary log of devtools protocol activity. Used in Fraggle Rock gathering. */
109
+ /** The primary log of devtools protocol activity. */
131
110
  DevtoolsLog: DevtoolsLog;
132
111
  /** Information on the document's doctype(or null if not present), specifically the name, publicId, and systemId.
133
112
  All properties default to an empty string if not present */
@@ -136,8 +115,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
136
115
  DOMStats: Artifacts.DOMStats;
137
116
  /** Relevant attributes and child properties of all <object>s, <embed>s and <applet>s in the page. */
138
117
  EmbeddedContent: Artifacts.EmbeddedContentInfo[];
139
- /** Information for font faces used in the page. */
140
- Fonts: Artifacts.Font[];
141
118
  /** Information on poorly sized font usage and the text affected by it. */
142
119
  FontSize: Artifacts.FontSize;
143
120
  /** All the input elements, including associated form and label elements. */
@@ -153,10 +130,8 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
153
130
  /** JS coverage information for code used during audit. Keyed by script id. */
154
131
  // 'url' is excluded because it can be overridden by a magic sourceURL= comment, which makes keeping it a dangerous footgun!
155
132
  JsUsage: Record<string, Omit<Crdp.Profiler.ScriptCoverage, 'url'>>;
156
- /** Parsed version of the page's Web App Manifest, or null if none found. */
157
- Manifest: Artifacts.Manifest | null;
158
- /** The URL loaded with interception */
159
- MixedContent: {url: string};
133
+ /** The user agent string that Lighthouse used to load the page. Set to the empty string if unknown. */
134
+ NetworkUserAgent: string;
160
135
  /** Size and compression opportunity information for all the images in the page. */
161
136
  OptimizedImages: Array<Artifacts.OptimizedImage | Artifacts.OptimizedImageError>;
162
137
  /** Size info of all network records sent without compression and their size after gzipping. */
@@ -175,12 +150,16 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
175
150
  TagsBlockingFirstPaint: Artifacts.TagBlockingFirstPaint[];
176
151
  /** Information about tap targets including their position and size. */
177
152
  TapTargets: Artifacts.TapTarget[];
178
- /** The primary log of devtools protocol activity. Used in Fraggle Rock gathering. */
153
+ /** The primary trace taken over the entire run. */
179
154
  Trace: Trace;
180
155
  /** Elements associated with metrics (ie: Largest Contentful Paint element). */
181
156
  TraceElements: Artifacts.TraceElement[];
182
157
  /** Parsed version of the page's Web App Manifest, or null if none found. */
183
158
  WebAppManifest: Artifacts.Manifest | null;
159
+ /** COMPAT: A set of traces, keyed by passName. */
160
+ traces: {[passName: string]: Trace};
161
+ /** COMPAT: A set of DevTools debugger protocol records, keyed by passName. */
162
+ devtoolsLogs: {[passName: string]: DevtoolsLog};
184
163
  }
185
164
 
186
165
  declare module Artifacts {
@@ -426,18 +405,6 @@ declare module Artifacts {
426
405
  notRestoredReasonsTree: BFCacheNotRestoredReasonsTree;
427
406
  }
428
407
 
429
- interface Font {
430
- display: string;
431
- family: string;
432
- featureSettings: string;
433
- stretch: string;
434
- style: string;
435
- unicodeRange: string;
436
- variant: string;
437
- weight: string;
438
- src?: string[];
439
- }
440
-
441
408
  interface FontSize {
442
409
  totalTextLength: number;
443
410
  failingTextLength: number;
@@ -728,7 +695,7 @@ declare module Artifacts {
728
695
  mainFrameInfo: {startingPid: number, frameId: string};
729
696
  /** The list of frames committed in the trace. */
730
697
  frames: Array<{id: string, url: string}>;
731
- /** The trace event marking the time at which the run should consider to have begun. Typically the same as the navigationStart but might differ due to SPA navigations, client-side redirects, etc. In the FR timespan case, this event is injected by Lighthouse itself. */
698
+ /** The trace event marking the time at which the run should consider to have begun. Typically the same as the navigationStart but might differ due to SPA navigations, client-side redirects, etc. In the timespan case, this event is injected by Lighthouse itself. */
732
699
  timeOriginEvt: TraceEvent;
733
700
  /** All received trace events subsetted to important categories. */
734
701
  _keyEvents: Array<TraceEvent>;
package/types/config.d.ts CHANGED
@@ -20,30 +20,14 @@ interface ClassOf<T> {
20
20
  interface Config {
21
21
  extends?: 'lighthouse:default' | string;
22
22
  settings?: SharedFlagsSettings;
23
+ artifacts?: Config.ArtifactJson[] | null;
23
24
  audits?: Config.AuditJson[] | null;
24
25
  categories?: Record<string, Config.CategoryJson> | null;
25
26
  groups?: Record<string, Config.GroupJson> | null;
26
27
  plugins?: Array<string>;
27
-
28
- // Fraggle Rock Only
29
- artifacts?: Config.ArtifactJson[] | null;
30
-
31
- // Legacy Only
32
- passes?: Config.PassJson[] | null;
33
28
  }
34
29
 
35
30
  declare module Config {
36
- /**
37
- * The normalized and fully resolved legacy config.
38
- */
39
- interface LegacyResolvedConfig {
40
- settings: Settings;
41
- passes: Pass[] | null;
42
- audits: AuditDefn[] | null;
43
- categories: Record<string, Category> | null;
44
- groups: Record<string, Group> | null;
45
- }
46
-
47
31
  /**
48
32
  * The normalized and fully resolved config.
49
33
  */
@@ -78,17 +62,6 @@ declare module Config {
78
62
  blankPage?: string;
79
63
  }
80
64
 
81
- interface PassJson extends SharedPassNavigationJson {
82
- /** The identifier for the pass. Config extension will deduplicate passes with the same passName. */
83
- passName: string;
84
- /** Whether a trace and devtoolsLog should be recorded for the pass. */
85
- recordTrace?: boolean;
86
- /** Whether throttling settings should be used for the pass. */
87
- useThrottling?: boolean;
88
- /** The array of gatherers to run during the pass. */
89
- gatherers?: GathererJson[];
90
- }
91
-
92
65
  interface NavigationJson extends SharedPassNavigationJson {
93
66
  /** The identifier for the navigation. Config extension will deduplicate navigations with the same id. */
94
67
  id: string;
@@ -102,22 +75,17 @@ declare module Config {
102
75
 
103
76
  interface ArtifactJson {
104
77
  id: string;
105
- gatherer: FRGathererJson;
78
+ gatherer: GathererJson;
106
79
  }
107
80
 
108
81
  type GathererJson = {
109
82
  path: string;
110
- options?: {};
111
83
  } | {
112
84
  implementation: ClassOf<Gatherer.GathererInstance>;
113
- options?: {};
114
85
  } | {
115
86
  instance: Gatherer.GathererInstance;
116
- options?: {};
117
87
  } | Gatherer.GathererInstance | ClassOf<Gatherer.GathererInstance> | string;
118
88
 
119
- type FRGathererJson = string | {instance: Gatherer.FRGathererInstance}
120
-
121
89
  interface CategoryJson {
122
90
  title: string | IcuMessage;
123
91
  auditRefs: AuditRefJson[];
@@ -153,17 +121,13 @@ declare module Config {
153
121
 
154
122
  type Settings = ConfigSettings;
155
123
 
156
- interface Pass extends Required<PassJson> {
157
- gatherers: GathererDefn[];
158
- }
159
-
160
124
  interface NavigationDefn extends Omit<Required<NavigationJson>, 'artifacts'> {
161
125
  artifacts: AnyArtifactDefn[];
162
126
  }
163
127
 
164
128
  interface ArtifactDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
165
129
  id: string;
166
- gatherer: FRGathererDefn<TDependencies>;
130
+ gatherer: GathererDefn<TDependencies>;
167
131
  dependencies?: TDependencies extends Gatherer.DefaultDependenciesKey ?
168
132
  undefined :
169
133
  Record<Exclude<TDependencies, Gatherer.DefaultDependenciesKey>, {id: string}>;
@@ -176,24 +140,18 @@ declare module Config {
176
140
  ArtifactDefn<TDependencies>
177
141
  type AnyArtifactDefn = ArtifactDefnExpander<Gatherer.DefaultDependenciesKey>|ArtifactDefnExpander<Gatherer.DependencyKey>
178
142
 
179
- interface FRGathererDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
180
- implementation?: ClassOf<Gatherer.FRGathererInstance<TDependencies>>;
181
- instance: Gatherer.FRGathererInstance<TDependencies>;
143
+ interface GathererDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
144
+ implementation?: ClassOf<Gatherer.GathererInstance<TDependencies>>;
145
+ instance: Gatherer.GathererInstance<TDependencies>;
182
146
  path?: string;
183
147
  }
184
148
 
185
- type FRGathererDefnExpander<TDependencies extends Gatherer.DependencyKey> =
149
+ type GathererDefnExpander<TDependencies extends Gatherer.DependencyKey> =
186
150
  // Lack of brackets intentional here to convert to the union of all individual dependencies.
187
151
  TDependencies extends Gatherer.DefaultDependenciesKey ?
188
- FRGathererDefn<Gatherer.DefaultDependenciesKey> :
189
- FRGathererDefn<TDependencies>
190
- type AnyFRGathererDefn = FRGathererDefnExpander<Gatherer.DefaultDependenciesKey>|FRGathererDefnExpander<Gatherer.DependencyKey>
191
-
192
- interface GathererDefn {
193
- implementation?: ClassOf<Gatherer.GathererInstance>;
194
- instance: Gatherer.GathererInstance;
195
- path?: string;
196
- }
152
+ GathererDefn<Gatherer.DefaultDependenciesKey> :
153
+ GathererDefn<TDependencies>
154
+ type AnyGathererDefn = GathererDefnExpander<Gatherer.DefaultDependenciesKey>|GathererDefnExpander<Gatherer.DependencyKey>
197
155
 
198
156
  interface AuditDefn {
199
157
  implementation: typeof Audit;
@@ -53,8 +53,6 @@ export interface CliFlags extends Flags {
53
53
  verbose: boolean;
54
54
  /** A flag to enable logLevel 'silent'. */
55
55
  quiet: boolean;
56
- /** Use the legacy navigation runner to gather CLI results. */
57
- legacyNavigation: boolean;
58
56
  /** Path to the file where precomputed lantern data should be read from. */
59
57
  precomputedLanternDataPath?: string;
60
58
  /** Path to the file where precomputed lantern data should be written to. */
@@ -10,14 +10,12 @@ import {ProtocolMapping as CrdpMappings} from 'devtools-protocol/types/protocol-
10
10
  import {NetworkNode as _NetworkNode} from '../core/lib/dependency-graph/network-node.js';
11
11
  import {CPUNode as _CPUNode} from '../core/lib/dependency-graph/cpu-node.js';
12
12
  import {Simulator as _Simulator} from '../core/lib/dependency-graph/simulator/simulator.js';
13
- import {Driver} from '../core/legacy/gather/driver.js';
14
13
  import {ExecutionContext} from '../core/gather/driver/execution-context.js';
15
14
  import {Fetcher} from '../core/gather/fetcher.js';
16
15
  import {ArbitraryEqualityMap} from '../core/lib/arbitrary-equality-map.js';
17
16
 
18
- import {Artifacts, BaseArtifacts, FRBaseArtifacts, GathererArtifacts, DevtoolsLog, Trace} from './artifacts.js';
17
+ import {Artifacts, BaseArtifacts, GathererArtifacts, DevtoolsLog, Trace} from './artifacts.js';
19
18
  import Config from './config.js';
20
- import {IcuMessage} from './lhr/i18n.js';
21
19
  import Result from './lhr/lhr.js';
22
20
  import Protocol from './protocol.js';
23
21
  import Puppeteer from './puppeteer.js';
@@ -27,7 +25,7 @@ type CrdpCommands = CrdpMappings.Commands;
27
25
 
28
26
  declare module Gatherer {
29
27
  /** The Lighthouse wrapper around a raw CDP session. */
30
- interface FRProtocolSession {
28
+ interface ProtocolSession {
31
29
  setTargetInfo(targetInfo: Crdp.Target.TargetInfo): void;
32
30
  hasNextProtocolTimeout(): boolean;
33
31
  getNextProtocolTimeout(): number;
@@ -39,30 +37,28 @@ declare module Gatherer {
39
37
  dispose(): Promise<void>;
40
38
  }
41
39
 
42
- /** The limited driver interface shared between pre and post Fraggle Rock Lighthouse. */
43
- interface FRTransitionalDriver {
44
- defaultSession: FRProtocolSession;
40
+ interface Driver {
41
+ defaultSession: ProtocolSession;
45
42
  executionContext: ExecutionContext;
46
43
  fetcher: Fetcher;
47
44
  url: () => Promise<string>;
48
45
  targetManager: {
49
- rootSession(): FRProtocolSession;
46
+ rootSession(): ProtocolSession;
50
47
  mainFrameExecutionContexts(): Array<Crdp.Runtime.ExecutionContextDescription>;
51
48
  on(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
52
49
  off(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
53
50
  };
54
51
  }
55
52
 
56
- /** The limited context interface shared between pre and post Fraggle Rock Lighthouse. */
57
- interface FRTransitionalContext<TDependencies extends DependencyKey = DefaultDependenciesKey> {
53
+ interface Context<TDependencies extends DependencyKey = DefaultDependenciesKey> {
58
54
  /** The gather mode Lighthouse is currently in. */
59
55
  gatherMode: GatherMode;
60
56
  /** The connection to the page being analyzed. */
61
- driver: FRTransitionalDriver;
57
+ driver: Driver;
62
58
  /** The Puppeteer page handle. Will be undefined in legacy navigation mode. */
63
59
  page?: Puppeteer.Page;
64
60
  /** The set of base artifacts that are always collected. */
65
- baseArtifacts: FRBaseArtifacts;
61
+ baseArtifacts: BaseArtifacts;
66
62
  /** The cached results of computed artifacts. */
67
63
  computedCache: Map<string, ArbitraryEqualityMap>;
68
64
  /** The set of available dependencies requested by the current gatherer. */
@@ -71,7 +67,7 @@ declare module Gatherer {
71
67
  settings: Config.Settings;
72
68
  }
73
69
 
74
- interface FRGatherResult {
70
+ interface GatherResult {
75
71
  artifacts: Artifacts;
76
72
  runnerOptions: {
77
73
  resolvedConfig: Config.ResolvedConfig;
@@ -79,19 +75,6 @@ declare module Gatherer {
79
75
  }
80
76
  }
81
77
 
82
- interface PassContext {
83
- gatherMode: 'navigation';
84
- /** The url of the currently loaded page. If the main document redirects, this will be updated to keep track. */
85
- url: string;
86
- driver: Driver;
87
- passConfig: Config.Pass
88
- settings: Config.Settings;
89
- computedCache: Map<string, ArbitraryEqualityMap>
90
- /** Gatherers can push to this array to add top-level warnings to the LHR. */
91
- LighthouseRunWarnings: Array<string | IcuMessage>;
92
- baseArtifacts: BaseArtifacts;
93
- }
94
-
95
78
  interface LoadData {
96
79
  networkRecords: Array<Artifacts.NetworkRequest>;
97
80
  devtoolsLog: DevtoolsLog;
@@ -129,31 +112,23 @@ declare module Gatherer {
129
112
  GathererMetaNoDependencies :
130
113
  GathererMetaWithDependencies<Exclude<TDependencies, DefaultDependenciesKey>>;
131
114
 
132
- interface GathererInstance {
133
- name: keyof GathererArtifacts;
134
- beforePass(context: Gatherer.PassContext): PhaseResult;
135
- pass(context: Gatherer.PassContext): PhaseResult;
136
- afterPass(context: Gatherer.PassContext, loadData: Gatherer.LoadData): PhaseResult;
137
- }
138
-
139
- type FRGatherPhase = keyof Omit<Gatherer.FRGathererInstance, 'name'|'meta'>
115
+ type GatherPhase = keyof Omit<Gatherer.GathererInstance, 'name'|'meta'>
140
116
 
141
- interface FRGathererInstance<TDependencies extends DependencyKey = DefaultDependenciesKey> {
142
- name: keyof GathererArtifacts; // temporary COMPAT measure until artifact config support is available
117
+ interface GathererInstance<TDependencies extends DependencyKey = DefaultDependenciesKey> {
143
118
  meta: GathererMeta<TDependencies>;
144
- startInstrumentation(context: FRTransitionalContext<DefaultDependenciesKey>): Promise<void>|void;
145
- startSensitiveInstrumentation(context: FRTransitionalContext<DefaultDependenciesKey>): Promise<void>|void;
146
- stopSensitiveInstrumentation(context: FRTransitionalContext<DefaultDependenciesKey>): Promise<void>|void;
147
- stopInstrumentation(context: FRTransitionalContext<DefaultDependenciesKey>): Promise<void>|void;
148
- getArtifact(context: FRTransitionalContext<TDependencies>): PhaseResult;
119
+ startInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
120
+ startSensitiveInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
121
+ stopSensitiveInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
122
+ stopInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
123
+ getArtifact(context: Context<TDependencies>): PhaseResult;
149
124
  }
150
125
 
151
- type FRGathererInstanceExpander<TDependencies extends Gatherer.DependencyKey> =
126
+ type GathererInstanceExpander<TDependencies extends Gatherer.DependencyKey> =
152
127
  // Lack of brackets intentional here to convert to the union of all individual dependencies.
153
128
  TDependencies extends Gatherer.DefaultDependenciesKey ?
154
- FRGathererInstance<Gatherer.DefaultDependenciesKey> :
155
- FRGathererInstance<Exclude<TDependencies, DefaultDependenciesKey>>
156
- type AnyFRGathererInstance = FRGathererInstanceExpander<Gatherer.DependencyKey>
129
+ GathererInstance<Gatherer.DefaultDependenciesKey> :
130
+ GathererInstance<Exclude<TDependencies, DefaultDependenciesKey>>
131
+ type AnyGathererInstance = GathererInstanceExpander<Gatherer.DependencyKey>
157
132
 
158
133
  namespace Simulation {
159
134
  type GraphNode = import('../core/lib/dependency-graph/base-node.js').Node;
package/types/lh.d.ts CHANGED
@@ -35,8 +35,6 @@ export import Puppeteer = Puppeteer_;
35
35
  // artifacts.d.ts
36
36
  export import Artifacts = Artifacts_.Artifacts;
37
37
  export import BaseArtifacts = Artifacts_.BaseArtifacts;
38
- export import FRArtifacts = Artifacts_.FRArtifacts;
39
- export import FRBaseArtifacts = Artifacts_.FRBaseArtifacts;
40
38
  export import GathererArtifacts = Artifacts_.GathererArtifacts;
41
39
  export import DevtoolsLog = Artifacts_.DevtoolsLog;
42
40
  export import Trace = Artifacts_.Trace;