@sentry/browser-utils 10.69.0 → 11.0.0-alpha.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.
Files changed (144) hide show
  1. package/build/cjs/htmlTreeAsString.js.map +1 -1
  2. package/build/cjs/index.js +2 -1
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/metrics/browserMetrics.js +25 -91
  5. package/build/cjs/metrics/browserMetrics.js.map +1 -1
  6. package/build/cjs/metrics/inp.js +0 -57
  7. package/build/cjs/metrics/inp.js.map +1 -1
  8. package/build/cjs/metrics/lcp.js +0 -67
  9. package/build/cjs/metrics/lcp.js.map +1 -1
  10. package/build/cjs/metrics/userTiming.js +118 -0
  11. package/build/cjs/metrics/userTiming.js.map +1 -0
  12. package/build/cjs/metrics/utils.js +0 -43
  13. package/build/cjs/metrics/utils.js.map +1 -1
  14. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js +2 -6
  15. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -1
  16. package/build/cjs/metrics/web-vitals/lib/initUnique.js +1 -1
  17. package/build/cjs/metrics/web-vitals/lib/initUnique.js.map +1 -1
  18. package/build/cjs/metrics/web-vitals/lib/onHidden.js +3 -4
  19. package/build/cjs/metrics/web-vitals/lib/onHidden.js.map +1 -1
  20. package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -1
  21. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -2
  22. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -1
  23. package/build/cjs/metrics/webVitalSpans.js +25 -9
  24. package/build/cjs/metrics/webVitalSpans.js.map +1 -1
  25. package/build/esm/htmlTreeAsString.js.map +1 -1
  26. package/build/esm/index.js +2 -1
  27. package/build/esm/index.js.map +1 -1
  28. package/build/esm/metrics/browserMetrics.js +29 -94
  29. package/build/esm/metrics/browserMetrics.js.map +1 -1
  30. package/build/esm/metrics/inp.js +3 -57
  31. package/build/esm/metrics/inp.js.map +1 -1
  32. package/build/esm/metrics/lcp.js +1 -66
  33. package/build/esm/metrics/lcp.js.map +1 -1
  34. package/build/esm/metrics/userTiming.js +115 -0
  35. package/build/esm/metrics/userTiming.js.map +1 -0
  36. package/build/esm/metrics/utils.js +2 -44
  37. package/build/esm/metrics/utils.js.map +1 -1
  38. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js +2 -6
  39. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -1
  40. package/build/esm/metrics/web-vitals/lib/initUnique.js +1 -1
  41. package/build/esm/metrics/web-vitals/lib/initUnique.js.map +1 -1
  42. package/build/esm/metrics/web-vitals/lib/onHidden.js +3 -4
  43. package/build/esm/metrics/web-vitals/lib/onHidden.js.map +1 -1
  44. package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -1
  45. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -2
  46. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -1
  47. package/build/esm/metrics/webVitalSpans.js +26 -10
  48. package/build/esm/metrics/webVitalSpans.js.map +1 -1
  49. package/build/esm/package.json +1 -1
  50. package/build/types/index.d.ts +2 -1
  51. package/build/types/index.d.ts.map +1 -1
  52. package/build/types/metrics/browserMetrics.d.ts +5 -29
  53. package/build/types/metrics/browserMetrics.d.ts.map +1 -1
  54. package/build/types/metrics/inp.d.ts +0 -13
  55. package/build/types/metrics/inp.d.ts.map +1 -1
  56. package/build/types/metrics/lcp.d.ts +0 -16
  57. package/build/types/metrics/lcp.d.ts.map +1 -1
  58. package/build/types/metrics/userTiming.d.ts +37 -0
  59. package/build/types/metrics/userTiming.d.ts.map +1 -0
  60. package/build/types/metrics/utils.d.ts +1 -25
  61. package/build/types/metrics/utils.d.ts.map +1 -1
  62. package/build/types/metrics/web-vitals/getCLS.d.ts.map +1 -1
  63. package/build/types/metrics/web-vitals/getINP.d.ts.map +1 -1
  64. package/build/types/metrics/web-vitals/getLCP.d.ts.map +1 -1
  65. package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts.map +1 -1
  66. package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts.map +1 -1
  67. package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts.map +1 -1
  68. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts +1 -1
  69. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts.map +1 -1
  70. package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts.map +1 -1
  71. package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts.map +1 -1
  72. package/build/types/metrics/web-vitals/lib/initMetric.d.ts +3 -3
  73. package/build/types/metrics/web-vitals/lib/initMetric.d.ts.map +1 -1
  74. package/build/types/metrics/web-vitals/lib/observe.d.ts.map +1 -1
  75. package/build/types/metrics/web-vitals/lib/onHidden.d.ts +4 -16
  76. package/build/types/metrics/web-vitals/lib/onHidden.d.ts.map +1 -1
  77. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +1 -1
  78. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts.map +1 -1
  79. package/build/types/metrics/web-vitals/lib/runOnce.d.ts.map +1 -1
  80. package/build/types/metrics/web-vitals/lib/whenActivated.d.ts.map +1 -1
  81. package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts.map +1 -1
  82. package/build/types/metrics/web-vitals/onFCP.d.ts.map +1 -1
  83. package/build/types/metrics/web-vitals/onTTFB.d.ts.map +1 -1
  84. package/build/types/metrics/web-vitals/types.d.ts +1 -1
  85. package/build/types/metrics/web-vitals/types.d.ts.map +1 -1
  86. package/build/types/metrics/webVitalSpans.d.ts +15 -9
  87. package/build/types/metrics/webVitalSpans.d.ts.map +1 -1
  88. package/build/types/types.d.ts +1 -1
  89. package/package.json +6 -15
  90. package/build/cjs/metrics/cls.js +0 -64
  91. package/build/cjs/metrics/cls.js.map +0 -1
  92. package/build/esm/metrics/cls.js +0 -61
  93. package/build/esm/metrics/cls.js.map +0 -1
  94. package/build/types/metrics/cls.d.ts +0 -17
  95. package/build/types/metrics/cls.d.ts.map +0 -1
  96. package/build/types-ts3.8/debug-build.d.ts +0 -7
  97. package/build/types-ts3.8/getNativeImplementation.d.ts +0 -69
  98. package/build/types-ts3.8/htmlTreeAsString.d.ts +0 -11
  99. package/build/types-ts3.8/index.d.ts +0 -17
  100. package/build/types-ts3.8/instrument/dom.d.ts +0 -11
  101. package/build/types-ts3.8/instrument/history.d.ts +0 -15
  102. package/build/types-ts3.8/instrument/location.d.ts +0 -13
  103. package/build/types-ts3.8/instrument/xhr.d.ts +0 -14
  104. package/build/types-ts3.8/is.d.ts +0 -7
  105. package/build/types-ts3.8/metrics/browserMetrics.d.ts +0 -119
  106. package/build/types-ts3.8/metrics/cls.d.ts +0 -17
  107. package/build/types-ts3.8/metrics/elementTiming.d.ts +0 -21
  108. package/build/types-ts3.8/metrics/inp.d.ts +0 -35
  109. package/build/types-ts3.8/metrics/instrument.d.ts +0 -121
  110. package/build/types-ts3.8/metrics/lcp.d.ts +0 -22
  111. package/build/types-ts3.8/metrics/resourceTiming.d.ts +0 -13
  112. package/build/types-ts3.8/metrics/utils.d.ts +0 -73
  113. package/build/types-ts3.8/metrics/web-vitals/getCLS.d.ts +0 -26
  114. package/build/types-ts3.8/metrics/web-vitals/getINP.d.ts +0 -34
  115. package/build/types-ts3.8/metrics/web-vitals/getLCP.d.ts +0 -16
  116. package/build/types-ts3.8/metrics/web-vitals/lib/InteractionManager.d.ts +0 -37
  117. package/build/types-ts3.8/metrics/web-vitals/lib/LCPEntryManager.d.ts +0 -5
  118. package/build/types-ts3.8/metrics/web-vitals/lib/LayoutShiftManager.d.ts +0 -7
  119. package/build/types-ts3.8/metrics/web-vitals/lib/bindReporter.d.ts +0 -7
  120. package/build/types-ts3.8/metrics/web-vitals/lib/generateUniqueID.d.ts +0 -7
  121. package/build/types-ts3.8/metrics/web-vitals/lib/getActivationStart.d.ts +0 -2
  122. package/build/types-ts3.8/metrics/web-vitals/lib/getNavigationEntry.d.ts +0 -2
  123. package/build/types-ts3.8/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +0 -5
  124. package/build/types-ts3.8/metrics/web-vitals/lib/globalListeners.d.ts +0 -11
  125. package/build/types-ts3.8/metrics/web-vitals/lib/initMetric.d.ts +0 -21
  126. package/build/types-ts3.8/metrics/web-vitals/lib/initUnique.d.ts +0 -7
  127. package/build/types-ts3.8/metrics/web-vitals/lib/observe.d.ts +0 -23
  128. package/build/types-ts3.8/metrics/web-vitals/lib/onHidden.d.ts +0 -27
  129. package/build/types-ts3.8/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +0 -15
  130. package/build/types-ts3.8/metrics/web-vitals/lib/runOnce.d.ts +0 -2
  131. package/build/types-ts3.8/metrics/web-vitals/lib/whenActivated.d.ts +0 -2
  132. package/build/types-ts3.8/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +0 -6
  133. package/build/types-ts3.8/metrics/web-vitals/onFCP.d.ts +0 -11
  134. package/build/types-ts3.8/metrics/web-vitals/onTTFB.d.ts +0 -20
  135. package/build/types-ts3.8/metrics/web-vitals/types/base.d.ts +0 -106
  136. package/build/types-ts3.8/metrics/web-vitals/types/cls.d.ts +0 -58
  137. package/build/types-ts3.8/metrics/web-vitals/types/fcp.d.ts +0 -47
  138. package/build/types-ts3.8/metrics/web-vitals/types/inp.d.ts +0 -150
  139. package/build/types-ts3.8/metrics/web-vitals/types/lcp.d.ts +0 -74
  140. package/build/types-ts3.8/metrics/web-vitals/types/ttfb.d.ts +0 -60
  141. package/build/types-ts3.8/metrics/web-vitals/types.d.ts +0 -78
  142. package/build/types-ts3.8/metrics/webVitalSpans.d.ts +0 -65
  143. package/build/types-ts3.8/networkUtils.d.ts +0 -28
  144. package/build/types-ts3.8/types.d.ts +0 -15
