@sentry/browser-utils 10.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/build/cjs/debug-build.js +6 -0
- package/build/cjs/debug-build.js.map +1 -0
- package/build/cjs/getNativeImplementation.js +51 -0
- package/build/cjs/getNativeImplementation.js.map +1 -0
- package/build/cjs/htmlTreeAsString.js +110 -0
- package/build/cjs/htmlTreeAsString.js.map +1 -0
- package/build/cjs/index.js +54 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/instrument/dom.js +137 -0
- package/build/cjs/instrument/dom.js.map +1 -0
- package/build/cjs/instrument/history.js +56 -0
- package/build/cjs/instrument/history.js.map +1 -0
- package/build/cjs/instrument/xhr.js +108 -0
- package/build/cjs/instrument/xhr.js.map +1 -0
- package/build/cjs/is.js +15 -0
- package/build/cjs/is.js.map +1 -0
- package/build/cjs/metrics/browserMetrics.js +535 -0
- package/build/cjs/metrics/browserMetrics.js.map +1 -0
- package/build/cjs/metrics/cls.js +64 -0
- package/build/cjs/metrics/cls.js.map +1 -0
- package/build/cjs/metrics/elementTiming.js +72 -0
- package/build/cjs/metrics/elementTiming.js.map +1 -0
- package/build/cjs/metrics/inp.js +170 -0
- package/build/cjs/metrics/inp.js.map +1 -0
- package/build/cjs/metrics/instrument.js +152 -0
- package/build/cjs/metrics/instrument.js.map +1 -0
- package/build/cjs/metrics/lcp.js +77 -0
- package/build/cjs/metrics/lcp.js.map +1 -0
- package/build/cjs/metrics/resourceTiming.js +44 -0
- package/build/cjs/metrics/resourceTiming.js.map +1 -0
- package/build/cjs/metrics/utils.js +137 -0
- package/build/cjs/metrics/utils.js.map +1 -0
- package/build/cjs/metrics/web-vitals/getCLS.js +46 -0
- package/build/cjs/metrics/web-vitals/getCLS.js.map +1 -0
- package/build/cjs/metrics/web-vitals/getINP.js +60 -0
- package/build/cjs/metrics/web-vitals/getINP.js.map +1 -0
- package/build/cjs/metrics/web-vitals/getLCP.js +62 -0
- package/build/cjs/metrics/web-vitals/getLCP.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/InteractionManager.js +87 -0
- package/build/cjs/metrics/web-vitals/lib/InteractionManager.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js +11 -0
- package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js +27 -0
- package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/bindReporter.js +31 -0
- package/build/cjs/metrics/web-vitals/lib/bindReporter.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js +8 -0
- package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/getActivationStart.js +11 -0
- package/build/cjs/metrics/web-vitals/lib/getActivationStart.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js +17 -0
- package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js +48 -0
- package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/globalListeners.js +18 -0
- package/build/cjs/metrics/web-vitals/lib/globalListeners.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/initMetric.js +34 -0
- package/build/cjs/metrics/web-vitals/lib/initMetric.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/initUnique.js +16 -0
- package/build/cjs/metrics/web-vitals/lib/initUnique.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/observe.js +20 -0
- package/build/cjs/metrics/web-vitals/lib/observe.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/onHidden.js +17 -0
- package/build/cjs/metrics/web-vitals/lib/onHidden.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +32 -0
- package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/runOnce.js +14 -0
- package/build/cjs/metrics/web-vitals/lib/runOnce.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/whenActivated.js +14 -0
- package/build/cjs/metrics/web-vitals/lib/whenActivated.js.map +1 -0
- package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js +24 -0
- package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -0
- package/build/cjs/metrics/web-vitals/onFCP.js +37 -0
- package/build/cjs/metrics/web-vitals/onFCP.js.map +1 -0
- package/build/cjs/metrics/web-vitals/onTTFB.js +35 -0
- package/build/cjs/metrics/web-vitals/onTTFB.js.map +1 -0
- package/build/cjs/metrics/webVitalSpans.js +199 -0
- package/build/cjs/metrics/webVitalSpans.js.map +1 -0
- package/build/cjs/networkUtils.js +70 -0
- package/build/cjs/networkUtils.js.map +1 -0
- package/build/cjs/types.js +8 -0
- package/build/cjs/types.js.map +1 -0
- package/build/esm/debug-build.js +4 -0
- package/build/esm/debug-build.js.map +1 -0
- package/build/esm/getNativeImplementation.js +46 -0
- package/build/esm/getNativeImplementation.js.map +1 -0
- package/build/esm/htmlTreeAsString.js +108 -0
- package/build/esm/htmlTreeAsString.js.map +1 -0
- package/build/esm/index.js +15 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/instrument/dom.js +134 -0
- package/build/esm/instrument/dom.js.map +1 -0
- package/build/esm/instrument/history.js +53 -0
- package/build/esm/instrument/history.js.map +1 -0
- package/build/esm/instrument/xhr.js +104 -0
- package/build/esm/instrument/xhr.js.map +1 -0
- package/build/esm/is.js +13 -0
- package/build/esm/is.js.map +1 -0
- package/build/esm/metrics/browserMetrics.js +524 -0
- package/build/esm/metrics/browserMetrics.js.map +1 -0
- package/build/esm/metrics/cls.js +61 -0
- package/build/esm/metrics/cls.js.map +1 -0
- package/build/esm/metrics/elementTiming.js +69 -0
- package/build/esm/metrics/elementTiming.js.map +1 -0
- package/build/esm/metrics/inp.js +162 -0
- package/build/esm/metrics/inp.js.map +1 -0
- package/build/esm/metrics/instrument.js +145 -0
- package/build/esm/metrics/instrument.js.map +1 -0
- package/build/esm/metrics/lcp.js +72 -0
- package/build/esm/metrics/lcp.js.map +1 -0
- package/build/esm/metrics/resourceTiming.js +42 -0
- package/build/esm/metrics/resourceTiming.js.map +1 -0
- package/build/esm/metrics/utils.js +128 -0
- package/build/esm/metrics/utils.js.map +1 -0
- package/build/esm/metrics/web-vitals/getCLS.js +43 -0
- package/build/esm/metrics/web-vitals/getCLS.js.map +1 -0
- package/build/esm/metrics/web-vitals/getINP.js +57 -0
- package/build/esm/metrics/web-vitals/getINP.js.map +1 -0
- package/build/esm/metrics/web-vitals/getLCP.js +59 -0
- package/build/esm/metrics/web-vitals/getLCP.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/InteractionManager.js +85 -0
- package/build/esm/metrics/web-vitals/lib/InteractionManager.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js +9 -0
- package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js +25 -0
- package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/bindReporter.js +29 -0
- package/build/esm/metrics/web-vitals/lib/bindReporter.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/generateUniqueID.js +6 -0
- package/build/esm/metrics/web-vitals/lib/generateUniqueID.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/getActivationStart.js +9 -0
- package/build/esm/metrics/web-vitals/lib/getActivationStart.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js +15 -0
- package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js +46 -0
- package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/globalListeners.js +15 -0
- package/build/esm/metrics/web-vitals/lib/globalListeners.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/initMetric.js +32 -0
- package/build/esm/metrics/web-vitals/lib/initMetric.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/initUnique.js +14 -0
- package/build/esm/metrics/web-vitals/lib/initUnique.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/observe.js +18 -0
- package/build/esm/metrics/web-vitals/lib/observe.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/onHidden.js +15 -0
- package/build/esm/metrics/web-vitals/lib/onHidden.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +29 -0
- package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/runOnce.js +12 -0
- package/build/esm/metrics/web-vitals/lib/runOnce.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/whenActivated.js +12 -0
- package/build/esm/metrics/web-vitals/lib/whenActivated.js.map +1 -0
- package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js +22 -0
- package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -0
- package/build/esm/metrics/web-vitals/onFCP.js +34 -0
- package/build/esm/metrics/web-vitals/onFCP.js.map +1 -0
- package/build/esm/metrics/web-vitals/onTTFB.js +32 -0
- package/build/esm/metrics/web-vitals/onTTFB.js.map +1 -0
- package/build/esm/metrics/webVitalSpans.js +191 -0
- package/build/esm/metrics/webVitalSpans.js.map +1 -0
- package/build/esm/networkUtils.js +64 -0
- package/build/esm/networkUtils.js.map +1 -0
- package/build/esm/package.json +1 -0
- package/build/esm/types.js +6 -0
- package/build/esm/types.js.map +1 -0
- package/build/types/debug-build.d.ts +7 -0
- package/build/types/debug-build.d.ts.map +1 -0
- package/build/types/getNativeImplementation.d.ts +69 -0
- package/build/types/getNativeImplementation.d.ts.map +1 -0
- package/build/types/htmlTreeAsString.d.ts +11 -0
- package/build/types/htmlTreeAsString.d.ts.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/instrument/dom.d.ts +11 -0
- package/build/types/instrument/dom.d.ts.map +1 -0
- package/build/types/instrument/history.d.ts +15 -0
- package/build/types/instrument/history.d.ts.map +1 -0
- package/build/types/instrument/xhr.d.ts +14 -0
- package/build/types/instrument/xhr.d.ts.map +1 -0
- package/build/types/is.d.ts +7 -0
- package/build/types/is.d.ts.map +1 -0
- package/build/types/metrics/browserMetrics.d.ts +116 -0
- package/build/types/metrics/browserMetrics.d.ts.map +1 -0
- package/build/types/metrics/cls.d.ts +17 -0
- package/build/types/metrics/cls.d.ts.map +1 -0
- package/build/types/metrics/elementTiming.d.ts +19 -0
- package/build/types/metrics/elementTiming.d.ts.map +1 -0
- package/build/types/metrics/inp.d.ts +35 -0
- package/build/types/metrics/inp.d.ts.map +1 -0
- package/build/types/metrics/instrument.d.ts +121 -0
- package/build/types/metrics/instrument.d.ts.map +1 -0
- package/build/types/metrics/lcp.d.ts +22 -0
- package/build/types/metrics/lcp.d.ts.map +1 -0
- package/build/types/metrics/resourceTiming.d.ts +13 -0
- package/build/types/metrics/resourceTiming.d.ts.map +1 -0
- package/build/types/metrics/utils.d.ts +73 -0
- package/build/types/metrics/utils.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/getCLS.d.ts +26 -0
- package/build/types/metrics/web-vitals/getCLS.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/getINP.d.ts +34 -0
- package/build/types/metrics/web-vitals/getINP.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/getLCP.d.ts +16 -0
- package/build/types/metrics/web-vitals/getLCP.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts +37 -0
- package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts +5 -0
- package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts +7 -0
- package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/bindReporter.d.ts +7 -0
- package/build/types/metrics/web-vitals/lib/bindReporter.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts +7 -0
- package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts +2 -0
- package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts +2 -0
- package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +5 -0
- package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/globalListeners.d.ts +11 -0
- package/build/types/metrics/web-vitals/lib/globalListeners.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/initMetric.d.ts +21 -0
- package/build/types/metrics/web-vitals/lib/initMetric.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/initUnique.d.ts +7 -0
- package/build/types/metrics/web-vitals/lib/initUnique.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/observe.d.ts +23 -0
- package/build/types/metrics/web-vitals/lib/observe.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/onHidden.d.ts +27 -0
- package/build/types/metrics/web-vitals/lib/onHidden.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +15 -0
- package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/runOnce.d.ts +2 -0
- package/build/types/metrics/web-vitals/lib/runOnce.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/whenActivated.d.ts +2 -0
- package/build/types/metrics/web-vitals/lib/whenActivated.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +6 -0
- package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/onFCP.d.ts +11 -0
- package/build/types/metrics/web-vitals/onFCP.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/onTTFB.d.ts +20 -0
- package/build/types/metrics/web-vitals/onTTFB.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/types/base.d.ts +103 -0
- package/build/types/metrics/web-vitals/types/base.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/types/cls.d.ts +58 -0
- package/build/types/metrics/web-vitals/types/cls.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/types/fcp.d.ts +47 -0
- package/build/types/metrics/web-vitals/types/fcp.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/types/inp.d.ts +150 -0
- package/build/types/metrics/web-vitals/types/inp.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/types/lcp.d.ts +74 -0
- package/build/types/metrics/web-vitals/types/lcp.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/types/ttfb.d.ts +60 -0
- package/build/types/metrics/web-vitals/types/ttfb.d.ts.map +1 -0
- package/build/types/metrics/web-vitals/types.d.ts +78 -0
- package/build/types/metrics/web-vitals/types.d.ts.map +1 -0
- package/build/types/metrics/webVitalSpans.d.ts +65 -0
- package/build/types/metrics/webVitalSpans.d.ts.map +1 -0
- package/build/types/networkUtils.d.ts +25 -0
- package/build/types/networkUtils.d.ts.map +1 -0
- package/build/types/types.d.ts +15 -0
- package/build/types/types.d.ts.map +1 -0
- package/build/types-ts3.8/debug-build.d.ts +7 -0
- package/build/types-ts3.8/getNativeImplementation.d.ts +69 -0
- package/build/types-ts3.8/htmlTreeAsString.d.ts +11 -0
- package/build/types-ts3.8/index.d.ts +15 -0
- package/build/types-ts3.8/instrument/dom.d.ts +11 -0
- package/build/types-ts3.8/instrument/history.d.ts +15 -0
- package/build/types-ts3.8/instrument/xhr.d.ts +14 -0
- package/build/types-ts3.8/is.d.ts +7 -0
- package/build/types-ts3.8/metrics/browserMetrics.d.ts +119 -0
- package/build/types-ts3.8/metrics/cls.d.ts +17 -0
- package/build/types-ts3.8/metrics/elementTiming.d.ts +19 -0
- package/build/types-ts3.8/metrics/inp.d.ts +35 -0
- package/build/types-ts3.8/metrics/instrument.d.ts +121 -0
- package/build/types-ts3.8/metrics/lcp.d.ts +22 -0
- package/build/types-ts3.8/metrics/resourceTiming.d.ts +13 -0
- package/build/types-ts3.8/metrics/utils.d.ts +73 -0
- package/build/types-ts3.8/metrics/web-vitals/getCLS.d.ts +26 -0
- package/build/types-ts3.8/metrics/web-vitals/getINP.d.ts +34 -0
- package/build/types-ts3.8/metrics/web-vitals/getLCP.d.ts +16 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/InteractionManager.d.ts +37 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/LCPEntryManager.d.ts +5 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/LayoutShiftManager.d.ts +7 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/bindReporter.d.ts +7 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/generateUniqueID.d.ts +7 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/getActivationStart.d.ts +2 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/getNavigationEntry.d.ts +2 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +5 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/globalListeners.d.ts +11 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/initMetric.d.ts +21 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/initUnique.d.ts +7 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/observe.d.ts +23 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/onHidden.d.ts +27 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +15 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/runOnce.d.ts +2 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/whenActivated.d.ts +2 -0
- package/build/types-ts3.8/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +6 -0
- package/build/types-ts3.8/metrics/web-vitals/onFCP.d.ts +11 -0
- package/build/types-ts3.8/metrics/web-vitals/onTTFB.d.ts +20 -0
- package/build/types-ts3.8/metrics/web-vitals/types/base.d.ts +106 -0
- package/build/types-ts3.8/metrics/web-vitals/types/cls.d.ts +58 -0
- package/build/types-ts3.8/metrics/web-vitals/types/fcp.d.ts +47 -0
- package/build/types-ts3.8/metrics/web-vitals/types/inp.d.ts +150 -0
- package/build/types-ts3.8/metrics/web-vitals/types/lcp.d.ts +74 -0
- package/build/types-ts3.8/metrics/web-vitals/types/ttfb.d.ts +60 -0
- package/build/types-ts3.8/metrics/web-vitals/types.d.ts +78 -0
- package/build/types-ts3.8/metrics/webVitalSpans.d.ts +65 -0
- package/build/types-ts3.8/networkUtils.d.ts +28 -0
- package/build/types-ts3.8/types.d.ts +15 -0
- package/package.json +69 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { CLSMetric, CLSMetricWithAttribution } from './cls';
|
|
2
|
+
import { FCPMetric, FCPMetricWithAttribution } from './fcp';
|
|
3
|
+
import { INPMetric, INPMetricWithAttribution } from './inp';
|
|
4
|
+
import { LCPMetric, LCPMetricWithAttribution } from './lcp';
|
|
5
|
+
import { TTFBMetric, TTFBMetricWithAttribution } from './ttfb';
|
|
6
|
+
export interface Metric {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the metric (in acronym form).
|
|
9
|
+
*/
|
|
10
|
+
name: 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';
|
|
11
|
+
/**
|
|
12
|
+
* The current value of the metric.
|
|
13
|
+
*/
|
|
14
|
+
value: number;
|
|
15
|
+
/**
|
|
16
|
+
* The rating as to whether the metric value is within the "good",
|
|
17
|
+
* "needs improvement", or "poor" thresholds of the metric.
|
|
18
|
+
*/
|
|
19
|
+
rating: 'good' | 'needs-improvement' | 'poor';
|
|
20
|
+
/**
|
|
21
|
+
* The delta between the current value and the last-reported value.
|
|
22
|
+
* On the first report, `delta` and `value` will always be the same.
|
|
23
|
+
*/
|
|
24
|
+
delta: number;
|
|
25
|
+
/**
|
|
26
|
+
* A unique ID representing this particular metric instance. This ID can
|
|
27
|
+
* be used by an analytics tool to dedupe multiple values sent for the same
|
|
28
|
+
* metric instance, or to group multiple deltas together and calculate a
|
|
29
|
+
* total. It can also be used to differentiate multiple different metric
|
|
30
|
+
* instances sent from the same page, which can happen if the page is
|
|
31
|
+
* restored from the back/forward cache (in that case new metrics object
|
|
32
|
+
* get created).
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Any performance entries relevant to the metric value calculation.
|
|
37
|
+
* The array may also be empty if the metric value was not based on any
|
|
38
|
+
* entries (e.g. a CLS value of 0 given no layout shifts).
|
|
39
|
+
*/
|
|
40
|
+
entries: PerformanceEntry[];
|
|
41
|
+
/**
|
|
42
|
+
* The type of navigation.
|
|
43
|
+
*
|
|
44
|
+
* This will be the value returned by the Navigation Timing API (or
|
|
45
|
+
* `undefined` if the browser doesn't support that API), with the following
|
|
46
|
+
* exceptions:
|
|
47
|
+
* - 'back-forward-cache': for pages that are restored from the bfcache.
|
|
48
|
+
* - 'back_forward' is renamed to 'back-forward' for consistency.
|
|
49
|
+
* - 'prerender': for pages that were prerendered.
|
|
50
|
+
* - 'restore': for pages that were discarded by the browser and then
|
|
51
|
+
* restored by the user.
|
|
52
|
+
*/
|
|
53
|
+
navigationType: 'navigate' | 'reload' | 'back-forward' | 'back-forward-cache' | 'prerender' | 'restore';
|
|
54
|
+
}
|
|
55
|
+
/** The union of supported metric types. */
|
|
56
|
+
export type MetricType = CLSMetric | FCPMetric | INPMetric | LCPMetric | TTFBMetric;
|
|
57
|
+
/** The union of supported metric attribution types. */
|
|
58
|
+
export type MetricWithAttribution = CLSMetricWithAttribution | FCPMetricWithAttribution | INPMetricWithAttribution | LCPMetricWithAttribution | TTFBMetricWithAttribution;
|
|
59
|
+
/**
|
|
60
|
+
* The thresholds of metric's "good", "needs improvement", and "poor" ratings.
|
|
61
|
+
*
|
|
62
|
+
* - Metric values up to and including [0] are rated "good"
|
|
63
|
+
* - Metric values up to and including [1] are rated "needs improvement"
|
|
64
|
+
* - Metric values above [1] are "poor"
|
|
65
|
+
*
|
|
66
|
+
* | Metric value | Rating |
|
|
67
|
+
* | --------------- | ------------------- |
|
|
68
|
+
* | ≦ [0] | "good" |
|
|
69
|
+
* | > [0] and ≦ [1] | "needs improvement" |
|
|
70
|
+
* | > [1] | "poor" |
|
|
71
|
+
*/
|
|
72
|
+
export type MetricRatingThresholds = [
|
|
73
|
+
number,
|
|
74
|
+
number
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use metric-specific function types instead, such as:
|
|
78
|
+
* `(metric: LCPMetric) => void`. If a single callback type is needed for
|
|
79
|
+
* multiple metrics, use `(metric: MetricType) => void`.
|
|
80
|
+
*/
|
|
81
|
+
export interface ReportCallback {
|
|
82
|
+
(metric: MetricType): void;
|
|
83
|
+
}
|
|
84
|
+
export interface ReportOpts {
|
|
85
|
+
reportAllChanges?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface AttributionReportOpts extends ReportOpts {
|
|
88
|
+
generateTarget?: (el: Node | null) => string | undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The loading state of the document. Note: this value is similar to
|
|
92
|
+
* `document.readyState` but it subdivides the "interactive" state into the
|
|
93
|
+
* time before and after the DOMContentLoaded event fires.
|
|
94
|
+
*
|
|
95
|
+
* State descriptions:
|
|
96
|
+
* - `loading`: the initial document response has not yet been fully downloaded
|
|
97
|
+
* and parsed. This is equivalent to the corresponding `readyState` value.
|
|
98
|
+
* - `dom-interactive`: the document has been fully loaded and parsed, but
|
|
99
|
+
* scripts may not have yet finished loading and executing.
|
|
100
|
+
* - `dom-content-loaded`: the document is fully loaded and parsed, and all
|
|
101
|
+
* scripts (except `async` scripts) have loaded and finished executing.
|
|
102
|
+
* - `complete`: the document and all of its sub-resources have finished
|
|
103
|
+
* loading. This is equivalent to the corresponding `readyState` value.
|
|
104
|
+
*/
|
|
105
|
+
export type LoadState = 'loading' | 'dom-interactive' | 'dom-content-loaded' | 'complete';
|
|
106
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LoadState, Metric } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* A CLS-specific version of the Metric object.
|
|
4
|
+
*/
|
|
5
|
+
export interface CLSMetric extends Metric {
|
|
6
|
+
name: 'CLS';
|
|
7
|
+
entries: LayoutShift[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An object containing potentially-helpful debugging information that
|
|
11
|
+
* can be sent along with the CLS value for the current page visit in order
|
|
12
|
+
* to help identify issues happening to real-users in the field.
|
|
13
|
+
*/
|
|
14
|
+
export interface CLSAttribution {
|
|
15
|
+
/**
|
|
16
|
+
* By default, a selector identifying the first element (in document order)
|
|
17
|
+
* that shifted when the single largest layout shift that contributed to the
|
|
18
|
+
* page's CLS score occurred. If the `generateTarget` configuration option
|
|
19
|
+
* was passed, then this will instead be the return value of that function,
|
|
20
|
+
* falling back to the default if that returns null or undefined.
|
|
21
|
+
*/
|
|
22
|
+
largestShiftTarget?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The time when the single largest layout shift contributing to the page's
|
|
25
|
+
* CLS score occurred.
|
|
26
|
+
*/
|
|
27
|
+
largestShiftTime?: DOMHighResTimeStamp;
|
|
28
|
+
/**
|
|
29
|
+
* The layout shift score of the single largest layout shift contributing to
|
|
30
|
+
* the page's CLS score.
|
|
31
|
+
*/
|
|
32
|
+
largestShiftValue?: number;
|
|
33
|
+
/**
|
|
34
|
+
* The `LayoutShiftEntry` representing the single largest layout shift
|
|
35
|
+
* contributing to the page's CLS score. (Useful when you need more than just
|
|
36
|
+
* `largestShiftTarget`, `largestShiftTime`, and `largestShiftValue`).
|
|
37
|
+
*/
|
|
38
|
+
largestShiftEntry?: LayoutShift;
|
|
39
|
+
/**
|
|
40
|
+
* The first element source (in document order) among the `sources` list
|
|
41
|
+
* of the `largestShiftEntry` object. (Also useful when you need more than
|
|
42
|
+
* just `largestShiftTarget`, `largestShiftTime`, and `largestShiftValue`).
|
|
43
|
+
*/
|
|
44
|
+
largestShiftSource?: LayoutShiftAttribution;
|
|
45
|
+
/**
|
|
46
|
+
* The loading state of the document at the time when the largest layout
|
|
47
|
+
* shift contribution to the page's CLS score occurred (see `LoadState`
|
|
48
|
+
* for details).
|
|
49
|
+
*/
|
|
50
|
+
loadState?: LoadState;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A CLS-specific version of the Metric object with attribution.
|
|
54
|
+
*/
|
|
55
|
+
export interface CLSMetricWithAttribution extends CLSMetric {
|
|
56
|
+
attribution: CLSAttribution;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=cls.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LoadState, Metric } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* An FCP-specific version of the Metric object.
|
|
4
|
+
*/
|
|
5
|
+
export interface FCPMetric extends Metric {
|
|
6
|
+
name: 'FCP';
|
|
7
|
+
entries: PerformancePaintTiming[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An object containing potentially-helpful debugging information that
|
|
11
|
+
* can be sent along with the FCP value for the current page visit in order
|
|
12
|
+
* to help identify issues happening to real-users in the field.
|
|
13
|
+
*/
|
|
14
|
+
export interface FCPAttribution {
|
|
15
|
+
/**
|
|
16
|
+
* The time from when the user initiates loading the page until when the
|
|
17
|
+
* browser receives the first byte of the response (a.k.a. TTFB).
|
|
18
|
+
*/
|
|
19
|
+
timeToFirstByte: number;
|
|
20
|
+
/**
|
|
21
|
+
* The delta between TTFB and the first contentful paint (FCP).
|
|
22
|
+
*/
|
|
23
|
+
firstByteToFCP: number;
|
|
24
|
+
/**
|
|
25
|
+
* The loading state of the document at the time when FCP `occurred (see
|
|
26
|
+
* `LoadState` for details). Ideally, documents can paint before they finish
|
|
27
|
+
* loading (e.g. the `loading` or `dom-interactive` phases).
|
|
28
|
+
*/
|
|
29
|
+
loadState: LoadState;
|
|
30
|
+
/**
|
|
31
|
+
* The `PerformancePaintTiming` entry corresponding to FCP.
|
|
32
|
+
*/
|
|
33
|
+
fcpEntry?: PerformancePaintTiming;
|
|
34
|
+
/**
|
|
35
|
+
* The `navigation` entry of the current page, which is useful for diagnosing
|
|
36
|
+
* general page load issues. This can be used to access `serverTiming` for example:
|
|
37
|
+
* navigationEntry?.serverTiming
|
|
38
|
+
*/
|
|
39
|
+
navigationEntry?: PerformanceNavigationTiming;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* An FCP-specific version of the Metric object with attribution.
|
|
43
|
+
*/
|
|
44
|
+
export interface FCPMetricWithAttribution extends FCPMetric {
|
|
45
|
+
attribution: FCPAttribution;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fcp.d.ts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { AttributionReportOpts, LoadState, Metric, ReportOpts } from './base';
|
|
2
|
+
export interface INPReportOpts extends ReportOpts {
|
|
3
|
+
durationThreshold?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface INPAttributionReportOpts extends AttributionReportOpts {
|
|
6
|
+
durationThreshold?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* An INP-specific version of the Metric object.
|
|
10
|
+
*/
|
|
11
|
+
export interface INPMetric extends Metric {
|
|
12
|
+
name: 'INP';
|
|
13
|
+
entries: PerformanceEventTiming[];
|
|
14
|
+
}
|
|
15
|
+
export interface INPLongestScriptSummary {
|
|
16
|
+
/**
|
|
17
|
+
* The longest Long Animation Frame script entry that intersects the INP
|
|
18
|
+
* interaction.
|
|
19
|
+
*/
|
|
20
|
+
entry: PerformanceScriptTiming;
|
|
21
|
+
/**
|
|
22
|
+
* The INP subpart where the longest script ran.
|
|
23
|
+
*/
|
|
24
|
+
subpart: 'input-delay' | 'processing-duration' | 'presentation-delay';
|
|
25
|
+
/**
|
|
26
|
+
* The amount of time the longest script intersected the INP duration.
|
|
27
|
+
*/
|
|
28
|
+
intersectingDuration: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* An object containing potentially-helpful debugging information that
|
|
32
|
+
* can be sent along with the INP value for the current page visit in order
|
|
33
|
+
* to help identify issues happening to real-users in the field.
|
|
34
|
+
*/
|
|
35
|
+
export interface INPAttribution {
|
|
36
|
+
/**
|
|
37
|
+
* By default, a selector identifying the element that the user first
|
|
38
|
+
* interacted with as part of the frame where the INP candidate interaction
|
|
39
|
+
* occurred. If this value is an empty string, that generally means the
|
|
40
|
+
* element was removed from the DOM after the interaction. If the
|
|
41
|
+
* `generateTarget` configuration option was passed, then this will instead
|
|
42
|
+
* be the return value of that function, falling back to the default if that
|
|
43
|
+
* returns null or undefined.
|
|
44
|
+
*/
|
|
45
|
+
interactionTarget: string;
|
|
46
|
+
/**
|
|
47
|
+
* The time when the user first interacted during the frame where the INP
|
|
48
|
+
* candidate interaction occurred (if more than one interaction occurred
|
|
49
|
+
* within the frame, only the first time is reported).
|
|
50
|
+
*/
|
|
51
|
+
interactionTime: DOMHighResTimeStamp;
|
|
52
|
+
/**
|
|
53
|
+
* The type of interaction, based on the event type of the `event` entry
|
|
54
|
+
* that corresponds to the interaction (i.e. the first `event` entry
|
|
55
|
+
* containing an `interactionId` dispatched in a given animation frame).
|
|
56
|
+
* For "pointerdown", "pointerup", or "click" events this will be "pointer",
|
|
57
|
+
* and for "keydown" or "keyup" events this will be "keyboard".
|
|
58
|
+
*/
|
|
59
|
+
interactionType: 'pointer' | 'keyboard';
|
|
60
|
+
/**
|
|
61
|
+
* The best-guess timestamp of the next paint after the interaction.
|
|
62
|
+
* In general, this timestamp is the same as the `startTime + duration` of
|
|
63
|
+
* the event timing entry. However, since duration values are rounded to the
|
|
64
|
+
* nearest 8ms (and can be rounded down), this value is clamped to always be
|
|
65
|
+
* reported after the processing times.
|
|
66
|
+
*/
|
|
67
|
+
nextPaintTime: DOMHighResTimeStamp;
|
|
68
|
+
/**
|
|
69
|
+
* An array of Event Timing entries that were processed within the same
|
|
70
|
+
* animation frame as the INP candidate interaction.
|
|
71
|
+
*/
|
|
72
|
+
processedEventEntries: PerformanceEventTiming[];
|
|
73
|
+
/**
|
|
74
|
+
* The time from when the user interacted with the page until when the
|
|
75
|
+
* browser was first able to start processing event listeners for that
|
|
76
|
+
* interaction. This time captures the delay before event processing can
|
|
77
|
+
* begin due to the main thread being busy with other work.
|
|
78
|
+
*/
|
|
79
|
+
inputDelay: number;
|
|
80
|
+
/**
|
|
81
|
+
* The time from when the first event listener started running in response to
|
|
82
|
+
* the user interaction until when all event listener processing has finished.
|
|
83
|
+
*/
|
|
84
|
+
processingDuration: number;
|
|
85
|
+
/**
|
|
86
|
+
* The time from when the browser finished processing all event listeners for
|
|
87
|
+
* the user interaction until the next frame is presented on the screen and
|
|
88
|
+
* visible to the user. This time includes work on the main thread (such as
|
|
89
|
+
* `requestAnimationFrame()` callbacks, `ResizeObserver` and
|
|
90
|
+
* `IntersectionObserver` callbacks, and style/layout calculation) as well
|
|
91
|
+
* as off-main-thread work (such as compositor, GPU, and raster work).
|
|
92
|
+
*/
|
|
93
|
+
presentationDelay: number;
|
|
94
|
+
/**
|
|
95
|
+
* The loading state of the document at the time when the interaction
|
|
96
|
+
* corresponding to INP occurred (see `LoadState` for details). If the
|
|
97
|
+
* interaction occurred while the document was loading and executing script
|
|
98
|
+
* (e.g. usually in the `dom-interactive` phase) it can result in long delays.
|
|
99
|
+
*/
|
|
100
|
+
loadState: LoadState;
|
|
101
|
+
/**
|
|
102
|
+
* If the browser supports the Long Animation Frame API, this array will
|
|
103
|
+
* include any `long-animation-frame` entries that intersect with the INP
|
|
104
|
+
* candidate interaction's `startTime` and the `processingEnd` time of the
|
|
105
|
+
* last event processed within that animation frame. If the browser does not
|
|
106
|
+
* support the Long Animation Frame API or no `long-animation-frame` entries
|
|
107
|
+
* are detected, this array will be empty.
|
|
108
|
+
*/
|
|
109
|
+
longAnimationFrameEntries: PerformanceLongAnimationFrameTiming[];
|
|
110
|
+
/**
|
|
111
|
+
* Summary information about the longest script entry intersecting the INP
|
|
112
|
+
* duration. Note, only script entries above 5 milliseconds are reported by
|
|
113
|
+
* the Long Animation Frame API.
|
|
114
|
+
*/
|
|
115
|
+
longestScript?: INPLongestScriptSummary;
|
|
116
|
+
/**
|
|
117
|
+
* The total duration of Long Animation Frame scripts that intersect the INP
|
|
118
|
+
* duration excluding any forced style and layout (that is included in
|
|
119
|
+
* totalStyleAndLayout). Note, this is limited to scripts > 5 milliseconds.
|
|
120
|
+
*/
|
|
121
|
+
totalScriptDuration?: number;
|
|
122
|
+
/**
|
|
123
|
+
* The total style and layout duration from any Long Animation Frames
|
|
124
|
+
* intersecting the INP interaction. This includes any end-of-frame style and
|
|
125
|
+
* layout duration + any forced style and layout duration.
|
|
126
|
+
*/
|
|
127
|
+
totalStyleAndLayoutDuration?: number;
|
|
128
|
+
/**
|
|
129
|
+
* The off main-thread presentation delay from the end of the last Long
|
|
130
|
+
* Animation Frame (where available) until the INP end point.
|
|
131
|
+
*/
|
|
132
|
+
totalPaintDuration?: number;
|
|
133
|
+
/**
|
|
134
|
+
* The total unattributed time not included in any of the previous totals.
|
|
135
|
+
* This includes scripts < 5 milliseconds and other timings not attributed
|
|
136
|
+
* by Long Animation Frame (including when a frame is < 50ms and so has no
|
|
137
|
+
* Long Animation Frame).
|
|
138
|
+
* When no Long Animation Frames are present this will be undefined, rather
|
|
139
|
+
* than everything being unattributed to make it clearer when it's expected
|
|
140
|
+
* to be small.
|
|
141
|
+
*/
|
|
142
|
+
totalUnattributedDuration?: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* An INP-specific version of the Metric object with attribution.
|
|
146
|
+
*/
|
|
147
|
+
export interface INPMetricWithAttribution extends INPMetric {
|
|
148
|
+
attribution: INPAttribution;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=inp.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Metric } from './base.js';
|
|
2
|
+
/**
|
|
3
|
+
* An LCP-specific version of the Metric object.
|
|
4
|
+
*/
|
|
5
|
+
export interface LCPMetric extends Metric {
|
|
6
|
+
name: 'LCP';
|
|
7
|
+
entries: LargestContentfulPaint[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An object containing potentially-helpful debugging information that
|
|
11
|
+
* can be sent along with the LCP value for the current page visit in order
|
|
12
|
+
* to help identify issues happening to real-users in the field.
|
|
13
|
+
*/
|
|
14
|
+
export interface LCPAttribution {
|
|
15
|
+
/**
|
|
16
|
+
* By default, a selector identifying the element corresponding to the
|
|
17
|
+
* largest contentful paint for the page. If the `generateTarget`
|
|
18
|
+
* configuration option was passed, then this will instead be the return
|
|
19
|
+
* value of that function, falling back to the default if that returns null
|
|
20
|
+
* or undefined.
|
|
21
|
+
*/
|
|
22
|
+
target?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The URL (if applicable) of the LCP image resource. If the LCP element
|
|
25
|
+
* is a text node, this value will not be set.
|
|
26
|
+
*/
|
|
27
|
+
url?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The time from when the user initiates loading the page until when the
|
|
30
|
+
* browser receives the first byte of the response (a.k.a. TTFB). See
|
|
31
|
+
* [Optimize LCP](https://web.dev/articles/optimize-lcp) for details.
|
|
32
|
+
*/
|
|
33
|
+
timeToFirstByte: number;
|
|
34
|
+
/**
|
|
35
|
+
* The delta between TTFB and when the browser starts loading the LCP
|
|
36
|
+
* resource (if there is one, otherwise 0). See [Optimize
|
|
37
|
+
* LCP](https://web.dev/articles/optimize-lcp) for details.
|
|
38
|
+
*/
|
|
39
|
+
resourceLoadDelay: number;
|
|
40
|
+
/**
|
|
41
|
+
* The total time it takes to load the LCP resource itself (if there is one,
|
|
42
|
+
* otherwise 0). See [Optimize LCP](https://web.dev/articles/optimize-lcp) for
|
|
43
|
+
* details.
|
|
44
|
+
*/
|
|
45
|
+
resourceLoadDuration: number;
|
|
46
|
+
/**
|
|
47
|
+
* The delta between when the LCP resource finishes loading until the LCP
|
|
48
|
+
* element is fully rendered. See [Optimize
|
|
49
|
+
* LCP](https://web.dev/articles/optimize-lcp) for details.
|
|
50
|
+
*/
|
|
51
|
+
elementRenderDelay: number;
|
|
52
|
+
/**
|
|
53
|
+
* The `navigation` entry of the current page, which is useful for diagnosing
|
|
54
|
+
* general page load issues. This can be used to access `serverTiming` for example:
|
|
55
|
+
* navigationEntry?.serverTiming
|
|
56
|
+
*/
|
|
57
|
+
navigationEntry?: PerformanceNavigationTiming;
|
|
58
|
+
/**
|
|
59
|
+
* The `resource` entry for the LCP resource (if applicable), which is useful
|
|
60
|
+
* for diagnosing resource load issues.
|
|
61
|
+
*/
|
|
62
|
+
lcpResourceEntry?: PerformanceResourceTiming;
|
|
63
|
+
/**
|
|
64
|
+
* The `LargestContentfulPaint` entry corresponding to LCP.
|
|
65
|
+
*/
|
|
66
|
+
lcpEntry?: LargestContentfulPaint;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An LCP-specific version of the Metric object with attribution.
|
|
70
|
+
*/
|
|
71
|
+
export interface LCPMetricWithAttribution extends LCPMetric {
|
|
72
|
+
attribution: LCPAttribution;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=lcp.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Metric } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* A TTFB-specific version of the Metric object.
|
|
4
|
+
*/
|
|
5
|
+
export interface TTFBMetric extends Metric {
|
|
6
|
+
name: 'TTFB';
|
|
7
|
+
entries: PerformanceNavigationTiming[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An object containing potentially-helpful debugging information that
|
|
11
|
+
* can be sent along with the TTFB value for the current page visit in order
|
|
12
|
+
* to help identify issues happening to real-users in the field.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: these values are primarily useful for page loads not handled via
|
|
15
|
+
* service worker, as browsers differ in what they report when service worker
|
|
16
|
+
* is involved, see: https://github.com/w3c/navigation-timing/issues/199
|
|
17
|
+
*/
|
|
18
|
+
export interface TTFBAttribution {
|
|
19
|
+
/**
|
|
20
|
+
* The total time from when the user initiates loading the page to when the
|
|
21
|
+
* page starts to handle the request. Large values here are typically due
|
|
22
|
+
* to HTTP redirects, though other browser processing contributes to this
|
|
23
|
+
* duration as well (so even without redirect it's generally not zero).
|
|
24
|
+
*/
|
|
25
|
+
waitingDuration: number;
|
|
26
|
+
/**
|
|
27
|
+
* The total time spent checking the HTTP cache for a match. For navigations
|
|
28
|
+
* handled via service worker, this duration usually includes service worker
|
|
29
|
+
* start-up time as well as time processing `fetch` event listeners, with
|
|
30
|
+
* some exceptions, see: https://github.com/w3c/navigation-timing/issues/199
|
|
31
|
+
*/
|
|
32
|
+
cacheDuration: number;
|
|
33
|
+
/**
|
|
34
|
+
* The total time to resolve the DNS for the requested domain.
|
|
35
|
+
*/
|
|
36
|
+
dnsDuration: number;
|
|
37
|
+
/**
|
|
38
|
+
* The total time to create the connection to the requested domain.
|
|
39
|
+
*/
|
|
40
|
+
connectionDuration: number;
|
|
41
|
+
/**
|
|
42
|
+
* The total time from when the request was sent until the first byte of the
|
|
43
|
+
* response was received. This includes network time as well as server
|
|
44
|
+
* processing time.
|
|
45
|
+
*/
|
|
46
|
+
requestDuration: number;
|
|
47
|
+
/**
|
|
48
|
+
* The `navigation` entry of the current page, which is useful for diagnosing
|
|
49
|
+
* general page load issues. This can be used to access `serverTiming` for
|
|
50
|
+
* example: navigationEntry?.serverTiming
|
|
51
|
+
*/
|
|
52
|
+
navigationEntry?: PerformanceNavigationTiming;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A TTFB-specific version of the Metric object with attribution.
|
|
56
|
+
*/
|
|
57
|
+
export interface TTFBMetricWithAttribution extends TTFBMetric {
|
|
58
|
+
attribution: TTFBAttribution;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ttfb.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export * from './types/base';
|
|
2
|
+
export * from './types/cls';
|
|
3
|
+
export * from './types/fcp';
|
|
4
|
+
export * from './types/inp';
|
|
5
|
+
export * from './types/lcp';
|
|
6
|
+
export * from './types/ttfb';
|
|
7
|
+
interface PerformanceEntryMap {
|
|
8
|
+
navigation: PerformanceNavigationTiming;
|
|
9
|
+
resource: PerformanceResourceTiming;
|
|
10
|
+
paint: PerformancePaintTiming;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface Document {
|
|
14
|
+
prerendering?: boolean;
|
|
15
|
+
wasDiscarded?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface Performance {
|
|
18
|
+
getEntriesByType<K extends keyof PerformanceEntryMap>(type: K): PerformanceEntryMap[K][];
|
|
19
|
+
}
|
|
20
|
+
interface PerformanceObserverInit {
|
|
21
|
+
durationThreshold?: number;
|
|
22
|
+
}
|
|
23
|
+
interface PerformanceNavigationTiming {
|
|
24
|
+
activationStart?: number;
|
|
25
|
+
}
|
|
26
|
+
interface PerformanceEventTiming extends PerformanceEntry {
|
|
27
|
+
duration: DOMHighResTimeStamp;
|
|
28
|
+
interactionId: number;
|
|
29
|
+
}
|
|
30
|
+
interface LayoutShiftAttribution {
|
|
31
|
+
node: Node | null;
|
|
32
|
+
previousRect: DOMRectReadOnly;
|
|
33
|
+
currentRect: DOMRectReadOnly;
|
|
34
|
+
}
|
|
35
|
+
interface LayoutShift extends PerformanceEntry {
|
|
36
|
+
value: number;
|
|
37
|
+
sources: LayoutShiftAttribution[];
|
|
38
|
+
hadRecentInput: boolean;
|
|
39
|
+
}
|
|
40
|
+
interface LargestContentfulPaint extends PerformanceEntry {
|
|
41
|
+
readonly renderTime: DOMHighResTimeStamp;
|
|
42
|
+
readonly loadTime: DOMHighResTimeStamp;
|
|
43
|
+
readonly size: number;
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly url: string;
|
|
46
|
+
readonly element: Element | null;
|
|
47
|
+
}
|
|
48
|
+
export type ScriptInvokerType = 'classic-script' | 'module-script' | 'event-listener' | 'user-callback' | 'resolve-promise' | 'reject-promise';
|
|
49
|
+
export type ScriptWindowAttribution = 'self' | 'descendant' | 'ancestor' | 'same-page' | 'other';
|
|
50
|
+
interface PerformanceScriptTiming extends PerformanceEntry {
|
|
51
|
+
readonly startTime: DOMHighResTimeStamp;
|
|
52
|
+
readonly duration: DOMHighResTimeStamp;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly entryType: string;
|
|
55
|
+
readonly invokerType: ScriptInvokerType;
|
|
56
|
+
readonly invoker: string;
|
|
57
|
+
readonly executionStart: DOMHighResTimeStamp;
|
|
58
|
+
readonly sourceURL: string;
|
|
59
|
+
readonly sourceFunctionName: string;
|
|
60
|
+
readonly sourceCharPosition: number;
|
|
61
|
+
readonly pauseDuration: DOMHighResTimeStamp;
|
|
62
|
+
readonly forcedStyleAndLayoutDuration: DOMHighResTimeStamp;
|
|
63
|
+
readonly window?: Window;
|
|
64
|
+
readonly windowAttribution: ScriptWindowAttribution;
|
|
65
|
+
}
|
|
66
|
+
interface PerformanceLongAnimationFrameTiming extends PerformanceEntry {
|
|
67
|
+
readonly startTime: DOMHighResTimeStamp;
|
|
68
|
+
readonly duration: DOMHighResTimeStamp;
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly entryType: string;
|
|
71
|
+
readonly renderStart: DOMHighResTimeStamp;
|
|
72
|
+
readonly styleAndLayoutStart: DOMHighResTimeStamp;
|
|
73
|
+
readonly blockingDuration: DOMHighResTimeStamp;
|
|
74
|
+
readonly firstUIEventTimestamp: DOMHighResTimeStamp;
|
|
75
|
+
readonly scripts: PerformanceScriptTiming[];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Client, Span, SpanAttributes } from '@sentry/core';
|
|
2
|
+
import { WebVitalReportEvent } from './utils';
|
|
3
|
+
import { PerformanceEventTiming } from './instrument';
|
|
4
|
+
export interface LayoutShift extends PerformanceEntry {
|
|
5
|
+
value: number;
|
|
6
|
+
sources: Array<{
|
|
7
|
+
node: Node | null;
|
|
8
|
+
}>;
|
|
9
|
+
hadRecentInput: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface LargestContentfulPaint extends PerformanceEntry {
|
|
12
|
+
readonly renderTime: DOMHighResTimeStamp;
|
|
13
|
+
readonly loadTime: DOMHighResTimeStamp;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly url: string;
|
|
17
|
+
readonly element: Element | null;
|
|
18
|
+
}
|
|
19
|
+
interface WebVitalSpanOptions {
|
|
20
|
+
name: string;
|
|
21
|
+
op: string;
|
|
22
|
+
origin: string;
|
|
23
|
+
metricName: 'lcp' | 'cls' | 'inp';
|
|
24
|
+
value: number;
|
|
25
|
+
attributes?: SpanAttributes;
|
|
26
|
+
parentSpan?: Span;
|
|
27
|
+
reportEvent?: WebVitalReportEvent;
|
|
28
|
+
startTime: number;
|
|
29
|
+
endTime?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Emits a web vital span that flows through the span streaming pipeline.
|
|
33
|
+
*/
|
|
34
|
+
export declare function _emitWebVitalSpan(options: WebVitalSpanOptions): void;
|
|
35
|
+
/**
|
|
36
|
+
* Tracks LCP as a streamed span.
|
|
37
|
+
*/
|
|
38
|
+
export declare function trackLcpAsSpan(client: Client): void;
|
|
39
|
+
/**
|
|
40
|
+
* Exported only for testing.
|
|
41
|
+
*/
|
|
42
|
+
export declare function _sendLcpSpan(lcpValue: number, entry: LargestContentfulPaint | undefined, pageloadSpan?: Span, reportEvent?: WebVitalReportEvent): void;
|
|
43
|
+
/**
|
|
44
|
+
* Tracks CLS as a streamed span.
|
|
45
|
+
*/
|
|
46
|
+
export declare function trackClsAsSpan(client: Client): void;
|
|
47
|
+
/**
|
|
48
|
+
* Exported only for testing.
|
|
49
|
+
*/
|
|
50
|
+
export declare function _sendClsSpan(clsValue: number, entry: LayoutShift | undefined, pageloadSpan?: Span, reportEvent?: WebVitalReportEvent): void;
|
|
51
|
+
/**
|
|
52
|
+
* Tracks INP as a streamed span.
|
|
53
|
+
*
|
|
54
|
+
* This mirrors the standalone INP tracking logic (`startTrackingINP`) but emits
|
|
55
|
+
* spans through the streaming pipeline instead of as standalone spans.
|
|
56
|
+
* Requires `registerInpInteractionListener()` to be called separately for
|
|
57
|
+
* cached element names and root spans per interaction.
|
|
58
|
+
*/
|
|
59
|
+
export declare function trackInpAsSpan(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Exported only for testing.
|
|
62
|
+
*/
|
|
63
|
+
export declare function _sendInpSpan(inpValue: number, entry: PerformanceEventTiming): void;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=webVitalSpans.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { debug } from '@sentry/core';
|
|
2
|
+
import { NetworkMetaWarning } from './types';
|
|
3
|
+
export declare const ORIGINAL_REQ_BODY: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Serializes FormData.
|
|
6
|
+
*
|
|
7
|
+
* This is a bit simplified, but gives us a decent estimate.
|
|
8
|
+
* This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare function serializeFormData(formData: FormData): string;
|
|
12
|
+
/** Get the string representation of a body. */
|
|
13
|
+
export declare function getBodyString(body: unknown, _debug?: typeof debug): [
|
|
14
|
+
string | undefined,
|
|
15
|
+
NetworkMetaWarning?
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Parses the fetch arguments to extract the request payload.
|
|
19
|
+
*
|
|
20
|
+
* In case of a Request object, this function attempts to retrieve the original body by looking for a Sentry-patched symbol.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getFetchRequestArgBody(fetchArgs?: unknown[]): RequestInit['body'] | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Parses XMLHttpRequest response headers into a Record.
|
|
25
|
+
* Extracted from replay internals to be reusable.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseXhrResponseHeaders(xhr: XMLHttpRequest): Record<string, string>;
|
|
28
|
+
//# sourceMappingURL=networkUtils.d.ts.map
|