lighthouse 11.7.0-dev.20240404 → 11.7.0-dev.20240405

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.
@@ -0,0 +1,6 @@
1
+ export { DOM } from "../renderer/dom.js";
2
+ export { ReportRenderer } from "../renderer/report-renderer.js";
3
+ export { ReportUIFeatures } from "../renderer/report-ui-features.js";
4
+ export { renderReport } from "../renderer/api.js";
5
+ export { swapLocale, format } from "../../shared/localization/i18n-module.js";
6
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ // This file is used to generate a bundle that can be imported
8
+ // into an esmodules codebase to render the lighthouse report.
9
+ // Currently, embedders must handle some boilerplate themselves (like standalone.js)
10
+ // until we work out a common rendering interface.
11
+ // See: https://github.com/GoogleChrome/lighthouse/pull/12623
12
+
13
+ // Modify core/scripts/roll-to-devtools.sh if exports change.
14
+ export {DOM} from '../renderer/dom.js';
15
+ export {ReportRenderer} from '../renderer/report-renderer.js';
16
+ export {ReportUIFeatures} from '../renderer/report-ui-features.js';
17
+ export {renderReport} from '../renderer/api.js';
18
+ export {swapLocale, format} from '../../shared/localization/i18n-module.js';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=standalone.d.ts.map
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview The entry point for rendering the Lighthouse report for the HTML
9
+ * file created by ReportGenerator.
10
+ * The renderer code is bundled and injected into the report HTML along with the JSON report.
11
+ */
12
+
13
+ /* global ga */
14
+
15
+ import {renderReport} from '../renderer/api.js';
16
+ import {Logger} from '../renderer/logger.js';
17
+
18
+ function __initLighthouseReport__() {
19
+ /** @type {LH.Result} */
20
+ // @ts-expect-error
21
+ const lhr = window.__LIGHTHOUSE_JSON__;
22
+
23
+ const reportRootEl = renderReport(lhr, {
24
+ occupyEntireViewport: true,
25
+ getStandaloneReportHTML() {
26
+ return document.documentElement.outerHTML;
27
+ },
28
+ });
29
+ document.body.append(reportRootEl);
30
+
31
+ document.addEventListener('lh-analytics', /** @param {Event} e */ e => {
32
+ // @ts-expect-error
33
+ if (window.ga) ga(e.detail.cmd, e.detail.fields);
34
+ });
35
+
36
+ document.addEventListener('lh-log', /** @param {Event} e */ e => {
37
+ const el = document.querySelector('div#lh-log');
38
+ if (!el) return;
39
+
40
+ const logger = new Logger(el);
41
+ // @ts-expect-error
42
+ const detail = e.detail;
43
+
44
+ switch (detail.cmd) {
45
+ case 'log':
46
+ logger.log(detail.msg);
47
+ break;
48
+ case 'warn':
49
+ logger.warn(detail.msg);
50
+ break;
51
+ case 'error':
52
+ logger.error(detail.msg);
53
+ break;
54
+ case 'hide':
55
+ logger.hide();
56
+ break;
57
+ }
58
+ });
59
+ }
60
+
61
+ // @ts-expect-error
62
+ window.__initLighthouseReport__ = __initLighthouseReport__;