@paulirish/trace_engine 0.0.66 → 0.0.67-beta.1
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/README.md +62 -22
- package/analyze-trace.mjs +6 -144
- package/core/common/Base64.d.ts +12 -0
- package/core/common/CharacterIdMap.d.ts +5 -0
- package/core/common/Color.d.ts +357 -0
- package/core/common/ColorConverter.d.ts +26 -0
- package/core/common/ColorUtils.d.ts +45 -0
- package/core/common/Console.d.ts +54 -0
- package/core/common/Debouncer.d.ts +8 -0
- package/core/common/EventTarget.d.ts +22 -0
- package/core/common/Gzip.d.ts +23 -0
- package/core/common/JavaScriptMetaData.d.ts +20 -0
- package/core/common/Lazy.d.ts +4 -0
- package/core/common/MapWithDefault.d.ts +9 -0
- package/core/common/Mutex.d.ts +13 -0
- package/core/common/Object.d.ts +20 -0
- package/core/common/ParsedURL.d.ts +87 -0
- package/core/common/Progress.d.ts +47 -0
- package/core/common/ResolverBase.d.ts +29 -0
- package/core/common/ResourceType.d.ts +52 -0
- package/core/common/ReturnToPanel.d.ts +10 -0
- package/core/common/Revealer.d.ts +66 -0
- package/core/common/Runnable.d.ts +14 -0
- package/core/common/SegmentedRange.d.ts +14 -0
- package/core/common/SettingRegistration.d.ts +136 -0
- package/core/common/Settings.d.ts +226 -0
- package/core/common/SimpleHistoryManager.d.ts +20 -0
- package/core/common/Srcset.d.ts +16 -0
- package/core/common/StringOutputStream.d.ts +10 -0
- package/core/common/TextDictionary.d.ts +11 -0
- package/core/common/Throttler.d.ts +12 -0
- package/core/common/Trie.d.ts +24 -0
- package/core/common/VersionController.d.ts +85 -0
- package/core/common/common.d.ts +33 -1
- package/core/host/AidaClient.d.ts +73 -0
- package/core/host/AidaClientTypes.d.ts +355 -0
- package/core/host/AidaGcaTranslation.d.ts +10 -0
- package/core/host/DispatchHttpRequestClient.d.ts +14 -0
- package/core/host/GcaClient.d.ts +14 -0
- package/core/host/GcaTypes.d.ts +411 -0
- package/core/host/GdpClient.d.ts +84 -0
- package/core/host/InspectorFrontendHost.d.ts +29 -0
- package/core/host/InspectorFrontendHostAPI.d.ts +425 -0
- package/core/host/InspectorFrontendHostStub.d.ts +151 -0
- package/core/host/Platform.d.ts +11 -0
- package/core/host/ResourceLoader.d.ts +15 -0
- package/core/host/UserMetrics.d.ts +116 -0
- package/core/host/UserMetricsEnums.d.ts +883 -0
- package/core/host/host.d.ts +13 -1
- package/core/i18n/ByteUtilities.d.ts +11 -0
- package/core/i18n/DevToolsLocale.d.ts +41 -0
- package/core/i18n/NumberFormatter.d.ts +11 -0
- package/core/i18n/i18n.d.ts +10 -0
- package/core/i18n/i18nImpl.d.ts +64 -0
- package/core/i18n/i18nTypes.d.ts +5 -0
- package/core/i18n/locales.d.ts +15 -0
- package/core/i18n/time-utilities.d.ts +16 -0
- package/core/platform/StringUtilities.d.ts +0 -21
- package/core/protocol_client/CDPConnection.d.ts +77 -0
- package/core/protocol_client/ConnectionTransport.d.ts +9 -0
- package/core/protocol_client/DevToolsCDPConnection.d.ts +16 -0
- package/core/protocol_client/InspectorBackend.d.ts +223 -0
- package/core/protocol_client/protocol_client.d.ts +5 -0
- package/core/root/DevToolsContext.d.ts +34 -0
- package/core/root/ExperimentNames.d.ts +8 -0
- package/core/root/Runtime.d.ts +351 -0
- package/core/root/root.d.ts +4 -1
- package/core/sdk/AccessibilityModel.d.ts +76 -0
- package/core/sdk/AnimationModel.d.ts +161 -0
- package/core/sdk/AutofillModel.d.ts +23 -0
- package/core/sdk/CPUProfilerModel.d.ts +46 -0
- package/core/sdk/CPUThrottlingManager.d.ts +47 -0
- package/core/sdk/CSSContainerQuery.d.ts +42 -0
- package/core/sdk/CSSFontFace.d.ts +10 -0
- package/core/sdk/CSSLayer.d.ts +9 -0
- package/core/sdk/CSSLocation.d.ts +14 -0
- package/core/sdk/CSSMatchedStyles.d.ts +138 -0
- package/core/sdk/CSSMedia.d.ts +36 -0
- package/core/sdk/CSSMetadata.d.ts +87 -0
- package/core/sdk/CSSModel.d.ts +180 -0
- package/core/sdk/CSSNavigation.d.ts +10 -0
- package/core/sdk/CSSProperty.d.ts +53 -0
- package/core/sdk/CSSPropertyParser.d.ts +131 -0
- package/core/sdk/CSSPropertyParserMatchers.d.ts +442 -0
- package/core/sdk/CSSQuery.d.ts +22 -0
- package/core/sdk/CSSRule.d.ts +132 -0
- package/core/sdk/CSSScope.d.ts +9 -0
- package/core/sdk/CSSStartingStyle.d.ts +9 -0
- package/core/sdk/CSSStyleDeclaration.d.ts +38 -0
- package/core/sdk/CSSStyleSheetHeader.d.ts +53 -0
- package/core/sdk/CSSSupports.d.ts +10 -0
- package/core/sdk/CategorizedBreakpoint.d.ts +42 -0
- package/core/sdk/ChildTargetManager.d.ts +40 -0
- package/core/sdk/CompilerSourceMappingContentProvider.d.ts +12 -0
- package/core/sdk/Connections.d.ts +36 -0
- package/core/sdk/ConsoleModel.d.ts +127 -0
- package/core/sdk/ConsoleModelTypes.d.ts +6 -0
- package/core/sdk/Cookie.d.ts +68 -0
- package/core/sdk/CookieModel.d.ts +31 -0
- package/core/sdk/CookieParser.d.ts +14 -0
- package/core/sdk/CrashReportContextModel.d.ts +8 -0
- package/core/sdk/DOMDebuggerModel.d.ts +127 -0
- package/core/sdk/DOMModel.d.ts +436 -0
- package/core/sdk/DOMStorageModel.d.ts +79 -0
- package/core/sdk/DebuggerModel.d.ts +272 -0
- package/core/sdk/EmulationModel.d.ts +95 -0
- package/core/sdk/EnhancedTracesParser.d.ts +105 -0
- package/core/sdk/EventBreakpointsModel.d.ts +66 -0
- package/core/sdk/FrameAssociated.d.ts +6 -0
- package/core/sdk/FrameManager.d.ts +68 -0
- package/core/sdk/HeapProfilerModel.d.ts +75 -0
- package/core/sdk/HttpReasonPhraseStrings.d.ts +5 -0
- package/core/sdk/IOModel.d.ts +10 -0
- package/core/sdk/IsolateManager.d.ts +53 -0
- package/core/sdk/IssuesModel.d.ts +28 -0
- package/core/sdk/LayerTreeBase.d.ts +70 -0
- package/core/sdk/LogModel.d.ts +20 -0
- package/core/sdk/NetworkManager.d.ts +418 -0
- package/core/sdk/NetworkRequest.d.ts +469 -0
- package/core/sdk/NetworkRequestAccess.d.ts +91 -0
- package/core/sdk/OverlayColorGenerator.d.ts +14 -0
- package/core/sdk/OverlayModel.d.ts +186 -0
- package/core/sdk/OverlayPersistentHighlighter.d.ts +116 -0
- package/core/sdk/PageFunctions.d.ts +22 -0
- package/core/sdk/PageLoad.d.ts +14 -0
- package/core/sdk/PageResourceLoader.d.ts +111 -0
- package/core/sdk/PaintProfiler.d.ts +43 -0
- package/core/sdk/PerformanceMetricsModel.d.ts +12 -0
- package/core/sdk/PreloadingModel.d.ts +146 -0
- package/core/sdk/RehydratingConnection.d.ts +73 -0
- package/core/sdk/RehydratingObject.d.ts +59 -0
- package/core/sdk/RemoteObject.d.ts +210 -0
- package/core/sdk/Resource.d.ts +36 -0
- package/core/sdk/ResourceTreeModel.d.ts +278 -0
- package/core/sdk/RuntimeModel.d.ts +163 -0
- package/core/sdk/SDKModel.d.ts +30 -0
- package/core/sdk/SDKSettings.d.ts +53 -0
- package/core/sdk/ScopeTreeCache.d.ts +21 -0
- package/core/sdk/ScreenCaptureModel.d.ts +69 -0
- package/core/sdk/Script.d.ts +134 -0
- package/core/sdk/SecurityOrigin.d.ts +108 -0
- package/core/sdk/SecurityOriginManager.d.ts +23 -0
- package/core/sdk/ServerSentEvents.d.ts +18 -0
- package/core/sdk/ServerSentEventsProtocol.d.ts +18 -0
- package/core/sdk/ServerTiming.d.ts +24 -0
- package/core/sdk/ServiceWorkerCacheModel.d.ts +71 -0
- package/core/sdk/ServiceWorkerManager.d.ts +125 -0
- package/core/sdk/SourceMap.d.ts +197 -0
- package/core/sdk/SourceMapCache.d.ts +12 -0
- package/core/sdk/SourceMapFunctionRanges.d.ts +26 -0
- package/core/sdk/SourceMapManager.d.ts +46 -0
- package/core/sdk/SourceMapRangeMappings.d.ts +15 -0
- package/core/sdk/SourceMapScopeChainEntry.d.ts +23 -0
- package/core/sdk/SourceMapScopesInfo.d.ts +109 -0
- package/core/sdk/StorageBucketsModel.d.ts +48 -0
- package/core/sdk/StorageKeyManager.d.ts +38 -0
- package/core/sdk/Target.d.ts +79 -0
- package/core/sdk/TargetManager.d.ts +92 -0
- package/core/sdk/TraceObject.d.ts +43 -0
- package/core/sdk/WebAuthnModel.d.ts +29 -0
- package/core/sdk/sdk.d.ts +97 -1
- package/core/text_utils/CodeMirrorUtils.d.ts +3 -0
- package/core/text_utils/ContentData.d.ts +94 -0
- package/core/text_utils/ContentProvider.d.ts +42 -0
- package/core/text_utils/StaticContentProvider.d.ts +13 -0
- package/core/text_utils/StreamingContentData.d.ts +49 -0
- package/core/text_utils/Text.d.ts +19 -0
- package/core/text_utils/TextCursor.d.ts +9 -0
- package/core/text_utils/TextRange.d.ts +81 -0
- package/core/text_utils/TextUtils.d.ts +97 -0
- package/core/text_utils/WasmDisassembly.d.ts +29 -0
- package/core/text_utils/text_utils.d.ts +11 -0
- package/entrypoints/formatter_actions/formatter_actions.d.ts +48 -0
- package/generated/InspectorBackendCommands.d.ts +14 -0
- package/generated/SupportedCSSProperties.d.ts +18 -0
- package/generated/protocol-mapping.d.ts +5930 -0
- package/generated/protocol-proxy-api.d.ts +5396 -0
- package/generated/protocol.d.ts +26 -72
- package/index.d.ts +2 -0
- package/index.js +6 -0
- package/locales/af.json +171 -174
- package/locales/am.json +351 -354
- package/locales/ar.json +352 -355
- package/locales/as.json +350 -353
- package/locales/az.json +341 -344
- package/locales/be.json +351 -354
- package/locales/bg.json +351 -354
- package/locales/bn.json +351 -354
- package/locales/bs.json +253 -256
- package/locales/ca.json +283 -286
- package/locales/cs.json +336 -339
- package/locales/cy.json +144 -147
- package/locales/da.json +232 -235
- package/locales/de.json +251 -254
- package/locales/el.json +336 -339
- package/locales/en-GB.json +132 -135
- package/locales/en-US.json +294 -297
- package/locales/es-419.json +282 -285
- package/locales/es.json +282 -285
- package/locales/et.json +236 -239
- package/locales/eu.json +131 -134
- package/locales/fa.json +351 -354
- package/locales/fi.json +283 -286
- package/locales/fil.json +128 -131
- package/locales/fr-CA.json +310 -313
- package/locales/fr.json +309 -312
- package/locales/gl.json +264 -267
- package/locales/gu.json +352 -355
- package/locales/he.json +352 -355
- package/locales/hi.json +336 -339
- package/locales/hr.json +257 -260
- package/locales/hu.json +342 -345
- package/locales/hy.json +351 -354
- package/locales/id.json +128 -131
- package/locales/is.json +304 -307
- package/locales/it.json +221 -224
- package/locales/ja.json +351 -354
- package/locales/ka.json +352 -355
- package/locales/kk.json +352 -355
- package/locales/km.json +351 -354
- package/locales/kn.json +352 -355
- package/locales/ko.json +351 -354
- package/locales/ky.json +350 -353
- package/locales/lo.json +352 -355
- package/locales/lt.json +323 -326
- package/locales/lv.json +317 -320
- package/locales/mk.json +352 -355
- package/locales/ml.json +351 -354
- package/locales/mn.json +351 -354
- package/locales/mr.json +351 -354
- package/locales/ms.json +128 -131
- package/locales/my.json +350 -353
- package/locales/ne.json +336 -339
- package/locales/nl.json +183 -186
- package/locales/no.json +238 -241
- package/locales/or.json +351 -354
- package/locales/pa.json +351 -354
- package/locales/pl.json +307 -310
- package/locales/pt-PT.json +273 -276
- package/locales/pt.json +270 -273
- package/locales/ro.json +309 -312
- package/locales/ru.json +351 -354
- package/locales/si.json +352 -355
- package/locales/sk.json +333 -336
- package/locales/sl.json +273 -276
- package/locales/sq.json +316 -319
- package/locales/sr-Latn.json +256 -259
- package/locales/sr.json +352 -355
- package/locales/sv.json +296 -299
- package/locales/sw.json +128 -131
- package/locales/ta.json +352 -355
- package/locales/te.json +350 -353
- package/locales/th.json +352 -355
- package/locales/tr.json +327 -330
- package/locales/uk.json +351 -354
- package/locales/ur.json +352 -355
- package/locales/uz.json +232 -235
- package/locales/vi.json +352 -355
- package/locales/zh-HK.json +352 -355
- package/locales/zh-TW.json +351 -354
- package/locales/zh.json +351 -354
- package/locales/zu.json +127 -130
- package/models/crux-manager/CrUXManager.d.ts +107 -0
- package/models/crux-manager/crux-manager.d.ts +1 -0
- package/models/emulation/DeviceModeModel.d.ts +156 -0
- package/models/emulation/EmulatedDevices.d.ts +148 -0
- package/models/emulation/emulation.d.ts +3 -0
- package/models/formatter/FormatterWorkerPool.d.ts +58 -0
- package/models/formatter/ScriptFormatter.d.ts +11 -0
- package/models/formatter/formatter.d.ts +3 -0
- package/models/trace/ModelImpl.d.ts +1 -1
- package/models/trace/extras/extras.d.ts +2 -7
- package/models/trace/handlers/ScriptsHandler.d.ts +2 -2
- package/models/trace/insights/CLSCulprits.d.ts +14 -14
- package/models/trace/insights/Cache.d.ts +8 -8
- package/models/trace/insights/CharacterSet.d.ts +10 -10
- package/models/trace/insights/Common.d.ts +4 -4
- package/models/trace/insights/DOMSize.d.ts +15 -15
- package/models/trace/insights/DocumentLatency.d.ts +13 -13
- package/models/trace/insights/DuplicatedJavaScript.d.ts +7 -7
- package/models/trace/insights/FontDisplay.d.ts +7 -7
- package/models/trace/insights/ForcedReflow.d.ts +9 -9
- package/models/trace/insights/INPBreakdown.d.ts +10 -10
- package/models/trace/insights/ImageDelivery.d.ts +12 -13
- package/models/trace/insights/LCPBreakdown.d.ts +13 -13
- package/models/trace/insights/LCPDiscovery.d.ts +12 -12
- package/models/trace/insights/LegacyJavaScript.d.ts +7 -7
- package/models/trace/insights/ModernHTTP.d.ts +7 -7
- package/models/trace/insights/NetworkDependencyTree.d.ts +21 -104
- package/models/trace/insights/RenderBlocking.d.ts +7 -7
- package/models/trace/insights/SlowCSSSelector.d.ts +12 -12
- package/models/trace/insights/ThirdParties.d.ts +8 -8
- package/models/trace/insights/Viewport.d.ts +5 -5
- package/models/trace/insights/types.d.ts +1 -1
- package/models/trace/lantern/core/NetworkAnalyzer.d.ts +0 -1
- package/models/trace/lantern/graph/BaseNode.d.ts +2 -2
- package/models/trace/lantern/graph/CPUNode.d.ts +2 -4
- package/models/trace/lantern/simulation/TCPConnection.d.ts +4 -4
- package/models/trace/lantern/types/Lantern.d.ts +19 -27
- package/models/trace/trace.js +544 -16
- package/models/trace/types/Configuration.d.ts +1 -1
- package/models/trace/types/Extensions.d.ts +1 -1
- package/models/trace/types/File.d.ts +5 -5
- package/models/trace/types/TraceEvents.d.ts +24 -24
- package/package.json +37 -8
- package/third_party/codemirror.next/codemirror.next.d.ts +9196 -0
- package/third_party/i18n/i18n-impl.d.ts +25 -0
- package/third_party/i18n/i18n.d.ts +3 -0
- package/third_party/i18n/localized-string-set.d.ts +49 -0
- package/third_party/intl-messageformat/intl-messageformat.d.ts +1 -0
- package/third_party/source-map-scopes-codec/package/src/builder/builder.d.ts +67 -0
- package/third_party/source-map-scopes-codec/package/src/builder/safe_builder.d.ts +38 -0
- package/third_party/source-map-scopes-codec/package/src/codec.d.ts +48 -0
- package/third_party/source-map-scopes-codec/package/src/decode/decode.d.ts +31 -0
- package/third_party/source-map-scopes-codec/package/src/encode/encode.d.ts +8 -0
- package/third_party/source-map-scopes-codec/package/src/encode/encoder.d.ts +6 -0
- package/third_party/source-map-scopes-codec/package/src/mod.d.ts +5 -0
- package/third_party/source-map-scopes-codec/package/src/scopes.d.ts +168 -0
- package/third_party/source-map-scopes-codec/package/src/util.d.ts +5 -0
- package/third_party/source-map-scopes-codec/package/src/vlq.d.ts +14 -0
- package/third_party/source-map-scopes-codec/source-map-scopes-codec.d.ts +1 -0
- package/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
- package/third_party/third-party-web/package/lib/index.d.ts +34 -0
- package/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
- package/third_party/third-party-web/third-party-web.d.ts +2 -1
- package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts +0 -13
- package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts.map +0 -1
- package/.tmp/tsbuildinfo/analyze-trace.d.mts +0 -17
- package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +0 -1
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +0 -4
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +0 -1
- package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts +0 -2
- package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts.map +0 -1
- package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts +0 -3
- package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts.map +0 -1
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +0 -1
- package/analyze-inspector-issues.mjs +0 -60
- package/core/common/common.js +0 -1
- package/core/host/host.js +0 -1
- package/core/platform/ArrayUtilities.js +0 -224
- package/core/platform/ArrayUtilities.js.map +0 -1
- package/core/platform/Brand.js +0 -5
- package/core/platform/Brand.js.map +0 -1
- package/core/platform/Constructor.js +0 -5
- package/core/platform/Constructor.js.map +0 -1
- package/core/platform/DateUtilities.js +0 -14
- package/core/platform/DateUtilities.js.map +0 -1
- package/core/platform/DevToolsPath.js +0 -28
- package/core/platform/DevToolsPath.js.map +0 -1
- package/core/platform/HostRuntime.js +0 -31
- package/core/platform/HostRuntime.js.map +0 -1
- package/core/platform/KeyboardUtilities.js +0 -34
- package/core/platform/KeyboardUtilities.js.map +0 -1
- package/core/platform/MapUtilities.js +0 -80
- package/core/platform/MapUtilities.js.map +0 -1
- package/core/platform/MimeType.js +0 -157
- package/core/platform/MimeType.js.map +0 -1
- package/core/platform/NumberUtilities.js +0 -73
- package/core/platform/NumberUtilities.js.map +0 -1
- package/core/platform/Size.js +0 -36
- package/core/platform/Size.js.map +0 -1
- package/core/platform/StringUtilities.js +0 -731
- package/core/platform/StringUtilities.js.map +0 -1
- package/core/platform/Timing.js +0 -10
- package/core/platform/Timing.js.map +0 -1
- package/core/platform/TypedArrayUtilities.js +0 -158
- package/core/platform/TypedArrayUtilities.js.map +0 -1
- package/core/platform/TypescriptUtilities.js +0 -17
- package/core/platform/TypescriptUtilities.js.map +0 -1
- package/core/platform/UIString.js +0 -5
- package/core/platform/UIString.js.map +0 -1
- package/core/platform/UserVisibleError.js +0 -23
- package/core/platform/UserVisibleError.js.map +0 -1
- package/core/platform/api/HostRuntime.js +0 -5
- package/core/platform/api/HostRuntime.js.map +0 -1
- package/core/platform/api/api-tsconfig.json +0 -58
- package/core/platform/api/api-tsconfig.ref.json +0 -26
- package/core/platform/api/api.js +0 -6
- package/core/platform/api/api.js.map +0 -1
- package/core/platform/browser/HostRuntime.js +0 -165
- package/core/platform/browser/HostRuntime.js.map +0 -1
- package/core/platform/browser/browser-tsconfig.json +0 -59
- package/core/platform/browser/browser-tsconfig.ref.json +0 -27
- package/core/platform/browser/browser.js +0 -6
- package/core/platform/browser/browser.js.map +0 -1
- package/core/platform/browser/bundle-tsconfig.json +0 -59
- package/core/platform/browser/bundle-tsconfig.ref.json +0 -27
- package/core/platform/bundle-tsconfig.json +0 -59
- package/core/platform/bundle-tsconfig.ref.json +0 -27
- package/core/platform/foundation_unittests-tsconfig.json +0 -73
- package/core/platform/foundation_unittests-tsconfig.ref.json +0 -40
- package/core/platform/foundation_unittests_node_typecheck-tsconfig.json +0 -70
- package/core/platform/node/HostRuntime.js +0 -127
- package/core/platform/node/HostRuntime.js.map +0 -1
- package/core/platform/node/bundle-tsconfig.json +0 -59
- package/core/platform/node/bundle-tsconfig.ref.json +0 -27
- package/core/platform/node/node-tsconfig.json +0 -59
- package/core/platform/node/node-tsconfig.ref.json +0 -27
- package/core/platform/node/node.js +0 -6
- package/core/platform/node/node.js.map +0 -1
- package/core/platform/platform-tsconfig.json +0 -81
- package/core/platform/platform-tsconfig.ref.json +0 -49
- package/core/platform/platform.js +0 -28
- package/core/platform/platform.js.map +0 -1
- package/core/platform/platform_node_typecheck-tsconfig.json +0 -78
- package/core/platform/platform_node_typecheck.stamp +0 -0
- package/core/root/root.js +0 -1
- package/core/sdk/sdk.js +0 -1
- package/generated/protocol.js +0 -3304
- package/locales/en-XL.json +0 -1058
- package/models/cpu_profile/CPUProfileDataModel.js +0 -517
- package/models/cpu_profile/CPUProfileDataModel.js.map +0 -1
- package/models/cpu_profile/ProfileTreeModel.js +0 -90
- package/models/cpu_profile/ProfileTreeModel.js.map +0 -1
- package/models/cpu_profile/bundle-tsconfig.json +0 -59
- package/models/cpu_profile/bundle-tsconfig.ref.json +0 -27
- package/models/cpu_profile/cpu_profile-tsconfig.json +0 -63
- package/models/cpu_profile/cpu_profile-tsconfig.ref.json +0 -31
- package/models/cpu_profile/cpu_profile.js +0 -7
- package/models/cpu_profile/cpu_profile.js.map +0 -1
- package/models/cpu_profile/cpu_profile_node_typecheck-tsconfig.json +0 -60
- package/models/cpu_profile/cpu_profile_node_typecheck.stamp +0 -0
- package/models/cpu_profile/foundation_unittests-tsconfig.json +0 -63
- package/models/cpu_profile/foundation_unittests-tsconfig.ref.json +0 -30
- package/models/cpu_profile/foundation_unittests_node_typecheck-tsconfig.json +0 -60
- package/models/issues_manager/CheckFormsIssuesTrigger.d.ts +0 -1
- package/models/issues_manager/CheckFormsIssuesTrigger.js +0 -1
- package/models/issues_manager/ContrastCheckTrigger.d.ts +0 -1
- package/models/issues_manager/ContrastCheckTrigger.js +0 -1
- package/models/issues_manager/DeprecationIssue.d.ts +0 -1
- package/models/issues_manager/DeprecationIssue.js +0 -1
- package/models/issues_manager/IssueResolver.d.ts +0 -1
- package/models/issues_manager/IssueResolver.js +0 -1
- package/models/issues_manager/RelatedIssue.d.ts +0 -1
- package/models/issues_manager/RelatedIssue.js +0 -1
- package/models/issues_manager/SourceFrameIssuesManager.d.ts +0 -1
- package/models/issues_manager/SourceFrameIssuesManager.js +0 -1
- package/models/trace/EntityMapper.js +0 -133
- package/models/trace/EntityMapper.js.map +0 -1
- package/models/trace/EventsSerializer.js +0 -90
- package/models/trace/EventsSerializer.js.map +0 -1
- package/models/trace/LanternComputationData.js +0 -374
- package/models/trace/LanternComputationData.js.map +0 -1
- package/models/trace/LegacyTracingModel.d.ts +0 -1
- package/models/trace/LegacyTracingModel.js +0 -1
- package/models/trace/ModelImpl.js +0 -181
- package/models/trace/ModelImpl.js.map +0 -1
- package/models/trace/Name.js +0 -115
- package/models/trace/Name.js.map +0 -1
- package/models/trace/Processor.js +0 -618
- package/models/trace/Processor.js.map +0 -1
- package/models/trace/Styles.js +0 -836
- package/models/trace/Styles.js.map +0 -1
- package/models/trace/TracingManager.d.ts +0 -1
- package/models/trace/TracingManager.js +0 -1
- package/models/trace/bundle-tsconfig.json +0 -77
- package/models/trace/bundle-tsconfig.ref.json +0 -45
- package/models/trace/extras/FilmStrip.js +0 -45
- package/models/trace/extras/FilmStrip.js.map +0 -1
- package/models/trace/extras/Initiators.js +0 -47
- package/models/trace/extras/Initiators.js.map +0 -1
- package/models/trace/extras/MainThreadActivity.js +0 -77
- package/models/trace/extras/MainThreadActivity.js.map +0 -1
- package/models/trace/extras/ScriptDuplication.js +0 -163
- package/models/trace/extras/ScriptDuplication.js.map +0 -1
- package/models/trace/extras/StackTraceForEvent.js +0 -192
- package/models/trace/extras/StackTraceForEvent.js.map +0 -1
- package/models/trace/extras/ThirdParties.js +0 -119
- package/models/trace/extras/ThirdParties.js.map +0 -1
- package/models/trace/extras/TraceFilter.js +0 -51
- package/models/trace/extras/TraceFilter.js.map +0 -1
- package/models/trace/extras/TraceTree.js +0 -621
- package/models/trace/extras/TraceTree.js.map +0 -1
- package/models/trace/extras/bundle-tsconfig.json +0 -59
- package/models/trace/extras/bundle-tsconfig.ref.json +0 -27
- package/models/trace/extras/extras-tsconfig.json +0 -81
- package/models/trace/extras/extras-tsconfig.ref.json +0 -49
- package/models/trace/extras/extras.js +0 -13
- package/models/trace/extras/extras.js.map +0 -1
- package/models/trace/extras/extras_node_typecheck-tsconfig.json +0 -78
- package/models/trace/extras/extras_node_typecheck.stamp +0 -0
- package/models/trace/extras/foundation_unittests-tsconfig.json +0 -91
- package/models/trace/extras/foundation_unittests-tsconfig.ref.json +0 -58
- package/models/trace/extras/foundation_unittests_node_typecheck-tsconfig.json +0 -88
- package/models/trace/foundation_unittests-tsconfig.json +0 -70
- package/models/trace/foundation_unittests-tsconfig.ref.json +0 -37
- package/models/trace/foundation_unittests_node_typecheck-tsconfig.json +0 -67
- package/models/trace/handlers/AnimationFramesHandler.js +0 -110
- package/models/trace/handlers/AnimationFramesHandler.js.map +0 -1
- package/models/trace/handlers/AnimationHandler.js +0 -27
- package/models/trace/handlers/AnimationHandler.js.map +0 -1
- package/models/trace/handlers/AsyncJSCallsHandler.js +0 -188
- package/models/trace/handlers/AsyncJSCallsHandler.js.map +0 -1
- package/models/trace/handlers/DOMStatsHandler.js +0 -22
- package/models/trace/handlers/DOMStatsHandler.js.map +0 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.js +0 -264
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +0 -1
- package/models/trace/handlers/FlowsHandler.js +0 -149
- package/models/trace/handlers/FlowsHandler.js.map +0 -1
- package/models/trace/handlers/FramesHandler.js +0 -491
- package/models/trace/handlers/FramesHandler.js.map +0 -1
- package/models/trace/handlers/GPUHandler.js +0 -36
- package/models/trace/handlers/GPUHandler.js.map +0 -1
- package/models/trace/handlers/ImagePaintingHandler.js +0 -148
- package/models/trace/handlers/ImagePaintingHandler.js.map +0 -1
- package/models/trace/handlers/InitiatorsHandler.js +0 -181
- package/models/trace/handlers/InitiatorsHandler.js.map +0 -1
- package/models/trace/handlers/InvalidationsHandler.js +0 -127
- package/models/trace/handlers/InvalidationsHandler.js.map +0 -1
- package/models/trace/handlers/LargestImagePaintHandler.js +0 -86
- package/models/trace/handlers/LargestImagePaintHandler.js.map +0 -1
- package/models/trace/handlers/LargestTextPaintHandler.js +0 -28
- package/models/trace/handlers/LargestTextPaintHandler.js.map +0 -1
- package/models/trace/handlers/LayerTreeHandler.js +0 -104
- package/models/trace/handlers/LayerTreeHandler.js.map +0 -1
- package/models/trace/handlers/LayoutShiftsHandler.js +0 -457
- package/models/trace/handlers/LayoutShiftsHandler.js.map +0 -1
- package/models/trace/handlers/MemoryHandler.js +0 -22
- package/models/trace/handlers/MemoryHandler.js.map +0 -1
- package/models/trace/handlers/MetaHandler.js +0 -442
- package/models/trace/handlers/MetaHandler.js.map +0 -1
- package/models/trace/handlers/ModelHandlers.js +0 -33
- package/models/trace/handlers/ModelHandlers.js.map +0 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +0 -578
- package/models/trace/handlers/NetworkRequestsHandler.js.map +0 -1
- package/models/trace/handlers/PageFramesHandler.js +0 -43
- package/models/trace/handlers/PageFramesHandler.js.map +0 -1
- package/models/trace/handlers/PageLoadMetricsHandler.js +0 -462
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +0 -1
- package/models/trace/handlers/RendererHandler.js +0 -346
- package/models/trace/handlers/RendererHandler.js.map +0 -1
- package/models/trace/handlers/SamplesHandler.js +0 -261
- package/models/trace/handlers/SamplesHandler.js.map +0 -1
- package/models/trace/handlers/ScreenshotsHandler.js +0 -56
- package/models/trace/handlers/ScreenshotsHandler.js.map +0 -1
- package/models/trace/handlers/ScriptsHandler.js +0 -286
- package/models/trace/handlers/ScriptsHandler.js.map +0 -1
- package/models/trace/handlers/SelectorStatsHandler.js +0 -72
- package/models/trace/handlers/SelectorStatsHandler.js.map +0 -1
- package/models/trace/handlers/Threads.js +0 -108
- package/models/trace/handlers/Threads.js.map +0 -1
- package/models/trace/handlers/UserInteractionsHandler.js +0 -319
- package/models/trace/handlers/UserInteractionsHandler.js.map +0 -1
- package/models/trace/handlers/UserTimingsHandler.js +0 -194
- package/models/trace/handlers/UserTimingsHandler.js.map +0 -1
- package/models/trace/handlers/WarningsHandler.js +0 -135
- package/models/trace/handlers/WarningsHandler.js.map +0 -1
- package/models/trace/handlers/WorkersHandler.js +0 -34
- package/models/trace/handlers/WorkersHandler.js.map +0 -1
- package/models/trace/handlers/bundle-tsconfig.json +0 -59
- package/models/trace/handlers/bundle-tsconfig.ref.json +0 -27
- package/models/trace/handlers/foundation_unittests-tsconfig.json +0 -102
- package/models/trace/handlers/foundation_unittests-tsconfig.ref.json +0 -69
- package/models/trace/handlers/foundation_unittests_node_typecheck-tsconfig.json +0 -99
- package/models/trace/handlers/handlers-tsconfig.json +0 -112
- package/models/trace/handlers/handlers-tsconfig.ref.json +0 -80
- package/models/trace/handlers/handlers.js +0 -8
- package/models/trace/handlers/handlers.js.map +0 -1
- package/models/trace/handlers/handlers_node_typecheck-tsconfig.json +0 -109
- package/models/trace/handlers/handlers_node_typecheck.stamp +0 -0
- package/models/trace/handlers/helpers.js +0 -164
- package/models/trace/handlers/helpers.js.map +0 -1
- package/models/trace/handlers/types.js +0 -2
- package/models/trace/handlers/types.js.map +0 -1
- package/models/trace/helpers/Extensions.js +0 -42
- package/models/trace/helpers/Extensions.js.map +0 -1
- package/models/trace/helpers/Network.js +0 -103
- package/models/trace/helpers/Network.js.map +0 -1
- package/models/trace/helpers/SamplesIntegrator.js +0 -512
- package/models/trace/helpers/SamplesIntegrator.js.map +0 -1
- package/models/trace/helpers/SyntheticEvents.js +0 -94
- package/models/trace/helpers/SyntheticEvents.js.map +0 -1
- package/models/trace/helpers/Timing.js +0 -207
- package/models/trace/helpers/Timing.js.map +0 -1
- package/models/trace/helpers/Trace.js +0 -817
- package/models/trace/helpers/Trace.js.map +0 -1
- package/models/trace/helpers/TreeHelpers.js +0 -255
- package/models/trace/helpers/TreeHelpers.js.map +0 -1
- package/models/trace/helpers/bundle-tsconfig.json +0 -59
- package/models/trace/helpers/bundle-tsconfig.ref.json +0 -27
- package/models/trace/helpers/foundation_unittests-tsconfig.json +0 -73
- package/models/trace/helpers/foundation_unittests-tsconfig.ref.json +0 -40
- package/models/trace/helpers/foundation_unittests_node_typecheck-tsconfig.json +0 -70
- package/models/trace/helpers/helpers-tsconfig.json +0 -77
- package/models/trace/helpers/helpers-tsconfig.ref.json +0 -45
- package/models/trace/helpers/helpers.js +0 -11
- package/models/trace/helpers/helpers.js.map +0 -1
- package/models/trace/helpers/helpers_node_typecheck-tsconfig.json +0 -74
- package/models/trace/helpers/helpers_node_typecheck.stamp +0 -0
- package/models/trace/insights/CLSCulprits.js +0 -519
- package/models/trace/insights/CLSCulprits.js.map +0 -1
- package/models/trace/insights/Cache.js +0 -210
- package/models/trace/insights/Cache.js.map +0 -1
- package/models/trace/insights/CharacterSet.js +0 -132
- package/models/trace/insights/CharacterSet.js.map +0 -1
- package/models/trace/insights/Common.js +0 -366
- package/models/trace/insights/Common.js.map +0 -1
- package/models/trace/insights/DOMSize.js +0 -182
- package/models/trace/insights/DOMSize.js.map +0 -1
- package/models/trace/insights/DocumentLatency.js +0 -259
- package/models/trace/insights/DocumentLatency.js.map +0 -1
- package/models/trace/insights/DuplicatedJavaScript.js +0 -99
- package/models/trace/insights/DuplicatedJavaScript.js.map +0 -1
- package/models/trace/insights/FontDisplay.js +0 -93
- package/models/trace/insights/FontDisplay.js.map +0 -1
- package/models/trace/insights/ForcedReflow.js +0 -162
- package/models/trace/insights/ForcedReflow.js.map +0 -1
- package/models/trace/insights/INPBreakdown.js +0 -130
- package/models/trace/insights/INPBreakdown.js.map +0 -1
- package/models/trace/insights/ImageDelivery.js +0 -264
- package/models/trace/insights/ImageDelivery.js.map +0 -1
- package/models/trace/insights/LCPBreakdown.js +0 -200
- package/models/trace/insights/LCPBreakdown.js.map +0 -1
- package/models/trace/insights/LCPDiscovery.js +0 -190
- package/models/trace/insights/LCPDiscovery.js.map +0 -1
- package/models/trace/insights/LegacyJavaScript.js +0 -99
- package/models/trace/insights/LegacyJavaScript.js.map +0 -1
- package/models/trace/insights/Models.js +0 -23
- package/models/trace/insights/Models.js.map +0 -1
- package/models/trace/insights/ModernHTTP.js +0 -205
- package/models/trace/insights/ModernHTTP.js.map +0 -1
- package/models/trace/insights/NetworkDependencyTree.js +0 -972
- package/models/trace/insights/NetworkDependencyTree.js.map +0 -1
- package/models/trace/insights/RenderBlocking.js +0 -191
- package/models/trace/insights/RenderBlocking.js.map +0 -1
- package/models/trace/insights/SlowCSSSelector.js +0 -140
- package/models/trace/insights/SlowCSSSelector.js.map +0 -1
- package/models/trace/insights/Statistics.js +0 -93
- package/models/trace/insights/Statistics.js.map +0 -1
- package/models/trace/insights/ThirdParties.js +0 -110
- package/models/trace/insights/ThirdParties.js.map +0 -1
- package/models/trace/insights/Viewport.js +0 -105
- package/models/trace/insights/Viewport.js.map +0 -1
- package/models/trace/insights/bundle-tsconfig.json +0 -59
- package/models/trace/insights/bundle-tsconfig.ref.json +0 -27
- package/models/trace/insights/foundation_unittests-tsconfig.json +0 -98
- package/models/trace/insights/foundation_unittests-tsconfig.ref.json +0 -65
- package/models/trace/insights/foundation_unittests_node_typecheck-tsconfig.json +0 -95
- package/models/trace/insights/insights-tsconfig.json +0 -114
- package/models/trace/insights/insights-tsconfig.ref.json +0 -82
- package/models/trace/insights/insights.js +0 -10
- package/models/trace/insights/insights.js.map +0 -1
- package/models/trace/insights/insights_node_typecheck-tsconfig.json +0 -111
- package/models/trace/insights/insights_node_typecheck.stamp +0 -0
- package/models/trace/insights/types.js +0 -41
- package/models/trace/insights/types.js.map +0 -1
- package/models/trace/lantern/bundle-tsconfig.json +0 -71
- package/models/trace/lantern/bundle-tsconfig.ref.json +0 -39
- package/models/trace/lantern/core/LanternError.js +0 -7
- package/models/trace/lantern/core/LanternError.js.map +0 -1
- package/models/trace/lantern/core/NetworkAnalyzer.js +0 -488
- package/models/trace/lantern/core/NetworkAnalyzer.js.map +0 -1
- package/models/trace/lantern/core/bundle-tsconfig.json +0 -59
- package/models/trace/lantern/core/bundle-tsconfig.ref.json +0 -27
- package/models/trace/lantern/core/core-tsconfig.json +0 -60
- package/models/trace/lantern/core/core-tsconfig.ref.json +0 -28
- package/models/trace/lantern/core/core.js +0 -6
- package/models/trace/lantern/core/core.js.map +0 -1
- package/models/trace/lantern/core/core_node_typecheck-tsconfig.json +0 -57
- package/models/trace/lantern/core/core_node_typecheck.stamp +0 -0
- package/models/trace/lantern/core/foundation_unittests-tsconfig.json +0 -69
- package/models/trace/lantern/core/foundation_unittests-tsconfig.ref.json +0 -36
- package/models/trace/lantern/core/foundation_unittests_node_typecheck-tsconfig.json +0 -66
- package/models/trace/lantern/graph/BaseNode.js +0 -277
- package/models/trace/lantern/graph/BaseNode.js.map +0 -1
- package/models/trace/lantern/graph/CPUNode.js +0 -80
- package/models/trace/lantern/graph/CPUNode.js.map +0 -1
- package/models/trace/lantern/graph/NetworkNode.js +0 -95
- package/models/trace/lantern/graph/NetworkNode.js.map +0 -1
- package/models/trace/lantern/graph/PageDependencyGraph.js +0 -574
- package/models/trace/lantern/graph/PageDependencyGraph.js.map +0 -1
- package/models/trace/lantern/graph/bundle-tsconfig.json +0 -59
- package/models/trace/lantern/graph/bundle-tsconfig.ref.json +0 -27
- package/models/trace/lantern/graph/foundation_unittests-tsconfig.json +0 -61
- package/models/trace/lantern/graph/foundation_unittests-tsconfig.ref.json +0 -28
- package/models/trace/lantern/graph/foundation_unittests_node_typecheck-tsconfig.json +0 -58
- package/models/trace/lantern/graph/graph-tsconfig.json +0 -65
- package/models/trace/lantern/graph/graph-tsconfig.ref.json +0 -33
- package/models/trace/lantern/graph/graph.js +0 -8
- package/models/trace/lantern/graph/graph.js.map +0 -1
- package/models/trace/lantern/graph/graph_node_typecheck-tsconfig.json +0 -62
- package/models/trace/lantern/graph/graph_node_typecheck.stamp +0 -0
- package/models/trace/lantern/lantern.js +0 -10
- package/models/trace/lantern/lantern.js.map +0 -1
- package/models/trace/lantern/metrics/FirstContentfulPaint.js +0 -137
- package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +0 -1
- package/models/trace/lantern/metrics/Interactive.js +0 -68
- package/models/trace/lantern/metrics/Interactive.js.map +0 -1
- package/models/trace/lantern/metrics/LargestContentfulPaint.js +0 -69
- package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +0 -1
- package/models/trace/lantern/metrics/MaxPotentialFID.js +0 -49
- package/models/trace/lantern/metrics/MaxPotentialFID.js.map +0 -1
- package/models/trace/lantern/metrics/Metric.js +0 -69
- package/models/trace/lantern/metrics/Metric.js.map +0 -1
- package/models/trace/lantern/metrics/SpeedIndex.js +0 -102
- package/models/trace/lantern/metrics/SpeedIndex.js.map +0 -1
- package/models/trace/lantern/metrics/TBTUtils.js +0 -65
- package/models/trace/lantern/metrics/TBTUtils.js.map +0 -1
- package/models/trace/lantern/metrics/TotalBlockingTime.js +0 -79
- package/models/trace/lantern/metrics/TotalBlockingTime.js.map +0 -1
- package/models/trace/lantern/metrics/bundle-tsconfig.json +0 -59
- package/models/trace/lantern/metrics/bundle-tsconfig.ref.json +0 -27
- package/models/trace/lantern/metrics/foundation_unittests-tsconfig.json +0 -76
- package/models/trace/lantern/metrics/foundation_unittests-tsconfig.ref.json +0 -43
- package/models/trace/lantern/metrics/foundation_unittests_node_typecheck-tsconfig.json +0 -73
- package/models/trace/lantern/metrics/metrics-tsconfig.json +0 -75
- package/models/trace/lantern/metrics/metrics-tsconfig.ref.json +0 -43
- package/models/trace/lantern/metrics/metrics.js +0 -12
- package/models/trace/lantern/metrics/metrics.js.map +0 -1
- package/models/trace/lantern/metrics/metrics_node_typecheck-tsconfig.json +0 -72
- package/models/trace/lantern/metrics/metrics_node_typecheck.stamp +0 -0
- package/models/trace/lantern/simulation/ConnectionPool.js +0 -116
- package/models/trace/lantern/simulation/ConnectionPool.js.map +0 -1
- package/models/trace/lantern/simulation/Constants.js +0 -45
- package/models/trace/lantern/simulation/Constants.js.map +0 -1
- package/models/trace/lantern/simulation/DNSCache.js +0 -48
- package/models/trace/lantern/simulation/DNSCache.js.map +0 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js +0 -135
- package/models/trace/lantern/simulation/SimulationTimingMap.js.map +0 -1
- package/models/trace/lantern/simulation/Simulator.js +0 -455
- package/models/trace/lantern/simulation/Simulator.js.map +0 -1
- package/models/trace/lantern/simulation/TCPConnection.js +0 -155
- package/models/trace/lantern/simulation/TCPConnection.js.map +0 -1
- package/models/trace/lantern/simulation/bundle-tsconfig.json +0 -59
- package/models/trace/lantern/simulation/bundle-tsconfig.ref.json +0 -27
- package/models/trace/lantern/simulation/foundation_unittests-tsconfig.json +0 -75
- package/models/trace/lantern/simulation/foundation_unittests-tsconfig.ref.json +0 -42
- package/models/trace/lantern/simulation/foundation_unittests_node_typecheck-tsconfig.json +0 -72
- package/models/trace/lantern/simulation/simulation-tsconfig.json +0 -70
- package/models/trace/lantern/simulation/simulation-tsconfig.ref.json +0 -38
- package/models/trace/lantern/simulation/simulation.js +0 -10
- package/models/trace/lantern/simulation/simulation.js.map +0 -1
- package/models/trace/lantern/simulation/simulation_node_typecheck-tsconfig.json +0 -67
- package/models/trace/lantern/simulation/simulation_node_typecheck.stamp +0 -0
- package/models/trace/lantern/testing/bundle-tsconfig.json +0 -60
- package/models/trace/lantern/testing/bundle-tsconfig.ref.json +0 -27
- package/models/trace/lantern/testing/testing-tsconfig.json +0 -63
- package/models/trace/lantern/testing/testing-tsconfig.ref.json +0 -30
- package/models/trace/lantern/types/Lantern.js +0 -25
- package/models/trace/lantern/types/Lantern.js.map +0 -1
- package/models/trace/lantern/types/bundle-tsconfig.json +0 -59
- package/models/trace/lantern/types/bundle-tsconfig.ref.json +0 -27
- package/models/trace/lantern/types/types-tsconfig.json +0 -59
- package/models/trace/lantern/types/types-tsconfig.ref.json +0 -27
- package/models/trace/lantern/types/types.js +0 -5
- package/models/trace/lantern/types/types.js.map +0 -1
- package/models/trace/lantern/types/types_node_typecheck-tsconfig.json +0 -56
- package/models/trace/lantern/types/types_node_typecheck.stamp +0 -0
- package/models/trace/trace-tsconfig.json +0 -89
- package/models/trace/trace-tsconfig.ref.json +0 -57
- package/models/trace/trace.js.map +0 -1
- package/models/trace/trace_node_typecheck-tsconfig.json +0 -86
- package/models/trace/trace_node_typecheck.stamp +0 -0
- package/models/trace/types/Configuration.js +0 -19
- package/models/trace/types/Configuration.js.map +0 -1
- package/models/trace/types/Extensions.js +0 -38
- package/models/trace/types/Extensions.js.map +0 -1
- package/models/trace/types/File.js +0 -82
- package/models/trace/types/File.js.map +0 -1
- package/models/trace/types/Overlays.js +0 -5
- package/models/trace/types/Overlays.js.map +0 -1
- package/models/trace/types/Timing.js +0 -16
- package/models/trace/types/Timing.js.map +0 -1
- package/models/trace/types/TraceEvents.js +0 -986
- package/models/trace/types/TraceEvents.js.map +0 -1
- package/models/trace/types/bundle-tsconfig.json +0 -59
- package/models/trace/types/bundle-tsconfig.ref.json +0 -27
- package/models/trace/types/foundation_unittests-tsconfig.json +0 -67
- package/models/trace/types/foundation_unittests-tsconfig.ref.json +0 -34
- package/models/trace/types/foundation_unittests_node_typecheck-tsconfig.json +0 -64
- package/models/trace/types/types-tsconfig.json +0 -76
- package/models/trace/types/types-tsconfig.ref.json +0 -44
- package/models/trace/types/types.js +0 -10
- package/models/trace/types/types.js.map +0 -1
- package/models/trace/types/types_node_typecheck-tsconfig.json +0 -73
- package/models/trace/types/types_node_typecheck.stamp +0 -0
- package/test/invalid-animation-events.json.gz +0 -0
- package/test/test-trace-engine.mjs +0 -191
- package/third_party/legacy-javascript/bundle-tsconfig.json +0 -59
- package/third_party/legacy-javascript/bundle-tsconfig.ref.json +0 -27
- package/third_party/legacy-javascript/legacy-javascript-tsconfig.ref.json +0 -15
- package/third_party/legacy-javascript/legacy-javascript.js +0 -3
- package/third_party/legacy-javascript/legacy-javascript.js.map +0 -1
- package/third_party/legacy-javascript/lib/legacy-javascript.js +0 -1119
- package/third_party/marked/marked.d.ts +0 -1
- package/third_party/marked/marked.js +0 -1
- package/third_party/third-party-web/third-party-web.js +0 -1
- package/tsconfig.json +0 -29
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 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 { linearInterpolation } from './Statistics.js';
|
|
8
|
-
import { InsightCategory, InsightKeys, } from './types.js';
|
|
9
|
-
export const UIStrings = {
|
|
10
|
-
/**
|
|
11
|
-
* @description Title of an insight that provides information and suggestions of resources that could improve their caching.
|
|
12
|
-
*/
|
|
13
|
-
title: 'Use efficient cache lifetimes',
|
|
14
|
-
/**
|
|
15
|
-
* @description Text to tell the user about how caching can help improve performance.
|
|
16
|
-
*/
|
|
17
|
-
description: 'A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).',
|
|
18
|
-
/**
|
|
19
|
-
* @description Column for a font loaded by the page to render text.
|
|
20
|
-
*/
|
|
21
|
-
requestColumn: 'Request',
|
|
22
|
-
/**
|
|
23
|
-
* @description Column for a resource cache's Time To Live.
|
|
24
|
-
*/
|
|
25
|
-
cacheTTL: 'Cache TTL',
|
|
26
|
-
/**
|
|
27
|
-
* @description Text describing that there were no requests found that need caching.
|
|
28
|
-
*/
|
|
29
|
-
noRequestsToCache: 'No requests with inefficient cache policies',
|
|
30
|
-
/**
|
|
31
|
-
* @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.
|
|
32
|
-
* @example {5} PH1
|
|
33
|
-
*/
|
|
34
|
-
others: '{PH1} others',
|
|
35
|
-
};
|
|
36
|
-
// const str_ = i18n.i18n.registerUIStrings('models/trace/insights/Cache.ts', UIStrings);
|
|
37
|
-
export const i18nString = (i18nId, values) => ({i18nId, values}); // i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
38
|
-
// Threshold for cache hits.
|
|
39
|
-
const IGNORE_THRESHOLD_IN_PERCENT = 0.925;
|
|
40
|
-
function finalize(partialModel) {
|
|
41
|
-
return {
|
|
42
|
-
insightKey: InsightKeys.CACHE,
|
|
43
|
-
strings: UIStrings,
|
|
44
|
-
title: i18nString(UIStrings.title),
|
|
45
|
-
description: i18nString(UIStrings.description),
|
|
46
|
-
docs: 'https://developer.chrome.com/docs/performance/insights/cache',
|
|
47
|
-
category: InsightCategory.ALL,
|
|
48
|
-
state: partialModel.requests.length > 0 ? 'fail' : 'pass',
|
|
49
|
-
...partialModel,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Determines if a request is "cacheable".
|
|
54
|
-
* A request is "cacheable" if it is of the appropriate protocol and resource type
|
|
55
|
-
* (see Helpers.Network.NON_NETWORK_SCHEMES and Helpers.Network.STATIC_RESOURCE_TYPE)
|
|
56
|
-
* and has the appropriate statusCodes.
|
|
57
|
-
*/
|
|
58
|
-
export function isCacheable(request) {
|
|
59
|
-
// Caching doesn't make sense for requests not loaded over the network.
|
|
60
|
-
if (Helpers.Network.NON_NETWORK_SCHEMES.includes(request.args.data.protocol)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
return Boolean(Helpers.Network.CACHEABLE_STATUS_CODES.has(request.args.data.statusCode) &&
|
|
64
|
-
Helpers.Network.STATIC_RESOURCE_TYPES.has(request.args.data.resourceType || "Other" /* Protocol.Network.ResourceType.Other */));
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Returns max-age if defined, otherwise expires header if defined, and null if not.
|
|
68
|
-
*/
|
|
69
|
-
export function computeCacheLifetimeInSeconds(headers, cacheControl) {
|
|
70
|
-
if (cacheControl?.['max-age'] !== undefined) {
|
|
71
|
-
return cacheControl['max-age'];
|
|
72
|
-
}
|
|
73
|
-
const expiresHeaders = headers.find(h => h.name === 'expires')?.value ?? null;
|
|
74
|
-
if (expiresHeaders) {
|
|
75
|
-
const expires = new Date(expiresHeaders).getTime();
|
|
76
|
-
// Treat expires values as having already expired.
|
|
77
|
-
if (!expires) {
|
|
78
|
-
return 0;
|
|
79
|
-
}
|
|
80
|
-
return Math.ceil((expires - Date.now()) / 1000);
|
|
81
|
-
}
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Computes the percent likelihood that a return visit will be within the cache lifetime, based on
|
|
86
|
-
* historical Chrome UMA stats (see RESOURCE_AGE_IN_HOURS_DECILES comment).
|
|
87
|
-
*
|
|
88
|
-
* This function returns values on this curve: https://www.desmos.com/calculator/eaqiszhugy (but using seconds, rather than hours)
|
|
89
|
-
* See http://github.com/GoogleChrome/lighthouse/pull/3531 for history.
|
|
90
|
-
*/
|
|
91
|
-
function getCacheHitProbability(maxAgeInSeconds) {
|
|
92
|
-
// This array contains the hand wavy distribution of the age of a resource in hours at the time of
|
|
93
|
-
// cache hit at 0th, 10th, 20th, 30th, etc percentiles. This is used to compute `wastedMs` since there
|
|
94
|
-
// are clearly diminishing returns to cache duration i.e. 6 months is not 2x better than 3 months.
|
|
95
|
-
// Based on UMA stats for HttpCache.StaleEntry.Validated.Age. see https://www.desmos.com/calculator/jjwc5mzuwd
|
|
96
|
-
// This UMA data is from 2017 but the metric isn't tracked any longer in 2025.
|
|
97
|
-
const RESOURCE_AGE_IN_HOURS_DECILES = [0, 0.2, 1, 3, 8, 12, 24, 48, 72, 168, 8760, Infinity];
|
|
98
|
-
const maxAgeInHours = maxAgeInSeconds / 3600;
|
|
99
|
-
const upperDecileIndex = RESOURCE_AGE_IN_HOURS_DECILES.findIndex(decile => decile >= maxAgeInHours);
|
|
100
|
-
// Clip the likelihood between 0 and 1
|
|
101
|
-
if (upperDecileIndex === RESOURCE_AGE_IN_HOURS_DECILES.length - 1) {
|
|
102
|
-
return 1;
|
|
103
|
-
}
|
|
104
|
-
if (upperDecileIndex === 0) {
|
|
105
|
-
return 0;
|
|
106
|
-
}
|
|
107
|
-
// Use the two closest decile points as control points
|
|
108
|
-
const upperDecileValue = RESOURCE_AGE_IN_HOURS_DECILES[upperDecileIndex];
|
|
109
|
-
const lowerDecileValue = RESOURCE_AGE_IN_HOURS_DECILES[upperDecileIndex - 1];
|
|
110
|
-
const upperDecile = upperDecileIndex / 10;
|
|
111
|
-
const lowerDecile = (upperDecileIndex - 1) / 10;
|
|
112
|
-
// Approximate the real likelihood with linear interpolation
|
|
113
|
-
return linearInterpolation(lowerDecileValue, lowerDecile, upperDecileValue, upperDecile, maxAgeInHours);
|
|
114
|
-
}
|
|
115
|
-
export function getCombinedHeaders(responseHeaders) {
|
|
116
|
-
const headers = new Map();
|
|
117
|
-
for (const header of responseHeaders) {
|
|
118
|
-
const name = header.name.toLowerCase();
|
|
119
|
-
if (headers.get(name)) {
|
|
120
|
-
headers.set(name, `${headers.get(name)}, ${header.value}`);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
headers.set(name, header.value);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return headers;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Returns whether a request contains headers that disable caching.
|
|
130
|
-
* Disabled caching is checked on the 'cache-control' and 'pragma' headers.
|
|
131
|
-
*/
|
|
132
|
-
export function cachingDisabled(headers, parsedCacheControl) {
|
|
133
|
-
const cacheControl = headers?.get('cache-control') ?? null;
|
|
134
|
-
const pragma = headers?.get('pragma') ?? null;
|
|
135
|
-
// The HTTP/1.0 Pragma header can disable caching if cache-control is not set, see https://tools.ietf.org/html/rfc7234#section-5.4
|
|
136
|
-
if (!cacheControl && pragma?.includes('no-cache')) {
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
// If we have any of these, the user intentionally doesn't want to cache.
|
|
140
|
-
if (parsedCacheControl &&
|
|
141
|
-
(parsedCacheControl['must-revalidate'] || parsedCacheControl['no-cache'] || parsedCacheControl['no-store'] ||
|
|
142
|
-
parsedCacheControl['private'])) {
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
export function isCacheInsight(model) {
|
|
148
|
-
return model.insightKey === InsightKeys.CACHE;
|
|
149
|
-
}
|
|
150
|
-
export function generateInsight(data, context) {
|
|
151
|
-
const isWithinContext = (event) => Helpers.Timing.eventIsInBounds(event, context.bounds);
|
|
152
|
-
const contextRequests = data.NetworkRequests.byTime.filter(isWithinContext);
|
|
153
|
-
const results = [];
|
|
154
|
-
let totalWastedBytes = 0;
|
|
155
|
-
const wastedBytesByRequestId = new Map();
|
|
156
|
-
for (const req of contextRequests) {
|
|
157
|
-
if (!req.args.data.responseHeaders || !isCacheable(req)) {
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
const headers = getCombinedHeaders(req.args.data.responseHeaders);
|
|
161
|
-
const cacheControl = headers.get('cache-control') ?? null;
|
|
162
|
-
const parsedDirectives = Helpers.Network.parseCacheControl(cacheControl);
|
|
163
|
-
// Skip requests that are deliberately avoiding caching.
|
|
164
|
-
if (cachingDisabled(headers, parsedDirectives)) {
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
let ttl = computeCacheLifetimeInSeconds(req.args.data.responseHeaders, parsedDirectives);
|
|
168
|
-
// Ignore if a non-positive number.
|
|
169
|
-
if (ttl !== null && (!Number.isFinite(ttl) || ttl <= 0)) {
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
ttl = ttl || 0;
|
|
173
|
-
// Ignore >= 30d.
|
|
174
|
-
const ttlDays = ttl / 86400;
|
|
175
|
-
if (ttlDays >= 30) {
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
// If cache lifetime is high enough, let's skip.
|
|
179
|
-
const cacheHitProbability = getCacheHitProbability(ttl);
|
|
180
|
-
if (cacheHitProbability > IGNORE_THRESHOLD_IN_PERCENT) {
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
const transferSize = req.args.data.encodedDataLength || 0;
|
|
184
|
-
const wastedBytes = (1 - cacheHitProbability) * transferSize;
|
|
185
|
-
wastedBytesByRequestId.set(req.args.data.requestId, wastedBytes);
|
|
186
|
-
totalWastedBytes += wastedBytes;
|
|
187
|
-
results.push({ request: req, ttl, wastedBytes });
|
|
188
|
-
}
|
|
189
|
-
// Sort by transfer size.
|
|
190
|
-
results.sort((a, b) => {
|
|
191
|
-
return b.request.args.data.decodedBodyLength - a.request.args.data.decodedBodyLength || a.ttl - b.ttl;
|
|
192
|
-
});
|
|
193
|
-
return finalize({
|
|
194
|
-
relatedEvents: results.map(r => r.request),
|
|
195
|
-
requests: results,
|
|
196
|
-
metricSavings: metricSavingsForWastedBytes(wastedBytesByRequestId, context),
|
|
197
|
-
wastedBytes: totalWastedBytes,
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
export function createOverlayForRequest(request) {
|
|
201
|
-
return {
|
|
202
|
-
type: 'ENTRY_OUTLINE',
|
|
203
|
-
entry: request,
|
|
204
|
-
outlineReason: 'ERROR',
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
export function createOverlays(model) {
|
|
208
|
-
return model.requests.map(req => createOverlayForRequest(req.request));
|
|
209
|
-
}
|
|
210
|
-
//# sourceMappingURL=Cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Cache.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;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,+BAA+B;IACtC;;OAEG;IACH,WAAW,EACP,0JAA0J;IAC9J;;OAEG;IACH,aAAa,EAAE,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,WAAW;IACrB;;OAEG;IACH,iBAAiB,EAAE,6CAA6C;IAChE;;;OAGG;IACH,MAAM,EAAE,cAAc;CACd,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,gCAAgC,EAAE,SAAS,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,UAAU,GAAwB,IAAI,CAAC,IAAI,CAAC,kBAAkB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,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;IACxG,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;QACd,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAC1C,QAAQ,EAAE,OAAO;QACjB,aAAa,EAAE,2BAA2B,CAAC,sBAAsB,EAAE,OAAO,CAAC;QAC3E,WAAW,EAAE,gBAAgB;KAC9B,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,KAAwB;IACrD,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AACzE,CAAC","sourcesContent":["// Copyright 2025 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 Protocol from '../../../generated/protocol.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 {linearInterpolation} from './Statistics.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 provides information and suggestions of resources that could improve their caching.\n */\n title: 'Use efficient cache lifetimes',\n /**\n * @description Text to tell the user about how caching can help improve performance.\n */\n description:\n 'A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).',\n /**\n * @description Column for a font loaded by the page to render text.\n */\n requestColumn: 'Request',\n /**\n * @description Column for a resource cache's Time To Live.\n */\n cacheTTL: 'Cache TTL',\n /**\n * @description Text describing that there were no requests found that need caching.\n */\n noRequestsToCache: 'No requests with inefficient cache policies',\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} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/Cache.ts', UIStrings);\nexport const i18nString: i18n.LocalizeString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type CacheInsightModel = InsightModel<typeof UIStrings, {\n requests: Array<{\n request: Types.Events.SyntheticNetworkRequest,\n ttl: number,\n wastedBytes: number,\n }>,\n}>;\n\n// Threshold for cache hits.\nconst IGNORE_THRESHOLD_IN_PERCENT = 0.925;\n\nfunction finalize(partialModel: PartialInsightModel<CacheInsightModel>): CacheInsightModel {\n return {\n insightKey: InsightKeys.CACHE,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/cache',\n category: InsightCategory.ALL,\n state: partialModel.requests.length > 0 ? 'fail' : 'pass',\n ...partialModel,\n };\n}\n\n/**\n * Determines if a request is \"cacheable\".\n * A request is \"cacheable\" if it is of the appropriate protocol and resource type\n * (see Helpers.Network.NON_NETWORK_SCHEMES and Helpers.Network.STATIC_RESOURCE_TYPE)\n * and has the appropriate statusCodes.\n */\nexport function isCacheable(request: Types.Events.SyntheticNetworkRequest): boolean {\n // Caching doesn't make sense for requests not loaded over the network.\n if (Helpers.Network.NON_NETWORK_SCHEMES.includes(request.args.data.protocol)) {\n return false;\n }\n return Boolean(\n Helpers.Network.CACHEABLE_STATUS_CODES.has(request.args.data.statusCode) &&\n Helpers.Network.STATIC_RESOURCE_TYPES.has(request.args.data.resourceType || Protocol.Network.ResourceType.Other));\n}\n\n/**\n * Returns max-age if defined, otherwise expires header if defined, and null if not.\n */\nexport function computeCacheLifetimeInSeconds(\n headers: Array<{name: string, value: string}>, cacheControl: Helpers.Network.CacheControl|null): number|null {\n if (cacheControl?.['max-age'] !== undefined) {\n return cacheControl['max-age'];\n }\n\n const expiresHeaders = headers.find(h => h.name === 'expires')?.value ?? null;\n if (expiresHeaders) {\n const expires = new Date(expiresHeaders).getTime();\n // Treat expires values as having already expired.\n if (!expires) {\n return 0;\n }\n return Math.ceil((expires - Date.now()) / 1000);\n }\n return null;\n}\n\n/**\n * Computes the percent likelihood that a return visit will be within the cache lifetime, based on\n * historical Chrome UMA stats (see RESOURCE_AGE_IN_HOURS_DECILES comment).\n *\n * This function returns values on this curve: https://www.desmos.com/calculator/eaqiszhugy (but using seconds, rather than hours)\n * See http://github.com/GoogleChrome/lighthouse/pull/3531 for history.\n */\nfunction getCacheHitProbability(maxAgeInSeconds: number): number {\n // This array contains the hand wavy distribution of the age of a resource in hours at the time of\n // cache hit at 0th, 10th, 20th, 30th, etc percentiles. This is used to compute `wastedMs` since there\n // are clearly diminishing returns to cache duration i.e. 6 months is not 2x better than 3 months.\n // Based on UMA stats for HttpCache.StaleEntry.Validated.Age. see https://www.desmos.com/calculator/jjwc5mzuwd\n // This UMA data is from 2017 but the metric isn't tracked any longer in 2025.\n const RESOURCE_AGE_IN_HOURS_DECILES = [0, 0.2, 1, 3, 8, 12, 24, 48, 72, 168, 8760, Infinity];\n\n const maxAgeInHours = maxAgeInSeconds / 3600;\n const upperDecileIndex = RESOURCE_AGE_IN_HOURS_DECILES.findIndex(decile => decile >= maxAgeInHours);\n\n // Clip the likelihood between 0 and 1\n if (upperDecileIndex === RESOURCE_AGE_IN_HOURS_DECILES.length - 1) {\n return 1;\n }\n if (upperDecileIndex === 0) {\n return 0;\n }\n\n // Use the two closest decile points as control points\n const upperDecileValue = RESOURCE_AGE_IN_HOURS_DECILES[upperDecileIndex];\n const lowerDecileValue = RESOURCE_AGE_IN_HOURS_DECILES[upperDecileIndex - 1];\n const upperDecile = upperDecileIndex / 10;\n const lowerDecile = (upperDecileIndex - 1) / 10;\n\n // Approximate the real likelihood with linear interpolation\n return linearInterpolation(lowerDecileValue, lowerDecile, upperDecileValue, upperDecile, maxAgeInHours);\n}\n\nexport function getCombinedHeaders(responseHeaders: Array<{name: string, value: string}>): Map<string, string> {\n const headers = new Map<string, string>();\n for (const header of responseHeaders) {\n const name = header.name.toLowerCase();\n if (headers.get(name)) {\n headers.set(name, `${headers.get(name)}, ${header.value}`);\n } else {\n headers.set(name, header.value);\n }\n }\n return headers;\n}\n\n/**\n * Returns whether a request contains headers that disable caching.\n * Disabled caching is checked on the 'cache-control' and 'pragma' headers.\n */\nexport function cachingDisabled(\n headers: Map<string, string>|null, parsedCacheControl: Helpers.Network.CacheControl|null): boolean {\n const cacheControl = headers?.get('cache-control') ?? null;\n const pragma = headers?.get('pragma') ?? null;\n\n // The HTTP/1.0 Pragma header can disable caching if cache-control is not set, see https://tools.ietf.org/html/rfc7234#section-5.4\n if (!cacheControl && pragma?.includes('no-cache')) {\n return true;\n }\n\n // If we have any of these, the user intentionally doesn't want to cache.\n if (parsedCacheControl &&\n (parsedCacheControl['must-revalidate'] || parsedCacheControl['no-cache'] || parsedCacheControl['no-store'] ||\n parsedCacheControl['private'])) {\n return true;\n }\n\n return false;\n}\n\nexport interface CacheableRequest {\n request: Types.Events.SyntheticNetworkRequest;\n ttl: number;\n wastedBytes: number;\n}\n\nexport function isCacheInsight(model: InsightModel): model is CacheInsightModel {\n return model.insightKey === InsightKeys.CACHE;\n}\n\nexport function generateInsight(data: Handlers.Types.HandlerData, context: InsightSetContext): CacheInsightModel {\n const isWithinContext = (event: Types.Events.Event): boolean => Helpers.Timing.eventIsInBounds(event, context.bounds);\n const contextRequests = data.NetworkRequests.byTime.filter(isWithinContext);\n\n const results: CacheableRequest[] = [];\n let totalWastedBytes = 0;\n const wastedBytesByRequestId = new Map<string, number>();\n for (const req of contextRequests) {\n if (!req.args.data.responseHeaders || !isCacheable(req)) {\n continue;\n }\n\n const headers = getCombinedHeaders(req.args.data.responseHeaders);\n const cacheControl = headers.get('cache-control') ?? null;\n const parsedDirectives = Helpers.Network.parseCacheControl(cacheControl);\n\n // Skip requests that are deliberately avoiding caching.\n if (cachingDisabled(headers, parsedDirectives)) {\n continue;\n }\n\n let ttl = computeCacheLifetimeInSeconds(req.args.data.responseHeaders, parsedDirectives);\n // Ignore if a non-positive number.\n if (ttl !== null && (!Number.isFinite(ttl) || ttl <= 0)) {\n continue;\n }\n ttl = ttl || 0;\n\n // Ignore >= 30d.\n const ttlDays = ttl / 86400;\n if (ttlDays >= 30) {\n continue;\n }\n\n // If cache lifetime is high enough, let's skip.\n const cacheHitProbability = getCacheHitProbability(ttl);\n if (cacheHitProbability > IGNORE_THRESHOLD_IN_PERCENT) {\n continue;\n }\n\n const transferSize = req.args.data.encodedDataLength || 0;\n const wastedBytes = (1 - cacheHitProbability) * transferSize;\n\n wastedBytesByRequestId.set(req.args.data.requestId, wastedBytes);\n totalWastedBytes += wastedBytes;\n\n results.push({request: req, ttl, wastedBytes});\n }\n\n // Sort by transfer size.\n results.sort((a, b) => {\n return b.request.args.data.decodedBodyLength - a.request.args.data.decodedBodyLength || a.ttl - b.ttl;\n });\n\n return finalize({\n relatedEvents: results.map(r => r.request),\n requests: results,\n metricSavings: metricSavingsForWastedBytes(wastedBytesByRequestId, context),\n wastedBytes: totalWastedBytes,\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: CacheInsightModel): Types.Overlays.Overlay[] {\n return model.requests.map(req => createOverlayForRequest(req.request));\n}\n"]}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 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 { InsightCategory, InsightKeys, InsightWarning, } from './types.js';
|
|
6
|
-
export const UIStrings = {
|
|
7
|
-
/**
|
|
8
|
-
* @description Title of an insight that checks whether the page declares a character encoding early enough.
|
|
9
|
-
*/
|
|
10
|
-
title: 'Declare a character encoding',
|
|
11
|
-
/**
|
|
12
|
-
* @description Description of an insight that checks whether the page has a proper character encoding declaration via HTTP header or early meta tag.
|
|
13
|
-
*/
|
|
14
|
-
description: 'A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).',
|
|
15
|
-
/**
|
|
16
|
-
* @description Text to tell the user that the charset is declared in the Content-Type HTTP response header.
|
|
17
|
-
*/
|
|
18
|
-
passingHttpHeader: 'Declares charset in HTTP header',
|
|
19
|
-
/**
|
|
20
|
-
* @description Text to tell the user that the charset is NOT declared in the Content-Type HTTP response header.
|
|
21
|
-
*/
|
|
22
|
-
failedHttpHeader: 'Doesn’t declare charset in HTTP header',
|
|
23
|
-
/**
|
|
24
|
-
* @description Text to tell the user that a meta charset tag was found in the first 1024 bytes of the HTML.
|
|
25
|
-
*/
|
|
26
|
-
passingMetaCharsetEarly: 'Declares charset using a meta tag in the first 1024 bytes',
|
|
27
|
-
/**
|
|
28
|
-
* @description Text to tell the user that a meta charset tag was found, but too late in the HTML.
|
|
29
|
-
*/
|
|
30
|
-
failedMetaCharsetLate: 'Declares charset using a meta tag after the first 1024 bytes',
|
|
31
|
-
/**
|
|
32
|
-
* @description Text to tell the user that no meta charset tag was found in the HTML.
|
|
33
|
-
*/
|
|
34
|
-
failedMetaCharsetMissing: 'Doesn’t declare charset using a meta tag',
|
|
35
|
-
/**
|
|
36
|
-
* @description Text to tell the user that trace data did not include the Blink signal for meta charset.
|
|
37
|
-
*/
|
|
38
|
-
failedMetaCharsetUnknown: 'Couldn’t determine meta charset declaration from trace',
|
|
39
|
-
};
|
|
40
|
-
// const str_ = i18n.i18n.registerUIStrings('models/trace/insights/CharacterSet.ts', UIStrings);
|
|
41
|
-
export const i18nString = (i18nId, values) => ({i18nId, values}); // i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
42
|
-
const CHARSET_HTTP_REGEX = /charset\s*=\s*[a-zA-Z0-9\-_:.()]{2,}/i;
|
|
43
|
-
export function isCharacterSetInsight(model) {
|
|
44
|
-
return model.insightKey === InsightKeys.CHARACTER_SET;
|
|
45
|
-
}
|
|
46
|
-
function finalize(partialModel) {
|
|
47
|
-
let hasFailure = false;
|
|
48
|
-
if (partialModel.data) {
|
|
49
|
-
hasFailure = !partialModel.data.checklist.httpCharset.value && !partialModel.data.checklist.metaCharset.value;
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
insightKey: InsightKeys.CHARACTER_SET,
|
|
53
|
-
strings: UIStrings,
|
|
54
|
-
title: i18nString(UIStrings.title),
|
|
55
|
-
description: i18nString(UIStrings.description),
|
|
56
|
-
docs: 'https://developer.chrome.com/docs/insights/charset/',
|
|
57
|
-
category: InsightCategory.ALL,
|
|
58
|
-
state: hasFailure ? 'fail' : 'pass',
|
|
59
|
-
...partialModel,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function hasCharsetInContentType(request) {
|
|
63
|
-
if (!request.args.data.responseHeaders) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
for (const header of request.args.data.responseHeaders) {
|
|
67
|
-
if (header.name.toLowerCase() === 'content-type') {
|
|
68
|
-
return CHARSET_HTTP_REGEX.test(header.value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
function findMetaCharsetDisposition(data, context) {
|
|
74
|
-
if (!context.navigation) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
return data.PageLoadMetrics.metaCharsetCheckEventsByNavigation.get(context.navigation)
|
|
78
|
-
?.at(-1)
|
|
79
|
-
?.args.data?.disposition;
|
|
80
|
-
}
|
|
81
|
-
function metaCharsetLabel(disposition) {
|
|
82
|
-
switch (disposition) {
|
|
83
|
-
case 'found-in-first-1024-bytes':
|
|
84
|
-
return i18nString(UIStrings.passingMetaCharsetEarly);
|
|
85
|
-
case 'found-after-first-1024-bytes':
|
|
86
|
-
return i18nString(UIStrings.failedMetaCharsetLate);
|
|
87
|
-
case 'not-found':
|
|
88
|
-
return i18nString(UIStrings.failedMetaCharsetMissing);
|
|
89
|
-
default:
|
|
90
|
-
return i18nString(UIStrings.failedMetaCharsetUnknown);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export function generateInsight(data, context) {
|
|
94
|
-
if (!context.navigation || !('navigationId' in context)) {
|
|
95
|
-
return finalize({});
|
|
96
|
-
}
|
|
97
|
-
const documentRequest = data.NetworkRequests.byId.get(context.navigationId);
|
|
98
|
-
if (!documentRequest) {
|
|
99
|
-
return finalize({ warnings: [InsightWarning.NO_DOCUMENT_REQUEST] });
|
|
100
|
-
}
|
|
101
|
-
const hasHttpCharset = hasCharsetInContentType(documentRequest);
|
|
102
|
-
const metaCharsetDisposition = findMetaCharsetDisposition(data, context);
|
|
103
|
-
const hasMetaCharsetInFirst1024Bytes = metaCharsetDisposition === 'found-in-first-1024-bytes';
|
|
104
|
-
return finalize({
|
|
105
|
-
relatedEvents: [documentRequest],
|
|
106
|
-
data: {
|
|
107
|
-
hasHttpCharset,
|
|
108
|
-
metaCharsetDisposition,
|
|
109
|
-
documentRequest,
|
|
110
|
-
checklist: {
|
|
111
|
-
httpCharset: {
|
|
112
|
-
label: hasHttpCharset ? i18nString(UIStrings.passingHttpHeader) : i18nString(UIStrings.failedHttpHeader),
|
|
113
|
-
value: hasHttpCharset,
|
|
114
|
-
},
|
|
115
|
-
metaCharset: {
|
|
116
|
-
label: metaCharsetLabel(metaCharsetDisposition),
|
|
117
|
-
value: hasMetaCharsetInFirst1024Bytes,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
export function createOverlays(model) {
|
|
124
|
-
if (!model.data?.documentRequest) {
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
|
-
return [{
|
|
128
|
-
type: 'ENTRY_SELECTED',
|
|
129
|
-
entry: model.data.documentRequest,
|
|
130
|
-
}];
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=CharacterSet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CharacterSet.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/CharacterSet.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAInD,OAAO,EAEL,eAAe,EACf,WAAW,EAGX,cAAc,GAEf,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,8BAA8B;IACrC;;OAEG;IACH,WAAW,EACP,iRAAiR;IACrR;;OAEG;IACH,iBAAiB,EAAE,iCAAiC;IACpD;;OAEG;IACH,gBAAgB,EAAE,wCAAwC;IAC1D;;OAEG;IACH,uBAAuB,EAAE,2DAA2D;IACpF;;OAEG;IACH,qBAAqB,EAAE,8DAA8D;IACrF;;OAEG;IACH,wBAAwB,EAAE,0CAA0C;IACpE;;OAEG;IACH,wBAAwB,EAAE,wDAAwD;CAC1E,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,uCAAuC,EAAE,SAAS,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,UAAU,GAAwB,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAElG,MAAM,kBAAkB,GAAG,uCAAuC,CAAC;AAWnE,MAAM,UAAU,qBAAqB,CAAC,KAAmB;IACvD,OAAO,KAAK,CAAC,UAAU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CAAC,eAAe,CAAC;QAChC,IAAI,EAAE;YACJ,cAAc;YACd,sBAAsB;YACtB,eAAe;YACf,SAAS,EAAE;gBACT,WAAW,EAAE;oBACX,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,gBAAgB,CAAC;oBACxG,KAAK,EAAE,cAAc;iBACtB;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,gBAAgB,CAAC,sBAAsB,CAAC;oBAC/C,KAAK,EAAE,8BAA8B;iBACtC;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAA+B;IAC5D,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,CAAC;YACN,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,eAAe;SAClC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright 2026 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 Handlers from '../handlers/handlers.js';\nimport type * as Types from '../types/types.js';\n\nimport {\n type Checklist,\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n InsightWarning,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /**\n * @description Title of an insight that checks whether the page declares a character encoding early enough.\n */\n title: 'Declare a character encoding',\n /**\n * @description Description of an insight that checks whether the page has a proper character encoding declaration via HTTP header or early meta tag.\n */\n description:\n 'A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).',\n /**\n * @description Text to tell the user that the charset is declared in the Content-Type HTTP response header.\n */\n passingHttpHeader: 'Declares charset in HTTP header',\n /**\n * @description Text to tell the user that the charset is NOT declared in the Content-Type HTTP response header.\n */\n failedHttpHeader: 'Doesn’t declare charset in HTTP header',\n /**\n * @description Text to tell the user that a meta charset tag was found in the first 1024 bytes of the HTML.\n */\n passingMetaCharsetEarly: 'Declares charset using a meta tag in the first 1024 bytes',\n /**\n * @description Text to tell the user that a meta charset tag was found, but too late in the HTML.\n */\n failedMetaCharsetLate: 'Declares charset using a meta tag after the first 1024 bytes',\n /**\n * @description Text to tell the user that no meta charset tag was found in the HTML.\n */\n failedMetaCharsetMissing: 'Doesn’t declare charset using a meta tag',\n /**\n * @description Text to tell the user that trace data did not include the Blink signal for meta charset.\n */\n failedMetaCharsetUnknown: 'Couldn’t determine meta charset declaration from trace',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/CharacterSet.ts', UIStrings);\nexport const i18nString: i18n.LocalizeString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nconst CHARSET_HTTP_REGEX = /charset\\s*=\\s*[a-zA-Z0-9\\-_:.()]{2,}/i;\n\nexport type CharacterSetInsightModel = InsightModel<typeof UIStrings, {\n data?: {\n hasHttpCharset: boolean,\n checklist: Checklist<'httpCharset'|'metaCharset'>,\n metaCharsetDisposition?: Types.Events.MetaCharsetDisposition,\n documentRequest?: Types.Events.SyntheticNetworkRequest,\n },\n}>;\n\nexport function isCharacterSetInsight(model: InsightModel): model is CharacterSetInsightModel {\n return model.insightKey === InsightKeys.CHARACTER_SET;\n}\n\nfunction finalize(partialModel: PartialInsightModel<CharacterSetInsightModel>): CharacterSetInsightModel {\n let hasFailure = false;\n if (partialModel.data) {\n hasFailure = !partialModel.data.checklist.httpCharset.value && !partialModel.data.checklist.metaCharset.value;\n }\n\n return {\n insightKey: InsightKeys.CHARACTER_SET,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/insights/charset/',\n category: InsightCategory.ALL,\n state: hasFailure ? 'fail' : 'pass',\n ...partialModel,\n };\n}\n\nfunction hasCharsetInContentType(request: Types.Events.SyntheticNetworkRequest): boolean {\n if (!request.args.data.responseHeaders) {\n return false;\n }\n for (const header of request.args.data.responseHeaders) {\n if (header.name.toLowerCase() === 'content-type') {\n return CHARSET_HTTP_REGEX.test(header.value);\n }\n }\n return false;\n}\n\nfunction findMetaCharsetDisposition(\n data: Handlers.Types.HandlerData,\n context: InsightSetContext,\n ): Types.Events.MetaCharsetDisposition|undefined {\n if (!context.navigation) {\n return undefined;\n }\n return data.PageLoadMetrics.metaCharsetCheckEventsByNavigation.get(context.navigation)\n ?.at(-1)\n ?.args.data?.disposition;\n}\n\nfunction metaCharsetLabel(disposition: Types.Events.MetaCharsetDisposition|undefined): ReturnType<typeof i18nString> {\n switch (disposition) {\n case 'found-in-first-1024-bytes':\n return i18nString(UIStrings.passingMetaCharsetEarly);\n case 'found-after-first-1024-bytes':\n return i18nString(UIStrings.failedMetaCharsetLate);\n case 'not-found':\n return i18nString(UIStrings.failedMetaCharsetMissing);\n default:\n return i18nString(UIStrings.failedMetaCharsetUnknown);\n }\n}\n\nexport function generateInsight(\n data: Handlers.Types.HandlerData, context: InsightSetContext): CharacterSetInsightModel {\n if (!context.navigation || !('navigationId' in context)) {\n return finalize({});\n }\n\n const documentRequest = data.NetworkRequests.byId.get(context.navigationId);\n if (!documentRequest) {\n return finalize({warnings: [InsightWarning.NO_DOCUMENT_REQUEST]});\n }\n\n const hasHttpCharset = hasCharsetInContentType(documentRequest);\n const metaCharsetDisposition = findMetaCharsetDisposition(data, context);\n const hasMetaCharsetInFirst1024Bytes = metaCharsetDisposition === 'found-in-first-1024-bytes';\n\n return finalize({\n relatedEvents: [documentRequest],\n data: {\n hasHttpCharset,\n metaCharsetDisposition,\n documentRequest,\n checklist: {\n httpCharset: {\n label: hasHttpCharset ? i18nString(UIStrings.passingHttpHeader) : i18nString(UIStrings.failedHttpHeader),\n value: hasHttpCharset,\n },\n metaCharset: {\n label: metaCharsetLabel(metaCharsetDisposition),\n value: hasMetaCharsetInFirst1024Bytes,\n },\n },\n },\n });\n}\n\nexport function createOverlays(model: CharacterSetInsightModel): Types.Overlays.Overlay[] {\n if (!model.data?.documentRequest) {\n return [];\n }\n\n return [{\n type: 'ENTRY_SELECTED',\n entry: model.data.documentRequest,\n }];\n}\n"]}
|