lighthouse 9.5.0-dev.20220607 → 9.6.2
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/dist/report/bundle.esm.js +467 -520
- package/dist/report/flow.js +22 -22
- package/dist/report/standalone.js +19 -19
- package/flow-report/src/summary/category.tsx +1 -1
- package/flow-report/src/topbar.tsx +2 -10
- package/flow-report/src/util.ts +1 -1
- package/flow-report/test/topbar-test.tsx +8 -7
- package/jest.config.js +1 -1
- package/lighthouse-cli/.eslintrc.cjs +4 -3
- package/lighthouse-cli/bin.js +1 -0
- package/lighthouse-cli/cli-flags.js +4 -3
- package/lighthouse-cli/commands/commands.js +1 -0
- package/lighthouse-cli/commands/list-audits.js +1 -0
- package/lighthouse-cli/commands/list-locales.js +1 -0
- package/lighthouse-cli/commands/list-trace-categories.js +1 -0
- package/lighthouse-cli/index.js +1 -0
- package/lighthouse-cli/printer.js +1 -0
- package/lighthouse-cli/run.js +24 -9
- package/lighthouse-cli/sentry-prompt.js +1 -0
- package/lighthouse-cli/test/smokehouse/core-tests.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/lib.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/node.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +1 -0
- package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +1 -0
- package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +1 -0
- package/lighthouse-cli/test/smokehouse/lib/local-console.js +1 -0
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +23 -109
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +3 -2
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +19 -28
- package/lighthouse-cli/test/smokehouse/report-assert.js +4 -3
- package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
- package/lighthouse-cli/test/smokehouse/version-check-test.js +3 -0
- package/lighthouse-cli/test/smokehouse/version-check.js +1 -0
- package/lighthouse-core/audits/accessibility/accesskeys.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-allowed-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-command-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-hidden-body.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-hidden-focus.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-input-field-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-meter-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-progressbar-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-required-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-required-children.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-required-parent.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-roles.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-toggle-field-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-tooltip-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-valid-attr-value.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-valid-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/button-name.js +1 -1
- package/lighthouse-core/audits/accessibility/bypass.js +1 -1
- package/lighthouse-core/audits/accessibility/color-contrast.js +1 -1
- package/lighthouse-core/audits/accessibility/definition-list.js +1 -1
- package/lighthouse-core/audits/accessibility/dlitem.js +1 -1
- package/lighthouse-core/audits/accessibility/document-title.js +1 -1
- package/lighthouse-core/audits/accessibility/duplicate-id-active.js +1 -1
- package/lighthouse-core/audits/accessibility/duplicate-id-aria.js +1 -1
- package/lighthouse-core/audits/accessibility/form-field-multiple-labels.js +1 -1
- package/lighthouse-core/audits/accessibility/frame-title.js +1 -1
- package/lighthouse-core/audits/accessibility/heading-order.js +1 -1
- package/lighthouse-core/audits/accessibility/html-has-lang.js +1 -1
- package/lighthouse-core/audits/accessibility/html-lang-valid.js +1 -1
- package/lighthouse-core/audits/accessibility/image-alt.js +1 -1
- package/lighthouse-core/audits/accessibility/input-image-alt.js +1 -1
- package/lighthouse-core/audits/accessibility/label.js +1 -1
- package/lighthouse-core/audits/accessibility/link-name.js +1 -1
- package/lighthouse-core/audits/accessibility/list.js +1 -1
- package/lighthouse-core/audits/accessibility/listitem.js +5 -5
- package/lighthouse-core/audits/accessibility/meta-refresh.js +1 -1
- package/lighthouse-core/audits/accessibility/meta-viewport.js +1 -1
- package/lighthouse-core/audits/accessibility/object-alt.js +1 -1
- package/lighthouse-core/audits/accessibility/tabindex.js +1 -1
- package/lighthouse-core/audits/accessibility/td-headers-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/th-has-data-cells.js +1 -1
- package/lighthouse-core/audits/accessibility/valid-lang.js +1 -1
- package/lighthouse-core/audits/accessibility/video-caption.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -2
- package/lighthouse-core/audits/byte-efficiency/duplicated-javascript.js +12 -11
- package/lighthouse-core/audits/byte-efficiency/efficient-animated-content.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +24 -22
- package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +2 -3
- package/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +3 -2
- package/lighthouse-core/audits/byte-efficiency/unminified-css.js +5 -3
- package/lighthouse-core/audits/byte-efficiency/unminified-javascript.js +11 -10
- package/lighthouse-core/audits/byte-efficiency/unused-css-rules.js +1 -0
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +8 -11
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/uses-text-compression.js +1 -1
- package/lighthouse-core/audits/deprecations.js +598 -8
- package/lighthouse-core/audits/diagnostics.js +3 -4
- package/lighthouse-core/audits/dobetterweb/doctype.js +9 -20
- package/lighthouse-core/audits/dobetterweb/geolocation-on-start.js +1 -1
- package/lighthouse-core/audits/dobetterweb/no-document-write.js +1 -1
- package/lighthouse-core/audits/dobetterweb/notification-on-start.js +1 -1
- package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -2
- package/lighthouse-core/audits/dobetterweb/uses-passive-event-listeners.js +1 -1
- package/lighthouse-core/audits/errors-in-console.js +2 -2
- package/lighthouse-core/audits/long-tasks.js +2 -3
- package/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +2 -2
- package/lighthouse-core/audits/metrics/first-contentful-paint.js +2 -3
- package/lighthouse-core/audits/metrics/first-meaningful-paint.js +2 -3
- package/lighthouse-core/audits/metrics/interactive.js +2 -3
- package/lighthouse-core/audits/metrics/largest-contentful-paint.js +2 -3
- package/lighthouse-core/audits/metrics/max-potential-fid.js +2 -3
- package/lighthouse-core/audits/metrics/speed-index.js +2 -3
- package/lighthouse-core/audits/metrics/total-blocking-time.js +2 -3
- package/lighthouse-core/audits/metrics.js +2 -3
- package/lighthouse-core/audits/no-unload-listeners.js +15 -7
- package/lighthouse-core/audits/predictive-perf.js +1 -2
- package/lighthouse-core/audits/preload-lcp-image.js +3 -3
- package/lighthouse-core/audits/redirects.js +1 -1
- package/lighthouse-core/audits/script-treemap-data.js +45 -45
- package/lighthouse-core/audits/seo/http-status-code.js +4 -2
- package/lighthouse-core/audits/seo/link-text.js +0 -2
- package/lighthouse-core/audits/server-response-time.js +17 -2
- package/lighthouse-core/audits/service-worker.js +2 -7
- package/lighthouse-core/audits/timing-budget.js +2 -3
- package/lighthouse-core/audits/uses-rel-preconnect.js +1 -1
- package/lighthouse-core/audits/uses-rel-preload.js +1 -1
- package/lighthouse-core/audits/valid-source-maps.js +14 -12
- package/lighthouse-core/audits/violation-audit.js +1 -1
- package/lighthouse-core/audits/work-during-interaction.js +2 -2
- package/lighthouse-core/computed/critical-request-chains.js +9 -5
- package/lighthouse-core/computed/js-bundles.js +11 -11
- package/lighthouse-core/computed/main-resource.js +2 -3
- package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +1 -1
- package/lighthouse-core/computed/metrics/first-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/first-meaningful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/interactive.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-interactive.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-max-potential-fid.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-metric.js +5 -3
- package/lighthouse-core/computed/metrics/lantern-speed-index.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +1 -1
- package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +1 -1
- package/lighthouse-core/computed/metrics/largest-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/max-potential-fid.js +1 -1
- package/lighthouse-core/computed/metrics/metric.js +0 -1
- package/lighthouse-core/computed/metrics/speed-index.js +1 -1
- package/lighthouse-core/computed/metrics/timing-summary.js +6 -13
- package/lighthouse-core/computed/metrics/total-blocking-time.js +1 -1
- package/lighthouse-core/computed/module-duplication.js +5 -6
- package/lighthouse-core/computed/page-dependency-graph.js +28 -55
- package/lighthouse-core/computed/resource-summary.js +5 -5
- package/lighthouse-core/computed/unused-css.js +7 -6
- package/lighthouse-core/computed/unused-javascript-summary.js +36 -16
- package/lighthouse-core/config/budget.js +2 -2
- package/lighthouse-core/config/default-config.js +1 -2
- package/lighthouse-core/fraggle-rock/api.js +1 -1
- package/lighthouse-core/fraggle-rock/config/default-config.js +0 -3
- package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +3 -6
- package/lighthouse-core/fraggle-rock/gather/driver.js +2 -2
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +26 -51
- package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +3 -0
- package/lighthouse-core/fraggle-rock/gather/session.js +22 -23
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -5
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +6 -6
- package/lighthouse-core/gather/connections/cri.js +1 -5
- package/lighthouse-core/gather/driver/execution-context.js +2 -5
- package/lighthouse-core/gather/driver/navigation.js +10 -13
- package/lighthouse-core/gather/driver/network-monitor.js +3 -16
- package/lighthouse-core/gather/driver.js +1 -6
- package/lighthouse-core/gather/fetcher.js +210 -34
- package/lighthouse-core/gather/gather-runner.js +17 -13
- package/lighthouse-core/gather/gatherers/accessibility.js +4 -16
- package/lighthouse-core/gather/gatherers/console-messages.js +2 -4
- package/lighthouse-core/gather/gatherers/dobetterweb/doctype.js +2 -4
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +2 -3
- package/lighthouse-core/gather/gatherers/iframe-elements.js +1 -4
- package/lighthouse-core/gather/gatherers/image-elements.js +0 -2
- package/lighthouse-core/gather/gatherers/js-usage.js +87 -12
- package/lighthouse-core/gather/gatherers/link-elements.js +14 -12
- package/lighthouse-core/gather/gatherers/main-document-content.js +8 -8
- package/lighthouse-core/gather/gatherers/script-elements.js +56 -7
- package/lighthouse-core/gather/gatherers/seo/robots-txt.js +30 -2
- package/lighthouse-core/gather/gatherers/source-maps.js +1 -8
- package/lighthouse-core/gather/gatherers/web-app-manifest.js +2 -2
- package/lighthouse-core/index.js +2 -26
- package/lighthouse-core/lib/cdt/generated/SourceMap.js +1 -1
- package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +29 -8
- package/lighthouse-core/lib/navigation-error.js +4 -13
- package/lighthouse-core/lib/page-functions.js +1 -3
- package/lighthouse-core/lib/script-helpers.js +6 -11
- package/lighthouse-core/lib/url-shim.js +2 -2
- package/lighthouse-core/runner.js +5 -0
- package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -0
- package/lighthouse-core/util-commonjs.js +6 -8
- package/package.json +13 -13
- package/readme.md +1 -1
- package/report/.eslintrc.cjs +1 -3
- package/report/assets/styles.css +5 -10
- package/report/assets/templates.html +9 -10
- package/report/clients/bundle.js +1 -0
- package/report/clients/standalone.js +1 -0
- package/report/generator/report-generator.js +21 -46
- package/report/renderer/api.js +2 -0
- package/report/renderer/category-renderer.js +24 -20
- package/report/renderer/components.js +304 -303
- package/report/renderer/crc-details-renderer.js +24 -21
- package/report/renderer/details-renderer.js +12 -12
- package/report/renderer/dom.js +7 -6
- package/report/renderer/drop-down-menu.js +1 -0
- package/report/renderer/element-screenshot-renderer.js +5 -1
- package/report/renderer/features-util.js +1 -0
- package/report/renderer/i18n.js +62 -118
- package/report/renderer/logger.js +1 -0
- package/report/renderer/open-tab.js +3 -1
- package/report/renderer/performance-category-renderer.js +11 -10
- package/report/renderer/pwa-category-renderer.js +4 -3
- package/report/renderer/report-renderer.js +17 -17
- package/report/renderer/report-ui-features.js +1 -0
- package/report/renderer/snippet-renderer.js +3 -2
- package/report/renderer/swap-locale-feature.js +1 -0
- package/report/renderer/text-encoding.js +1 -0
- package/report/renderer/topbar-features.js +1 -0
- package/report/renderer/util.js +6 -7
- package/report/test/clients/bundle-test.js +5 -0
- package/report/test/generator/file-namer-test.js +1 -0
- package/report/test/generator/report-generator-test.js +20 -25
- package/report/test/renderer/category-renderer-test.js +4 -3
- package/report/test/renderer/components-test.js +3 -0
- package/report/test/renderer/crc-details-renderer-test.js +3 -0
- package/report/test/renderer/details-renderer-test.js +3 -49
- package/report/test/renderer/dom-test.js +3 -0
- package/report/test/renderer/element-screenshot-renderer-test.js +6 -3
- package/report/test/renderer/i18n-test.js +25 -70
- package/report/test/renderer/performance-category-renderer-test.js +5 -14
- package/report/test/renderer/pwa-category-renderer-test.js +4 -3
- package/report/test/renderer/report-renderer-axe-test.js +4 -3
- package/report/test/renderer/report-renderer-test.js +4 -3
- package/report/test/renderer/report-ui-features-test.js +4 -3
- package/report/test/renderer/snippet-renderer-test.js +3 -0
- package/report/test/renderer/text-encoding-test.js +3 -0
- package/report/test/renderer/util-test.js +5 -4
- package/report/test-assets/faux-psi.js +1 -2
- package/shared/localization/format.js +3 -7
- package/shared/localization/locales/en-US.json +238 -55
- package/shared/localization/locales/en-XL.json +238 -55
- package/shared/test/localization/format-test.js +2 -8
- package/shared/test/localization/locales-test.js +2 -0
- package/shared/test/localization/swap-locale-test.js +2 -0
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +2 -0
- package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
- package/tsconfig.json +0 -1
- package/types/artifacts.d.ts +8 -47
- package/types/config.d.ts +0 -2
- package/types/externs.d.ts +2 -3
- package/types/gatherer.d.ts +2 -1
- package/types/global-lh.d.ts +0 -3
- package/types/lhr/lhr.d.ts +2 -2
- package/types/lhr/treemap.d.ts +1 -0
- package/changelog.md +0 -5902
- package/lighthouse-core/audits/script-elements-test-audit.js +0 -30
- package/lighthouse-core/gather/gatherers/scripts.js +0 -154
- package/lighthouse-core/scripts/package.json +0 -4
- package/report/test/.eslintrc.cjs +0 -11
- package/shared/test/localization/.eslintrc.cjs +0 -11
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
const Audit = require('./audit.js');
|
|
9
9
|
const i18n = require('../lib/i18n/i18n.js');
|
|
10
10
|
const MainResource = require('../computed/main-resource.js');
|
|
11
|
+
const NetworkRecords = require('../computed/network-records.js');
|
|
12
|
+
const NetworkAnalyzer = require('../lib/dependency-graph/simulator/network-analyzer.js');
|
|
11
13
|
|
|
12
14
|
const UIStrings = {
|
|
13
15
|
/** Title of a diagnostic audit that provides detail on how long it took from starting a request to when the server started responding. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
|
|
@@ -37,7 +39,7 @@ class ServerResponseTime extends Audit {
|
|
|
37
39
|
title: str_(UIStrings.title),
|
|
38
40
|
failureTitle: str_(UIStrings.failureTitle),
|
|
39
41
|
description: str_(UIStrings.description),
|
|
40
|
-
supportedModes: ['navigation'],
|
|
42
|
+
supportedModes: ['timespan', 'navigation'],
|
|
41
43
|
requiredArtifacts: ['devtoolsLogs', 'URL', 'GatherContext'],
|
|
42
44
|
};
|
|
43
45
|
}
|
|
@@ -59,7 +61,20 @@ class ServerResponseTime extends Audit {
|
|
|
59
61
|
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
60
62
|
|
|
61
63
|
/** @type {LH.Artifacts.NetworkRequest} */
|
|
62
|
-
|
|
64
|
+
let mainResource;
|
|
65
|
+
if (artifacts.GatherContext.gatherMode === 'timespan') {
|
|
66
|
+
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
67
|
+
const optionalMainResource = NetworkAnalyzer.findOptionalMainDocument(
|
|
68
|
+
networkRecords,
|
|
69
|
+
artifacts.URL.finalUrl
|
|
70
|
+
);
|
|
71
|
+
if (!optionalMainResource) {
|
|
72
|
+
return {score: null, notApplicable: true};
|
|
73
|
+
}
|
|
74
|
+
mainResource = optionalMainResource;
|
|
75
|
+
} else {
|
|
76
|
+
mainResource = await MainResource.request({devtoolsLog, URL: artifacts.URL}, context);
|
|
77
|
+
}
|
|
63
78
|
|
|
64
79
|
const responseTime = ServerResponseTime.calculateResponseTime(mainResource);
|
|
65
80
|
const passed = responseTime < TOO_SLOW_THRESHOLD_MS;
|
|
@@ -51,7 +51,6 @@ class ServiceWorker extends Audit {
|
|
|
51
51
|
title: str_(UIStrings.title),
|
|
52
52
|
failureTitle: str_(UIStrings.failureTitle),
|
|
53
53
|
description: str_(UIStrings.description),
|
|
54
|
-
supportedModes: ['navigation'],
|
|
55
54
|
requiredArtifacts: ['URL', 'ServiceWorker', 'WebAppManifest'],
|
|
56
55
|
};
|
|
57
56
|
}
|
|
@@ -129,12 +128,8 @@ class ServiceWorker extends Audit {
|
|
|
129
128
|
* @return {LH.Audit.Product}
|
|
130
129
|
*/
|
|
131
130
|
static audit(artifacts) {
|
|
132
|
-
// Match against
|
|
133
|
-
|
|
134
|
-
// For this reason it is better to evaluate the SW in relation to the main document url rather than the final frame url.
|
|
135
|
-
const {mainDocumentUrl} = artifacts.URL;
|
|
136
|
-
if (!mainDocumentUrl) throw new Error('mainDocumentUrl must exist in navigation mode');
|
|
137
|
-
const pageUrl = new URL(mainDocumentUrl);
|
|
131
|
+
// Match against artifacts.URL.finalUrl so audit accounts for any redirects.
|
|
132
|
+
const pageUrl = new URL(artifacts.URL.finalUrl);
|
|
138
133
|
const {versions, registrations} = artifacts.ServiceWorker;
|
|
139
134
|
|
|
140
135
|
const versionsForOrigin = ServiceWorker.getVersionsForOrigin(versions, pageUrl);
|
|
@@ -140,9 +140,8 @@ class TimingBudget extends Audit {
|
|
|
140
140
|
const gatherContext = artifacts.GatherContext;
|
|
141
141
|
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
142
142
|
const trace = artifacts.traces[Audit.DEFAULT_PASS];
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const data = {trace, devtoolsLog, gatherContext, settings: context.settings, URL};
|
|
143
|
+
const mainResource = await MainResource.request({URL: artifacts.URL, devtoolsLog}, context);
|
|
144
|
+
const data = {trace, devtoolsLog, gatherContext, settings: context.settings};
|
|
146
145
|
const summary = (await TimingSummary.request(data, context)).metrics;
|
|
147
146
|
const budget = Budget.getMatchingBudget(context.settings.budgets, mainResource.url);
|
|
148
147
|
|
|
@@ -123,7 +123,7 @@ class UsesRelPreconnectAudit extends Audit {
|
|
|
123
123
|
MainResource.request({devtoolsLog, URL: artifacts.URL}, context),
|
|
124
124
|
LoadSimulator.request({devtoolsLog, settings}, context),
|
|
125
125
|
ProcessedNavigation.request(processedTrace, context),
|
|
126
|
-
PageDependencyGraph.request({trace, devtoolsLog
|
|
126
|
+
PageDependencyGraph.request({trace, devtoolsLog}, context),
|
|
127
127
|
]);
|
|
128
128
|
|
|
129
129
|
const {rtt, additionalRttByOrigin} = loadSimulator.getOptions();
|
|
@@ -217,7 +217,7 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
217
217
|
|
|
218
218
|
const [mainResource, graph, simulator] = await Promise.all([
|
|
219
219
|
MainResource.request({devtoolsLog, URL}, context),
|
|
220
|
-
PageDependencyGraph.request({trace, devtoolsLog
|
|
220
|
+
PageDependencyGraph.request({trace, devtoolsLog}, context),
|
|
221
221
|
LoadSimulator.request(simulatorOptions, context),
|
|
222
222
|
]);
|
|
223
223
|
|
|
@@ -44,22 +44,22 @@ class ValidSourceMaps extends Audit {
|
|
|
44
44
|
title: str_(UIStrings.title),
|
|
45
45
|
failureTitle: str_(UIStrings.failureTitle),
|
|
46
46
|
description: str_(UIStrings.description),
|
|
47
|
-
requiredArtifacts: ['
|
|
47
|
+
requiredArtifacts: ['ScriptElements', 'SourceMaps', 'URL'],
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Returns true if the size of the script exceeds a static threshold.
|
|
53
|
-
* @param {LH.Artifacts.
|
|
53
|
+
* @param {LH.Artifacts.ScriptElement} scriptElement
|
|
54
54
|
* @param {string} finalURL
|
|
55
55
|
* @return {boolean}
|
|
56
56
|
*/
|
|
57
|
-
static isLargeFirstPartyJS(
|
|
58
|
-
if (
|
|
57
|
+
static isLargeFirstPartyJS(scriptElement, finalURL) {
|
|
58
|
+
if (scriptElement.content === null) return false;
|
|
59
59
|
|
|
60
|
-
const isLargeJS =
|
|
61
|
-
const isFirstPartyJS =
|
|
62
|
-
thirdPartyWeb.isFirstParty(
|
|
60
|
+
const isLargeJS = scriptElement.content.length >= LARGE_JS_BYTE_THRESHOLD;
|
|
61
|
+
const isFirstPartyJS = scriptElement.src ?
|
|
62
|
+
thirdPartyWeb.isFirstParty(scriptElement.src, thirdPartyWeb.getEntity(finalURL)) : false;
|
|
63
63
|
|
|
64
64
|
return isLargeJS && isFirstPartyJS;
|
|
65
65
|
}
|
|
@@ -75,14 +75,16 @@ class ValidSourceMaps extends Audit {
|
|
|
75
75
|
|
|
76
76
|
let missingMapsForLargeFirstPartyFile = false;
|
|
77
77
|
const results = [];
|
|
78
|
-
for (const
|
|
79
|
-
|
|
78
|
+
for (const scriptElement of artifacts.ScriptElements) {
|
|
79
|
+
if (!scriptElement.src) continue; // TODO: inline scripts, how do they work?
|
|
80
|
+
|
|
81
|
+
const sourceMap = SourceMaps.find(m => m.scriptUrl === scriptElement.src);
|
|
80
82
|
const errors = [];
|
|
81
|
-
const isLargeFirstParty = this.isLargeFirstPartyJS(
|
|
83
|
+
const isLargeFirstParty = this.isLargeFirstPartyJS(scriptElement, artifacts.URL.finalUrl);
|
|
82
84
|
|
|
83
85
|
if (isLargeFirstParty && (!sourceMap || !sourceMap.map)) {
|
|
84
86
|
missingMapsForLargeFirstPartyFile = true;
|
|
85
|
-
isMissingMapForLargeFirstPartyScriptUrl.add(
|
|
87
|
+
isMissingMapForLargeFirstPartyScriptUrl.add(scriptElement.src);
|
|
86
88
|
errors.push({error: str_(UIStrings.missingSourceMapErrorMessage)});
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -105,7 +107,7 @@ class ValidSourceMaps extends Audit {
|
|
|
105
107
|
|
|
106
108
|
if (sourceMap || errors.length) {
|
|
107
109
|
results.push({
|
|
108
|
-
scriptUrl:
|
|
110
|
+
scriptUrl: scriptElement.src,
|
|
109
111
|
sourceMapUrl: sourceMap?.sourceMapUrl,
|
|
110
112
|
subItems: {
|
|
111
113
|
type: /** @type {const} */ ('subitems'),
|
|
@@ -31,7 +31,7 @@ class ViolationAudit extends Audit {
|
|
|
31
31
|
return artifacts.ConsoleMessages
|
|
32
32
|
.filter(entry => entry.url && entry.source === 'violation' && pattern.test(entry.text))
|
|
33
33
|
.map(entry => {
|
|
34
|
-
const bundle = bundles.find(bundle => bundle.script.
|
|
34
|
+
const bundle = bundles.find(bundle => bundle.script.src === entry.url);
|
|
35
35
|
return Audit.makeSourceLocationFromConsoleMessage(entry, bundle);
|
|
36
36
|
})
|
|
37
37
|
.filter(filterUndefined)
|
|
@@ -32,7 +32,7 @@ const UIStrings = {
|
|
|
32
32
|
/** Label for a column in a data table; entries will be information on the time that the browser is delayed before responding to user input. Ideally fits within a ~40 character limit. */
|
|
33
33
|
inputDelay: 'Input delay',
|
|
34
34
|
/** Label for a column in a data table; entries will be information on the time taken by code processing user input that delays a response to the user. Ideally fits within a ~40 character limit. */
|
|
35
|
-
|
|
35
|
+
processingDelay: 'Processing delay',
|
|
36
36
|
/** Label for a column in a data table; entries will be information on the time that the browser is delayed before presenting a response to user input on screen. Ideally fits within a ~40 character limit. */
|
|
37
37
|
presentationDelay: 'Presentation delay',
|
|
38
38
|
/**
|
|
@@ -116,7 +116,7 @@ class WorkDuringInteraction extends Audit {
|
|
|
116
116
|
const endTs = startTs + interactionData.duration * 1000;
|
|
117
117
|
return {
|
|
118
118
|
inputDelay: {startTs, endTs: processingStartTs},
|
|
119
|
-
|
|
119
|
+
processingDelay: {startTs: processingStartTs, endTs: processingEndTs},
|
|
120
120
|
presentationDelay: {startTs: processingEndTs, endTs},
|
|
121
121
|
};
|
|
122
122
|
}
|
|
@@ -117,9 +117,6 @@ class CriticalRequestChains {
|
|
|
117
117
|
// Ignore if some ancestor is not a critical request.
|
|
118
118
|
if (networkPath.some(r => !CriticalRequestChains.isCritical(r, mainResource))) return;
|
|
119
119
|
|
|
120
|
-
// Ignore non-network things (like data urls).
|
|
121
|
-
if (NetworkRequest.isNonNetworkRequest(node.record)) return;
|
|
122
|
-
|
|
123
120
|
addChain(networkPath);
|
|
124
121
|
}, getNextNodes);
|
|
125
122
|
|
|
@@ -132,8 +129,15 @@ class CriticalRequestChains {
|
|
|
132
129
|
* @return {Promise<LH.Artifacts.CriticalRequestNode>}
|
|
133
130
|
*/
|
|
134
131
|
static async compute_(data, context) {
|
|
135
|
-
const mainResource = await MainResource.request(
|
|
136
|
-
|
|
132
|
+
const mainResource = await MainResource.request({
|
|
133
|
+
URL: data.URL,
|
|
134
|
+
devtoolsLog: data.devtoolsLog,
|
|
135
|
+
}, context);
|
|
136
|
+
|
|
137
|
+
const graph = await PageDependencyGraph.request({
|
|
138
|
+
trace: data.trace,
|
|
139
|
+
devtoolsLog: data.devtoolsLog,
|
|
140
|
+
}, context);
|
|
137
141
|
|
|
138
142
|
return CriticalRequestChains.extractChainsFromGraph(mainResource, graph);
|
|
139
143
|
}
|
|
@@ -12,15 +12,14 @@ const SDK = require('../lib/cdt/SDK.js');
|
|
|
12
12
|
/**
|
|
13
13
|
* Calculate the number of bytes contributed by each source file
|
|
14
14
|
* @param {LH.Artifacts.Bundle['map']} map
|
|
15
|
-
* @param {number} contentLength
|
|
16
15
|
* @param {string} content
|
|
17
16
|
* @return {LH.Artifacts.Bundle['sizes']}
|
|
18
17
|
*/
|
|
19
|
-
function computeGeneratedFileSizes(map,
|
|
18
|
+
function computeGeneratedFileSizes(map, content) {
|
|
20
19
|
const lines = content.split('\n');
|
|
21
20
|
/** @type {Record<string, number>} */
|
|
22
21
|
const files = {};
|
|
23
|
-
const totalBytes =
|
|
22
|
+
const totalBytes = content.length;
|
|
24
23
|
let unmappedBytes = totalBytes;
|
|
25
24
|
|
|
26
25
|
// @ts-expect-error: This function is added in SDK.js. This will eventually be added to CDT.
|
|
@@ -79,10 +78,10 @@ function computeGeneratedFileSizes(map, contentLength, content) {
|
|
|
79
78
|
|
|
80
79
|
class JSBundles {
|
|
81
80
|
/**
|
|
82
|
-
* @param {Pick<LH.Artifacts, 'SourceMaps'|'
|
|
81
|
+
* @param {Pick<LH.Artifacts, 'SourceMaps'|'ScriptElements'>} artifacts
|
|
83
82
|
*/
|
|
84
83
|
static async compute_(artifacts) {
|
|
85
|
-
const {SourceMaps,
|
|
84
|
+
const {SourceMaps, ScriptElements} = artifacts;
|
|
86
85
|
|
|
87
86
|
/** @type {LH.Artifacts.Bundle[]} */
|
|
88
87
|
const bundles = [];
|
|
@@ -90,22 +89,23 @@ class JSBundles {
|
|
|
90
89
|
// Collate map and script, compute file sizes.
|
|
91
90
|
for (const SourceMap of SourceMaps) {
|
|
92
91
|
if (!SourceMap.map) continue;
|
|
93
|
-
const {
|
|
92
|
+
const {scriptUrl, map: rawMap} = SourceMap;
|
|
94
93
|
|
|
95
94
|
if (!rawMap.mappings) continue;
|
|
96
95
|
|
|
97
|
-
const
|
|
98
|
-
if (!
|
|
96
|
+
const scriptElement = ScriptElements.find(s => s.src === scriptUrl);
|
|
97
|
+
if (!scriptElement) continue;
|
|
99
98
|
|
|
100
99
|
const compiledUrl = SourceMap.scriptUrl || 'compiled.js';
|
|
101
100
|
const mapUrl = SourceMap.sourceMapUrl || 'compiled.js.map';
|
|
102
101
|
const map = new SDK.TextSourceMap(compiledUrl, mapUrl, rawMap);
|
|
103
102
|
|
|
104
|
-
const
|
|
103
|
+
const content = scriptElement?.content ? scriptElement.content : '';
|
|
104
|
+
const sizes = computeGeneratedFileSizes(map, content);
|
|
105
105
|
|
|
106
106
|
const bundle = {
|
|
107
107
|
rawMap,
|
|
108
|
-
script,
|
|
108
|
+
script: scriptElement,
|
|
109
109
|
map,
|
|
110
110
|
sizes,
|
|
111
111
|
};
|
|
@@ -116,4 +116,4 @@ class JSBundles {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
module.exports = makeComputedArtifact(JSBundles, ['
|
|
119
|
+
module.exports = makeComputedArtifact(JSBundles, ['ScriptElements', 'SourceMaps']);
|
|
@@ -20,10 +20,9 @@ class MainResource {
|
|
|
20
20
|
* @return {Promise<LH.Artifacts.NetworkRequest>}
|
|
21
21
|
*/
|
|
22
22
|
static async compute_(data, context) {
|
|
23
|
-
const
|
|
24
|
-
if (!mainDocumentUrl) throw new Error('mainDocumentUrl must exist to get the main resource');
|
|
23
|
+
const finalUrl = data.URL.finalUrl;
|
|
25
24
|
const requests = await NetworkRecords.request(data.devtoolsLog, context);
|
|
26
|
-
const mainResource = NetworkAnalyzer.
|
|
25
|
+
const mainResource = NetworkAnalyzer.findMainDocument(requests, finalUrl);
|
|
27
26
|
if (!mainResource) {
|
|
28
27
|
throw new Error('Unable to identify the main resource');
|
|
29
28
|
}
|
|
@@ -33,5 +33,5 @@ class FirstContentfulPaintAllFrames extends NavigationMetric {
|
|
|
33
33
|
|
|
34
34
|
module.exports = makeComputedArtifact(
|
|
35
35
|
FirstContentfulPaintAllFrames,
|
|
36
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
36
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
37
37
|
);
|
|
@@ -36,5 +36,5 @@ class FirstContentfulPaint extends NavigationMetric {
|
|
|
36
36
|
|
|
37
37
|
module.exports = makeComputedArtifact(
|
|
38
38
|
FirstContentfulPaint,
|
|
39
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
39
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
40
40
|
);
|
|
@@ -40,5 +40,5 @@ class FirstMeaningfulPaint extends NavigationMetric {
|
|
|
40
40
|
|
|
41
41
|
module.exports = makeComputedArtifact(
|
|
42
42
|
FirstMeaningfulPaint,
|
|
43
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
43
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
44
44
|
);
|
|
@@ -183,7 +183,7 @@ class Interactive extends NavigationMetric {
|
|
|
183
183
|
|
|
184
184
|
module.exports = makeComputedArtifact(
|
|
185
185
|
Interactive,
|
|
186
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
186
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
187
187
|
);
|
|
188
188
|
|
|
189
189
|
/**
|
|
@@ -200,5 +200,5 @@ class LanternFirstContentfulPaint extends LanternMetric {
|
|
|
200
200
|
|
|
201
201
|
module.exports = makeComputedArtifact(
|
|
202
202
|
LanternFirstContentfulPaint,
|
|
203
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
203
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
204
204
|
);
|
|
@@ -79,5 +79,5 @@ class LanternFirstMeaningfulPaint extends LanternMetric {
|
|
|
79
79
|
|
|
80
80
|
module.exports = makeComputedArtifact(
|
|
81
81
|
LanternFirstMeaningfulPaint,
|
|
82
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
82
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
83
83
|
);
|
|
@@ -109,5 +109,5 @@ class LanternInteractive extends LanternMetric {
|
|
|
109
109
|
|
|
110
110
|
module.exports = makeComputedArtifact(
|
|
111
111
|
LanternInteractive,
|
|
112
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
112
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
113
113
|
);
|
|
@@ -107,5 +107,5 @@ class LanternLargestContentfulPaint extends LanternMetric {
|
|
|
107
107
|
|
|
108
108
|
module.exports = makeComputedArtifact(
|
|
109
109
|
LanternLargestContentfulPaint,
|
|
110
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
110
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
111
111
|
);
|
|
@@ -89,5 +89,5 @@ class LanternMaxPotentialFID extends LanternMetricArtifact {
|
|
|
89
89
|
|
|
90
90
|
module.exports = makeComputedArtifact(
|
|
91
91
|
LanternMaxPotentialFID,
|
|
92
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
92
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
93
93
|
);
|
|
@@ -101,15 +101,17 @@ class LanternMetricArtifact {
|
|
|
101
101
|
static async computeMetricWithGraphs(data, context, extras) {
|
|
102
102
|
// TODO: remove this fallback when lighthouse-pub-ads plugin can update.
|
|
103
103
|
const gatherContext = data.gatherContext || {gatherMode: 'navigation'};
|
|
104
|
+
const {trace, devtoolsLog, settings} = data;
|
|
104
105
|
if (gatherContext.gatherMode !== 'navigation') {
|
|
105
106
|
throw new Error(`Lantern metrics can only be computed on navigations`);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
const metricName = this.name.replace('Lantern', '');
|
|
109
|
-
const graph = await PageDependencyGraph.request(
|
|
110
|
-
const processedTrace = await ProcessedTrace.request(
|
|
110
|
+
const graph = await PageDependencyGraph.request({trace, devtoolsLog}, context);
|
|
111
|
+
const processedTrace = await ProcessedTrace.request(trace, context);
|
|
111
112
|
const processedNavigation = await ProcessedNavigation.request(processedTrace, context);
|
|
112
|
-
const simulator = data.simulator ||
|
|
113
|
+
const simulator = data.simulator ||
|
|
114
|
+
(await LoadSimulator.request({devtoolsLog, settings}, context));
|
|
113
115
|
|
|
114
116
|
const optimisticGraph = this.getOptimisticGraph(graph, processedNavigation);
|
|
115
117
|
const pessimisticGraph = this.getPessimisticGraph(graph, processedNavigation);
|
|
@@ -146,5 +146,5 @@ class LanternSpeedIndex extends LanternMetric {
|
|
|
146
146
|
|
|
147
147
|
module.exports = makeComputedArtifact(
|
|
148
148
|
LanternSpeedIndex,
|
|
149
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
149
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
150
150
|
);
|
|
@@ -122,5 +122,5 @@ class LanternTotalBlockingTime extends LanternMetric {
|
|
|
122
122
|
|
|
123
123
|
module.exports = makeComputedArtifact(
|
|
124
124
|
LanternTotalBlockingTime,
|
|
125
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
125
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
126
126
|
);
|
|
@@ -41,5 +41,5 @@ class LargestContentfulPaintAllFrames extends NavigationMetric {
|
|
|
41
41
|
|
|
42
42
|
module.exports = makeComputedArtifact(
|
|
43
43
|
LargestContentfulPaintAllFrames,
|
|
44
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
44
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
45
45
|
);
|
|
@@ -48,5 +48,5 @@ class LargestContentfulPaint extends NavigationMetric {
|
|
|
48
48
|
|
|
49
49
|
module.exports = makeComputedArtifact(
|
|
50
50
|
LargestContentfulPaint,
|
|
51
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
51
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
52
52
|
);
|
|
@@ -41,5 +41,5 @@ class MaxPotentialFID extends NavigationMetric {
|
|
|
41
41
|
|
|
42
42
|
module.exports = makeComputedArtifact(
|
|
43
43
|
MaxPotentialFID,
|
|
44
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
44
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
45
45
|
);
|
|
@@ -26,12 +26,11 @@ class TimingSummary {
|
|
|
26
26
|
* @param {LH.DevtoolsLog} devtoolsLog
|
|
27
27
|
* @param {LH.Artifacts['GatherContext']} gatherContext
|
|
28
28
|
* @param {ImmutableObject<LH.Config.Settings>} settings
|
|
29
|
-
* @param {LH.Artifacts['URL']} URL
|
|
30
29
|
* @param {LH.Artifacts.ComputedContext} context
|
|
31
30
|
* @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
|
|
32
31
|
*/
|
|
33
|
-
static async summarize(trace, devtoolsLog, gatherContext, settings,
|
|
34
|
-
const metricComputationData = {trace, devtoolsLog, gatherContext, settings
|
|
32
|
+
static async summarize(trace, devtoolsLog, gatherContext, settings, context) {
|
|
33
|
+
const metricComputationData = {trace, devtoolsLog, gatherContext, settings};
|
|
35
34
|
/**
|
|
36
35
|
* @template TArtifacts
|
|
37
36
|
* @template TReturn
|
|
@@ -135,23 +134,17 @@ class TimingSummary {
|
|
|
135
134
|
return {metrics, debugInfo};
|
|
136
135
|
}
|
|
137
136
|
/**
|
|
138
|
-
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: ImmutableObject<LH.Config.Settings
|
|
137
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: ImmutableObject<LH.Config.Settings>}} data
|
|
139
138
|
* @param {LH.Artifacts.ComputedContext} context
|
|
140
139
|
* @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
|
|
141
140
|
*/
|
|
142
141
|
static async compute_(data, context) {
|
|
143
|
-
return TimingSummary.summarize(
|
|
144
|
-
|
|
145
|
-
data.devtoolsLog,
|
|
146
|
-
data.gatherContext,
|
|
147
|
-
data.settings,
|
|
148
|
-
data.URL,
|
|
149
|
-
context
|
|
150
|
-
);
|
|
142
|
+
return TimingSummary.summarize(data.trace, data.devtoolsLog, data.gatherContext, data.settings,
|
|
143
|
+
context);
|
|
151
144
|
}
|
|
152
145
|
}
|
|
153
146
|
|
|
154
147
|
module.exports = makeComputedArtifact(
|
|
155
148
|
TimingSummary,
|
|
156
|
-
['devtoolsLog', 'gatherContext', 'settings', 'trace'
|
|
149
|
+
['devtoolsLog', 'gatherContext', 'settings', 'trace']
|
|
157
150
|
);
|
|
@@ -70,5 +70,5 @@ class TotalBlockingTime extends ComputedMetric {
|
|
|
70
70
|
|
|
71
71
|
module.exports = makeComputedArtifact(
|
|
72
72
|
TotalBlockingTime,
|
|
73
|
-
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace'
|
|
73
|
+
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
|
|
74
74
|
);
|
|
@@ -43,7 +43,7 @@ class ModuleDuplication {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* @param {Map<string, Array<{
|
|
46
|
+
* @param {Map<string, Array<{scriptUrl: string, resourceSize: number}>>} moduleNameToSourceData
|
|
47
47
|
*/
|
|
48
48
|
static _normalizeAggregatedData(moduleNameToSourceData) {
|
|
49
49
|
for (const [key, originalSourceData] of moduleNameToSourceData.entries()) {
|
|
@@ -74,7 +74,7 @@ class ModuleDuplication {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* @param {Pick<LH.Artifacts, '
|
|
77
|
+
* @param {Pick<LH.Artifacts, 'ScriptElements'|'SourceMaps'>} artifacts
|
|
78
78
|
* @param {LH.Artifacts.ComputedContext} context
|
|
79
79
|
*/
|
|
80
80
|
static async compute_(artifacts, context) {
|
|
@@ -109,7 +109,7 @@ class ModuleDuplication {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
/** @type {Map<string, Array<{
|
|
112
|
+
/** @type {Map<string, Array<{scriptUrl: string, resourceSize: number}>>} */
|
|
113
113
|
const moduleNameToSourceData = new Map();
|
|
114
114
|
for (const {rawMap, script} of bundles) {
|
|
115
115
|
const sourceDataArray = sourceDatasMap.get(rawMap);
|
|
@@ -122,8 +122,7 @@ class ModuleDuplication {
|
|
|
122
122
|
moduleNameToSourceData.set(sourceData.source, data);
|
|
123
123
|
}
|
|
124
124
|
data.push({
|
|
125
|
-
|
|
126
|
-
scriptUrl: script.url,
|
|
125
|
+
scriptUrl: script.src || '',
|
|
127
126
|
resourceSize: sourceData.resourceSize,
|
|
128
127
|
});
|
|
129
128
|
}
|
|
@@ -134,4 +133,4 @@ class ModuleDuplication {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
module.exports = makeComputedArtifact(ModuleDuplication, ['
|
|
136
|
+
module.exports = makeComputedArtifact(ModuleDuplication, ['ScriptElements', 'SourceMaps']);
|