lighthouse 10.4.0 → 11.0.0
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/CONTRIBUTING.md +1 -1
- package/cli/cli-flags.d.ts +1 -6
- package/cli/cli-flags.js +0 -5
- package/cli/run.js +3 -10
- package/cli/sentry-prompt.js +4 -2
- package/cli/test/smokehouse/core-tests.js +0 -2
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +24 -14
- package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +1 -2
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +12 -21
- package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +1 -3
- package/cli/test/smokehouse/lighthouse-runners/cli.js +3 -7
- package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +1 -5
- package/cli/test/smokehouse/lighthouse-runners/devtools.js +1 -12
- package/cli/test/smokehouse/readme.md +0 -2
- package/cli/test/smokehouse/report-assert.d.ts +1 -3
- package/cli/test/smokehouse/report-assert.js +2 -19
- package/cli/test/smokehouse/smokehouse.js +3 -32
- package/core/audits/accessibility/aria-allowed-role.d.ts +10 -0
- package/core/audits/accessibility/aria-allowed-role.js +46 -0
- package/core/audits/accessibility/image-redundant-alt.d.ts +10 -0
- package/core/audits/accessibility/image-redundant-alt.js +45 -0
- package/core/audits/accessibility/label-content-name-mismatch.d.ts +10 -0
- package/core/audits/accessibility/label-content-name-mismatch.js +44 -0
- package/core/audits/accessibility/skip-link.d.ts +10 -0
- package/core/audits/accessibility/skip-link.js +43 -0
- package/core/audits/accessibility/table-duplicate-name.d.ts +10 -0
- package/core/audits/accessibility/table-duplicate-name.js +44 -0
- package/core/audits/accessibility/target-size.js +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.js +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.js +1 -0
- package/core/audits/dobetterweb/uses-http2.d.ts +18 -1
- package/core/audits/dobetterweb/uses-http2.js +62 -16
- package/core/audits/installable-manifest.d.ts +1 -5
- package/core/audits/installable-manifest.js +2 -7
- package/core/audits/largest-contentful-paint-element.d.ts +0 -6
- package/core/audits/largest-contentful-paint-element.js +13 -15
- package/core/audits/metrics/{experimental-interaction-to-next-paint.d.ts → interaction-to-next-paint.d.ts} +3 -3
- package/core/audits/metrics/{experimental-interaction-to-next-paint.js → interaction-to-next-paint.js} +3 -3
- package/core/audits/uses-rel-preconnect.js +23 -8
- package/core/audits/work-during-interaction.js +2 -2
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/config/config-helpers.d.ts +3 -3
- package/core/config/config-helpers.js +5 -12
- package/core/config/config.js +1 -7
- package/core/config/constants.d.ts +0 -2
- package/core/config/constants.js +2 -18
- package/core/config/default-config.js +59 -53
- package/core/config/filters.js +1 -1
- package/core/config/validation.d.ts +7 -12
- package/core/config/validation.js +16 -26
- package/core/gather/base-artifacts.d.ts +4 -4
- package/core/gather/base-artifacts.js +2 -6
- package/core/gather/base-gatherer.d.ts +12 -37
- package/core/gather/base-gatherer.js +7 -54
- package/core/gather/driver/dom.d.ts +4 -4
- package/core/gather/driver/dom.js +2 -2
- package/core/gather/driver/environment.d.ts +4 -4
- package/core/gather/driver/environment.js +2 -2
- package/core/gather/driver/execution-context.d.ts +12 -3
- package/core/gather/driver/execution-context.js +34 -3
- package/core/gather/driver/navigation.d.ts +2 -2
- package/core/gather/driver/navigation.js +2 -5
- package/core/gather/driver/network-monitor.d.ts +7 -6
- package/core/gather/driver/network-monitor.js +4 -4
- package/core/gather/driver/network.d.ts +2 -2
- package/core/gather/driver/network.js +1 -1
- package/core/gather/driver/prepare.d.ts +10 -10
- package/core/gather/driver/prepare.js +10 -10
- package/core/gather/driver/service-workers.d.ts +4 -4
- package/core/gather/driver/service-workers.js +2 -2
- package/core/gather/driver/storage.d.ts +6 -6
- package/core/gather/driver/storage.js +3 -3
- package/core/gather/driver/target-manager.d.ts +6 -5
- package/core/gather/driver/target-manager.js +3 -3
- package/core/gather/driver/wait-for-condition.d.ts +14 -14
- package/core/gather/driver/wait-for-condition.js +8 -8
- package/core/gather/driver.d.ts +9 -6
- package/core/gather/driver.js +14 -4
- package/core/gather/fetcher.d.ts +3 -3
- package/core/gather/fetcher.js +1 -1
- package/core/gather/gatherers/accessibility.d.ts +4 -4
- package/core/gather/gatherers/accessibility.js +8 -3
- package/core/gather/gatherers/anchor-elements.d.ts +4 -4
- package/core/gather/gatherers/anchor-elements.js +4 -4
- package/core/gather/gatherers/bf-cache-failures.d.ts +8 -14
- package/core/gather/gatherers/bf-cache-failures.js +5 -14
- package/core/gather/gatherers/cache-contents.d.ts +4 -4
- package/core/gather/gatherers/cache-contents.js +3 -3
- package/core/gather/gatherers/console-messages.d.ts +6 -6
- package/core/gather/gatherers/console-messages.js +4 -4
- package/core/gather/gatherers/css-usage.d.ts +14 -14
- package/core/gather/gatherers/css-usage.js +9 -9
- package/core/gather/gatherers/devtools-log-compat.d.ts +5 -5
- package/core/gather/gatherers/devtools-log-compat.js +4 -4
- package/core/gather/gatherers/devtools-log.d.ts +6 -6
- package/core/gather/gatherers/devtools-log.js +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +10 -22
- package/core/gather/gatherers/dobetterweb/optimized-images.js +10 -27
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +6 -12
- package/core/gather/gatherers/dobetterweb/response-compression.js +14 -21
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +8 -14
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +5 -14
- package/core/gather/gatherers/full-page-screenshot.d.ts +10 -10
- package/core/gather/gatherers/full-page-screenshot.js +7 -10
- package/core/gather/gatherers/global-listeners.d.ts +4 -4
- package/core/gather/gatherers/global-listeners.js +3 -3
- package/core/gather/gatherers/iframe-elements.d.ts +4 -4
- package/core/gather/gatherers/iframe-elements.js +3 -3
- package/core/gather/gatherers/image-elements.d.ts +10 -10
- package/core/gather/gatherers/image-elements.js +6 -6
- package/core/gather/gatherers/inputs.d.ts +4 -4
- package/core/gather/gatherers/inputs.js +3 -3
- package/core/gather/gatherers/inspector-issues.d.ts +8 -19
- package/core/gather/gatherers/inspector-issues.js +9 -26
- package/core/gather/gatherers/installability-errors.d.ts +6 -6
- package/core/gather/gatherers/installability-errors.js +4 -4
- package/core/gather/gatherers/js-usage.d.ts +6 -6
- package/core/gather/gatherers/js-usage.js +4 -4
- package/core/gather/gatherers/link-elements.d.ts +8 -20
- package/core/gather/gatherers/link-elements.js +7 -24
- package/core/gather/gatherers/main-document-content.d.ts +4 -16
- package/core/gather/gatherers/main-document-content.js +5 -23
- package/core/gather/gatherers/meta-elements.d.ts +4 -4
- package/core/gather/gatherers/meta-elements.js +3 -3
- package/core/gather/gatherers/network-user-agent.d.ts +5 -5
- package/core/gather/gatherers/network-user-agent.js +4 -4
- package/core/gather/gatherers/script-elements.d.ts +6 -11
- package/core/gather/gatherers/script-elements.js +4 -13
- package/core/gather/gatherers/scripts.d.ts +7 -6
- package/core/gather/gatherers/scripts.js +7 -9
- package/core/gather/gatherers/seo/embedded-content.d.ts +4 -4
- package/core/gather/gatherers/seo/embedded-content.js +3 -3
- package/core/gather/gatherers/seo/font-size.d.ts +6 -6
- package/core/gather/gatherers/seo/font-size.js +5 -5
- package/core/gather/gatherers/seo/robots-txt.d.ts +4 -4
- package/core/gather/gatherers/seo/robots-txt.js +3 -3
- package/core/gather/gatherers/seo/tap-targets.d.ts +8 -8
- package/core/gather/gatherers/seo/tap-targets.js +5 -5
- package/core/gather/gatherers/service-worker.d.ts +4 -10
- package/core/gather/gatherers/service-worker.js +3 -15
- package/core/gather/gatherers/source-maps.d.ts +11 -23
- package/core/gather/gatherers/source-maps.js +22 -53
- package/core/gather/gatherers/stacks.d.ts +7 -7
- package/core/gather/gatherers/stacks.js +6 -6
- package/core/gather/gatherers/trace-compat.d.ts +5 -5
- package/core/gather/gatherers/trace-compat.js +4 -4
- package/core/gather/gatherers/trace-elements.d.ts +13 -25
- package/core/gather/gatherers/trace-elements.js +19 -32
- package/core/gather/gatherers/trace.d.ts +8 -8
- package/core/gather/gatherers/trace.js +5 -5
- package/core/gather/gatherers/viewport-dimensions.d.ts +4 -4
- package/core/gather/gatherers/viewport-dimensions.js +3 -3
- package/core/gather/gatherers/web-app-manifest.d.ts +8 -8
- package/core/gather/gatherers/web-app-manifest.js +5 -5
- package/core/gather/navigation-runner.d.ts +9 -9
- package/core/gather/navigation-runner.js +14 -8
- package/core/gather/runner-helpers.d.ts +3 -3
- package/core/gather/runner-helpers.js +12 -4
- package/core/gather/session.d.ts +2 -2
- package/core/gather/session.js +1 -1
- package/core/gather/snapshot-runner.d.ts +2 -2
- package/core/gather/snapshot-runner.js +1 -1
- package/core/gather/timespan-runner.d.ts +2 -2
- package/core/gather/timespan-runner.js +1 -1
- package/core/index.cjs +0 -7
- package/core/index.d.ts +0 -15
- package/core/index.js +2 -40
- package/core/lib/asset-saver.js +14 -4
- package/core/lib/axe.js +1 -1
- package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +28 -12
- package/core/lib/dependency-graph/simulator/network-analyzer.js +128 -100
- package/core/lib/emulation.d.ts +14 -14
- package/core/lib/emulation.js +7 -7
- package/core/lib/navigation-error.js +5 -0
- package/core/lib/network-recorder.d.ts +2 -1
- package/core/lib/network-recorder.js +1 -0
- package/core/lib/network-request.js +12 -3
- package/core/lib/page-functions.d.ts +10 -2
- package/core/lib/page-functions.js +85 -8
- package/core/lib/sentry.js +9 -2
- package/core/lib/stack-packs.js +4 -0
- package/core/runner.d.ts +8 -30
- package/core/runner.js +8 -39
- package/core/user-flow.d.ts +4 -4
- package/core/user-flow.js +2 -2
- package/dist/report/bundle.esm.js +2221 -5832
- package/dist/report/flow.js +2631 -235
- package/dist/report/standalone.js +2586 -234
- package/flow-report/src/i18n/i18n.d.ts +2 -2
- package/package.json +17 -24
- package/readme.md +3 -1
- package/report/assets/templates.html +3 -1
- package/report/renderer/category-renderer.d.ts +3 -2
- package/report/renderer/category-renderer.js +8 -4
- package/report/renderer/components.js +11 -5
- package/report/renderer/pwa-category-renderer.js +1 -1
- package/report/renderer/report-ui-features.js +9 -6
- package/report/renderer/report-utils.d.ts +1 -1
- package/report/renderer/report-utils.js +2 -2
- package/report/renderer/topbar-features.js +3 -0
- package/shared/localization/locales/ar-XB.json +185 -44
- package/shared/localization/locales/ar.json +185 -44
- package/shared/localization/locales/bg.json +185 -44
- package/shared/localization/locales/ca.json +190 -49
- package/shared/localization/locales/cs.json +185 -44
- package/shared/localization/locales/da.json +185 -44
- package/shared/localization/locales/de.json +185 -44
- package/shared/localization/locales/el.json +185 -44
- package/shared/localization/locales/en-GB.json +185 -44
- package/shared/localization/locales/en-US.json +99 -45
- package/shared/localization/locales/en-XA.json +185 -44
- package/shared/localization/locales/en-XL.json +99 -45
- package/shared/localization/locales/es-419.json +185 -44
- package/shared/localization/locales/es.json +185 -44
- package/shared/localization/locales/fi.json +185 -44
- package/shared/localization/locales/fil.json +185 -44
- package/shared/localization/locales/fr.json +185 -44
- package/shared/localization/locales/he.json +186 -45
- package/shared/localization/locales/hi.json +185 -44
- package/shared/localization/locales/hr.json +185 -44
- package/shared/localization/locales/hu.json +185 -44
- package/shared/localization/locales/id.json +185 -44
- package/shared/localization/locales/it.json +185 -44
- package/shared/localization/locales/ja.json +185 -44
- package/shared/localization/locales/ko.json +185 -44
- package/shared/localization/locales/lt.json +185 -44
- package/shared/localization/locales/lv.json +185 -44
- package/shared/localization/locales/nl.json +185 -44
- package/shared/localization/locales/no.json +185 -44
- package/shared/localization/locales/pl.json +185 -44
- package/shared/localization/locales/pt-PT.json +185 -44
- package/shared/localization/locales/pt.json +190 -49
- package/shared/localization/locales/ro.json +185 -44
- package/shared/localization/locales/ru.json +185 -44
- package/shared/localization/locales/sk.json +185 -44
- package/shared/localization/locales/sl.json +185 -44
- package/shared/localization/locales/sr-Latn.json +185 -44
- package/shared/localization/locales/sr.json +185 -44
- package/shared/localization/locales/sv.json +185 -44
- package/shared/localization/locales/ta.json +185 -44
- package/shared/localization/locales/te.json +185 -44
- package/shared/localization/locales/th.json +185 -44
- package/shared/localization/locales/tr.json +185 -44
- package/shared/localization/locales/uk.json +185 -44
- package/shared/localization/locales/vi.json +185 -44
- package/shared/localization/locales/zh-HK.json +185 -44
- package/shared/localization/locales/zh-TW.json +185 -44
- package/shared/localization/locales/zh.json +185 -44
- package/third-party/esbuild-plugins-polyfills/LICENSE +3 -0
- package/third-party/esbuild-plugins-polyfills/README.md +7 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +9 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +129 -0
- package/tsconfig.json +2 -1
- package/types/artifacts.d.ts +16 -45
- package/types/config.d.ts +10 -52
- package/types/externs.d.ts +0 -2
- package/types/gatherer.d.ts +24 -47
- package/types/internal/rxjs.d.ts +26 -0
- package/types/internal/smokehouse.d.ts +1 -3
- package/types/lh.d.ts +0 -2
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/metrics/first-contentful-paint-3g.d.ts +0 -15
- package/core/audits/metrics/first-contentful-paint-3g.js +0 -69
- package/core/audits/resource-summary.d.ts +0 -16
- package/core/audits/resource-summary.js +0 -104
- package/core/audits/service-worker.d.ts +0 -46
- package/core/audits/service-worker.js +0 -182
- package/core/gather/gatherers/gatherer.d.ts +0 -46
- package/core/gather/gatherers/gatherer.js +0 -58
- package/core/legacy/config/config.d.ts +0 -107
- package/core/legacy/config/config.js +0 -566
- package/core/legacy/config/legacy-default-config.d.ts +0 -4
- package/core/legacy/config/legacy-default-config.js +0 -87
- package/core/legacy/gather/connections/connection.d.ts +0 -77
- package/core/legacy/gather/connections/connection.js +0 -196
- package/core/legacy/gather/connections/cri.d.ts +0 -27
- package/core/legacy/gather/connections/cri.js +0 -162
- package/core/legacy/gather/connections/raw.d.ts +0 -20
- package/core/legacy/gather/connections/raw.js +0 -57
- package/core/legacy/gather/driver.d.ts +0 -216
- package/core/legacy/gather/driver.js +0 -480
- package/core/legacy/gather/gather-runner.d.ts +0 -166
- package/core/legacy/gather/gather-runner.js +0 -590
- package/types/internal/lighthouse-logger.d.ts +0 -34
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
8
8
|
import {waitForFrameNavigated, waitForLoadEvent} from '../driver/wait-for-condition.js';
|
|
9
9
|
import DevtoolsLog from './devtools-log.js';
|
|
10
10
|
|
|
11
11
|
const AFTER_RETURN_TIMEOUT = 100;
|
|
12
12
|
const TEMP_PAGE_PAUSE_TIMEOUT = 100;
|
|
13
13
|
|
|
14
|
-
class BFCacheFailures extends
|
|
14
|
+
class BFCacheFailures extends BaseGatherer {
|
|
15
15
|
/** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
|
|
16
16
|
meta = {
|
|
17
17
|
supportedModes: ['navigation', 'timespan'],
|
|
@@ -83,7 +83,7 @@ class BFCacheFailures extends FRGatherer {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* @param {LH.Gatherer.
|
|
86
|
+
* @param {LH.Gatherer.Context} context
|
|
87
87
|
* @return {Promise<LH.Crdp.Page.BackForwardCacheNotUsedEvent|undefined>}
|
|
88
88
|
*/
|
|
89
89
|
async activelyCollectBFCacheEvent(context) {
|
|
@@ -137,7 +137,7 @@ class BFCacheFailures extends FRGatherer {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
|
-
* @param {LH.Gatherer.
|
|
140
|
+
* @param {LH.Gatherer.Context<'DevtoolsLog'>} context
|
|
141
141
|
* @return {LH.Crdp.Page.BackForwardCacheNotUsedEvent[]}
|
|
142
142
|
*/
|
|
143
143
|
passivelyCollectBFCacheEvents(context) {
|
|
@@ -151,7 +151,7 @@ class BFCacheFailures extends FRGatherer {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
* @param {LH.Gatherer.
|
|
154
|
+
* @param {LH.Gatherer.Context<'DevtoolsLog'>} context
|
|
155
155
|
* @return {Promise<LH.Artifacts['BFCacheFailures']>}
|
|
156
156
|
*/
|
|
157
157
|
async getArtifact(context) {
|
|
@@ -163,15 +163,6 @@ class BFCacheFailures extends FRGatherer {
|
|
|
163
163
|
|
|
164
164
|
return events.map(BFCacheFailures.processBFCacheEvent);
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
169
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
170
|
-
* @return {Promise<LH.Artifacts['BFCacheFailures']>}
|
|
171
|
-
*/
|
|
172
|
-
async afterPass(passContext, loadData) {
|
|
173
|
-
return this.getArtifact({...passContext, dependencies: {DevtoolsLog: loadData.devtoolsLog}});
|
|
174
|
-
}
|
|
175
166
|
}
|
|
176
167
|
|
|
177
168
|
export default BFCacheFailures;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export default CacheContents;
|
|
2
|
-
declare class CacheContents extends
|
|
2
|
+
declare class CacheContents extends BaseGatherer {
|
|
3
3
|
/**
|
|
4
4
|
* Creates an array of cached URLs.
|
|
5
|
-
* @param {LH.Gatherer.
|
|
5
|
+
* @param {LH.Gatherer.Context} passContext
|
|
6
6
|
* @return {Promise<LH.Artifacts['CacheContents']>}
|
|
7
7
|
*/
|
|
8
|
-
getArtifact(passContext: LH.Gatherer.
|
|
8
|
+
getArtifact(passContext: LH.Gatherer.Context): Promise<LH.Artifacts['CacheContents']>;
|
|
9
9
|
}
|
|
10
|
-
import
|
|
10
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
11
11
|
//# sourceMappingURL=cache-contents.d.ts.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
/* global caches */
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @return {Promise<Array<string>>}
|
|
@@ -36,7 +36,7 @@ function getCacheContents() {
|
|
|
36
36
|
}
|
|
37
37
|
/* c8 ignore stop */
|
|
38
38
|
|
|
39
|
-
class CacheContents extends
|
|
39
|
+
class CacheContents extends BaseGatherer {
|
|
40
40
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
41
41
|
meta = {
|
|
42
42
|
supportedModes: ['snapshot', 'navigation'],
|
|
@@ -44,7 +44,7 @@ class CacheContents extends FRGatherer {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Creates an array of cached URLs.
|
|
47
|
-
* @param {LH.Gatherer.
|
|
47
|
+
* @param {LH.Gatherer.Context} passContext
|
|
48
48
|
* @return {Promise<LH.Artifacts['CacheContents']>}
|
|
49
49
|
*/
|
|
50
50
|
async getArtifact(passContext) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ConsoleMessages;
|
|
2
|
-
declare class ConsoleMessages extends
|
|
2
|
+
declare class ConsoleMessages extends BaseGatherer {
|
|
3
3
|
/** @type {LH.Artifacts.ConsoleMessage[]} */
|
|
4
4
|
_logEntries: LH.Artifacts.ConsoleMessage[];
|
|
5
5
|
_onConsoleAPICalled: (event: LH.Crdp.Runtime.ConsoleAPICalledEvent) => void;
|
|
@@ -22,18 +22,18 @@ declare class ConsoleMessages extends FRGatherer {
|
|
|
22
22
|
*/
|
|
23
23
|
onLogEntry(event: LH.Crdp.Log.EntryAddedEvent): void;
|
|
24
24
|
/**
|
|
25
|
-
* @param {LH.Gatherer.
|
|
25
|
+
* @param {LH.Gatherer.Context} passContext
|
|
26
26
|
*/
|
|
27
|
-
startInstrumentation(passContext: LH.Gatherer.
|
|
27
|
+
startInstrumentation(passContext: LH.Gatherer.Context): Promise<void>;
|
|
28
28
|
/**
|
|
29
|
-
* @param {LH.Gatherer.
|
|
29
|
+
* @param {LH.Gatherer.Context} passContext
|
|
30
30
|
* @return {Promise<void>}
|
|
31
31
|
*/
|
|
32
|
-
stopInstrumentation({ driver }: LH.Gatherer.
|
|
32
|
+
stopInstrumentation({ driver }: LH.Gatherer.Context): Promise<void>;
|
|
33
33
|
/**
|
|
34
34
|
* @return {Promise<LH.Artifacts['ConsoleMessages']>}
|
|
35
35
|
*/
|
|
36
36
|
getArtifact(): Promise<LH.Artifacts['ConsoleMessages']>;
|
|
37
37
|
}
|
|
38
|
-
import
|
|
38
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
39
39
|
//# sourceMappingURL=console-messages.d.ts.map
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @param {LH.Crdp.Runtime.RemoteObject} obj
|
|
@@ -29,7 +29,7 @@ function remoteObjectToString(obj) {
|
|
|
29
29
|
return `[${type} ${className}]`;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
class ConsoleMessages extends
|
|
32
|
+
class ConsoleMessages extends BaseGatherer {
|
|
33
33
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
34
34
|
meta = {
|
|
35
35
|
supportedModes: ['timespan', 'navigation'],
|
|
@@ -134,7 +134,7 @@ class ConsoleMessages extends FRGatherer {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
|
-
* @param {LH.Gatherer.
|
|
137
|
+
* @param {LH.Gatherer.Context} passContext
|
|
138
138
|
*/
|
|
139
139
|
async startInstrumentation(passContext) {
|
|
140
140
|
const session = passContext.driver.defaultSession;
|
|
@@ -151,7 +151,7 @@ class ConsoleMessages extends FRGatherer {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
* @param {LH.Gatherer.
|
|
154
|
+
* @param {LH.Gatherer.Context} passContext
|
|
155
155
|
* @return {Promise<void>}
|
|
156
156
|
*/
|
|
157
157
|
async stopInstrumentation({driver}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default CSSUsage;
|
|
2
|
-
declare class CSSUsage extends
|
|
3
|
-
/** @type {LH.Gatherer.
|
|
4
|
-
_session: LH.Gatherer.
|
|
2
|
+
declare class CSSUsage extends BaseGatherer {
|
|
3
|
+
/** @type {LH.Gatherer.ProtocolSession|undefined} */
|
|
4
|
+
_session: LH.Gatherer.ProtocolSession | undefined;
|
|
5
5
|
/** @type {Map<string, Promise<LH.Artifacts.CSSStyleSheetInfo|Error>>} */
|
|
6
6
|
_sheetPromises: Map<string, Promise<LH.Artifacts.CSSStyleSheetInfo | Error>>;
|
|
7
7
|
/**
|
|
@@ -14,26 +14,26 @@ declare class CSSUsage extends FRGatherer {
|
|
|
14
14
|
*/
|
|
15
15
|
_onStylesheetAdded(event: LH.Crdp.CSS.StyleSheetAddedEvent): Promise<void>;
|
|
16
16
|
/**
|
|
17
|
-
* @param {LH.Gatherer.
|
|
17
|
+
* @param {LH.Gatherer.Context} context
|
|
18
18
|
*/
|
|
19
|
-
startCSSUsageTracking(context: LH.Gatherer.
|
|
19
|
+
startCSSUsageTracking(context: LH.Gatherer.Context): Promise<void>;
|
|
20
20
|
/**
|
|
21
|
-
* @param {LH.Gatherer.
|
|
21
|
+
* @param {LH.Gatherer.Context} context
|
|
22
22
|
*/
|
|
23
|
-
stopCSSUsageTracking(context: LH.Gatherer.
|
|
23
|
+
stopCSSUsageTracking(context: LH.Gatherer.Context): Promise<void>;
|
|
24
24
|
/**
|
|
25
|
-
* @param {LH.Gatherer.
|
|
25
|
+
* @param {LH.Gatherer.Context} context
|
|
26
26
|
*/
|
|
27
|
-
startInstrumentation(context: LH.Gatherer.
|
|
27
|
+
startInstrumentation(context: LH.Gatherer.Context): Promise<void>;
|
|
28
28
|
/**
|
|
29
|
-
* @param {LH.Gatherer.
|
|
29
|
+
* @param {LH.Gatherer.Context} context
|
|
30
30
|
*/
|
|
31
|
-
stopInstrumentation(context: LH.Gatherer.
|
|
31
|
+
stopInstrumentation(context: LH.Gatherer.Context): Promise<void>;
|
|
32
32
|
/**
|
|
33
|
-
* @param {LH.Gatherer.
|
|
33
|
+
* @param {LH.Gatherer.Context} context
|
|
34
34
|
* @return {Promise<LH.Artifacts['CSSUsage']>}
|
|
35
35
|
*/
|
|
36
|
-
getArtifact(context: LH.Gatherer.
|
|
36
|
+
getArtifact(context: LH.Gatherer.Context): Promise<LH.Artifacts['CSSUsage']>;
|
|
37
37
|
}
|
|
38
|
-
import
|
|
38
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
39
39
|
//# sourceMappingURL=css-usage.d.ts.map
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
import log from 'lighthouse-logger';
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
14
14
|
import {Sentry} from '../../lib/sentry.js';
|
|
15
15
|
|
|
16
|
-
class CSSUsage extends
|
|
16
|
+
class CSSUsage extends BaseGatherer {
|
|
17
17
|
constructor() {
|
|
18
18
|
super();
|
|
19
|
-
/** @type {LH.Gatherer.
|
|
19
|
+
/** @type {LH.Gatherer.ProtocolSession|undefined} */
|
|
20
20
|
this._session = undefined;
|
|
21
21
|
/** @type {Map<string, Promise<LH.Artifacts.CSSStyleSheetInfo|Error>>} */
|
|
22
22
|
this._sheetPromises = new Map();
|
|
@@ -51,7 +51,7 @@ class CSSUsage extends FRGatherer {
|
|
|
51
51
|
);
|
|
52
52
|
Sentry.captureException(err, {
|
|
53
53
|
tags: {
|
|
54
|
-
gatherer:
|
|
54
|
+
gatherer: 'CSSUsage',
|
|
55
55
|
},
|
|
56
56
|
extra: {
|
|
57
57
|
url: event.header.sourceURL,
|
|
@@ -64,7 +64,7 @@ class CSSUsage extends FRGatherer {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* @param {LH.Gatherer.
|
|
67
|
+
* @param {LH.Gatherer.Context} context
|
|
68
68
|
*/
|
|
69
69
|
async startCSSUsageTracking(context) {
|
|
70
70
|
const session = context.driver.defaultSession;
|
|
@@ -78,7 +78,7 @@ class CSSUsage extends FRGatherer {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* @param {LH.Gatherer.
|
|
81
|
+
* @param {LH.Gatherer.Context} context
|
|
82
82
|
*/
|
|
83
83
|
async stopCSSUsageTracking(context) {
|
|
84
84
|
const session = context.driver.defaultSession;
|
|
@@ -88,7 +88,7 @@ class CSSUsage extends FRGatherer {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* @param {LH.Gatherer.
|
|
91
|
+
* @param {LH.Gatherer.Context} context
|
|
92
92
|
*/
|
|
93
93
|
async startInstrumentation(context) {
|
|
94
94
|
if (context.gatherMode !== 'timespan') return;
|
|
@@ -96,7 +96,7 @@ class CSSUsage extends FRGatherer {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* @param {LH.Gatherer.
|
|
99
|
+
* @param {LH.Gatherer.Context} context
|
|
100
100
|
*/
|
|
101
101
|
async stopInstrumentation(context) {
|
|
102
102
|
if (context.gatherMode !== 'timespan') return;
|
|
@@ -104,7 +104,7 @@ class CSSUsage extends FRGatherer {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* @param {LH.Gatherer.
|
|
107
|
+
* @param {LH.Gatherer.Context} context
|
|
108
108
|
* @return {Promise<LH.Artifacts['CSSUsage']>}
|
|
109
109
|
*/
|
|
110
110
|
async getArtifact(context) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export default DevtoolsLogCompat;
|
|
2
|
-
/** @implements {LH.Gatherer.
|
|
3
|
-
declare class DevtoolsLogCompat extends
|
|
2
|
+
/** @implements {LH.Gatherer.GathererInstance<'DevtoolsLog'>} */
|
|
3
|
+
declare class DevtoolsLogCompat extends BaseGatherer implements LH.Gatherer.GathererInstance<'DevtoolsLog'> {
|
|
4
4
|
/** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
|
|
5
5
|
meta: LH.Gatherer.GathererMeta<'DevtoolsLog'>;
|
|
6
6
|
/**
|
|
7
|
-
* @param {LH.Gatherer.
|
|
7
|
+
* @param {LH.Gatherer.Context<'DevtoolsLog'>} passContext
|
|
8
8
|
* @return {Promise<LH.Artifacts['devtoolsLogs']>}
|
|
9
9
|
*/
|
|
10
|
-
getArtifact(passContext: LH.Gatherer.
|
|
10
|
+
getArtifact(passContext: LH.Gatherer.Context<'DevtoolsLog'>): Promise<LH.Artifacts['devtoolsLogs']>;
|
|
11
11
|
}
|
|
12
|
-
import
|
|
12
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
13
13
|
//# sourceMappingURL=devtools-log-compat.d.ts.map
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import DevtoolsLogGatherer from './devtools-log.js';
|
|
14
|
-
import
|
|
14
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
15
15
|
|
|
16
|
-
/** @implements {LH.Gatherer.
|
|
17
|
-
class DevtoolsLogCompat extends
|
|
16
|
+
/** @implements {LH.Gatherer.GathererInstance<'DevtoolsLog'>} */
|
|
17
|
+
class DevtoolsLogCompat extends BaseGatherer {
|
|
18
18
|
/** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
|
|
19
19
|
meta = {
|
|
20
20
|
supportedModes: ['timespan', 'navigation'],
|
|
@@ -22,7 +22,7 @@ class DevtoolsLogCompat extends FRGatherer {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* @param {LH.Gatherer.
|
|
25
|
+
* @param {LH.Gatherer.Context<'DevtoolsLog'>} passContext
|
|
26
26
|
* @return {Promise<LH.Artifacts['devtoolsLogs']>}
|
|
27
27
|
*/
|
|
28
28
|
async getArtifact(passContext) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export default DevtoolsLog;
|
|
2
|
-
declare class DevtoolsLog extends
|
|
2
|
+
declare class DevtoolsLog extends BaseGatherer {
|
|
3
3
|
static symbol: symbol;
|
|
4
4
|
_messageLog: DevtoolsMessageLog;
|
|
5
5
|
/** @param {LH.Protocol.RawEventMessage} e */
|
|
6
6
|
_onProtocolMessage: (e: LH.Protocol.RawEventMessage) => void;
|
|
7
7
|
/**
|
|
8
|
-
* @param {LH.Gatherer.
|
|
8
|
+
* @param {LH.Gatherer.Context} passContext
|
|
9
9
|
*/
|
|
10
|
-
startSensitiveInstrumentation({ driver }: LH.Gatherer.
|
|
10
|
+
startSensitiveInstrumentation({ driver }: LH.Gatherer.Context): Promise<void>;
|
|
11
11
|
/**
|
|
12
|
-
* @param {LH.Gatherer.
|
|
12
|
+
* @param {LH.Gatherer.Context} passContext
|
|
13
13
|
*/
|
|
14
|
-
stopSensitiveInstrumentation({ driver }: LH.Gatherer.
|
|
14
|
+
stopSensitiveInstrumentation({ driver }: LH.Gatherer.Context): Promise<void>;
|
|
15
15
|
/**
|
|
16
16
|
* @return {Promise<LH.Artifacts['DevtoolsLog']>}
|
|
17
17
|
*/
|
|
@@ -44,5 +44,5 @@ export class DevtoolsMessageLog {
|
|
|
44
44
|
*/
|
|
45
45
|
record(message: LH.Protocol.RawEventMessage): void;
|
|
46
46
|
}
|
|
47
|
-
import
|
|
47
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
48
48
|
//# sourceMappingURL=devtools-log.d.ts.map
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* This protocol log can be used to recreate the network records using lib/network-recorder.js.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
14
14
|
|
|
15
|
-
class DevtoolsLog extends
|
|
15
|
+
class DevtoolsLog extends BaseGatherer {
|
|
16
16
|
static symbol = Symbol('DevtoolsLog');
|
|
17
17
|
|
|
18
18
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
@@ -31,7 +31,7 @@ class DevtoolsLog extends FRGatherer {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @param {LH.Gatherer.
|
|
34
|
+
* @param {LH.Gatherer.Context} passContext
|
|
35
35
|
*/
|
|
36
36
|
async startSensitiveInstrumentation({driver}) {
|
|
37
37
|
this._messageLog.reset();
|
|
@@ -42,7 +42,7 @@ class DevtoolsLog extends FRGatherer {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* @param {LH.Gatherer.
|
|
45
|
+
* @param {LH.Gatherer.Context} passContext
|
|
46
46
|
*/
|
|
47
47
|
async stopSensitiveInstrumentation({driver}) {
|
|
48
48
|
this._messageLog.endRecording();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default Doctype;
|
|
2
|
-
declare class Doctype extends
|
|
2
|
+
declare class Doctype extends BaseGatherer {
|
|
3
3
|
/**
|
|
4
|
-
* @param {LH.Gatherer.
|
|
4
|
+
* @param {LH.Gatherer.Context} passContext
|
|
5
5
|
* @return {Promise<LH.Artifacts['Doctype']>}
|
|
6
6
|
*/
|
|
7
|
-
getArtifact(passContext: LH.Gatherer.
|
|
7
|
+
getArtifact(passContext: LH.Gatherer.Context): Promise<LH.Artifacts['Doctype']>;
|
|
8
8
|
}
|
|
9
|
-
import
|
|
9
|
+
import BaseGatherer from '../../base-gatherer.js';
|
|
10
10
|
//# sourceMappingURL=doctype.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import BaseGatherer from '../../base-gatherer.js';
|
|
8
8
|
|
|
9
9
|
/* global document */
|
|
10
10
|
|
|
@@ -25,14 +25,14 @@ function getDoctype() {
|
|
|
25
25
|
return {name, publicId, systemId, documentCompatMode};
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
class Doctype extends
|
|
28
|
+
class Doctype extends BaseGatherer {
|
|
29
29
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
30
30
|
meta = {
|
|
31
31
|
supportedModes: ['snapshot', 'navigation'],
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* @param {LH.Gatherer.
|
|
35
|
+
* @param {LH.Gatherer.Context} passContext
|
|
36
36
|
* @return {Promise<LH.Artifacts['Doctype']>}
|
|
37
37
|
*/
|
|
38
38
|
getArtifact(passContext) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default DOMStats;
|
|
2
|
-
declare class DOMStats extends
|
|
2
|
+
declare class DOMStats extends BaseGatherer {
|
|
3
3
|
/**
|
|
4
|
-
* @param {LH.Gatherer.
|
|
4
|
+
* @param {LH.Gatherer.Context} passContext
|
|
5
5
|
* @return {Promise<LH.Artifacts['DOMStats']>}
|
|
6
6
|
*/
|
|
7
|
-
getArtifact(passContext: LH.Gatherer.
|
|
7
|
+
getArtifact(passContext: LH.Gatherer.Context): Promise<LH.Artifacts['DOMStats']>;
|
|
8
8
|
}
|
|
9
|
-
import
|
|
9
|
+
import BaseGatherer from '../../base-gatherer.js';
|
|
10
10
|
//# sourceMappingURL=domstats.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/* global getNodeDetails document */
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import BaseGatherer from '../../base-gatherer.js';
|
|
16
16
|
import {pageFunctions} from '../../../lib/page-functions.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -75,14 +75,14 @@ function getDOMStats(element = document.body, deep = true) {
|
|
|
75
75
|
}
|
|
76
76
|
/* c8 ignore stop */
|
|
77
77
|
|
|
78
|
-
class DOMStats extends
|
|
78
|
+
class DOMStats extends BaseGatherer {
|
|
79
79
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
80
80
|
meta = {
|
|
81
81
|
supportedModes: ['snapshot', 'navigation'],
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* @param {LH.Gatherer.
|
|
85
|
+
* @param {LH.Gatherer.Context} passContext
|
|
86
86
|
* @return {Promise<LH.Artifacts['DOMStats']>}
|
|
87
87
|
*/
|
|
88
88
|
async getArtifact(passContext) {
|
|
@@ -6,7 +6,7 @@ export type SimplifiedNetworkRecord = {
|
|
|
6
6
|
resourceSize: number;
|
|
7
7
|
};
|
|
8
8
|
/** @typedef {{requestId: string, url: string, mimeType: string, resourceSize: number}} SimplifiedNetworkRecord */
|
|
9
|
-
declare class OptimizedImages extends
|
|
9
|
+
declare class OptimizedImages extends BaseGatherer {
|
|
10
10
|
/**
|
|
11
11
|
* @param {Array<LH.Artifacts.NetworkRequest>} networkRecords
|
|
12
12
|
* @return {Array<SimplifiedNetworkRecord>}
|
|
@@ -16,46 +16,34 @@ declare class OptimizedImages extends FRGatherer {
|
|
|
16
16
|
meta: LH.Gatherer.GathererMeta<'DevtoolsLog'>;
|
|
17
17
|
_encodingStartAt: number;
|
|
18
18
|
/**
|
|
19
|
-
* @param {LH.Gatherer.
|
|
19
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
20
20
|
* @param {string} requestId
|
|
21
21
|
* @param {'jpeg'|'webp'} encoding Either webp or jpeg.
|
|
22
22
|
* @return {Promise<LH.Crdp.Audits.GetEncodedResponseResponse>}
|
|
23
23
|
*/
|
|
24
|
-
_getEncodedResponse(session: LH.Gatherer.
|
|
24
|
+
_getEncodedResponse(session: LH.Gatherer.ProtocolSession, requestId: string, encoding: 'jpeg' | 'webp'): Promise<LH.Crdp.Audits.GetEncodedResponseResponse>;
|
|
25
25
|
/**
|
|
26
|
-
* @param {LH.Gatherer.
|
|
26
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
27
27
|
* @param {SimplifiedNetworkRecord} networkRecord
|
|
28
28
|
* @return {Promise<{originalSize: number, jpegSize?: number, webpSize?: number}>}
|
|
29
29
|
*/
|
|
30
|
-
calculateImageStats(session: LH.Gatherer.
|
|
30
|
+
calculateImageStats(session: LH.Gatherer.ProtocolSession, networkRecord: SimplifiedNetworkRecord): Promise<{
|
|
31
31
|
originalSize: number;
|
|
32
32
|
jpegSize?: number | undefined;
|
|
33
33
|
webpSize?: number | undefined;
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
|
-
* @param {LH.Gatherer.
|
|
36
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
37
37
|
* @param {Array<SimplifiedNetworkRecord>} imageRecords
|
|
38
38
|
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
39
39
|
*/
|
|
40
|
-
computeOptimizedImages(session: LH.Gatherer.
|
|
40
|
+
computeOptimizedImages(session: LH.Gatherer.ProtocolSession, imageRecords: Array<SimplifiedNetworkRecord>): Promise<LH.Artifacts['OptimizedImages']>;
|
|
41
41
|
/**
|
|
42
|
-
* @param {LH.Gatherer.
|
|
43
|
-
* @param {LH.Artifacts.NetworkRequest[]} networkRecords
|
|
42
|
+
* @param {LH.Gatherer.Context<'DevtoolsLog'>} context
|
|
44
43
|
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
45
44
|
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param {LH.Gatherer.FRTransitionalContext<'DevtoolsLog'>} context
|
|
49
|
-
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
50
|
-
*/
|
|
51
|
-
getArtifact(context: LH.Gatherer.FRTransitionalContext<'DevtoolsLog'>): Promise<LH.Artifacts['OptimizedImages']>;
|
|
52
|
-
/**
|
|
53
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
54
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
55
|
-
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
56
|
-
*/
|
|
57
|
-
afterPass(passContext: LH.Gatherer.PassContext, loadData: LH.Gatherer.LoadData): Promise<LH.Artifacts['OptimizedImages']>;
|
|
45
|
+
getArtifact(context: LH.Gatherer.Context<'DevtoolsLog'>): Promise<LH.Artifacts['OptimizedImages']>;
|
|
58
46
|
}
|
|
59
|
-
import
|
|
47
|
+
import BaseGatherer from '../../base-gatherer.js';
|
|
60
48
|
import { NetworkRequest } from '../../../lib/network-request.js';
|
|
61
49
|
//# sourceMappingURL=optimized-images.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import log from 'lighthouse-logger';
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import BaseGatherer from '../../base-gatherer.js';
|
|
16
16
|
import UrlUtils from '../../../lib/url-utils.js';
|
|
17
17
|
import {NetworkRequest} from '../../../lib/network-request.js';
|
|
18
18
|
import {Sentry} from '../../../lib/sentry.js';
|
|
@@ -34,7 +34,7 @@ const IMAGE_REGEX = /^image\/((x|ms|x-ms)-)?(png|bmp|jpeg)$/;
|
|
|
34
34
|
|
|
35
35
|
/** @typedef {{requestId: string, url: string, mimeType: string, resourceSize: number}} SimplifiedNetworkRecord */
|
|
36
36
|
|
|
37
|
-
class OptimizedImages extends
|
|
37
|
+
class OptimizedImages extends BaseGatherer {
|
|
38
38
|
/** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
|
|
39
39
|
meta = {
|
|
40
40
|
supportedModes: ['timespan', 'navigation'],
|
|
@@ -78,7 +78,7 @@ class OptimizedImages extends FRGatherer {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* @param {LH.Gatherer.
|
|
81
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
82
82
|
* @param {string} requestId
|
|
83
83
|
* @param {'jpeg'|'webp'} encoding Either webp or jpeg.
|
|
84
84
|
* @return {Promise<LH.Crdp.Audits.GetEncodedResponseResponse>}
|
|
@@ -92,7 +92,7 @@ class OptimizedImages extends FRGatherer {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* @param {LH.Gatherer.
|
|
95
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
96
96
|
* @param {SimplifiedNetworkRecord} networkRecord
|
|
97
97
|
* @return {Promise<{originalSize: number, jpegSize?: number, webpSize?: number}>}
|
|
98
98
|
*/
|
|
@@ -116,7 +116,7 @@ class OptimizedImages extends FRGatherer {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* @param {LH.Gatherer.
|
|
119
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
120
120
|
* @param {Array<SimplifiedNetworkRecord>} imageRecords
|
|
121
121
|
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
122
122
|
*/
|
|
@@ -153,11 +153,13 @@ class OptimizedImages extends FRGatherer {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* @param {LH.Gatherer.
|
|
157
|
-
* @param {LH.Artifacts.NetworkRequest[]} networkRecords
|
|
156
|
+
* @param {LH.Gatherer.Context<'DevtoolsLog'>} context
|
|
158
157
|
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
159
158
|
*/
|
|
160
|
-
async
|
|
159
|
+
async getArtifact(context) {
|
|
160
|
+
const devtoolsLog = context.dependencies.DevtoolsLog;
|
|
161
|
+
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
162
|
+
|
|
161
163
|
const imageRecords = OptimizedImages
|
|
162
164
|
.filterImageRequests(networkRecords)
|
|
163
165
|
.sort((a, b) => b.resourceSize - a.resourceSize);
|
|
@@ -169,25 +171,6 @@ class OptimizedImages extends FRGatherer {
|
|
|
169
171
|
}
|
|
170
172
|
return results;
|
|
171
173
|
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* @param {LH.Gatherer.FRTransitionalContext<'DevtoolsLog'>} context
|
|
175
|
-
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
176
|
-
*/
|
|
177
|
-
async getArtifact(context) {
|
|
178
|
-
const devtoolsLog = context.dependencies.DevtoolsLog;
|
|
179
|
-
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
180
|
-
return this._getArtifact(context, networkRecords);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
185
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
186
|
-
* @return {Promise<LH.Artifacts['OptimizedImages']>}
|
|
187
|
-
*/
|
|
188
|
-
async afterPass(passContext, loadData) {
|
|
189
|
-
return this._getArtifact({...passContext, dependencies: {}}, loadData.networkRecords);
|
|
190
|
-
}
|
|
191
174
|
}
|
|
192
175
|
|
|
193
176
|
export default OptimizedImages;
|