@paulirish/trace_engine 0.0.67-beta.2 → 0.0.68
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/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts +13 -0
- package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts.map +1 -0
- package/.tmp/tsbuildinfo/analyze-trace.d.mts +17 -0
- package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +1 -0
- package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts +2 -0
- package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts.map +1 -0
- package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts +3 -0
- package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts.map +1 -0
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -0
- package/README.md +22 -62
- package/analyze-inspector-issues.mjs +60 -0
- package/analyze-trace.mjs +144 -6
- package/core/common/ParsedURL.d.ts +0 -2
- package/core/common/ParsedURL.js +512 -0
- package/core/common/ParsedURL.js.map +1 -0
- package/core/common/common.d.ts +8 -33
- package/core/common/common.js +2 -0
- package/core/host/host.d.ts +1 -13
- package/core/host/host.js +1 -0
- package/core/i18n/i18n.d.ts +20 -8
- package/core/i18n/i18n.js +15 -0
- package/core/platform/ArrayUtilities.js +224 -0
- package/core/platform/ArrayUtilities.js.map +1 -0
- package/core/platform/Brand.js +5 -0
- package/core/platform/Brand.js.map +1 -0
- package/core/platform/Constructor.js +5 -0
- package/core/platform/Constructor.js.map +1 -0
- package/core/platform/DateUtilities.js +14 -0
- package/core/platform/DateUtilities.js.map +1 -0
- package/core/platform/DevToolsPath.js +28 -0
- package/core/platform/DevToolsPath.js.map +1 -0
- package/core/platform/HostRuntime.js +8 -0
- package/core/platform/HostRuntime.js.map +1 -0
- package/core/platform/KeyboardUtilities.js +34 -0
- package/core/platform/KeyboardUtilities.js.map +1 -0
- package/core/platform/MapUtilities.js +80 -0
- package/core/platform/MapUtilities.js.map +1 -0
- package/core/platform/MimeType.js +157 -0
- package/core/platform/MimeType.js.map +1 -0
- package/core/platform/NumberUtilities.js +73 -0
- package/core/platform/NumberUtilities.js.map +1 -0
- package/core/platform/Size.js +36 -0
- package/core/platform/Size.js.map +1 -0
- package/core/platform/StringUtilities.d.ts +15 -4
- package/core/platform/StringUtilities.js +767 -0
- package/core/platform/StringUtilities.js.map +1 -0
- package/core/platform/Timing.js +10 -0
- package/core/platform/Timing.js.map +1 -0
- package/core/platform/TypedArrayUtilities.js +158 -0
- package/core/platform/TypedArrayUtilities.js.map +1 -0
- package/core/platform/TypescriptUtilities.js +17 -0
- package/core/platform/TypescriptUtilities.js.map +1 -0
- package/core/platform/UIString.d.ts +5 -2
- package/core/platform/UIString.js +5 -0
- package/core/platform/UIString.js.map +1 -0
- package/core/platform/UserVisibleError.d.ts +1 -12
- package/core/platform/UserVisibleError.js +23 -0
- package/core/platform/UserVisibleError.js.map +1 -0
- package/core/platform/api/HostRuntime.d.ts +1 -0
- package/core/platform/api/HostRuntime.js +5 -0
- package/core/platform/api/HostRuntime.js.map +1 -0
- package/core/platform/api/api-tsconfig.json +58 -0
- package/core/platform/api/api-tsconfig.ref.json +26 -0
- package/core/platform/api/api.js +6 -0
- package/core/platform/api/api.js.map +1 -0
- package/core/platform/bundle-tsconfig.json +59 -0
- package/core/platform/bundle-tsconfig.ref.json +27 -0
- package/core/platform/foundation_unittests-tsconfig.json +73 -0
- package/core/platform/foundation_unittests-tsconfig.ref.json +40 -0
- package/core/platform/foundation_unittests_node_typecheck-tsconfig.json +69 -0
- package/core/platform/platform-tsconfig.json +81 -0
- package/core/platform/platform-tsconfig.ref.json +49 -0
- package/core/platform/platform.js +28 -0
- package/core/platform/platform.js.map +1 -0
- package/core/platform/platform_node_typecheck-tsconfig.json +78 -0
- package/core/platform/platform_node_typecheck.stamp +0 -0
- package/core/root/root.d.ts +1 -4
- package/core/root/root.js +1 -0
- package/core/sdk/sdk.d.ts +27 -97
- package/core/sdk/sdk.js +1 -0
- package/generated/protocol.d.ts +34 -6
- package/generated/protocol.js +3312 -0
- package/locales/af.json +94 -97
- package/locales/am.json +353 -356
- package/locales/ar.json +354 -357
- package/locales/as.json +352 -355
- package/locales/az.json +343 -346
- package/locales/be.json +353 -356
- package/locales/bg.json +353 -356
- package/locales/bn.json +353 -356
- package/locales/bs.json +247 -250
- package/locales/ca.json +285 -288
- package/locales/cs.json +338 -341
- package/locales/cy.json +124 -127
- package/locales/da.json +202 -205
- package/locales/de.json +222 -225
- package/locales/el.json +338 -341
- package/locales/en-GB.json +78 -81
- package/locales/en-US.json +250 -256
- package/locales/en-XL.json +1052 -0
- package/locales/es-419.json +278 -281
- package/locales/es.json +279 -282
- package/locales/et.json +237 -240
- package/locales/eu.json +124 -127
- package/locales/fa.json +353 -356
- package/locales/fi.json +283 -286
- package/locales/fil.json +32 -35
- package/locales/fr-CA.json +310 -313
- package/locales/fr.json +307 -310
- package/locales/gl.json +263 -266
- package/locales/gu.json +354 -357
- package/locales/he.json +354 -357
- package/locales/hi.json +338 -341
- package/locales/hr.json +238 -241
- package/locales/hu.json +344 -347
- package/locales/hy.json +353 -356
- package/locales/id.json +67 -70
- package/locales/is.json +305 -308
- package/locales/it.json +175 -178
- package/locales/ja.json +353 -356
- package/locales/ka.json +354 -357
- package/locales/kk.json +354 -357
- package/locales/km.json +353 -356
- package/locales/kn.json +354 -357
- package/locales/ko.json +353 -356
- package/locales/ky.json +352 -355
- package/locales/lo.json +354 -357
- package/locales/lt.json +322 -325
- package/locales/lv.json +319 -322
- package/locales/mk.json +354 -357
- package/locales/ml.json +353 -356
- package/locales/mn.json +353 -356
- package/locales/mr.json +353 -356
- package/locales/ms.json +14 -17
- package/locales/my.json +352 -355
- package/locales/ne.json +338 -341
- package/locales/nl.json +91 -94
- package/locales/no.json +179 -182
- package/locales/or.json +353 -356
- package/locales/pa.json +353 -356
- package/locales/pl.json +309 -312
- package/locales/pt-PT.json +275 -278
- package/locales/pt.json +268 -271
- package/locales/ro.json +309 -312
- package/locales/ru.json +353 -356
- package/locales/si.json +354 -357
- package/locales/sk.json +335 -338
- package/locales/sl.json +220 -223
- package/locales/sq.json +318 -321
- package/locales/sr-Latn.json +255 -258
- package/locales/sr.json +354 -357
- package/locales/sv.json +281 -284
- package/locales/sw.json +68 -71
- package/locales/ta.json +354 -357
- package/locales/te.json +352 -355
- package/locales/th.json +354 -357
- package/locales/tr.json +328 -331
- package/locales/uk.json +353 -356
- package/locales/ur.json +354 -357
- package/locales/uz.json +168 -171
- package/locales/vi.json +354 -357
- package/locales/zh-HK.json +354 -357
- package/locales/zh-TW.json +353 -356
- package/locales/zh.json +353 -356
- package/locales/zu.json +52 -55
- package/models/cpu_profile/CPUProfileDataModel.d.ts +0 -33
- package/models/cpu_profile/CPUProfileDataModel.js +517 -0
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -0
- package/models/cpu_profile/ProfileTreeModel.d.ts +1 -2
- package/models/cpu_profile/ProfileTreeModel.js +90 -0
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -0
- package/models/cpu_profile/bundle-tsconfig.json +59 -0
- package/models/cpu_profile/bundle-tsconfig.ref.json +27 -0
- package/models/cpu_profile/cpu_profile-tsconfig.json +63 -0
- package/models/cpu_profile/cpu_profile-tsconfig.ref.json +31 -0
- package/models/cpu_profile/cpu_profile.js +7 -0
- package/models/cpu_profile/cpu_profile.js.map +1 -0
- package/models/cpu_profile/cpu_profile_node_typecheck-tsconfig.json +60 -0
- package/models/cpu_profile/cpu_profile_node_typecheck.stamp +0 -0
- package/models/cpu_profile/foundation_unittests-tsconfig.json +63 -0
- package/models/cpu_profile/foundation_unittests-tsconfig.ref.json +30 -0
- package/models/cpu_profile/foundation_unittests_node_typecheck-tsconfig.json +59 -0
- package/models/crux-manager/crux-manager.d.ts +3 -1
- package/models/crux-manager/crux-manager.js +1 -0
- package/models/trace/EntityMapper.js +133 -0
- package/models/trace/EntityMapper.js.map +1 -0
- package/models/trace/EventsSerializer.d.ts +1 -0
- package/models/trace/EventsSerializer.js +113 -0
- package/models/trace/EventsSerializer.js.map +1 -0
- package/models/trace/LanternComputationData.js +394 -0
- package/models/trace/LanternComputationData.js.map +1 -0
- package/models/trace/ModelImpl.js +179 -0
- package/models/trace/ModelImpl.js.map +1 -0
- package/models/trace/Name.js +115 -0
- package/models/trace/Name.js.map +1 -0
- package/models/trace/Processor.js +616 -0
- package/models/trace/Processor.js.map +1 -0
- package/models/trace/Styles.d.ts +2 -2
- package/models/trace/Styles.js +836 -0
- package/models/trace/Styles.js.map +1 -0
- package/models/trace/bundle-tsconfig.json +77 -0
- package/models/trace/bundle-tsconfig.ref.json +45 -0
- package/models/trace/extras/FilmStrip.js +45 -0
- package/models/trace/extras/FilmStrip.js.map +1 -0
- package/models/trace/extras/Initiators.js +47 -0
- package/models/trace/extras/Initiators.js.map +1 -0
- package/models/trace/extras/MainThreadActivity.js +77 -0
- package/models/trace/extras/MainThreadActivity.js.map +1 -0
- package/models/trace/extras/ScriptDuplication.js +163 -0
- package/models/trace/extras/ScriptDuplication.js.map +1 -0
- package/models/trace/extras/StackTraceForEvent.js +192 -0
- package/models/trace/extras/StackTraceForEvent.js.map +1 -0
- package/models/trace/extras/ThirdParties.js +119 -0
- package/models/trace/extras/ThirdParties.js.map +1 -0
- package/models/trace/extras/TraceFilter.js +51 -0
- package/models/trace/extras/TraceFilter.js.map +1 -0
- package/models/trace/extras/TraceTree.js +678 -0
- package/models/trace/extras/TraceTree.js.map +1 -0
- package/models/trace/extras/bundle-tsconfig.json +59 -0
- package/models/trace/extras/bundle-tsconfig.ref.json +27 -0
- package/models/trace/extras/extras-tsconfig.json +81 -0
- package/models/trace/extras/extras-tsconfig.ref.json +49 -0
- package/models/trace/extras/extras.js +12 -0
- package/models/trace/extras/extras.js.map +1 -0
- package/models/trace/extras/extras_node_typecheck-tsconfig.json +78 -0
- package/models/trace/extras/extras_node_typecheck.stamp +0 -0
- package/models/trace/extras/foundation_unittests-tsconfig.json +91 -0
- package/models/trace/extras/foundation_unittests-tsconfig.ref.json +58 -0
- package/models/trace/extras/foundation_unittests_node_typecheck-tsconfig.json +87 -0
- package/models/trace/foundation_unittests-tsconfig.json +70 -0
- package/models/trace/foundation_unittests-tsconfig.ref.json +37 -0
- package/models/trace/foundation_unittests_node_typecheck-tsconfig.json +66 -0
- package/models/trace/handlers/AnimationFramesHandler.js +110 -0
- package/models/trace/handlers/AnimationFramesHandler.js.map +1 -0
- package/models/trace/handlers/AnimationHandler.js +27 -0
- package/models/trace/handlers/AnimationHandler.js.map +1 -0
- package/models/trace/handlers/AsyncJSCallsHandler.js +188 -0
- package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -0
- package/models/trace/handlers/DOMStatsHandler.js +22 -0
- package/models/trace/handlers/DOMStatsHandler.js.map +1 -0
- package/models/trace/handlers/ExtensionTraceDataHandler.js +264 -0
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -0
- package/models/trace/handlers/FlowsHandler.js +155 -0
- package/models/trace/handlers/FlowsHandler.js.map +1 -0
- package/models/trace/handlers/FramesHandler.js +491 -0
- package/models/trace/handlers/FramesHandler.js.map +1 -0
- package/models/trace/handlers/GPUHandler.js +36 -0
- package/models/trace/handlers/GPUHandler.js.map +1 -0
- package/models/trace/handlers/ImagePaintingHandler.js +148 -0
- package/models/trace/handlers/ImagePaintingHandler.js.map +1 -0
- package/models/trace/handlers/InitiatorsHandler.js +169 -0
- package/models/trace/handlers/InitiatorsHandler.js.map +1 -0
- package/models/trace/handlers/InvalidationsHandler.js +125 -0
- package/models/trace/handlers/InvalidationsHandler.js.map +1 -0
- package/models/trace/handlers/LargestImagePaintHandler.js +86 -0
- package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -0
- package/models/trace/handlers/LargestTextPaintHandler.js +28 -0
- package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -0
- package/models/trace/handlers/LayerTreeHandler.js +104 -0
- package/models/trace/handlers/LayerTreeHandler.js.map +1 -0
- package/models/trace/handlers/LayoutShiftsHandler.js +449 -0
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -0
- package/models/trace/handlers/MemoryHandler.js +22 -0
- package/models/trace/handlers/MemoryHandler.js.map +1 -0
- package/models/trace/handlers/MetaHandler.js +442 -0
- package/models/trace/handlers/MetaHandler.js.map +1 -0
- package/models/trace/handlers/ModelHandlers.js +33 -0
- package/models/trace/handlers/ModelHandlers.js.map +1 -0
- package/models/trace/handlers/NetworkRequestsHandler.js +584 -0
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -0
- package/models/trace/handlers/PageFramesHandler.js +43 -0
- package/models/trace/handlers/PageFramesHandler.js.map +1 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js +463 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -0
- package/models/trace/handlers/RendererHandler.js +346 -0
- package/models/trace/handlers/RendererHandler.js.map +1 -0
- package/models/trace/handlers/SamplesHandler.js +264 -0
- package/models/trace/handlers/SamplesHandler.js.map +1 -0
- package/models/trace/handlers/ScreenshotsHandler.js +56 -0
- package/models/trace/handlers/ScreenshotsHandler.js.map +1 -0
- package/models/trace/handlers/ScriptsHandler.js +277 -0
- package/models/trace/handlers/ScriptsHandler.js.map +1 -0
- package/models/trace/handlers/SelectorStatsHandler.js +72 -0
- package/models/trace/handlers/SelectorStatsHandler.js.map +1 -0
- package/models/trace/handlers/Threads.js +108 -0
- package/models/trace/handlers/Threads.js.map +1 -0
- package/models/trace/handlers/UserInteractionsHandler.js +319 -0
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -0
- package/models/trace/handlers/UserTimingsHandler.js +194 -0
- package/models/trace/handlers/UserTimingsHandler.js.map +1 -0
- package/models/trace/handlers/WarningsHandler.js +135 -0
- package/models/trace/handlers/WarningsHandler.js.map +1 -0
- package/models/trace/handlers/WorkersHandler.js +34 -0
- package/models/trace/handlers/WorkersHandler.js.map +1 -0
- package/models/trace/handlers/bundle-tsconfig.json +59 -0
- package/models/trace/handlers/bundle-tsconfig.ref.json +27 -0
- package/models/trace/handlers/foundation_unittests-tsconfig.json +102 -0
- package/models/trace/handlers/foundation_unittests-tsconfig.ref.json +69 -0
- package/models/trace/handlers/foundation_unittests_node_typecheck-tsconfig.json +98 -0
- package/models/trace/handlers/handlers-tsconfig.json +112 -0
- package/models/trace/handlers/handlers-tsconfig.ref.json +80 -0
- package/models/trace/handlers/handlers.js +8 -0
- package/models/trace/handlers/handlers.js.map +1 -0
- package/models/trace/handlers/handlers_node_typecheck-tsconfig.json +109 -0
- package/models/trace/handlers/handlers_node_typecheck.stamp +0 -0
- package/models/trace/handlers/helpers.js +167 -0
- package/models/trace/handlers/helpers.js.map +1 -0
- package/models/trace/handlers/types.js +2 -0
- package/models/trace/handlers/types.js.map +1 -0
- package/models/trace/helpers/Extensions.js +42 -0
- package/models/trace/helpers/Extensions.js.map +1 -0
- package/models/trace/helpers/Network.js +103 -0
- package/models/trace/helpers/Network.js.map +1 -0
- package/models/trace/helpers/SamplesIntegrator.js +527 -0
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -0
- package/models/trace/helpers/SyntheticEvents.d.ts +0 -8
- package/models/trace/helpers/SyntheticEvents.js +73 -0
- package/models/trace/helpers/SyntheticEvents.js.map +1 -0
- package/models/trace/helpers/Timing.js +200 -0
- package/models/trace/helpers/Timing.js.map +1 -0
- package/models/trace/helpers/Trace.js +844 -0
- package/models/trace/helpers/Trace.js.map +1 -0
- package/models/trace/helpers/TreeHelpers.js +255 -0
- package/models/trace/helpers/TreeHelpers.js.map +1 -0
- package/models/trace/helpers/bundle-tsconfig.json +59 -0
- package/models/trace/helpers/bundle-tsconfig.ref.json +27 -0
- package/models/trace/helpers/foundation_unittests-tsconfig.json +73 -0
- package/models/trace/helpers/foundation_unittests-tsconfig.ref.json +40 -0
- package/models/trace/helpers/foundation_unittests_node_typecheck-tsconfig.json +69 -0
- package/models/trace/helpers/helpers-tsconfig.json +77 -0
- package/models/trace/helpers/helpers-tsconfig.ref.json +45 -0
- package/models/trace/helpers/helpers.js +11 -0
- package/models/trace/helpers/helpers.js.map +1 -0
- package/models/trace/helpers/helpers_node_typecheck-tsconfig.json +74 -0
- package/models/trace/helpers/helpers_node_typecheck.stamp +0 -0
- package/models/trace/insights/CLSCulprits.d.ts +14 -14
- package/models/trace/insights/CLSCulprits.js +519 -0
- package/models/trace/insights/CLSCulprits.js.map +1 -0
- package/models/trace/insights/Cache.d.ts +6 -6
- package/models/trace/insights/Cache.js +210 -0
- package/models/trace/insights/Cache.js.map +1 -0
- package/models/trace/insights/CharacterSet.d.ts +8 -8
- package/models/trace/insights/CharacterSet.js +132 -0
- package/models/trace/insights/CharacterSet.js.map +1 -0
- package/models/trace/insights/Common.js +367 -0
- package/models/trace/insights/Common.js.map +1 -0
- package/models/trace/insights/DOMSize.d.ts +13 -13
- package/models/trace/insights/DOMSize.js +182 -0
- package/models/trace/insights/DOMSize.js.map +1 -0
- package/models/trace/insights/DocumentLatency.d.ts +11 -11
- package/models/trace/insights/DocumentLatency.js +259 -0
- package/models/trace/insights/DocumentLatency.js.map +1 -0
- package/models/trace/insights/DuplicatedJavaScript.d.ts +5 -5
- package/models/trace/insights/DuplicatedJavaScript.js +110 -0
- package/models/trace/insights/DuplicatedJavaScript.js.map +1 -0
- package/models/trace/insights/FontDisplay.d.ts +5 -5
- package/models/trace/insights/FontDisplay.js +93 -0
- package/models/trace/insights/FontDisplay.js.map +1 -0
- package/models/trace/insights/ForcedReflow.d.ts +7 -7
- package/models/trace/insights/ForcedReflow.js +162 -0
- package/models/trace/insights/ForcedReflow.js.map +1 -0
- package/models/trace/insights/INPBreakdown.d.ts +8 -8
- package/models/trace/insights/INPBreakdown.js +130 -0
- package/models/trace/insights/INPBreakdown.js.map +1 -0
- package/models/trace/insights/ImageDelivery.d.ts +12 -12
- package/models/trace/insights/ImageDelivery.js +264 -0
- package/models/trace/insights/ImageDelivery.js.map +1 -0
- package/models/trace/insights/LCPBreakdown.d.ts +11 -11
- package/models/trace/insights/LCPBreakdown.js +200 -0
- package/models/trace/insights/LCPBreakdown.js.map +1 -0
- package/models/trace/insights/LCPDiscovery.d.ts +10 -10
- package/models/trace/insights/LCPDiscovery.js +190 -0
- package/models/trace/insights/LCPDiscovery.js.map +1 -0
- package/models/trace/insights/LegacyJavaScript.d.ts +5 -5
- package/models/trace/insights/LegacyJavaScript.js +99 -0
- package/models/trace/insights/LegacyJavaScript.js.map +1 -0
- package/models/trace/insights/Models.js +23 -0
- package/models/trace/insights/Models.js.map +1 -0
- package/models/trace/insights/ModernHTTP.d.ts +5 -5
- package/models/trace/insights/ModernHTTP.js +205 -0
- package/models/trace/insights/ModernHTTP.js.map +1 -0
- package/models/trace/insights/NetworkDependencyTree.d.ts +19 -19
- package/models/trace/insights/NetworkDependencyTree.js +551 -0
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -0
- package/models/trace/insights/RenderBlocking.d.ts +5 -5
- package/models/trace/insights/RenderBlocking.js +213 -0
- package/models/trace/insights/RenderBlocking.js.map +1 -0
- package/models/trace/insights/SlowCSSSelector.d.ts +10 -10
- package/models/trace/insights/SlowCSSSelector.js +140 -0
- package/models/trace/insights/SlowCSSSelector.js.map +1 -0
- package/models/trace/insights/Statistics.js +93 -0
- package/models/trace/insights/Statistics.js.map +1 -0
- package/models/trace/insights/ThirdParties.d.ts +6 -6
- package/models/trace/insights/ThirdParties.js +110 -0
- package/models/trace/insights/ThirdParties.js.map +1 -0
- package/models/trace/insights/Viewport.d.ts +3 -3
- package/models/trace/insights/Viewport.js +105 -0
- package/models/trace/insights/Viewport.js.map +1 -0
- package/models/trace/insights/bundle-tsconfig.json +59 -0
- package/models/trace/insights/bundle-tsconfig.ref.json +27 -0
- package/models/trace/insights/foundation_unittests-tsconfig.json +98 -0
- package/models/trace/insights/foundation_unittests-tsconfig.ref.json +65 -0
- package/models/trace/insights/foundation_unittests_node_typecheck-tsconfig.json +94 -0
- package/models/trace/insights/insights-tsconfig.json +114 -0
- package/models/trace/insights/insights-tsconfig.ref.json +82 -0
- package/models/trace/insights/insights.js +10 -0
- package/models/trace/insights/insights.js.map +1 -0
- package/models/trace/insights/insights_node_typecheck-tsconfig.json +111 -0
- package/models/trace/insights/insights_node_typecheck.stamp +0 -0
- package/models/trace/insights/types.d.ts +3 -3
- package/models/trace/insights/types.js +41 -0
- package/models/trace/insights/types.js.map +1 -0
- package/models/trace/lantern/bundle-tsconfig.json +71 -0
- package/models/trace/lantern/bundle-tsconfig.ref.json +39 -0
- package/models/trace/lantern/core/LanternError.js +7 -0
- package/models/trace/lantern/core/LanternError.js.map +1 -0
- package/models/trace/lantern/core/NetworkAnalyzer.js +496 -0
- package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -0
- package/models/trace/lantern/core/bundle-tsconfig.json +59 -0
- package/models/trace/lantern/core/bundle-tsconfig.ref.json +27 -0
- package/models/trace/lantern/core/core-tsconfig.json +60 -0
- package/models/trace/lantern/core/core-tsconfig.ref.json +28 -0
- package/models/trace/lantern/core/core.js +6 -0
- package/models/trace/lantern/core/core.js.map +1 -0
- package/models/trace/lantern/core/core_node_typecheck-tsconfig.json +57 -0
- package/models/trace/lantern/core/core_node_typecheck.stamp +0 -0
- package/models/trace/lantern/core/foundation_unittests-tsconfig.json +69 -0
- package/models/trace/lantern/core/foundation_unittests-tsconfig.ref.json +36 -0
- package/models/trace/lantern/core/foundation_unittests_node_typecheck-tsconfig.json +65 -0
- package/models/trace/lantern/graph/BaseNode.d.ts +2 -2
- package/models/trace/lantern/graph/BaseNode.js +277 -0
- package/models/trace/lantern/graph/BaseNode.js.map +1 -0
- package/models/trace/lantern/graph/CPUNode.js +80 -0
- package/models/trace/lantern/graph/CPUNode.js.map +1 -0
- package/models/trace/lantern/graph/NetworkNode.js +95 -0
- package/models/trace/lantern/graph/NetworkNode.js.map +1 -0
- package/models/trace/lantern/graph/PageDependencyGraph.js +574 -0
- package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -0
- package/models/trace/lantern/graph/bundle-tsconfig.json +59 -0
- package/models/trace/lantern/graph/bundle-tsconfig.ref.json +27 -0
- package/models/trace/lantern/graph/foundation_unittests-tsconfig.json +61 -0
- package/models/trace/lantern/graph/foundation_unittests-tsconfig.ref.json +28 -0
- package/models/trace/lantern/graph/foundation_unittests_node_typecheck-tsconfig.json +57 -0
- package/models/trace/lantern/graph/graph-tsconfig.json +65 -0
- package/models/trace/lantern/graph/graph-tsconfig.ref.json +33 -0
- package/models/trace/lantern/graph/graph.js +8 -0
- package/models/trace/lantern/graph/graph.js.map +1 -0
- package/models/trace/lantern/graph/graph_node_typecheck-tsconfig.json +62 -0
- package/models/trace/lantern/graph/graph_node_typecheck.stamp +0 -0
- package/models/trace/lantern/lantern.js +10 -0
- package/models/trace/lantern/lantern.js.map +1 -0
- package/models/trace/lantern/metrics/FirstContentfulPaint.js +137 -0
- package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -0
- package/models/trace/lantern/metrics/Interactive.js +68 -0
- package/models/trace/lantern/metrics/Interactive.js.map +1 -0
- package/models/trace/lantern/metrics/LargestContentfulPaint.d.ts +5 -1
- package/models/trace/lantern/metrics/LargestContentfulPaint.js +187 -0
- package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -0
- package/models/trace/lantern/metrics/MaxPotentialFID.js +49 -0
- package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -0
- package/models/trace/lantern/metrics/Metric.js +69 -0
- package/models/trace/lantern/metrics/Metric.js.map +1 -0
- package/models/trace/lantern/metrics/SpeedIndex.js +102 -0
- package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -0
- package/models/trace/lantern/metrics/TBTUtils.js +65 -0
- package/models/trace/lantern/metrics/TBTUtils.js.map +1 -0
- package/models/trace/lantern/metrics/TotalBlockingTime.js +79 -0
- package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -0
- package/models/trace/lantern/metrics/bundle-tsconfig.json +59 -0
- package/models/trace/lantern/metrics/bundle-tsconfig.ref.json +27 -0
- package/models/trace/lantern/metrics/foundation_unittests-tsconfig.json +76 -0
- package/models/trace/lantern/metrics/foundation_unittests-tsconfig.ref.json +43 -0
- package/models/trace/lantern/metrics/foundation_unittests_node_typecheck-tsconfig.json +72 -0
- package/models/trace/lantern/metrics/metrics-tsconfig.json +75 -0
- package/models/trace/lantern/metrics/metrics-tsconfig.ref.json +43 -0
- package/models/trace/lantern/metrics/metrics.js +12 -0
- package/models/trace/lantern/metrics/metrics.js.map +1 -0
- package/models/trace/lantern/metrics/metrics_node_typecheck-tsconfig.json +72 -0
- package/models/trace/lantern/metrics/metrics_node_typecheck.stamp +0 -0
- package/models/trace/lantern/simulation/ConnectionPool.js +116 -0
- package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -0
- package/models/trace/lantern/simulation/Constants.js +45 -0
- package/models/trace/lantern/simulation/Constants.js.map +1 -0
- package/models/trace/lantern/simulation/DNSCache.js +48 -0
- package/models/trace/lantern/simulation/DNSCache.js.map +1 -0
- package/models/trace/lantern/simulation/SimulationTimingMap.js +135 -0
- package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -0
- package/models/trace/lantern/simulation/Simulator.js +461 -0
- package/models/trace/lantern/simulation/Simulator.js.map +1 -0
- package/models/trace/lantern/simulation/TCPConnection.js +155 -0
- package/models/trace/lantern/simulation/TCPConnection.js.map +1 -0
- package/models/trace/lantern/simulation/bundle-tsconfig.json +59 -0
- package/models/trace/lantern/simulation/bundle-tsconfig.ref.json +27 -0
- package/models/trace/lantern/simulation/foundation_unittests-tsconfig.json +75 -0
- package/models/trace/lantern/simulation/foundation_unittests-tsconfig.ref.json +42 -0
- package/models/trace/lantern/simulation/foundation_unittests_node_typecheck-tsconfig.json +71 -0
- package/models/trace/lantern/simulation/simulation-tsconfig.json +70 -0
- package/models/trace/lantern/simulation/simulation-tsconfig.ref.json +38 -0
- package/models/trace/lantern/simulation/simulation.js +10 -0
- package/models/trace/lantern/simulation/simulation.js.map +1 -0
- package/models/trace/lantern/simulation/simulation_node_typecheck-tsconfig.json +67 -0
- package/models/trace/lantern/simulation/simulation_node_typecheck.stamp +0 -0
- package/models/trace/lantern/testing/bundle-tsconfig.json +60 -0
- package/models/trace/lantern/testing/bundle-tsconfig.ref.json +27 -0
- package/models/trace/lantern/testing/testing-tsconfig.json +63 -0
- package/models/trace/lantern/testing/testing-tsconfig.ref.json +30 -0
- package/models/trace/lantern/types/Lantern.d.ts +23 -19
- package/models/trace/lantern/types/Lantern.js +25 -0
- package/models/trace/lantern/types/Lantern.js.map +1 -0
- package/models/trace/lantern/types/bundle-tsconfig.json +59 -0
- package/models/trace/lantern/types/bundle-tsconfig.ref.json +27 -0
- package/models/trace/lantern/types/types-tsconfig.json +59 -0
- package/models/trace/lantern/types/types-tsconfig.ref.json +27 -0
- package/models/trace/lantern/types/types.js +5 -0
- package/models/trace/lantern/types/types.js.map +1 -0
- package/models/trace/lantern/types/types_node_typecheck-tsconfig.json +56 -0
- package/models/trace/lantern/types/types_node_typecheck.stamp +0 -0
- package/models/trace/trace-tsconfig.json +89 -0
- package/models/trace/trace-tsconfig.ref.json +57 -0
- package/models/trace/trace.js +16 -544
- package/models/trace/trace.js.map +1 -0
- package/models/trace/trace_node_typecheck-tsconfig.json +86 -0
- package/models/trace/trace_node_typecheck.stamp +0 -0
- package/models/trace/types/Configuration.d.ts +2 -2
- package/models/trace/types/Configuration.js +19 -0
- package/models/trace/types/Configuration.js.map +1 -0
- package/models/trace/types/Extensions.d.ts +1 -1
- package/models/trace/types/Extensions.js +38 -0
- package/models/trace/types/Extensions.js.map +1 -0
- package/models/trace/types/File.d.ts +9 -3
- package/models/trace/types/File.js +92 -0
- package/models/trace/types/File.js.map +1 -0
- package/models/trace/types/Overlays.js +5 -0
- package/models/trace/types/Overlays.js.map +1 -0
- package/models/trace/types/Timing.js +16 -0
- package/models/trace/types/Timing.js.map +1 -0
- package/models/trace/types/TraceEvents.d.ts +21 -16
- package/models/trace/types/TraceEvents.js +983 -0
- package/models/trace/types/TraceEvents.js.map +1 -0
- package/models/trace/types/bundle-tsconfig.json +59 -0
- package/models/trace/types/bundle-tsconfig.ref.json +27 -0
- package/models/trace/types/foundation_unittests-tsconfig.json +67 -0
- package/models/trace/types/foundation_unittests-tsconfig.ref.json +34 -0
- package/models/trace/types/foundation_unittests_node_typecheck-tsconfig.json +63 -0
- package/models/trace/types/types-tsconfig.json +76 -0
- package/models/trace/types/types-tsconfig.ref.json +44 -0
- package/models/trace/types/types.js +10 -0
- package/models/trace/types/types.js.map +1 -0
- package/models/trace/types/types_node_typecheck-tsconfig.json +73 -0
- package/models/trace/types/types_node_typecheck.stamp +0 -0
- package/package.json +8 -40
- package/test/invalid-animation-events.json.gz +0 -0
- package/test/test-trace-engine.mjs +191 -0
- package/third_party/legacy-javascript/bundle-tsconfig.json +59 -0
- package/third_party/legacy-javascript/bundle-tsconfig.ref.json +27 -0
- package/third_party/legacy-javascript/legacy-javascript-tsconfig.ref.json +15 -0
- package/third_party/legacy-javascript/legacy-javascript.js +3 -0
- package/third_party/legacy-javascript/legacy-javascript.js.map +1 -0
- package/third_party/legacy-javascript/lib/legacy-javascript.js +1119 -0
- package/third_party/marked/marked.d.ts +1 -2
- package/third_party/marked/marked.js +1 -0
- package/third_party/third-party-web/third-party-web.d.ts +1 -2
- package/third_party/third-party-web/third-party-web.js +1 -0
- package/tsconfig.json +29 -0
- package/core/common/Base64.d.ts +0 -12
- package/core/common/CharacterIdMap.d.ts +0 -5
- package/core/common/Color.d.ts +0 -357
- package/core/common/ColorConverter.d.ts +0 -26
- package/core/common/ColorUtils.d.ts +0 -45
- package/core/common/Console.d.ts +0 -54
- package/core/common/Debouncer.d.ts +0 -8
- package/core/common/EventTarget.d.ts +0 -22
- package/core/common/Gzip.d.ts +0 -23
- package/core/common/JavaScriptMetaData.d.ts +0 -20
- package/core/common/Lazy.d.ts +0 -4
- package/core/common/MapWithDefault.d.ts +0 -9
- package/core/common/Mutex.d.ts +0 -13
- package/core/common/Object.d.ts +0 -20
- package/core/common/Progress.d.ts +0 -47
- package/core/common/ResolverBase.d.ts +0 -29
- package/core/common/ResourceType.d.ts +0 -52
- package/core/common/ReturnToPanel.d.ts +0 -10
- package/core/common/Revealer.d.ts +0 -66
- package/core/common/Runnable.d.ts +0 -14
- package/core/common/SegmentedRange.d.ts +0 -14
- package/core/common/SettingRegistration.d.ts +0 -136
- package/core/common/Settings.d.ts +0 -228
- package/core/common/SimpleHistoryManager.d.ts +0 -20
- package/core/common/Srcset.d.ts +0 -16
- package/core/common/StringOutputStream.d.ts +0 -10
- package/core/common/TextDictionary.d.ts +0 -11
- package/core/common/Throttler.d.ts +0 -12
- package/core/common/Trie.d.ts +0 -24
- package/core/common/VersionController.d.ts +0 -85
- package/core/host/AidaClient.d.ts +0 -73
- package/core/host/AidaClientTypes.d.ts +0 -355
- package/core/host/AidaGcaTranslation.d.ts +0 -10
- package/core/host/DispatchHttpRequestClient.d.ts +0 -14
- package/core/host/GcaClient.d.ts +0 -14
- package/core/host/GcaTypes.d.ts +0 -411
- package/core/host/GdpClient.d.ts +0 -84
- package/core/host/InspectorFrontendHost.d.ts +0 -29
- package/core/host/InspectorFrontendHostAPI.d.ts +0 -425
- package/core/host/InspectorFrontendHostStub.d.ts +0 -151
- package/core/host/Platform.d.ts +0 -16
- package/core/host/ResourceLoader.d.ts +0 -15
- package/core/host/UserMetrics.d.ts +0 -116
- package/core/host/UserMetricsEnums.d.ts +0 -888
- package/core/i18n/ByteUtilities.d.ts +0 -11
- package/core/i18n/DevToolsLocale.d.ts +0 -41
- package/core/i18n/NumberFormatter.d.ts +0 -11
- package/core/i18n/i18nImpl.d.ts +0 -64
- package/core/i18n/i18nTypes.d.ts +0 -5
- package/core/i18n/locales.d.ts +0 -15
- package/core/i18n/time-utilities.d.ts +0 -16
- package/core/platform/browser/HostRuntime.d.ts +0 -2
- package/core/platform/browser/browser.d.ts +0 -2
- package/core/platform/node/HostRuntime.d.ts +0 -2
- package/core/platform/node/node.d.ts +0 -2
- package/core/protocol_client/CDPConnection.d.ts +0 -77
- package/core/protocol_client/ConnectionTransport.d.ts +0 -9
- package/core/protocol_client/DevToolsCDPConnection.d.ts +0 -16
- package/core/protocol_client/InspectorBackend.d.ts +0 -223
- package/core/protocol_client/protocol_client.d.ts +0 -5
- package/core/root/DevToolsContext.d.ts +0 -34
- package/core/root/ExperimentNames.d.ts +0 -9
- package/core/root/Runtime.d.ts +0 -353
- package/core/sdk/AccessibilityModel.d.ts +0 -76
- package/core/sdk/AnimationModel.d.ts +0 -161
- package/core/sdk/AutofillModel.d.ts +0 -23
- package/core/sdk/CPUProfilerModel.d.ts +0 -46
- package/core/sdk/CPUThrottlingManager.d.ts +0 -47
- package/core/sdk/CSSContainerQuery.d.ts +0 -42
- package/core/sdk/CSSFontFace.d.ts +0 -10
- package/core/sdk/CSSLayer.d.ts +0 -9
- package/core/sdk/CSSLocation.d.ts +0 -14
- package/core/sdk/CSSMatchedStyles.d.ts +0 -138
- package/core/sdk/CSSMedia.d.ts +0 -36
- package/core/sdk/CSSMetadata.d.ts +0 -87
- package/core/sdk/CSSModel.d.ts +0 -185
- package/core/sdk/CSSNavigation.d.ts +0 -10
- package/core/sdk/CSSProperty.d.ts +0 -53
- package/core/sdk/CSSPropertyParser.d.ts +0 -126
- package/core/sdk/CSSPropertyParserMatchers.d.ts +0 -442
- package/core/sdk/CSSQuery.d.ts +0 -22
- package/core/sdk/CSSRule.d.ts +0 -132
- package/core/sdk/CSSScope.d.ts +0 -9
- package/core/sdk/CSSStartingStyle.d.ts +0 -9
- package/core/sdk/CSSStyleDeclaration.d.ts +0 -38
- package/core/sdk/CSSStyleSheetHeader.d.ts +0 -53
- package/core/sdk/CSSSupports.d.ts +0 -10
- package/core/sdk/CategorizedBreakpoint.d.ts +0 -42
- package/core/sdk/ChildTargetManager.d.ts +0 -40
- package/core/sdk/CompilerSourceMappingContentProvider.d.ts +0 -12
- package/core/sdk/Connections.d.ts +0 -36
- package/core/sdk/ConsoleModel.d.ts +0 -127
- package/core/sdk/ConsoleModelTypes.d.ts +0 -6
- package/core/sdk/Cookie.d.ts +0 -68
- package/core/sdk/CookieModel.d.ts +0 -31
- package/core/sdk/CookieParser.d.ts +0 -14
- package/core/sdk/CrashReportContextModel.d.ts +0 -8
- package/core/sdk/DOMDebuggerModel.d.ts +0 -127
- package/core/sdk/DOMModel.d.ts +0 -440
- package/core/sdk/DOMStorageModel.d.ts +0 -79
- package/core/sdk/DebuggerModel.d.ts +0 -305
- package/core/sdk/EmulationModel.d.ts +0 -95
- package/core/sdk/EnhancedTracesParser.d.ts +0 -105
- package/core/sdk/EventBreakpointsModel.d.ts +0 -66
- package/core/sdk/FrameAssociated.d.ts +0 -6
- package/core/sdk/FrameManager.d.ts +0 -68
- package/core/sdk/HeapProfilerModel.d.ts +0 -75
- package/core/sdk/HttpReasonPhraseStrings.d.ts +0 -5
- package/core/sdk/IOModel.d.ts +0 -10
- package/core/sdk/IsolateManager.d.ts +0 -53
- package/core/sdk/IssuesModel.d.ts +0 -28
- package/core/sdk/LayerTreeBase.d.ts +0 -70
- package/core/sdk/LogModel.d.ts +0 -20
- package/core/sdk/NetworkManager.d.ts +0 -418
- package/core/sdk/NetworkRequest.d.ts +0 -497
- package/core/sdk/NetworkRequestAccess.d.ts +0 -91
- package/core/sdk/OverlayColorGenerator.d.ts +0 -14
- package/core/sdk/OverlayModel.d.ts +0 -186
- package/core/sdk/OverlayPersistentHighlighter.d.ts +0 -116
- package/core/sdk/PageFunctions.d.ts +0 -22
- package/core/sdk/PageLoad.d.ts +0 -14
- package/core/sdk/PageResourceLoader.d.ts +0 -111
- package/core/sdk/PaintProfiler.d.ts +0 -43
- package/core/sdk/PerformanceMetricsModel.d.ts +0 -12
- package/core/sdk/PreloadingModel.d.ts +0 -146
- package/core/sdk/RehydratingConnection.d.ts +0 -73
- package/core/sdk/RehydratingObject.d.ts +0 -59
- package/core/sdk/RemoteObject.d.ts +0 -210
- package/core/sdk/Resource.d.ts +0 -36
- package/core/sdk/ResourceTreeModel.d.ts +0 -280
- package/core/sdk/RuntimeModel.d.ts +0 -164
- package/core/sdk/SDKModel.d.ts +0 -30
- package/core/sdk/SDKSettings.d.ts +0 -54
- package/core/sdk/ScopeTreeCache.d.ts +0 -21
- package/core/sdk/ScreenCaptureModel.d.ts +0 -69
- package/core/sdk/Script.d.ts +0 -134
- package/core/sdk/SecurityOrigin.d.ts +0 -108
- package/core/sdk/SecurityOriginManager.d.ts +0 -23
- package/core/sdk/ServerSentEvents.d.ts +0 -18
- package/core/sdk/ServerSentEventsProtocol.d.ts +0 -18
- package/core/sdk/ServerTiming.d.ts +0 -24
- package/core/sdk/ServiceWorkerCacheModel.d.ts +0 -71
- package/core/sdk/ServiceWorkerManager.d.ts +0 -125
- package/core/sdk/SourceMap.d.ts +0 -211
- package/core/sdk/SourceMapCache.d.ts +0 -12
- package/core/sdk/SourceMapFunctionRanges.d.ts +0 -23
- package/core/sdk/SourceMapManager.d.ts +0 -46
- package/core/sdk/SourceMapRangeMappings.d.ts +0 -15
- package/core/sdk/SourceMapScopeChainEntry.d.ts +0 -23
- package/core/sdk/SourceMapScopesInfo.d.ts +0 -184
- package/core/sdk/StorageBucketsModel.d.ts +0 -48
- package/core/sdk/StorageKeyManager.d.ts +0 -38
- package/core/sdk/Target.d.ts +0 -79
- package/core/sdk/TargetManager.d.ts +0 -92
- package/core/sdk/TraceObject.d.ts +0 -43
- package/core/sdk/WebAuthnModel.d.ts +0 -29
- package/core/text_utils/CodeMirrorUtils.d.ts +0 -3
- package/core/text_utils/ContentData.d.ts +0 -94
- package/core/text_utils/ContentProvider.d.ts +0 -42
- package/core/text_utils/Markdown.d.ts +0 -13
- package/core/text_utils/StaticContentProvider.d.ts +0 -13
- package/core/text_utils/StreamingContentData.d.ts +0 -49
- package/core/text_utils/Text.d.ts +0 -19
- package/core/text_utils/TextCursor.d.ts +0 -9
- package/core/text_utils/TextRange.d.ts +0 -81
- package/core/text_utils/TextUtils.d.ts +0 -97
- package/core/text_utils/WasmDisassembly.d.ts +0 -29
- package/core/text_utils/text_utils.d.ts +0 -12
- package/entrypoints/formatter_actions/formatter_actions.d.ts +0 -65
- package/generated/InspectorBackendCommands.d.ts +0 -14
- package/generated/SupportedCSSProperties.d.ts +0 -18
- package/generated/protocol-mapping.d.ts +0 -5985
- package/generated/protocol-proxy-api.d.ts +0 -5447
- package/index.d.ts +0 -2
- package/index.js +0 -6
- package/models/crux-manager/CrUXManager.d.ts +0 -107
- package/models/emulation/DeviceModeModel.d.ts +0 -157
- package/models/emulation/EmulatedDevices.d.ts +0 -148
- package/models/emulation/emulation.d.ts +0 -3
- package/models/formatter/FormatterWorkerPool.d.ts +0 -58
- package/models/formatter/ScriptFormatter.d.ts +0 -11
- package/models/formatter/formatter.d.ts +0 -3
- package/third_party/codemirror.next/codemirror.next.d.ts +0 -9196
- package/third_party/i18n/i18n-impl.d.ts +0 -25
- package/third_party/i18n/i18n.d.ts +0 -3
- package/third_party/i18n/localized-string-set.d.ts +0 -49
- package/third_party/intl-messageformat/intl-messageformat.d.ts +0 -1
- package/third_party/marked/package/lib/marked.esm.d.ts +0 -760
- package/third_party/source-map-scopes-codec/package/src/builder/builder.d.ts +0 -70
- package/third_party/source-map-scopes-codec/package/src/builder/safe_builder.d.ts +0 -40
- package/third_party/source-map-scopes-codec/package/src/codec.d.ts +0 -49
- package/third_party/source-map-scopes-codec/package/src/decode/decode.d.ts +0 -33
- package/third_party/source-map-scopes-codec/package/src/encode/encode.d.ts +0 -8
- package/third_party/source-map-scopes-codec/package/src/encode/encoder.d.ts +0 -9
- package/third_party/source-map-scopes-codec/package/src/mod.d.ts +0 -5
- package/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -169
- package/third_party/source-map-scopes-codec/package/src/util.d.ts +0 -5
- package/third_party/source-map-scopes-codec/package/src/vlq.d.ts +0 -14
- package/third_party/source-map-scopes-codec/source-map-scopes-codec.d.ts +0 -1
- package/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
- package/third_party/third-party-web/package/lib/index.d.ts +0 -34
- package/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
|
5
|
+
import * as Handlers from '../handlers/handlers.js';
|
|
6
|
+
import * as Helpers from '../helpers/helpers.js';
|
|
7
|
+
import { InsightCategory, InsightKeys, } from './types.js';
|
|
8
|
+
export const UIStrings = {
|
|
9
|
+
/**
|
|
10
|
+
* @description Text to tell the user about the longest user interaction.
|
|
11
|
+
*/
|
|
12
|
+
description: 'Start investigating [how to improve INP](https://developer.chrome.com/docs/performance/insights/inp-breakdown) by looking at the longest subpart',
|
|
13
|
+
/**
|
|
14
|
+
* @description Title for the performance insight "INP breakdown", which shows a breakdown of INP by subparts / sections.
|
|
15
|
+
*/
|
|
16
|
+
title: 'INP breakdown',
|
|
17
|
+
/**
|
|
18
|
+
* @description Label used for the subpart/component/stage/section of a larger duration.
|
|
19
|
+
*/
|
|
20
|
+
subpart: 'Subpart',
|
|
21
|
+
/**
|
|
22
|
+
* @description Label used for a time duration.
|
|
23
|
+
*/
|
|
24
|
+
duration: 'Duration',
|
|
25
|
+
// TODO: these are repeated in InteractionBreakdown. Add a place for common strings?
|
|
26
|
+
/**
|
|
27
|
+
* @description Text shown next to the interaction event's input delay time in the detail view.
|
|
28
|
+
*/
|
|
29
|
+
inputDelay: 'Input delay',
|
|
30
|
+
/**
|
|
31
|
+
* @description Text shown next to the interaction event's thread processing duration in the detail view.
|
|
32
|
+
*/
|
|
33
|
+
processingDuration: 'Processing duration',
|
|
34
|
+
/**
|
|
35
|
+
* @description Text shown next to the interaction event's presentation delay time in the detail view.
|
|
36
|
+
*/
|
|
37
|
+
presentationDelay: 'Presentation delay',
|
|
38
|
+
/**
|
|
39
|
+
* @description Text status indicating that no user interactions were detected.
|
|
40
|
+
*/
|
|
41
|
+
noInteractions: 'No interactions detected',
|
|
42
|
+
};
|
|
43
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/INPBreakdown.ts', UIStrings);
|
|
44
|
+
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
45
|
+
export function isINPBreakdownInsight(insight) {
|
|
46
|
+
return insight.insightKey === InsightKeys.INP_BREAKDOWN;
|
|
47
|
+
}
|
|
48
|
+
function finalize(partialModel) {
|
|
49
|
+
let state = 'pass';
|
|
50
|
+
if (partialModel.longestInteractionEvent) {
|
|
51
|
+
const classification = Handlers.ModelHandlers.UserInteractions.scoreClassificationForInteractionToNextPaint(partialModel.longestInteractionEvent.dur);
|
|
52
|
+
if (classification === Handlers.ModelHandlers.PageLoadMetrics.ScoreClassification.GOOD) {
|
|
53
|
+
state = 'informative';
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
state = 'fail';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
insightKey: InsightKeys.INP_BREAKDOWN,
|
|
61
|
+
strings: UIStrings,
|
|
62
|
+
title: i18nString(UIStrings.title),
|
|
63
|
+
description: i18nString(UIStrings.description),
|
|
64
|
+
docs: 'https://developer.chrome.com/docs/performance/insights/inp-breakdown',
|
|
65
|
+
category: InsightCategory.INP,
|
|
66
|
+
state,
|
|
67
|
+
...partialModel,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function generateInsight(data, context) {
|
|
71
|
+
const interactionEvents = data.UserInteractions.interactionEventsWithNoNesting.filter(event => {
|
|
72
|
+
return Helpers.Timing.eventIsInBounds(event, context.bounds);
|
|
73
|
+
});
|
|
74
|
+
if (!interactionEvents.length) {
|
|
75
|
+
// A valid result, when there is no user interaction.
|
|
76
|
+
return finalize({});
|
|
77
|
+
}
|
|
78
|
+
const longestByInteractionId = new Map();
|
|
79
|
+
for (const event of interactionEvents) {
|
|
80
|
+
const key = event.interactionId;
|
|
81
|
+
const longest = longestByInteractionId.get(key);
|
|
82
|
+
if (!longest || event.dur > longest.dur) {
|
|
83
|
+
longestByInteractionId.set(key, event);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const normalizedInteractionEvents = [...longestByInteractionId.values()];
|
|
87
|
+
normalizedInteractionEvents.sort((a, b) => b.dur - a.dur);
|
|
88
|
+
// INP is the "nearest-rank"/inverted_cdf 98th percentile, except Chrome only
|
|
89
|
+
// keeps the 10 worst events around, so it can never be more than the 10th from
|
|
90
|
+
// last array element. To keep things simpler, sort desc and pick from front.
|
|
91
|
+
// See https://source.chromium.org/chromium/chromium/src/+/main:components/page_load_metrics/browser/responsiveness_metrics_normalization.cc;l=45-59;drc=cb0f9c8b559d9c7c3cb4ca94fc1118cc015d38ad
|
|
92
|
+
const highPercentileIndex = Math.min(9, Math.floor(normalizedInteractionEvents.length / 50));
|
|
93
|
+
return finalize({
|
|
94
|
+
relatedEvents: [normalizedInteractionEvents[0]],
|
|
95
|
+
longestInteractionEvent: normalizedInteractionEvents[0],
|
|
96
|
+
highPercentileInteractionEvent: normalizedInteractionEvents[highPercentileIndex],
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* If `subpart` is -1, then all subparts are included. Otherwise it's just that index.
|
|
101
|
+
**/
|
|
102
|
+
export function createOverlaysForSubpart(event, subpartIndex = -1) {
|
|
103
|
+
const p1 = Helpers.Timing.traceWindowFromMicroSeconds(event.ts, (event.ts + event.inputDelay));
|
|
104
|
+
const p2 = Helpers.Timing.traceWindowFromMicroSeconds(p1.max, (p1.max + event.mainThreadHandling));
|
|
105
|
+
const p3 = Helpers.Timing.traceWindowFromMicroSeconds(p2.max, (p2.max + event.presentationDelay));
|
|
106
|
+
let sections = [
|
|
107
|
+
{ bounds: p1, label: i18nString(UIStrings.inputDelay), showDuration: true },
|
|
108
|
+
{ bounds: p2, label: i18nString(UIStrings.processingDuration), showDuration: true },
|
|
109
|
+
{ bounds: p3, label: i18nString(UIStrings.presentationDelay), showDuration: true },
|
|
110
|
+
];
|
|
111
|
+
if (subpartIndex !== -1) {
|
|
112
|
+
sections = [sections[subpartIndex]];
|
|
113
|
+
}
|
|
114
|
+
return [
|
|
115
|
+
{
|
|
116
|
+
type: 'TIMESPAN_BREAKDOWN',
|
|
117
|
+
sections,
|
|
118
|
+
renderLocation: 'BELOW_EVENT',
|
|
119
|
+
entry: event,
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
export function createOverlays(model) {
|
|
124
|
+
const event = model.longestInteractionEvent;
|
|
125
|
+
if (!event) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
return createOverlaysForSubpart(event);
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=INPBreakdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"INPBreakdown.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/INPBreakdown.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,WAAW,EACP,kJAAkJ;IACtJ;;OAEG;IACH,KAAK,EAAE,eAAe;IACtB;;OAEG;IACH,OAAO,EAAE,SAAS;IAClB;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB,oFAAoF;IACpF;;OAEG;IACH,UAAU,EAAE,aAAa;IACzB;;OAEG;IACH,kBAAkB,EAAE,qBAAqB;IACzC;;OAEG;IACH,iBAAiB,EAAE,oBAAoB;IACvC;;OAEG;IACH,cAAc,EAAE,0BAA0B;C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K,GAAG,KAAK,CAAC,uBAAuB,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as i18n from '../../../core/i18n/i18n.js';\nimport * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport type * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /**\n * @description Text to tell the user about the longest user interaction.\n */\n description:\n 'Start investigating [how to improve INP](https://developer.chrome.com/docs/performance/insights/inp-breakdown) by looking at the longest subpart',\n /**\n * @description Title for the performance insight \"INP breakdown\", which shows a breakdown of INP by subparts / sections.\n */\n title: 'INP breakdown',\n /**\n * @description Label used for the subpart/component/stage/section of a larger duration.\n */\n subpart: 'Subpart',\n /**\n * @description Label used for a time duration.\n */\n duration: 'Duration',\n\n // TODO: these are repeated in InteractionBreakdown. Add a place for common strings?\n /**\n * @description Text shown next to the interaction event's input delay time in the detail view.\n */\n inputDelay: 'Input delay',\n /**\n * @description Text shown next to the interaction event's thread processing duration in the detail view.\n */\n processingDuration: 'Processing duration',\n /**\n * @description Text shown next to the interaction event's presentation delay time in the detail view.\n */\n presentationDelay: 'Presentation delay',\n /**\n * @description Text status indicating that no user interactions were detected.\n */\n noInteractions: 'No interactions detected',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/INPBreakdown.ts', UIStrings);\nexport const i18nString: i18n.LocalizeString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type INPBreakdownInsightModel = InsightModel<typeof UIStrings, {\n longestInteractionEvent?: Types.Events.SyntheticInteractionPair,\n highPercentileInteractionEvent?: Types.Events.SyntheticInteractionPair,\n}>;\n\nexport function isINPBreakdownInsight(insight: InsightModel): insight is INPBreakdownInsightModel {\n return insight.insightKey === InsightKeys.INP_BREAKDOWN;\n}\n\nfunction finalize(partialModel: PartialInsightModel<INPBreakdownInsightModel>): INPBreakdownInsightModel {\n let state: INPBreakdownInsightModel['state'] = 'pass';\n if (partialModel.longestInteractionEvent) {\n const classification = Handlers.ModelHandlers.UserInteractions.scoreClassificationForInteractionToNextPaint(\n partialModel.longestInteractionEvent.dur);\n if (classification === Handlers.ModelHandlers.PageLoadMetrics.ScoreClassification.GOOD) {\n state = 'informative';\n } else {\n state = 'fail';\n }\n }\n\n return {\n insightKey: InsightKeys.INP_BREAKDOWN,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/inp-breakdown',\n category: InsightCategory.INP,\n state,\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n data: Handlers.Types.HandlerData, context: InsightSetContext): INPBreakdownInsightModel {\n const interactionEvents = data.UserInteractions.interactionEventsWithNoNesting.filter(event => {\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n if (!interactionEvents.length) {\n // A valid result, when there is no user interaction.\n return finalize({});\n }\n\n const longestByInteractionId = new Map<number, Types.Events.SyntheticInteractionPair>();\n for (const event of interactionEvents) {\n const key = event.interactionId;\n const longest = longestByInteractionId.get(key);\n if (!longest || event.dur > longest.dur) {\n longestByInteractionId.set(key, event);\n }\n }\n const normalizedInteractionEvents = [...longestByInteractionId.values()];\n normalizedInteractionEvents.sort((a, b) => b.dur - a.dur);\n\n // INP is the \"nearest-rank\"/inverted_cdf 98th percentile, except Chrome only\n // keeps the 10 worst events around, so it can never be more than the 10th from\n // last array element. To keep things simpler, sort desc and pick from front.\n // See https://source.chromium.org/chromium/chromium/src/+/main:components/page_load_metrics/browser/responsiveness_metrics_normalization.cc;l=45-59;drc=cb0f9c8b559d9c7c3cb4ca94fc1118cc015d38ad\n const highPercentileIndex = Math.min(9, Math.floor(normalizedInteractionEvents.length / 50));\n\n return finalize({\n relatedEvents: [normalizedInteractionEvents[0]],\n longestInteractionEvent: normalizedInteractionEvents[0],\n highPercentileInteractionEvent: normalizedInteractionEvents[highPercentileIndex],\n });\n}\n\n/**\n * If `subpart` is -1, then all subparts are included. Otherwise it's just that index.\n **/\nexport function createOverlaysForSubpart(\n event: Types.Events.SyntheticInteractionPair, subpartIndex = -1): Types.Overlays.Overlay[] {\n const p1 = Helpers.Timing.traceWindowFromMicroSeconds(\n event.ts,\n (event.ts + event.inputDelay) as Types.Timing.Micro,\n );\n const p2 = Helpers.Timing.traceWindowFromMicroSeconds(\n p1.max,\n (p1.max + event.mainThreadHandling) as Types.Timing.Micro,\n );\n const p3 = Helpers.Timing.traceWindowFromMicroSeconds(\n p2.max,\n (p2.max + event.presentationDelay) as Types.Timing.Micro,\n );\n let sections = [\n {bounds: p1, label: i18nString(UIStrings.inputDelay), showDuration: true},\n {bounds: p2, label: i18nString(UIStrings.processingDuration), showDuration: true},\n {bounds: p3, label: i18nString(UIStrings.presentationDelay), showDuration: true},\n ];\n if (subpartIndex !== -1) {\n sections = [sections[subpartIndex]];\n }\n\n return [\n {\n type: 'TIMESPAN_BREAKDOWN',\n sections,\n renderLocation: 'BELOW_EVENT',\n entry: event,\n },\n ];\n}\n\nexport function createOverlays(model: INPBreakdownInsightModel): Types.Overlays.Overlay[] {\n const event = model.longestInteractionEvent;\n if (!event) {\n return [];\n }\n\n return createOverlaysForSubpart(event);\n}\n"]}
|
|
@@ -7,48 +7,48 @@ export declare const UIStrings: {
|
|
|
7
7
|
/**
|
|
8
8
|
* @description Title of an insight that recommends ways to reduce the size of images downloaded and used on the page.
|
|
9
9
|
*/
|
|
10
|
-
readonly title:
|
|
10
|
+
readonly title: 'Improve image delivery';
|
|
11
11
|
/**
|
|
12
12
|
* @description Description of an insight that recommends ways to reduce the size of images downloaded and used on the page.
|
|
13
13
|
*/
|
|
14
|
-
readonly description:
|
|
14
|
+
readonly description: 'Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).';
|
|
15
15
|
/**
|
|
16
16
|
* @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
|
|
17
17
|
*/
|
|
18
|
-
readonly useCompression:
|
|
18
|
+
readonly useCompression: 'Increasing the image compression factor could improve this image’s download size';
|
|
19
19
|
/**
|
|
20
20
|
* @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
|
|
21
21
|
*/
|
|
22
|
-
readonly useModernFormat:
|
|
22
|
+
readonly useModernFormat: 'Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image’s download size';
|
|
23
23
|
/**
|
|
24
24
|
* @description Message displayed in a chip advising the user to use video formats instead of GIFs because videos generally have smaller file sizes.
|
|
25
25
|
*/
|
|
26
|
-
readonly useVideoFormat:
|
|
26
|
+
readonly useVideoFormat: 'Using video formats instead of GIFs can improve the download size of animated content';
|
|
27
27
|
/**
|
|
28
28
|
* @description Message displayed in a chip explaining that an image was displayed on the page with dimensions much smaller than the image file dimensions.
|
|
29
29
|
* @example {1000x500} PH1
|
|
30
30
|
* @example {100x50} PH2
|
|
31
31
|
*/
|
|
32
|
-
readonly useResponsiveSize:
|
|
32
|
+
readonly useResponsiveSize: 'This image file is larger than it needs to be ({PH1}) for its displayed dimensions ({PH2}). Use responsive images to reduce the image download size.';
|
|
33
33
|
/**
|
|
34
34
|
* @description Column header for a table column containing network requests for images which can improve their file size (e.g. use a different format, increase compression, etc).
|
|
35
35
|
*/
|
|
36
|
-
readonly optimizeFile:
|
|
36
|
+
readonly optimizeFile: 'Optimize file size';
|
|
37
37
|
/**
|
|
38
38
|
* @description Table row value representing the remaining items not shown in the table due to size constraints. This row will always represent at least 2 items.
|
|
39
39
|
* @example {5} PH1
|
|
40
40
|
*/
|
|
41
|
-
readonly others:
|
|
41
|
+
readonly others: '{PH1} others';
|
|
42
42
|
/**
|
|
43
43
|
* @description Text status indicating that no potential optimizations were found for any image file.
|
|
44
44
|
*/
|
|
45
|
-
readonly noOptimizableImages:
|
|
45
|
+
readonly noOptimizableImages: 'No optimizable images';
|
|
46
46
|
/**
|
|
47
47
|
* @description Text describing the estimated number of bytes that an image file optimization can save. This text is appended to another block of text describing the image optimization in more detail. "Est" means "Estimated".
|
|
48
48
|
* @example {Use the correct image dimensions to reduce the image file size.} PH1
|
|
49
49
|
* @example {50 MB} PH2
|
|
50
50
|
*/
|
|
51
|
-
readonly estimatedSavings:
|
|
51
|
+
readonly estimatedSavings: '{PH1} (Est {PH2})';
|
|
52
52
|
};
|
|
53
53
|
export declare const i18nString: i18n.LocalizeString;
|
|
54
54
|
export declare enum ImageOptimizationType {
|
|
@@ -90,8 +90,8 @@ export type ImageDeliveryInsightModel = InsightModel<typeof UIStrings, {
|
|
|
90
90
|
wastedBytes: number;
|
|
91
91
|
}>;
|
|
92
92
|
export declare function isImageDeliveryInsight(model: InsightModel): model is ImageDeliveryInsightModel;
|
|
93
|
-
export declare function getOptimizationMessage(optimization: ImageOptimization):
|
|
94
|
-
export declare function getOptimizationMessageWithBytes(optimization: ImageOptimization):
|
|
93
|
+
export declare function getOptimizationMessage(optimization: ImageOptimization): Platform.UIString.LocalizedString;
|
|
94
|
+
export declare function getOptimizationMessageWithBytes(optimization: ImageOptimization): Platform.UIString.LocalizedString;
|
|
95
95
|
export declare function generateInsight(data: Handlers.Types.HandlerData, context: InsightSetContext): ImageDeliveryInsightModel;
|
|
96
96
|
export declare function createOverlayForRequest(request: Types.Events.SyntheticNetworkRequest): Types.Overlays.EntryOutline;
|
|
97
97
|
export declare function createOverlays(model: ImageDeliveryInsightModel): Types.Overlays.Overlay[];
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
|
5
|
+
import * as Helpers from '../helpers/helpers.js';
|
|
6
|
+
import { metricSavingsForWastedBytes } from './Common.js';
|
|
7
|
+
import { InsightCategory, InsightKeys, } from './types.js';
|
|
8
|
+
export const UIStrings = {
|
|
9
|
+
/**
|
|
10
|
+
* @description Title of an insight that recommends ways to reduce the size of images downloaded and used on the page.
|
|
11
|
+
*/
|
|
12
|
+
title: 'Improve image delivery',
|
|
13
|
+
/**
|
|
14
|
+
* @description Description of an insight that recommends ways to reduce the size of images downloaded and used on the page.
|
|
15
|
+
*/
|
|
16
|
+
description: 'Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).',
|
|
17
|
+
/**
|
|
18
|
+
* @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
|
|
19
|
+
*/
|
|
20
|
+
useCompression: 'Increasing the image compression factor could improve this image’s download size',
|
|
21
|
+
/**
|
|
22
|
+
* @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
|
|
23
|
+
*/
|
|
24
|
+
useModernFormat: 'Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image’s download size',
|
|
25
|
+
/**
|
|
26
|
+
* @description Message displayed in a chip advising the user to use video formats instead of GIFs because videos generally have smaller file sizes.
|
|
27
|
+
*/
|
|
28
|
+
useVideoFormat: 'Using video formats instead of GIFs can improve the download size of animated content',
|
|
29
|
+
/**
|
|
30
|
+
* @description Message displayed in a chip explaining that an image was displayed on the page with dimensions much smaller than the image file dimensions.
|
|
31
|
+
* @example {1000x500} PH1
|
|
32
|
+
* @example {100x50} PH2
|
|
33
|
+
*/
|
|
34
|
+
useResponsiveSize: 'This image file is larger than it needs to be ({PH1}) for its displayed dimensions ({PH2}). Use responsive images to reduce the image download size.',
|
|
35
|
+
/**
|
|
36
|
+
* @description Column header for a table column containing network requests for images which can improve their file size (e.g. use a different format, increase compression, etc).
|
|
37
|
+
*/
|
|
38
|
+
optimizeFile: 'Optimize file size',
|
|
39
|
+
/**
|
|
40
|
+
* @description Table row value representing the remaining items not shown in the table due to size constraints. This row will always represent at least 2 items.
|
|
41
|
+
* @example {5} PH1
|
|
42
|
+
*/
|
|
43
|
+
others: '{PH1} others',
|
|
44
|
+
/**
|
|
45
|
+
* @description Text status indicating that no potential optimizations were found for any image file.
|
|
46
|
+
*/
|
|
47
|
+
noOptimizableImages: 'No optimizable images',
|
|
48
|
+
/**
|
|
49
|
+
* @description Text describing the estimated number of bytes that an image file optimization can save. This text is appended to another block of text describing the image optimization in more detail. "Est" means "Estimated".
|
|
50
|
+
* @example {Use the correct image dimensions to reduce the image file size.} PH1
|
|
51
|
+
* @example {50 MB} PH2
|
|
52
|
+
*/
|
|
53
|
+
estimatedSavings: '{PH1} (Est {PH2})',
|
|
54
|
+
};
|
|
55
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/ImageDelivery.ts', UIStrings);
|
|
56
|
+
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
57
|
+
/**
|
|
58
|
+
* Even JPEGs with lots of detail can usually be compressed down to <1 byte per pixel
|
|
59
|
+
* Using 4:2:2 subsampling already gets an uncompressed bitmap to 2 bytes per pixel.
|
|
60
|
+
* The compression ratio for JPEG is usually somewhere around 10:1 depending on content, so
|
|
61
|
+
* 8:1 is a reasonable expectation for web content which is 1.5MB for a 6MP image.
|
|
62
|
+
*
|
|
63
|
+
* WebP usually gives ~20% additional savings on top of that, so we will assume 10:1 for WebP.
|
|
64
|
+
* This is quite pessimistic as their study shows a photographic compression ratio of ~29:1.
|
|
65
|
+
* https://developers.google.com/speed/webp/docs/webp_lossless_alpha_study#results
|
|
66
|
+
*
|
|
67
|
+
* AVIF usually gives ~20% additional savings on top of WebP, so we will use 12:1 for AVIF.
|
|
68
|
+
* This is quite pessimistic as Netflix study shows a photographic compression ratio of ~40:1
|
|
69
|
+
* (0.4 *bits* per pixel at SSIM 0.97).
|
|
70
|
+
* https://netflixtechblog.com/avif-for-next-generation-image-coding-b1d75675fe4
|
|
71
|
+
*/
|
|
72
|
+
const TARGET_BYTES_PER_PIXEL_AVIF = 2 * 1 / 12;
|
|
73
|
+
/**
|
|
74
|
+
* If GIFs are above this size, we'll flag them
|
|
75
|
+
* See https://github.com/GoogleChrome/lighthouse/pull/4885#discussion_r178406623 and https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-370979920
|
|
76
|
+
*/
|
|
77
|
+
const GIF_SIZE_THRESHOLD = 100 * 1024;
|
|
78
|
+
const BYTE_SAVINGS_THRESHOLD = 4096;
|
|
79
|
+
// Ignore up to 12KB of waste for responsive images if an effort was made with breakpoints.
|
|
80
|
+
const BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS = 12288;
|
|
81
|
+
export var ImageOptimizationType;
|
|
82
|
+
(function (ImageOptimizationType) {
|
|
83
|
+
ImageOptimizationType["ADJUST_COMPRESSION"] = "ADJUST_COMPRESSION";
|
|
84
|
+
ImageOptimizationType["MODERN_FORMAT_OR_COMPRESSION"] = "MODERN_FORMAT_OR_COMPRESSION";
|
|
85
|
+
ImageOptimizationType["VIDEO_FORMAT"] = "VIDEO_FORMAT";
|
|
86
|
+
ImageOptimizationType["RESPONSIVE_SIZE"] = "RESPONSIVE_SIZE";
|
|
87
|
+
})(ImageOptimizationType || (ImageOptimizationType = {}));
|
|
88
|
+
export function isImageDeliveryInsight(model) {
|
|
89
|
+
return model.insightKey === 'ImageDelivery';
|
|
90
|
+
}
|
|
91
|
+
export function getOptimizationMessage(optimization) {
|
|
92
|
+
switch (optimization.type) {
|
|
93
|
+
case ImageOptimizationType.ADJUST_COMPRESSION:
|
|
94
|
+
return i18nString(UIStrings.useCompression);
|
|
95
|
+
case ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION:
|
|
96
|
+
return i18nString(UIStrings.useModernFormat);
|
|
97
|
+
case ImageOptimizationType.VIDEO_FORMAT:
|
|
98
|
+
return i18nString(UIStrings.useVideoFormat);
|
|
99
|
+
case ImageOptimizationType.RESPONSIVE_SIZE:
|
|
100
|
+
return i18nString(UIStrings.useResponsiveSize, {
|
|
101
|
+
PH1: `${optimization.fileDimensions.width}x${optimization.fileDimensions.height}`,
|
|
102
|
+
PH2: `${optimization.displayDimensions.width}x${optimization.displayDimensions.height}`,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function getOptimizationMessageWithBytes(optimization) {
|
|
107
|
+
const byteSavingsText = i18n.ByteUtilities.bytesToString(optimization.byteSavings);
|
|
108
|
+
const optimizationMessage = getOptimizationMessage(optimization);
|
|
109
|
+
return i18nString(UIStrings.estimatedSavings, { PH1: optimizationMessage, PH2: byteSavingsText });
|
|
110
|
+
}
|
|
111
|
+
function finalize(partialModel) {
|
|
112
|
+
return {
|
|
113
|
+
insightKey: InsightKeys.IMAGE_DELIVERY,
|
|
114
|
+
strings: UIStrings,
|
|
115
|
+
title: i18nString(UIStrings.title),
|
|
116
|
+
description: i18nString(UIStrings.description),
|
|
117
|
+
docs: 'https://developer.chrome.com/docs/performance/insights/image-delivery',
|
|
118
|
+
category: InsightCategory.LCP,
|
|
119
|
+
state: partialModel.optimizableImages.length > 0 ? 'fail' : 'pass',
|
|
120
|
+
...partialModel,
|
|
121
|
+
relatedEvents: new Map(partialModel.optimizableImages.map(image => [image.request, image.optimizations.map(getOptimizationMessageWithBytes)])),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Calculate rough savings percentage based on 1000 real gifs transcoded to video
|
|
126
|
+
* https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-380296510
|
|
127
|
+
*/
|
|
128
|
+
function estimateGIFPercentSavings(request) {
|
|
129
|
+
return Math.round((29.1 * Math.log10(request.args.data.decodedBodyLength) - 100.7)) / 100;
|
|
130
|
+
}
|
|
131
|
+
function getDisplayedSize(data, paintImage) {
|
|
132
|
+
// Note: for traces made prior to metadata.hostDPR (which means no data in
|
|
133
|
+
// paintEventToCorrectedDisplaySize), the displayed size unexpectedly ignores any
|
|
134
|
+
// emulated DPR and so the results may be very misleading.
|
|
135
|
+
return data.ImagePainting.paintEventToCorrectedDisplaySize.get(paintImage) ?? {
|
|
136
|
+
width: paintImage.args.data.width,
|
|
137
|
+
height: paintImage.args.data.height,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function getPixelCounts(data, paintImage) {
|
|
141
|
+
const { width, height } = getDisplayedSize(data, paintImage);
|
|
142
|
+
return {
|
|
143
|
+
filePixels: paintImage.args.data.srcWidth * paintImage.args.data.srcHeight,
|
|
144
|
+
displayedPixels: width * height,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export function generateInsight(data, context) {
|
|
148
|
+
const isWithinContext = (event) => Helpers.Timing.eventIsInBounds(event, context.bounds);
|
|
149
|
+
const contextRequests = data.NetworkRequests.byTime.filter(isWithinContext);
|
|
150
|
+
const optimizableImages = [];
|
|
151
|
+
for (const request of contextRequests) {
|
|
152
|
+
if (request.args.data.resourceType !== 'Image') {
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (request.args.data.mimeType === 'image/svg+xml') {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
// If the request was redirected, the image paints will have the pre-redirect URL.
|
|
159
|
+
const url = request.args.data.redirects[0]?.url ?? request.args.data.url;
|
|
160
|
+
const imagePaints = data.ImagePainting.paintImageEventForUrl.get(url)?.filter(isWithinContext);
|
|
161
|
+
// This will filter out things like preloaded image requests where an image file is downloaded
|
|
162
|
+
// but never rendered on the page.
|
|
163
|
+
if (!imagePaints?.length) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const largestImagePaint = imagePaints.reduce((prev, curr) => {
|
|
167
|
+
const prevPixels = getPixelCounts(data, prev).displayedPixels;
|
|
168
|
+
const currPixels = getPixelCounts(data, curr).displayedPixels;
|
|
169
|
+
return prevPixels > currPixels ? prev : curr;
|
|
170
|
+
});
|
|
171
|
+
const { filePixels: imageFilePixels, displayedPixels: largestImageDisplayPixels, } = getPixelCounts(data, largestImagePaint);
|
|
172
|
+
// Decoded body length is almost always the right one to be using because of the below:
|
|
173
|
+
// `encodedDataLength = decodedBodyLength + headers`.
|
|
174
|
+
// HOWEVER, there are some cases where an image is compressed again over the network and transfer size
|
|
175
|
+
// is smaller (see https://github.com/GoogleChrome/lighthouse/pull/4968).
|
|
176
|
+
// Use the min of the two numbers to be safe.
|
|
177
|
+
const imageBytes = Math.min(request.args.data.decodedBodyLength, request.args.data.encodedDataLength);
|
|
178
|
+
const bytesPerPixel = imageBytes / imageFilePixels;
|
|
179
|
+
let optimizations = [];
|
|
180
|
+
if (request.args.data.mimeType === 'image/gif') {
|
|
181
|
+
if (imageBytes > GIF_SIZE_THRESHOLD) {
|
|
182
|
+
const percentSavings = estimateGIFPercentSavings(request);
|
|
183
|
+
const byteSavings = Math.round(imageBytes * percentSavings);
|
|
184
|
+
optimizations.push({ type: ImageOptimizationType.VIDEO_FORMAT, byteSavings });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (bytesPerPixel > TARGET_BYTES_PER_PIXEL_AVIF) {
|
|
188
|
+
const idealAvifImageSize = Math.round(TARGET_BYTES_PER_PIXEL_AVIF * imageFilePixels);
|
|
189
|
+
const byteSavings = imageBytes - idealAvifImageSize;
|
|
190
|
+
if (request.args.data.mimeType !== 'image/webp' && request.args.data.mimeType !== 'image/avif') {
|
|
191
|
+
optimizations.push({ type: ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION, byteSavings });
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
optimizations.push({ type: ImageOptimizationType.ADJUST_COMPRESSION, byteSavings });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// At this point (before looking at image size), the # of optimizations should only ever be 1 or 0
|
|
198
|
+
// Math.max handles both cases correctly, and is defensive against future patches that would add
|
|
199
|
+
// more than 1 format-specific optimization by this point.
|
|
200
|
+
const imageByteSavingsFromFormat = Math.max(0, ...optimizations.map(o => o.byteSavings));
|
|
201
|
+
let imageByteSavings = imageByteSavingsFromFormat;
|
|
202
|
+
const wastedPixelRatio = 1 - (largestImageDisplayPixels / imageFilePixels);
|
|
203
|
+
// Ignore CSS images because it's difficult to determine what is a spritesheet,
|
|
204
|
+
// and the reward-to-effort ratio for responsive CSS images is quite low https://css-tricks.com/responsive-images-css/.
|
|
205
|
+
if (wastedPixelRatio > 0 && !largestImagePaint.args.data.isCSS) {
|
|
206
|
+
const byteSavings = Math.round(wastedPixelRatio * imageBytes);
|
|
207
|
+
const hadBreakpoints = largestImagePaint.args.data.isPicture || largestImagePaint.args.data.srcsetAttribute;
|
|
208
|
+
if (!hadBreakpoints || byteSavings > BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS) {
|
|
209
|
+
// This will compound the byte savings from any potential format changes with the image size
|
|
210
|
+
// optimization added here.
|
|
211
|
+
imageByteSavings += Math.round(wastedPixelRatio * (imageBytes - imageByteSavingsFromFormat));
|
|
212
|
+
const { width, height } = getDisplayedSize(data, largestImagePaint);
|
|
213
|
+
optimizations.push({
|
|
214
|
+
type: ImageOptimizationType.RESPONSIVE_SIZE,
|
|
215
|
+
byteSavings,
|
|
216
|
+
fileDimensions: {
|
|
217
|
+
width: Math.round(largestImagePaint.args.data.srcWidth),
|
|
218
|
+
height: Math.round(largestImagePaint.args.data.srcHeight),
|
|
219
|
+
},
|
|
220
|
+
displayDimensions: {
|
|
221
|
+
width: Math.round(width),
|
|
222
|
+
height: Math.round(height),
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
optimizations = optimizations.filter(optimization => optimization.byteSavings > BYTE_SAVINGS_THRESHOLD);
|
|
228
|
+
if (optimizations.length > 0) {
|
|
229
|
+
optimizableImages.push({
|
|
230
|
+
request,
|
|
231
|
+
largestImagePaint,
|
|
232
|
+
optimizations,
|
|
233
|
+
byteSavings: imageByteSavings,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const wastedBytesByRequestId = new Map();
|
|
238
|
+
for (const image of optimizableImages) {
|
|
239
|
+
wastedBytesByRequestId.set(image.request.args.data.requestId, image.byteSavings);
|
|
240
|
+
}
|
|
241
|
+
// Sort by savings, then by size of image.
|
|
242
|
+
optimizableImages.sort((a, b) => {
|
|
243
|
+
if (b.byteSavings !== a.byteSavings) {
|
|
244
|
+
return b.byteSavings - a.byteSavings;
|
|
245
|
+
}
|
|
246
|
+
return b.request.args.data.decodedBodyLength - a.request.args.data.decodedBodyLength;
|
|
247
|
+
});
|
|
248
|
+
return finalize({
|
|
249
|
+
optimizableImages,
|
|
250
|
+
metricSavings: metricSavingsForWastedBytes(wastedBytesByRequestId, context),
|
|
251
|
+
wastedBytes: optimizableImages.reduce((total, img) => total + img.byteSavings, 0),
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
export function createOverlayForRequest(request) {
|
|
255
|
+
return {
|
|
256
|
+
type: 'ENTRY_OUTLINE',
|
|
257
|
+
entry: request,
|
|
258
|
+
outlineReason: 'ERROR',
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
export function createOverlays(model) {
|
|
262
|
+
return model.optimizableImages.map(image => createOverlayForRequest(image.request));
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=ImageDelivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageDelivery.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/ImageDelivery.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAC,2BAA2B,EAAC,MAAM,aAAa,CAAC;AACx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AC,CAAC,WAAW,CAAC;QACvC,CAAC;QAED,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;IACvF,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;QACd,iBAAiB;QACjB,aAAa,EAAE,2BAA2B,CAAC,sBAAsB,EAAE,OAAO,CAAC;QAC3E,WAAW,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;KAClF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAA6C;IACnF,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;KACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,OAAO,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as i18n from '../../../core/i18n/i18n.js';\nimport type * as Platform from '../../../core/platform/platform.js';\nimport type * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport type * as Types from '../types/types.js';\n\nimport {metricSavingsForWastedBytes} from './Common.js';\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /**\n * @description Title of an insight that recommends ways to reduce the size of images downloaded and used on the page.\n */\n title: 'Improve image delivery',\n /**\n * @description Description of an insight that recommends ways to reduce the size of images downloaded and used on the page.\n */\n description:\n 'Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).',\n /**\n * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.\n */\n useCompression: 'Increasing the image compression factor could improve this image’s download size',\n /**\n * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.\n */\n useModernFormat:\n 'Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image’s download size',\n /**\n * @description Message displayed in a chip advising the user to use video formats instead of GIFs because videos generally have smaller file sizes.\n */\n useVideoFormat: 'Using video formats instead of GIFs can improve the download size of animated content',\n /**\n * @description Message displayed in a chip explaining that an image was displayed on the page with dimensions much smaller than the image file dimensions.\n * @example {1000x500} PH1\n * @example {100x50} PH2\n */\n useResponsiveSize:\n 'This image file is larger than it needs to be ({PH1}) for its displayed dimensions ({PH2}). Use responsive images to reduce the image download size.',\n /**\n * @description Column header for a table column containing network requests for images which can improve their file size (e.g. use a different format, increase compression, etc).\n */\n optimizeFile: 'Optimize file size',\n /**\n * @description Table row value representing the remaining items not shown in the table due to size constraints. This row will always represent at least 2 items.\n * @example {5} PH1\n */\n others: '{PH1} others',\n /**\n * @description Text status indicating that no potential optimizations were found for any image file.\n */\n noOptimizableImages: 'No optimizable images',\n /**\n * @description Text describing the estimated number of bytes that an image file optimization can save. This text is appended to another block of text describing the image optimization in more detail. \"Est\" means \"Estimated\".\n * @example {Use the correct image dimensions to reduce the image file size.} PH1\n * @example {50 MB} PH2\n */\n estimatedSavings: '{PH1} (Est {PH2})',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/ImageDelivery.ts', UIStrings);\nexport const i18nString: i18n.LocalizeString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\n/**\n * Even JPEGs with lots of detail can usually be compressed down to <1 byte per pixel\n * Using 4:2:2 subsampling already gets an uncompressed bitmap to 2 bytes per pixel.\n * The compression ratio for JPEG is usually somewhere around 10:1 depending on content, so\n * 8:1 is a reasonable expectation for web content which is 1.5MB for a 6MP image.\n *\n * WebP usually gives ~20% additional savings on top of that, so we will assume 10:1 for WebP.\n * This is quite pessimistic as their study shows a photographic compression ratio of ~29:1.\n * https://developers.google.com/speed/webp/docs/webp_lossless_alpha_study#results\n *\n * AVIF usually gives ~20% additional savings on top of WebP, so we will use 12:1 for AVIF.\n * This is quite pessimistic as Netflix study shows a photographic compression ratio of ~40:1\n * (0.4 *bits* per pixel at SSIM 0.97).\n * https://netflixtechblog.com/avif-for-next-generation-image-coding-b1d75675fe4\n */\nconst TARGET_BYTES_PER_PIXEL_AVIF = 2 * 1 / 12;\n\n/**\n * If GIFs are above this size, we'll flag them\n * See https://github.com/GoogleChrome/lighthouse/pull/4885#discussion_r178406623 and https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-370979920\n */\nconst GIF_SIZE_THRESHOLD = 100 * 1024;\n\nconst BYTE_SAVINGS_THRESHOLD = 4096;\n\n// Ignore up to 12KB of waste for responsive images if an effort was made with breakpoints.\nconst BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS = 12288;\n\nexport enum ImageOptimizationType {\n ADJUST_COMPRESSION = 'ADJUST_COMPRESSION',\n MODERN_FORMAT_OR_COMPRESSION = 'MODERN_FORMAT_OR_COMPRESSION',\n VIDEO_FORMAT = 'VIDEO_FORMAT',\n RESPONSIVE_SIZE = 'RESPONSIVE_SIZE',\n}\n\nexport type ImageOptimization = {\n type: Exclude<ImageOptimizationType, ImageOptimizationType.RESPONSIVE_SIZE>,\n byteSavings: number,\n}|{\n type: ImageOptimizationType.RESPONSIVE_SIZE,\n byteSavings: number,\n fileDimensions: {width: number, height: number},\n displayDimensions: {width: number, height: number},\n};\n\nexport interface OptimizableImage {\n request: Types.Events.SyntheticNetworkRequest;\n optimizations: ImageOptimization[];\n byteSavings: number;\n /**\n * If the an image resource has multiple `PaintImage`s, we compare its intrinsic size to the largest of the displayed sizes.\n *\n * It is theoretically possible for `PaintImage` events with the same URL to have different intrinsic sizes.\n * However, this should be rare because it requires serving different images from the same URL.\n */\n largestImagePaint: Types.Events.PaintImage;\n}\n\nexport type ImageDeliveryInsightModel = InsightModel<typeof UIStrings, {\n /** Sorted by potential byte savings, then by size of image. */\n optimizableImages: OptimizableImage[],\n wastedBytes: number,\n}>;\n\nexport function isImageDeliveryInsight(model: InsightModel): model is ImageDeliveryInsightModel {\n return model.insightKey === 'ImageDelivery';\n}\n\nexport function getOptimizationMessage(optimization: ImageOptimization): Platform.UIString.LocalizedString {\n switch (optimization.type) {\n case ImageOptimizationType.ADJUST_COMPRESSION:\n return i18nString(UIStrings.useCompression);\n case ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION:\n return i18nString(UIStrings.useModernFormat);\n case ImageOptimizationType.VIDEO_FORMAT:\n return i18nString(UIStrings.useVideoFormat);\n case ImageOptimizationType.RESPONSIVE_SIZE:\n return i18nString(UIStrings.useResponsiveSize, {\n PH1: `${optimization.fileDimensions.width}x${optimization.fileDimensions.height}`,\n PH2: `${optimization.displayDimensions.width}x${optimization.displayDimensions.height}`,\n });\n }\n}\n\nexport function getOptimizationMessageWithBytes(optimization: ImageOptimization): Platform.UIString.LocalizedString {\n const byteSavingsText = i18n.ByteUtilities.bytesToString(optimization.byteSavings);\n const optimizationMessage = getOptimizationMessage(optimization);\n return i18nString(UIStrings.estimatedSavings, {PH1: optimizationMessage, PH2: byteSavingsText});\n}\n\nfunction finalize(partialModel: PartialInsightModel<ImageDeliveryInsightModel>): ImageDeliveryInsightModel {\n return {\n insightKey: InsightKeys.IMAGE_DELIVERY,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/image-delivery',\n category: InsightCategory.LCP,\n state: partialModel.optimizableImages.length > 0 ? 'fail' : 'pass',\n ...partialModel,\n relatedEvents: new Map(partialModel.optimizableImages.map(\n image => [image.request, image.optimizations.map(getOptimizationMessageWithBytes)])),\n };\n}\n\n/**\n * Calculate rough savings percentage based on 1000 real gifs transcoded to video\n * https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-380296510\n */\nfunction estimateGIFPercentSavings(request: Types.Events.SyntheticNetworkRequest): number {\n return Math.round((29.1 * Math.log10(request.args.data.decodedBodyLength) - 100.7)) / 100;\n}\n\nfunction getDisplayedSize(\n data: Handlers.Types.HandlerData, paintImage: Types.Events.PaintImage): {width: number, height: number} {\n // Note: for traces made prior to metadata.hostDPR (which means no data in\n // paintEventToCorrectedDisplaySize), the displayed size unexpectedly ignores any\n // emulated DPR and so the results may be very misleading.\n return data.ImagePainting.paintEventToCorrectedDisplaySize.get(paintImage) ?? {\n width: paintImage.args.data.width,\n height: paintImage.args.data.height,\n };\n}\n\nfunction getPixelCounts(data: Handlers.Types.HandlerData, paintImage: Types.Events.PaintImage):\n {displayedPixels: number, filePixels: number} {\n const {width, height} = getDisplayedSize(data, paintImage);\n return {\n filePixels: paintImage.args.data.srcWidth * paintImage.args.data.srcHeight,\n displayedPixels: width * height,\n };\n}\n\nexport function generateInsight(\n data: Handlers.Types.HandlerData, context: InsightSetContext): ImageDeliveryInsightModel {\n const isWithinContext = (event: Types.Events.Event): boolean => Helpers.Timing.eventIsInBounds(event, context.bounds);\n\n const contextRequests = data.NetworkRequests.byTime.filter(isWithinContext);\n\n const optimizableImages: OptimizableImage[] = [];\n for (const request of contextRequests) {\n if (request.args.data.resourceType !== 'Image') {\n continue;\n }\n\n if (request.args.data.mimeType === 'image/svg+xml') {\n continue;\n }\n\n // If the request was redirected, the image paints will have the pre-redirect URL.\n const url = request.args.data.redirects[0]?.url ?? request.args.data.url;\n const imagePaints = data.ImagePainting.paintImageEventForUrl.get(url)?.filter(isWithinContext);\n\n // This will filter out things like preloaded image requests where an image file is downloaded\n // but never rendered on the page.\n if (!imagePaints?.length) {\n continue;\n }\n\n const largestImagePaint = imagePaints.reduce((prev, curr) => {\n const prevPixels = getPixelCounts(data, prev).displayedPixels;\n const currPixels = getPixelCounts(data, curr).displayedPixels;\n return prevPixels > currPixels ? prev : curr;\n });\n\n const {\n filePixels: imageFilePixels,\n displayedPixels: largestImageDisplayPixels,\n } = getPixelCounts(data, largestImagePaint);\n\n // Decoded body length is almost always the right one to be using because of the below:\n // `encodedDataLength = decodedBodyLength + headers`.\n // HOWEVER, there are some cases where an image is compressed again over the network and transfer size\n // is smaller (see https://github.com/GoogleChrome/lighthouse/pull/4968).\n // Use the min of the two numbers to be safe.\n const imageBytes = Math.min(request.args.data.decodedBodyLength, request.args.data.encodedDataLength);\n\n const bytesPerPixel = imageBytes / imageFilePixels;\n\n let optimizations: ImageOptimization[] = [];\n if (request.args.data.mimeType === 'image/gif') {\n if (imageBytes > GIF_SIZE_THRESHOLD) {\n const percentSavings = estimateGIFPercentSavings(request);\n const byteSavings = Math.round(imageBytes * percentSavings);\n optimizations.push({type: ImageOptimizationType.VIDEO_FORMAT, byteSavings});\n }\n } else if (bytesPerPixel > TARGET_BYTES_PER_PIXEL_AVIF) {\n const idealAvifImageSize = Math.round(TARGET_BYTES_PER_PIXEL_AVIF * imageFilePixels);\n const byteSavings = imageBytes - idealAvifImageSize;\n if (request.args.data.mimeType !== 'image/webp' && request.args.data.mimeType !== 'image/avif') {\n optimizations.push({type: ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION, byteSavings});\n } else {\n optimizations.push({type: ImageOptimizationType.ADJUST_COMPRESSION, byteSavings});\n }\n }\n\n // At this point (before looking at image size), the # of optimizations should only ever be 1 or 0\n // Math.max handles both cases correctly, and is defensive against future patches that would add\n // more than 1 format-specific optimization by this point.\n const imageByteSavingsFromFormat = Math.max(0, ...optimizations.map(o => o.byteSavings));\n let imageByteSavings = imageByteSavingsFromFormat;\n\n const wastedPixelRatio = 1 - (largestImageDisplayPixels / imageFilePixels);\n\n // Ignore CSS images because it's difficult to determine what is a spritesheet,\n // and the reward-to-effort ratio for responsive CSS images is quite low https://css-tricks.com/responsive-images-css/.\n if (wastedPixelRatio > 0 && !largestImagePaint.args.data.isCSS) {\n const byteSavings = Math.round(wastedPixelRatio * imageBytes);\n\n const hadBreakpoints = largestImagePaint.args.data.isPicture || largestImagePaint.args.data.srcsetAttribute;\n if (!hadBreakpoints || byteSavings > BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS) {\n // This will compound the byte savings from any potential format changes with the image size\n // optimization added here.\n imageByteSavings += Math.round(wastedPixelRatio * (imageBytes - imageByteSavingsFromFormat));\n\n const {width, height} = getDisplayedSize(data, largestImagePaint);\n\n optimizations.push({\n type: ImageOptimizationType.RESPONSIVE_SIZE,\n byteSavings,\n fileDimensions: {\n width: Math.round(largestImagePaint.args.data.srcWidth),\n height: Math.round(largestImagePaint.args.data.srcHeight),\n },\n displayDimensions: {\n width: Math.round(width),\n height: Math.round(height),\n },\n });\n }\n }\n\n optimizations = optimizations.filter(optimization => optimization.byteSavings > BYTE_SAVINGS_THRESHOLD);\n\n if (optimizations.length > 0) {\n optimizableImages.push({\n request,\n largestImagePaint,\n optimizations,\n byteSavings: imageByteSavings,\n });\n }\n }\n\n const wastedBytesByRequestId = new Map<string, number>();\n for (const image of optimizableImages) {\n wastedBytesByRequestId.set(image.request.args.data.requestId, image.byteSavings);\n }\n\n // Sort by savings, then by size of image.\n optimizableImages.sort((a, b) => {\n if (b.byteSavings !== a.byteSavings) {\n return b.byteSavings - a.byteSavings;\n }\n\n return b.request.args.data.decodedBodyLength - a.request.args.data.decodedBodyLength;\n });\n\n return finalize({\n optimizableImages,\n metricSavings: metricSavingsForWastedBytes(wastedBytesByRequestId, context),\n wastedBytes: optimizableImages.reduce((total, img) => total + img.byteSavings, 0),\n });\n}\n\nexport function createOverlayForRequest(request: Types.Events.SyntheticNetworkRequest): Types.Overlays.EntryOutline {\n return {\n type: 'ENTRY_OUTLINE',\n entry: request,\n outlineReason: 'ERROR',\n };\n}\n\nexport function createOverlays(model: ImageDeliveryInsightModel): Types.Overlays.Overlay[] {\n return model.optimizableImages.map(image => createOverlayForRequest(image.request));\n}\n"]}
|
|
@@ -7,49 +7,49 @@ export declare const UIStrings: {
|
|
|
7
7
|
/**
|
|
8
8
|
* @description Title of an insight that provides details about the LCP metric, broken down by parts.
|
|
9
9
|
*/
|
|
10
|
-
readonly title:
|
|
10
|
+
readonly title: 'LCP breakdown';
|
|
11
11
|
/**
|
|
12
12
|
* @description Description of a DevTools insight that presents a breakdown for the LCP metric by subparts.
|
|
13
13
|
* This is displayed after a user expands the section to see more. No character length limits.
|
|
14
14
|
*/
|
|
15
|
-
readonly description:
|
|
15
|
+
readonly description: 'Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.';
|
|
16
16
|
/**
|
|
17
17
|
* @description Time to first byte title for the Largest Contentful Paint's subparts timespan breakdown.
|
|
18
18
|
*/
|
|
19
|
-
readonly timeToFirstByte:
|
|
19
|
+
readonly timeToFirstByte: 'Time to first byte';
|
|
20
20
|
/**
|
|
21
21
|
* @description Resource load delay title for the Largest Contentful Paint subparts timespan breakdown.
|
|
22
22
|
*/
|
|
23
|
-
readonly resourceLoadDelay:
|
|
23
|
+
readonly resourceLoadDelay: 'Resource load delay';
|
|
24
24
|
/**
|
|
25
25
|
* @description Resource load duration title for the Largest Contentful Paint subparts timespan breakdown.
|
|
26
26
|
*/
|
|
27
|
-
readonly resourceLoadDuration:
|
|
27
|
+
readonly resourceLoadDuration: 'Resource load duration';
|
|
28
28
|
/**
|
|
29
29
|
* @description Element render delay title for the Largest Contentful Paint subparts timespan breakdown.
|
|
30
30
|
*/
|
|
31
|
-
readonly elementRenderDelay:
|
|
31
|
+
readonly elementRenderDelay: 'Element render delay';
|
|
32
32
|
/**
|
|
33
33
|
* @description Label used for the subpart (section) of a larger duration.
|
|
34
34
|
*/
|
|
35
|
-
readonly subpart:
|
|
35
|
+
readonly subpart: 'Subpart';
|
|
36
36
|
/**
|
|
37
37
|
* @description Label used for the duration a single subpart (section) takes up of a larger duration.
|
|
38
38
|
*/
|
|
39
|
-
readonly duration:
|
|
39
|
+
readonly duration: 'Duration';
|
|
40
40
|
/**
|
|
41
41
|
* @description Label used for the duration a single subpart (section) takes up of a larger duration. The value will be the 75th percentile of aggregate data. "Field" means that the data was collected from real users in the field as opposed to the developers local environment. "Field" is synonymous with "Real user data".
|
|
42
42
|
*/
|
|
43
|
-
readonly fieldDuration:
|
|
43
|
+
readonly fieldDuration: 'Field p75';
|
|
44
44
|
/**
|
|
45
45
|
* @description Text status indicating that the Largest Contentful Paint (LCP) metric timing was not found. "LCP" is an acronym and should not be translated.
|
|
46
46
|
*/
|
|
47
|
-
readonly noLcp:
|
|
47
|
+
readonly noLcp: 'No LCP detected';
|
|
48
48
|
};
|
|
49
49
|
export declare const i18nString: i18n.LocalizeString;
|
|
50
50
|
/** A TraceWindow plus its UIString. **/
|
|
51
51
|
export type Subpart = Types.Timing.TraceWindowMicro & {
|
|
52
|
-
label:
|
|
52
|
+
label: Common.UIString.LocalizedString;
|
|
53
53
|
};
|
|
54
54
|
interface LCPSubparts {
|
|
55
55
|
/**
|