@paulirish/trace_engine 0.0.60 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +1 -1
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
- package/analyze-inspector-issues.mjs +1 -1
- package/analyze-trace.mjs +1 -2
- package/core/platform/ArrayUtilities.d.ts +2 -0
- package/core/platform/ArrayUtilities.js +11 -1
- package/core/platform/ArrayUtilities.js.map +1 -1
- package/core/platform/HostRuntime.d.ts +4 -0
- package/core/platform/HostRuntime.js +25 -0
- package/core/platform/HostRuntime.js.map +1 -0
- package/core/platform/KeyboardUtilities.d.ts +6 -2
- package/core/platform/KeyboardUtilities.js.map +1 -1
- package/core/platform/StringUtilities.d.ts +2 -0
- package/core/platform/StringUtilities.js +64 -13
- package/core/platform/StringUtilities.js.map +1 -1
- package/core/platform/api/HostRuntime.d.ts +36 -0
- package/core/platform/api/HostRuntime.js +5 -0
- package/core/platform/api/HostRuntime.js.map +1 -0
- package/core/platform/api/api-tsconfig.json +43 -0
- package/core/platform/api/api.d.ts +2 -0
- package/core/platform/api/api.js +6 -0
- package/core/platform/api/api.js.map +1 -0
- package/core/platform/api/api_node_typecheck-tsconfig.json +48 -0
- package/core/platform/api/bundle-tsconfig.json +1 -0
- package/core/platform/api/devtools_entrypoint-bundle-typescript-tsconfig.json +48 -0
- package/core/platform/browser/HostRuntime.d.ts +2 -0
- package/core/platform/browser/HostRuntime.js +64 -0
- package/core/platform/browser/HostRuntime.js.map +1 -0
- package/core/platform/browser/browser-tsconfig.json +48 -0
- package/core/platform/browser/browser.d.ts +2 -0
- package/core/platform/browser/browser.js +6 -0
- package/core/platform/browser/browser.js.map +1 -0
- package/core/platform/browser/bundle-tsconfig.json +1 -0
- package/core/platform/browser/devtools_entrypoint-bundle-typescript-tsconfig.json +48 -0
- package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/core/platform/node/HostRuntime.d.ts +2 -0
- package/core/platform/node/HostRuntime.js +73 -0
- package/core/platform/node/HostRuntime.js.map +1 -0
- package/core/platform/node/bundle-tsconfig.json +1 -0
- package/core/platform/node/devtools_entrypoint-bundle-typescript-tsconfig.json +48 -0
- package/core/platform/node/node-tsconfig.json +52 -0
- package/core/platform/node/node.d.ts +2 -0
- package/core/platform/node/node.js +6 -0
- package/core/platform/node/node.js.map +1 -0
- package/core/platform/platform-tsconfig.json +17 -5
- package/core/platform/platform.d.ts +2 -2
- package/core/platform/platform.js +2 -2
- package/core/platform/platform.js.map +1 -1
- package/core/platform/platform_node_typecheck-tsconfig.json +74 -0
- package/generated/protocol.d.ts +1517 -592
- package/locales/af.json +83 -38
- package/locales/am.json +83 -38
- package/locales/ar.json +86 -41
- package/locales/as.json +83 -38
- package/locales/az.json +83 -38
- package/locales/be.json +81 -36
- package/locales/bg.json +81 -36
- package/locales/bn.json +83 -38
- package/locales/bs.json +82 -37
- package/locales/ca.json +81 -36
- package/locales/cs.json +81 -36
- package/locales/cy.json +83 -38
- package/locales/da.json +83 -38
- package/locales/de.json +81 -36
- package/locales/el.json +82 -37
- package/locales/en-GB.json +83 -38
- package/locales/en-US.json +104 -35
- package/locales/en-XL.json +104 -35
- package/locales/es-419.json +81 -36
- package/locales/es.json +82 -37
- package/locales/et.json +83 -38
- package/locales/eu.json +81 -36
- package/locales/fa.json +84 -39
- package/locales/fi.json +81 -36
- package/locales/fil.json +83 -38
- package/locales/fr-CA.json +82 -37
- package/locales/fr.json +168 -123
- package/locales/gl.json +82 -37
- package/locales/gu.json +82 -37
- package/locales/he.json +96 -51
- package/locales/hi.json +82 -37
- package/locales/hr.json +81 -36
- package/locales/hu.json +82 -37
- package/locales/hy.json +82 -37
- package/locales/id.json +83 -38
- package/locales/is.json +82 -37
- package/locales/it.json +81 -36
- package/locales/ja.json +81 -36
- package/locales/ka.json +83 -38
- package/locales/kk.json +81 -36
- package/locales/km.json +83 -38
- package/locales/kn.json +82 -37
- package/locales/ko.json +82 -37
- package/locales/ky.json +81 -36
- package/locales/lo.json +82 -37
- package/locales/lt.json +81 -36
- package/locales/lv.json +81 -36
- package/locales/mk.json +84 -39
- package/locales/ml.json +82 -37
- package/locales/mn.json +82 -37
- package/locales/mr.json +83 -38
- package/locales/ms.json +81 -36
- package/locales/my.json +82 -37
- package/locales/ne.json +82 -37
- package/locales/nl.json +82 -37
- package/locales/no.json +81 -36
- package/locales/or.json +81 -36
- package/locales/pa.json +81 -36
- package/locales/pl.json +81 -36
- package/locales/pt-PT.json +81 -36
- package/locales/pt.json +83 -38
- package/locales/ro.json +82 -37
- package/locales/ru.json +81 -36
- package/locales/si.json +81 -36
- package/locales/sk.json +81 -36
- package/locales/sl.json +81 -36
- package/locales/sq.json +82 -37
- package/locales/sr-Latn.json +82 -37
- package/locales/sr.json +82 -37
- package/locales/sv.json +84 -39
- package/locales/sw.json +83 -38
- package/locales/ta.json +82 -37
- package/locales/te.json +82 -37
- package/locales/th.json +82 -37
- package/locales/tr.json +81 -36
- package/locales/uk.json +81 -36
- package/locales/ur.json +82 -37
- package/locales/uz.json +82 -37
- package/locales/vi.json +83 -38
- package/locales/zh-HK.json +81 -36
- package/locales/zh-TW.json +84 -39
- package/locales/zh.json +84 -39
- package/locales/zu.json +82 -37
- package/models/cpu_profile/CPUProfileDataModel.d.ts +9 -0
- package/models/cpu_profile/CPUProfileDataModel.js +9 -7
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
- package/models/cpu_profile/ProfileTreeModel.d.ts +3 -2
- package/models/cpu_profile/ProfileTreeModel.js +6 -7
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
- package/models/cpu_profile/cpu_profile-tsconfig.json +4 -3
- package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/EntityMapper.d.ts +1 -0
- package/models/trace/EntityMapper.js +10 -0
- package/models/trace/EntityMapper.js.map +1 -1
- package/models/trace/EventsSerializer.js +10 -2
- package/models/trace/EventsSerializer.js.map +1 -1
- package/models/trace/LanternComputationData.d.ts +1 -1
- package/models/trace/LanternComputationData.js +3 -8
- package/models/trace/LanternComputationData.js.map +1 -1
- package/models/trace/ModelImpl.d.ts +1 -0
- package/models/trace/ModelImpl.js +9 -6
- package/models/trace/ModelImpl.js.map +1 -1
- package/models/trace/Processor.js +23 -23
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/Styles.js +13 -5
- package/models/trace/Styles.js.map +1 -1
- package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/extras/Initiators.d.ts +12 -0
- package/models/trace/extras/Initiators.js +47 -0
- package/models/trace/extras/Initiators.js.map +1 -0
- package/models/trace/extras/TraceTree.js +13 -5
- package/models/trace/extras/TraceTree.js.map +1 -1
- package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/extras/extras-tsconfig.json +11 -3
- package/models/trace/extras/extras.d.ts +0 -3979
- package/models/trace/extras/extras.js +0 -3979
- package/models/trace/extras/extras.js.map +1 -1
- package/models/trace/handlers/LargestImagePaintHandler.js +2 -2
- package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.js +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/MetaHandler.d.ts +12 -1
- package/models/trace/handlers/MetaHandler.js +10 -1
- package/models/trace/handlers/MetaHandler.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.d.ts +8 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +22 -4
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.d.ts +13 -3
- package/models/trace/handlers/PageLoadMetricsHandler.js +71 -27
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
- package/models/trace/handlers/SamplesHandler.js +59 -6
- package/models/trace/handlers/SamplesHandler.js.map +1 -1
- package/models/trace/handlers/ScriptsHandler.js +24 -0
- package/models/trace/handlers/ScriptsHandler.js.map +1 -1
- package/models/trace/handlers/UserTimingsHandler.d.ts +1 -1
- package/models/trace/handlers/UserTimingsHandler.js +1 -1
- package/models/trace/handlers/UserTimingsHandler.js.map +1 -1
- package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/handlers/handlers-tsconfig.json +13 -3
- package/models/trace/helpers/Network.js +1 -1
- package/models/trace/helpers/Network.js.map +1 -1
- package/models/trace/helpers/SamplesIntegrator.js +1 -8
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
- package/models/trace/helpers/Timing.d.ts +1 -1
- package/models/trace/helpers/Timing.js +9 -2
- package/models/trace/helpers/Timing.js.map +1 -1
- package/models/trace/helpers/Trace.d.ts +1 -0
- package/models/trace/helpers/Trace.js +12 -5
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/helpers/helpers-tsconfig.json +7 -3
- package/models/trace/insights/CLSCulprits.d.ts +1 -1
- package/models/trace/insights/CLSCulprits.js +2 -1
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/Cache.d.ts +1 -1
- package/models/trace/insights/Cache.js +2 -1
- package/models/trace/insights/Cache.js.map +1 -1
- package/models/trace/insights/CharacterSet.d.ts +49 -0
- package/models/trace/insights/CharacterSet.js +132 -0
- package/models/trace/insights/CharacterSet.js.map +1 -0
- package/models/trace/insights/Common.d.ts +2 -2
- package/models/trace/insights/Common.js +1 -6
- package/models/trace/insights/Common.js.map +1 -1
- package/models/trace/insights/DOMSize.d.ts +1 -1
- package/models/trace/insights/DOMSize.js +2 -1
- package/models/trace/insights/DOMSize.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +1 -1
- package/models/trace/insights/DocumentLatency.js +2 -1
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/DuplicatedJavaScript.d.ts +1 -1
- package/models/trace/insights/DuplicatedJavaScript.js +2 -1
- package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
- package/models/trace/insights/FontDisplay.d.ts +1 -1
- package/models/trace/insights/FontDisplay.js +2 -1
- package/models/trace/insights/FontDisplay.js.map +1 -1
- package/models/trace/insights/ForcedReflow.d.ts +2 -2
- package/models/trace/insights/ForcedReflow.js +3 -2
- package/models/trace/insights/ForcedReflow.js.map +1 -1
- package/models/trace/insights/INPBreakdown.d.ts +1 -1
- package/models/trace/insights/INPBreakdown.js +2 -1
- package/models/trace/insights/INPBreakdown.js.map +1 -1
- package/models/trace/insights/ImageDelivery.d.ts +1 -1
- package/models/trace/insights/ImageDelivery.js +2 -1
- package/models/trace/insights/ImageDelivery.js.map +1 -1
- package/models/trace/insights/LCPBreakdown.d.ts +2 -2
- package/models/trace/insights/LCPBreakdown.js +4 -3
- package/models/trace/insights/LCPBreakdown.js.map +1 -1
- package/models/trace/insights/LCPDiscovery.d.ts +8 -4
- package/models/trace/insights/LCPDiscovery.js +18 -11
- package/models/trace/insights/LCPDiscovery.js.map +1 -1
- package/models/trace/insights/LegacyJavaScript.d.ts +1 -1
- package/models/trace/insights/LegacyJavaScript.js +2 -1
- package/models/trace/insights/LegacyJavaScript.js.map +1 -1
- package/models/trace/insights/Models.d.ts +1 -0
- package/models/trace/insights/Models.js +1 -0
- package/models/trace/insights/Models.js.map +1 -1
- package/models/trace/insights/ModernHTTP.d.ts +1 -1
- package/models/trace/insights/ModernHTTP.js +2 -1
- package/models/trace/insights/ModernHTTP.js.map +1 -1
- package/models/trace/insights/NetworkDependencyTree.d.ts +1 -1
- package/models/trace/insights/NetworkDependencyTree.js +6 -4
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
- package/models/trace/insights/RenderBlocking.d.ts +2 -2
- package/models/trace/insights/RenderBlocking.js +8 -7
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/SlowCSSSelector.d.ts +1 -1
- package/models/trace/insights/SlowCSSSelector.js +2 -1
- package/models/trace/insights/SlowCSSSelector.js.map +1 -1
- package/models/trace/insights/ThirdParties.js +2 -1
- package/models/trace/insights/ThirdParties.js.map +1 -1
- package/models/trace/insights/Viewport.d.ts +1 -1
- package/models/trace/insights/Viewport.js +2 -1
- package/models/trace/insights/Viewport.js.map +1 -1
- package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/insights/insights-tsconfig.json +26 -3
- package/models/trace/insights/types.d.ts +17 -6
- package/models/trace/insights/types.js +1 -0
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/lantern/core/core-tsconfig.json +4 -3
- package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/lantern/graph/graph-tsconfig.json +4 -3
- package/models/trace/lantern/lantern-tsconfig.json +4 -3
- package/models/trace/lantern/metrics/FirstContentfulPaint.js +6 -6
- package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -1
- package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/lantern/metrics/metrics-tsconfig.json +4 -3
- package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/lantern/simulation/simulation-tsconfig.json +4 -3
- package/models/trace/lantern/types/Lantern.d.ts +7 -7
- package/models/trace/lantern/types/Lantern.js.map +1 -1
- package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/lantern/types/types-tsconfig.json +4 -3
- package/models/trace/trace-tsconfig.json +7 -3
- package/models/trace/types/Configuration.d.ts +1 -4
- package/models/trace/types/Configuration.js +0 -1
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/File.d.ts +8 -0
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +97 -15
- package/models/trace/types/TraceEvents.js +44 -11
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +4 -3
- package/models/trace/types/types-tsconfig.json +10 -3
- package/package.json +1 -1
- package/test/test-trace-engine.mjs +8 -9
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +0 -4
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +0 -1
- package/core/platform/DOMUtilities.d.ts +0 -16
- package/core/platform/DOMUtilities.js +0 -123
- package/core/platform/DOMUtilities.js.map +0 -1
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "graph-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "lantern-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -23,8 +23,8 @@ class FirstContentfulPaint extends Metric {
|
|
|
23
23
|
const cpuNodes = [];
|
|
24
24
|
graph.traverse(node => {
|
|
25
25
|
if (node.type === Graph.BaseNode.types.CPU) {
|
|
26
|
-
// A task is *possibly* render
|
|
27
|
-
// We use startTime here because the paint event can be *inside* the task that was render
|
|
26
|
+
// A task is *possibly* render-blocking if it *started* before cutoffTimestamp.
|
|
27
|
+
// We use startTime here because the paint event can be *inside* the task that was render-blocking.
|
|
28
28
|
if (node.startTime <= cutoffTimestamp) {
|
|
29
29
|
cpuNodes.push(node);
|
|
30
30
|
}
|
|
@@ -38,14 +38,14 @@ class FirstContentfulPaint extends Metric {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
cpuNodes.sort((a, b) => a.startTime - b.startTime);
|
|
41
|
-
// A script is *possibly* render
|
|
41
|
+
// A script is *possibly* render-blocking if it finished loading before cutoffTimestamp.
|
|
42
42
|
const possiblyRenderBlockingScriptUrls = Metric.getScriptUrls(graph, node => {
|
|
43
43
|
// The optimistic LCP treatNodeAsRenderBlocking fn wants to exclude some images in the graph,
|
|
44
44
|
// but here it only receives scripts to evaluate. It's a no-op in this case, but it will
|
|
45
45
|
// matter below in the getFirstPaintBasedGraph clone operation.
|
|
46
46
|
return node.endTime <= cutoffTimestamp && treatNodeAsRenderBlocking(node);
|
|
47
47
|
});
|
|
48
|
-
// A script is *definitely not* render
|
|
48
|
+
// A script is *definitely not* render-blocking if its EvaluateScript task started after cutoffTimestamp.
|
|
49
49
|
const definitelyNotRenderBlockingScriptUrls = new Set();
|
|
50
50
|
const renderBlockingCpuNodeIds = new Set();
|
|
51
51
|
for (const url of possiblyRenderBlockingScriptUrls) {
|
|
@@ -110,7 +110,7 @@ class FirstContentfulPaint extends Metric {
|
|
|
110
110
|
if (definitelyNotRenderBlockingScriptUrls.has(url)) {
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
113
|
-
// Lastly, build up the FCP graph of all nodes we consider render
|
|
113
|
+
// Lastly, build up the FCP graph of all nodes we consider render-blocking
|
|
114
114
|
return treatNodeAsRenderBlocking(node);
|
|
115
115
|
}
|
|
116
116
|
// If it's a CPU node, just check if it was blocking.
|
|
@@ -120,7 +120,7 @@ class FirstContentfulPaint extends Metric {
|
|
|
120
120
|
static getOptimisticGraph(dependencyGraph, processedNavigation) {
|
|
121
121
|
return this.getFirstPaintBasedGraph(dependencyGraph, {
|
|
122
122
|
cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,
|
|
123
|
-
// In the optimistic graph we exclude resources that appeared to be render
|
|
123
|
+
// In the optimistic graph we exclude resources that appeared to be render-blocking but were
|
|
124
124
|
// initiated by a script. While they typically have a very high importance and tend to have a
|
|
125
125
|
// significant impact on the page's content, these resources don't technically block rendering.
|
|
126
126
|
treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority() && node.initiatorType !== 'script',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirstContentfulPaint.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAC,MAAM,EAA0B,MAAM,aAAa,CAAC;AAoB5D,MAAM,oBAAqB,SAAQ,MAAM;IACvC,MAAM,KAAc,YAAY;QAC9B,OAAO;YACL,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,GAAG;SACjB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,yBAAyB,CAC5B,KAAiB,EACjB,EAAC,eAAe,EAAE,yBAAyB,EAAE,yCAAyC,EACvD;QAEjC,iGAAiG;QACjG,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAyB,CAAC;QAE5D,MAAM,QAAQ,GAAoB,EAAE,CAAC;QACrC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;gBAC3C,+EAA+E;gBAC/E,mGAAmG;gBACnG,IAAI,IAAI,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uBAAuB,CAAC,eAAe,EAAE;YACnD,eAAe,EAAE,mBAAmB,CAAC,UAAU,CAAC,oBAAoB;YACpE,4FAA4F;YAC5F,6FAA6F;YAC7F,+FAA+F;YAC/F,yBAAyB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,IAAI,CAAC,aAAa,KAAK,QAAQ;SACvG,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAU,mBAAmB,CAC/B,eAA8B,EAAE,mBAAyD;QAC3F,OAAO,IAAI,CAAC,uBAAuB,CAAC,eAAe,EAAE;YACnD,eAAe,EAAE,mBAAmB,CAAC,UAAU,CAAC,oBAAoB;YACpE,yBAAyB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE;SACpE,CAAC,CAAC;IACL,CAAC;CACF;AAED,OAAO,EAAC,oBAAoB,EAAC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Graph from '../graph/graph.js';\nimport type * as Types from '../types/types.js';\n\nimport {Metric, type MetricCoefficients} from './Metric.js';\n\ninterface FirstPaintBasedGraphOpts<T> {\n /**\n * The timestamp used to filter out tasks that occurred after our paint of interest.\n * Typically this is First Contentful Paint or First Meaningful Paint.\n */\n cutoffTimestamp: number;\n /**\n * The function that determines which resources should be considered *possibly*\n * render-blocking.\n */\n treatNodeAsRenderBlocking: (node: Graph.NetworkNode<T>) => boolean;\n /**\n * The function that determines which CPU nodes should also be included in our\n * blocking node IDs set, beyond what getRenderBlockingNodeData() already includes.\n */\n additionalCpuNodesToTreatAsRenderBlocking?: (node: Graph.CPUNode) => boolean;\n}\n\nclass FirstContentfulPaint extends Metric {\n static override get coefficients(): MetricCoefficients {\n return {\n intercept: 0,\n optimistic: 0.5,\n pessimistic: 0.5,\n };\n }\n\n /**\n * Computes the set of URLs that *appeared* to be render-blocking based on our filter,\n * *but definitely were not* render-blocking based on the timing of their EvaluateScript task.\n * It also computes the set of corresponding CPU node ids that were needed for the paint at the\n * given timestamp.\n */\n static getRenderBlockingNodeData<T = unknown>(\n graph: Graph.Node,\n {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}:\n FirstPaintBasedGraphOpts<T>,\n ): {definitelyNotRenderBlockingScriptUrls: Set<string>, renderBlockingCpuNodeIds: Set<string>} {\n /** A map of blocking script URLs to the earliest EvaluateScript task node that executed them. */\n const scriptUrlToNodeMap = new Map<string, Graph.CPUNode>();\n\n const cpuNodes: Graph.CPUNode[] = [];\n graph.traverse(node => {\n if (node.type === Graph.BaseNode.types.CPU) {\n // A task is *possibly* render blocking if it *started* before cutoffTimestamp.\n // We use startTime here because the paint event can be *inside* the task that was render blocking.\n if (node.startTime <= cutoffTimestamp) {\n cpuNodes.push(node);\n }\n\n // Build our script URL map to find the earliest EvaluateScript task node.\n const scriptUrls = node.getEvaluateScriptURLs();\n for (const url of scriptUrls) {\n // Use the earliest CPU node we find.\n const existing = scriptUrlToNodeMap.get(url) || node;\n scriptUrlToNodeMap.set(url, node.startTime < existing.startTime ? node : existing);\n }\n }\n });\n\n cpuNodes.sort((a, b) => a.startTime - b.startTime);\n\n // A script is *possibly* render blocking if it finished loading before cutoffTimestamp.\n const possiblyRenderBlockingScriptUrls = Metric.getScriptUrls(graph, node => {\n // The optimistic LCP treatNodeAsRenderBlocking fn wants to exclude some images in the graph,\n // but here it only receives scripts to evaluate. It's a no-op in this case, but it will\n // matter below in the getFirstPaintBasedGraph clone operation.\n return node.endTime <= cutoffTimestamp && treatNodeAsRenderBlocking(node);\n });\n\n // A script is *definitely not* render blocking if its EvaluateScript task started after cutoffTimestamp.\n const definitelyNotRenderBlockingScriptUrls = new Set<string>();\n const renderBlockingCpuNodeIds = new Set<string>();\n for (const url of possiblyRenderBlockingScriptUrls) {\n // Lookup the CPU node that had the earliest EvaluateScript for this URL.\n const cpuNodeForUrl = scriptUrlToNodeMap.get(url);\n\n // If we can't find it at all, we can't conclude anything, so just skip it.\n if (!cpuNodeForUrl) {\n continue;\n }\n\n // If we found it and it was in our `cpuNodes` set that means it finished before cutoffTimestamp, so it really is render-blocking.\n if (cpuNodes.includes(cpuNodeForUrl)) {\n renderBlockingCpuNodeIds.add(cpuNodeForUrl.id);\n continue;\n }\n\n // We couldn't find the evaluate script in the set of CPU nodes that ran before our paint, so\n // it must not have been necessary for the paint.\n definitelyNotRenderBlockingScriptUrls.add(url);\n }\n\n // The first layout, first paint, and first ParseHTML are almost always necessary for first paint,\n // so we always include those CPU nodes.\n const firstLayout = cpuNodes.find(node => node.didPerformLayout());\n if (firstLayout) {\n renderBlockingCpuNodeIds.add(firstLayout.id);\n }\n const firstPaint = cpuNodes.find(node => node.childEvents.some(e => e.name === 'Paint'));\n if (firstPaint) {\n renderBlockingCpuNodeIds.add(firstPaint.id);\n }\n const firstParse = cpuNodes.find(node => node.childEvents.some(e => e.name === 'ParseHTML'));\n if (firstParse) {\n renderBlockingCpuNodeIds.add(firstParse.id);\n }\n\n // If a CPU filter was passed in, we also want to include those extra nodes.\n if (additionalCpuNodesToTreatAsRenderBlocking) {\n cpuNodes.filter(additionalCpuNodesToTreatAsRenderBlocking).forEach(node => renderBlockingCpuNodeIds.add(node.id));\n }\n\n return {\n definitelyNotRenderBlockingScriptUrls,\n renderBlockingCpuNodeIds,\n };\n }\n\n /**\n * Computes the graph required for the first paint of interest.\n */\n static getFirstPaintBasedGraph<T>(\n dependencyGraph: Graph.Node,\n {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}:\n FirstPaintBasedGraphOpts<T>,\n ): Graph.Node<T> {\n const rbData = this.getRenderBlockingNodeData(dependencyGraph, {\n cutoffTimestamp,\n treatNodeAsRenderBlocking,\n additionalCpuNodesToTreatAsRenderBlocking,\n });\n const {definitelyNotRenderBlockingScriptUrls, renderBlockingCpuNodeIds} = rbData;\n\n return dependencyGraph.cloneWithRelationships(node => {\n if (node.type === Graph.BaseNode.types.NETWORK) {\n // Exclude all nodes that ended after cutoffTimestamp (except for the main document which we always consider necessary)\n // endTime is negative if request does not finish, make sure startTime isn't after cutoffTimestamp in this case.\n const endedAfterPaint = node.endTime > cutoffTimestamp || node.startTime > cutoffTimestamp;\n if (endedAfterPaint && !node.isMainDocument()) {\n return false;\n }\n\n const url = node.request.url;\n // If the URL definitely wasn't render-blocking then we filter it out.\n if (definitelyNotRenderBlockingScriptUrls.has(url)) {\n return false;\n }\n\n // Lastly, build up the FCP graph of all nodes we consider render blocking\n return treatNodeAsRenderBlocking(node);\n }\n // If it's a CPU node, just check if it was blocking.\n return renderBlockingCpuNodeIds.has(node.id);\n });\n }\n\n static override getOptimisticGraph<T>(\n dependencyGraph: Graph.Node<T>, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node<T> {\n return this.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,\n // In the optimistic graph we exclude resources that appeared to be render blocking but were\n // initiated by a script. While they typically have a very high importance and tend to have a\n // significant impact on the page's content, these resources don't technically block rendering.\n treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority() && node.initiatorType !== 'script',\n });\n }\n\n static override getPessimisticGraph<T>(\n dependencyGraph: Graph.Node<T>, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node<T> {\n return this.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,\n treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority(),\n });\n }\n}\n\nexport {FirstContentfulPaint};\n"]}
|
|
1
|
+
{"version":3,"file":"FirstContentfulPaint.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAC,MA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,eAAe,IAAI,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;gBAC3F,IAAI,eAAe,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC9C,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;gBAC7B,sEAAsE;gBACtE,IAAI,qCAAqC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBACnD,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,0EAA0E;gBAC1E,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;YACzC,CAAC;YACD,qDAAqD;YACrD,OAAO,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAU,kBAAkB,CAC9B,eAA8B,EAAE,mBAAyD;QAC3F,OAAO,IAAI,CAAC,uBAAuB,CAAC,eAAe,EAAE;YACnD,eAAe,EAAE,mBAAmB,CAAC,UAAU,CAAC,oBAAoB;YACpE,4FAA4F;YAC5F,6FAA6F;YAC7F,+FAA+F;YAC/F,yBAAyB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,IAAI,CAAC,aAAa,KAAK,QAAQ;SACvG,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAU,mBAAmB,CAC/B,eAA8B,EAAE,mBAAyD;QAC3F,OAAO,IAAI,CAAC,uBAAuB,CAAC,eAAe,EAAE;YACnD,eAAe,EAAE,mBAAmB,CAAC,UAAU,CAAC,oBAAoB;YACpE,yBAAyB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE;SACpE,CAAC,CAAC;IACL,CAAC;CACF;AAED,OAAO,EAAC,oBAAoB,EAAC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Graph from '../graph/graph.js';\nimport type * as Types from '../types/types.js';\n\nimport {Metric, type MetricCoefficients} from './Metric.js';\n\ninterface FirstPaintBasedGraphOpts<T> {\n /**\n * The timestamp used to filter out tasks that occurred after our paint of interest.\n * Typically this is First Contentful Paint or First Meaningful Paint.\n */\n cutoffTimestamp: number;\n /**\n * The function that determines which resources should be considered *possibly*\n * render-blocking.\n */\n treatNodeAsRenderBlocking: (node: Graph.NetworkNode<T>) => boolean;\n /**\n * The function that determines which CPU nodes should also be included in our\n * blocking node IDs set, beyond what getRenderBlockingNodeData() already includes.\n */\n additionalCpuNodesToTreatAsRenderBlocking?: (node: Graph.CPUNode) => boolean;\n}\n\nclass FirstContentfulPaint extends Metric {\n static override get coefficients(): MetricCoefficients {\n return {\n intercept: 0,\n optimistic: 0.5,\n pessimistic: 0.5,\n };\n }\n\n /**\n * Computes the set of URLs that *appeared* to be render-blocking based on our filter,\n * *but definitely were not* render-blocking based on the timing of their EvaluateScript task.\n * It also computes the set of corresponding CPU node ids that were needed for the paint at the\n * given timestamp.\n */\n static getRenderBlockingNodeData<T = unknown>(\n graph: Graph.Node,\n {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}:\n FirstPaintBasedGraphOpts<T>,\n ): {definitelyNotRenderBlockingScriptUrls: Set<string>, renderBlockingCpuNodeIds: Set<string>} {\n /** A map of blocking script URLs to the earliest EvaluateScript task node that executed them. */\n const scriptUrlToNodeMap = new Map<string, Graph.CPUNode>();\n\n const cpuNodes: Graph.CPUNode[] = [];\n graph.traverse(node => {\n if (node.type === Graph.BaseNode.types.CPU) {\n // A task is *possibly* render-blocking if it *started* before cutoffTimestamp.\n // We use startTime here because the paint event can be *inside* the task that was render-blocking.\n if (node.startTime <= cutoffTimestamp) {\n cpuNodes.push(node);\n }\n\n // Build our script URL map to find the earliest EvaluateScript task node.\n const scriptUrls = node.getEvaluateScriptURLs();\n for (const url of scriptUrls) {\n // Use the earliest CPU node we find.\n const existing = scriptUrlToNodeMap.get(url) || node;\n scriptUrlToNodeMap.set(url, node.startTime < existing.startTime ? node : existing);\n }\n }\n });\n\n cpuNodes.sort((a, b) => a.startTime - b.startTime);\n\n // A script is *possibly* render-blocking if it finished loading before cutoffTimestamp.\n const possiblyRenderBlockingScriptUrls = Metric.getScriptUrls(graph, node => {\n // The optimistic LCP treatNodeAsRenderBlocking fn wants to exclude some images in the graph,\n // but here it only receives scripts to evaluate. It's a no-op in this case, but it will\n // matter below in the getFirstPaintBasedGraph clone operation.\n return node.endTime <= cutoffTimestamp && treatNodeAsRenderBlocking(node);\n });\n\n // A script is *definitely not* render-blocking if its EvaluateScript task started after cutoffTimestamp.\n const definitelyNotRenderBlockingScriptUrls = new Set<string>();\n const renderBlockingCpuNodeIds = new Set<string>();\n for (const url of possiblyRenderBlockingScriptUrls) {\n // Lookup the CPU node that had the earliest EvaluateScript for this URL.\n const cpuNodeForUrl = scriptUrlToNodeMap.get(url);\n\n // If we can't find it at all, we can't conclude anything, so just skip it.\n if (!cpuNodeForUrl) {\n continue;\n }\n\n // If we found it and it was in our `cpuNodes` set that means it finished before cutoffTimestamp, so it really is render-blocking.\n if (cpuNodes.includes(cpuNodeForUrl)) {\n renderBlockingCpuNodeIds.add(cpuNodeForUrl.id);\n continue;\n }\n\n // We couldn't find the evaluate script in the set of CPU nodes that ran before our paint, so\n // it must not have been necessary for the paint.\n definitelyNotRenderBlockingScriptUrls.add(url);\n }\n\n // The first layout, first paint, and first ParseHTML are almost always necessary for first paint,\n // so we always include those CPU nodes.\n const firstLayout = cpuNodes.find(node => node.didPerformLayout());\n if (firstLayout) {\n renderBlockingCpuNodeIds.add(firstLayout.id);\n }\n const firstPaint = cpuNodes.find(node => node.childEvents.some(e => e.name === 'Paint'));\n if (firstPaint) {\n renderBlockingCpuNodeIds.add(firstPaint.id);\n }\n const firstParse = cpuNodes.find(node => node.childEvents.some(e => e.name === 'ParseHTML'));\n if (firstParse) {\n renderBlockingCpuNodeIds.add(firstParse.id);\n }\n\n // If a CPU filter was passed in, we also want to include those extra nodes.\n if (additionalCpuNodesToTreatAsRenderBlocking) {\n cpuNodes.filter(additionalCpuNodesToTreatAsRenderBlocking).forEach(node => renderBlockingCpuNodeIds.add(node.id));\n }\n\n return {\n definitelyNotRenderBlockingScriptUrls,\n renderBlockingCpuNodeIds,\n };\n }\n\n /**\n * Computes the graph required for the first paint of interest.\n */\n static getFirstPaintBasedGraph<T>(\n dependencyGraph: Graph.Node,\n {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}:\n FirstPaintBasedGraphOpts<T>,\n ): Graph.Node<T> {\n const rbData = this.getRenderBlockingNodeData(dependencyGraph, {\n cutoffTimestamp,\n treatNodeAsRenderBlocking,\n additionalCpuNodesToTreatAsRenderBlocking,\n });\n const {definitelyNotRenderBlockingScriptUrls, renderBlockingCpuNodeIds} = rbData;\n\n return dependencyGraph.cloneWithRelationships(node => {\n if (node.type === Graph.BaseNode.types.NETWORK) {\n // Exclude all nodes that ended after cutoffTimestamp (except for the main document which we always consider necessary)\n // endTime is negative if request does not finish, make sure startTime isn't after cutoffTimestamp in this case.\n const endedAfterPaint = node.endTime > cutoffTimestamp || node.startTime > cutoffTimestamp;\n if (endedAfterPaint && !node.isMainDocument()) {\n return false;\n }\n\n const url = node.request.url;\n // If the URL definitely wasn't render-blocking then we filter it out.\n if (definitelyNotRenderBlockingScriptUrls.has(url)) {\n return false;\n }\n\n // Lastly, build up the FCP graph of all nodes we consider render-blocking\n return treatNodeAsRenderBlocking(node);\n }\n // If it's a CPU node, just check if it was blocking.\n return renderBlockingCpuNodeIds.has(node.id);\n });\n }\n\n static override getOptimisticGraph<T>(\n dependencyGraph: Graph.Node<T>, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node<T> {\n return this.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,\n // In the optimistic graph we exclude resources that appeared to be render-blocking but were\n // initiated by a script. While they typically have a very high importance and tend to have a\n // significant impact on the page's content, these resources don't technically block rendering.\n treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority() && node.initiatorType !== 'script',\n });\n }\n\n static override getPessimisticGraph<T>(\n dependencyGraph: Graph.Node<T>, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node<T> {\n return this.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,\n treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority(),\n });\n }\n}\n\nexport {FirstContentfulPaint};\n"]}
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "metrics-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "simulation-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -44,7 +44,7 @@ export interface Trace {
|
|
|
44
44
|
}
|
|
45
45
|
export type ResourcePriority = ('VeryLow' | 'Low' | 'Medium' | 'High' | 'VeryHigh');
|
|
46
46
|
export type ResourceType = keyof typeof NetworkRequestTypes;
|
|
47
|
-
type InitiatorType = ('parser' | 'script' | 'preload' | 'SignedExchange' | 'preflight' | 'other');
|
|
47
|
+
type InitiatorType = ('parser' | 'script' | 'preload' | 'SignedExchange' | 'preflight' | 'FedCM' | 'other');
|
|
48
48
|
export type ResourceTiming = Protocol.Network.ResourceTiming;
|
|
49
49
|
export interface CallStack {
|
|
50
50
|
callFrames: Array<{
|
|
@@ -100,19 +100,19 @@ export interface NetworkRequest<T = AnyNetworkObject> {
|
|
|
100
100
|
failed: boolean;
|
|
101
101
|
statusCode: number;
|
|
102
102
|
/** The network request that redirected to this one */
|
|
103
|
-
redirectSource
|
|
103
|
+
redirectSource?: NetworkRequest<T>;
|
|
104
104
|
/** The network request that this one redirected to */
|
|
105
|
-
redirectDestination
|
|
105
|
+
redirectDestination?: NetworkRequest<T>;
|
|
106
106
|
initiator: {
|
|
107
107
|
type: InitiatorType;
|
|
108
108
|
url?: string;
|
|
109
109
|
stack?: CallStack;
|
|
110
110
|
};
|
|
111
|
-
initiatorRequest
|
|
111
|
+
initiatorRequest?: NetworkRequest<T>;
|
|
112
112
|
/** The chain of network requests that redirected to this one */
|
|
113
|
-
redirects
|
|
114
|
-
timing
|
|
115
|
-
resourceType
|
|
113
|
+
redirects?: NetworkRequest[] | undefined;
|
|
114
|
+
timing?: Protocol.Network.ResourceTiming;
|
|
115
|
+
resourceType?: ResourceType;
|
|
116
116
|
mimeType: string;
|
|
117
117
|
priority: ResourcePriority;
|
|
118
118
|
frameId: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lantern.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/types/Lantern.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAI7B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,kBAAkB,EAAE,oBAAoB;IACxC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACN,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Protocol from '../../../../generated/protocol.js';\n\nexport const NetworkRequestTypes = {\n XHR: 'XHR',\n Fetch: 'Fetch',\n EventSource: 'EventSource',\n Script: 'Script',\n Stylesheet: 'Stylesheet',\n Image: 'Image',\n Media: 'Media',\n Font: 'Font',\n Document: 'Document',\n TextTrack: 'TextTrack',\n WebSocket: 'WebSocket',\n Other: 'Other',\n Manifest: 'Manifest',\n SignedExchange: 'SignedExchange',\n Ping: 'Ping',\n Preflight: 'Preflight',\n CSPViolationReport: 'CSPViolationReport',\n Prefetch: 'Prefetch',\n FedCM: 'FedCM',\n} as const;\n\nexport interface TraceEvent {\n name: string;\n args: {\n name?: string,\n data?: {\n frame?: string,\n readyState?: number,\n stackTrace?: Array<{\n url: string,\n }>,\n url?: string,\n },\n };\n pid: number;\n tid: number;\n /** Timestamp of the event in microseconds. */\n ts: number;\n dur: number;\n}\nexport interface Trace {\n traceEvents: TraceEvent[];\n}\nexport type ResourcePriority = ('VeryLow'|'Low'|'Medium'|'High'|'VeryHigh');\nexport type ResourceType = keyof typeof NetworkRequestTypes;\ntype InitiatorType = ('parser'|'script'|'preload'|'SignedExchange'|'preflight'|'other');\nexport type ResourceTiming = Protocol.Network.ResourceTiming;\nexport interface CallStack {\n callFrames: Array<{\n scriptId: string,\n url: string,\n lineNumber: number,\n columnNumber: number,\n functionName: string,\n }>;\n parent?: CallStack;\n}\n\nexport interface ParsedURL {\n /**\n * Equivalent to a `new URL(url).protocol` BUT w/o the trailing colon (:)\n */\n scheme: string;\n /**\n * Equivalent to a `new URL(url).hostname`\n */\n host: string;\n securityOrigin: string;\n}\n\n// When Lantern NetworkRequests are constructed, the source-of-truth of the network record is given as `rawRequest`.\n// Internally Lantern doesn't care about the type of this field, so a default type is given to simplify internal code\n// by avoiding unnecessary typescript overhead.\n// If callers want to access the underlying network record, they are expected to make use of this generic on top-level\n// interfaces like Simulator.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyNetworkObject = any;\n\nexport interface NetworkRequest<T = AnyNetworkObject> {\n requestId: string;\n connectionId: number;\n connectionReused: boolean;\n url: string;\n protocol: string;\n parsedURL: ParsedURL;\n documentURL: string;\n /** When the renderer process initially discovers a network request, in milliseconds. */\n rendererStartTime: number;\n /**\n * When the network service is about to handle a request, ie. just before going to the\n * HTTP cache or going to the network for DNS/connection setup, in milliseconds.\n */\n networkRequestTime: number;\n /**\n * When the last byte of the response headers is received, in milliseconds.\n * Equal to networkRequestTime if no data is received over the\n * network (ex: cached requests or data urls).\n */\n responseHeadersEndTime: number;\n /** When the last byte of the response body is received, in milliseconds. */\n networkEndTime: number;\n transferSize: number;\n resourceSize: number;\n fromDiskCache: boolean;\n fromMemoryCache: boolean;\n isLinkPreload: boolean;\n finished: boolean;\n failed: boolean;\n statusCode: number;\n /** The network request that redirected to this one */\n redirectSource
|
|
1
|
+
{"version":3,"file":"Lantern.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/types/Lantern.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAI7B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,kBAAkB,EAAE,oBAAoB;IACxC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACN,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Protocol from '../../../../generated/protocol.js';\n\nexport const NetworkRequestTypes = {\n XHR: 'XHR',\n Fetch: 'Fetch',\n EventSource: 'EventSource',\n Script: 'Script',\n Stylesheet: 'Stylesheet',\n Image: 'Image',\n Media: 'Media',\n Font: 'Font',\n Document: 'Document',\n TextTrack: 'TextTrack',\n WebSocket: 'WebSocket',\n Other: 'Other',\n Manifest: 'Manifest',\n SignedExchange: 'SignedExchange',\n Ping: 'Ping',\n Preflight: 'Preflight',\n CSPViolationReport: 'CSPViolationReport',\n Prefetch: 'Prefetch',\n FedCM: 'FedCM',\n} as const;\n\nexport interface TraceEvent {\n name: string;\n args: {\n name?: string,\n data?: {\n frame?: string,\n readyState?: number,\n stackTrace?: Array<{\n url: string,\n }>,\n url?: string,\n },\n };\n pid: number;\n tid: number;\n /** Timestamp of the event in microseconds. */\n ts: number;\n dur: number;\n}\nexport interface Trace {\n traceEvents: TraceEvent[];\n}\nexport type ResourcePriority = ('VeryLow'|'Low'|'Medium'|'High'|'VeryHigh');\nexport type ResourceType = keyof typeof NetworkRequestTypes;\ntype InitiatorType = ('parser'|'script'|'preload'|'SignedExchange'|'preflight'|'FedCM'|'other');\nexport type ResourceTiming = Protocol.Network.ResourceTiming;\nexport interface CallStack {\n callFrames: Array<{\n scriptId: string,\n url: string,\n lineNumber: number,\n columnNumber: number,\n functionName: string,\n }>;\n parent?: CallStack;\n}\n\nexport interface ParsedURL {\n /**\n * Equivalent to a `new URL(url).protocol` BUT w/o the trailing colon (:)\n */\n scheme: string;\n /**\n * Equivalent to a `new URL(url).hostname`\n */\n host: string;\n securityOrigin: string;\n}\n\n// When Lantern NetworkRequests are constructed, the source-of-truth of the network record is given as `rawRequest`.\n// Internally Lantern doesn't care about the type of this field, so a default type is given to simplify internal code\n// by avoiding unnecessary typescript overhead.\n// If callers want to access the underlying network record, they are expected to make use of this generic on top-level\n// interfaces like Simulator.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyNetworkObject = any;\n\nexport interface NetworkRequest<T = AnyNetworkObject> {\n requestId: string;\n connectionId: number;\n connectionReused: boolean;\n url: string;\n protocol: string;\n parsedURL: ParsedURL;\n documentURL: string;\n /** When the renderer process initially discovers a network request, in milliseconds. */\n rendererStartTime: number;\n /**\n * When the network service is about to handle a request, ie. just before going to the\n * HTTP cache or going to the network for DNS/connection setup, in milliseconds.\n */\n networkRequestTime: number;\n /**\n * When the last byte of the response headers is received, in milliseconds.\n * Equal to networkRequestTime if no data is received over the\n * network (ex: cached requests or data urls).\n */\n responseHeadersEndTime: number;\n /** When the last byte of the response body is received, in milliseconds. */\n networkEndTime: number;\n transferSize: number;\n resourceSize: number;\n fromDiskCache: boolean;\n fromMemoryCache: boolean;\n isLinkPreload: boolean;\n finished: boolean;\n failed: boolean;\n statusCode: number;\n /** The network request that redirected to this one */\n redirectSource?: NetworkRequest<T>;\n /** The network request that this one redirected to */\n redirectDestination?: NetworkRequest<T>;\n // TODO: can't use Protocol.Network.Initiator because of type mismatch in Lighthouse initiator.\n initiator: {\n type: InitiatorType,\n url?: string,\n stack?: CallStack,\n };\n initiatorRequest?: NetworkRequest<T>;\n /** The chain of network requests that redirected to this one */\n redirects?: NetworkRequest[]|undefined;\n timing?: Protocol.Network.ResourceTiming;\n resourceType?: ResourceType;\n mimeType: string;\n priority: ResourcePriority;\n frameId: string|undefined;\n fromWorker: boolean;\n /**\n * Optional value for how long the server took to respond to this request, in ms.\n * When not provided, the server response time is derived from the timing object.\n */\n serverResponseTime?: number;\n /**\n * Implementation-specific canonical data structure that this Lantern NetworkRequest\n * was derived from.\n * Users of Lantern create a NetworkRequest matching this interface,\n * but can store the source-of-truth for their network model in this property.\n * This is then accessible as a read-only property on NetworkNode.\n */\n rawRequest?: T;\n}\n\nexport namespace Simulation {\n export interface URL {\n /** URL of the initially requested URL */\n requestedUrl?: string;\n /** URL of the last document request */\n mainDocumentUrl?: string;\n }\n\n /** Simulation settings that control the amount of network & cpu throttling in the run. */\n export interface ThrottlingSettings {\n /** The round trip time in milliseconds. */\n rttMs?: number;\n /** The network throughput in kilobits per second. */\n throughputKbps?: number;\n // devtools settings\n /** The network request latency in milliseconds. */\n requestLatencyMs?: number;\n /** The network download throughput in kilobits per second. */\n downloadThroughputKbps?: number;\n /** The network upload throughput in kilobits per second. */\n uploadThroughputKbps?: number;\n // used by both\n /** The amount of slowdown applied to the cpu (1/<cpuSlowdownMultiplier>). */\n cpuSlowdownMultiplier?: number;\n }\n\n export interface PrecomputedLanternData {\n additionalRttByOrigin: Record<string, number>;\n serverResponseTimeByOrigin: Record<string, number>;\n }\n\n export interface Settings {\n networkAnalysis: {\n rtt: number,\n additionalRttByOrigin: Map<string, number>,\n serverResponseTimeByOrigin: Map<string, number>,\n throughput: number,\n };\n /** The method used to throttle the network. */\n throttlingMethod: 'devtools'|'simulate'|'provided';\n /** The throttling config settings. */\n throttling?: Required<ThrottlingSettings>;\n /** Precomputed lantern estimates to use instead of observed analysis. */\n precomputedLanternData?: PrecomputedLanternData|null;\n }\n\n export interface Options {\n rtt?: number;\n throughput?: number;\n observedThroughput: number;\n maximumConcurrentRequests?: number;\n cpuSlowdownMultiplier?: number;\n layoutTaskMultiplier?: number;\n additionalRttByOrigin?: Map<string, number>;\n serverResponseTimeByOrigin?: Map<string, number>;\n }\n\n export interface ProcessedNavigation {\n timestamps: {\n firstContentfulPaint: number,\n largestContentfulPaint?: number,\n };\n }\n\n export interface NodeTiming {\n startTime: number;\n endTime: number;\n duration: number;\n }\n}\n"]}
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "types-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
+
"dom",
|
|
12
|
+
"dom.iterable",
|
|
11
13
|
"ES2023",
|
|
12
14
|
"ES2024.Promise",
|
|
13
15
|
"ESNext.Iterator",
|
|
14
16
|
"ESNext.Collection",
|
|
15
|
-
"ESNext.Array"
|
|
16
|
-
"dom",
|
|
17
|
-
"dom.iterable"
|
|
17
|
+
"ESNext.Array"
|
|
18
18
|
],
|
|
19
19
|
"module": "esnext",
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"target": "ES2023",
|
|
32
32
|
"tsBuildInfoFile": "trace-tsconfig.json.tsbuildinfo",
|
|
33
33
|
"typeRoots": [],
|
|
34
|
+
"types": [],
|
|
34
35
|
"useUnknownInCatchVariables": false
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -49,6 +50,9 @@
|
|
|
49
50
|
{
|
|
50
51
|
"path": "../../core/common/bundle-tsconfig.json"
|
|
51
52
|
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../../core/i18n/bundle-tsconfig.json"
|
|
55
|
+
},
|
|
52
56
|
{
|
|
53
57
|
"path": "../../core/platform/bundle-tsconfig.json"
|
|
54
58
|
},
|
|
@@ -5,10 +5,6 @@ import type * as Lantern from '../lantern/lantern.js';
|
|
|
5
5
|
import type * as File from './File.js';
|
|
6
6
|
import type { Milli } from './Timing.js';
|
|
7
7
|
export interface Configuration {
|
|
8
|
-
/**
|
|
9
|
-
* Include V8 RCS functions in the JS stacks
|
|
10
|
-
*/
|
|
11
|
-
includeRuntimeCallStats: boolean;
|
|
12
8
|
/**
|
|
13
9
|
* Show all events: disable the default filtering which hides and excludes some events.
|
|
14
10
|
*/
|
|
@@ -49,6 +45,7 @@ export declare const defaults: () => Configuration;
|
|
|
49
45
|
*/
|
|
50
46
|
export declare function configToCacheKey(config: Configuration): string;
|
|
51
47
|
export interface ParseOptions {
|
|
48
|
+
showAllEvents?: boolean;
|
|
52
49
|
/**
|
|
53
50
|
* If the trace was just recorded on the current page, rather than an imported file.
|
|
54
51
|
* TODO(paulirish): Maybe remove. This is currently unused by the Processor and Handlers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Configuration.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;
|
|
1
|
+
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Configuration.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AA4C7B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAkB,EAAE,CAAC,CAAC;IAC5C,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,KAAK;IAChB,6BAA6B,EAAE,EAAE;IACjC,4BAA4B,EAAE,KAAK;CACpC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAqB;IACpD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC","sourcesContent":["// Copyright 2023 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 type * as Platform from '../../../core/platform/platform.js';\nimport type * as SDK from '../../../core/sdk/sdk.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport type * as Lantern from '../lantern/lantern.js';\n\nimport type * as File from './File.js';\nimport type {Milli} from './Timing.js';\n\nexport interface Configuration {\n /**\n * Show all events: disable the default filtering which hides and excludes some events.\n */\n showAllEvents: boolean;\n /**\n * Extra detail for RPP developers (eg Trace Event json in Summary, and individual JS Sample events)\n */\n debugMode: boolean;\n /**\n * How many invalidation events will be stored for a layout (or similar) event.\n * On large sites with a lot of DOM there can be thousands of invalidations\n * associated with any given event. It is not useful to show the user 1000s of\n * invalidations in the UI, but it is also expensive for us to hold onto them\n * all, and it helps prevents OOM issues when running in NodeJS\n * [https://github.com/GoogleChrome/lighthouse/issues/16111].\n * Therefore, instead, we store only the latest 20 per event. We do also store\n * the total count, so we can show that, but we'll only ever hold on to the\n * last 20 invalidations (in DESC trace order - so the latest 20 in the trace file)\n *\n * If you set this to 0, we will skip the Invalidations processing entirely.\n * 0 effectively disables the InvalidationsHandler and it will not even\n * attempt to gather or track invalidations.\n */\n maxInvalidationEventsPerEvent: number;\n /**\n * Determines if the AnimationFramesHandler should be enabled. Currently in\n * DevTools we do not use it, so we disable it by default to avoid work that\n * we do not use. If you disable it, you will still see `data.AnimationFrames`\n * from the model, but the contents will be empty.\n */\n enableAnimationsFrameHandler: boolean;\n}\n\nexport const defaults = (): Configuration => ({\n showAllEvents: false,\n debugMode: false,\n maxInvalidationEventsPerEvent: 20,\n enableAnimationsFrameHandler: false,\n});\n\n/**\n * Generates a key that can be used to represent this config in a cache. This is\n * used mainly in tests, where we want to avoid re-parsing a file if we have\n * already processed it with the same configuration.\n */\nexport function configToCacheKey(config: Configuration): string {\n return JSON.stringify(config);\n}\n\nexport interface ParseOptions {\n showAllEvents?: boolean;\n /**\n * If the trace was just recorded on the current page, rather than an imported file.\n * TODO(paulirish): Maybe remove. This is currently unused by the Processor and Handlers\n * @default false\n */\n isFreshRecording?: boolean;\n /**\n * If the trace is a CPU Profile rather than a Chrome tracing trace.\n * @default false\n */\n isCPUProfile?: boolean;\n metadata?: File.MetaData;\n resolveSourceMap?: (params: ResolveSourceMapParams) => Promise<SDK.SourceMap.SourceMap|null>;\n logger?: {\n start: (id: string) => void,\n end: (id: string) => void,\n };\n lanternSettings?: Omit<Lantern.Types.Simulation.Settings, 'networkAnalysis'>;\n /**\n * Used when an Insight needs to format a time to string as part of its\n * output. By default we use the i18n.TimeUtilities in DevTools but this\n * enables it to be overridden, which is useful if you are consuming the trace\n * engine outside of DevTools.\n */\n insightTimeFormatters?: InsightTimeFormatters;\n}\n\nexport interface InsightTimeFormatters {\n milli: (x: Milli) => string;\n}\n\nexport interface ResolveSourceMapParams {\n scriptId: string;\n scriptUrl: Platform.DevToolsPath.UrlString;\n /** The url as resolved by any sourceUrl comment. */\n sourceUrl: Platform.DevToolsPath.UrlString;\n sourceMapUrl: Platform.DevToolsPath.UrlString;\n frame: Protocol.Page.FrameId;\n /** Set only if the raw source map was found on the provided metadata. Never set for source maps from data urls. */\n cachedRawSourceMap?: SDK.SourceMap.SourceMapV3;\n}\n"]}
|
|
@@ -176,6 +176,8 @@ export interface MetaData {
|
|
|
176
176
|
cruxFieldData?: any[];
|
|
177
177
|
/** Currently only stores JS maps, not CSS. This never stores data url source maps. */
|
|
178
178
|
sourceMaps?: MetadataSourceMap[];
|
|
179
|
+
/** Currently only stores HTML and CSS resources. */
|
|
180
|
+
resources?: MetadataResource[];
|
|
179
181
|
visualTrackConfig?: PersistedTraceVisualConfig;
|
|
180
182
|
hostDPR?: number;
|
|
181
183
|
}
|
|
@@ -185,5 +187,11 @@ export interface MetadataSourceMap {
|
|
|
185
187
|
sourceMapUrl?: string;
|
|
186
188
|
sourceMap: any;
|
|
187
189
|
}
|
|
190
|
+
export interface MetadataResource {
|
|
191
|
+
url: string;
|
|
192
|
+
frame: string;
|
|
193
|
+
content: string;
|
|
194
|
+
mimeType: string;
|
|
195
|
+
}
|
|
188
196
|
export type Contents = TraceFile | Event[];
|
|
189
197
|
export declare function traceEventKeyToValues(key: SerializableKey): SerializableKeyValues;
|