@@ -1,34 +0,0 @@
1
- import { INPMetric, INPReportOpts, MetricRatingThresholds } from './types';
2
- /** Thresholds for INP. See https://web.dev/articles/inp#what_is_a_good_inp_score */
3
- export declare const INPThresholds: MetricRatingThresholds;
4
- /**
5
- * Calculates the [INP](https://web.dev/articles/inp) value for the current
6
- * page and calls the `callback` function once the value is ready, along with
7
- * the `event` performance entries reported for that interaction. The reported
8
- * value is a `DOMHighResTimeStamp`.
9
- *
10
- * A custom `durationThreshold` configuration option can optionally be passed
11
- * to control what `event-timing` entries are considered for INP reporting. The
12
- * default threshold is `40`, which means INP scores of less than 40 will not
13
- * be reported. To avoid reporting no interactions in these cases, the library
14
- * will fall back to the input delay of the first interaction. Note that this
15
- * will not affect your 75th percentile INP value unless that value is also
16
- * less than 40 (well below the recommended
17
- * [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
18
- *
19
- * If the `reportAllChanges` configuration option is set to `true`, the
20
- * `callback` function will be called as soon as the value is initially
21
- * determined as well as any time the value changes throughout the page
22
- * lifespan.
23
- *
24
- * _**Important:** INP should be continually monitored for changes throughout
25
- * the entire lifespan of a page—including if the user returns to the page after
26
- * it's been hidden/backgrounded. However, since browsers often [will not fire
27
- * additional callbacks once the user has backgrounded a
28
- * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),
29
- * `callback` is always called when the page's visibility state changes to
30
- * hidden. As a result, the `callback` function might be called multiple times
31
- * during the same page load._
32
- */
33
- export declare const onINP: (onReport: (metric: INPMetric) => void, opts?: INPReportOpts) => void;
34
- //# sourceMappingURL=getINP.d.ts.map
@@ -1,16 +0,0 @@
1
- import { LCPMetric, MetricRatingThresholds, ReportOpts } from './types';
2
- /** Thresholds for LCP. See https://web.dev/articles/lcp#what_is_a_good_lcp_score */
3
- export declare const LCPThresholds: MetricRatingThresholds;
4
- /**
5
- * Calculates the [LCP](https://web.dev/articles/lcp) value for the current page and
6
- * calls the `callback` function once the value is ready (along with the
7
- * relevant `largest-contentful-paint` performance entry used to determine the
8
- * value). The reported value is a `DOMHighResTimeStamp`.
9
- *
10
- * If the `reportAllChanges` configuration option is set to `true`, the
11
- * `callback` function will be called any time a new `largest-contentful-paint`
12
- * performance entry is dispatched, or once the final value of the metric has
13
- * been determined.
14
- */
15
- export declare const onLCP: (onReport: (metric: LCPMetric) => void, opts?: ReportOpts) => void;
16
- //# sourceMappingURL=getLCP.d.ts.map
@@ -1,37 +0,0 @@
1
- export interface Interaction {
2
- _latency: number;
3
- id: number;
4
- entries: PerformanceEventTiming[];
5
- }
6
- /**
7
- *
8
- */
9
- export declare class InteractionManager {
10
- /**
11
- * A list of longest interactions on the page (by latency) sorted so the
12
- * longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER
13
- * long.
14
- */
15
- _longestInteractionList: Interaction[];
16
- /**
17
- * A mapping of longest interactions by their interaction ID.
18
- * This is used for faster lookup.
19
- */
20
- _longestInteractionMap: Map<number, Interaction>;
21
- _onBeforeProcessingEntry?: (entry: PerformanceEventTiming) => void;
22
- _onAfterProcessingINPCandidate?: (interaction: Interaction) => void;
23
- _resetInteractions(): void;
24
- /**
25
- * Returns the estimated p98 longest interaction based on the stored
26
- * interaction candidates and the interaction count for the current page.
27
- */
28
- _estimateP98LongestInteraction(): Interaction | undefined;
29
- /**
30
- * Takes a performance entry and adds it to the list of worst interactions
31
- * if its duration is long enough to make it among the worst. If the
32
- * entry is part of an existing interaction, it is merged and the latency
33
- * and entries list is updated as needed.
34
- */
35
- _processEntry(entry: PerformanceEventTiming): void;
36
- }
37
- //# sourceMappingURL=InteractionManager.d.ts.map
@@ -1,5 +0,0 @@
1
- export declare class LCPEntryManager {
2
- _onBeforeProcessingEntry?: (entry: LargestContentfulPaint) => void;
3
- _processEntry(entry: LargestContentfulPaint): void;
4
- }
5
- //# sourceMappingURL=LCPEntryManager.d.ts.map
@@ -1,7 +0,0 @@
1
- export declare class LayoutShiftManager {
2
- _onAfterProcessingUnexpectedShift?: (entry: LayoutShift) => void;
3
- _sessionValue: number;
4
- _sessionEntries: LayoutShift[];
5
- _processEntry(entry: LayoutShift): void;
6
- }
7
- //# sourceMappingURL=LayoutShiftManager.d.ts.map
@@ -1,7 +0,0 @@
1
- import { MetricRatingThresholds, MetricType } from '../types';
2
- export declare const bindReporter: <MetricName extends MetricType["name"]>(callback: (metric: Extract<MetricType, {
3
- name: MetricName;
4
- }>) => void, metric: Extract<MetricType, {
5
- name: MetricName;
6
- }>, thresholds: MetricRatingThresholds, reportAllChanges?: boolean) => (forceReport?: boolean) => void;
7
- //# sourceMappingURL=bindReporter.d.ts.map
@@ -1,7 +0,0 @@
1
- /**
2
- * Performantly generate a unique, 30-char string by combining a version
3
- * number, the current timestamp with a 13-digit number integer.
4
- * @return {string}
5
- */
6
- export declare const generateUniqueID: () => string;
7
- //# sourceMappingURL=generateUniqueID.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const getActivationStart: () => number;
2
- //# sourceMappingURL=getActivationStart.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const getNavigationEntry: (checkResponseStart?: boolean) => PerformanceNavigationTiming | void;
2
- //# sourceMappingURL=getNavigationEntry.d.ts.map
@@ -1,5 +0,0 @@
1
- export declare const getVisibilityWatcher: () => {
2
- readonly firstHiddenTime: number;
3
- onHidden(cb: () => void): void;
4
- };
5
- //# sourceMappingURL=getVisibilityWatcher.d.ts.map
@@ -1,11 +0,0 @@
1
- /**
2
- * web-vitals 5.1.0 switched listeners to be added on the window rather than the document.
3
- * Instead of having to check for window/document every time we add a listener, we can use this function.
4
- */
5
- export declare function addPageListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions): void;
6
- /**
7
- * web-vitals 5.1.0 switched listeners to be removed from the window rather than the document.
8
- * Instead of having to check for window/document every time we remove a listener, we can use this function.
9
- */
10
- export declare function removePageListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions): void;
11
- //# sourceMappingURL=globalListeners.d.ts.map
@@ -1,21 +0,0 @@
1
- import { MetricType } from '../types';
2
- export declare const initMetric: <MetricName extends MetricType["name"]>(name: MetricName, value?: number) => {
3
- name: MetricName;
4
- value: number;
5
- rating: "good";
6
- delta: number;
7
- entries: (Extract<import("../types").CLSMetric, {
8
- name: MetricName;
9
- }> | Extract<import("../types").FCPMetric, {
10
- name: MetricName;
11
- }> | Extract<import("../types").INPMetric, {
12
- name: MetricName;
13
- }> | Extract<import("../types").LCPMetric, {
14
- name: MetricName;
15
- }> | Extract<import("../types").TTFBMetric, {
16
- name: MetricName;
17
- }>)["entries"];
18
- id: string;
19
- navigationType: "navigate" | "reload" | "back-forward" | "back-forward-cache" | "prerender" | "restore";
20
- };
21
- //# sourceMappingURL=initMetric.d.ts.map
@@ -1,7 +0,0 @@
1
- /**
2
- * A function that accepts and identity object and a class object and returns
3
- * either a new instance of that class or an existing instance, if the
4
- * identity object was previously used.
5
- */
6
- export declare function initUnique<T>(identityObj: object, ClassObj: new () => T): T;
7
- //# sourceMappingURL=initUnique.d.ts.map
@@ -1,23 +0,0 @@
1
- interface PerformanceEntryMap {
2
- event: PerformanceEventTiming[];
3
- 'first-input': PerformanceEventTiming[];
4
- 'layout-shift': LayoutShift[];
5
- 'largest-contentful-paint': LargestContentfulPaint[];
6
- 'long-animation-frame': PerformanceLongAnimationFrameTiming[];
7
- paint: PerformancePaintTiming[];
8
- navigation: PerformanceNavigationTiming[];
9
- resource: PerformanceResourceTiming[];
10
- longtask: PerformanceEntry[];
11
- element: PerformanceEntry[];
12
- }
13
- /**
14
- * Takes a performance entry type and a callback function, and creates a
15
- * `PerformanceObserver` instance that will observe the specified entry type
16
- * with buffering enabled and call the callback _for each entry_.
17
- *
18
- * This function also feature-detects entry support and wraps the logic in a
19
- * try/catch to avoid errors in unsupporting browsers.
20
- */
21
- export declare const observe: <K extends keyof PerformanceEntryMap>(type: K, callback: (entries: PerformanceEntryMap[K]) => void, opts?: PerformanceObserverInit) => PerformanceObserver | undefined;
22
- export {};
23
- //# sourceMappingURL=observe.d.ts.map
@@ -1,27 +0,0 @@
1
- export interface OnHiddenCallback {
2
- (event: Event): void;
3
- }
4
- /**
5
- * Sentry-specific change:
6
- *
7
- * This function's logic was NOT updated to web-vitals 4.2.4 or 5.x but we continue
8
- * to use the web-vitals 3.5.2 version due to having stricter browser support.
9
- *
10
- * PR with context that made the changes:
11
- * https://github.com/GoogleChrome/web-vitals/pull/442/files#r1530492402
12
- *
13
- * The PR removed listening to the `pagehide` event, in favour of only listening to
14
- * the `visibilitychange` event. This is "more correct" but some browsers we still
15
- * support (Safari <14.4) don't fully support `visibilitychange` or have known bugs
16
- * with respect to the `visibilitychange` event.
17
- *
18
- * TODO (v11): If we decide to drop support for Safari 14.4, we can use the logic
19
- * from web-vitals 4.2.4. In this case, we also need to update the integration tests
20
- * that currently trigger the `pagehide` event to simulate the page being hidden.
21
- *
22
- * @param {OnHiddenCallback} cb - Callback to be executed when the page is hidden or unloaded.
23
- *
24
- * @deprecated use `whenIdleOrHidden` or `addPageListener('visibilitychange')` instead
25
- */
26
- export declare const onHidden: (cb: OnHiddenCallback) => void;
27
- //# sourceMappingURL=onHidden.d.ts.map
@@ -1,15 +0,0 @@
1
- declare global {
2
- interface Performance {
3
- interactionCount: number;
4
- }
5
- }
6
- /**
7
- * Returns the `interactionCount` value using the native API (if available)
8
- * or the polyfill estimate in this module.
9
- */
10
- export declare const getInteractionCount: () => number;
11
- /**
12
- * Feature detects native support or initializes the polyfill if needed.
13
- */
14
- export declare const initInteractionCountPolyfill: () => void;
15
- //# sourceMappingURL=interactionCountPolyfill.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const runOnce: (cb: () => void) => () => void;
2
- //# sourceMappingURL=runOnce.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const whenActivated: (callback: () => void) => void;
2
- //# sourceMappingURL=whenActivated.d.ts.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Runs the passed callback during the next idle period, or immediately
3
- * if the browser's visibility state is (or becomes) hidden.
4
- */
5
- export declare const whenIdleOrHidden: (cb: () => void) => void;
6
- //# sourceMappingURL=whenIdleOrHidden.d.ts.map
@@ -1,11 +0,0 @@
1
- import { FCPMetric, MetricRatingThresholds, ReportOpts } from './types';
2
- /** Thresholds for FCP. See https://web.dev/articles/fcp#what_is_a_good_fcp_score */
3
- export declare const FCPThresholds: MetricRatingThresholds;
4
- /**
5
- * Calculates the [FCP](https://web.dev/articles/fcp) value for the current page and
6
- * calls the `callback` function once the value is ready, along with the
7
- * relevant `paint` performance entry used to determine the value. The reported
8
- * value is a `DOMHighResTimeStamp`.
9
- */
10
- export declare const onFCP: (onReport: (metric: FCPMetric) => void, opts?: ReportOpts) => void;
11
- //# sourceMappingURL=onFCP.d.ts.map
@@ -1,20 +0,0 @@
1
- import { MetricRatingThresholds, ReportOpts, TTFBMetric } from './types';
2
- /** Thresholds for TTFB. See https://web.dev/articles/ttfb#what_is_a_good_ttfb_score */
3
- export declare const TTFBThresholds: MetricRatingThresholds;
4
- /**
5
- * Calculates the [TTFB](https://web.dev/articles/ttfb) value for the
6
- * current page and calls the `callback` function once the page has loaded,
7
- * along with the relevant `navigation` performance entry used to determine the
8
- * value. The reported value is a `DOMHighResTimeStamp`.
9
- *
10
- * Note, this function waits until after the page is loaded to call `callback`
11
- * in order to ensure all properties of the `navigation` entry are populated.
12
- * This is useful if you want to report on other metrics exposed by the
13
- * [Navigation Timing API](https://w3c.github.io/navigation-timing/). For
14
- * example, the TTFB metric starts from the page's [time
15
- * origin](https://www.w3.org/TR/hr-time-2/#sec-time-origin), which means it
16
- * includes time spent on DNS lookup, connection negotiation, network latency,
17
- * and server processing time.
18
- */
19
- export declare const onTTFB: (onReport: (metric: TTFBMetric) => void, opts?: ReportOpts) => void;
20
- //# sourceMappingURL=onTTFB.d.ts.map
@@ -1,106 +0,0 @@
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
@@ -1,58 +0,0 @@
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
@@ -1,47 +0,0 @@
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