devtools-tracing 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +14 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +28854 -0
- package/package.json +10 -8
- package/generate.ts +0 -649
- package/index.ts +0 -17
- package/lib/extension-api/ExtensionAPI.d.ts +0 -357
- package/lib/front_end/core/common/App.ts +0 -7
- package/lib/front_end/core/common/AppProvider.ts +0 -32
- package/lib/front_end/core/common/Base64.ts +0 -47
- package/lib/front_end/core/common/CharacterIdMap.ts +0 -30
- package/lib/front_end/core/common/Color.ts +0 -2506
- package/lib/front_end/core/common/ColorConverter.ts +0 -402
- package/lib/front_end/core/common/ColorUtils.ts +0 -252
- package/lib/front_end/core/common/Console.ts +0 -114
- package/lib/front_end/core/common/Debouncer.ts +0 -15
- package/lib/front_end/core/common/EventTarget.ts +0 -52
- package/lib/front_end/core/common/Gzip.ts +0 -74
- package/lib/front_end/core/common/JavaScriptMetaData.ts +0 -29
- package/lib/front_end/core/common/Lazy.ts +0 -31
- package/lib/front_end/core/common/Linkifier.ts +0 -55
- package/lib/front_end/core/common/MapWithDefault.ts +0 -26
- package/lib/front_end/core/common/Mutex.ts +0 -55
- package/lib/front_end/core/common/Object.ts +0 -145
- package/lib/front_end/core/common/ParsedURL.ts +0 -554
- package/lib/front_end/core/common/Progress.ts +0 -180
- package/lib/front_end/core/common/QueryParamHandler.ts +0 -7
- package/lib/front_end/core/common/ResolverBase.ts +0 -85
- package/lib/front_end/core/common/ResourceType.ts +0 -588
- package/lib/front_end/core/common/ReturnToPanel.ts +0 -17
- package/lib/front_end/core/common/Revealer.ts +0 -192
- package/lib/front_end/core/common/Runnable.ts +0 -41
- package/lib/front_end/core/common/SegmentedRange.ts +0 -87
- package/lib/front_end/core/common/SettingRegistration.ts +0 -339
- package/lib/front_end/core/common/Settings.ts +0 -1497
- package/lib/front_end/core/common/SimpleHistoryManager.ts +0 -124
- package/lib/front_end/core/common/StringOutputStream.ts +0 -26
- package/lib/front_end/core/common/TextDictionary.ts +0 -48
- package/lib/front_end/core/common/Throttler.ts +0 -99
- package/lib/front_end/core/common/Trie.ts +0 -152
- package/lib/front_end/core/common/Worker.ts +0 -60
- package/lib/front_end/core/common/common.ts +0 -81
- package/lib/front_end/core/host/AidaClient.ts +0 -733
- package/lib/front_end/core/host/GdpClient.ts +0 -316
- package/lib/front_end/core/host/InspectorFrontendHost.ts +0 -648
- package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +0 -551
- package/lib/front_end/core/host/Platform.ts +0 -76
- package/lib/front_end/core/host/ResourceLoader.ts +0 -282
- package/lib/front_end/core/host/UserMetrics.ts +0 -1230
- package/lib/front_end/core/host/host.ts +0 -23
- package/lib/front_end/core/i18n/ByteUtilities.ts +0 -82
- package/lib/front_end/core/i18n/DevToolsLocale.ts +0 -87
- package/lib/front_end/core/i18n/NumberFormatter.ts +0 -82
- package/lib/front_end/core/i18n/i18n.ts +0 -17
- package/lib/front_end/core/i18n/i18nImpl.ts +0 -204
- package/lib/front_end/core/i18n/i18nTypes.ts +0 -10
- package/lib/front_end/core/i18n/locales.js +0 -14
- package/lib/front_end/core/i18n/time-utilities.ts +0 -174
- package/lib/front_end/core/platform/ArrayUtilities.ts +0 -271
- package/lib/front_end/core/platform/Brand.ts +0 -23
- package/lib/front_end/core/platform/Constructor.ts +0 -10
- package/lib/front_end/core/platform/DOMUtilities.ts +0 -138
- package/lib/front_end/core/platform/DateUtilities.ts +0 -15
- package/lib/front_end/core/platform/DevToolsPath.ts +0 -53
- package/lib/front_end/core/platform/KeyboardUtilities.ts +0 -38
- package/lib/front_end/core/platform/MapUtilities.ts +0 -95
- package/lib/front_end/core/platform/MimeType.ts +0 -175
- package/lib/front_end/core/platform/NumberUtilities.ts +0 -80
- package/lib/front_end/core/platform/StringUtilities.ts +0 -588
- package/lib/front_end/core/platform/Timing.ts +0 -17
- package/lib/front_end/core/platform/TypedArrayUtilities.ts +0 -189
- package/lib/front_end/core/platform/TypescriptUtilities.ts +0 -86
- package/lib/front_end/core/platform/UIString.ts +0 -39
- package/lib/front_end/core/platform/UserVisibleError.ts +0 -28
- package/lib/front_end/core/platform/platform.ts +0 -45
- package/lib/front_end/core/protocol_client/ConnectionTransport.ts +0 -26
- package/lib/front_end/core/protocol_client/InspectorBackend.ts +0 -1050
- package/lib/front_end/core/protocol_client/NodeURL.ts +0 -42
- package/lib/front_end/core/protocol_client/protocol_client.ts +0 -13
- package/lib/front_end/core/root/Runtime.ts +0 -609
- package/lib/front_end/core/root/root.ts +0 -6
- package/lib/front_end/core/sdk/AccessibilityModel.ts +0 -353
- package/lib/front_end/core/sdk/AnimationModel.ts +0 -1041
- package/lib/front_end/core/sdk/AutofillModel.ts +0 -184
- package/lib/front_end/core/sdk/CPUProfilerModel.ts +0 -148
- package/lib/front_end/core/sdk/CPUThrottlingManager.ts +0 -282
- package/lib/front_end/core/sdk/CSSContainerQuery.ts +0 -139
- package/lib/front_end/core/sdk/CSSFontFace.ts +0 -40
- package/lib/front_end/core/sdk/CSSLayer.ts +0 -30
- package/lib/front_end/core/sdk/CSSMatchedStyles.ts +0 -1646
- package/lib/front_end/core/sdk/CSSMedia.ts +0 -121
- package/lib/front_end/core/sdk/CSSMetadata.ts +0 -1647
- package/lib/front_end/core/sdk/CSSModel.ts +0 -1128
- package/lib/front_end/core/sdk/CSSProperty.ts +0 -384
- package/lib/front_end/core/sdk/CSSPropertyParser.ts +0 -681
- package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +0 -1395
- package/lib/front_end/core/sdk/CSSQuery.ts +0 -72
- package/lib/front_end/core/sdk/CSSRule.ts +0 -465
- package/lib/front_end/core/sdk/CSSScope.ts +0 -30
- package/lib/front_end/core/sdk/CSSStartingStyle.ts +0 -29
- package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +0 -313
- package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +0 -196
- package/lib/front_end/core/sdk/CSSSupports.ts +0 -33
- package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +0 -64
- package/lib/front_end/core/sdk/ChildTargetManager.ts +0 -314
- package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +0 -62
- package/lib/front_end/core/sdk/Connections.ts +0 -293
- package/lib/front_end/core/sdk/ConsoleModel.ts +0 -808
- package/lib/front_end/core/sdk/ConsoleModelTypes.ts +0 -15
- package/lib/front_end/core/sdk/Cookie.ts +0 -319
- package/lib/front_end/core/sdk/CookieModel.ts +0 -239
- package/lib/front_end/core/sdk/CookieParser.ts +0 -185
- package/lib/front_end/core/sdk/DOMDebuggerModel.ts +0 -787
- package/lib/front_end/core/sdk/DOMModel.ts +0 -1961
- package/lib/front_end/core/sdk/DebuggerModel.ts +0 -1605
- package/lib/front_end/core/sdk/EmulationModel.ts +0 -648
- package/lib/front_end/core/sdk/EnhancedTracesParser.ts +0 -515
- package/lib/front_end/core/sdk/EventBreakpointsModel.ts +0 -183
- package/lib/front_end/core/sdk/FrameAssociated.ts +0 -11
- package/lib/front_end/core/sdk/FrameManager.ts +0 -259
- package/lib/front_end/core/sdk/HeapProfilerModel.ts +0 -225
- package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +0 -77
- package/lib/front_end/core/sdk/IOModel.ts +0 -91
- package/lib/front_end/core/sdk/IsolateManager.ts +0 -257
- package/lib/front_end/core/sdk/IssuesModel.ts +0 -70
- package/lib/front_end/core/sdk/LayerTreeBase.ts +0 -169
- package/lib/front_end/core/sdk/LogModel.ts +0 -56
- package/lib/front_end/core/sdk/NetworkManager.ts +0 -2823
- package/lib/front_end/core/sdk/NetworkRequest.ts +0 -2253
- package/lib/front_end/core/sdk/OverlayColorGenerator.ts +0 -52
- package/lib/front_end/core/sdk/OverlayModel.ts +0 -1011
- package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -522
- package/lib/front_end/core/sdk/PageLoad.ts +0 -35
- package/lib/front_end/core/sdk/PageResourceLoader.ts +0 -435
- package/lib/front_end/core/sdk/PaintProfiler.ts +0 -110
- package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +0 -84
- package/lib/front_end/core/sdk/PreloadingModel.ts +0 -863
- package/lib/front_end/core/sdk/RehydratingConnection.ts +0 -386
- package/lib/front_end/core/sdk/RehydratingObject.ts +0 -66
- package/lib/front_end/core/sdk/RemoteObject.ts +0 -1160
- package/lib/front_end/core/sdk/Resource.ts +0 -232
- package/lib/front_end/core/sdk/ResourceTreeModel.ts +0 -1160
- package/lib/front_end/core/sdk/RuntimeModel.ts +0 -732
- package/lib/front_end/core/sdk/SDKModel.ts +0 -65
- package/lib/front_end/core/sdk/ScopeTreeCache.ts +0 -45
- package/lib/front_end/core/sdk/ScreenCaptureModel.ts +0 -255
- package/lib/front_end/core/sdk/Script.ts +0 -534
- package/lib/front_end/core/sdk/SecurityOriginManager.ts +0 -76
- package/lib/front_end/core/sdk/ServerSentEvents.ts +0 -80
- package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +0 -122
- package/lib/front_end/core/sdk/ServerTiming.ts +0 -260
- package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -377
- package/lib/front_end/core/sdk/ServiceWorkerManager.ts +0 -605
- package/lib/front_end/core/sdk/SourceMap.ts +0 -867
- package/lib/front_end/core/sdk/SourceMapCache.ts +0 -54
- package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +0 -156
- package/lib/front_end/core/sdk/SourceMapManager.ts +0 -239
- package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +0 -189
- package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +0 -508
- package/lib/front_end/core/sdk/StorageBucketsModel.ts +0 -204
- package/lib/front_end/core/sdk/StorageKeyManager.ts +0 -98
- package/lib/front_end/core/sdk/Target.ts +0 -332
- package/lib/front_end/core/sdk/TargetManager.ts +0 -453
- package/lib/front_end/core/sdk/TraceObject.ts +0 -61
- package/lib/front_end/core/sdk/WebAuthnModel.ts +0 -104
- package/lib/front_end/core/sdk/sdk.ts +0 -174
- package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -59
- package/lib/front_end/generated/InspectorBackendCommands.js +0 -1617
- package/lib/front_end/generated/SupportedCSSProperties.js +0 -7512
- package/lib/front_end/generated/protocol-proxy-api.d.ts +0 -5022
- package/lib/front_end/generated/protocol.ts +0 -22014
- package/lib/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -318
- package/lib/front_end/models/bindings/CompilerScriptMapping.ts +0 -536
- package/lib/front_end/models/bindings/ContentProviderBasedProject.ts +0 -187
- package/lib/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1197
- package/lib/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -733
- package/lib/front_end/models/bindings/DefaultScriptMapping.ts +0 -141
- package/lib/front_end/models/bindings/FileUtils.ts +0 -228
- package/lib/front_end/models/bindings/LiveLocation.ts +0 -81
- package/lib/front_end/models/bindings/NetworkProject.ts +0 -157
- package/lib/front_end/models/bindings/PresentationConsoleMessageHelper.ts +0 -312
- package/lib/front_end/models/bindings/ResourceMapping.ts +0 -539
- package/lib/front_end/models/bindings/ResourceScriptMapping.ts +0 -491
- package/lib/front_end/models/bindings/ResourceUtils.ts +0 -103
- package/lib/front_end/models/bindings/SASSSourceMapping.ts +0 -222
- package/lib/front_end/models/bindings/StylesSourceMapping.ts +0 -316
- package/lib/front_end/models/bindings/TempFile.ts +0 -67
- package/lib/front_end/models/bindings/bindings.ts +0 -39
- package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +0 -571
- package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +0 -103
- package/lib/front_end/models/cpu_profile/cpu_profile.ts +0 -11
- package/lib/front_end/models/formatter/FormatterWorkerPool.ts +0 -219
- package/lib/front_end/models/formatter/ScriptFormatter.ts +0 -112
- package/lib/front_end/models/formatter/formatter.ts +0 -8
- package/lib/front_end/models/source_map_scopes/NamesResolver.ts +0 -765
- package/lib/front_end/models/source_map_scopes/ScopeChainModel.ts +0 -84
- package/lib/front_end/models/source_map_scopes/source_map_scopes.ts +0 -11
- package/lib/front_end/models/stack_trace/StackTrace.ts +0 -53
- package/lib/front_end/models/stack_trace/StackTraceImpl.ts +0 -85
- package/lib/front_end/models/stack_trace/StackTraceModel.ts +0 -128
- package/lib/front_end/models/stack_trace/Trie.ts +0 -163
- package/lib/front_end/models/stack_trace/stack_trace.ts +0 -9
- package/lib/front_end/models/stack_trace/stack_trace_impl.ts +0 -13
- package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +0 -37
- package/lib/front_end/models/text_utils/ContentData.ts +0 -199
- package/lib/front_end/models/text_utils/ContentProvider.ts +0 -68
- package/lib/front_end/models/text_utils/StaticContentProvider.ts +0 -49
- package/lib/front_end/models/text_utils/StreamingContentData.ts +0 -108
- package/lib/front_end/models/text_utils/Text.ts +0 -90
- package/lib/front_end/models/text_utils/TextCursor.ts +0 -44
- package/lib/front_end/models/text_utils/TextRange.ts +0 -266
- package/lib/front_end/models/text_utils/TextUtils.ts +0 -401
- package/lib/front_end/models/text_utils/WasmDisassembly.ts +0 -87
- package/lib/front_end/models/text_utils/text_utils.ts +0 -27
- package/lib/front_end/models/trace/EntityMapper.ts +0 -141
- package/lib/front_end/models/trace/EventsSerializer.ts +0 -101
- package/lib/front_end/models/trace/LanternComputationData.ts +0 -438
- package/lib/front_end/models/trace/ModelImpl.ts +0 -236
- package/lib/front_end/models/trace/Name.ts +0 -136
- package/lib/front_end/models/trace/Processor.ts +0 -652
- package/lib/front_end/models/trace/Styles.ts +0 -1138
- package/lib/front_end/models/trace/extras/FilmStrip.ts +0 -78
- package/lib/front_end/models/trace/extras/MainThreadActivity.ts +0 -86
- package/lib/front_end/models/trace/extras/ScriptDuplication.ts +0 -236
- package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +0 -203
- package/lib/front_end/models/trace/extras/ThirdParties.ts +0 -164
- package/lib/front_end/models/trace/extras/TraceFilter.ts +0 -62
- package/lib/front_end/models/trace/extras/TraceTree.ts +0 -701
- package/lib/front_end/models/trace/extras/extras.ts +0 -11
- package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +0 -128
- package/lib/front_end/models/trace/handlers/AnimationHandler.ts +0 -36
- package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +0 -239
- package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +0 -183
- package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +0 -31
- package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +0 -306
- package/lib/front_end/models/trace/handlers/FlowsHandler.ts +0 -175
- package/lib/front_end/models/trace/handlers/FramesHandler.ts +0 -571
- package/lib/front_end/models/trace/handlers/GPUHandler.ts +0 -50
- package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +0 -183
- package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -193
- package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -168
- package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +0 -109
- package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +0 -35
- package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +0 -123
- package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +0 -573
- package/lib/front_end/models/trace/handlers/MemoryHandler.ts +0 -31
- package/lib/front_end/models/trace/handlers/MetaHandler.ts +0 -525
- package/lib/front_end/models/trace/handlers/ModelHandlers.ts +0 -34
- package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +0 -672
- package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +0 -52
- package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +0 -460
- package/lib/front_end/models/trace/handlers/RendererHandler.ts +0 -428
- package/lib/front_end/models/trace/handlers/SamplesHandler.ts +0 -271
- package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +0 -122
- package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +0 -336
- package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +0 -110
- package/lib/front_end/models/trace/handlers/Threads.ts +0 -139
- package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +0 -400
- package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -233
- package/lib/front_end/models/trace/handlers/WarningsHandler.ts +0 -162
- package/lib/front_end/models/trace/handlers/WorkersHandler.ts +0 -45
- package/lib/front_end/models/trace/handlers/handlers.ts +0 -8
- package/lib/front_end/models/trace/handlers/helpers.ts +0 -196
- package/lib/front_end/models/trace/handlers/types.ts +0 -75
- package/lib/front_end/models/trace/helpers/Extensions.ts +0 -54
- package/lib/front_end/models/trace/helpers/Network.ts +0 -129
- package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +0 -544
- package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +0 -87
- package/lib/front_end/models/trace/helpers/Timing.ts +0 -248
- package/lib/front_end/models/trace/helpers/Trace.ts +0 -928
- package/lib/front_end/models/trace/helpers/TreeHelpers.ts +0 -320
- package/lib/front_end/models/trace/helpers/helpers.ts +0 -11
- package/lib/front_end/models/trace/insights/CLSCulprits.ts +0 -668
- package/lib/front_end/models/trace/insights/Cache.ts +0 -269
- package/lib/front_end/models/trace/insights/Common.ts +0 -453
- package/lib/front_end/models/trace/insights/DOMSize.ts +0 -223
- package/lib/front_end/models/trace/insights/DocumentLatency.ts +0 -319
- package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +0 -126
- package/lib/front_end/models/trace/insights/FontDisplay.ts +0 -119
- package/lib/front_end/models/trace/insights/ForcedReflow.ts +0 -220
- package/lib/front_end/models/trace/insights/INPBreakdown.ts +0 -171
- package/lib/front_end/models/trace/insights/ImageDelivery.ts +0 -348
- package/lib/front_end/models/trace/insights/LCPBreakdown.ts +0 -268
- package/lib/front_end/models/trace/insights/LCPDiscovery.ts +0 -237
- package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +0 -138
- package/lib/front_end/models/trace/insights/Models.ts +0 -22
- package/lib/front_end/models/trace/insights/ModernHTTP.ts +0 -257
- package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +0 -726
- package/lib/front_end/models/trace/insights/RenderBlocking.ts +0 -257
- package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +0 -175
- package/lib/front_end/models/trace/insights/Statistics.ts +0 -101
- package/lib/front_end/models/trace/insights/ThirdParties.ts +0 -130
- package/lib/front_end/models/trace/insights/Viewport.ts +0 -138
- package/lib/front_end/models/trace/insights/insights.ts +0 -10
- package/lib/front_end/models/trace/insights/types.ts +0 -157
- package/lib/front_end/models/trace/lantern/core/LanternError.ts +0 -7
- package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +0 -619
- package/lib/front_end/models/trace/lantern/core/core.ts +0 -6
- package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +0 -345
- package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +0 -80
- package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +0 -101
- package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +0 -636
- package/lib/front_end/models/trace/lantern/graph/graph.ts +0 -8
- package/lib/front_end/models/trace/lantern/lantern.ts +0 -17
- package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +0 -187
- package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +0 -88
- package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +0 -92
- package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +0 -72
- package/lib/front_end/models/trace/lantern/metrics/Metric.ts +0 -126
- package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +0 -126
- package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +0 -82
- package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +0 -112
- package/lib/front_end/models/trace/lantern/metrics/metrics.ts +0 -12
- package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +0 -150
- package/lib/front_end/models/trace/lantern/simulation/Constants.ts +0 -46
- package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +0 -61
- package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +0 -196
- package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +0 -556
- package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +0 -192
- package/lib/front_end/models/trace/lantern/simulation/simulation.ts +0 -10
- package/lib/front_end/models/trace/lantern/types/Lantern.ts +0 -220
- package/lib/front_end/models/trace/lantern/types/types.ts +0 -5
- package/lib/front_end/models/trace/trace.ts +0 -33
- package/lib/front_end/models/trace/types/Configuration.ts +0 -110
- package/lib/front_end/models/trace/types/Extensions.ts +0 -136
- package/lib/front_end/models/trace/types/File.ts +0 -281
- package/lib/front_end/models/trace/types/Overlays.ts +0 -138
- package/lib/front_end/models/trace/types/Timing.ts +0 -30
- package/lib/front_end/models/trace/types/TraceEvents.ts +0 -3277
- package/lib/front_end/models/trace/types/types.ts +0 -10
- package/lib/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +0 -240
- package/lib/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +0 -5
- package/lib/front_end/models/workspace/FileManager.ts +0 -97
- package/lib/front_end/models/workspace/IgnoreListManager.ts +0 -628
- package/lib/front_end/models/workspace/SearchConfig.ts +0 -149
- package/lib/front_end/models/workspace/UISourceCode.ts +0 -698
- package/lib/front_end/models/workspace/WorkspaceImpl.ts +0 -339
- package/lib/front_end/models/workspace/workspace.ts +0 -17
- package/lib/front_end/panels/timeline/TimelineUIUtils.ts +0 -1029
- package/lib/front_end/panels/timeline/extensions/ExtensionUI.ts +0 -49
- package/lib/front_end/panels/timeline/extensions/extensions.ts +0 -9
- package/lib/front_end/third_party/codemirror.next/LICENSE +0 -21
- package/lib/front_end/third_party/codemirror.next/README.chromium +0 -30
- package/lib/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
- package/lib/front_end/third_party/codemirror.next/bundle.ts +0 -135
- package/lib/front_end/third_party/codemirror.next/chunk/angular.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/angular.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/cpp.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/cpp.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/css.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/html.js +0 -4
- package/lib/front_end/third_party/codemirror.next/chunk/java.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/java.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/javascript.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/legacy.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/legacy.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/less.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/less.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/markdown.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/markdown.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/php.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/php.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/python.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/python.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/sass.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/sass.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/svelte.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/svelte.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/vue.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/vue.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/wast.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/wast.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/xml.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/xml.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/codemirror.next.d.ts +0 -8057
- package/lib/front_end/third_party/codemirror.next/codemirror.next.js +0 -2
- package/lib/front_end/third_party/codemirror.next/codemirror.next.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/package.json +0 -43
- package/lib/front_end/third_party/codemirror.next/rebuild.sh +0 -6
- package/lib/front_end/third_party/codemirror.next/rollup.config.mjs +0 -49
- package/lib/front_end/third_party/i18n/LICENSE +0 -202
- package/lib/front_end/third_party/i18n/README.chromium +0 -15
- package/lib/front_end/third_party/i18n/i18n-impl.ts +0 -61
- package/lib/front_end/third_party/i18n/i18n.ts +0 -11
- package/lib/front_end/third_party/i18n/localized-string-set.ts +0 -129
- package/lib/front_end/third_party/intl-messageformat/LICENSE +0 -33
- package/lib/front_end/third_party/intl-messageformat/README.chromium +0 -24
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +0 -6
- package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +0 -33
- package/lib/front_end/third_party/intl-messageformat/package/README.md +0 -3
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +0 -6
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/index.js +0 -13
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +0 -5
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +0 -1710
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +0 -1815
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +0 -6
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +0 -10
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +0 -229
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +0 -28
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +0 -48
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +0 -179
- package/lib/front_end/third_party/intl-messageformat/package/package.json +0 -42
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/src/core.js +0 -230
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +0 -28
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/src/error.js +0 -51
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +0 -182
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +0 -79
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +0 -15
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +0 -153
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +0 -139
- package/lib/front_end/third_party/legacy-javascript/LICENSE +0 -202
- package/lib/front_end/third_party/legacy-javascript/README.chromium +0 -13
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +0 -3
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +0 -18
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +0 -943
- package/lib/front_end/third_party/legacy-javascript/package.json +0 -8
- package/lib/front_end/third_party/legacy-javascript/rebuild.sh +0 -9
- package/lib/front_end/third_party/source-map-scopes-codec/LICENSE +0 -26
- package/lib/front_end/third_party/source-map-scopes-codec/README.chromium +0 -31
- package/lib/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -33
- package/lib/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -26
- package/lib/front_end/third_party/source-map-scopes-codec/package/README.md +0 -64
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -62
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -37
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -29
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -8
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -6
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/deno.json +0 -21
- package/lib/front_end/third_party/source-map-scopes-codec/package/package.json +0 -14
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +0 -196
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +0 -262
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -235
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -359
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -39
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -53
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -438
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -539
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -23
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -35
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -257
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -348
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -8
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -20
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes-tsconfig.json +0 -8
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -184
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -9
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -12
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -82
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -99
- package/lib/front_end/third_party/source-map-scopes-codec/source-map-scopes-codec.ts +0 -5
- package/lib/front_end/third_party/third-party-web/LICENSE +0 -20
- package/lib/front_end/third_party/third-party-web/README.chromium +0 -13
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +0 -149
- package/lib/front_end/third_party/third-party-web/package/LICENSE +0 -20
- package/lib/front_end/third_party/third-party-web/package/README.md +0 -929
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/dist/entities.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/facades.md +0 -46
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +0 -1
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +0 -1006
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +0 -139
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +0 -44
- package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +0 -27
- package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +0 -34
- package/lib/front_end/third_party/third-party-web/package/lib/index.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +0 -246
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +0 -36
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +0 -9
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +0 -5
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +0 -151
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +0 -14
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +0 -1
- package/lib/front_end/third_party/third-party-web/package/package.json +0 -46
- package/lib/front_end/third_party/third-party-web/package.json +0 -8
- package/lib/front_end/third_party/third-party-web/rebuild.sh +0 -13
- package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
- package/lib/front_end/third_party/third-party-web/third-party-web.ts +0 -3
- package/lib/front_end/ui/legacy/theme_support/ThemeSupport.ts +0 -222
- package/lib/front_end/ui/legacy/theme_support/theme_support.ts +0 -5
- package/patches/chrome-devtools-frontend+1.0.1533544.patch +0 -1716
|
@@ -1,348 +0,0 @@
|
|
|
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
|
-
|
|
5
|
-
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
|
-
import type * as Handlers from '../handlers/handlers.js';
|
|
7
|
-
import * as Helpers from '../helpers/helpers.js';
|
|
8
|
-
import type * as Types from '../types/types.js';
|
|
9
|
-
|
|
10
|
-
import {metricSavingsForWastedBytes} from './Common.js';
|
|
11
|
-
import {
|
|
12
|
-
InsightCategory,
|
|
13
|
-
InsightKeys,
|
|
14
|
-
type InsightModel,
|
|
15
|
-
type InsightSetContext,
|
|
16
|
-
type PartialInsightModel,
|
|
17
|
-
} from './types.js';
|
|
18
|
-
|
|
19
|
-
export const UIStrings = {
|
|
20
|
-
/**
|
|
21
|
-
* @description Title of an insight that recommends ways to reduce the size of images downloaded and used on the page.
|
|
22
|
-
*/
|
|
23
|
-
title: 'Improve image delivery',
|
|
24
|
-
/**
|
|
25
|
-
* @description Description of an insight that recommends ways to reduce the size of images downloaded and used on the page.
|
|
26
|
-
*/
|
|
27
|
-
description:
|
|
28
|
-
'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)',
|
|
29
|
-
/**
|
|
30
|
-
* @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.
|
|
31
|
-
*/
|
|
32
|
-
useCompression: 'Increasing the image compression factor could improve this image\'s download size.',
|
|
33
|
-
/**
|
|
34
|
-
* @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.
|
|
35
|
-
*/
|
|
36
|
-
useModernFormat:
|
|
37
|
-
'Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image\'s download size.',
|
|
38
|
-
/**
|
|
39
|
-
* @description Message displayed in a chip advising the user to use video formats instead of GIFs because videos generally have smaller file sizes.
|
|
40
|
-
*/
|
|
41
|
-
useVideoFormat: 'Using video formats instead of GIFs can improve the download size of animated content.',
|
|
42
|
-
/**
|
|
43
|
-
* @description Message displayed in a chip explaining that an image was displayed on the page with dimensions much smaller than the image file dimensions.
|
|
44
|
-
* @example {1000x500} PH1
|
|
45
|
-
* @example {100x50} PH2
|
|
46
|
-
*/
|
|
47
|
-
useResponsiveSize:
|
|
48
|
-
'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.',
|
|
49
|
-
/**
|
|
50
|
-
* @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).
|
|
51
|
-
*/
|
|
52
|
-
optimizeFile: 'Optimize file size',
|
|
53
|
-
/**
|
|
54
|
-
* @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.
|
|
55
|
-
* @example {5} PH1
|
|
56
|
-
*/
|
|
57
|
-
others: '{PH1} others',
|
|
58
|
-
/**
|
|
59
|
-
* @description Text status indicating that no potential optimizations were found for any image file
|
|
60
|
-
*/
|
|
61
|
-
noOptimizableImages: 'No optimizable images',
|
|
62
|
-
/**
|
|
63
|
-
* @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".
|
|
64
|
-
* @example {Use the correct image dimensions to reduce the image file size.} PH1
|
|
65
|
-
* @example {50 MB} PH2
|
|
66
|
-
*/
|
|
67
|
-
estimatedSavings: '{PH1} (Est {PH2})',
|
|
68
|
-
} as const;
|
|
69
|
-
|
|
70
|
-
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/ImageDelivery.ts', UIStrings);
|
|
71
|
-
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Even JPEGs with lots of detail can usually be compressed down to <1 byte per pixel
|
|
75
|
-
* Using 4:2:2 subsampling already gets an uncompressed bitmap to 2 bytes per pixel.
|
|
76
|
-
* The compression ratio for JPEG is usually somewhere around 10:1 depending on content, so
|
|
77
|
-
* 8:1 is a reasonable expectation for web content which is 1.5MB for a 6MP image.
|
|
78
|
-
*
|
|
79
|
-
* WebP usually gives ~20% additional savings on top of that, so we will assume 10:1 for WebP.
|
|
80
|
-
* This is quite pessimistic as their study shows a photographic compression ratio of ~29:1.
|
|
81
|
-
* https://developers.google.com/speed/webp/docs/webp_lossless_alpha_study#results
|
|
82
|
-
*
|
|
83
|
-
* AVIF usually gives ~20% additional savings on top of WebP, so we will use 12:1 for AVIF.
|
|
84
|
-
* This is quite pessimistic as Netflix study shows a photographic compression ratio of ~40:1
|
|
85
|
-
* (0.4 *bits* per pixel at SSIM 0.97).
|
|
86
|
-
* https://netflixtechblog.com/avif-for-next-generation-image-coding-b1d75675fe4
|
|
87
|
-
*/
|
|
88
|
-
const TARGET_BYTES_PER_PIXEL_AVIF = 2 * 1 / 12;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* If GIFs are above this size, we'll flag them
|
|
92
|
-
* See https://github.com/GoogleChrome/lighthouse/pull/4885#discussion_r178406623 and https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-370979920
|
|
93
|
-
*/
|
|
94
|
-
const GIF_SIZE_THRESHOLD = 100 * 1024;
|
|
95
|
-
|
|
96
|
-
const BYTE_SAVINGS_THRESHOLD = 4096;
|
|
97
|
-
|
|
98
|
-
// Ignore up to 12KB of waste for responsive images if an effort was made with breakpoints.
|
|
99
|
-
const BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS = 12288;
|
|
100
|
-
|
|
101
|
-
export enum ImageOptimizationType {
|
|
102
|
-
ADJUST_COMPRESSION = 'ADJUST_COMPRESSION',
|
|
103
|
-
MODERN_FORMAT_OR_COMPRESSION = 'MODERN_FORMAT_OR_COMPRESSION',
|
|
104
|
-
VIDEO_FORMAT = 'VIDEO_FORMAT',
|
|
105
|
-
RESPONSIVE_SIZE = 'RESPONSIVE_SIZE',
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export type ImageOptimization = {
|
|
109
|
-
type: Exclude<ImageOptimizationType, ImageOptimizationType.RESPONSIVE_SIZE>,
|
|
110
|
-
byteSavings: number,
|
|
111
|
-
}|{
|
|
112
|
-
type: ImageOptimizationType.RESPONSIVE_SIZE,
|
|
113
|
-
byteSavings: number,
|
|
114
|
-
fileDimensions: {width: number, height: number},
|
|
115
|
-
displayDimensions: {width: number, height: number},
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export interface OptimizableImage {
|
|
119
|
-
request: Types.Events.SyntheticNetworkRequest;
|
|
120
|
-
optimizations: ImageOptimization[];
|
|
121
|
-
byteSavings: number;
|
|
122
|
-
/**
|
|
123
|
-
* If the an image resource has multiple `PaintImage`s, we compare its intrinsic size to the largest of the displayed sizes.
|
|
124
|
-
*
|
|
125
|
-
* It is theoretically possible for `PaintImage` events with the same URL to have different intrinsic sizes.
|
|
126
|
-
* However, this should be rare because it requires serving different images from the same URL.
|
|
127
|
-
*/
|
|
128
|
-
largestImagePaint: Types.Events.PaintImage;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export type ImageDeliveryInsightModel = InsightModel<typeof UIStrings, {
|
|
132
|
-
/** Sorted by potential byte savings, then by size of image. */
|
|
133
|
-
optimizableImages: OptimizableImage[],
|
|
134
|
-
wastedBytes: number,
|
|
135
|
-
}>;
|
|
136
|
-
|
|
137
|
-
export function isImageDeliveryInsight(model: InsightModel): model is ImageDeliveryInsightModel {
|
|
138
|
-
return model.insightKey === 'ImageDelivery';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function getOptimizationMessage(optimization: ImageOptimization): string {
|
|
142
|
-
switch (optimization.type) {
|
|
143
|
-
case ImageOptimizationType.ADJUST_COMPRESSION:
|
|
144
|
-
return i18nString(UIStrings.useCompression);
|
|
145
|
-
case ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION:
|
|
146
|
-
return i18nString(UIStrings.useModernFormat);
|
|
147
|
-
case ImageOptimizationType.VIDEO_FORMAT:
|
|
148
|
-
return i18nString(UIStrings.useVideoFormat);
|
|
149
|
-
case ImageOptimizationType.RESPONSIVE_SIZE:
|
|
150
|
-
return i18nString(UIStrings.useResponsiveSize, {
|
|
151
|
-
PH1: `${optimization.fileDimensions.width}x${optimization.fileDimensions.height}`,
|
|
152
|
-
PH2: `${optimization.displayDimensions.width}x${optimization.displayDimensions.height}`,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export function getOptimizationMessageWithBytes(optimization: ImageOptimization): string {
|
|
158
|
-
const byteSavingsText = i18n.ByteUtilities.bytesToString(optimization.byteSavings);
|
|
159
|
-
const optimizationMessage = getOptimizationMessage(optimization);
|
|
160
|
-
return i18nString(UIStrings.estimatedSavings, {PH1: optimizationMessage, PH2: byteSavingsText});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function finalize(partialModel: PartialInsightModel<ImageDeliveryInsightModel>): ImageDeliveryInsightModel {
|
|
164
|
-
return {
|
|
165
|
-
insightKey: InsightKeys.IMAGE_DELIVERY,
|
|
166
|
-
strings: UIStrings,
|
|
167
|
-
title: i18nString(UIStrings.title),
|
|
168
|
-
description: i18nString(UIStrings.description),
|
|
169
|
-
docs: 'https://developer.chrome.com/docs/performance/insights/image-delivery',
|
|
170
|
-
category: InsightCategory.LCP,
|
|
171
|
-
state: partialModel.optimizableImages.length > 0 ? 'fail' : 'pass',
|
|
172
|
-
...partialModel,
|
|
173
|
-
relatedEvents: new Map(partialModel.optimizableImages.map(
|
|
174
|
-
image => [image.request, image.optimizations.map(getOptimizationMessageWithBytes)])),
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Calculate rough savings percentage based on 1000 real gifs transcoded to video
|
|
180
|
-
* https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-380296510
|
|
181
|
-
*/
|
|
182
|
-
function estimateGIFPercentSavings(request: Types.Events.SyntheticNetworkRequest): number {
|
|
183
|
-
return Math.round((29.1 * Math.log10(request.args.data.decodedBodyLength) - 100.7)) / 100;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function getDisplayedSize(
|
|
187
|
-
data: Handlers.Types.HandlerData, paintImage: Types.Events.PaintImage): {width: number, height: number} {
|
|
188
|
-
// Note: for traces made prior to metadata.hostDPR (which means no data in
|
|
189
|
-
// paintEventToCorrectedDisplaySize), the displayed size unexpectedly ignores any
|
|
190
|
-
// emulated DPR and so the results may be very misleading.
|
|
191
|
-
return data.ImagePainting.paintEventToCorrectedDisplaySize.get(paintImage) ?? {
|
|
192
|
-
width: paintImage.args.data.width,
|
|
193
|
-
height: paintImage.args.data.height,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function getPixelCounts(data: Handlers.Types.HandlerData, paintImage: Types.Events.PaintImage):
|
|
198
|
-
{displayedPixels: number, filePixels: number} {
|
|
199
|
-
const {width, height} = getDisplayedSize(data, paintImage);
|
|
200
|
-
return {
|
|
201
|
-
filePixels: paintImage.args.data.srcWidth * paintImage.args.data.srcHeight,
|
|
202
|
-
displayedPixels: width * height,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export function generateInsight(
|
|
207
|
-
data: Handlers.Types.HandlerData, context: InsightSetContext): ImageDeliveryInsightModel {
|
|
208
|
-
const isWithinContext = (event: Types.Events.Event): boolean => Helpers.Timing.eventIsInBounds(event, context.bounds);
|
|
209
|
-
|
|
210
|
-
const contextRequests = data.NetworkRequests.byTime.filter(isWithinContext);
|
|
211
|
-
|
|
212
|
-
const optimizableImages: OptimizableImage[] = [];
|
|
213
|
-
for (const request of contextRequests) {
|
|
214
|
-
if (request.args.data.resourceType !== 'Image') {
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (request.args.data.mimeType === 'image/svg+xml') {
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// If the request was redirected, the image paints will have the pre-redirect URL.
|
|
223
|
-
const url = request.args.data.redirects[0]?.url ?? request.args.data.url;
|
|
224
|
-
const imagePaints = data.ImagePainting.paintImageEventForUrl.get(url)?.filter(isWithinContext);
|
|
225
|
-
|
|
226
|
-
// This will filter out things like preloaded image requests where an image file is downloaded
|
|
227
|
-
// but never rendered on the page.
|
|
228
|
-
if (!imagePaints?.length) {
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const largestImagePaint = imagePaints.reduce((prev, curr) => {
|
|
233
|
-
const prevPixels = getPixelCounts(data, prev).displayedPixels;
|
|
234
|
-
const currPixels = getPixelCounts(data, curr).displayedPixels;
|
|
235
|
-
return prevPixels > currPixels ? prev : curr;
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
const {
|
|
239
|
-
filePixels: imageFilePixels,
|
|
240
|
-
displayedPixels: largestImageDisplayPixels,
|
|
241
|
-
} = getPixelCounts(data, largestImagePaint);
|
|
242
|
-
|
|
243
|
-
// Decoded body length is almost always the right one to be using because of the below:
|
|
244
|
-
// `encodedDataLength = decodedBodyLength + headers`.
|
|
245
|
-
// HOWEVER, there are some cases where an image is compressed again over the network and transfer size
|
|
246
|
-
// is smaller (see https://github.com/GoogleChrome/lighthouse/pull/4968).
|
|
247
|
-
// Use the min of the two numbers to be safe.
|
|
248
|
-
const imageBytes = Math.min(request.args.data.decodedBodyLength, request.args.data.encodedDataLength);
|
|
249
|
-
|
|
250
|
-
const bytesPerPixel = imageBytes / imageFilePixels;
|
|
251
|
-
|
|
252
|
-
let optimizations: ImageOptimization[] = [];
|
|
253
|
-
if (request.args.data.mimeType === 'image/gif') {
|
|
254
|
-
if (imageBytes > GIF_SIZE_THRESHOLD) {
|
|
255
|
-
const percentSavings = estimateGIFPercentSavings(request);
|
|
256
|
-
const byteSavings = Math.round(imageBytes * percentSavings);
|
|
257
|
-
optimizations.push({type: ImageOptimizationType.VIDEO_FORMAT, byteSavings});
|
|
258
|
-
}
|
|
259
|
-
} else if (bytesPerPixel > TARGET_BYTES_PER_PIXEL_AVIF) {
|
|
260
|
-
const idealAvifImageSize = Math.round(TARGET_BYTES_PER_PIXEL_AVIF * imageFilePixels);
|
|
261
|
-
const byteSavings = imageBytes - idealAvifImageSize;
|
|
262
|
-
if (request.args.data.mimeType !== 'image/webp' && request.args.data.mimeType !== 'image/avif') {
|
|
263
|
-
optimizations.push({type: ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION, byteSavings});
|
|
264
|
-
} else {
|
|
265
|
-
optimizations.push({type: ImageOptimizationType.ADJUST_COMPRESSION, byteSavings});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// At this point (before looking at image size), the # of optimizations should only ever be 1 or 0
|
|
270
|
-
// Math.max handles both cases correctly, and is defensive against future patches that would add
|
|
271
|
-
// more than 1 format-specific optimization by this point.
|
|
272
|
-
const imageByteSavingsFromFormat = Math.max(0, ...optimizations.map(o => o.byteSavings));
|
|
273
|
-
let imageByteSavings = imageByteSavingsFromFormat;
|
|
274
|
-
|
|
275
|
-
const wastedPixelRatio = 1 - (largestImageDisplayPixels / imageFilePixels);
|
|
276
|
-
|
|
277
|
-
// Ignore CSS images because it's difficult to determine what is a spritesheet,
|
|
278
|
-
// and the reward-to-effort ratio for responsive CSS images is quite low https://css-tricks.com/responsive-images-css/.
|
|
279
|
-
if (wastedPixelRatio > 0 && !largestImagePaint.args.data.isCSS) {
|
|
280
|
-
const byteSavings = Math.round(wastedPixelRatio * imageBytes);
|
|
281
|
-
|
|
282
|
-
const hadBreakpoints = largestImagePaint.args.data.isPicture || largestImagePaint.args.data.srcsetAttribute;
|
|
283
|
-
if (!hadBreakpoints || byteSavings > BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS) {
|
|
284
|
-
// This will compound the byte savings from any potential format changes with the image size
|
|
285
|
-
// optimization added here.
|
|
286
|
-
imageByteSavings += Math.round(wastedPixelRatio * (imageBytes - imageByteSavingsFromFormat));
|
|
287
|
-
|
|
288
|
-
const {width, height} = getDisplayedSize(data, largestImagePaint);
|
|
289
|
-
|
|
290
|
-
optimizations.push({
|
|
291
|
-
type: ImageOptimizationType.RESPONSIVE_SIZE,
|
|
292
|
-
byteSavings,
|
|
293
|
-
fileDimensions: {
|
|
294
|
-
width: Math.round(largestImagePaint.args.data.srcWidth),
|
|
295
|
-
height: Math.round(largestImagePaint.args.data.srcHeight),
|
|
296
|
-
},
|
|
297
|
-
displayDimensions: {
|
|
298
|
-
width: Math.round(width),
|
|
299
|
-
height: Math.round(height),
|
|
300
|
-
},
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
optimizations = optimizations.filter(optimization => optimization.byteSavings > BYTE_SAVINGS_THRESHOLD);
|
|
306
|
-
|
|
307
|
-
if (optimizations.length > 0) {
|
|
308
|
-
optimizableImages.push({
|
|
309
|
-
request,
|
|
310
|
-
largestImagePaint,
|
|
311
|
-
optimizations,
|
|
312
|
-
byteSavings: imageByteSavings,
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const wastedBytesByRequestId = new Map<string, number>();
|
|
318
|
-
for (const image of optimizableImages) {
|
|
319
|
-
wastedBytesByRequestId.set(image.request.args.data.requestId, image.byteSavings);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// Sort by savings, then by size of image.
|
|
323
|
-
optimizableImages.sort((a, b) => {
|
|
324
|
-
if (b.byteSavings !== a.byteSavings) {
|
|
325
|
-
return b.byteSavings - a.byteSavings;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return b.request.args.data.decodedBodyLength - a.request.args.data.decodedBodyLength;
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
return finalize({
|
|
332
|
-
optimizableImages,
|
|
333
|
-
metricSavings: metricSavingsForWastedBytes(wastedBytesByRequestId, context),
|
|
334
|
-
wastedBytes: optimizableImages.reduce((total, img) => total + img.byteSavings, 0),
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export function createOverlayForRequest(request: Types.Events.SyntheticNetworkRequest): Types.Overlays.EntryOutline {
|
|
339
|
-
return {
|
|
340
|
-
type: 'ENTRY_OUTLINE',
|
|
341
|
-
entry: request,
|
|
342
|
-
outlineReason: 'ERROR',
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
export function createOverlays(model: ImageDeliveryInsightModel): Types.Overlays.Overlay[] {
|
|
347
|
-
return model.optimizableImages.map(image => createOverlayForRequest(image.request));
|
|
348
|
-
}
|
|
@@ -1,268 +0,0 @@
|
|
|
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
|
-
|
|
5
|
-
import type * as Common from '../../../core/common/common.js';
|
|
6
|
-
import * as i18n from '../../../core/i18n/i18n.js';
|
|
7
|
-
import * as Handlers from '../handlers/handlers.js';
|
|
8
|
-
import * as Helpers from '../helpers/helpers.js';
|
|
9
|
-
import * as Types from '../types/types.js';
|
|
10
|
-
|
|
11
|
-
import {calculateDocFirstByteTs} from './Common.js';
|
|
12
|
-
import {
|
|
13
|
-
InsightCategory,
|
|
14
|
-
InsightKeys,
|
|
15
|
-
type InsightModel,
|
|
16
|
-
type InsightSetContext,
|
|
17
|
-
InsightWarning,
|
|
18
|
-
type PartialInsightModel,
|
|
19
|
-
} from './types.js';
|
|
20
|
-
|
|
21
|
-
export const UIStrings = {
|
|
22
|
-
/**
|
|
23
|
-
* @description Title of an insight that provides details about the LCP metric, broken down by parts.
|
|
24
|
-
*/
|
|
25
|
-
title: 'LCP breakdown',
|
|
26
|
-
/**
|
|
27
|
-
* @description Description of a DevTools insight that presents a breakdown for the LCP metric by subparts.
|
|
28
|
-
* This is displayed after a user expands the section to see more. No character length limits.
|
|
29
|
-
*/
|
|
30
|
-
description:
|
|
31
|
-
'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.',
|
|
32
|
-
/**
|
|
33
|
-
* @description Time to first byte title for the Largest Contentful Paint's subparts timespan breakdown.
|
|
34
|
-
*/
|
|
35
|
-
timeToFirstByte: 'Time to first byte',
|
|
36
|
-
/**
|
|
37
|
-
* @description Resource load delay title for the Largest Contentful Paint subparts timespan breakdown.
|
|
38
|
-
*/
|
|
39
|
-
resourceLoadDelay: 'Resource load delay',
|
|
40
|
-
/**
|
|
41
|
-
* @description Resource load duration title for the Largest Contentful Paint subparts timespan breakdown.
|
|
42
|
-
*/
|
|
43
|
-
resourceLoadDuration: 'Resource load duration',
|
|
44
|
-
/**
|
|
45
|
-
* @description Element render delay title for the Largest Contentful Paint subparts timespan breakdown.
|
|
46
|
-
*/
|
|
47
|
-
elementRenderDelay: 'Element render delay',
|
|
48
|
-
/**
|
|
49
|
-
* @description Label used for the subpart (section) of a larger duration.
|
|
50
|
-
*/
|
|
51
|
-
subpart: 'Subpart',
|
|
52
|
-
/**
|
|
53
|
-
* @description Label used for the duration a single subpart (section) takes up of a larger duration.
|
|
54
|
-
*/
|
|
55
|
-
duration: 'Duration',
|
|
56
|
-
/**
|
|
57
|
-
* @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".
|
|
58
|
-
*/
|
|
59
|
-
fieldDuration: 'Field p75',
|
|
60
|
-
/**
|
|
61
|
-
* @description Text status indicating that the the Largest Contentful Paint (LCP) metric timing was not found. "LCP" is an acronym and should not be translated.
|
|
62
|
-
*/
|
|
63
|
-
noLcp: 'No LCP detected',
|
|
64
|
-
} as const;
|
|
65
|
-
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/LCPBreakdown.ts', UIStrings);
|
|
66
|
-
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
67
|
-
|
|
68
|
-
/** A TraceWindow plus its UIString. **/
|
|
69
|
-
export type Subpart = Types.Timing.TraceWindowMicro&{label: Common.UIString.LocalizedString};
|
|
70
|
-
interface LCPSubparts {
|
|
71
|
-
/**
|
|
72
|
-
* The time between when the user initiates loading the page until when
|
|
73
|
-
* the browser receives the first byte of the html response.
|
|
74
|
-
*/
|
|
75
|
-
ttfb: Subpart;
|
|
76
|
-
/**
|
|
77
|
-
* The time between ttfb and the LCP request request being started.
|
|
78
|
-
* For a text LCP, this is undefined given no request is loaded.
|
|
79
|
-
*/
|
|
80
|
-
loadDelay?: Subpart;
|
|
81
|
-
/**
|
|
82
|
-
* The time it takes to load the LCP request.
|
|
83
|
-
*/
|
|
84
|
-
loadDuration?: Subpart;
|
|
85
|
-
/**
|
|
86
|
-
* The time between when the LCP request finishes loading and when
|
|
87
|
-
* the LCP element is rendered.
|
|
88
|
-
*/
|
|
89
|
-
renderDelay: Subpart;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function isLCPBreakdownInsight(model: InsightModel): model is LCPBreakdownInsightModel {
|
|
93
|
-
return model.insightKey === 'LCPBreakdown';
|
|
94
|
-
}
|
|
95
|
-
export type LCPBreakdownInsightModel = InsightModel<typeof UIStrings, {
|
|
96
|
-
lcpMs?: Types.Timing.Milli,
|
|
97
|
-
lcpTs?: Types.Timing.Milli,
|
|
98
|
-
lcpEvent?: Types.Events.LargestContentfulPaintCandidate,
|
|
99
|
-
/** The network request for the LCP image, if there was one. */
|
|
100
|
-
lcpRequest?: Types.Events.SyntheticNetworkRequest,
|
|
101
|
-
subparts?: LCPSubparts,
|
|
102
|
-
}>;
|
|
103
|
-
|
|
104
|
-
function anyValuesNaN(...values: number[]): boolean {
|
|
105
|
-
return values.some(v => Number.isNaN(v));
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the 2–4 subparts of an LCP as bounds.
|
|
109
|
-
* Will return `null` if any required values were missing. We don't ever expect
|
|
110
|
-
* them to be missing on newer traces, but old trace files may lack some of the
|
|
111
|
-
* data we rely on, so we want to handle that case.
|
|
112
|
-
*/
|
|
113
|
-
function determineSubparts(
|
|
114
|
-
nav: Types.Events.NavigationStart, docRequest: Types.Events.SyntheticNetworkRequest,
|
|
115
|
-
lcpEvent: Types.Events.LargestContentfulPaintCandidate,
|
|
116
|
-
lcpRequest: Types.Events.SyntheticNetworkRequest|undefined): LCPSubparts|null {
|
|
117
|
-
const firstDocByteTs = calculateDocFirstByteTs(docRequest);
|
|
118
|
-
if (firstDocByteTs === null) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const ttfb = Helpers.Timing.traceWindowFromMicroSeconds(nav.ts, firstDocByteTs) as Subpart;
|
|
123
|
-
ttfb.label = i18nString(UIStrings.timeToFirstByte);
|
|
124
|
-
|
|
125
|
-
let renderDelay = Helpers.Timing.traceWindowFromMicroSeconds(ttfb.max, lcpEvent.ts) as Subpart;
|
|
126
|
-
renderDelay.label = i18nString(UIStrings.elementRenderDelay);
|
|
127
|
-
|
|
128
|
-
// If the LCP is text, we don't have a request, so just 2 subparts.
|
|
129
|
-
if (!lcpRequest) {
|
|
130
|
-
/**
|
|
131
|
-
* Text LCP. 2 subparts, thus 3 timestamps
|
|
132
|
-
*
|
|
133
|
-
* | ttfb | renderDelay |
|
|
134
|
-
* ^ lcpEvent.ts
|
|
135
|
-
* ^ firstDocByteTs
|
|
136
|
-
* ^ navStartTs
|
|
137
|
-
*/
|
|
138
|
-
if (anyValuesNaN(ttfb.range, renderDelay.range)) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
return {ttfb, renderDelay};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Image LCP. 4 subparts means 5 timestamps
|
|
146
|
-
*
|
|
147
|
-
* | ttfb | loadDelay | loadTime | renderDelay |
|
|
148
|
-
* ^ lcpEvent.ts
|
|
149
|
-
* ^ lcpReqEndTs
|
|
150
|
-
* ^ lcpStartTs
|
|
151
|
-
* ^ ttfbTs
|
|
152
|
-
* ^ navStartTs
|
|
153
|
-
*/
|
|
154
|
-
const lcpStartTs = lcpRequest.ts;
|
|
155
|
-
const lcpReqEndTs = lcpRequest.args.data.syntheticData.finishTime;
|
|
156
|
-
|
|
157
|
-
const loadDelay = Helpers.Timing.traceWindowFromMicroSeconds(ttfb.max, lcpStartTs) as Subpart;
|
|
158
|
-
const loadDuration = Helpers.Timing.traceWindowFromMicroSeconds(lcpStartTs, lcpReqEndTs) as Subpart;
|
|
159
|
-
renderDelay = Helpers.Timing.traceWindowFromMicroSeconds(lcpReqEndTs, lcpEvent.ts) as Subpart;
|
|
160
|
-
loadDelay.label = i18nString(UIStrings.resourceLoadDelay);
|
|
161
|
-
loadDuration.label = i18nString(UIStrings.resourceLoadDuration);
|
|
162
|
-
renderDelay.label = i18nString(UIStrings.elementRenderDelay);
|
|
163
|
-
if (anyValuesNaN(ttfb.range, loadDelay.range, loadDuration.range, renderDelay.range)) {
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
ttfb,
|
|
169
|
-
loadDelay,
|
|
170
|
-
loadDuration,
|
|
171
|
-
renderDelay,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function finalize(partialModel: PartialInsightModel<LCPBreakdownInsightModel>): LCPBreakdownInsightModel {
|
|
176
|
-
const relatedEvents = [];
|
|
177
|
-
if (partialModel.lcpEvent) {
|
|
178
|
-
relatedEvents.push(partialModel.lcpEvent);
|
|
179
|
-
}
|
|
180
|
-
if (partialModel.lcpRequest) {
|
|
181
|
-
relatedEvents.push(partialModel.lcpRequest);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
let state: LCPBreakdownInsightModel['state'] = 'pass';
|
|
185
|
-
if (partialModel.lcpMs !== undefined) {
|
|
186
|
-
const classification = Handlers.ModelHandlers.PageLoadMetrics.scoreClassificationForLargestContentfulPaint(
|
|
187
|
-
Helpers.Timing.milliToMicro(partialModel.lcpMs));
|
|
188
|
-
if (classification === Handlers.ModelHandlers.PageLoadMetrics.ScoreClassification.GOOD) {
|
|
189
|
-
state = 'informative';
|
|
190
|
-
} else {
|
|
191
|
-
state = 'fail';
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return {
|
|
196
|
-
insightKey: InsightKeys.LCP_BREAKDOWN,
|
|
197
|
-
strings: UIStrings,
|
|
198
|
-
title: i18nString(UIStrings.title),
|
|
199
|
-
description: i18nString(UIStrings.description),
|
|
200
|
-
docs: 'https://developer.chrome.com/docs/performance/insights/lcp-breakdown',
|
|
201
|
-
category: InsightCategory.LCP,
|
|
202
|
-
state,
|
|
203
|
-
...partialModel,
|
|
204
|
-
relatedEvents,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function generateInsight(
|
|
209
|
-
data: Handlers.Types.HandlerData, context: InsightSetContext): LCPBreakdownInsightModel {
|
|
210
|
-
if (!context.navigation) {
|
|
211
|
-
return finalize({});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const networkRequests = data.NetworkRequests;
|
|
215
|
-
|
|
216
|
-
const frameMetrics = data.PageLoadMetrics.metricScoresByFrameId.get(context.frameId);
|
|
217
|
-
if (!frameMetrics) {
|
|
218
|
-
throw new Error('no frame metrics');
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const navMetrics = frameMetrics.get(context.navigationId);
|
|
222
|
-
if (!navMetrics) {
|
|
223
|
-
throw new Error('no navigation metrics');
|
|
224
|
-
}
|
|
225
|
-
const metricScore = navMetrics.get(Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP);
|
|
226
|
-
const lcpEvent = metricScore?.event;
|
|
227
|
-
if (!lcpEvent || !Types.Events.isLargestContentfulPaintCandidate(lcpEvent)) {
|
|
228
|
-
return finalize({warnings: [InsightWarning.NO_LCP]});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// This helps calculate the subparts.
|
|
232
|
-
const lcpMs = Helpers.Timing.microToMilli(metricScore.timing);
|
|
233
|
-
// This helps position things on the timeline's UI accurately for a trace.
|
|
234
|
-
const lcpTs = metricScore.event?.ts ? Helpers.Timing.microToMilli(metricScore.event?.ts) : undefined;
|
|
235
|
-
const lcpRequest = data.LargestImagePaint.lcpRequestByNavigationId.get(context.navigationId);
|
|
236
|
-
|
|
237
|
-
const docRequest = networkRequests.byId.get(context.navigationId);
|
|
238
|
-
if (!docRequest) {
|
|
239
|
-
return finalize({lcpMs, lcpTs, lcpEvent, lcpRequest, warnings: [InsightWarning.NO_DOCUMENT_REQUEST]});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return finalize({
|
|
243
|
-
lcpMs,
|
|
244
|
-
lcpTs,
|
|
245
|
-
lcpEvent,
|
|
246
|
-
lcpRequest,
|
|
247
|
-
subparts: determineSubparts(context.navigation, docRequest, lcpEvent, lcpRequest) ?? undefined,
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export function createOverlays(model: LCPBreakdownInsightModel): Types.Overlays.Overlay[] {
|
|
252
|
-
if (!model.subparts || !model.lcpTs) {
|
|
253
|
-
return [];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const overlays: Types.Overlays.Overlay[] = [
|
|
257
|
-
{
|
|
258
|
-
type: 'TIMESPAN_BREAKDOWN',
|
|
259
|
-
sections: Object.values(model.subparts)
|
|
260
|
-
.map((subpart: Subpart) => ({bounds: subpart, label: subpart.label, showDuration: true})),
|
|
261
|
-
},
|
|
262
|
-
];
|
|
263
|
-
if (model.lcpRequest) {
|
|
264
|
-
overlays.push({type: 'ENTRY_OUTLINE', entry: model.lcpRequest, outlineReason: 'INFO'});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return overlays;
|
|
268
|
-
}
|